Skip to content
Snippets Groups Projects
Commit 06fbd4f8 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[PL] Store GeoObject& in ProcessVar and BCs.

parent 02a0b778
No related branches found
No related tags found
No related merge requests found
...@@ -28,14 +28,14 @@ namespace ProcessLib ...@@ -28,14 +28,14 @@ namespace ProcessLib
class BoundaryConditionConfig class BoundaryConditionConfig
{ {
public: public:
BoundaryConditionConfig(GeoLib::GeoObject const* const geometry) BoundaryConditionConfig(GeoLib::GeoObject const& geometry)
: _geometry(geometry) : _geometry(geometry)
{ } { }
virtual ~BoundaryConditionConfig() = default; virtual ~BoundaryConditionConfig() = default;
protected: protected:
GeoLib::GeoObject const* const _geometry; GeoLib::GeoObject const& _geometry;
}; };
...@@ -43,8 +43,8 @@ protected: ...@@ -43,8 +43,8 @@ protected:
class NeumannBcConfig : public BoundaryConditionConfig class NeumannBcConfig : public BoundaryConditionConfig
{ {
public: public:
NeumannBcConfig(GeoLib::GeoObject const* const geometry, NeumannBcConfig(GeoLib::GeoObject const& geometry,
BaseLib::ConfigTree const& config) BaseLib::ConfigTree const& config)
: BoundaryConditionConfig(geometry) : BoundaryConditionConfig(geometry)
{ {
DBUG("Constructing NeumannBcConfig from config."); DBUG("Constructing NeumannBcConfig from config.");
...@@ -71,7 +71,8 @@ public: ...@@ -71,7 +71,8 @@ public:
/// The elements are appended to the \c elements vector. /// The elements are appended to the \c elements vector.
void initialize(MeshGeoToolsLib::BoundaryElementsSearcher& searcher) void initialize(MeshGeoToolsLib::BoundaryElementsSearcher& searcher)
{ {
std::vector<MeshLib::Element*> elems = searcher.getBoundaryElements(*_geometry); std::vector<MeshLib::Element*> elems =
searcher.getBoundaryElements(_geometry);
// deep copy because the searcher destroys the elements. // deep copy because the searcher destroys the elements.
std::transform(elems.cbegin(), elems.cend(), std::transform(elems.cbegin(), elems.cend(),
......
...@@ -73,11 +73,14 @@ ProcessVariable::ProcessVariable(BaseLib::ConfigTree const& config, ...@@ -73,11 +73,14 @@ ProcessVariable::ProcessVariable(BaseLib::ConfigTree const& config,
//! \ogs_file_param{boundary_condition__geometry} //! \ogs_file_param{boundary_condition__geometry}
bc_config.getConfigParameter<std::string>("geometry"); bc_config.getConfigParameter<std::string>("geometry");
GeoLib::GeoObject const* const geometry = GeoLib::GeoObject const* const geometry_ptr =
geometries.getGeoObject(geometrical_set_name, geometry_name); geometries.getGeoObject(geometrical_set_name, geometry_name);
assert(geometry_ptr != nullptr);
GeoLib::GeoObject const& geometry = *geometry_ptr;
DBUG( DBUG(
"Found geometry type \"%s\"", "Found geometry type \"%s\"",
GeoLib::convertGeoTypeToString(geometry->getGeoType()).c_str()); GeoLib::convertGeoTypeToString(geometry.getGeoType()).c_str());
// Construct type dependent boundary condition // Construct type dependent boundary condition
//! \ogs_file_param{boundary_condition__type} //! \ogs_file_param{boundary_condition__type}
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace ProcessLib namespace ProcessLib
{ {
UniformDirichletBoundaryCondition::UniformDirichletBoundaryCondition( UniformDirichletBoundaryCondition::UniformDirichletBoundaryCondition(
GeoLib::GeoObject const* const geometry, BaseLib::ConfigTree const& config) GeoLib::GeoObject const& geometry, BaseLib::ConfigTree const& config)
: _geometry(geometry) : _geometry(geometry)
{ {
DBUG("Constructing UniformDirichletBoundaryCondition from config."); DBUG("Constructing UniformDirichletBoundaryCondition from config.");
...@@ -30,7 +30,7 @@ UniformDirichletBoundaryCondition::UniformDirichletBoundaryCondition( ...@@ -30,7 +30,7 @@ UniformDirichletBoundaryCondition::UniformDirichletBoundaryCondition(
} }
UniformDirichletBoundaryCondition::UniformDirichletBoundaryCondition( UniformDirichletBoundaryCondition::UniformDirichletBoundaryCondition(
GeoLib::GeoObject const* const geometry, double value) GeoLib::GeoObject const& geometry, double value)
: _value(value), _geometry(geometry) : _value(value), _geometry(geometry)
{ {
DBUG("Constructed UniformDirichletBoundaryCondition using value %g", DBUG("Constructed UniformDirichletBoundaryCondition using value %g",
...@@ -51,7 +51,7 @@ void UniformDirichletBoundaryCondition::initialize( ...@@ -51,7 +51,7 @@ void UniformDirichletBoundaryCondition::initialize(
{ {
// Find nodes' ids on the given mesh on which this boundary condition // Find nodes' ids on the given mesh on which this boundary condition
// is defined. // is defined.
std::vector<std::size_t> ids = searcher.getMeshNodeIDs(*_geometry); std::vector<std::size_t> ids = searcher.getMeshNodeIDs(_geometry);
// convert mesh node ids to global index for the given component // convert mesh node ids to global index for the given component
bc.ids.reserve(bc.ids.size() + ids.size()); bc.ids.reserve(bc.ids.size() + ids.size());
......
...@@ -31,10 +31,10 @@ namespace ProcessLib ...@@ -31,10 +31,10 @@ namespace ProcessLib
class UniformDirichletBoundaryCondition class UniformDirichletBoundaryCondition
{ {
public: public:
UniformDirichletBoundaryCondition(GeoLib::GeoObject const* const geometry, UniformDirichletBoundaryCondition(GeoLib::GeoObject const& geometry,
BaseLib::ConfigTree const& config); BaseLib::ConfigTree const& config);
UniformDirichletBoundaryCondition(GeoLib::GeoObject const* const geometry, UniformDirichletBoundaryCondition(GeoLib::GeoObject const& geometry,
double value); double value);
/// Initialize Dirichlet type boundary conditions. /// Initialize Dirichlet type boundary conditions.
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
private: private:
double _value; double _value;
GeoLib::GeoObject const* const _geometry; GeoLib::GeoObject const& _geometry;
}; };
} // namespace ProcessLib } // namespace ProcessLib
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment