Page MenuHomec4science

adim_constraints.hpp
No OneTemporary

File Metadata

Created
Sat, Nov 16, 09:44

adim_constraints.hpp

/* =============================================================================
Copyright (c) 2014-2017 F. Georget <fabieng@princeton.edu> Princeton University
Copyright (c) 2017-2018 F. Georget <fabien.georget@epfl.ch> EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
============================================================================= */
#ifndef SPECMICP_REACTMICP_COMMON_ADIMCONSTRAINTS_HPP
#define SPECMICP_REACTMICP_COMMON_ADIMCONSTRAINTS_HPP
#include "specmicp_common/types.hpp"
#include "specmicp_common/pimpl_ptr.hpp"
#include "string"
namespace specmicp {
struct AdimensionalSystemConstraints;
namespace reactmicp {
namespace systems {
//! \brief The chemical constraints for a set of nodes
class SPECMICP_DLL_PUBLIC AdimReactMiCPConstraints
{
public:
AdimReactMiCPConstraints(index_t nb_nodes);
~AdimReactMiCPConstraints();
//! \brief Return true if the constraints exist
bool has_constraint(const std::string& name) const;
//! \brief Return the chemical constraint of the given node
const AdimensionalSystemConstraints& get_constraint(uindex_t node) const;
//! \brief Return the chemical constraint of the given node
//!
//! \warning Changing the constraint changes it for all node sharing the
//! same constraint. To modify only this node, use `fork_constraints' first.
//!
AdimensionalSystemConstraints& get_constraint(uindex_t node);
//! \brief Return the constraint identified by 'name'
const AdimensionalSystemConstraints& get_constraint(
const std::string& name) const;
//! \brief Return the constraint identified by 'name'
AdimensionalSystemConstraints& get_constraint(const std::string& name);
//! \brief Set a new constraints for the given node
AdimensionalSystemConstraints& fork_constraint(
uindex_t node,
const std::string& name
);
//! \brief Fork the given constraint
AdimensionalSystemConstraints& fork_constraint(
const std::string& old_name,
const std::string& new_name
);
//! \brief Add a constraint
AdimensionalSystemConstraints& add_constraint(
const std::string& name
);
//! \brief Set the constraint of the given node
void set_constraint(uindex_t node, const std::string& name);
private:
struct SPECMICP_DLL_LOCAL AdimReactMiCPConstraintsImpl;
utils::pimpl_ptr<AdimReactMiCPConstraintsImpl> m_impl;
};
} // namespace systems
} // namespace reactmicp
} // namespace specmicp
#endif // SPECMICP_REACTMICP_COMMON_ADIMCONSTRAINTS_HPP

Event Timeline