31 MeshLib::Mesh const& src_mesh, std::string
const& property_name)
32 : _src_mesh(src_mesh), _property_name(property_name)
41 ERR(
"MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh() "
42 "dimension of source (dim = {:d}) and destination (dim = {:d}) "
43 "mesh does not match.",
51 "MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh() "
52 "implemented only for 2D case at the moment.");
65 INFO(
"Create new PropertyVector '{:s}' of type double.",
74 "Could not get or create a PropertyVector of type double using "
75 "the given name '{:s}'.",
90 std::vector<double> interpolated_src_node_properties(
93 interpolated_src_node_properties);
102 auto const& dest_elements(dest_mesh.
getElements());
103 const std::size_t n_dest_elements(dest_elements.size());
104 for (std::size_t k(0); k < n_dest_elements; k++)
118 std::vector<std::vector<MeshLib::Node*>
const*>
const nodes =
123 double average_value(0.0);
125 for (
auto const* nodes_vec : nodes)
127 for (
auto const* node : *nodes_vec)
133 interpolated_src_node_properties[node->getID()];
142 "Mesh2MeshInterpolation: Could not find values in source mesh "
143 "for the element {:d}.",
146 dest_properties[k] = average_value / cnt;
152 std::vector<double>& interpolated_properties)
const
160 auto const* elem_props =
164 const std::size_t n_src_nodes(src_nodes.size());
165 for (std::size_t k(0); k < n_src_nodes; k++)
167 const std::size_t n_con_elems(
169 interpolated_properties[k] = (*elem_props)
171 for (std::size_t j(1); j < n_con_elems; j++)
173 interpolated_properties[k] +=
178 interpolated_properties[k] /= n_con_elems;
Definition of the AABB class.
Definition of the Element class.
Definition of the Grid class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Implementation of the Mesh2MeshPropertyInterpolation class.
Definition of mesh-related Enumerations.
Definition of the Mesh class.
Definition of the Node class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Eigen::Vector3d const & getMaxPoint() const
Eigen::Vector3d const & getMinPoint() const
bool containsPointXY(T const &pnt) const
std::vector< std::vector< POINT * > const * > getPntVecsOfGridCellsIntersectingCuboid(Eigen::Vector3d const &min_pnt, Eigen::Vector3d const &max_pnt) const
virtual MeshElemType getGeomType() const =0
virtual unsigned getNumberOfBaseNodes() const =0
virtual Node *const * getNodes() const =0
Get array of element nodes.
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Properties & getProperties()
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
std::size_t getNumberOfElements() const
Get the number of elements.
bool existsPropertyVector(std::string_view name) const
PropertyVector< T > * createNewPropertyVector(std::string_view name, MeshItemType mesh_item_type, std::size_t n_components=1)
PropertyVector< T > const * getPropertyVector(std::string_view name) const
constexpr std::size_t size() const
bool isPointInElementXY(MathLib::Point3d const &p, Element const &e)