87 auto&
fld = tfld.ref();
92 fld.internalFieldRef().field() =
96 const auto& map = reader.
faceMap();
99 for (
auto& pfld :
fld.boundaryFieldRef())
101 const auto&
pp = pfld.patch();
105 const label bFacei =
pp.patch().offset()+i;
106 pfld[i] =
field[map[bFacei]];
116 int main(
int argc,
char *argv[])
120 "Convert legacy VTK file (ascii) containing an unstructured grid" 121 " to an OpenFOAM mesh without boundary information" 131 const bool doFields = !
args.
found(
"no-fields");
145 std::move(reader.
points()),
167 Info<<
"Re-reading mesh ..." <<
endl;
170 constructVolFields<scalar>(
mesh, reader);
171 constructVolFields<vector>(
mesh, reader);
172 constructVolFields<sphericalTensor>(
mesh, reader);
173 constructVolFields<symmTensor>(
mesh, reader);
174 constructVolFields<tensor>(
mesh, reader);
List< faceList > faceListList
List of faceList.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A class for handling file names.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
UPtrList< const Type > csorted() const
Return sorted list of objects with a class satisfying isA<Type> or isType<Type> (with Strict) ...
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool store()
Register object with its registry and transfer ownership to the registry.
static void noParallel()
Remove the parallel options.
Reader for vtk UNSTRUCTURED_GRID legacy files. Supports single CELLS, POINTS etc. entry only...
const pointField & points() const noexcept
Points.
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
const labelList & faceMap() const noexcept
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
#define forAll(list, i)
Loop across all elements in list.
const cellShapeList & cells() const noexcept
3D cells
const labelList & cellMap() const noexcept
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
const objectRegistry & cellData() const noexcept
Cell based fields.
static word defaultRegion
Return the default region name.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
label size() const noexcept
The number of elements in the list.
static unsigned int minPrecision(unsigned int prec) noexcept
Set the minimum default precision.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
const word & constant() const noexcept
Return constant name.
Input from file stream as an ISstream, normally using std::ifstream for the actual input...
List< word > wordList
List of word.
T get(const label index) const
Get a value from the argument at index.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Automatically write from objectRegistry::writeObject()
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
A primitive field of type <T> with automated input and output.
bool found(const word &optName) const
Return true if the named option is found.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())