OGS
DeactivatedSubdomain.cpp
Go to the documentation of this file.
1 
13 #include "DeactivatedSubdomain.h"
14 
15 #include "BaseLib/Error.h"
17 #include "MeshLib/Mesh.h"
18 #include "MeshLib/Node.h"
19 #include "ParameterLib/Parameter.h"
20 
21 namespace ProcessLib
22 {
24  "zero_for_element_deactivation_approach";
25 
27  std::unique_ptr<MeshLib::Mesh> deactivated_subdomain_mesh_,
28  std::vector<MeshLib::Node*>&& inner_nodes_,
29  std::vector<MeshLib::Node*>&& outer_nodes_)
30  : mesh(std::move(deactivated_subdomain_mesh_)),
31  inner_nodes(std::move(inner_nodes_)),
32  outer_nodes(std::move(outer_nodes_))
33 {
34 }
35 
38  std::pair<Eigen::Vector3d, Eigen::Vector3d>
39  line_segment,
40  std::vector<int>&& materialIDs_,
41  std::vector<std::unique_ptr<DeactivatedSubdomainMesh>>&&
42  deactivated_subdomain_meshes_,
43  ParameterLib::Parameter<double> const* const boundary_value_parameter)
44  : time_interval(std::move(time_interval_)),
45  line_segment(line_segment),
46  materialIDs(std::move(materialIDs_)),
47  deactivated_subdomain_meshes(std::move(deactivated_subdomain_meshes_)),
48  boundary_value_parameter(boundary_value_parameter)
49 {
50 }
51 
53 {
54  return time_interval.getSupportMin() <= t &&
56 }
57 
59  double const time) const
60 {
61  // Line from a to b.
62  auto const& a = line_segment.first;
63  auto const& b = line_segment.second;
64  // Tangent vector t = (b - a)/|b - a|.
65  Eigen::Vector3d const t = (b - a).normalized();
66 
67  // Position r on the line at given time.
68  Eigen::Vector3d const r = a + t * time_interval.getValue(time);
69  Eigen::Map<Eigen::Vector3d const> const p{point.getCoords(), 3};
70 
71  // Return true if p is "behind" the plane through r.
72  return (p - r).dot(t) <= 0;
73 }
74 } // namespace ProcessLib
Definition of the Element class.
Definition of the Mesh class.
Definition of the Node class.
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.
const T * getCoords() const
Definition: TemplatePoint.h:75
static const double r
PropertyVector< int > const * materialIDs(Mesh const &mesh)
Definition: Mesh.cpp:258
DeactivatedSubdomainMesh(std::unique_ptr< MeshLib::Mesh > deactivated_subdomain_mesh_, std::vector< MeshLib::Node * > &&inner_nodes_, std::vector< MeshLib::Node * > &&outer_nodes_)
std::pair< Eigen::Vector3d, Eigen::Vector3d > line_segment
MathLib::PiecewiseLinearInterpolation const time_interval
DeactivatedSubdomain(MathLib::PiecewiseLinearInterpolation time_interval_, std::pair< Eigen::Vector3d, Eigen::Vector3d > line_segment, std::vector< int > &&materialIDs_, std::vector< std::unique_ptr< DeactivatedSubdomainMesh >> &&deactivated_subdomain_meshes_, ParameterLib::Parameter< double > const *boundary_value_parameter)
bool isDeactivated(MathLib::Point3d const &point, double const time) const
static const std::string zero_parameter_name
bool isInTimeSupportInterval(double const t) const