MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / discretize

Method discretize

SRC/element/PFEMElement/PFEMMesher3D.cpp:71–236  ·  view source on GitHub ↗

PLC

Source from the content-addressed store, hash-verified

69
70// PLC
71int
72PFEMMesher3D::discretize(int startnode, const PointVec& points, const FacetVec facets,
73 const PointVec& holes, double maxvol, int ndf,
74 const std::vector<int>& fix, const std::vector<double>& mass,
75 Domain* theDomain, int& endnode)
76{
77 if(theDomain == 0) {
78 opserr<<"WARNING: null domain";
79 opserr<<" -- PFEMMesher3D::discretize\n";
80 return -1;
81 }
82
83 // structs
84 tetgenio in, out;
85
86 // input points
87 in.numberofpoints = points.size();
88 if(in.numberofpoints > 0) {
89 in.pointlist = new double[in.numberofpoints*3];
90 } else {
91 in.pointlist = NULL;
92 }
93 for(int i=0; i<in.numberofpoints; i++) {
94 const Point& point = points[i];
95 in.pointlist[3*i] = point.x();
96 in.pointlist[3*i+1] = point.y();
97 in.pointlist[3*i+2] = point.z();
98 //opserr<<"point "<<i<<": "<<point.x()<<" "<<point.y()<<" "<<point.z()<<"\n";
99 }
100
101 // input facets
102 in.numberoffacets = facets.size();
103 if(in.numberoffacets > 0) {
104 in.facetlist = new tetgenio::facet[in.numberoffacets];
105 } else {
106 in.facetlist = NULL;
107 }
108 for(int i=0; i<in.numberoffacets; i++) {
109 const Facet& facet = facets[i];
110 const PolygonVec& polygons = facet.polygons();
111 const PointVec& holes = facet.holes();
112
113 // new facet
114 tetgenio::facet& tfacet = in.facetlist[i];
115
116 // polygons
117 tfacet.numberofpolygons = polygons.size();
118 if(tfacet.numberofpolygons > 0) {
119 tfacet.polygonlist = new tetgenio::polygon[tfacet.numberofpolygons];
120 } else {
121 tfacet.polygonlist = NULL;
122 }
123 for(int j=0; j<tfacet.numberofpolygons; j++) {
124 tetgenio::polygon& tpolygon = tfacet.polygonlist[j];
125 const Polygon& polygon = polygons[j];
126 tpolygon.numberofvertices = polygon.size();
127 if(tpolygon.numberofvertices > 0) {
128 tpolygon.vertexlist = new int[tpolygon.numberofvertices];

Callers 2

Calls 11

tetrahedralizeFunction · 0.50
sizeMethod · 0.45
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45
strMethod · 0.45
addNodeMethod · 0.45
addSP_ConstraintMethod · 0.45
setMassMethod · 0.45
setTrialVelMethod · 0.45
commitStateMethod · 0.45

Tested by

no test coverage detected