mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: enumerations for known cell models in cellModel, ptr/ref lookups
- this provides a better typesafe means of locating predefined cell models than relying on strings. The lookup is now ptr() or ref() directly. The lookup functions behave like on-demand singletons when loading "etc/cellModels". Functionality is now located entirely in cellModel but a forwarding version of cellModeller is provided for API (but not ABI) compatibility with older existing user code. STYLE: use constexpr for cellMatcher constants
This commit is contained in:
@ -42,7 +42,7 @@ Description
|
||||
#include "OFstream.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "basicMultiComponentMixture.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -13,8 +13,7 @@ points[5] = vector(1, 0, 1);
|
||||
points[6] = vector(1, 1, 1);
|
||||
points[7] = vector(0, 1, 1);
|
||||
|
||||
const cellModel& hexa = *(cellModeller::lookup("hex"));
|
||||
faceList faces = hexa.modelFaces();
|
||||
faceList faces = cellModel::ref(cellModel::HEX).modelFaces();
|
||||
|
||||
fvMesh mesh
|
||||
(
|
||||
@ -25,7 +24,7 @@ fvMesh mesh
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
xferMove<Field<vector>>(points),
|
||||
xferMove<pointField>(points),
|
||||
faces.xfer(),
|
||||
owner.xfer(),
|
||||
neighbour.xfer()
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "boundBox.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -52,15 +52,11 @@ boundBox cube(scalar start, scalar width)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
// #include "createTime.H"
|
||||
// #include "createMesh.H"
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
Info<<"boundBox faces: " << boundBox::faces << endl;
|
||||
Info<<"hex faces: " << hex.modelFaces() << endl;
|
||||
Info<<"tree-bb faces: " << treeBoundBox::faces << endl;
|
||||
Info<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
||||
Info<<"boundBox faces: " << boundBox::faces << nl
|
||||
<<"hex faces: " << cellModel::ref(cellModel::HEX).modelFaces() << nl
|
||||
<<"tree-bb faces: " << treeBoundBox::faces << nl
|
||||
<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
||||
|
||||
boundBox bb = boundBox::greatBox;
|
||||
Info<<"great box: " << bb << endl;
|
||||
|
||||
3
applications/test/cellModels/Make/files
Normal file
3
applications/test/cellModels/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-cellModels.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-cellModels
|
||||
0
applications/test/cellModels/Make/options
Normal file
0
applications/test/cellModels/Make/options
Normal file
97
applications/test/cellModels/Test-cellModels.C
Normal file
97
applications/test/cellModels/Test-cellModels.C
Normal file
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-cellModels
|
||||
|
||||
Description
|
||||
Print information about known cellModels
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellModel.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
void printInfo(const cellModel* mdl)
|
||||
{
|
||||
if (mdl)
|
||||
{
|
||||
Info<< *mdl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "nullptr" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void printInfo(const cellModel::modelType type)
|
||||
{
|
||||
Info<< cellModel::modelNames[type] << " = ";
|
||||
printInfo(cellModel::ptr(type));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Info<<"lookup by enum" << nl
|
||||
<<"=========================" << endl;
|
||||
|
||||
printInfo(cellModel::UNKNOWN);
|
||||
printInfo(cellModel::HEX);
|
||||
printInfo(cellModel::WEDGE);
|
||||
printInfo(cellModel::PRISM);
|
||||
printInfo(cellModel::PYR);
|
||||
printInfo(cellModel::TET);
|
||||
printInfo(cellModel::SPLITHEX);
|
||||
printInfo(cellModel::TETWEDGE);
|
||||
|
||||
|
||||
Info<<"lookup by name" << nl
|
||||
<<"=========================" << endl;
|
||||
|
||||
printInfo(cellModel::ptr("tet"));
|
||||
|
||||
Info<<"lookup by index" << nl
|
||||
<<"=========================" << endl;
|
||||
|
||||
printInfo(cellModel::ptr(7));
|
||||
|
||||
// Compatibility mode
|
||||
Info<<"cellModeller::lookup (compatibility)" << nl
|
||||
<<"=========================" << endl;
|
||||
|
||||
printInfo(cellModeller::lookup("tet"));
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -52,7 +52,7 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "cellCuts.H"
|
||||
#include "cellSet.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "meshCutter.H"
|
||||
#include "unitConversion.H"
|
||||
#include "geomCellLooper.H"
|
||||
@ -387,7 +387,7 @@ void collectCuts
|
||||
const vectorField& faceAreas = mesh.faceAreas();
|
||||
|
||||
// Hex shape
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
// cut handling functions
|
||||
edgeVertex ev(mesh);
|
||||
|
||||
@ -56,7 +56,6 @@ using namespace Foam;
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
#include "SLList.H"
|
||||
#include "SLPtrList.H"
|
||||
|
||||
@ -363,10 +362,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
labelList labelsHex(8);
|
||||
labelList labelsPrism(6);
|
||||
|
||||
@ -41,7 +41,6 @@ Description
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -545,7 +544,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
cellShapeList cellShapes(nMeshCells);
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
label nCreatedCells = 0;
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ Description
|
||||
#define cellShapeRecognition_H
|
||||
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
#include "faceList.H"
|
||||
#include "PtrList.H"
|
||||
|
||||
|
||||
@ -50,13 +50,13 @@ cellShape create3DCellShape
|
||||
static List<const cellModel*> fluentCellModelLookup
|
||||
(
|
||||
7,
|
||||
reinterpret_cast<const cellModel*>(0)
|
||||
nullptr
|
||||
);
|
||||
|
||||
fluentCellModelLookup[2] = cellModeller::lookup("tet");
|
||||
fluentCellModelLookup[4] = cellModeller::lookup("hex");
|
||||
fluentCellModelLookup[5] = cellModeller::lookup("pyr");
|
||||
fluentCellModelLookup[6] = cellModeller::lookup("prism");
|
||||
fluentCellModelLookup[2] = cellModel::ptr(cellModel::TET);
|
||||
fluentCellModelLookup[4] = cellModel::ptr(cellModel::HEX);
|
||||
fluentCellModelLookup[5] = cellModel::ptr(cellModel::PYR);
|
||||
fluentCellModelLookup[6] = cellModel::ptr(cellModel::PRISM);
|
||||
|
||||
static label faceMatchingOrder[7][6] =
|
||||
{
|
||||
|
||||
@ -51,7 +51,7 @@ cellShape extrudedQuadCellShape
|
||||
|
||||
if (!hexModelPtr_)
|
||||
{
|
||||
hexModelPtr_ = cellModeller::lookup("hex");
|
||||
hexModelPtr_ = cellModel::ptr(cellModel::HEX);
|
||||
}
|
||||
|
||||
const cellModel& hex = *hexModelPtr_;
|
||||
|
||||
@ -28,7 +28,7 @@ Description
|
||||
|
||||
#include "cellShapeRecognition.H"
|
||||
#include "labelList.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,7 +52,7 @@ cellShape extrudedTriangleCellShape
|
||||
|
||||
if (!prismModelPtr_)
|
||||
{
|
||||
prismModelPtr_ = cellModeller::lookup("prism");
|
||||
prismModelPtr_ = cellModel::ptr(cellModel::PRISM);
|
||||
}
|
||||
|
||||
const cellModel& prism = *prismModelPtr_;
|
||||
|
||||
@ -34,7 +34,7 @@ using std::ios;
|
||||
#include "wallFvPatch.H"
|
||||
#include "symmetryPlaneFvPatch.H"
|
||||
#include "symmetryFvPatch.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -218,10 +218,10 @@ void Foam::fluentFvMesh::writeFluentMesh() const
|
||||
<< "(12 (1 1 "
|
||||
<< nCells() << " 1 0)(" << std::endl;
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
const cellShapeList& cells = cellShapes();
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpMeshConversionUtilities
|
||||
|
||||
Description
|
||||
Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
|
||||
Reads an OpenFOAM mesh and writes a STARCD/PROSTAR (v4) bnd/cel/vrt format.
|
||||
|
||||
Usage
|
||||
\b foamToStarMesh [OPTION]
|
||||
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"read OpenFOAM mesh and write a pro-STAR (v4) bnd/cel/vrt format"
|
||||
"read OpenFOAM mesh and write a STARCD/PROSTAR (v4) bnd/cel/vrt format"
|
||||
);
|
||||
argList::noParallel();
|
||||
timeSelector::addOptions();
|
||||
|
||||
@ -53,7 +53,6 @@ using namespace Foam;
|
||||
#include "polyMesh.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellShape.H"
|
||||
#include "SLList.H"
|
||||
#include "SLPtrList.H"
|
||||
@ -699,10 +698,10 @@ int main(int argc, char *argv[])
|
||||
cellLookup[cellMap[celli] ] = celli;
|
||||
}
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
labelList labelsHex(8);
|
||||
labelList labelsPrism(6);
|
||||
|
||||
@ -52,7 +52,7 @@ Description
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IFstream.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "repatchPolyTopoChanger.H"
|
||||
#include "cellSet.H"
|
||||
#include "faceSet.H"
|
||||
@ -435,10 +435,10 @@ void readCells
|
||||
|
||||
Info<< "Starting to read cells at line " << inFile.lineNumber() << endl;
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
face triPoints(3);
|
||||
face quadPoints(4);
|
||||
|
||||
@ -42,7 +42,7 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "IFstream.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "cellSet.H"
|
||||
#include "faceSet.H"
|
||||
#include "DynamicList.H"
|
||||
@ -291,9 +291,9 @@ void readCells
|
||||
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
|
||||
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
labelHashSet skippedElements;
|
||||
|
||||
|
||||
@ -37,7 +37,6 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "Fstream.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "wallPolyPatch.H"
|
||||
|
||||
@ -102,7 +102,7 @@ cellShapeList cellShapes(nPoints);
|
||||
|
||||
labelList cellZoning(nPoints, -1);
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
labelList hexLabels(8);
|
||||
label activeCells = 0;
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Description
|
||||
#include "IFstream.H"
|
||||
#include "polyPatch.H"
|
||||
#include "ListOps.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@ -87,8 +87,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
cellShapeList cells(nCells);
|
||||
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
labelList tetPoints(4);
|
||||
labelList hexPoints(8);
|
||||
|
||||
@ -82,7 +82,7 @@ NOTE:
|
||||
#include "polyMesh.H"
|
||||
#include "IFstream.H"
|
||||
#include "polyPatch.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "triFace.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "nTets:" << nTets << endl;
|
||||
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
cellShapeList cells(nTets);
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@ Description
|
||||
#include "wallPolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
#include "mergePoints.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -202,7 +201,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
cellShapeList cellShapes(nMeshCells);
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
label nCreatedCells = 0;
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpMeshConversionUtilities
|
||||
|
||||
Description
|
||||
Converts a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
|
||||
Converts a STARCD/PROSTAR (v4) mesh into OpenFOAM format.
|
||||
|
||||
Usage
|
||||
\b star4ToFoam [OPTION] prostarMesh
|
||||
@ -66,11 +66,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"convert pro-STAR (v4) mesh to OpenFOAM"
|
||||
"convert STARCD/PROSTAR (v4) mesh to OpenFOAM"
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::validArgs.append("pro-STAR prefix");
|
||||
argList::validArgs.append("PROSTAR prefix");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"ascii",
|
||||
|
||||
@ -70,7 +70,7 @@ Note
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IFstream.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -276,8 +276,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
labelList tetPoints(4);
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@ Description
|
||||
#include "cellShapeControl.H"
|
||||
#include "backgroundMeshDecomposition.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
#include "DynamicField.H"
|
||||
#include "isoSurfaceCell.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
@ -252,7 +251,7 @@ autoPtr<polyMesh> generateHexMesh
|
||||
}
|
||||
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
cellShapeList cellShapes(nCells[0]*nCells[1]*nCells[2]);
|
||||
|
||||
labelList hexPoints(8);
|
||||
|
||||
@ -53,7 +53,6 @@ Description
|
||||
#include "faceSet.H"
|
||||
#include "motionSmoother.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "cellModeller.H"
|
||||
#include "uindirectPrimitivePatch.H"
|
||||
#include "surfZoneIdentifierList.H"
|
||||
#include "UnsortedMeshedSurface.H"
|
||||
|
||||
@ -57,7 +57,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
if (element_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
label nHex08 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
@ -80,7 +80,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
else if (element_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label nPen06 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
@ -103,7 +103,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
else if (element_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label nPyr05 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
@ -126,7 +126,7 @@ int USERD_get_part_elements_by_type
|
||||
//================================
|
||||
else if (element_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label nTet04 = 0;
|
||||
forAll(cellShapes, celli)
|
||||
|
||||
@ -37,8 +37,8 @@ const cellShapeList& cellShapes = meshPtr->cellShapes();
|
||||
// hexa's
|
||||
if (which_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
//const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
//const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
|
||||
label counter = 1;
|
||||
for (label celli=0; celli<nCells; celli++)
|
||||
@ -56,7 +56,7 @@ if (which_type == Z_HEX08)
|
||||
// penta's
|
||||
if (which_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -74,7 +74,7 @@ if (which_type == Z_PEN06)
|
||||
// pyramids's
|
||||
if (which_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -92,7 +92,7 @@ if (which_type == Z_PYR05)
|
||||
// tet's
|
||||
if (which_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
|
||||
@ -37,8 +37,8 @@ const cellShapeList& cellShapes = meshPtr->cellShapes();
|
||||
// hexa's
|
||||
if (which_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
//const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
//const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -56,7 +56,7 @@ if (which_type == Z_HEX08)
|
||||
// penta's
|
||||
if (which_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -74,7 +74,7 @@ if (which_type == Z_PEN06)
|
||||
// pyramids's
|
||||
if (which_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -93,7 +93,7 @@ if (which_type == Z_PYR05)
|
||||
// penta's
|
||||
if (which_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label counter = 1;
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ const cellShapeList& cellShapes = meshPtr->cellShapes();
|
||||
// hexa's
|
||||
if (which_type == Z_HEX08)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
//const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
//const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -56,7 +56,7 @@ if (which_type == Z_HEX08)
|
||||
// penta's
|
||||
if (which_type == Z_PEN06)
|
||||
{
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -74,7 +74,7 @@ if (which_type == Z_PEN06)
|
||||
// pyramids's
|
||||
if (which_type == Z_PYR05)
|
||||
{
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
@ -93,7 +93,7 @@ if (which_type == Z_PYR05)
|
||||
// tet's
|
||||
if (which_type == Z_TET04)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
label counter = 1;
|
||||
for (label n=0; n<nCells; n++)
|
||||
|
||||
@ -43,7 +43,7 @@ Description
|
||||
#include "Cloud.H"
|
||||
#include "passiveParticle.H"
|
||||
#include "fvMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "globalFoam.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Foam Dictionary.
|
||||
// An OpenFOAM dictionary of cellModels.
|
||||
// The index and name must match those listed in the cellModel class.
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -17,9 +18,7 @@ unknown
|
||||
{
|
||||
index 0;
|
||||
numberOfPoints 0;
|
||||
|
||||
faces 0();
|
||||
|
||||
edges 0();
|
||||
}
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# This file is part of OpenFOAM, licensed under the GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM.
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/ADIOS
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# This file is part of OpenFOAM, licensed under the GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM.
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/ADIOS
|
||||
|
||||
@ -442,11 +442,9 @@ $(cell)/cellIOList.C
|
||||
tetCell = $(meshShapes)/tetCell
|
||||
$(tetCell)/tetCell.C
|
||||
|
||||
cellModeller = $(meshShapes)/cellModeller
|
||||
$(cellModeller)/cellModeller.C
|
||||
|
||||
cellModel = $(meshShapes)/cellModel
|
||||
$(cellModel)/cellModel.C
|
||||
$(cellModel)/cellModels.C
|
||||
$(cellModel)/cellModelIO.C
|
||||
|
||||
cellShape = $(meshShapes)/cellShape
|
||||
|
||||
@ -106,11 +106,6 @@ bool Foam::JobInfo::constructed(false);
|
||||
#include "constants.C"
|
||||
#include "dimensionedConstants.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Read and set cell models
|
||||
|
||||
#include "globalCellModeller.C"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Create the jobInfo file in the $FOAM_JOB_DIR/runningJobs directory
|
||||
|
||||
|
||||
@ -276,7 +276,7 @@ Foam::scalar Foam::cell::mag
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::operator==(const cell& a, const cell& b)
|
||||
{
|
||||
@ -288,18 +288,16 @@ bool Foam::operator==(const cell& a, const cell& b)
|
||||
|
||||
List<bool> fnd(a.size(), false);
|
||||
|
||||
forAll(b, bI)
|
||||
for (const label curLabel : b)
|
||||
{
|
||||
const label curLabel = b[bI];
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll(a, aI)
|
||||
forAll(a, ai)
|
||||
{
|
||||
if (a[aI] == curLabel)
|
||||
if (a[ai] == curLabel)
|
||||
{
|
||||
found = true;
|
||||
fnd[aI] = true;
|
||||
fnd[ai] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -311,9 +309,9 @@ bool Foam::operator==(const cell& a, const cell& b)
|
||||
}
|
||||
|
||||
// Any faces missed?
|
||||
forAll(fnd, aI)
|
||||
forAll(fnd, ai)
|
||||
{
|
||||
if (!fnd[aI])
|
||||
if (!fnd[ai])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -45,13 +45,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class cell;
|
||||
bool operator==(const cell& a, const cell& b);
|
||||
inline bool operator!=(const cell& a, const cell& b);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cell Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -73,7 +66,7 @@ public:
|
||||
//- Construct null
|
||||
inline cell();
|
||||
|
||||
//- Construct given size
|
||||
//- Construct given size, with invalid point labels (-1)
|
||||
explicit inline cell(const label sz);
|
||||
|
||||
//- Construct from list of labels
|
||||
@ -132,15 +125,19 @@ public:
|
||||
|
||||
//- Returns cell volume
|
||||
scalar mag(const UList<point>& p, const faceUList& f) const;
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
friend bool operator==(const cell& a, const cell& b);
|
||||
friend bool operator!=(const cell& a, const cell& b);
|
||||
};
|
||||
|
||||
|
||||
// Global Operators
|
||||
|
||||
//- Test if both cells are the same size and contain the same points
|
||||
// The internal point ordering is ignored
|
||||
bool operator==(const cell& a, const cell& b);
|
||||
|
||||
//- Test if the cells differ (different size or different points)
|
||||
inline bool operator!=(const cell& a, const cell& b);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -61,6 +61,8 @@ inline Foam::label Foam::cell::nFaces() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::operator!=(const cell& a, const cell& b)
|
||||
{
|
||||
return !(a == b);
|
||||
|
||||
@ -31,9 +31,6 @@ Description
|
||||
#include "oppositeFace.H"
|
||||
#include "boolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::cell::opposingFaceLabel
|
||||
@ -125,64 +122,61 @@ Foam::oppositeFace Foam::cell::opposingFace
|
||||
{
|
||||
return oppositeFace(face(0), masterFaceLabel, oppFaceLabel);
|
||||
}
|
||||
else
|
||||
|
||||
// This is a prismatic cell. Go through all the vertices of the master
|
||||
// face and find an edge going from the master face vertex to a slave
|
||||
// face vertex. If all is OK, there should be only one such
|
||||
// edge for every master vertex and will provide te
|
||||
// master-to-slave vertex mapping. Assemble the opposite face
|
||||
// in the same manner as the master.
|
||||
|
||||
// Get reference to faces and prepare the return
|
||||
const face& masterFace = meshFaces[masterFaceLabel];
|
||||
const face& slaveFace = meshFaces[oppFaceLabel];
|
||||
|
||||
// Get cell edges
|
||||
const edgeList e = edges(meshFaces);
|
||||
boolList usedEdges(e.size(), false);
|
||||
|
||||
oppositeFace oppFace
|
||||
(
|
||||
face(masterFace.size()),
|
||||
masterFaceLabel,
|
||||
oppFaceLabel
|
||||
);
|
||||
|
||||
forAll(masterFace, pointi)
|
||||
{
|
||||
// This is a prismatic cell. Go through all the vertices of the master
|
||||
// face and find an edge going from the master face vertex to a slave
|
||||
// face vertex. If all is OK, there should be only one such
|
||||
// edge for every master vertex and will provide te
|
||||
// master-to-slave vertex mapping. Assemble the opposite face
|
||||
// in the same manner as the master.
|
||||
|
||||
// Get reference to faces and prepare the return
|
||||
const face& masterFace = meshFaces[masterFaceLabel];
|
||||
const face& slaveFace = meshFaces[oppFaceLabel];
|
||||
|
||||
// Get cell edges
|
||||
const edgeList e = edges(meshFaces);
|
||||
boolList usedEdges(e.size(), false);
|
||||
|
||||
oppositeFace oppFace
|
||||
(
|
||||
face(masterFace.size()),
|
||||
masterFaceLabel,
|
||||
oppFaceLabel
|
||||
);
|
||||
|
||||
forAll(masterFace, pointi)
|
||||
// Go through the list of edges and find the edge from this vertex
|
||||
// to the slave face
|
||||
forAll(e, edgeI)
|
||||
{
|
||||
// Go through the list of edges and find the edge from this vertex
|
||||
// to the slave face
|
||||
forAll(e, edgeI)
|
||||
if (!usedEdges[edgeI])
|
||||
{
|
||||
if (!usedEdges[edgeI])
|
||||
// Get the other vertex
|
||||
label otherVertex = e[edgeI].otherVertex(masterFace[pointi]);
|
||||
|
||||
if (otherVertex != -1)
|
||||
{
|
||||
// Get the other vertex
|
||||
label otherVertex =
|
||||
e[edgeI].otherVertex(masterFace[pointi]);
|
||||
|
||||
if (otherVertex != -1)
|
||||
// Found an edge coming from this vertex.
|
||||
// Check all vertices of the slave to find out
|
||||
// if it exists.
|
||||
forAll(slaveFace, slavePointi)
|
||||
{
|
||||
// Found an edge coming from this vertex.
|
||||
// Check all vertices of the slave to find out
|
||||
// if it exists.
|
||||
forAll(slaveFace, slavePointi)
|
||||
if (slaveFace[slavePointi] == otherVertex)
|
||||
{
|
||||
if (slaveFace[slavePointi] == otherVertex)
|
||||
{
|
||||
usedEdges[edgeI] = true;
|
||||
oppFace[pointi] = otherVertex;
|
||||
usedEdges[edgeI] = true;
|
||||
oppFace[pointi] = otherVertex;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oppFace;
|
||||
}
|
||||
|
||||
return oppFace;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ License
|
||||
#include "labelList.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellMatcher::cellMatcher
|
||||
@ -61,9 +60,9 @@ Foam::cellMatcher::cellMatcher
|
||||
f.setSize(maxVertPerFace);
|
||||
}
|
||||
|
||||
forAll(pointFaceIndex_, vertI)
|
||||
forAll(pointFaceIndex_, verti)
|
||||
{
|
||||
pointFaceIndex_[vertI].setSize(facePerCell);
|
||||
pointFaceIndex_[verti].setSize(facePerCell);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +82,7 @@ Foam::label Foam::cellMatcher::calcLocalFaces
|
||||
label newVertI = 0;
|
||||
forAll(myFaces, myFacei)
|
||||
{
|
||||
label facei = myFaces[myFacei];
|
||||
const label facei = myFaces[myFacei];
|
||||
|
||||
const face& f = faces[facei];
|
||||
face& localFace = localFaces_[myFacei];
|
||||
@ -202,10 +201,10 @@ void Foam::cellMatcher::calcPointFaceIndex()
|
||||
(
|
||||
label fp = 0;
|
||||
fp < faceSize_[localFacei];
|
||||
fp++
|
||||
++fp
|
||||
)
|
||||
{
|
||||
label vert = f[fp];
|
||||
const label vert = f[fp];
|
||||
pointFaceIndex_[vert][localFacei] = fp;
|
||||
}
|
||||
}
|
||||
@ -220,7 +219,7 @@ Foam::label Foam::cellMatcher::otherFace
|
||||
const label localFacei
|
||||
) const
|
||||
{
|
||||
label key = edgeKey(numVert, v0, v1);
|
||||
const label key = edgeKey(numVert, v0, v1);
|
||||
|
||||
if (edgeFaces_[key] == localFacei)
|
||||
{
|
||||
@ -230,17 +229,15 @@ Foam::label Foam::cellMatcher::otherFace
|
||||
{
|
||||
return edgeFaces_[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "edgeFaces_ does not contain:" << localFacei
|
||||
<< " for edge " << v0 << " " << v1 << " at key " << key
|
||||
<< " edgeFaces_[key, key+1]:" << edgeFaces_[key]
|
||||
<< " , " << edgeFaces_[key+1]
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
}
|
||||
FatalErrorInFunction
|
||||
<< "edgeFaces_ does not contain:" << localFacei
|
||||
<< " for edge " << v0 << " " << v1 << " at key " << key
|
||||
<< " edgeFaces_[key, key+1]:" << edgeFaces_[key]
|
||||
<< " , " << edgeFaces_[key+1]
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -256,10 +253,10 @@ void Foam::cellMatcher::write(Foam::Ostream& os) const
|
||||
{
|
||||
os << ' ' << localFaces_[facei][fp];
|
||||
}
|
||||
os << endl;
|
||||
os << nl;
|
||||
}
|
||||
|
||||
os << "Face map : " << faceMap_ << endl;
|
||||
os << "Face map : " << faceMap_ << nl;
|
||||
os << "Point map : " << pointMap_ << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,6 @@ SourceFiles
|
||||
|
||||
#include "labelList.H"
|
||||
#include "faceList.H"
|
||||
#include "boolList.H"
|
||||
#include "Map.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -90,8 +89,8 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class primitiveMesh;
|
||||
class cell;
|
||||
class cellShape;
|
||||
class cellModel;
|
||||
class cellShape;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellMatcher Declaration
|
||||
@ -178,15 +177,15 @@ private:
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
cellMatcher(const cellMatcher&);
|
||||
void operator=(const cellMatcher&);
|
||||
cellMatcher(const cellMatcher&) = delete;
|
||||
cellMatcher& operator=(const cellMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given mesh and shape factors
|
||||
//- Construct for shape factors
|
||||
cellMatcher
|
||||
(
|
||||
const label vertPerCell,
|
||||
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -87,13 +86,12 @@ inline const Foam::cellModel& Foam::cellMatcher::model() const
|
||||
{
|
||||
if (cellModelPtr_ == nullptr)
|
||||
{
|
||||
cellModelPtr_ = cellModeller::lookup(cellModelName_);
|
||||
cellModelPtr_ = cellModel::ptr(cellModelName_);
|
||||
}
|
||||
return *cellModelPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Key into edgeFaces_. key and key+1 are the entries for edge going from
|
||||
// v0 to v1
|
||||
inline Foam::label Foam::cellMatcher::edgeKey
|
||||
|
||||
@ -36,6 +36,8 @@ Foam::pyrMatcher Foam::degenerateMatcher::pyr;
|
||||
Foam::tetMatcher Foam::degenerateMatcher::tet;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellShape Foam::degenerateMatcher::match
|
||||
(
|
||||
const faceList& faces,
|
||||
@ -50,30 +52,28 @@ Foam::cellShape Foam::degenerateMatcher::match
|
||||
{
|
||||
return cellShape(hex.model(), hex.vertLabels());
|
||||
}
|
||||
else if (tet.matchShape(false, faces, owner, celli, cellFaces))
|
||||
if (tet.matchShape(false, faces, owner, celli, cellFaces))
|
||||
{
|
||||
return cellShape(tet.model(), tet.vertLabels());
|
||||
}
|
||||
else if (prism.matchShape(false, faces, owner, celli, cellFaces))
|
||||
if (prism.matchShape(false, faces, owner, celli, cellFaces))
|
||||
{
|
||||
return cellShape(prism.model(), prism.vertLabels());
|
||||
}
|
||||
else if (pyr.matchShape(false, faces, owner, celli, cellFaces))
|
||||
if (pyr.matchShape(false, faces, owner, celli, cellFaces))
|
||||
{
|
||||
return cellShape(pyr.model(), pyr.vertLabels());
|
||||
}
|
||||
else if (wedge.matchShape(false, faces, owner, celli, cellFaces))
|
||||
if (wedge.matchShape(false, faces, owner, celli, cellFaces))
|
||||
{
|
||||
return cellShape(wedge.model(), wedge.vertLabels());
|
||||
}
|
||||
else if (tetWedge.matchShape(false, faces, owner, celli, cellFaces))
|
||||
if (tetWedge.matchShape(false, faces, owner, celli, cellFaces))
|
||||
{
|
||||
return cellShape(tetWedge.model(), tetWedge.vertLabels());
|
||||
}
|
||||
else
|
||||
{
|
||||
return cellShape(*(cellModeller::lookup(0)), labelList(0));
|
||||
}
|
||||
|
||||
return cellShape(cellModel::ref(cellModel::UNKNOWN), labelList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ Class
|
||||
|
||||
Description
|
||||
Collection of all hex degenerate matchers (hex, wedge, prism etc.)
|
||||
|
||||
Has static member function to match a shape.
|
||||
|
||||
See also
|
||||
@ -52,7 +53,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class degenerateMatcher Declaration
|
||||
Class degenerateMatcher Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class degenerateMatcher
|
||||
|
||||
@ -27,13 +27,6 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::hexMatcher::vertPerCell = 8;
|
||||
const Foam::label Foam::hexMatcher::facePerCell = 6;
|
||||
const Foam::label Foam::hexMatcher::maxVertPerFace = 4;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::hexMatcher::hexMatcher()
|
||||
@ -43,7 +36,7 @@ Foam::hexMatcher::hexMatcher()
|
||||
vertPerCell,
|
||||
facePerCell,
|
||||
maxVertPerFace,
|
||||
"hex"
|
||||
"hex" // same as cellModel::modelNames[cellModel::HEX]
|
||||
)
|
||||
{}
|
||||
|
||||
@ -261,9 +254,9 @@ bool Foam::hexMatcher::faceSizeMatch
|
||||
return false;
|
||||
}
|
||||
|
||||
forAll(myFaces, myFacei)
|
||||
for (const label facei : myFaces)
|
||||
{
|
||||
label size = faces[myFaces[myFacei]].size();
|
||||
const label size = faces[facei].size();
|
||||
|
||||
if (size != 4)
|
||||
{
|
||||
@ -325,10 +318,8 @@ bool Foam::hexMatcher::matches
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::hexMatcher
|
||||
|
||||
Description
|
||||
A cellMatcher for hex cells
|
||||
A cellMatcher for hex cells (cellModel::HEX).
|
||||
|
||||
See also
|
||||
cellMatcher
|
||||
cellMatcher, cellModel
|
||||
|
||||
SourceFiles
|
||||
hexMatcher.C
|
||||
@ -46,28 +46,28 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hexMatcher Declaration
|
||||
Class hexMatcher Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class hexMatcher
|
||||
:
|
||||
public cellMatcher
|
||||
{
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
//- Constants for this shape
|
||||
static const label vertPerCell;
|
||||
static const label facePerCell;
|
||||
static const label maxVertPerFace;
|
||||
// Constants for this shape
|
||||
static constexpr label vertPerCell = 8;
|
||||
static constexpr label facePerCell = 6;
|
||||
static constexpr label maxVertPerFace = 4;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
hexMatcher(const hexMatcher&);
|
||||
hexMatcher(const hexMatcher&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const hexMatcher&);
|
||||
hexMatcher& operator=(const hexMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -27,13 +27,6 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::prismMatcher::vertPerCell = 6;
|
||||
const Foam::label Foam::prismMatcher::facePerCell = 5;
|
||||
const Foam::label Foam::prismMatcher::maxVertPerFace = 4;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::prismMatcher::prismMatcher()
|
||||
@ -43,7 +36,7 @@ Foam::prismMatcher::prismMatcher()
|
||||
vertPerCell,
|
||||
facePerCell,
|
||||
maxVertPerFace,
|
||||
"prism"
|
||||
"prism" // same as cellModel::modelNames[cellModel::PRISM]
|
||||
)
|
||||
{}
|
||||
|
||||
@ -312,31 +305,25 @@ bool Foam::prismMatcher::faceSizeMatch
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
forAll(myFaces, myFacei)
|
||||
for (const label facei : myFaces)
|
||||
{
|
||||
label size = faces[myFaces[myFacei]].size();
|
||||
const label size = faces[facei].size();
|
||||
|
||||
if (size == 3)
|
||||
{
|
||||
nTris++;
|
||||
++nTris;
|
||||
}
|
||||
else if (size == 4)
|
||||
{
|
||||
nQuads++;
|
||||
++nQuads;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ((nTris == 2) && (nQuads == 3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (nTris == 2 && nQuads == 3);
|
||||
}
|
||||
|
||||
|
||||
@ -390,10 +377,8 @@ bool Foam::prismMatcher::matches
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::prismMatcher
|
||||
|
||||
Description
|
||||
A cellMatcher for prism cells
|
||||
A cellMatcher for prism cells (cellModel::PRISM)
|
||||
|
||||
See also
|
||||
cellMatcher
|
||||
cellMatcher, cellModel
|
||||
|
||||
SourceFiles
|
||||
prismMatcher.C
|
||||
@ -53,21 +53,21 @@ class prismMatcher
|
||||
:
|
||||
public cellMatcher
|
||||
{
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
//- Constants for this shape
|
||||
static const label vertPerCell;
|
||||
static const label facePerCell;
|
||||
static const label maxVertPerFace;
|
||||
// Constants for this shape
|
||||
static constexpr label vertPerCell = 6;
|
||||
static constexpr label facePerCell = 5;
|
||||
static constexpr label maxVertPerFace = 4;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
prismMatcher(const prismMatcher&);
|
||||
prismMatcher(const prismMatcher&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const prismMatcher&);
|
||||
prismMatcher& operator=(const prismMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -26,16 +26,9 @@ License
|
||||
#include "pyrMatcher.H"
|
||||
#include "cellMatcher.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::pyrMatcher::vertPerCell = 5;
|
||||
const Foam::label Foam::pyrMatcher::facePerCell = 5;
|
||||
const Foam::label Foam::pyrMatcher::maxVertPerFace = 4;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pyrMatcher::pyrMatcher()
|
||||
@ -45,7 +38,7 @@ Foam::pyrMatcher::pyrMatcher()
|
||||
vertPerCell,
|
||||
facePerCell,
|
||||
maxVertPerFace,
|
||||
"pyr"
|
||||
"pyr" // same as cellModel::modelNames[cellModel::PYR]
|
||||
)
|
||||
{}
|
||||
|
||||
@ -234,17 +227,17 @@ bool Foam::pyrMatcher::faceSizeMatch
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
forAll(myFaces, myFacei)
|
||||
for (const label facei : myFaces)
|
||||
{
|
||||
label size = faces[myFaces[myFacei]].size();
|
||||
const label size = faces[facei].size();
|
||||
|
||||
if (size == 3)
|
||||
{
|
||||
nTris++;
|
||||
++nTris;
|
||||
}
|
||||
else if (size == 4)
|
||||
{
|
||||
nQuads++;
|
||||
++nQuads;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -252,14 +245,7 @@ bool Foam::pyrMatcher::faceSizeMatch
|
||||
}
|
||||
}
|
||||
|
||||
if ((nTris == 4) && (nQuads == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (nTris == 4 && nQuads == 1);
|
||||
}
|
||||
|
||||
|
||||
@ -313,10 +299,8 @@ bool Foam::pyrMatcher::matches
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::pyrMatcher
|
||||
|
||||
Description
|
||||
A cellMatcher for pyr cells
|
||||
A cellMatcher for pyr cells (cellModel::PYR)
|
||||
|
||||
See also
|
||||
cellMatcher
|
||||
cellMatcher, cellModel
|
||||
|
||||
SourceFiles
|
||||
pyrMatcher.C
|
||||
@ -46,28 +46,28 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pyrMatcher Declaration
|
||||
Class pyrMatcher Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pyrMatcher
|
||||
:
|
||||
public cellMatcher
|
||||
{
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
//- Constants for this shape
|
||||
static const label vertPerCell;
|
||||
static const label facePerCell;
|
||||
static const label maxVertPerFace;
|
||||
// Constants for this shape
|
||||
static constexpr label vertPerCell = 5;
|
||||
static constexpr label facePerCell = 5;
|
||||
static constexpr label maxVertPerFace = 4;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pyrMatcher(const pyrMatcher&);
|
||||
pyrMatcher(const pyrMatcher&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const pyrMatcher&);
|
||||
pyrMatcher& operator=(const pyrMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -26,16 +26,9 @@ License
|
||||
#include "tetMatcher.H"
|
||||
#include "cellMatcher.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::tetMatcher::vertPerCell = 4;
|
||||
const Foam::label Foam::tetMatcher::facePerCell = 4;
|
||||
const Foam::label Foam::tetMatcher::maxVertPerFace = 3;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tetMatcher::tetMatcher()
|
||||
@ -45,7 +38,7 @@ Foam::tetMatcher::tetMatcher()
|
||||
vertPerCell,
|
||||
facePerCell,
|
||||
maxVertPerFace,
|
||||
"tet"
|
||||
"tet" // same as cellModel::modelNames[cellModel::TET]
|
||||
)
|
||||
{}
|
||||
|
||||
@ -201,15 +194,16 @@ bool Foam::tetMatcher::faceSizeMatch
|
||||
return false;
|
||||
}
|
||||
|
||||
forAll(myFaces, myFacei)
|
||||
for (const label facei : myFaces)
|
||||
{
|
||||
label size = faces[myFaces[myFacei]].size();
|
||||
const label size = faces[facei].size();
|
||||
|
||||
if (size != 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -264,10 +258,8 @@ bool Foam::tetMatcher::matches
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::tetMatcher
|
||||
|
||||
Description
|
||||
A cellMatcher for tet cells
|
||||
A cellMatcher for tet cells (cellModel::TET)
|
||||
|
||||
See also
|
||||
cellMatcher
|
||||
cellMatcher, cellModel
|
||||
|
||||
SourceFiles
|
||||
tetMatcher.C
|
||||
@ -53,21 +53,21 @@ class tetMatcher
|
||||
:
|
||||
public cellMatcher
|
||||
{
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
//- Constants for this shape
|
||||
static const label vertPerCell;
|
||||
static const label facePerCell;
|
||||
static const label maxVertPerFace;
|
||||
// Constants for this shape
|
||||
static constexpr label vertPerCell = 4;
|
||||
static constexpr label facePerCell = 4;
|
||||
static constexpr label maxVertPerFace = 3;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
tetMatcher(const tetMatcher&);
|
||||
tetMatcher(const tetMatcher&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const tetMatcher&);
|
||||
tetMatcher& operator=(const tetMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -26,16 +26,9 @@ License
|
||||
#include "tetWedgeMatcher.H"
|
||||
#include "cellMatcher.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::tetWedgeMatcher::vertPerCell = 5;
|
||||
const Foam::label Foam::tetWedgeMatcher::facePerCell = 4;
|
||||
const Foam::label Foam::tetWedgeMatcher::maxVertPerFace = 4;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tetWedgeMatcher::tetWedgeMatcher()
|
||||
@ -45,7 +38,7 @@ Foam::tetWedgeMatcher::tetWedgeMatcher()
|
||||
vertPerCell,
|
||||
facePerCell,
|
||||
maxVertPerFace,
|
||||
"tetWedge"
|
||||
"tetWedge" // same as cellModel::modelNames[cellModel::TETWEDGE]
|
||||
)
|
||||
{}
|
||||
|
||||
@ -239,31 +232,25 @@ bool Foam::tetWedgeMatcher::faceSizeMatch
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
forAll(myFaces, myFacei)
|
||||
for (const label facei : myFaces)
|
||||
{
|
||||
label size = faces[myFaces[myFacei]].size();
|
||||
const label size = faces[facei].size();
|
||||
|
||||
if (size == 3)
|
||||
{
|
||||
nTris++;
|
||||
++nTris;
|
||||
}
|
||||
else if (size == 4)
|
||||
{
|
||||
nQuads++;
|
||||
++nQuads;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ((nTris == 2) && (nQuads == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (nTris == 2 && nQuads == 2);
|
||||
}
|
||||
|
||||
|
||||
@ -317,10 +304,8 @@ bool Foam::tetWedgeMatcher::matches
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::tetWedgeMatcher
|
||||
|
||||
Description
|
||||
A cellMatcher for tetWedge cells
|
||||
A cellMatcher for tetWedge cells (cellModel::TETWEDGE).
|
||||
|
||||
See also
|
||||
cellMatcher
|
||||
cellMatcher, cellModel
|
||||
|
||||
SourceFiles
|
||||
tetWedgeMatcher.C
|
||||
@ -46,28 +46,28 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class tetWedgeMatcher Declaration
|
||||
Class tetWedgeMatcher Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class tetWedgeMatcher
|
||||
:
|
||||
public cellMatcher
|
||||
{
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
//- Constants for this shape
|
||||
static const label vertPerCell;
|
||||
static const label facePerCell;
|
||||
static const label maxVertPerFace;
|
||||
// Constants for this shape
|
||||
static constexpr label vertPerCell = 5;
|
||||
static constexpr label facePerCell = 4;
|
||||
static constexpr label maxVertPerFace = 4;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
tetWedgeMatcher(const tetWedgeMatcher&);
|
||||
tetWedgeMatcher(const tetWedgeMatcher&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const tetWedgeMatcher&);
|
||||
tetWedgeMatcher& operator=(const tetWedgeMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -27,13 +27,6 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::wedgeMatcher::vertPerCell = 7;
|
||||
const Foam::label Foam::wedgeMatcher::facePerCell = 6;
|
||||
const Foam::label Foam::wedgeMatcher::maxVertPerFace = 4;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::wedgeMatcher::wedgeMatcher()
|
||||
@ -43,7 +36,7 @@ Foam::wedgeMatcher::wedgeMatcher()
|
||||
vertPerCell,
|
||||
facePerCell,
|
||||
maxVertPerFace,
|
||||
"wedge"
|
||||
"wedge" // same as cellModel::modelNames[cellModel::WEDGE]
|
||||
)
|
||||
{}
|
||||
|
||||
@ -339,31 +332,25 @@ bool Foam::wedgeMatcher::faceSizeMatch
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
forAll(myFaces, myFacei)
|
||||
for (const label facei : myFaces)
|
||||
{
|
||||
label size = faces[myFaces[myFacei]].size();
|
||||
const label size = faces[facei].size();
|
||||
|
||||
if (size == 3)
|
||||
{
|
||||
nTris++;
|
||||
++nTris;
|
||||
}
|
||||
else if (size == 4)
|
||||
{
|
||||
nQuads++;
|
||||
++nQuads;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ((nTris == 2) && (nQuads == 4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (nTris == 2 && nQuads == 4);
|
||||
}
|
||||
|
||||
|
||||
@ -417,10 +404,8 @@ bool Foam::wedgeMatcher::matches
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::wedgeMatcher
|
||||
|
||||
Description
|
||||
A cellMatcher for wedge cells
|
||||
A cellMatcher for wedge cells (cellModel::WEDGE).
|
||||
|
||||
See also
|
||||
cellMatcher
|
||||
cellMatcher, cellModel
|
||||
|
||||
SourceFiles
|
||||
wedgeMatcher.C
|
||||
@ -46,28 +46,28 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wedgeMatcher Declaration
|
||||
Class wedgeMatcher Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wedgeMatcher
|
||||
:
|
||||
public cellMatcher
|
||||
{
|
||||
// Static data members
|
||||
// Static Data Members
|
||||
|
||||
//- Constants for this shape
|
||||
static const label vertPerCell;
|
||||
static const label facePerCell;
|
||||
static const label maxVertPerFace;
|
||||
// Constants for this shape
|
||||
static constexpr label vertPerCell = 7;
|
||||
static constexpr label facePerCell = 6;
|
||||
static constexpr label maxVertPerFace = 4;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
wedgeMatcher(const wedgeMatcher&);
|
||||
wedgeMatcher(const wedgeMatcher&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const wedgeMatcher&);
|
||||
wedgeMatcher& operator=(const wedgeMatcher&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -137,4 +137,5 @@ Foam::scalar Foam::cellModel::mag
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,14 +25,21 @@ Class
|
||||
Foam::cellModel
|
||||
|
||||
Description
|
||||
Maps a geometry to a set of cell primitives, which enables
|
||||
geometric cell data to be calculated without access to the primitive
|
||||
geometric level. This means mapping a 3D geometry to a set of
|
||||
pyramids which are each described by a cell face and the cell centre
|
||||
point.
|
||||
Maps a geometry to a set of cell primitives.
|
||||
|
||||
This enables geometric cell data to be calculated without access
|
||||
to the primitive geometric level. This means mapping a 3D
|
||||
geometry to a set of pyramids which are each described by a cell
|
||||
face and the cell centre point.
|
||||
|
||||
Also includes a static collection of cell models (normally loaded from
|
||||
etc/cellModels), and a means of looking them up.
|
||||
|
||||
SourceFiles
|
||||
cellModelI.H
|
||||
cellModel.C
|
||||
cellModels.C
|
||||
cellModelIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -44,19 +51,17 @@ SourceFiles
|
||||
#include "faceList.H"
|
||||
#include "InfoProxy.H"
|
||||
#include "autoPtr.H"
|
||||
#include "PtrList.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
// Forward declarations
|
||||
class cellModel;
|
||||
inline bool operator==(const cellModel& m1, const cellModel& m2);
|
||||
inline bool operator!=(const cellModel& m1, const cellModel& m2);
|
||||
Ostream& operator<<(Ostream& os, const cellModel& c);
|
||||
|
||||
Ostream& operator<<(Ostream& os, const cellModel& cm);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellModel Declaration
|
||||
@ -64,12 +69,66 @@ Ostream& operator<<(Ostream& os, const cellModel& c);
|
||||
|
||||
class cellModel
|
||||
{
|
||||
// Private data
|
||||
public:
|
||||
|
||||
//- Name
|
||||
//- Enumeration of commonly used cellModel types.
|
||||
// The indices must match those in "etc/cellModels"
|
||||
enum modelType
|
||||
{
|
||||
UNKNOWN = 0, //!< unknown
|
||||
HEX = 3, //!< hex
|
||||
WEDGE = 4, //!< wedge
|
||||
PRISM = 5, //!< prism
|
||||
PYR = 6, //!< pyr
|
||||
TET = 7, //!< tet
|
||||
SPLITHEX = 8, //!< splitHex
|
||||
TETWEDGE = 9, //!< tetWedge
|
||||
};
|
||||
|
||||
//- Names of commonly used cellModels corresponding to modelType.
|
||||
// The names must match those in "etc/cellModels"
|
||||
static const Enum<modelType> modelNames;
|
||||
|
||||
|
||||
// Lookup Static Models
|
||||
|
||||
//- Look up pointer to cellModel by enumeration, or nullptr on failure.
|
||||
static const cellModel* ptr(const modelType model);
|
||||
|
||||
//- Look up pointer to cellModel by name, or nullptr on failure.
|
||||
static const cellModel* ptr(const word& modelName);
|
||||
|
||||
//- Look up pointer to cellModel by index, or nullptr on failure
|
||||
static const cellModel* ptr(const label modelIndex);
|
||||
|
||||
|
||||
//- Look up reference to cellModel by enumeration. Fatal on failure
|
||||
static const cellModel& ref(const modelType model);
|
||||
|
||||
//- Look up reference to cellModel by name. Fatal on failure
|
||||
static const cellModel& ref(const word& modelName);
|
||||
|
||||
//- Look up reference to cellModel by index. Fatal on failure
|
||||
static const cellModel& ref(const label modelIndex);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Static Data
|
||||
|
||||
//- PtrList of predefined models
|
||||
static PtrList<cellModel> models_;
|
||||
|
||||
//- Lookup of model pointers (in models_) by index
|
||||
static List<const cellModel*> modelPtrs_;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- (Unique) model name
|
||||
word name_;
|
||||
|
||||
//- Label in the model list
|
||||
//- Index in the model list
|
||||
label index_;
|
||||
|
||||
//- Number of points in the model which determines the geometry
|
||||
@ -82,6 +141,12 @@ class cellModel
|
||||
edgeList edges_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct from central "etc/cellModels" file.
|
||||
static void constructModels();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -104,31 +169,32 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
//- Return model name
|
||||
inline const word& name() const;
|
||||
|
||||
//- Return model name
|
||||
inline const word& name() const;
|
||||
//- Return index of model in the model list
|
||||
inline label index() const;
|
||||
|
||||
//- Return index of model in the model list
|
||||
inline label index() const;
|
||||
//- Return number of points
|
||||
inline label nPoints() const;
|
||||
|
||||
//- Return number of points
|
||||
inline label nPoints() const;
|
||||
//- Return number of edges
|
||||
inline label nEdges() const;
|
||||
|
||||
//- Return number of edges
|
||||
inline label nEdges() const;
|
||||
//- Return number of faces
|
||||
inline label nFaces() const;
|
||||
|
||||
//- Return number of faces
|
||||
inline label nFaces() const;
|
||||
//- Return a raw list of model edges
|
||||
inline const edgeList& modelEdges() const;
|
||||
|
||||
//- Return list of edges
|
||||
inline edgeList edges(const UList<label>& pointLabels) const;
|
||||
//- Return a raw list of model faces
|
||||
inline const faceList& modelFaces() const;
|
||||
|
||||
//- Return a raw list of model faces
|
||||
inline const faceList& modelFaces() const;
|
||||
//- Return list of edges
|
||||
inline edgeList edges(const labelUList& pointLabels) const;
|
||||
|
||||
//- Return list of faces
|
||||
inline faceList faces(const UList<label>& pointLabels) const;
|
||||
//- Return list of faces
|
||||
inline faceList faces(const labelUList& pointLabels) const;
|
||||
|
||||
|
||||
//- Vector centroid
|
||||
@ -146,7 +212,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Return info proxy.
|
||||
// Used to print token information to a stream
|
||||
// Used to print information to a stream
|
||||
InfoProxy<cellModel> info() const
|
||||
{
|
||||
return *this;
|
||||
@ -160,25 +226,28 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
//- Equality operator: true => ptr to models are equal !
|
||||
friend bool operator==(const cellModel& m1, const cellModel& m2);
|
||||
|
||||
//- Inequality operator: true => ptr to models are not equal !
|
||||
friend bool operator!=(const cellModel& m1, const cellModel& m2);
|
||||
|
||||
|
||||
// Ostream operator
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const cellModel& c);
|
||||
friend Ostream& operator<<(Ostream& os, const cellModel& cm);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Ostream operators
|
||||
|
||||
template<>
|
||||
Ostream& operator<<(Ostream& os, const InfoProxy<cellModel>& ip);
|
||||
|
||||
|
||||
// Global operators
|
||||
|
||||
//- Equality: true when model pointers are identical
|
||||
inline bool operator==(const cellModel& lhs, const cellModel& rhs);
|
||||
|
||||
//- Inequality: true when model pointers are not identical
|
||||
inline bool operator!=(const cellModel& lhs, const cellModel& rhs);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -23,9 +23,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::word& Foam::cellModel::name() const
|
||||
@ -58,27 +55,9 @@ inline Foam::label Foam::cellModel::nFaces() const
|
||||
}
|
||||
|
||||
|
||||
// Return the faces of a cellModel by untangling the geometry
|
||||
// supplied in terms of the face labels
|
||||
inline Foam::edgeList Foam::cellModel::edges
|
||||
(
|
||||
const UList<label>& pointLabels
|
||||
) const
|
||||
inline const Foam::edgeList& Foam::cellModel::modelEdges() const
|
||||
{
|
||||
edgeList e(edges_.size());
|
||||
|
||||
// Translate model lebels into global labels
|
||||
forAll(edges_, edgeI)
|
||||
{
|
||||
e[edgeI] =
|
||||
edge
|
||||
(
|
||||
pointLabels[edges_[edgeI].start()],
|
||||
pointLabels[edges_[edgeI].end()]
|
||||
);
|
||||
}
|
||||
|
||||
return e;
|
||||
return edges_;
|
||||
}
|
||||
|
||||
|
||||
@ -88,16 +67,40 @@ inline const Foam::faceList& Foam::cellModel::modelFaces() const
|
||||
}
|
||||
|
||||
|
||||
// Return the faces of a cellModel by untangling the geometry
|
||||
// supplied in terms of the face labels
|
||||
inline Foam::edgeList Foam::cellModel::edges
|
||||
(
|
||||
const labelUList& pointLabels
|
||||
) const
|
||||
{
|
||||
edgeList e(edges_.size());
|
||||
|
||||
// Translate model labels into global labels
|
||||
forAll(edges_, edgei)
|
||||
{
|
||||
e[edgei] =
|
||||
edge
|
||||
(
|
||||
pointLabels[edges_[edgei].start()],
|
||||
pointLabels[edges_[edgei].end()]
|
||||
);
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
// Return the faces of a cellModel by untangling the geometry
|
||||
// supplied in terms of the face labels
|
||||
inline Foam::faceList Foam::cellModel::faces
|
||||
(
|
||||
const UList<label>& pointLabels
|
||||
const labelUList& pointLabels
|
||||
) const
|
||||
{
|
||||
faceList f(faces_.size());
|
||||
|
||||
// Translate model lebels into global labels
|
||||
// Translate model labels into global labels
|
||||
forAll(faces_, facei)
|
||||
{
|
||||
const labelList& curModelLabels = faces_[facei];
|
||||
@ -106,9 +109,9 @@ inline Foam::faceList Foam::cellModel::faces
|
||||
|
||||
curFace.setSize(curModelLabels.size());
|
||||
|
||||
forAll(curModelLabels, labelI)
|
||||
forAll(curModelLabels, labeli)
|
||||
{
|
||||
curFace[labelI] = pointLabels[curModelLabels[labelI]];
|
||||
curFace[labeli] = pointLabels[curModelLabels[labeli]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,18 +119,17 @@ inline Foam::faceList Foam::cellModel::faces
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
// Equality operator: true => ptr to models are equal !
|
||||
inline bool Foam::operator==(const cellModel& m1, const cellModel& m2)
|
||||
inline bool Foam::operator==(const cellModel& lhs, const cellModel& rhs)
|
||||
{
|
||||
return (&m1 == &m2);
|
||||
return (&lhs == &rhs);
|
||||
}
|
||||
|
||||
// Inequality operator: true => ptr to models are not equal !
|
||||
inline bool Foam::operator!=(const cellModel& m1, const cellModel& m2)
|
||||
|
||||
inline bool Foam::operator!=(const cellModel& lhs, const cellModel& rhs)
|
||||
{
|
||||
return (&m1 != &m2);
|
||||
return (&lhs != &rhs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -26,26 +26,29 @@ License
|
||||
#include "cellModel.H"
|
||||
#include "dictionaryEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellModel::cellModel(Istream& is)
|
||||
{
|
||||
dictionaryEntry entry(dictionary::null, is);
|
||||
name_ = entry.keyword();
|
||||
entry.lookup("index") >> index_;
|
||||
entry.lookup("numberOfPoints") >> nPoints_;
|
||||
entry.lookup("faces") >> faces_;
|
||||
entry.lookup("edges") >> edges_;
|
||||
dictionaryEntry dict(dictionary::null, is);
|
||||
|
||||
name_ = dict.keyword();
|
||||
dict.lookup("index") >> index_;
|
||||
dict.lookup("numberOfPoints") >> nPoints_;
|
||||
dict.lookup("faces") >> faces_;
|
||||
dict.lookup("edges") >> edges_;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const cellModel& c)
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const cellModel& cm)
|
||||
{
|
||||
os << "name" << tab << c.name_ << tab
|
||||
<< "index" << tab << c.index_ << tab
|
||||
<< "numberOfPoints" << tab << c.nPoints_ << tab
|
||||
<< "faces" << tab << c.faces_ << tab
|
||||
<< "edges" << tab << c.edges_ << endl;
|
||||
os << "name" << tab << cm.name() << tab
|
||||
<< "index" << tab << cm.index() << tab
|
||||
<< "numberOfPoints" << tab << cm.nPoints() << tab
|
||||
<< "faces" << tab << cm.modelFaces() << tab
|
||||
<< "edges" << tab << cm.modelEdges() << endl;
|
||||
|
||||
return os;
|
||||
}
|
||||
@ -60,8 +63,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<cellModel>& ip)
|
||||
<< "index = " << cm.index() << ", "
|
||||
<< "number of points = " << cm.nPoints() << ", "
|
||||
<< "number of faces = " << cm.nFaces() << ", "
|
||||
<< "number of edges = " << cm.nEdges()
|
||||
<< endl;
|
||||
<< "number of edges = " << cm.nEdges() << endl;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
54
src/OpenFOAM/meshes/meshShapes/cellModel/cellModeller.H
Normal file
54
src/OpenFOAM/meshes/meshShapes/cellModel/cellModeller.H
Normal file
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Namespace
|
||||
Foam::cellModeller
|
||||
|
||||
Description
|
||||
Compatibility definitions of static cellModel lookups.
|
||||
|
||||
Superseded (NOV-2017) by cellModel methods.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
#ifndef cellModeller_H
|
||||
#define cellModeller_H
|
||||
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace cellModeller
|
||||
{
|
||||
|
||||
//- Equivalent to cellModel::ptr static method.
|
||||
// \deprecated use cellModel::ptr instead (NOV-2017)
|
||||
inline const cellModel* lookup(const word& modelName)
|
||||
{
|
||||
return cellModel::ptr(modelName);
|
||||
}
|
||||
|
||||
//- Equivalent to cellModel::ptr static method.
|
||||
// \deprecated use cellModel::ptr instead (NOV-2017)
|
||||
inline const cellModel* lookup(const label modelIndex)
|
||||
{
|
||||
return cellModel::ptr(modelIndex);
|
||||
}
|
||||
|
||||
} // End namespace cellModeller
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
200
src/OpenFOAM/meshes/meshShapes/cellModel/cellModels.C
Normal file
200
src/OpenFOAM/meshes/meshShapes/cellModel/cellModels.C
Normal file
@ -0,0 +1,200 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellModel.H"
|
||||
#include "etcFiles.H"
|
||||
#include "IFstream.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PtrList<Foam::cellModel> Foam::cellModel::models_;
|
||||
|
||||
Foam::List<const Foam::cellModel*> Foam::cellModel::modelPtrs_;
|
||||
|
||||
const Foam::Enum<Foam::cellModel::modelType> Foam::cellModel::modelNames
|
||||
{
|
||||
{ modelType::UNKNOWN, "unknown" },
|
||||
{ modelType::HEX, "hex" },
|
||||
{ modelType::WEDGE, "wedge" },
|
||||
{ modelType::PRISM, "prism" },
|
||||
{ modelType::PYR, "pyr" },
|
||||
{ modelType::TET, "tet" },
|
||||
{ modelType::TETWEDGE, "tetWedge" },
|
||||
{ modelType::SPLITHEX, "splitHex" },
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cellModel::constructModels()
|
||||
{
|
||||
if (models_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "attempt to re-construct cellModeller when it already exists"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
IFstream is(findEtcFile("cellModels", true));
|
||||
|
||||
PtrList<cellModel> newPtrs(is);
|
||||
models_.swap(newPtrs);
|
||||
|
||||
///Info<< "loading " << models_.size()
|
||||
/// << " cell models from etc/controlDict" << endl;
|
||||
|
||||
|
||||
// Build two lookups: by index, by name
|
||||
// Since there are relatively few models, use straight lookup for the index
|
||||
// and a linear (non-hashed) search for the name.
|
||||
// Lookup by name is less likely than lookup by enum anyhow.
|
||||
|
||||
label maxIndex = 0;
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (maxIndex < models_[i].index())
|
||||
{
|
||||
maxIndex = models_[i].index();
|
||||
}
|
||||
}
|
||||
|
||||
modelPtrs_.clear();
|
||||
modelPtrs_.setSize(maxIndex+1, nullptr);
|
||||
|
||||
wordHashSet used(2*maxIndex);
|
||||
|
||||
forAll(models_, i)
|
||||
{
|
||||
const label modelIndex = models_[i].index();
|
||||
const word& modelName = models_[i].name();
|
||||
const cellModel* ptr = &models_[i];
|
||||
|
||||
if (used.insert(modelName))
|
||||
{
|
||||
if (modelPtrs_[modelIndex])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "more than one model share the index "
|
||||
<< modelIndex
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelPtrs_[modelIndex] = ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "more than one model share the name "
|
||||
<< modelName
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::cellModel::ptr(const modelType model)
|
||||
{
|
||||
return ptr(label(model));
|
||||
}
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::cellModel::ptr(const word& modelName)
|
||||
{
|
||||
if (models_.empty())
|
||||
{
|
||||
constructModels();
|
||||
}
|
||||
|
||||
const label n = models_.size();
|
||||
for (label i = 0; i < n; ++i)
|
||||
{
|
||||
if (models_[i].name() == modelName)
|
||||
{
|
||||
return &(models_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::cellModel::ptr(const label modelIndex)
|
||||
{
|
||||
if (models_.empty())
|
||||
{
|
||||
constructModels();
|
||||
}
|
||||
|
||||
return (modelIndex < modelPtrs_.size() ? modelPtrs_[modelIndex] : nullptr);
|
||||
}
|
||||
|
||||
|
||||
const Foam::cellModel& Foam::cellModel::ref(const modelType model)
|
||||
{
|
||||
const cellModel* p = ptr(model);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No such cellModel: " << modelNames[model]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
||||
const Foam::cellModel& Foam::cellModel::ref(const word& modelName)
|
||||
{
|
||||
const cellModel* p = ptr(modelName);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No such cellModel: " << modelName
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
||||
const Foam::cellModel& Foam::cellModel::ref(const label modelIndex)
|
||||
{
|
||||
const cellModel* p = ptr(modelIndex);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No such cellModel: " << modelIndex
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return *p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,103 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Constructor of cellModeller: just sets the cellModeller's params.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellModeller::cellModeller()
|
||||
{
|
||||
if (modelPtrs_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "attempt to re-construct cellModeller when it already exists"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
label maxIndex = 0;
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
|
||||
}
|
||||
|
||||
modelPtrs_.setSize(maxIndex + 1);
|
||||
modelPtrs_ = nullptr;
|
||||
|
||||
// For all the words in the wordlist, set the details of the model
|
||||
// to those specified by the word name and the other parameters
|
||||
// given. This should result in an automatic 'read' of the model
|
||||
// from its File (see cellModel class).
|
||||
forAll(models_, i)
|
||||
{
|
||||
if (modelPtrs_[models_[i].index()])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "more than one model share the index "
|
||||
<< models_[i].index()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelPtrs_[models_[i].index()] = &models_[i];
|
||||
|
||||
if (modelDictionary_.found(models_[i].name()))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "more than one model share the name "
|
||||
<< models_[i].name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
modelDictionary_.insert(models_[i].name(), &models_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellModeller::~cellModeller()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::cellModel* Foam::cellModeller::lookup(const word& name)
|
||||
{
|
||||
HashTable<const cellModel*>::iterator iter = modelDictionary_.find(name);
|
||||
|
||||
if (iter != modelDictionary_.end())
|
||||
{
|
||||
return iter();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,100 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::cellModeller
|
||||
|
||||
Description
|
||||
A static collection of cell models, and a means of looking them up.
|
||||
|
||||
SourceFiles
|
||||
cellModeller.C
|
||||
cellModellerIO.C
|
||||
globalCellModeller.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellModeller_H
|
||||
#define cellModeller_H
|
||||
|
||||
#include "cellModel.H"
|
||||
#include "PtrList.H"
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellModeller Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cellModeller
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- PtrList of models
|
||||
static PtrList<cellModel> models_;
|
||||
|
||||
//- List of model pointers
|
||||
static List<cellModel*> modelPtrs_;
|
||||
|
||||
//- HashTable of model pointers
|
||||
static HashTable<const cellModel*> modelDictionary_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from central "cellModels" file
|
||||
cellModeller();
|
||||
|
||||
//- Destructor
|
||||
~cellModeller();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Look up a model by name and return a pointer to the model or nullptr
|
||||
static const cellModel* lookup(const word&);
|
||||
|
||||
//- Look up a model by index and return a pointer to the model or
|
||||
// nullptr
|
||||
static const cellModel* lookup(const label i)
|
||||
{
|
||||
return modelPtrs_[i];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
cellModeller global initializations
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellModeller.H"
|
||||
#include "etcFiles.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PtrList<Foam::cellModel> Foam::cellModeller::models_
|
||||
(
|
||||
IFstream(findEtcFile("cellModels", true))()
|
||||
);
|
||||
|
||||
Foam::List<Foam::cellModel*> Foam::cellModeller::modelPtrs_;
|
||||
|
||||
Foam::HashTable<const Foam::cellModel*> Foam::cellModeller::modelDictionary_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Construct a dummy cellModeller which reads the models and fills
|
||||
// the above tables
|
||||
cellModeller globalCellModeller_;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -87,16 +87,16 @@ public:
|
||||
//- Construct from components
|
||||
inline cellShape
|
||||
(
|
||||
const cellModel&,
|
||||
const labelList&,
|
||||
const cellModel& model,
|
||||
const labelUList& labels,
|
||||
const bool doCollapse = false
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
inline cellShape
|
||||
(
|
||||
const word& model,
|
||||
const labelList&,
|
||||
const word& modelName,
|
||||
const labelUList& labels,
|
||||
const bool doCollapse = false
|
||||
);
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "Istream.H"
|
||||
#include "cell.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,13 +37,13 @@ inline Foam::cellShape::cellShape()
|
||||
|
||||
inline Foam::cellShape::cellShape
|
||||
(
|
||||
const cellModel& M,
|
||||
const labelList& l,
|
||||
const cellModel& model,
|
||||
const labelUList& labels,
|
||||
const bool doCollapse
|
||||
)
|
||||
:
|
||||
labelList(l),
|
||||
m(&M)
|
||||
labelList(labels),
|
||||
m(&model)
|
||||
{
|
||||
if (doCollapse)
|
||||
{
|
||||
@ -54,13 +54,13 @@ inline Foam::cellShape::cellShape
|
||||
|
||||
inline Foam::cellShape::cellShape
|
||||
(
|
||||
const word& model,
|
||||
const labelList& l,
|
||||
const word& modelName,
|
||||
const labelUList& labels,
|
||||
const bool doCollapse
|
||||
)
|
||||
:
|
||||
labelList(l),
|
||||
m(cellModeller::lookup(model))
|
||||
labelList(labels),
|
||||
m(cellModel::ptr(modelName))
|
||||
{
|
||||
if (doCollapse)
|
||||
{
|
||||
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "cellShape.H"
|
||||
#include "token.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,14 +52,14 @@ Foam::Istream& Foam::operator>>(Istream& is, cellShape& s)
|
||||
}
|
||||
}
|
||||
|
||||
// it is allowed to have either a word or a number describing the model
|
||||
// Model can be described by index or name
|
||||
if (t.isLabel())
|
||||
{
|
||||
s.m = cellModeller::lookup(int(t.labelToken()));
|
||||
s.m = cellModel::ptr(t.labelToken());
|
||||
}
|
||||
else if (t.isWord())
|
||||
{
|
||||
s.m = cellModeller::lookup(t.wordToken());
|
||||
s.m = cellModel::ptr(t.wordToken());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -98,13 +97,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const cellShape& s)
|
||||
os << token::BEGIN_LIST;
|
||||
|
||||
// Write the list label for the symbol (ONE OR THE OTHER !!!)
|
||||
os << (s.m)->index() << token::SPACE;
|
||||
os << (s.m)->index();
|
||||
|
||||
// Write the model name instead of the label (ONE OR THE OTHER !!!)
|
||||
// os << (s.m)->name() << token::SPACE;
|
||||
// os << (s.m)->name();
|
||||
|
||||
// Write the geometry
|
||||
os << static_cast<const labelList&>(s);
|
||||
os << token::SPACE << static_cast<const labelList&>(s);
|
||||
|
||||
// End of record
|
||||
os << token::END_LIST;
|
||||
|
||||
@ -203,7 +203,7 @@ public:
|
||||
// Returns true on success. Negative labels never insert.
|
||||
// Return the number of slots filled.
|
||||
// Similar to a HashTable::insert().
|
||||
inline label insert(const UList<label>& lst);
|
||||
inline label insert(const labelUList& lst);
|
||||
|
||||
//- Fill open slots with the indices if they did not previously exist.
|
||||
// Returns true on success. Negative labels never insert.
|
||||
@ -225,7 +225,7 @@ public:
|
||||
|
||||
//- Remove existing indices from the edge and set locations to '-1'.
|
||||
// Returns the number of changes.
|
||||
inline label erase(const UList<label>& lst);
|
||||
inline label erase(const labelUList& lst);
|
||||
|
||||
//- Remove existing indices from the edge and set locations to '-1'.
|
||||
// Returns the number of changes.
|
||||
|
||||
@ -199,6 +199,7 @@ inline Foam::label Foam::edge::which(const label pointLabel) const
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -328,7 +329,7 @@ inline bool Foam::edge::insert(const label index)
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::insert(const UList<label>& lst)
|
||||
inline Foam::label Foam::edge::insert(const labelUList& lst)
|
||||
{
|
||||
return insertMultiple(lst.begin(), lst.end());
|
||||
}
|
||||
@ -373,7 +374,7 @@ inline Foam::label Foam::edge::erase(const label index)
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::erase(const UList<label>& lst)
|
||||
inline Foam::label Foam::edge::erase(const labelUList& lst)
|
||||
{
|
||||
return eraseMultiple(lst.begin(), lst.end());
|
||||
}
|
||||
|
||||
@ -25,8 +25,6 @@ License
|
||||
|
||||
#include "tetCell.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,12 +34,10 @@ Foam::cellShape Foam::tetCell::tetCellShape() const
|
||||
|
||||
if (!tetModelPtr_)
|
||||
{
|
||||
tetModelPtr_ = cellModeller::lookup("tet");
|
||||
tetModelPtr_ = cellModel::ptr(cellModel::TET);
|
||||
}
|
||||
|
||||
const cellModel& tet = *tetModelPtr_;
|
||||
|
||||
return cellShape(tet, labelList(*this));
|
||||
return cellShape(*tetModelPtr_, labelList(*this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,10 +65,10 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Construct null, with invalid point labels (-1)
|
||||
inline tetCell();
|
||||
|
||||
//- Construct from four points
|
||||
//- Construct from four point labels
|
||||
inline tetCell
|
||||
(
|
||||
const label a,
|
||||
@ -77,9 +77,12 @@ public:
|
||||
const label d
|
||||
);
|
||||
|
||||
//- Construct from FixedList
|
||||
//- Construct from FixedList of four point labels
|
||||
inline tetCell(const FixedList<label, 4>& lst);
|
||||
|
||||
//- Construct from an initializer list of four point labels
|
||||
explicit inline tetCell(std::initializer_list<label> lst);
|
||||
|
||||
//- Construct from Istream
|
||||
inline tetCell(Istream& is);
|
||||
|
||||
@ -92,17 +95,17 @@ public:
|
||||
inline triFace face(const label facei) const;
|
||||
|
||||
//- Return first face adjacent to the given edge
|
||||
inline label edgeFace(const label edgeI) const;
|
||||
inline label edgeFace(const label edgei) const;
|
||||
|
||||
//- Return face adjacent to the given face sharing the same edge
|
||||
inline label edgeAdjacentFace
|
||||
(
|
||||
const label edgeI,
|
||||
const label edgei,
|
||||
const label facei
|
||||
) const;
|
||||
|
||||
//- Return i-th edge
|
||||
inline edge tetEdge(const label edgeI) const;
|
||||
inline edge tetEdge(const label edgei) const;
|
||||
|
||||
|
||||
// Operations
|
||||
|
||||
@ -30,6 +30,8 @@ Description
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::tetCell::tetCell()
|
||||
:
|
||||
FixedList<label, 4>(-1)
|
||||
{}
|
||||
|
||||
|
||||
@ -54,6 +56,12 @@ inline Foam::tetCell::tetCell(const FixedList<label, 4>& lst)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::tetCell::tetCell(std::initializer_list<label> lst)
|
||||
:
|
||||
FixedList<label, 4>(lst)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::tetCell::tetCell(Istream& is)
|
||||
:
|
||||
FixedList<label, 4>(is)
|
||||
@ -66,9 +74,9 @@ inline Foam::triFace Foam::tetCell::face(const label facei) const
|
||||
{
|
||||
// Warning. Ordering of faces needs to be the same for a tetrahedron
|
||||
// class, a tetrahedron cell shape model and a tetCell
|
||||
static const label a[] = {1, 0, 0, 0};
|
||||
static const label b[] = {2, 3, 1, 2};
|
||||
static const label c[] = {3, 2, 3, 1};
|
||||
static const label a[4] = {1, 0, 0, 0};
|
||||
static const label b[4] = {2, 3, 1, 2};
|
||||
static const label c[4] = {3, 2, 3, 1};
|
||||
|
||||
#ifdef FULLDEBUG
|
||||
if (facei < 0 || facei >= 4)
|
||||
@ -88,29 +96,28 @@ inline Foam::triFace Foam::tetCell::face(const label facei) const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::tetCell::edgeFace(const label edgeI) const
|
||||
inline Foam::label Foam::tetCell::edgeFace(const label edgei) const
|
||||
{
|
||||
// Warning. Ordering of faces needs to be the same for a tetrahedron
|
||||
// class, a tetrahedron cell shape model and a tetCell
|
||||
//static const label edgeFaces[6] = {2, 1, 1, 0, 0, 0};
|
||||
static const label edgeFaces[6] = {2, 3, 1, 0, 0, 1};
|
||||
|
||||
#ifdef FULLDEBUG
|
||||
if (edgeI < 0 || edgeI >= 6)
|
||||
if (edgei < 0 || edgei >= 6)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "edge index out of range 0 -> 5. edgeI = " << edgeI
|
||||
<< "edge index out of range 0 -> 5. edgei = " << edgei
|
||||
<< abort(FatalError);
|
||||
}
|
||||
#endif
|
||||
|
||||
return edgeFaces[edgeI];
|
||||
return edgeFaces[edgei];
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::tetCell::edgeAdjacentFace
|
||||
(
|
||||
const label edgeI,
|
||||
const label edgei,
|
||||
const label facei
|
||||
) const
|
||||
{
|
||||
@ -134,36 +141,35 @@ inline Foam::label Foam::tetCell::edgeAdjacentFace
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (edgeI < 0 || edgeI >= 6)
|
||||
if (edgei < 0 || edgei >= 6)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "edge index out of range 0 -> 5. edgeI = " << edgeI
|
||||
<< "edge index out of range 0 -> 5. edgei = " << edgei
|
||||
<< abort(FatalError);
|
||||
}
|
||||
#endif
|
||||
|
||||
return adjacentFace[edgeI][facei];
|
||||
return adjacentFace[edgei][facei];
|
||||
}
|
||||
|
||||
|
||||
inline Foam::edge Foam::tetCell::tetEdge(const label edgeI) const
|
||||
inline Foam::edge Foam::tetCell::tetEdge(const label edgei) const
|
||||
{
|
||||
// Warning. Ordering of edges needs to be the same for a tetrahedron
|
||||
// class, a tetrahedron cell shape model and a tetCell
|
||||
//
|
||||
static const label start[] = {0, 0, 0, 3, 1, 3};
|
||||
static const label end[] = {1, 2, 3, 1, 2, 2};
|
||||
static const label pt0[] = {0, 0, 0, 3, 1, 3};
|
||||
static const label pt1[] = {1, 2, 3, 1, 2, 2};
|
||||
|
||||
#ifdef FULLDEBUG
|
||||
if (edgeI < 0 || edgeI >= 6)
|
||||
if (edgei < 0 || edgei >= 6)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "index out of range 0 -> 5. edgeI = " << edgeI
|
||||
<< "index out of range 0 -> 5. edgei = " << edgei
|
||||
<< abort(FatalError);
|
||||
}
|
||||
#endif
|
||||
|
||||
return edge(operator[](start[edgeI]), operator[](end[edgeI]));
|
||||
return edge(operator[](pt0[edgei]), operator[](pt1[edgei]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -86,10 +86,10 @@ public:
|
||||
const label c
|
||||
);
|
||||
|
||||
//- Copy construct from a list of 3 labels.
|
||||
//- Copy construct from a list of three point labels.
|
||||
explicit inline triFace(const labelUList& lst);
|
||||
|
||||
//- Construct from an initializer list of 3 labels
|
||||
//- Construct from an initializer list of three point labels
|
||||
explicit inline triFace(std::initializer_list<label> lst);
|
||||
|
||||
//- Construct from Istream
|
||||
|
||||
@ -52,10 +52,8 @@ inline int Foam::triFace::compare(const triFace& a, const triFace& b)
|
||||
// same face, but reversed orientation
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -379,10 +377,8 @@ inline int Foam::triFace::edgeDirection(const edge& e) const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -21,8 +21,6 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstreams.H"
|
||||
|
||||
@ -122,13 +122,11 @@ inline Foam::triPointRef Foam::tetrahedron<Point, PointRef>::tri
|
||||
{
|
||||
return triPointRef(a_, c_, b_);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "index out of range 0 -> 3. facei = " << facei
|
||||
<< abort(FatalError);
|
||||
return triPointRef(b_, c_, d_);
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "index out of range 0 -> 3. facei = " << facei
|
||||
<< abort(FatalError);
|
||||
return triPointRef(b_, c_, d_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -149,11 +149,11 @@ inline Point Foam::triangle<Point, PointRef>::circumCentre() const
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
|
||||
{
|
||||
scalar d1 = (c_ - a_) & (b_ - a_);
|
||||
scalar d2 = -(c_ - b_) & (b_ - a_);
|
||||
scalar d3 = (c_ - a_) & (c_ - b_);
|
||||
const scalar d1 = (c_ - a_) & (b_ - a_);
|
||||
const scalar d2 = -(c_ - b_) & (b_ - a_);
|
||||
const scalar d3 = (c_ - a_) & (c_ - b_);
|
||||
|
||||
scalar denom = d2*d3 + d3*d1 + d1*d2;
|
||||
const scalar denom = d2*d3 + d3*d1 + d1*d2;
|
||||
|
||||
if (Foam::mag(denom) < VSMALL)
|
||||
{
|
||||
@ -161,12 +161,9 @@ inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
|
||||
|
||||
return GREAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar a = (d1 + d2)*(d2 + d3)*(d3 + d1) / denom;
|
||||
|
||||
return 0.5*Foam::sqrt(min(GREAT, max(0, a)));
|
||||
}
|
||||
const scalar a = (d1 + d2)*(d2 + d3)*(d3 + d1) / denom;
|
||||
return 0.5*Foam::sqrt(min(GREAT, max(0, a)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -26,10 +26,8 @@ License
|
||||
#include "treeBoundBox.H"
|
||||
#include "FixedList.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
template<unsigned Size>
|
||||
Foam::treeBoundBox::treeBoundBox
|
||||
(
|
||||
|
||||
@ -24,7 +24,7 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "ccmWriter.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "ccmInternal.H" // include last to avoid any strange interactions
|
||||
|
||||
@ -304,12 +304,12 @@ Foam::ccm::writer::writer
|
||||
mesh_(mesh),
|
||||
// Mapping between OpenFOAM and PROSTAR primitives
|
||||
prostarShapeLookup_
|
||||
({
|
||||
{ cellModeller::lookup("hex")->index(), STARCDCore::starcdHex },
|
||||
{ cellModeller::lookup("prism")->index(), STARCDCore::starcdPrism },
|
||||
{ cellModeller::lookup("tet")->index(), STARCDCore::starcdTet },
|
||||
{ cellModeller::lookup("pyr")->index(), STARCDCore::starcdPyr }
|
||||
}),
|
||||
{
|
||||
{ cellModel::ref(cellModel::HEX).index(), STARCDCore::starcdHex },
|
||||
{ cellModel::ref(cellModel::PRISM).index(), STARCDCore::starcdPrism },
|
||||
{ cellModel::ref(cellModel::TET).index(), STARCDCore::starcdTet },
|
||||
{ cellModel::ref(cellModel::PYR).index(), STARCDCore::starcdPyr }
|
||||
},
|
||||
boundaryRegion_(mesh),
|
||||
cellTable_(mesh)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
With pro-STAR version v4, the input formats have changed radically.
|
||||
With PROSTAR version v4, the input formats have changed radically.
|
||||
* Easier to parse space-delimited input formats
|
||||
* No arbitrary or integral couples
|
||||
* No trimmed or degenerate cells
|
||||
@ -11,7 +11,7 @@ incorrect lookup.
|
||||
Fortunately, there are only 4 primitive shapes to be concerned with.
|
||||
|
||||
Hexa:
|
||||
Foam pro-STAR
|
||||
OpenFOAM PROSTAR
|
||||
~~~~~~~~~~~~~~ ~~~~~~~~~~~
|
||||
Face 0 (0 4 7 3) -> F5: (0 4 7 3)
|
||||
Face 1 (1 2 6 5) -> F6: (1 2 6 5)
|
||||
@ -22,7 +22,7 @@ Hexa:
|
||||
|
||||
|
||||
Prism:
|
||||
Foam pro-STAR
|
||||
OpenFOAM PROSTAR
|
||||
~~~~~~~~~~~~~~ ~~~~~~~~~~~
|
||||
Face 0 (0 2 1) -> F1: (0 2 1)
|
||||
Face 1 (3 4 5) -> F2: (3 4 5)
|
||||
@ -32,7 +32,7 @@ Prism:
|
||||
|
||||
|
||||
Tetra:
|
||||
Foam pro-STAR
|
||||
OpenFOAM PROSTAR
|
||||
~~~~~~~~~~~~~~ ~~~~~~~~~~~
|
||||
Face 0 (1 2 3) -> F6: (1 2 3)
|
||||
Face 1 (0 3 2) -> F5: (0 3 2)
|
||||
@ -41,7 +41,7 @@ Tetra:
|
||||
|
||||
|
||||
Pyramid:
|
||||
Foam pro-STAR
|
||||
OpenFOAM PROSTAR
|
||||
~~~~~~~~~~~~~~ ~~~~~~~~~~~
|
||||
Face 0 (0 3 2 1) -> F1: (0 3 2 1)
|
||||
Face 1 (0 4 3) -> F5: (0 4 3)
|
||||
@ -49,12 +49,12 @@ Pyramid:
|
||||
Face 3 (1 2 4) -> F6: (1 2 4)
|
||||
Face 4 (0 1 4) -> F3: (0 1 4)
|
||||
|
||||
Noting that several faces are skipped over in the pro-STAR definitions,
|
||||
Noting that several faces are skipped over in the PROSTAR definitions,
|
||||
simply introducing a new cell modeller will be a problem.
|
||||
Instead, subtract 1 from the pro-STAR faces and use lookup tables.
|
||||
Instead, subtract 1 from the PROSTAR faces and use lookup tables.
|
||||
|
||||
|
||||
Here are the pro-STAR macro snippets used for creating the primitive cells:
|
||||
Here are the PROSTAR macro snippets used for creating the primitive cells:
|
||||
|
||||
! hexa
|
||||
v 10 0 0 0
|
||||
|
||||
@ -28,42 +28,8 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "faceSet.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "cellModeller.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::cellModel* Foam::meshReader::unknownModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"unknown"
|
||||
);
|
||||
|
||||
const Foam::cellModel* Foam::meshReader::tetModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"tet"
|
||||
);
|
||||
|
||||
const Foam::cellModel* Foam::meshReader::pyrModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"pyr"
|
||||
);
|
||||
|
||||
const Foam::cellModel* Foam::meshReader::prismModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"prism"
|
||||
);
|
||||
|
||||
const Foam::cellModel* Foam::meshReader::hexModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"hex"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::meshReader::addCellZones(polyMesh& mesh) const
|
||||
|
||||
@ -30,7 +30,7 @@ Description
|
||||
The derived classes are responsible for providing the protected data.
|
||||
This implementation is somewhat messy, but could/should be restructured
|
||||
to provide a more generalized reader (at the moment it has been written
|
||||
for converting pro-STAR data).
|
||||
for converting PROSTAR data).
|
||||
|
||||
The meshReader supports cellTable information (see new user's guide entry).
|
||||
|
||||
@ -204,13 +204,6 @@ protected:
|
||||
|
||||
// Protected member data
|
||||
|
||||
//- Pointers to cell shape models
|
||||
static const cellModel* unknownModel;
|
||||
static const cellModel* tetModel;
|
||||
static const cellModel* pyrModel;
|
||||
static const cellModel* prismModel;
|
||||
static const cellModel* hexModel;
|
||||
|
||||
//- Referenced filename
|
||||
fileName geometryFile_;
|
||||
|
||||
|
||||
@ -24,48 +24,12 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "meshWriter.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::meshWriter::unknownModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"unknown"
|
||||
);
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::meshWriter::tetModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"tet"
|
||||
);
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::meshWriter::pyrModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"pyr"
|
||||
);
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::meshWriter::prismModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"prism"
|
||||
);
|
||||
|
||||
|
||||
const Foam::cellModel* Foam::meshWriter::hexModel = Foam::cellModeller::
|
||||
lookup
|
||||
(
|
||||
"hex"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshWriter::meshWriter
|
||||
|
||||
@ -107,14 +107,6 @@ protected:
|
||||
//- cellTable IDs for each cell
|
||||
labelList cellTableId_;
|
||||
|
||||
//- Pointers to cell shape models
|
||||
static const cellModel* unknownModel;
|
||||
static const cellModel* tetModel;
|
||||
static const cellModel* pyrModel;
|
||||
static const cellModel* prismModel;
|
||||
static const cellModel* hexModel;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "ListOps.H"
|
||||
#include "IFstream.H"
|
||||
#include "IOMap.H"
|
||||
@ -317,7 +317,10 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName)
|
||||
|
||||
|
||||
// avoid undefined shapes for polyhedra
|
||||
cellShape genericShape(*unknownModel, labelList(0));
|
||||
cellShape genericShape
|
||||
(
|
||||
cellModel::ref(cellModel::UNKNOWN), labelList()
|
||||
);
|
||||
|
||||
// Pass 2:
|
||||
// construct cellFaces_ and possibly cellShapes_
|
||||
@ -372,23 +375,23 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName)
|
||||
continue;
|
||||
}
|
||||
|
||||
// determine the foam cell shape
|
||||
// determine the OpenFOAM cell shape
|
||||
const cellModel* curModelPtr = nullptr;
|
||||
|
||||
// fluid/solid cells
|
||||
switch (shapeId)
|
||||
{
|
||||
case STARCDCore::starcdHex:
|
||||
curModelPtr = hexModel;
|
||||
curModelPtr = cellModel::ptr(cellModel::HEX);
|
||||
break;
|
||||
case STARCDCore::starcdPrism:
|
||||
curModelPtr = prismModel;
|
||||
curModelPtr = cellModel::ptr(cellModel::PRISM);
|
||||
break;
|
||||
case STARCDCore::starcdTet:
|
||||
curModelPtr = tetModel;
|
||||
curModelPtr = cellModel::ptr(cellModel::TET);
|
||||
break;
|
||||
case STARCDCore::starcdPyr:
|
||||
curModelPtr = pyrModel;
|
||||
curModelPtr = cellModel::ptr(cellModel::PYR);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -612,12 +615,12 @@ void Foam::fileFormats::STARCDMeshReader::readBoundary
|
||||
// Mapping between OpenFOAM and PROSTAR primitives
|
||||
// - needed for face mapping
|
||||
//
|
||||
const Map<label> prostarShapeLookup =
|
||||
const Map<label> shapeLookup =
|
||||
{
|
||||
{ hexModel->index(), STARCDCore::starcdHex },
|
||||
{ prismModel->index(), STARCDCore::starcdPrism },
|
||||
{ tetModel->index(), STARCDCore::starcdTet },
|
||||
{ pyrModel->index(), STARCDCore::starcdPyr }
|
||||
{ cellModel::ref(cellModel::HEX).index(), STARCDCore::starcdHex },
|
||||
{ cellModel::ref(cellModel::PRISM).index(), STARCDCore::starcdPrism },
|
||||
{ cellModel::ref(cellModel::TET).index(), STARCDCore::starcdTet },
|
||||
{ cellModel::ref(cellModel::PYR).index(), STARCDCore::starcdPyr },
|
||||
};
|
||||
|
||||
// Pass 1:
|
||||
@ -861,9 +864,9 @@ void Foam::fileFormats::STARCDMeshReader::readBoundary
|
||||
if (cellId < cellShapes_.size())
|
||||
{
|
||||
label mapIndex = cellShapes_[cellId].model().index();
|
||||
if (prostarShapeLookup.found(mapIndex))
|
||||
if (shapeLookup.found(mapIndex))
|
||||
{
|
||||
mapIndex = prostarShapeLookup[mapIndex];
|
||||
mapIndex = shapeLookup[mapIndex];
|
||||
cellFaceId =
|
||||
STARCDCore::starToFoamFaceAddr
|
||||
[mapIndex][cellFaceId];
|
||||
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::fileFormats::STARCDMeshReader
|
||||
|
||||
Description
|
||||
Read pro-STAR vrt/cel/bnd files.
|
||||
Read PROSTAR vrt/cel/bnd files.
|
||||
The protected data in meshReader are filled.
|
||||
|
||||
Starting with pro-STAR version 4, the files have become easier to read.
|
||||
Starting with PROSTAR version 4, the files have become easier to read.
|
||||
- vertices are space-delimited.
|
||||
- the cell format is logical.
|
||||
- trimmed and degenerate cells are saved as polyhedral.
|
||||
|
||||
@ -35,18 +35,17 @@ Foam::label Foam::fileFormats::STARCDMeshWriter::findDefaultBoundary() const
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
label id = -1;
|
||||
|
||||
// find Default_Boundary_Region if it exists
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (defaultBoundaryName == patches[patchi].name())
|
||||
{
|
||||
id = patchi;
|
||||
return patchi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return id;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -165,29 +164,16 @@ void Foam::fileFormats::STARCDMeshWriter::writeCells
|
||||
OFstream os(starFileName(prefix, STARCDCore::CEL_FILE));
|
||||
writeHeader(os, STARCDCore::HEADER_CEL);
|
||||
|
||||
// this is what we seem to need
|
||||
// map foam cellModeller index -> star shape
|
||||
Map<label> shapeLookupIndex;
|
||||
shapeLookupIndex.insert
|
||||
(
|
||||
hexModel->index(),
|
||||
STARCDCore::starcdHex
|
||||
);
|
||||
shapeLookupIndex.insert
|
||||
(
|
||||
prismModel->index(),
|
||||
STARCDCore::starcdPrism
|
||||
);
|
||||
shapeLookupIndex.insert
|
||||
(
|
||||
tetModel->index(),
|
||||
STARCDCore::starcdTet
|
||||
);
|
||||
shapeLookupIndex.insert
|
||||
(
|
||||
pyrModel->index(),
|
||||
STARCDCore::starcdPyr
|
||||
);
|
||||
//
|
||||
// Mapping between OpenFOAM and PROSTAR primitives
|
||||
//
|
||||
const Map<label> shapeLookupIndex
|
||||
{
|
||||
{ cellModel::ref(cellModel::HEX).index(), STARCDCore::starcdHex },
|
||||
{ cellModel::ref(cellModel::PRISM).index(), STARCDCore::starcdPrism },
|
||||
{ cellModel::ref(cellModel::TET).index(), STARCDCore::starcdTet },
|
||||
{ cellModel::ref(cellModel::PYR).index(), STARCDCore::starcdPyr },
|
||||
};
|
||||
|
||||
const cellShapeList& shapes = mesh_.cellShapes();
|
||||
const cellList& cells = mesh_.cells();
|
||||
@ -336,12 +322,12 @@ void Foam::fileFormats::STARCDMeshWriter::writeBoundary
|
||||
// Mapping between OpenFOAM and PROSTAR primitives
|
||||
// - needed for face mapping
|
||||
//
|
||||
const Map<label> prostarShapeLookup =
|
||||
const Map<label> shapeLookupIndex =
|
||||
{
|
||||
{ hexModel->index(), STARCDCore::starcdHex },
|
||||
{ prismModel->index(), STARCDCore::starcdPrism },
|
||||
{ tetModel->index(), STARCDCore::starcdTet },
|
||||
{ pyrModel->index(), STARCDCore::starcdPyr }
|
||||
{ cellModel::ref(cellModel::HEX).index(), STARCDCore::starcdHex },
|
||||
{ cellModel::ref(cellModel::PRISM).index(), STARCDCore::starcdPrism },
|
||||
{ cellModel::ref(cellModel::TET).index(), STARCDCore::starcdTet },
|
||||
{ cellModel::ref(cellModel::PYR).index(), STARCDCore::starcdPyr },
|
||||
};
|
||||
|
||||
Info<< "Writing " << os.name() << " : "
|
||||
@ -396,7 +382,7 @@ void Foam::fileFormats::STARCDMeshWriter::writeBoundary
|
||||
label mapIndex = shape.model().index();
|
||||
|
||||
// A registered primitive type
|
||||
if (prostarShapeLookup.found(mapIndex))
|
||||
if (shapeLookupIndex.found(mapIndex))
|
||||
{
|
||||
const faceList sFaces = shape.faces();
|
||||
forAll(sFaces, sFacei)
|
||||
@ -408,7 +394,7 @@ void Foam::fileFormats::STARCDMeshWriter::writeBoundary
|
||||
}
|
||||
}
|
||||
|
||||
mapIndex = prostarShapeLookup[mapIndex];
|
||||
mapIndex = shapeLookupIndex[mapIndex];
|
||||
cellFaceId =
|
||||
STARCDCore::foamToStarFaceAddr[mapIndex][cellFaceId];
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::fileFormats::STARCDMeshWriter
|
||||
|
||||
Description
|
||||
Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
|
||||
Writes polyMesh in PROSTAR (v4) bnd/cel/vrt format
|
||||
|
||||
The cellTableId and cellTable information are used (if available).
|
||||
Otherwise the cellZones are used (if available).
|
||||
|
||||
@ -27,7 +27,6 @@ License
|
||||
#include "foamVtkCore.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// Only used in this file
|
||||
#include "foamVtuSizingTemplates.C"
|
||||
@ -74,12 +73,12 @@ void Foam::vtk::vtuSizing::reset
|
||||
const bool decompose
|
||||
)
|
||||
{
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
const cellModel& tetWedge = cellModel::ref(cellModel::TETWEDGE);
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
const cellShapeList& shapes = mesh.cellShapes();
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@ License
|
||||
#include "foamVtkCore.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -212,12 +211,12 @@ void Foam::vtk::vtuSizing::populateArrays
|
||||
|
||||
faceOffset = -1;
|
||||
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& wedge = cellModel::ref(cellModel::WEDGE);
|
||||
const cellModel& tetWedge = cellModel::ref(cellModel::TETWEDGE);
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
const cellShapeList& shapes = mesh.cellShapes();
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ License
|
||||
#include "hexCellLooper.H"
|
||||
#include "cellFeatures.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "plane.H"
|
||||
#include "ListOps.H"
|
||||
#include "meshTools.H"
|
||||
@ -153,7 +153,7 @@ void Foam::hexCellLooper::makeFace
|
||||
Foam::hexCellLooper::hexCellLooper(const polyMesh& mesh)
|
||||
:
|
||||
geomCellLooper(mesh),
|
||||
hex_(*(cellModeller::lookup("hex")))
|
||||
hex_(cellModel::ref(cellModel::HEX))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ License
|
||||
#include "hexRef8.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -186,7 +186,7 @@ void Foam::multiDirRefinement::addCells
|
||||
|
||||
Foam::labelList Foam::multiDirRefinement::splitOffHex(const primitiveMesh& mesh)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
const cellShapeList& cellShapes = mesh.cellShapes();
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ License
|
||||
#include "ensightCells.H"
|
||||
#include "error.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -162,10 +162,10 @@ void Foam::ensightCells::classify
|
||||
)
|
||||
{
|
||||
// References to cell shape models
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
|
||||
const cellShapeList& shapes = mesh.cellShapes();
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::fileFormats::STARCDCore
|
||||
|
||||
Description
|
||||
Core routines used when reading/writing pro-STAR vrt/cel/bnd files.
|
||||
Core routines used when reading/writing PROSTAR vrt/cel/bnd files.
|
||||
|
||||
SourceFiles
|
||||
STARCDCore.C
|
||||
@ -121,11 +121,11 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Face addressing from pro-STAR faces to OpenFOAM faces.
|
||||
//- Face addressing from PROSTAR faces to OpenFOAM faces.
|
||||
// For hex, prism, tet, pyr primitive shapes.
|
||||
static const Map<FixedList<int, 6>> starToFoamFaceAddr;
|
||||
|
||||
//- Face addressing from OpenFOAM faces to pro-STAR faces.
|
||||
//- Face addressing from OpenFOAM faces to PROSTAR faces.
|
||||
// For hex, prism, tet, pyr primitive shapes.
|
||||
static const Map<FixedList<int, 6>> foamToStarFaceAddr;
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ bool Foam::fileFormats::STLCore::isBinaryName
|
||||
// this seems to work better than the old token-based method
|
||||
// - using wordToken can cause an abort if non-word (binary) content
|
||||
// is detected ... this is not exactly what we want.
|
||||
// - some programs (eg, pro-STAR) have 'solid' as the first word in
|
||||
// - some programs (eg, PROSTAR) have 'solid' as the first word in
|
||||
// the binary header. This is just wrong and not our fault.
|
||||
int Foam::fileFormats::STLCore::detectBinaryHeader
|
||||
(
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
#include "labelIOField.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "stringIOList.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "vectorIOField.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
@ -104,10 +104,10 @@ void Foam::vtkUnstructuredReader::extractCells
|
||||
const labelList& cellVertData
|
||||
)
|
||||
{
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||
const cellModel& prism = cellModel::ref(cellModel::PRISM);
|
||||
const cellModel& pyr = cellModel::ref(cellModel::PYR);
|
||||
const cellModel& tet = cellModel::ref(cellModel::TET);
|
||||
|
||||
labelList tetPoints(4);
|
||||
labelList pyrPoints(5);
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
#include "labelIOField.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "stringIOList.H"
|
||||
#include "cellModeller.H"
|
||||
#include "cellModel.H"
|
||||
#include "vectorIOField.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user