10 #if !defined(KRATOS_TRIGEN_CDT_H_INCLUDED )
11 #define KRATOS_TRIGEN_CDT_H_INCLUDED
35 void triangulate(
char *,
struct triangulateio *,
struct triangulateio *,
struct triangulateio *);
96 Element const& rReferenceElement
103 struct triangulateio in;
104 struct triangulateio mid;
105 struct triangulateio
out;
106 struct triangulateio vorout;
108 clean_triangulateio(in);
109 clean_triangulateio(mid);
110 clean_triangulateio(
out);
111 clean_triangulateio(vorout);
115 in.numberofpoints = ThisModelPart.
Nodes().size();
116 in.pointlist = (
REAL *) malloc(in.numberofpoints * 2 *
sizeof(
REAL));
118 ModelPart::NodesContainerType::iterator nodes_begin = ThisModelPart.
NodesBegin();
119 for(
unsigned int i = 0;
i<ThisModelPart.
Nodes().size();
i++)
125 (nodes_begin +
i)->SetId(
i+1);
128 in.pointlist[base] = (nodes_begin +
i)->
X();
129 in.pointlist[base+1] = (nodes_begin +
i)->
Y();
132 in.numberoftriangles = ThisModelPart.
Elements().size();
133 in.trianglelist = (
int*) malloc(in.numberoftriangles * 3 *
sizeof(
int));
135 ModelPart::ElementsContainerType::iterator elem_begin = ThisModelPart.
ElementsBegin();
136 for(
unsigned int el = 0;
el<ThisModelPart.
Elements().size();
el++)
143 in.trianglelist[base] = geom[0].
Id();
144 in.trianglelist[base+1] = geom[1].
Id();
145 in.trianglelist[base+2] = geom[2].
Id();
157 char options[] =
"rcEBQ";
161 free( in.pointlist );
162 free( in.trianglelist );
165 mid.numberoftriangles = 0;
166 free(mid.trianglelist);
167 char regeneration_option[] =
"pBQY";
176 free( mid.pointlist );
177 free( mid.segmentlist );
184 int el_number =
out.numberoftriangles;
190 for(
int el = 0;
el< el_number;
el++)
196 temp.push_back( *((ModelNodes).find(
out.trianglelist[base]).base() ) );
197 temp.push_back( *((ModelNodes).find(
out.trianglelist[base+1]).base() ) );
198 temp.push_back( *((ModelNodes).find(
out.trianglelist[base+2]).base() ) );
200 Element::Pointer p_element = rReferenceElement.
Create(
id,
temp, properties);
201 ThisModelPart.
Elements().push_back(p_element);
211 free(
out.pointattributelist );
212 free(
out.trianglelist );
237 virtual std::string
Info()
const
301 void clean_triangulateio( triangulateio& tr )
304 tr.pointlist = (
REAL*)
nullptr;
305 tr.pointattributelist = (
REAL*)
nullptr;
306 tr.pointmarkerlist = (
int*)
nullptr;
307 tr.numberofpoints = 0;
308 tr.numberofpointattributes = 0;
309 tr.trianglelist = (
int*)
nullptr;
310 tr.triangleattributelist = (
REAL*)
nullptr;
311 tr.trianglearealist = (
REAL*)
nullptr;
312 tr.neighborlist = (
int*)
nullptr;
313 tr.numberoftriangles = 0;
314 tr.numberofcorners = 3;
315 tr.numberoftriangleattributes = 0;
316 tr.segmentlist = (
int*)
nullptr;
317 tr.segmentmarkerlist = (
int*)
nullptr;
318 tr.numberofsegments = 0;
319 tr.holelist = (
REAL*)
nullptr;
320 tr.numberofholes = 0;
321 tr.regionlist = (
REAL*)
nullptr;
322 tr.numberofregions = 0;
323 tr.edgelist = (
int*)
nullptr;
324 tr.edgemarkerlist = (
int*)
nullptr;
325 tr.normlist = (
REAL*)
nullptr;
326 tr.numberofedges = 0;
382 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Elements.
Definition: element.h:60
virtual Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const
It creates a new element pointer.
Definition: element.h:202
Geometry base class.
Definition: geometry.h:71
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
PropertiesType::Pointer pGetProperties(IndexType PropertiesId)
Definition: mesh.h:394
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Short class definition.
Definition: trigen_cdt.h:63
virtual std::string Info() const
Turn back information as a string.
Definition: trigen_cdt.h:237
KRATOS_CLASS_POINTER_DEFINITION(TriGenCDT)
Pointer definition of TriGenCDT.
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: trigen_cdt.h:243
TriGenCDT()=default
Default constructor.
virtual ~TriGenCDT()=default
Destructor.
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: trigen_cdt.h:246
void GenerateCDT(ModelPart &ThisModelPart, Element const &rReferenceElement)
Definition: trigen_cdt.h:94
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#define REAL
Definition: delaunator_utilities.cpp:16
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
void triangulate(char *, struct triangulateio *, struct triangulateio *, struct triangulateio *)
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
out
Definition: isotropic_damage_automatic_differentiation.py:200
el
Definition: read_stl.py:25
float temp
Definition: rotating_cone.py:85
integer i
Definition: TensorModule.f:17