Go to the documentation of this file.
39 template<
class>
class FaceList,
49 const label startFaceI,
50 const label startEdgeI,
56 if (!pFacesHad[index])
59 pFacesHad[index] =
true;
62 const labelList& fEdges = faceEdges()[startFaceI];
68 label edgeI = fEdges[i];
70 const edge&
e = edges()[edgeI];
72 if (edgeI != startEdgeI && (
e[0] == pointI ||
e[1] == pointI))
84 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
86 ) <<
"Problem: cannot find edge out of " << fEdges
87 <<
"on face " << startFaceI <<
" that uses point " << pointI
92 const labelList& eFaces = edgeFaces()[nextEdgeI];
96 if (eFaces[i] != startFaceI)
117 template<
class>
class FaceList,
127 Info<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
129 "calculating patch topology"
141 if (nNbrs < 1 || nNbrs > 2)
157 Info<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
159 "finished calculating patch topology"
170 template<
class>
class FaceList,
184 Info<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
185 "checkTopology(const bool, labelHashSet&) : "
186 "checking patch topology"
200 if (nNbrs < 1 || nNbrs > 2)
202 surfaceType = ILLEGAL;
206 Info<<
"Edge " << edgeI <<
" with vertices:" << edges()[edgeI]
207 <<
" has " << nNbrs <<
" face neighbours"
213 const edge&
e = edges()[edgeI];
215 setPtr->
insert(meshPoints()[
e.start()]);
216 setPtr->
insert(meshPoints()[
e.end()]);
227 Info<<
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
228 "checkTopology(const bool, labelHashSet&) : "
229 "finished checking patch topology"
233 return surfaceType == ILLEGAL;
240 template<
class>
class FaceList,
257 bool foundError =
false;
268 label startEdgeI = pEdges[0];
270 const labelList& eFaces = ef[startEdgeI];
276 this->visitPointRegion
299 setPtr->
insert(meshPointI);
304 Info<<
"Point " << meshPointI
305 <<
" uses faces which are not connected through an edge"
307 <<
"This means that the surface formed by this patched"
308 <<
" is multiply connected at this point" <<
nl
309 <<
"Connected (patch) faces:" <<
nl;
319 Info<<
nl <<
"Unconnected (patch) faces:" <<
nl;
338 template<
class>
class FaceList,
354 mps <<
"# vtk DataFile Version 2.0" <<
nl
357 <<
"DATASET POLYDATA" <<
nl
358 <<
"POINTS " <<
points.size() <<
" float" <<
nl;
366 mlpBuffer[counter++] = float(
points[i].
x());
367 mlpBuffer[counter++] = float(
points[i].
y());
368 mlpBuffer[counter++] = float(
points[i].z());
373 mps << mlpBuffer[i] <<
' ';
375 if (i > 0 && (i % 10) == 0)
382 label nFaceVerts = 0;
386 nFaceVerts += faces[faceI].
size() + 1;
393 const Face&
f = faces[faceI];
395 mlfBuffer[counter++] =
f.size();
399 mlfBuffer[counter++] =
f[fpI];
404 mps <<
"POLYGONS " << faces.
size() <<
' ' << nFaceVerts <<
endl;
408 mps << mlfBuffer[i] <<
' ';
410 if (i > 0 && (i % 10) == 0)
422 template<
class>
class FaceList,
438 mps <<
"# vtk DataFile Version 2.0" <<
nl
441 <<
"DATASET POLYDATA" <<
nl
442 <<
"POINTS " << faces.
size() <<
" float" <<
nl;
452 mlPointBuffer[counter++] = float(
c.x());
453 mlPointBuffer[counter++] = float(
c.y());
454 mlPointBuffer[counter++] = float(
c.z());
459 mps << mlPointBuffer[i] <<
' ';
461 if (i > 0 && (i % 10) == 0)
469 mps <<
"POINT_DATA " << faces.
size() <<
nl
470 <<
"FIELD attributes " << 1 <<
nl
471 <<
"normals" <<
" 3 "
472 << faces.
size() <<
" float" <<
nl;
481 mlNormalBuffer[counter++] = float(
n.x());
482 mlNormalBuffer[counter++] = float(
n.y());
483 mlNormalBuffer[counter++] = float(
n.z());
486 forAll (mlNormalBuffer, i)
488 mps << mlNormalBuffer[i] <<
' ';
490 if (i > 0 && (i % 10) == 0)
502 template<
class>
class FaceList,
525 template<
class>
class FaceList,
const dimensionedScalar mp
Proton mass.
A class for handling file names.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
static void writeVTK(const fileName &name, const FaceListType &faces, const Field< PointType > &points)
Write generic VTK patch, HJ, 14/Jan/2009.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Ostream & endl(Ostream &os)
Add newline and flush stream.
surfaceTopo surfaceType() const
Calculate surface type formed by patch.
void writeVTK(OFstream &os, const Type &value)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
bool checkTopology(const bool report=false, labelHashSet *setPtr=NULL) const
Check surface formed by patch for manifoldness (see above).
void visitPointRegion(const label pointI, const labelList &pFaces, const label startFaceI, const label startEdgeI, boolList &pFacesHad) const
Face-edge-face walk while remaining on a patch point.
errorManip< error > abort(error &err)
surfaceTopo
Enumeration defining the surface type. Used in check routines.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void writeVTKNormals(const fileName &name, const FaceListType &faces, const Field< PointType > &points)
Write generic VTK patch normals, HJ, 14/Jan/2009.
const dimensionedScalar e
Elementary charge.
bool insert(const Key &key)
Insert a new entry.
const dimensionedScalar c
Speed of light in a vacuum.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Various functions to operate on Lists.
void size(const label)
Override size to be inconsistent with allocated storage.
bool checkPointManifold(const bool report=false, labelHashSet *setPtr=NULL) const
Checks primitivePatch for faces sharing point but not edge.
word name(const complex &)
Return a string representation of a complex.
A list of faces which address into the list of points.