37{ 1, 2, 2, 4, 2, 4, 4, 1 }
42static const int ones = P4EST_CHILDREN - 1;
68int COctreeVoxelMesh::max_level;
70vector<XYZ> COctreeVoxelMesh::cornerPoints;
71vector<XYZ> COctreeVoxelMesh::CentrePoints;
73vector<vector<int>> COctreeVoxelMesh::FaceX_min;
74vector<vector<int>> COctreeVoxelMesh::FaceX_max;
75vector<vector<int>> COctreeVoxelMesh::FaceY_min;
76vector<vector<int>> COctreeVoxelMesh::FaceY_max;
77vector<vector<int>> COctreeVoxelMesh::FaceZ_min;
78vector<vector<int>> COctreeVoxelMesh::FaceZ_max;
81pair<XYZ, XYZ> COctreeVoxelMesh::g_DomainAABB;
82vector<char> COctreeVoxelMesh::materialInfo;
89 if ( fabs(x - y) < 0.25* P4EST_QUADRANT_LEN(12) / P4EST_QUADRANT_LEN(0))
98lnodes_decode2 (p4est_lnodes_code_t face_code,
int hanging_corner[P4EST_CHILDREN])
101 const int c = (int) (face_code &
ones);
103 int work = (int) (face_code >> P4EST_DIM);
106 hanging_corner[c] = hanging_corner[c ^
ones] = -1;
107 for (i = 0; i < P4EST_DIM; ++i) {
110 hanging_corner[h ^
ones] = (work & 1) ? c : -1;
113 hanging_corner[h] = (work & P4EST_CHILDREN) ? c : -1;
128 for (i = 0; i < 8; i++) {
135 for (i = 0; i < 8; i++) {
136 hang_coord[i][0] = hang_coord[i+1][0];
137 hang_coord[i][1] = hang_coord[i+1][1];
138 hang_coord[i][2] = hang_coord[i+1][2];
139 hang_nums[i] = hang_nums[i+1];
145 int currentVal = v[0];
146 int currentCount = 0;
150 for (
int i = 0; i < v.size(); i++) {
151 int c = count(v.begin(), v.end(), v[i]);
158 return make_pair(mostVal, mostCount);
163int COctreeVoxelMesh::writeTempFile(
string filename, pair<XYZ, XYZ> myDomain)
165 ofstream TempFile(filename);
167 TGERROR(
"Cannot create an initialisation *.inp file " << filename);
170 TempFile <<
"*HEADING" <<
"\n";
171 TempFile <<
"This is a temp input for the octree refinement" <<
"\n";
172 TempFile <<
"*NODE" <<
"\n";
177 TempFile <<
"1, " << myDomain.first.x<<
", " << myDomain.first.y <<
", " << myDomain.first.z <<
"\n";
178 TempFile <<
"2, " << myDomain.second.x <<
", " << myDomain.first.y <<
", " << myDomain.first.z <<
"\n";
179 TempFile <<
"3, " << myDomain.first.x <<
", " << myDomain.second.y <<
", " << myDomain.first.z <<
"\n";
180 TempFile <<
"4, " << myDomain.second.x <<
", " << myDomain.second.y <<
", " << myDomain.first.z <<
"\n";
182 TempFile <<
"5, " << myDomain.first.x <<
", " << myDomain.first.y <<
", " << myDomain.second.z <<
"\n";
183 TempFile <<
"6, " << myDomain.second.x <<
", " << myDomain.first.y <<
", " << myDomain.second.z <<
"\n";
184 TempFile <<
"7, " << myDomain.first.x <<
", " << myDomain.second.y <<
", " << myDomain.second.z <<
"\n";
185 TempFile <<
"8, " << myDomain.second.x <<
", " << myDomain.second.y <<
", " << myDomain.second.z <<
"\n";
186 TempFile <<
"*ELEMENT,TYPE=C3D8R" <<
"\n";
187 TempFile <<
"1, 5, 7, 3, 1, 6, 8, 4, 2" <<
"\n";
193 DomSize = myDomain.second - myDomain.first;
210 Point.
x = myDomain.first.x + m_VoxSize[0] * x;
211 Point.
y = myDomain.first.y + m_VoxSize[1] * y;
212 Point.
z = myDomain.first.z + m_VoxSize[2] * z;
213 TempFile << iNodeIndex <<
", " <<
Point <<
"\n";
219 TempFile <<
"*ELEMENT,TYPE=C3D8R" <<
"\n";
220 int iElementNumber = 1;
230 TempFile << iElementNumber <<
", ";
231 TempFile << x +y*numx + (z+1)*numx*numy + 1 <<
", " << x +(y+1)*numx + (z+1)*numx*numy + 1 <<
", ";
232 TempFile << x + (y+1)*numx + z*numx*numy + 1 <<
", " << x + y*numx + z*numx*numy + 1 <<
", ";
233 TempFile << (x+1) +y*numx + (z+1)*numx*numy + 1 <<
", " << (x+1) +(y+1)*numx + (z+1)*numx*numy + 1 <<
", ";
234 TempFile << (x+1) + (y+1)*numx + z*numx*numy + 1 <<
", " << (x+1) +y*numx + z*numx*numy + 1 <<
"\n";
247 vector<int> facesInd;
249 if (NodeIndices.size() == 5)
251 if (NodeIndices.size() == 6)
253 if (NodeIndices.size() == 7)
257 if (NodeIndices.size() == 8) {
262 while (i < numFaces) {
263 if (NodeIndices.count(0) && NodeIndices.count(1) && NodeIndices.count(2) && NodeIndices.count(3))
264 facesInd.push_back(0), i++;
265 if (NodeIndices.count(4) && NodeIndices.count(5) && NodeIndices.count(6) && NodeIndices.count(7))
266 facesInd.push_back(1), i++;
267 if (NodeIndices.count(0) && NodeIndices.count(1) && NodeIndices.count(4) && NodeIndices.count(5))
268 facesInd.push_back(2), i++;
269 if (NodeIndices.count(1) && NodeIndices.count(2) && NodeIndices.count(5) && NodeIndices.count(6))
270 facesInd.push_back(3), i++;
271 if (NodeIndices.count(2) && NodeIndices.count(3) && NodeIndices.count(6) && NodeIndices.count(7))
272 facesInd.push_back(4), i++;
273 if (NodeIndices.count(3) && NodeIndices.count(0) && NodeIndices.count(7) && NodeIndices.count(4))
274 facesInd.push_back(5), i++;
275 if (k++ > numFaces) {
290 if (NodeIndices.count(0) && NodeIndices.count(1) && NodeIndices.count(2) && NodeIndices.count(3))
292 if (NodeIndices.count(4) && NodeIndices.count(5) && NodeIndices.count(6) && NodeIndices.count(7))
294 if (NodeIndices.count(0) && NodeIndices.count(1) && NodeIndices.count(4) && NodeIndices.count(5))
296 if (NodeIndices.count(1) && NodeIndices.count(2) && NodeIndices.count(5) && NodeIndices.count(6))
298 if (NodeIndices.count(2) && NodeIndices.count(3) && NodeIndices.count(6) && NodeIndices.count(7))
300 if (NodeIndices.count(3) && NodeIndices.count(0) && NodeIndices.count(7) && NodeIndices.count(4))
311 vector<int>::const_iterator itSurf;
312 vector<int>::const_iterator itVol;
314 for (itSurf = SurfIndices.begin(); itSurf != SurfIndices.end(); ++itSurf)
316 for (itVol = VolIndices.begin(), i=0; itVol != VolIndices.end(); ++itVol, ++i)
318 if (*itSurf == *itVol)
335 p4est_destroy (
p4est);
336 TGLOG(
"P4est object destroyed");
337 p4est_connectivity_destroy (
conn);
338 TGLOG(
"Connectivity destoyed");
367 int c = hanging_corner[node_i];
370 vector<int> master_nodes;
372 for (
int j = 0; j < ncontrib; ++j) {
373 int h = contrib_corner[j]^c;
374 master_nodes.push_back(all_lni[h] + 1);
377 sort(master_nodes.begin(), master_nodes.end());
383 std::stringstream ss;
384 for(
size_t i = 0; i < master_nodes.size(); ++i)
386 ss << master_nodes[i];
388 std::string s = ss.str();
398 TGLOG(
"Hanging constr are the same but coords not!");
421 Output <<
"*EQUATION" <<
"\n";
422 map<int, vector<int>>::iterator itConstraints;
424 for (
int i = 0; i < 3; i++) {
425 int num = (int)itConstraints->second.size();
426 Output << num + 1 <<
"\n";
427 Output << itConstraints->first <<
", " << i + 1 <<
", 1, ";
428 for (
int j = 0; j < num; ++j) {
429 Output << itConstraints->second[j] <<
", " << i + 1 <<
", " << -1.0/num;
443 vector<int> FaceA, FaceB, FaceC, FaceD, FaceE, FaceF;
444 vector<int> Edge1, Edge2, Edge3, Edge4, Edge5, Edge6, Edge7, Edge8, Edge9, Edge10, Edge11, Edge12;
534 for (
int i = 0; i < 8; i++) {
544 timer.
start(
"Writing elements");
545 vector<vector<int>>::iterator itElements;
546 vector<int>::iterator itNodes;
547 int i, elem_count = 1;
553 Output << elem_count ++ <<
", ";
554 for (itNodes = itElem->begin(), i = 1; itNodes != itElem->end(); itNodes++, i++) {
570 Output << elem_count ++ <<
", ";
571 for (itNodes = itElements->begin(), i = 1; itNodes != itElements->end(); itNodes++, i++) {
583 timer.
check(
"Elements written");
587 timer.
start(
"Writing surfaces");
588 map<int, vector<int>>::iterator itSurfaceNodes;
590 if ( itSurfaceNodes->first == -1) {
591 Output <<
"*NSET, NSET=SURFACE-NODES-MATRIX" <<
"\n";
593 Output <<
"*NSET, NSET=SURFACE-NODES-YARN" << itSurfaceNodes->first <<
"\n";
598 map<int, vector< pair<int,int> > >::iterator itSurfaceFaces;
600 if (itSurfaceFaces->first == -1) {
601 Output <<
"*SURFACE, NAME=SURFACE-MATRIX" <<
"\n";
603 Output <<
"*SURFACE, NAME=SURFACE-YARN" << itSurfaceFaces->first <<
"\n";
605 vector< pair<int, int> >::iterator itFaces;
606 for (itFaces = itSurfaceFaces->second.begin(); itFaces != itSurfaceFaces->second.end(); ++itFaces) {
607 Output << itFaces->first <<
", S" << itFaces->second <<
"\n";
611 timer.
check(
"Surfaces written");
637 vector<XYZ> CornerPoints;
638 vector<POINT_INFO> CornerInfo;
641 p4est_quadrant_t node_quadrant;
651 for (
int node_i=0; node_i < 8; node_i++) {
652 p4est_quadrant_corner_node(quadrant, node_i, &node_quadrant);
653 p4est_qcoord_to_vertex (
p4est->connectivity, which_tree, node_quadrant.x, node_quadrant.y, node_quadrant.z, vxyz);
701 vector<XYZ> CornerPoints;
702 vector<POINT_INFO> CornerInfo;
705 p4est_quadrant_t node_quadrant;
706 double x_min, x_max, y_min, y_max, z_min, z_max;
717 if (quadrant->level <2) {
721 for (
int node_i=0; node_i < 8; node_i++) {
722 p4est_quadrant_corner_node(quadrant, node_i, &node_quadrant);
723 p4est_qcoord_to_vertex (
p4est->connectivity, which_tree, node_quadrant.x, node_quadrant.y, node_quadrant.z, vxyz);
727 cx += 1.0/8.0 *vxyz[0];
728 cy += 1.0/8.0 *vxyz[1];
729 cz += 1.0/8.0 *vxyz[2];
731 CornerPoints.push_back(
Point);
754 vector<XYZ> ExtraPoints;
755 for (
int i = 0; i < 8; i++) {
757 NewPoint.
x = (CornerPoints[i].x - cx)*coef + cx;
758 NewPoint.
y = (CornerPoints[i].y - cy)*coef + cy;
759 NewPoint.
z = (CornerPoints[i].z - cz)*coef + cz;
760 ExtraPoints.push_back(NewPoint);
762 ExtraPoints.push_back(
XYZ(cx, cy, cz));
763 CornerPoints.push_back(
XYZ(cx, cy, cz));
774 vector<XYZ> CornerPoints;
775 vector<XYZ> ExtraPoints;
776 vector<POINT_INFO> ExtraInfo;
778 p4est_quadrant_t node_quadrant;
792 for (
int i = 0; i < 8; i++) {
793 p4est_quadrant_corner_node(quadrant, i, &node_quadrant);
794 p4est_qcoord_to_vertex (
p4est->connectivity, which_tree, node_quadrant.x, node_quadrant.y, node_quadrant.z, vxyz);
799 CentrePoint.
x += vxyz[0] * 1.0/8.0;
800 CentrePoint.
y += vxyz[1] * 1.0/8.0;
801 CentrePoint.
z += vxyz[2] * 1.0/8.0;
803 CornerPoints.push_back(
Point);
806 ExtraPoints.push_back(CentrePoint);
808 for (
int i = 0; i < 8; i++) {
813 NewPoint = (CornerPoints[i] - CentrePoint)*coef + CentrePoint;
814 ExtraPoints.push_back(NewPoint);
816 NewPoint.
x = (CornerPoints[i].x - CentrePoint.
x)*coef + CentrePoint.
x;
817 NewPoint.
y = CentrePoint.
y;
818 NewPoint.
z = CentrePoint.
z;
819 ExtraPoints.push_back(NewPoint);
821 NewPoint.
x = CentrePoint.
x;
822 NewPoint.
y = (CornerPoints[i].y - CentrePoint.
y)*coef + CentrePoint.
y;
823 NewPoint.
z = CentrePoint.
z;
824 ExtraPoints.push_back(NewPoint);
826 NewPoint.
x = CentrePoint.
x;
827 NewPoint.
y = CentrePoint.
y;
828 NewPoint.
z = (CornerPoints[i].z - CentrePoint.
z)*coef + CentrePoint.
z;
829 ExtraPoints.push_back(NewPoint);
833 for (
int i = 0; i < 8; i++) {
835 NewPoint.
x = (CornerPoints[i].x - CentrePoint.
x)*coef + CentrePoint.
x;
836 NewPoint.
y = (CornerPoints[i].y - CentrePoint.
y)*coef + CentrePoint.
y;
837 NewPoint.
z = (CornerPoints[i].z - CentrePoint.
z)*coef + CentrePoint.
z;
838 ExtraPoints.push_back(NewPoint);
840 NewPoint.
x = (CornerPoints[i].x - CentrePoint.
x)*coef + CentrePoint.
x;
841 NewPoint.
y = CentrePoint.
y;
842 NewPoint.
z = CentrePoint.
z;
843 ExtraPoints.push_back(NewPoint);
845 NewPoint.
x = CentrePoint.
x;
846 NewPoint.
y = (CornerPoints[i].y - CentrePoint.
y)*coef + CentrePoint.
y;
847 NewPoint.
z = CentrePoint.
z;
848 ExtraPoints.push_back(NewPoint);
850 NewPoint.
x = CentrePoint.
x;
851 NewPoint.
y = CentrePoint.
y;
852 NewPoint.
z = (CornerPoints[i].z - CentrePoint.
z)*coef + CentrePoint.
z;
853 ExtraPoints.push_back(NewPoint);
873 double dx = x_length / pow(2, refineLevel) /
g_XVoxels;
874 double dy = y_length / pow(2, refineLevel) /
g_YVoxels;
875 double dz = z_length / pow(2, refineLevel) /
g_ZVoxels;
877 int num = pow(2, refineLevel) + 1;
884 int layer_len = row_len * num *
g_YVoxels;
886 vector<XYZ>::const_iterator itPoint;
887 int previousMaterial;
890 for (itPoint = myPoints.begin(); itPoint != myPoints.end(); ++itPoint)
892 double x = itPoint->x;
893 double y = itPoint->y;
894 double z = itPoint->z;
896 if ( x > x0 + x_length )
902 if ( y > y0 + y_length )
908 if ( z > z0 + z_length )
914 int index_i = ( (x - x0)/ dx - floor((x - x0) / dx) >= 0.5 ) ? ceil((x - x0) / dx) : floor((x - x0) / dx);
915 int index_j = ( (y - y0)/ dy - floor((y - y0) / dy) >= 0.5 ) ? ceil((y - y0) / dy) : floor((y - y0) / dy);
916 int index_k = ( (z - z0)/ dz - floor((z - z0) / dz) >= 0.5 ) ? ceil((z - z0) / dz) : floor((z - z0) / dz);
930 previousMaterial =
materialInfo[index_i + row_len * index_j + layer_len * index_k];
932 if (i > 0 && previousMaterial !=
materialInfo[index_i + row_len * index_j + layer_len * index_k] )
943 vector<XYZ> myPoints;
944 vector<POINT_INFO> temp;
952 double dx = x_length / pow(2, refineLevel) /
m_XVoxels;
953 double dy = y_length / pow(2, refineLevel) /
m_YVoxels;
954 double dz = z_length / pow(2, refineLevel) /
m_ZVoxels;
956 int num = pow(2, refineLevel) + 1;
964 for (
int k = 0; k < num *
m_ZVoxels; k++)
965 for (
int j = 0; j < num *
m_YVoxels; j++)
966 for (
int i = 0; i < num *
m_XVoxels; i++)
967 myPoints.push_back(
XYZ(x0 + dx*i, y0 + dy*j, z0 + dz*k));
973 vector<POINT_INFO>::const_iterator itInfo;
976 TGLOG(
"Infos " << myPoints.size());
978 for (itInfo = temp.begin(); itInfo != temp.end(); ++itInfo)
988 vector <XYZ> myPoints;
991 for (
int j = 0; j < 8; j++) {
995 vector<POINT_INFO> myInfo;
1001 for (
int j = 0; j < 9; j++) {
1002 v.push_back(myInfo[i*9 + j].iYarnIndex);
1005 vector<int>::iterator it = find(v.begin(), v.end(), mat.first);
1006 int pos = distance(v.begin(), it);
1016 int mpiret = sc_MPI_Init (
NULL,
NULL);
1017 SC_CHECK_MPI (mpiret);
1018 sc_MPI_Comm mpicomm = sc_MPI_COMM_WORLD;
1024 for (
int i = 0; i < len + 1; i++) {
1025 vector<int> temp(len, 0);
1043 conn = p4est_connectivity_read_inp (
"temp_octree.inp");
1046 TGERROR(
"Failed to read a valid connectivity from temp_octree.inp");
1055 for (
int level = 0; level < min_level; ++level) {
1061 for (
int level = min_level; level < refine_level; ++level) {
1070 p4est_balance (
p4est, P4EST_CONNECT_FULL,
NULL);
1072 TGLOG(
"Post-refinement now");
1076 for (
int i = 0; i < 3; i++) {
1080 p4est_balance (
p4est, P4EST_CONNECT_FULL,
NULL);
1089void COctreeVoxelMesh::SaveVoxelMesh(
CTextile &Textile,
string OutputFilename,
int XVoxNum,
int YVoxNum,
int ZVoxNum,
int min_level,
int refine_level,
bool smoothing,
int iter,
double s1,
double s2,
bool surfaceOutput)
1113 if (min_level < 0 || refine_level < 0 || min_level > refine_level) {
1114 TGERROR(
"Incorrect refinement levels specified. min_level should be lower than refine_level");
1119 if (!( ((s1 > 0 && s1 == s2) || (s1 > 0 && s2 < 0 && s1 < -s2)) &&
m_smoothIter > 0)) {
1120 TGERROR(
"Smoothing coefficients are not correct. It should be:\n1. Coef1 = Coef2 - for Laplacian smoothing\n2. Coef1 < -Coef2 (and Coef1 > 0) - for non-shrinking smoothing\nIter > 0");
1125 timer.
start(
"Starting octree refinement...");
1131 timer.
check(
"Octree refinement finished");
1143 p4est_ghost_t *ghost;
1144 p4est_lnodes_t *lnodes;
1146 ghost = p4est_ghost_new (
p4est, P4EST_CONNECT_FULL);
1148 lnodes = p4est_lnodes_new (
p4est, ghost, 1 );
1150 p4est_ghost_destroy (ghost);
1164 int i, k, node_i, q, Q, used, anyhang, hanging_corner[P4EST_CHILDREN], node_elements[8], hang_nums[8];
1165 int elem_order[8] = {0, 2, 3, 1, 4, 6, 7, 5};
1166 sc_array_t *tquadrants;
1168 p4est_locidx_t all_lni[P4EST_CHILDREN];
1170 p4est_quadrant_t *quad, node_quadrant;
1178 double hang_coord[8][3];
1182 for (tt =
p4est->first_local_tree, k = 0; tt <= p4est->last_local_tree; ++tt) {
1183 tree = p4est_tree_array_index (
p4est->trees, tt);
1184 tquadrants = &tree->quadrants;
1185 Q = (p4est_locidx_t) tquadrants->elem_count;
1187 for (q = 0; q < Q; ++q, ++k) {
1190 quad = p4est_quadrant_array_index (tquadrants, q);
1192 for (i = 0; i < P4EST_CHILDREN; ++i) {
1193 all_lni[i] = lnodes->element_nodes[P4EST_CHILDREN * k + i];
1199 vector<int> elemNodes;
1202 for(node_i = 0; node_i < P4EST_CHILDREN; node_i++) {
1204 p4est_quadrant_corner_node(quad, node_i, &node_quadrant);
1205 p4est_qcoord_to_vertex (
p4est->connectivity, tt, node_quadrant.x, node_quadrant.y, node_quadrant.z, vxyz);
1209 if (!anyhang || hanging_corner[node_i] == -1) {
1211 if (node_count - 1 < lnodes->element_nodes[P4EST_CHILDREN * k + node_i]) {
1212 AllNodes.insert(make_pair(lnodes->element_nodes[P4EST_CHILDREN * k + node_i] + 1,
XYZ(vxyz[0], vxyz[1], vxyz[2])));
1216 m_boundaryPoints.push_back(
Point(lnodes->element_nodes[P4EST_CHILDREN * k + node_i] + 1, vxyz[0], vxyz[1], vxyz[2]));
1221 node_elements[node_i] = lnodes->element_nodes[P4EST_CHILDREN * k + node_i] + 1;
1229 node_elements[node_i] = used;
1233 int loc_hang =
storeHangingNode(all_lni, hanging_corner, node_i, hanging_count + 1, vxyz);
1234 if ( loc_hang != 0 ) {
1237 node_elements[node_i] = loc_hang;
1239 AllNodes.insert(make_pair(++hanging_count,
XYZ(vxyz[0], vxyz[1], vxyz[2])));
1240 node_elements[node_i] = hanging_count;
1241 hang_coord[7][0] = vxyz[0];
1242 hang_coord[7][1] = vxyz[1];
1243 hang_coord[7][2] = vxyz[2];
1244 hang_nums[7] = hanging_count;
1261 CurrentCentre.
x += 1.0/8.0 * vxyz[0];
1262 CurrentCentre.
y += 1.0/8.0 * vxyz[1];
1263 CurrentCentre.
z += 1.0/8.0 * vxyz[2];
1267 for(i = 0; i < 8; i++) {
1268 elemNodes.push_back(node_elements[elem_order[i]]);
1277 vector<int>::iterator itNodes;
1280 for (itNodes = elemNodes.begin(); itNodes != elemNodes.end(); ++itNodes, i++) {
1285 case 0: { a[0] = elemNodes[1]; a[1] = elemNodes[3]; a[2] = elemNodes[4];
break; }
1286 case 1: { a[0] = elemNodes[0]; a[1] = elemNodes[2]; a[2] = elemNodes[5];
break; }
1287 case 2: { a[0] = elemNodes[1]; a[1] = elemNodes[3]; a[2] = elemNodes[6];
break; }
1288 case 3: { a[0] = elemNodes[0]; a[1] = elemNodes[2]; a[2] = elemNodes[7];
break; }
1289 case 4: { a[0] = elemNodes[0]; a[1] = elemNodes[5]; a[2] = elemNodes[7];
break; }
1290 case 5: { a[0] = elemNodes[1]; a[1] = elemNodes[4]; a[2] = elemNodes[6];
break; }
1291 case 6: { a[0] = elemNodes[2]; a[1] = elemNodes[5]; a[2] = elemNodes[7];
break; }
1292 case 7: { a[0] = elemNodes[3]; a[1] = elemNodes[4]; a[2] = elemNodes[6];
break; }
1303 p4est_lnodes_destroy (lnodes);
1466 map<int, vector<int>>::iterator itConstraints;
1467 vector<int>::const_iterator itNodes;
1468 vector<int> masterNodes;
1469 vector<int> elementsInvolved;
1470 vector<int>::iterator pos;
1477 int faces_inds[6][4] = {
1486 vector<int> local_face;
1487 map<int, map<int, vector<int> >> markedElements;
1493 timer.
start(
"Start constraint processing");
1497 masterNodes = itConstraints->second;
1498 sort(masterNodes.begin(), masterNodes.end());
1499 int num = masterNodes.size();
1501 elementsInvolved.clear();
1502 for (
int j = 0; j < num; ++j) {
1503 int currentNode = itConstraints->second[j] ;
1509 map<int, int> elemCount;
1510 for (
auto iter = elementsInvolved.begin(); iter != elementsInvolved.end(); ++iter) {
1513 if ( *iter == 17682 ) {
1514 TGLOG(
"Elemen 17682 constrained " << elemCount[*iter]);
1519 for (
auto iter = elemCount.begin(); iter != elemCount.end(); ++iter) {
1521 if ( iter->second == num ) {
1523 int elemNum = iter->first;
1526 for (
int j = 0; j < 6; j++)
1529 local_face.push_back(nodes[faces_inds[j][0]]);
1530 local_face.push_back(nodes[faces_inds[j][1]]);
1531 local_face.push_back(nodes[faces_inds[j][2]]);
1532 local_face.push_back(nodes[faces_inds[j][3]]);
1533 sort(local_face.begin(), local_face.end());
1537 if ( find(local_face.begin(), local_face.end(), masterNodes[0]) != local_face.end() &&
1538 find(local_face.begin(), local_face.end(), masterNodes[1]) != local_face.end() ) {
1539 markedElements[elemNum][j].push_back(itConstraints->first);
1541 if (elemNum == 17682) {
1542 TGLOG(
"Element 17682: mark " << j <<
" with " << itConstraints->first)
1550 if ( equal(masterNodes.begin(), masterNodes.end(), local_face.begin()) )
1552 markedElements[elemNum][j].push_back(itConstraints->first);
1554 if (elemNum == 17682) {
1555 TGLOG(
"Element 17682: mark " << j <<
" with " << itConstraints->first)
1567 timer.
check(
"Finished");
1572 int newNodesCount =
AllNodes.size() + 1;
1575 vector<int> existingNodes;
1576 int tet_split[12][3] = {
1593 int face_tet_split[8][3] = {
1604 int faceLoops[6][4] = {
1613 TGLOG(
"Start hex splitting");
1614 vector<XYZ> newCentrePoints;
1618 int newCentreNode = newNodesCount++;
1619 AllNodes.insert(make_pair(newCentreNode, newNode));
1622 if ( markedElements.find(i) != markedElements.end() ) {
1626 TGLOG(
"Let's split 17682");
1630 for (
int faces = 0; faces < 6; faces++) {
1632 if ( markedElements[i].find(faces) != markedElements[i].end() ) {
1633 vector<int> faceNodes;
1634 XYZ faceCentre =
XYZ(0, 0, 0);
1635 int newFaceNode = 0;
1636 int faceInd = faces;
1640 TGLOG(
"Face " << faces <<
" has " << markedElements[i][faces].size() <<
" nodes");
1644 if ( markedElements[i][faces].size() == 5 ) {
1648 TGLOG(
"Let's split 17682, face " << faces <<
": 5 nodes");
1651 for (
auto it3 = markedElements[i][faces].begin(); it3 != markedElements[i][faces].end(); ++it3) {
1658 for (
int kk = 0; kk < 4; kk++) {
1659 faceNodes.push_back(existingNodes[faceLoops[faceInd][kk]]);
1667 TGLOG(
"Let's split 17682 " << faces <<
": create node");
1670 newFaceNode = newNodesCount++;
1671 for (
int kk = 0; kk < 4; kk++) {
1672 faceNodes.push_back(existingNodes[faceLoops[faceInd][kk]]);
1673 faceCentre += 0.25*
AllNodes[faceNodes[kk]];
1675 AllNodes.insert(make_pair(newFaceNode, faceCentre));
1680 if ( markedElements[i][faces].size() > 0 && markedElements[i][faces].size() != 4) {
1682 for (
auto it3 = markedElements[i][faces].begin(); it3 != markedElements[i][faces].end(); ++it3) {
1693 auto newFaceNodeIt1 = find(faceNodes.begin(), faceNodes.end(),
m_NodeConstraints[*it3][0]);
1694 auto newFaceNodeIt2 = find(faceNodes.begin(), faceNodes.end(),
m_NodeConstraints[*it3][1]);
1695 int newPos1 = distance(faceNodes.begin(), newFaceNodeIt1);
1696 int newPos2 = distance(faceNodes.begin(), newFaceNodeIt2);
1698 if ( *it3 == 2003180 ) {
1699 TGLOG(
"pos 1 = " << newPos1 <<
" , pos 2 = " << newPos2 <<
", length = " << faceNodes.size());
1702 if ( newPos1 == newPos2 - 1 ) {
1703 faceNodes.insert(newFaceNodeIt1 + 1, *it3);
1706 if ( newPos1 - 1 == newPos2 ) {
1707 faceNodes.insert(newFaceNodeIt2 + 1, *it3);
1710 if ( newPos1 == newPos2 - 3 || newPos1 - 3 == newPos2 ) {
1711 faceNodes.push_back(*it3);
1714 if ( newPos1 == newPos2 + 1 - faceNodes.size() || newPos1 + 1 - faceNodes.size() == newPos2 ) {
1715 faceNodes.push_back(*it3);
1720 if ( markedElements[i][faces].size() != 5 )
1723 faceNodes.push_back(existingNodes[faceLoops[faceInd][0]]);
1729 TGLOG(
"Print all face");
1730 for (
auto itFa = faceNodes.begin(); itFa != faceNodes.end(); ++itFa) {
1731 TGLOG(
"Face node: " << *itFa);
1733 TGLOG(
"newFaceNode " << newFaceNode <<
" newCentreNode " << newCentreNode);
1736 if ( markedElements[i][faces].size() == 5 )
1738 faceNodes.push_back(newFaceNode);
1739 for (
int kk = 0; kk < 8; kk++) {
1740 vector<int> new_tet;
1741 new_tet.push_back(faceNodes[face_tet_split[kk][0] - 1]);
1742 new_tet.push_back(faceNodes[face_tet_split[kk][1] - 1]);
1743 new_tet.push_back(faceNodes[face_tet_split[kk][2] - 1]);
1744 new_tet.push_back(newCentreNode);
1753 for (
int kk = 0; kk < faceNodes.size() - 1; kk++) {
1754 vector<int> new_tet;
1755 new_tet.push_back(faceNodes[kk]);
1756 new_tet.push_back(faceNodes[kk + 1]);
1757 new_tet.push_back(newFaceNode);
1758 new_tet.push_back(newCentreNode);
1766 for (
int k = faces*2; k < (faces + 1) * 2; k++) {
1767 vector<int> new_tet;
1768 new_tet.push_back(existingNodes[tet_split[k][0] - 1]);
1769 new_tet.push_back(existingNodes[tet_split[k][1] - 1]);
1770 new_tet.push_back(existingNodes[tet_split[k][2] - 1]);
1771 new_tet.push_back(newCentreNode);
1861 for (
int k = 0; k < 12; k++) {
1862 vector<int> new_tet;
1863 new_tet.push_back(existingNodes[tet_split[k][0] - 1]);
1864 new_tet.push_back(existingNodes[tet_split[k][1] - 1]);
1865 new_tet.push_back(existingNodes[tet_split[k][2] - 1]);
1866 new_tet.push_back(newCentreNode);
1879 TGLOG(
"Splitting is finished");
1888 TGLOG(
"Converting octree to nodes coordinates");
1890 TGLOG(
"Octree converted");
1900 TGLOG(
"Retrieving info on centre points");
1904 TGLOG(
"Info retrieved");
1909 vector<XYZ>::iterator itCentres;
1910 vector<XYZ>::iterator itCentres2;
1911 vector<vector<int>>::iterator itElemNodes;
1912 TGLOG(
"Remove strays");
1925 double dx = x_length / pow(2,
max_level);
1926 double dy = y_length / pow(2,
max_level);
1927 double dz = z_length / pow(2,
max_level);
1928 vector <XYZ> checkPoints;
1932 vector<int> toChange;
1939 int localMats[7] = { 0, 0, 0, 0, 0, 0, 0};
1943 if ( fabs(fabs(n1.
x - n2.
x) - dx) < dx/100.0 || fabs(fabs(n1.
y - n2.
y) - dy) < dy/100.0 || fabs(fabs(n1.
z - n2.
z) - dz) < dz/100.0 )
1954 if ( fabs(itCentres->x + dx - itCentres2->x) < dx/10 && fabs(itCentres->y - itCentres2->y) < dy/10 && fabs(itCentres->z - itCentres2->z) < dz/10 )
1961 if ( fabs(itCentres->x - dx - itCentres2->x) < dx/10 && fabs(itCentres->y - itCentres2->y) < dy/10 && fabs(itCentres->z - itCentres2->z) < dz/10 )
1968 if ( fabs(itCentres->x - itCentres2->x) < dx/10 && fabs(itCentres->y + dy - itCentres2->y) < dy/10 && fabs(itCentres->z - itCentres2->z) < dz/10 )
1976 if ( fabs(itCentres->x - itCentres2->x) < dx/10 && fabs(itCentres->y - dy - itCentres2->y) < dy/10 && fabs(itCentres->z - itCentres2->z) < dz/10 )
1984 if ( fabs(itCentres->x - itCentres2->x) < dx/10 && fabs(itCentres->y - itCentres2->y) < dy/10 && fabs(itCentres->z + dz - itCentres2->z) < dz/10 )
1992 if ( fabs(itCentres->x - itCentres2->x) < dx/10 && fabs(itCentres->y - itCentres2->y) < dy/10 && fabs(itCentres->z - dz - itCentres2->z) < dz/10 )
2013 if ( localMats[5] == -1 && localMats[6] == -1)
2016 toChange.push_back(i);
2030 TGLOG(
"Total elements: " << i);
2031 vector<int>::iterator myIt;
2032 for (myIt = toChange.begin(); myIt != toChange.end(); ++myIt)
2040 TGLOG(
"Stray voxels removed");
2044 map<int, vector<int>> NodeSurf;
2045 vector<int> AllSurf;
2050 TGLOG(
"Smoothing starts");
2053 TGLOG(
"Smoothing finished");
2059 TGLOG(
"Preparing interface definitions");
2062 TGLOG(
"Interfaces defined");
2071 TGLOG(
"Write the nodes");
2072 map<int,XYZ>::iterator itNodes, itNodes2;
2075 Output << setprecision(12) << itNodes->first <<
", " << itNodes->second.x <<
", " << itNodes->second.y <<
", " << itNodes->second.z <<
"\n";
2078 TGLOG(
"Nodes written");
2087 vector<int>::const_iterator itNodes;
2088 for(itNodes = nodes.begin(); itNodes != nodes.end(); ++itNodes) {
2089 vector<int>::iterator itEnc;
2091 elems.push_back(*itEnc);
2096 elems.erase(remove(elems.begin(), elems.end(), currentElement), elems.end());
2098 if (p.second == 4) {
2109 vector<int> facesInd;
2111 if (NodeIndices.size() == 5 || NodeIndices.size() == 4)
2113 if (NodeIndices.size() == 6)
2115 if (NodeIndices.size() == 7)
2117 if (NodeIndices.size() == 8)
2121 while (i < numFaces) {
2122 if (NodeIndices.count(0) && NodeIndices.count(1) && NodeIndices.count(2) && NodeIndices.count(3)) {
2131 facesInd.push_back(0), i++;
2134 if (NodeIndices.count(4) && NodeIndices.count(5) && NodeIndices.count(6) && NodeIndices.count(7)) {
2143 facesInd.push_back(1), i++;
2146 if (NodeIndices.count(0) && NodeIndices.count(1) && NodeIndices.count(4) && NodeIndices.count(5)) {
2155 facesInd.push_back(2), i++;
2158 if (NodeIndices.count(1) && NodeIndices.count(2) && NodeIndices.count(5) && NodeIndices.count(6)) {
2167 facesInd.push_back(3), i++;
2170 if (NodeIndices.count(2) && NodeIndices.count(3) && NodeIndices.count(6) && NodeIndices.count(7)) {
2179 facesInd.push_back(4), i++;
2182 if (NodeIndices.count(3) && NodeIndices.count(0) && NodeIndices.count(7) && NodeIndices.count(4)) {
2191 facesInd.push_back(5), i++;
2194 if (k++ > numFaces) {
2196 return make_pair(i,facesInd);
2200 return make_pair(numFaces, facesInd);
2206 map<int, vector<int>> NodeSets;
2207 vector<POINT_INFO>::iterator itData;
2208 vector<int>::iterator itNodes;
2209 map<int, vector<int>>::iterator itNodeSurf, itNodeSets;
2221 for (itNodeSets = NodeSets.begin(); itNodeSets != NodeSets.end(); ++itNodeSets) {
2222 vector<int> mat = itNodeSets->second;
2223 sort(mat.begin(), mat.end());
2224 mat.erase( unique(mat.begin(), mat.end()), mat.end() );
2225 itNodeSets->second = mat;
2229 for (itNodeSets = NodeSets.begin(); itNodeSets != NodeSets.end(); ++itNodeSets) {
2230 map<int,vector<int>>::iterator itTempNodeSet;
2231 vector<int> currentSet;
2232 for (itTempNodeSet = NodeSets.begin(); itTempNodeSet != NodeSets.end(); ++itTempNodeSet) {
2233 if (itNodeSets->first != itTempNodeSet->first) {
2234 vector<int> v1 = itNodeSets->second;
2235 vector<int> v2 = itTempNodeSet->second;
2236 sort(v1.begin(), v1.end());
2237 sort(v2.begin(), v2.end());
2239 vector<int> v_intersection;
2240 set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(v_intersection));
2241 currentSet.insert(currentSet.end(), v_intersection.begin(), v_intersection.end());
2244 sort(currentSet.begin(), currentSet.end());
2245 currentSet.erase( unique(currentSet.begin(), currentSet.end()), currentSet.end());
2246 NodeSurf[itNodeSets->first] = currentSet;
2250 for (itNodeSurf = NodeSurf.begin(); itNodeSurf != NodeSurf.end(); ++itNodeSurf) {
2251 for (itNodes = itNodeSurf->second.begin(); itNodes != itNodeSurf->second.end(); ++itNodes) {
2253 if ( find(AllSurf.begin(), AllSurf.end(), *itNodes) == AllSurf.end() )
2254 AllSurf.push_back(*itNodes);
2261 vector<POINT_INFO>::iterator itData;
2262 map<int, vector<int>>::const_iterator itNodeSurf;
2265 map<int,XYZ> AllLapl;
2266 map<int,XYZ> PrevNodes;
2269 vector<int> v = AllSurf;
2270 sort(v.begin(),v.end());
2273 map<int, vector<int>>::iterator itNeighbourNodes;
2277 vector<int> v_intersection;
2279 temp = itNeighbourNodes->second;
2280 sort(temp.begin(), temp.end());
2281 temp.erase( unique(temp.begin(), temp.end()), temp.end());
2282 set_intersection(v.begin(), v.end(), temp.begin(), temp.end(), back_inserter(v_intersection));
2283 itNeighbourNodes->second = v_intersection;
2286 for (
int iter_i = 0; iter_i <
m_smoothIter; iter_i++) {
2296 double diag = sqrt( 4*max_dx * max_dx + 4*max_dy * max_dy + 4*max_dz * max_dz );
2298 for (itNodeSurf = NodeSurf.begin(); itNodeSurf != NodeSurf.end(); ++itNodeSurf) {
2299 vector<int>::const_iterator itNodes;
2300 for (itNodes = itNodeSurf->second.begin(); itNodes != itNodeSurf->second.end(); ++itNodes) {
2301 vector<int>::iterator itNeighbour;
2302 XYZ laplacian(0.0, 0.0, 0.0);
2306 XYZ orig = PrevNodes[*itNodes];
2309 laplacian -= coef/num*(orig -
AllNodes[*itNeighbour]);
2322 if ( AllLapl.find(*itNodes) == AllLapl.end() ) {
2323 AllLapl.insert(make_pair(*itNodes,laplacian));
2328 map<int, XYZ>::iterator itNodes;
2330 if ( AllLapl.find(itNodes->first) != AllLapl.end() ) {
2331 AllNodes[itNodes->first] += AllLapl[itNodes->first];
2332 XYZ node_move =
AllNodes[itNodes->first] - OldNodes[itNodes->first];
2335 if ( fabs(node_move.
x) > max_dx || fabs(node_move.
y) > 0.5 * max_dy || fabs(node_move.
z) > max_dz ||
2336 sqrt( node_move.
x * node_move.
x + node_move.
y * node_move.
y + node_move.
z * node_move.
z) > diag)
2337 AllNodes[itNodes->first] -= AllLapl[itNodes->first];
2355 vector<int> AllSurfElems;
2356 vector<POINT_INFO>::iterator itData;
2357 vector<int>::const_iterator itNodes;
2358 map<int, vector<int>>::iterator itNodeSurf, itElemSurf, itYarnElems;
2359 map<int, vector<int>> MyNodeSurf, MyElemSurf, InteriorElems;
2360 vector<POINT_INFO>::iterator itInfo;
2362 int extraNodeCount = 3000000;
2365 for (itNodes = AllSurf.begin(); itNodes != AllSurf.end(); ++itNodes) {
2368 vector<int>::iterator itEncounter;
2378 int minMaterial = *min_element(temp.begin(), temp.end());
2380 vector<int> usedMaterial;
2381 vector<int> usedNodes;
2392 MyElemSurf[
m_ElementsInfo[*itEncounter-1].iYarnIndex].push_back(*itEncounter);
2393 MyNodeSurf[
m_ElementsInfo[*itEncounter-1].iYarnIndex].push_back(*itNodes);
2398 for (itNodeSurf = MyNodeSurf.begin(); itNodeSurf != MyNodeSurf.end(); ++itNodeSurf)
2400 sort( itNodeSurf->second.begin(), itNodeSurf->second.end());
2401 itNodeSurf->second.erase( unique(itNodeSurf->second.begin(), itNodeSurf->second.end()) , itNodeSurf->second.end() );
2406 for (itElemSurf = MyElemSurf.begin(); itElemSurf != MyElemSurf.end(); ++itElemSurf)
2408 sort( itElemSurf->second.begin(), itElemSurf->second.end());
2409 itElemSurf->second.erase( unique(itElemSurf->second.begin(), itElemSurf->second.end()) , itElemSurf->second.end() );
2412 for (itElemSurf = MyElemSurf.begin(); itElemSurf != MyElemSurf.end(); ++itElemSurf) {
2413 vector<int>::iterator itElems;
2414 for (itElems = itElemSurf->second.begin(); itElems != itElemSurf->second.end(); ++itElems) {
2418 if ( checkFaces.first != -1 ) {
2419 vector<int>::iterator itFace;
2420 for (itFace = checkFaces.second.begin(); itFace != checkFaces.second.end(); ++itFace) {
2429 for (itNodes = AllSurf.begin(); itNodes != AllSurf.end(); ++itNodes) {
2432 vector<int>::iterator itEncounter;
2442 int minMaterial = *min_element(temp.begin(), temp.end());
2444 vector<int> usedMaterial;
2445 vector<int> usedNodes;
2456 MyElemSurf[
m_ElementsInfo[*itEncounter-1].iYarnIndex].push_back(*itEncounter);
2459 MyNodeSurf[
m_ElementsInfo[*itEncounter-1].iYarnIndex].push_back(*itNodes);
2461 vector<int>::iterator it = find(usedMaterial.begin(), usedMaterial.end(),
m_ElementsInfo[*itEncounter-1].iYarnIndex);
2462 if ( usedMaterial.size() > 0 && it != usedMaterial.end() ) {
2464 replace(
m_AllElements[*itEncounter-1].begin(),
m_AllElements[*itEncounter-1].end(), *itNodes, usedNodes[it - usedMaterial.begin()]);
2468 MyNodeSurf[
m_ElementsInfo[*itEncounter-1].iYarnIndex].push_back(extraNodeCount);
2472 usedMaterial.push_back(
m_ElementsInfo[*itEncounter - 1].iYarnIndex);
2473 usedNodes.push_back(extraNodeCount);
2480 for (itNodeSurf = MyNodeSurf.begin(); itNodeSurf != MyNodeSurf.end(); ++itNodeSurf)
2482 sort( itNodeSurf->second.begin(), itNodeSurf->second.end());
2483 itNodeSurf->second.erase( unique(itNodeSurf->second.begin(), itNodeSurf->second.end()) , itNodeSurf->second.end() );
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
const int p8est_face_corners[6][4]
int GetFaceIndex(CMesh::ELEMENT_TYPE ElemType, const set< int > &NodeIndices)
const int p8est_edge_corners[12][2]
pair< int, int > most_common(vector< int > v)
static int lnodes_decode2(p4est_lnodes_code_t face_code, int hanging_corner[P4EST_CHILDREN])
int my_comparison(double x, double y)
vector< int > GetFaceIndices(CMesh::ELEMENT_TYPE ElemType, const set< int > &NodeIndices)
set< int > GetCommonIndices(const vector< int > &SurfIndices, const vector< int > &VolIndices)
static const int corner_num_hanging[P4EST_CHILDREN]
static const int * corner_to_hanging[P4EST_CHILDREN]
int duplicatedHangingNode(double vxyz[3], double hang_coord[8][3], int hang_nums[8])
const CMesh & GetMesh() const
Get the mesh representing the domain as a surface mesh.
ELEMENT_TYPE
Each element type is represented by a unique integer value.
pair< XYZ, XYZ > GetAABB(double dGrowDistance=0) const
Get an axis aligned bounding box for the mesh.
void OutputSurfaces(const std::map< int, vector< int > > &NodeSurf, const std::vector< int > &AllSurf)
vector< std::vector< int > > m_AllElements
void OutputPeriodicBoundaries(ostream &Output, CTextile &Textile, int iBoundaryConditions, bool bMatrixOnly)
Store info (nodes at boundaries) for periodic BCs.
static vector< vector< int > > FaceZ_max
static vector< vector< int > > FaceX_max
map< int, vector< int > > m_NeighbourNodes
vector< vector< int > > m_TetElements
int CreateP4ESTRefinement(int min_level, int refine_level)
Performs octree refinement using external P4EST library.
static vector< XYZ > cornerPoints
void SaveVoxelMesh(CTextile &Textile, string OutputFilename, int XVoxNum, int YVoxNum, int ZVoxNum, int min_level, int refine_level, bool smoothing, int smoothIter, double smooth1, double smooth2, bool surfaceOuput)
static int getPointsInfo(vector< XYZ > myPoints, int refineLevel)
static vector< char > materialInfo
static vector< vector< int > > FaceX_min
void extractSurfaceNodeSets(std::map< int, vector< int > > &NodeSurf, std::vector< int > &AllSurf)
int storeHangingNode(int *all_lni, int *hanging_corner, int node_i, int hanging_count, double v[3])
Storing hanging nodes from octree-mesh to a vector for writing the constraints.
map< int, vector< pair< int, int > > > m_SurfaceElementFaces
static vector< XYZ > CentrePoints
vector< Point > m_boundaryPoints
static int refine_fn_post(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
COctreeVoxelMesh(string Type="CPeriodicBoundaries")
static vector< vector< int > > FaceY_min
bool CalculateVoxelSizes(CTextile &Textile)
Calculate voxel size based on number of voxels on each axis and domain size.
static int refine_fn_uni(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
map< int, vector< int > > m_SurfaceNodes
static int refine_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
virtual ~COctreeVoxelMesh(void)
static void FindLocMinMax(int &XMin, int &XMax, int &YMin, int &YMax, XYZ &Min, XYZ &Max)
int checkIndex(int currentElement, vector< int > nodes)
map< int, vector< int > > m_NodeConstraints
int isBoundary(double p[3])
pair< int, vector< int > > GetFaceIndices2(CMesh::ELEMENT_TYPE ElemType, const set< int > &NodeIndices, int currentElement)
int OutputHexElements(ostream &Output, bool bOutputMatrix, bool bOutputYarn, int Filetype=INP_EXPORT)
Output elements to .inp file.
static pair< XYZ, XYZ > g_DomainAABB
map< int, vector< int > > m_NodesEncounter
static vector< vector< int > > FaceY_max
void OutputNodes(ostream &Output, CTextile &Textile, int Filetype=INP_EXPORT)
Outputs nodes to .inp file and gets element information.
map< string, int > m_NodeConstraintsReverse
void storePointInfo(int refineLevel)
int writeTempFile(string filename, pair< XYZ, XYZ > myDomain)
static int refine_fn_periodic(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
p4est_connectivity_t * conn
void smoothing(const std::map< int, vector< int > > &NodeSurf, const vector< int > &AllSurf)
Smoothing.
static vector< vector< int > > FaceZ_min
void ConvertOctreeToNodes()
Decode the P4EST mesh structure and store nodes/elements.
void SetFaceB(vector< int > &B1, vector< int > &B2)
void CreatePeriodicBoundaries(ostream &Output, int iDummyNodeNum, CTextile &Textile, int iBoundarConditions, bool bMatrixOnly)
void SetEdges(vector< int > &Edge)
virtual void SetDomainSize(const CMesh &Mesh)
void SetVertex(int Vertex)
void SetFaceA(vector< int > &A1, vector< int > &A2)
void SetFaceC(vector< int > &C1, vector< int > &C2)
Represents a textile cell containing yarns.
const CDomain * GetDomain() const
void GetPointInformation(const vector< XYZ > &Points, vector< POINT_INFO > &PointsInfo, double dTolerance=1e-9)
Get useful information of a list of points.
Class used to meaure the amount of time it takes to perform a certain task.
void stop(const char *msg=0)
Stop the timer and print an optional message.
void check(const char *msg=0)
void start(const char *msg=0)
Class used to generate voxel mesh for output to ABAQUS.
pair< XYZ, XYZ > m_DomainAABB
Domain limits.
int m_XVoxels
Number of voxels along x,y and z axes.
CPeriodicBoundaries * m_PeriodicBoundaries
vector< POINT_INFO > m_ElementsInfo
Element information as calculated by GetPointInformation.
virtual void SaveVoxelMesh(CTextile &Textile, string OutputFilename, int XVoxNum, int YVoxNum, int ZVoxNum, bool bOutputMatrix, bool bOutputYarns, int iBoundaryConditions, int iElementType=0, int FileType=INP_EXPORT)
Namespace containing a series of customised math operations not found in the standard c++ library.
void WriteValues(std::ostream &Output, T &Values, int iMaxPerLine)
double Max(XYZ &Vector)
Get maximum element of vector and return it.
XYZ Min(const XYZ &P1, const XYZ &P2)
Given two points, return a new point who's coordinates are the smaller of the two.
Structure used to retreive information about a particular point in space.
Struct for representing points in 3D space.