48template<
class ReadGeoField,
class MappedGeoField>
55 const typename MappedGeoField::value_type& nullValue,
59 typedef typename MappedGeoField::value_type Type;
64 tetFields.
setSize(fieldObjects.size());
69 Info<<
"Converting " << ReadGeoField::typeName <<
' ' << iter.key()
72 ReadGeoField readField(*iter(),
mesh);
87 readField.registerObject()
89 pointMesh::New(tetDualMesh),
97 fld.setSize(map.
size(), nullValue);
100 label index = map[pointi];
104 label celli = index-1;
105 fld[pointi] = readField[celli];
109 label facei = -index-1;
110 label bFacei = facei -
mesh.nInternalFaces();
113 label patchi =
mesh.boundaryMesh().patchID()[bFacei];
114 label localFacei =
mesh.boundaryMesh()[patchi].whichFace
118 fld[pointi] = readField.boundaryField()[patchi][localFacei];
136 tetFields[i].correctBoundaryConditions();
143int main(
int argc,
char *argv[])
147 "Convert polyMesh results to tetDualMesh"
164 Info<<
"Create tetDualMesh for time = "
182 "pointDualAddressing",
190 if (pointDualAddressing.size() != tetDualMesh.
nPoints())
193 <<
"Size " << pointDualAddressing.size()
194 <<
" of addressing map " << pointDualAddressing.objectPath()
195 <<
" differs from number of points in mesh "
203 label nPatchFaces = 0;
205 forAll(pointDualAddressing, pointi)
207 label index = pointDualAddressing[pointi];
219 label facei = -index-1;
220 if (facei <
mesh.nInternalFaces())
223 <<
"Face " << facei <<
" from index " << index
224 <<
" is not a boundary face."
225 <<
" nInternalFaces:" <<
mesh.nInternalFaces()
238 Info<<
"tetDualMesh points : " << tetDualMesh.
nPoints()
239 <<
" of which mapped to" <<
nl
240 <<
" cells : " << nCells <<
nl
241 <<
" patch faces : " << nPatchFaces <<
nl
242 <<
" not mapped : " << nUnmapped <<
nl
251 ReadAndMapFields<volScalarField, pointScalarField>
262 ReadAndMapFields<volVectorField, pointVectorField>
273 ReadAndMapFields<volSphericalTensorField, pointSphericalTensorField>
284 ReadAndMapFields<volSymmTensorField, pointSymmTensorField>
295 ReadAndMapFields<volTensorField, pointTensorField>
305 tetDualMesh.objectRegistry::write();
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
reduce(hasMovingMesh, orOp< bool >())
Generic templated field type.
List of IOobjects with searching and retrieving facilities.
IOobjectList lookupClass(const char *clsName) const
The list of IOobjects with the given headerClassName.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
void setSize(const label newLen)
Same as resize()
void size(const label n)
Older name for setAddressableSize.
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
const fileName & facesInstance() const
Return the current instance directory for faces.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
label nPoints() const noexcept
Number of mesh points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.