63 os <<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
nl;
85 pointStream <<
"l " <<
e.start() + 1 <<
' ' <<
e.end() + 1 <<
nl;
100 Info<<
"Writing mesh points and edges to " << fName <<
endl;
112 label celli = cellLabels[i];
118 const edge&
e =
mesh.edges()[cEdges[cEdgeI]];
122 const auto e0Fnd = pointToObj.cfind(
e[0]);
132 pointToObj.insert(
e[0], v0);
137 const auto e1Fnd = pointToObj.cfind(
e[1]);
147 pointToObj.insert(
e[1], v1);
151 str <<
"l " << v0+1 <<
' ' << v1+1 <<
nl;
171 Info<<
"Writing mesh points and edges to " << fName <<
endl;
175 const cell& cFaces =
mesh.cells()[celli];
188 /
"meshFaceCentres_" +
timeName +
".obj"
191 Info<<
"Writing mesh face centres to " << faceFile <<
endl;
206 mesh.time().path()/
"meshCellCentres_" +
timeName +
".obj"
209 Info<<
"Writing mesh cell centres to " << cellFile <<
endl;
220void writePatchCentres
237 Info<<
"Writing patch face centres to " << faceFile <<
endl;
243 writeOBJ(
pp.faceCentres()[facei], patchFaceStream);
264 /
"patchFaces_" +
pp.name() +
'_' +
timeName +
".obj"
267 Info<<
"Writing patch faces to " << faceFile <<
endl;
273 writeOBJ(
pp.localPoints()[pointi], patchFaceStream);
278 const face&
f =
pp.localFaces()[facei];
280 patchFaceStream<<
'f';
284 patchFaceStream <<
' ' <<
f[fp]+1;
286 patchFaceStream <<
nl;
292void writePatchBoundaryEdges
307 /
"patchEdges_" +
pp.name() +
'_' +
timeName +
".obj"
310 Info<<
"Writing patch edges to " << edgeFile <<
endl;
316 writeOBJ(
pp.localPoints()[pointi], patchEdgeStream);
319 for (label edgeI =
pp.nInternalEdges(); edgeI <
pp.nEdges(); edgeI++)
321 if (
pp.edgeFaces()[edgeI].size() == 1)
323 const edge&
e =
pp.edges()[edgeI];
325 patchEdgeStream<<
"l " <<
e[0]+1 <<
' ' <<
e[1]+1 <<
nl;
347 allEdges.insert(cEdges);
354 /
"pointEdges_" +
timeName +
'_' +
name(pointi) +
".obj"
357 Info<<
"Writing pointEdges to " << pFile <<
endl;
363 for (
const label edgei : allEdges)
369 pointStream<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
375int main(
int argc,
char *argv[])
379 "For mesh debugging: write mesh as separate OBJ files"
386 "Write patch faces edges"
391 "Write patch boundary edges"
397 "Write points for the specified cell"
403 "Write specified face"
409 "Write specified point"
415 "Write points for specified cellSet"
421 "Write points for specified faceSet"
430 const bool patchFaces =
args.found(
"patchFaces");
431 const bool patchEdges =
args.found(
"patchEdges");
432 const bool doCell =
args.found(
"cell");
433 const bool doPoint =
args.found(
"point");
434 const bool doFace =
args.found(
"face");
435 const bool doCellSet =
args.found(
"cellSet");
436 const bool doFaceSet =
args.found(
"faceSet");
439 Info<<
"Writing mesh objects as .obj files such that the object"
440 <<
" numbering" <<
endl
441 <<
"(for points, faces, cells) is consistent with"
442 <<
" Foam numbering (starting from 0)." <<
endl <<
endl;
450 runTime.setTime(timeDirs[timeI], timeI);
468 const label celli =
args.get<label>(
"cell");
474 const label pointi =
args.get<label>(
"point");
480 const label facei =
args.get<label>(
"face");
492 Info<<
"Writing mesh points and edges to " << fName <<
endl;
502 const word setName =
args[
"cellSet"];
506 Info<<
"Read " <<
cells.size() <<
" cells from set " << setName
513 const word setName =
args[
"faceSet"];
517 Info<<
"Read " << faces.size() <<
" faces from set " << setName
530 Info<<
"Writing mesh points and edges to " << fName <<
endl;
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A HashTable to objects of type <T> with a label key.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void size(const label n)
Older name for setAddressableSize.
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A collection of cell labels.
A cell is defined as a list of faces with extra functionality.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Inserts points at locations specified in a pointFile into the surfaces to be conformed to of the conf...
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
A patch is a list of labels that address the faces in the global face list.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options and also set the runTime to the first i...
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
OBJstream os(runTime.globalPath()/outputName)
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
List< instant > instantList
List of instants.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.