Page MenuHomec4science

equilibrium_constraints.hpp
No OneTemporary

File Metadata

Created
Tue, Jul 9, 19:05

equilibrium_constraints.hpp

/* =============================================================================
Copyright (c) 2014 - 2016
F. Georget <fabieng@princeton.edu> Princeton University
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_SYSTEMS_UNSATURATED_EQUILIBRUMCONSTRAINTS_HPP
#define SPECMICP_REACTMICP_SYSTEMS_UNSATURATED_EQUILIBRUMCONSTRAINTS_HPP
#include "../../../types.hpp"
#include "../../../dfpm/meshes/mesh1dfwd.hpp"
#include <memory>
namespace specmicp {
struct AdimensionalSystemConstraints;
struct AdimensionalSystemSolverOptions;
namespace reactmicp {
namespace systems {
namespace unsaturated {
//! \brief Constraints for the equilibrium stagger
class SPECMICP_DLL_PUBLIC EquilibriumConstraints
{
public:
//! \brief Build a new set of constraints
EquilibriumConstraints(index_t nb_nodes);
//! \brief Build a new set of constraints
EquilibriumConstraints(index_t nb_nodes,
const AdimensionalSystemSolverOptions& opts);
~EquilibriumConstraints();
//! \brief Add a new constraints to the set of constraints
//!
//! \param constraints A set of constraints
//! \return the index of the set of constraints
//!
//! \sa new_constraints
std::size_t add_constraints(
const AdimensionalSystemConstraints& constraints);
//! \brief Add a new default constraint to the system
//!
//! \return the index of the set of constraints
//!
//! The constraints can be obtained through operator[]
//!
//! Ex :
//!
//! EquilibriumConstraints constraints(10);
//! auto id = constraints.new_constraints();
//! auto& constraint_to_modify = constraints[];
//! // to stuff to constraint_to_modify
//!
std::size_t new_constraints();
//! \brief Return the constraint with index 'index_constraint'
//!
//! \param index_constraint is the index return by add_constraints,
//! or new_constraints
AdimensionalSystemConstraints& operator[] (std::size_t index_constraint);
//! \brief Set the constraint to be 'id_constraint' for each node in 'nodes'
void set_constraints(
std::size_t id_constraint,
const std::vector<index_t>& nodes
);
//! \brief Set constraints for each node
//!
//! \param constraints_for_each_node Vector containing the index of the
//! constraint for each node
void set_constraints(
const std::vector<std::size_t>& constraints_for_each_node);
//! \brief Set the constraint for all node
void set_constraint_for_all(std::size_t id_constraint);
//! \brief Return the constraint for node (node)
AdimensionalSystemConstraints& get_constraints(index_t node);
//! \brief Add a fixed node
void add_fixed_node(index_t node);
//! \brief Add a list of fixed nodes
void add_fixed_nodes(std::vector<index_t> fixed_nodes);
//! \brief Return true if the node is fixed
bool is_fixed_node(index_t node);
//! \brief Set the options
AdimensionalSystemSolverOptions& get_options();
private:
struct EquilibriumConstraintsImpl;
std::unique_ptr<EquilibriumConstraintsImpl> m_impl;
};
//! \brief Return a constraint container for the EquilibriumStagger
std::shared_ptr<EquilibriumConstraints> equilibrium_constraints(
mesh::Mesh1DPtr the_mesh
);
} //end namespace unsaturated
} //end namespace systems
} //end namespace reactmicp
} //end namespace specmicp
#endif // SPECMICP_REACTMICP_SYSTEMS_UNSATURATED_EQUILIBRUMCONSTRAINTS_HPP

Event Timeline