OGS
DeactivatedSubdomain.cpp
Go to the documentation of this file.
1
14
15#include <range/v3/algorithm/contains.hpp>
16
17#include "BaseLib/Error.h"
19#include "MeshLib/Node.h"
21
22namespace ProcessLib
23{
25 "zero_for_element_deactivation_approach";
26
28{
29 return time_interval.getSupportMin() <= t &&
31}
32
34 double const time) const
35{
36 auto const& bulk_element_ids = deactivated_subdomain_mesh.bulk_element_ids;
37 if (!bulk_element_ids.contains(element.getID()))
38 {
39 return false;
40 }
41
42 if (!line_segment)
43 {
44 return true;
45 }
46
47 auto const& element_center = getCenterOfGravity(element);
48 // Line from a to b.
49 auto const& a = line_segment->first;
50 auto const& b = line_segment->second;
51 // Tangent vector t = (b - a)/|b - a|.
52 Eigen::Vector3d const t = (b - a).normalized();
53
54 // Position r on the line at given time.
55 auto const curve_position = time_interval.getValue(time);
56 Eigen::Vector3d const r = a + t * curve_position;
57
58 // Return true if p is "behind" the plane through r.
59 return (element_center.asEigenVector3d() - r).dot(t) <= 0;
60}
61} // namespace ProcessLib
Definition of the Element class.
Definition of the Node class.
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
std::unordered_set< std::size_t > bulk_element_ids
bool isDeactivated(MeshLib::Element const &element, double const time) const
static PROCESSLIB_EXPORT const std::string zero_parameter_name
MathLib::PiecewiseLinearInterpolation time_interval
DeactivatedSubdomainMesh deactivated_subdomain_mesh
bool isInTimeSupportInterval(double const t) const
std::optional< std::pair< Eigen::Vector3d, Eigen::Vector3d > > line_segment