44 template<
class TGeometricalObjectType,
typename TArrayType>
84 const compressed_matrix<int>& rCoord,
86 bool InterpolateInternalVariables
89 typename TArrayType::iterator GeometricalObjectsBegin = rObjects.ptr_begin();
90 typename TArrayType::iterator GeometricalObjectsEnd = rObjects.ptr_end();
92 unsigned int to_be_deleted = 0;
93 unsigned int large_id = (GeometricalObjectsEnd - 1)->Id() * 10;
94 bool create_object =
false;
97 int number_object = 0;
98 int splitted_edges = 0;
100 std::vector<int> rAux;
104 KRATOS_INFO(
"LocalRefineTriangleMeshGeneric") <<
"****************** REFINING MESH ******************" << std::endl;
105 KRATOS_INFO(
"LocalRefineTriangleMeshGeneric") <<
"OLD NUMBER OBJECTS: " << GeometricalObjectsEnd - GeometricalObjectsBegin << std::endl;
109 unsigned int current_id = (GeometricalObjectsEnd - 1)->Id() + 1;
110 for (
typename TArrayType::iterator it = GeometricalObjectsBegin; it != GeometricalObjectsEnd; ++it) {
117 const unsigned int dimension = rGeom.WorkingSpaceDimension();
126 r_child_objects.resize(0);
127 for (
int i = 0;
i < number_object;
i++) {
128 const unsigned int base =
i * 3;
129 const unsigned int i0 = rAux[
t[base]];
130 const unsigned int i1 = rAux[
t[base + 1]];
131 const unsigned int i2 = rAux[
t[base + 2]];
135 rThisModelPart.
Nodes()(i0),
136 rThisModelPart.
Nodes()(i1),
137 rThisModelPart.
Nodes()(i2)
140 typename TGeometricalObjectType::Pointer p_object;
141 p_object = it->Create(
current_id, rGeom, it->pGetProperties());
142 p_object->Initialize(rCurrentProcessInfo);
143 p_object->InitializeSolutionStep(rCurrentProcessInfo);
144 p_object->FinalizeSolutionStep(rCurrentProcessInfo);
147 if (InterpolateInternalVariables) {
152 p_object->GetData() = it->GetData();
154 p_object->GetValue(SPLIT_ELEMENT) =
false;
157 r_child_objects.push_back(
typename TGeometricalObjectType::WeakPointer(p_object) );
160 rThisModelPart.
Nodes()(i0),
161 rThisModelPart.
Nodes()(i1),
162 rThisModelPart.
Nodes()(i2)
165 typename TGeometricalObjectType::Pointer p_object;
166 p_object = it->Create(
current_id, rGeom, it->pGetProperties());
167 p_object->Initialize(rCurrentProcessInfo);
168 p_object->InitializeSolutionStep(rCurrentProcessInfo);
169 p_object->FinalizeSolutionStep(rCurrentProcessInfo);
172 if (InterpolateInternalVariables ==
true)
176 p_object->GetData() = it->GetData();
177 p_object->GetValue(SPLIT_ELEMENT) =
false;
179 r_child_objects.push_back(
typename TGeometricalObjectType::WeakPointer(p_object) );
191 for (
auto it_new = rNewObjects.
begin(); it_new != rNewObjects.
end(); it_new++) {
192 rObjects.push_back(*(it_new.base()));
199 rObjects.erase(rObjects.end() - to_be_deleted, rObjects.end());
201 KRATOS_INFO(
"LocalRefineTriangleMeshGeneric") <<
"NEW NUMBER OBJECTS: " << rObjects.size() << std::endl;
214 const compressed_matrix<int>& rCoord,
216 std::vector<int>& rAux
219 rAux.resize(6,
false);
225 rAux[0] = rGeom[0].
Id();
226 rAux[1] = rGeom[1].
Id();
227 rAux[2] = rGeom[2].
Id();
229 if (index_0 > index_1) {
230 rAux[3] = rCoord(index_1, index_0);
232 rAux[3] = rCoord(index_0, index_1);
235 if (index_1 > index_2) {
236 rAux[4] = rCoord(index_2, index_1);
238 rAux[4] = rCoord(index_1, index_2);
241 if (index_2 > index_0){
242 rAux[5] = rCoord(index_0, index_2);
244 rAux[5] = rCoord(index_2, index_0);
249 if (index_0 > index_1){
260 if (index_1 > index_2) {
271 if (index_2 > index_0) {
283 return it_elem->GetValue(NEIGHBOUR_ELEMENTS);
288 return it_cond->GetValue(NEIGHBOUR_CONDITIONS);
Geometry base class.
Definition: geometry.h:71
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
Definition: local_refine_geometry_mesh.hpp:49
std::unordered_map< std::size_t, unsigned int > mMapNodeIdToPos
The current refinement level.
Definition: local_refine_geometry_mesh.hpp:240
void InterpolateInteralVariables(const int &number_elem, const TGeometricalObjectPointerType father_elem, TGeometricalObjectPointerType child_elem, const ProcessInfo &rCurrentProcessInfo)
Definition: local_refine_geometry_mesh.hpp:213
Definition: local_refine_triangle_mesh_generic.hpp:47
GlobalPointersVector< Element > & GetNeighbour(ElementsArrayType::iterator it_elem)
Definition: local_refine_triangle_mesh_generic.hpp:281
~LocalRefineTriangleMeshGeneric() override=default
Destructor.
void EraseOldObjetcsAndCreateNewObjects(ModelPart &rThisModelPart, TArrayType &rObjects, const compressed_matrix< int > &rCoord, PointerVector< TGeometricalObjectType > &rNewObjects, bool InterpolateInternalVariables)
Definition: local_refine_triangle_mesh_generic.hpp:81
GlobalPointersVector< Condition > & GetNeighbour(ConditionsArrayType::iterator it_cond)
Definition: local_refine_triangle_mesh_generic.hpp:286
void CalculateEdges(Geometry< Node > &rGeom, const compressed_matrix< int > &rCoord, int *EdgeIds, std::vector< int > &rAux) override
Definition: local_refine_triangle_mesh_generic.hpp:212
LocalRefineTriangleMeshGeneric(ModelPart &model_part)
Default constructors.
Definition: local_refine_triangle_mesh_generic.hpp:57
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
iterator end()
Definition: pointer_vector.h:177
iterator begin()
Definition: pointer_vector.h:169
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
A three node 2D triangle geometry with linear shape functions.
Definition: triangle_2d_3.h:74
A three node 3D triangle geometry with linear shape functions.
Definition: triangle_3d_3.h:77
static int Split_Triangle(const int edges[3], int t[12], int *nel, int *splitted_edges, int *nint)
Utility to split triangles.
Definition: split_triangle.h:117
#define KRATOS_INFO(label)
Definition: logger.h:250
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
model_part
Definition: face_heat.py:14
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
int t
Definition: ode_solve.py:392
int current_id
Output settings end ####.
Definition: script.py:194
integer i
Definition: TensorModule.f:17