From aac95d1038b436cca10abf464ab59d0a5849ad58 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 14 May 2008 12:42:26 +0100 Subject: [PATCH] Handling starting from 0 or 1 on indexing --- .../conversion/tetgenToFoam/tetgenToFoam.C | 169 ++++++++---------- 1 file changed, 70 insertions(+), 99 deletions(-) diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 6ce391ad03..9155c5f563 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -56,18 +56,14 @@ NOTE: always. Might use some geometric check instead. - marked faces might not actually be boundary faces of mesh. This is not handled and you'll have to run without face file (-noFaceFile option) -- default is to have indices starting at 1. Use -startAt0 if starting at 0. -- all input is expected to be ordered. + \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" #include "polyMesh.H" #include "IFstream.H" -#include "polyPatch.H" #include "cellModeller.H" -#include "ListOps.H" -#include using namespace Foam; @@ -79,7 +75,6 @@ int main(int argc, char *argv[]) { argList::validArgs.append("file prefix"); argList::validOptions.insert("noFaceFile", ""); - argList::validOptions.insert("startAt0", ""); # include "setRootCase.H" # include "createTime.H" @@ -87,34 +82,29 @@ int main(int argc, char *argv[]) bool readFaceFile = !args.options().found("noFaceFile"); - bool startAt1 = !args.options().found("startAt0"); - fileName prefix(args.additionalArgs()[0]); fileName nodeFile(prefix + ".node"); fileName eleFile(prefix + ".ele"); fileName faceFile(prefix + ".face"); - Info<< "Files:" << endl - << " nodes : " << nodeFile << endl - << " elems : " << eleFile << endl - << " faces : " << faceFile << endl - << endl; - - - if (readFaceFile) + if (!readFaceFile) { - Info<< "Reading .file for boundary information" << nl << endl; - } - if (startAt1) - { - Info<< "Numbering in files starts at 1" << nl << endl; + Info<< "Files:" << endl + << " nodes : " << nodeFile << endl + << " elems : " << eleFile << endl + << endl; } else { - Info<< "Numbering in files starts at 0" << nl << endl; - } + Info<< "Files:" << endl + << " nodes : " << nodeFile << endl + << " elems : " << eleFile << endl + << " faces : " << faceFile << endl + << endl; + Info<< "Reading .face file for boundary information" << nl << endl; + } if (!exists(nodeFile) || !exists(eleFile)) { @@ -134,7 +124,7 @@ int main(int argc, char *argv[]) } - std::ifstream nodeStream(nodeFile.c_str()); + IFstream nodeStream(nodeFile); // // Read nodes. @@ -145,7 +135,7 @@ int main(int argc, char *argv[]) do { - std::getline(nodeStream, line); + nodeStream.getLine(line); } while((line.size() > 0) && (line[0] == '#')); @@ -169,61 +159,60 @@ int main(int argc, char *argv[]) // pointField points(nNodes); + Map