/** * \file * \copyright * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license * */ #pragma once #include "MathLib/LinAlg/GlobalMatrixVectorTypes.h" #include "ParameterLib/Parameter.h" #include "ProcessLib/BoundaryConditionAndSourceTerm/BoundaryConditionConfig.h" #include "ProcessLib/BoundaryConditionAndSourceTerm/SourceTermConfig.h" // DeactivatedSubdomain cannot be forwardly declared because that // std::unique_ptr type member requires its full // definition (see https://stackoverflow.com/a/6089065). #include "ProcessLib/DeactivatedSubdomain.h" namespace MeshLib { class Mesh; template class PropertyVector; } // namespace MeshLib namespace NumLib { class LocalToGlobalIndexMap; } namespace ProcessLib { class SourceTerm; class BoundaryCondition; class Process; } // namespace ProcessLib namespace ProcessLib { /// A named process variable. Its properties includes the mesh, and the initial /// and boundary conditions as well as the source terms. class ProcessVariable { public: ProcessVariable( BaseLib::ConfigTree const& config, MeshLib::Mesh& mesh, std::vector> const& meshes, std::vector> const& parameters, std::map> const& curves); ProcessVariable(ProcessVariable&& other); std::string const& getName() const; /// Returns a mesh on which the process variable is defined. MeshLib::Mesh const& getMesh() const; std::vector> const& getDeactivatedSubdomains() const { return _deactivated_subdomains; } void updateDeactivatedSubdomains(double const time); std::vector const& getActiveElementIDs() const { return _ids_of_active_elements; } /// Returns the number of components of the process variable. int getNumberOfGlobalComponents() const { return _n_components; } std::vector> createBoundaryConditions( const NumLib::LocalToGlobalIndexMap& dof_table, const int variable_id, unsigned const integration_order, std::vector> const& parameters, Process const& process); std::vector> createSourceTerms( const NumLib::LocalToGlobalIndexMap& dof_table, const int variable_id, unsigned const integration_order, std::vector> const& parameters); ParameterLib::Parameter const& getInitialCondition() const { return _initial_condition; } unsigned getShapeFunctionOrder() const { return _shapefunction_order; } private: std::string const _name; MeshLib::Mesh& _mesh; const int _n_components; /// The polynomial order of the process variable's shape functions. /// /// Requires an appropriate mesh. /// /// The order of the shape functions can not be higher than the maximum /// available order for the underlying geometric elements. For example the /// second order shape functions for a hexahedron are only possible if the /// geometric element is at least a 20-node hexahedron element /// (MeshLib::TemplateElement), whereas linear shape /// functions are also available on the 8-node hexahedron /// (MeshLib::TemplateElement). /// /// \sa MeshLib::CellRule MeshLib::FaceRule MeshLib::EdgeRule. unsigned _shapefunction_order; std::vector> _deactivated_subdomains; /// IDs of the active elements. It is initialized only if there are /// deactivated subdomains. mutable std::vector _ids_of_active_elements; void createBoundaryConditionsForDeactivatedSubDomains( const NumLib::LocalToGlobalIndexMap& dof_table, const int variable_id, std::vector> const& parameters, std::vector>& bcs); ParameterLib::Parameter const& _initial_condition; std::vector _bc_configs; std::vector _source_term_configs; }; } // namespace ProcessLib