mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: Resolved conflict
This commit is contained in:
@ -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) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,7 +48,7 @@ Note
|
||||
creating the cellTable information.
|
||||
|
||||
See also
|
||||
Foam::cellTable, Foam::meshWriter and Foam::meshWriters::STARCD
|
||||
Foam::cellTable, Foam::meshWriter and Foam::fileFormats::STARCDMeshWriter
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (!timeI || state != polyMesh::UNCHANGED)
|
||||
{
|
||||
meshWriters::STARCD writer(mesh, scaleFactor);
|
||||
fileFormats::STARCDMeshWriter writer(mesh, scaleFactor);
|
||||
|
||||
if (args.optionFound("noBnd"))
|
||||
{
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
sammMesh.C
|
||||
fillSammCellShapeTable.C
|
||||
fillSammAddressingTable.C
|
||||
readPoints.C
|
||||
readCells.C
|
||||
readBoundary.C
|
||||
fixCollapsedEdges.C
|
||||
readCouples.C
|
||||
calcPointCells.C
|
||||
createPolyCells.C
|
||||
createBoundaryFaces.C
|
||||
createPolyBoundary.C
|
||||
purgeCellShapes.C
|
||||
writeMesh.C
|
||||
sammToFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/sammToFoam
|
||||
@ -1,139 +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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::calcPointCells() const
|
||||
{
|
||||
static const label UNIT_POINT_CELLS = 12;
|
||||
|
||||
if (pointCellsPtr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "PointCells already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
pointCellsPtr_ = new labelListList(points_.size());
|
||||
|
||||
labelListList& pc = *pointCellsPtr_;
|
||||
|
||||
forAll(pc, i)
|
||||
{
|
||||
pc[i].setSize(UNIT_POINT_CELLS);
|
||||
}
|
||||
|
||||
// Initialise the list of labels which will hold the count the
|
||||
// actual number of cells per point during the analysis
|
||||
labelList cellCount(points_.size());
|
||||
|
||||
forAll(cellCount, i)
|
||||
{
|
||||
cellCount[i] = 0;
|
||||
}
|
||||
|
||||
// Note. Unlike the standard point-cell algorithm, which asks the cell for
|
||||
// the supporting point labels, we need to work based on the cell faces.
|
||||
// This is because some of the faces for meshes with arbitrary interfaces
|
||||
// do not come from the cell shape, but from the slaves of the coupled
|
||||
// match. It is also adventageous to remove the duplicates from the
|
||||
// point-cell addressing, because this removes a lot of waste later.
|
||||
//
|
||||
|
||||
// For each cell
|
||||
forAll(cellShapes_, celli)
|
||||
{
|
||||
const faceList& faces = cellFaces_[celli];
|
||||
|
||||
forAll(faces, i)
|
||||
{
|
||||
// For each vertex
|
||||
const labelList& labels = faces[i];
|
||||
|
||||
forAll(labels, j)
|
||||
{
|
||||
// Set working point label
|
||||
label curPoint = labels[j];
|
||||
labelList& curPointCells = pc[curPoint];
|
||||
label curCount = cellCount[curPoint];
|
||||
|
||||
// check if the cell has been added before
|
||||
bool found = false;
|
||||
|
||||
for (label f = 0; f < curCount; f++)
|
||||
{
|
||||
if (curPointCells[f] == celli)
|
||||
{
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
||||
// If the list of pointCells is not big enough, double it
|
||||
if (curPointCells.size() <= curCount)
|
||||
{
|
||||
curPointCells.setSize(curPointCells.size()*2);
|
||||
}
|
||||
|
||||
// Enter the cell label in the point's cell list
|
||||
curPointCells[curCount] = celli;
|
||||
|
||||
// Increment the cell count for the point addressed
|
||||
cellCount[curPoint]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, truncate the lists made to their active size
|
||||
forAll(pc, i)
|
||||
{
|
||||
pc[i].setSize(cellCount[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::sammMesh::pointCells() const
|
||||
{
|
||||
if (!pointCellsPtr_)
|
||||
{
|
||||
calcPointCells();
|
||||
}
|
||||
|
||||
return *pointCellsPtr_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,126 +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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::sammMesh::sammEqualFace
|
||||
(
|
||||
const face& boundaryFace,
|
||||
const face& cellFace
|
||||
) const
|
||||
{
|
||||
// A PROSTAR boundary face is defined by 4 vertices irrespective
|
||||
// of its topology.
|
||||
// In order to deal with all possibilities, two faces will be
|
||||
// considered equal if three of the vertices are the same.
|
||||
label nEqual = 0;
|
||||
|
||||
forAll(cellFace, cellFaceLabelI)
|
||||
{
|
||||
const label curCellFaceLabel = cellFace[cellFaceLabelI];
|
||||
|
||||
forAll(boundaryFace, bouFaceLabelI)
|
||||
{
|
||||
if (boundaryFace[bouFaceLabelI] == curCellFaceLabel)
|
||||
{
|
||||
nEqual++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nEqual >= 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::sammMesh::createBoundaryFaces()
|
||||
{
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
faceList& patchFaces = boundary_[patchi];
|
||||
|
||||
const labelListList& PointCells = pointCells();
|
||||
|
||||
forAll(patchFaces, facei)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
face& curFace = patchFaces[facei];
|
||||
const labelList& facePoints = curFace;
|
||||
|
||||
forAll(facePoints, pointi)
|
||||
{
|
||||
const labelList& facePointCells =
|
||||
PointCells[facePoints[pointi]];
|
||||
|
||||
forAll(facePointCells, celli)
|
||||
{
|
||||
const faceList& curCellFaces =
|
||||
cellFaces_[facePointCells[celli]];
|
||||
|
||||
forAll(curCellFaces, cellFacei)
|
||||
{
|
||||
if (sammEqualFace(curCellFaces[cellFacei], curFace))
|
||||
{
|
||||
// Found the cell face corresponding to this face
|
||||
found = true;
|
||||
|
||||
// Set boundary face to the corresponding cell face
|
||||
// which guarantees it is outward-pointing
|
||||
curFace = curCellFaces[cellFacei];
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face " << facei
|
||||
<< " does not have neighbour cell." << endl
|
||||
<< " face : " << endl << curFace
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,144 +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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
#include "polyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::createPolyBoundary()
|
||||
{
|
||||
label nBoundaryFacesFound = 0;
|
||||
|
||||
polyBoundaryPatchStartIndices_.setSize(boundary_.size());
|
||||
|
||||
label nCreatedFaces = nInternalFaces_;
|
||||
|
||||
const labelListList& PointCells = pointCells();
|
||||
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
const faceList& curShapePatch = boundary_[patchi];
|
||||
|
||||
polyBoundaryPatchStartIndices_[patchi] = nCreatedFaces;
|
||||
|
||||
forAll(curShapePatch, facei)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
const face& curFace = curShapePatch[facei];
|
||||
|
||||
meshFaces_[nCreatedFaces] = curFace;
|
||||
|
||||
// Must find which cell this face belongs to in order to
|
||||
// mark it in the cellPolys_
|
||||
const labelList& facePoints = curFace;
|
||||
|
||||
forAll(facePoints, pointi)
|
||||
{
|
||||
const labelList& facePointCells =
|
||||
PointCells[facePoints[pointi]];
|
||||
|
||||
forAll(facePointCells, celli)
|
||||
{
|
||||
const faceList& curCellFaces =
|
||||
cellFaces_[facePointCells[celli]];
|
||||
|
||||
forAll(curCellFaces, cellFacei)
|
||||
{
|
||||
if (curCellFaces[cellFacei] == curFace)
|
||||
{
|
||||
// Found the cell face corresponding to this face
|
||||
found = true;
|
||||
|
||||
// Debugging
|
||||
if
|
||||
(
|
||||
cellPolys_[facePointCells[celli]][cellFacei]
|
||||
!= -1
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "This looks like an already detected "
|
||||
<< "internal face"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
cellPolys_[facePointCells[celli]][cellFacei] =
|
||||
nCreatedFaces;
|
||||
|
||||
nBoundaryFacesFound++;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
|
||||
nCreatedFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// reset the size of the face list
|
||||
meshFaces_.setSize(nCreatedFaces);
|
||||
|
||||
Info<< "Number of boundary faces: " << nBoundaryFacesFound << endl;
|
||||
Info<< "Total number of faces: " << nCreatedFaces << endl;
|
||||
}
|
||||
|
||||
|
||||
Foam::List<Foam::polyPatch* > Foam::sammMesh::polyBoundaryPatches
|
||||
(
|
||||
const polyMesh& pMesh
|
||||
)
|
||||
{
|
||||
List<polyPatch* > p(boundary_.size());
|
||||
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
const faceList& curShapePatch = boundary_[patchi];
|
||||
|
||||
p[patchi] = polyPatch::New
|
||||
(
|
||||
patchTypes_[patchi],
|
||||
patchNames_[patchi],
|
||||
curShapePatch.size(),
|
||||
polyBoundaryPatchStartIndices_[patchi],
|
||||
patchi,
|
||||
pMesh.boundaryMesh()
|
||||
).ptr();
|
||||
|
||||
p[patchi]->physicalType() = patchPhysicalTypes_[patchi];
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,188 +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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::createPolyCells()
|
||||
{
|
||||
// loop through all cell faces and create connectivity. This will produce
|
||||
// a global face list and will describe all cells as lists of face labels
|
||||
|
||||
// count the maximum number of faces and set the size of the cellPolys_
|
||||
cellPolys_.setSize(cellShapes_.size());
|
||||
|
||||
label maxFaces = 0;
|
||||
|
||||
forAll(cellPolys_, celli)
|
||||
{
|
||||
cell& curCell = cellPolys_[celli];
|
||||
|
||||
curCell.setSize(cellFaces_[celli].size());
|
||||
|
||||
forAll(curCell, fI)
|
||||
{
|
||||
curCell[fI] = -1;
|
||||
}
|
||||
|
||||
maxFaces += cellFaces_[celli].size();
|
||||
}
|
||||
|
||||
Info<< "Maximum possible number of faces in mesh: " << maxFaces << endl;
|
||||
|
||||
meshFaces_.setSize(maxFaces);
|
||||
|
||||
// set reference to point-cell addressing
|
||||
const labelListList& PointCells = pointCells();
|
||||
|
||||
bool found = false;
|
||||
|
||||
nInternalFaces_ = 0;
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
// Note:
|
||||
// Insertion cannot be done in one go as the faces need to be
|
||||
// added into the list in the increasing order of neighbour
|
||||
// cells. Therefore, all neighbours will be detected first
|
||||
// and then added in the correct order.
|
||||
|
||||
const faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
// Record the neighbour cell
|
||||
labelList neiCells(curFaces.size(), -1);
|
||||
|
||||
// Record the face of neighbour cell
|
||||
labelList faceOfNeiCell(curFaces.size(), -1);
|
||||
|
||||
label nNeighbours = 0;
|
||||
|
||||
// For all faces ...
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
// Skip faces that have already been matched
|
||||
if (cellPolys_[celli][facei] >= 0) continue;
|
||||
|
||||
found = false;
|
||||
|
||||
const face& curFace = curFaces[facei];
|
||||
|
||||
// get the list of labels
|
||||
const labelList& curPoints = curFace;
|
||||
|
||||
// For all points
|
||||
forAll(curPoints, pointi)
|
||||
{
|
||||
// get the list of cells sharing this point
|
||||
const labelList& curNeighbours = PointCells[curPoints[pointi]];
|
||||
|
||||
// For all neighbours
|
||||
forAll(curNeighbours, neiI)
|
||||
{
|
||||
label curNei = curNeighbours[neiI];
|
||||
|
||||
// reject neighbours with the lower label. This should
|
||||
// also reject current cell.
|
||||
if (curNei > celli)
|
||||
{
|
||||
// get the list of search faces
|
||||
const faceList& searchFaces = cellFaces_[curNei];
|
||||
|
||||
forAll(searchFaces, neiFacei)
|
||||
{
|
||||
if (searchFaces[neiFacei] == curFace)
|
||||
{
|
||||
// match!!
|
||||
found = true;
|
||||
|
||||
// Record the neighbour cell and face
|
||||
neiCells[facei] = curNei;
|
||||
faceOfNeiCell[facei] = neiFacei;
|
||||
nNeighbours++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
} // End of current points
|
||||
} // End of current faces
|
||||
|
||||
// Add the faces in the increasing order of neighbours
|
||||
for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
|
||||
{
|
||||
// Find the lowest neighbour which is still valid
|
||||
label nextNei = -1;
|
||||
label minNei = cellPolys_.size();
|
||||
|
||||
forAll(neiCells, ncI)
|
||||
{
|
||||
if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
|
||||
{
|
||||
nextNei = ncI;
|
||||
minNei = neiCells[ncI];
|
||||
}
|
||||
}
|
||||
|
||||
if (nextNei > -1)
|
||||
{
|
||||
// Add the face to the list of faces
|
||||
meshFaces_[nInternalFaces_] = curFaces[nextNei];
|
||||
|
||||
// Mark for owner
|
||||
cellPolys_[celli][nextNei] = nInternalFaces_;
|
||||
|
||||
// Mark for neighbour
|
||||
cellPolys_[neiCells[nextNei]][faceOfNeiCell[nextNei]] =
|
||||
nInternalFaces_;
|
||||
|
||||
// Stop the neighbour from being used again
|
||||
neiCells[nextNei] = -1;
|
||||
|
||||
// Increment number of faces counter
|
||||
nInternalFaces_++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error in internal face insertion"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// I won't reset the size of internal faces, because more faces will be
|
||||
// added in createPolyBoundary()
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,216 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::fillSammAddressingTable()
|
||||
{
|
||||
// SAMM trim type 1: 8 models
|
||||
static label SammTrim1Rot0[10] = {1, 5, 6, 2, 8, 10, 4, 7, 3, 9};
|
||||
static label SammTrim1Rot1[10] = {2, 6, 7, 3, 8, 10, 5, 4, 0, 9};
|
||||
static label SammTrim1Rot2[10] = {3, 7, 4, 0, 8, 10, 6, 5, 1, 9};
|
||||
static label SammTrim1Rot3[10] = {0, 4, 5, 1, 8, 10, 7, 6, 2, 9};
|
||||
static label SammTrim1Rot4[10] = {7, 3, 2, 6, 8, 10, 0, 1, 5, 9};
|
||||
static label SammTrim1Rot5[10] = {4, 0, 3, 7, 8, 10, 1, 2, 6, 9};
|
||||
static label SammTrim1Rot6[10] = {5, 1, 0, 4, 8, 10, 2, 3, 7, 9};
|
||||
static label SammTrim1Rot7[10] = {6, 2, 1, 5, 8, 10, 3, 0, 4, 9};
|
||||
|
||||
sammAddressingTable[1] = SammTrim1Rot0;
|
||||
sammAddressingTable[2] = SammTrim1Rot1;
|
||||
sammAddressingTable[4] = SammTrim1Rot2;
|
||||
sammAddressingTable[8] = SammTrim1Rot3;
|
||||
sammAddressingTable[16] = SammTrim1Rot4;
|
||||
sammAddressingTable[32] = SammTrim1Rot5;
|
||||
sammAddressingTable[64] = SammTrim1Rot6;
|
||||
sammAddressingTable[128] = SammTrim1Rot7;
|
||||
|
||||
|
||||
// SAMM trim type 2: 12 models
|
||||
static label SammTrim2Rot0[10] = {9, 3, 7, 4, 10, 8, 2, 6, 5, 11};
|
||||
static label SammTrim2Rot1[10] = {9, 1, 5, 6, 10, 8, 0, 4, 7, 11};
|
||||
static label SammTrim2Rot2[10] = {9, 2, 1, 5, 10, 8, 3, 0, 4, 11};
|
||||
static label SammTrim2Rot3[10] = {9, 0, 3, 7, 10, 8, 1, 2, 6, 11};
|
||||
|
||||
static label SammTrim2Rot4[10] = {9, 4, 5, 1, 10, 8, 7, 6, 2, 11};
|
||||
static label SammTrim2Rot5[10] = {9, 5, 1, 0, 10, 8, 6, 2, 3, 11};
|
||||
static label SammTrim2Rot6[10] = {9, 1, 0, 4, 10, 8, 2, 3, 7, 11};
|
||||
static label SammTrim2Rot7[10] = {9, 0, 4, 5, 10, 8, 3, 7, 6, 11};
|
||||
|
||||
static label SammTrim2Rot8[10] = {9, 1, 2, 3, 10, 8, 5, 6, 7, 11};
|
||||
static label SammTrim2Rot9[10] = {9, 2, 3, 0, 10, 8, 6, 7, 4, 11};
|
||||
static label SammTrim2Rot10[10] = {9, 3, 0, 1, 10, 8, 7, 4, 5, 11};
|
||||
static label SammTrim2Rot11[10] = {9, 0, 1, 2, 10, 8, 4, 5, 6, 11};
|
||||
|
||||
sammAddressingTable[3] = SammTrim2Rot0;
|
||||
sammAddressingTable[12] = SammTrim2Rot1;
|
||||
sammAddressingTable[192] = SammTrim2Rot2;
|
||||
sammAddressingTable[48] = SammTrim2Rot3;
|
||||
sammAddressingTable[9] = SammTrim2Rot4;
|
||||
sammAddressingTable[144] = SammTrim2Rot5;
|
||||
sammAddressingTable[96] = SammTrim2Rot6;
|
||||
sammAddressingTable[6] = SammTrim2Rot7;
|
||||
sammAddressingTable[17] = SammTrim2Rot8;
|
||||
sammAddressingTable[34] = SammTrim2Rot9;
|
||||
sammAddressingTable[68] = SammTrim2Rot10;
|
||||
sammAddressingTable[136] = SammTrim2Rot11;
|
||||
|
||||
|
||||
// SAMM trim type 3: 24 models
|
||||
static label SammTrim3Rot0[10] = {5, 4, 7, 6, 11, 10, 9, 3, 8, 12};
|
||||
static label SammTrim3Rot1[10] = {6, 5, 4, 7, 11, 10, 9, 0, 8, 12};
|
||||
static label SammTrim3Rot2[10] = {7, 6, 5, 4, 11, 10, 9, 1, 8, 12};
|
||||
static label SammTrim3Rot3[10] = {4, 7, 6, 5, 11, 10, 9, 2, 8, 12};
|
||||
static label SammTrim3Rot4[10] = {1, 2, 3, 0, 11, 10, 9, 7, 8, 12};
|
||||
static label SammTrim3Rot5[10] = {2, 3, 0, 1, 11, 10, 9, 4, 8, 12};
|
||||
static label SammTrim3Rot6[10] = {3, 0, 1, 2, 11, 10, 9, 5, 8, 12};
|
||||
static label SammTrim3Rot7[10] = {0, 1, 2, 3, 11, 10, 9, 6, 8, 12};
|
||||
static label SammTrim3Rot8[10] = {0, 3, 7, 4, 11, 10, 9, 6, 8, 12};
|
||||
static label SammTrim3Rot9[10] = {3, 7, 4, 0, 11, 10, 9, 5, 8, 12};
|
||||
static label SammTrim3Rot10[10] = {7, 4, 0, 3, 11, 10, 9, 1, 8, 12};
|
||||
static label SammTrim3Rot11[10] = {4, 0, 3, 7, 11, 10, 9, 2, 8, 12};
|
||||
static label SammTrim3Rot12[10] = {1, 5, 6, 2, 11, 10, 9, 7, 8, 12};
|
||||
static label SammTrim3Rot13[10] = {2, 1, 5, 6, 11, 10, 9, 4, 8, 12};
|
||||
static label SammTrim3Rot14[10] = {6, 2, 1, 5, 11, 10, 9, 0, 8, 12};
|
||||
static label SammTrim3Rot15[10] = {5, 6, 1, 2, 11, 10, 9, 3, 8, 12};
|
||||
static label SammTrim3Rot16[10] = {7, 3, 2, 6, 11, 10, 9, 1, 8, 12};
|
||||
static label SammTrim3Rot17[10] = {6, 7, 3, 2, 11, 10, 9, 0, 8, 12};
|
||||
static label SammTrim3Rot18[10] = {2, 6, 7, 3, 11, 10, 9, 4, 8, 12};
|
||||
static label SammTrim3Rot19[10] = {3, 2, 6, 7, 11, 10, 9, 5, 8, 12};
|
||||
static label SammTrim3Rot20[10] = {4, 5, 1, 0, 11, 10, 9, 2, 8, 12};
|
||||
static label SammTrim3Rot21[10] = {5, 1, 0, 4, 11, 10, 9, 3, 8, 12};
|
||||
static label SammTrim3Rot22[10] = {1, 0, 4, 5, 11, 10, 9, 7, 8, 12};
|
||||
static label SammTrim3Rot23[10] = {0, 4, 5, 1, 11, 10, 9, 6, 8, 12};
|
||||
|
||||
sammAddressingTable[7] = SammTrim3Rot0;
|
||||
sammAddressingTable[14] = SammTrim3Rot1;
|
||||
sammAddressingTable[13] = SammTrim3Rot2;
|
||||
sammAddressingTable[11] = SammTrim3Rot3;
|
||||
sammAddressingTable[112] = SammTrim3Rot4;
|
||||
sammAddressingTable[224] = SammTrim3Rot5;
|
||||
sammAddressingTable[208] = SammTrim3Rot6;
|
||||
sammAddressingTable[176] = SammTrim3Rot7;
|
||||
sammAddressingTable[38] = SammTrim3Rot8;
|
||||
sammAddressingTable[70] = SammTrim3Rot9;
|
||||
sammAddressingTable[100] = SammTrim3Rot10;
|
||||
sammAddressingTable[98] = SammTrim3Rot11;
|
||||
sammAddressingTable[25] = SammTrim3Rot12;
|
||||
sammAddressingTable[137] = SammTrim3Rot13;
|
||||
sammAddressingTable[152] = SammTrim3Rot14;
|
||||
sammAddressingTable[145] = SammTrim3Rot15;
|
||||
sammAddressingTable[49] = SammTrim3Rot16;
|
||||
sammAddressingTable[50] = SammTrim3Rot17;
|
||||
sammAddressingTable[35] = SammTrim3Rot18;
|
||||
sammAddressingTable[19] = SammTrim3Rot19;
|
||||
sammAddressingTable[200] = SammTrim3Rot20;
|
||||
sammAddressingTable[196] = SammTrim3Rot21;
|
||||
sammAddressingTable[76] = SammTrim3Rot22;
|
||||
sammAddressingTable[140] = SammTrim3Rot23;
|
||||
|
||||
|
||||
// SAMM trim type 4: 8 models
|
||||
static label SammTrim4Rot0[10] = {6, 7, 2, 5, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot1[10] = {7, 4, 3, 6, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot2[10] = {4, 5, 6, 7, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot3[10] = {5, 6, 1, 4, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot4[10] = {2, 1, 6, 3, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot5[10] = {3, 2, 7, 0, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot6[10] = {0, 3, 4, 1, 13, 12 ,11, 10, 9, 8};
|
||||
static label SammTrim4Rot7[10] = {1, 0, 5, 2, 13, 12 ,11, 10, 9, 8};
|
||||
|
||||
sammAddressingTable[27] = SammTrim4Rot0;
|
||||
sammAddressingTable[39] = SammTrim4Rot1;
|
||||
sammAddressingTable[78] = SammTrim4Rot2;
|
||||
sammAddressingTable[141] = SammTrim4Rot3;
|
||||
sammAddressingTable[177] = SammTrim4Rot4;
|
||||
sammAddressingTable[114] = SammTrim4Rot5;
|
||||
sammAddressingTable[228] = SammTrim4Rot6;
|
||||
sammAddressingTable[216] = SammTrim4Rot7;
|
||||
|
||||
|
||||
// SAMM trim type 5: 24 models
|
||||
static label SammTrim5Rot0[8] = {12, 0, 1, 2, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot1[8] = {12, 1, 2, 3, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot2[8] = {12, 2, 3, 0, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot3[8] = {12, 3, 0, 1, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot4[8] = {12, 6, 5, 4, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot5[8] = {12, 7, 6, 5, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot6[8] = {12, 4, 7, 6, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot7[8] = {12, 5, 4, 7, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot8[8] = {12, 2, 1, 5, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot9[8] = {12, 6, 2, 1, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot10[8] = {12, 5, 6, 2, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot11[8] = {12, 1, 5, 6, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot12[8] = {12, 4, 0, 3, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot13[8] = {12, 0, 3, 7, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot14[8] = {12, 3, 7, 4, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot15[8] = {12, 7, 4, 0, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot16[8] = {12, 0, 4, 5, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot17[8] = {12, 4, 5, 1, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot18[8] = {12, 5, 1, 0, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot19[8] = {12, 1, 0, 4, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot20[8] = {12, 6, 7, 3, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot21[8] = {12, 2, 6, 7, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot22[8] = {12, 3, 2, 6, 8, 11, 10, 9};
|
||||
static label SammTrim5Rot23[8] = {12, 7, 3, 2, 8, 11, 10, 9};
|
||||
|
||||
sammAddressingTable[248] = SammTrim5Rot0;
|
||||
sammAddressingTable[241] = SammTrim5Rot1;
|
||||
sammAddressingTable[242] = SammTrim5Rot2;
|
||||
sammAddressingTable[244] = SammTrim5Rot3;
|
||||
sammAddressingTable[143] = SammTrim5Rot4;
|
||||
sammAddressingTable[31] = SammTrim5Rot5;
|
||||
sammAddressingTable[47] = SammTrim5Rot6;
|
||||
sammAddressingTable[79] = SammTrim5Rot7;
|
||||
sammAddressingTable[217] = SammTrim5Rot8;
|
||||
sammAddressingTable[185] = SammTrim5Rot9;
|
||||
sammAddressingTable[155] = SammTrim5Rot10;
|
||||
sammAddressingTable[157] = SammTrim5Rot11;
|
||||
sammAddressingTable[230] = SammTrim5Rot12;
|
||||
sammAddressingTable[118] = SammTrim5Rot13;
|
||||
sammAddressingTable[103] = SammTrim5Rot14;
|
||||
sammAddressingTable[110] = SammTrim5Rot15;
|
||||
sammAddressingTable[206] = SammTrim5Rot16;
|
||||
sammAddressingTable[205] = SammTrim5Rot17;
|
||||
sammAddressingTable[220] = SammTrim5Rot18;
|
||||
sammAddressingTable[236] = SammTrim5Rot19;
|
||||
sammAddressingTable[55] = SammTrim5Rot20;
|
||||
sammAddressingTable[59] = SammTrim5Rot21;
|
||||
sammAddressingTable[179] = SammTrim5Rot22;
|
||||
sammAddressingTable[115] = SammTrim5Rot23;
|
||||
|
||||
|
||||
// SAMM trim type 8: 1 model
|
||||
static label SammTrim8[12] = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
|
||||
|
||||
sammAddressingTable[255] = SammTrim8;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,131 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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
|
||||
SAMM cell shape lookup table
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::fillSammCellShapeTable()
|
||||
{
|
||||
// Fill the list by hand
|
||||
|
||||
// SAMM trim type 1: 8 models
|
||||
sammShapeLookup[1] = sammTrim1Ptr_;
|
||||
sammShapeLookup[2] = sammTrim1Ptr_;
|
||||
sammShapeLookup[4] = sammTrim1Ptr_;
|
||||
sammShapeLookup[8] = sammTrim1Ptr_;
|
||||
sammShapeLookup[16] = sammTrim1Ptr_;
|
||||
sammShapeLookup[32] = sammTrim1Ptr_;
|
||||
sammShapeLookup[64] = sammTrim1Ptr_;
|
||||
sammShapeLookup[128] = sammTrim1Ptr_;
|
||||
|
||||
//SAMM trim type 2: 12 models
|
||||
sammShapeLookup[3] = sammTrim2Ptr_;
|
||||
sammShapeLookup[12] = sammTrim2Ptr_;
|
||||
sammShapeLookup[192] = sammTrim2Ptr_;
|
||||
sammShapeLookup[48] = sammTrim2Ptr_;
|
||||
sammShapeLookup[9] = sammTrim2Ptr_;
|
||||
sammShapeLookup[144] = sammTrim2Ptr_;
|
||||
sammShapeLookup[96] = sammTrim2Ptr_;
|
||||
sammShapeLookup[6] = sammTrim2Ptr_;
|
||||
sammShapeLookup[17] = sammTrim2Ptr_;
|
||||
sammShapeLookup[34] = sammTrim2Ptr_;
|
||||
sammShapeLookup[68] = sammTrim2Ptr_;
|
||||
sammShapeLookup[136] = sammTrim2Ptr_;
|
||||
|
||||
// SAMM trim type 3: 24 models
|
||||
sammShapeLookup[7] = sammTrim3Ptr_;
|
||||
sammShapeLookup[14] = sammTrim3Ptr_;
|
||||
sammShapeLookup[13] = sammTrim3Ptr_;
|
||||
sammShapeLookup[11] = sammTrim3Ptr_;
|
||||
sammShapeLookup[112] = sammTrim3Ptr_;
|
||||
sammShapeLookup[224] = sammTrim3Ptr_;
|
||||
sammShapeLookup[208] = sammTrim3Ptr_;
|
||||
sammShapeLookup[176] = sammTrim3Ptr_;
|
||||
sammShapeLookup[38] = sammTrim3Ptr_;
|
||||
sammShapeLookup[70] = sammTrim3Ptr_;
|
||||
sammShapeLookup[100] = sammTrim3Ptr_;
|
||||
sammShapeLookup[98] = sammTrim3Ptr_;
|
||||
sammShapeLookup[25] = sammTrim3Ptr_;
|
||||
sammShapeLookup[137] = sammTrim3Ptr_;
|
||||
sammShapeLookup[152] = sammTrim3Ptr_;
|
||||
sammShapeLookup[145] = sammTrim3Ptr_;
|
||||
sammShapeLookup[49] = sammTrim3Ptr_;
|
||||
sammShapeLookup[50] = sammTrim3Ptr_;
|
||||
sammShapeLookup[35] = sammTrim3Ptr_;
|
||||
sammShapeLookup[19] = sammTrim3Ptr_;
|
||||
sammShapeLookup[200] = sammTrim3Ptr_;
|
||||
sammShapeLookup[196] = sammTrim3Ptr_;
|
||||
sammShapeLookup[76] = sammTrim3Ptr_;
|
||||
sammShapeLookup[140] = sammTrim3Ptr_;
|
||||
|
||||
// SAMM trim type 4: 8 models
|
||||
sammShapeLookup[27] = sammTrim4Ptr_;
|
||||
sammShapeLookup[39] = sammTrim4Ptr_;
|
||||
sammShapeLookup[78] = sammTrim4Ptr_;
|
||||
sammShapeLookup[141] = sammTrim4Ptr_;
|
||||
sammShapeLookup[177] = sammTrim4Ptr_;
|
||||
sammShapeLookup[114] = sammTrim4Ptr_;
|
||||
sammShapeLookup[228] = sammTrim4Ptr_;
|
||||
sammShapeLookup[216] = sammTrim4Ptr_;
|
||||
|
||||
// SAMM trim type 5: 24 models
|
||||
sammShapeLookup[248] = sammTrim5Ptr_;
|
||||
sammShapeLookup[241] = sammTrim5Ptr_;
|
||||
sammShapeLookup[242] = sammTrim5Ptr_;
|
||||
sammShapeLookup[244] = sammTrim5Ptr_;
|
||||
sammShapeLookup[143] = sammTrim5Ptr_;
|
||||
sammShapeLookup[31] = sammTrim5Ptr_;
|
||||
sammShapeLookup[47] = sammTrim5Ptr_;
|
||||
sammShapeLookup[79] = sammTrim5Ptr_;
|
||||
sammShapeLookup[217] = sammTrim5Ptr_;
|
||||
sammShapeLookup[185] = sammTrim5Ptr_;
|
||||
sammShapeLookup[155] = sammTrim5Ptr_;
|
||||
sammShapeLookup[157] = sammTrim5Ptr_;
|
||||
sammShapeLookup[230] = sammTrim5Ptr_;
|
||||
sammShapeLookup[118] = sammTrim5Ptr_;
|
||||
sammShapeLookup[103] = sammTrim5Ptr_;
|
||||
sammShapeLookup[110] = sammTrim5Ptr_;
|
||||
sammShapeLookup[206] = sammTrim5Ptr_;
|
||||
sammShapeLookup[205] = sammTrim5Ptr_;
|
||||
sammShapeLookup[220] = sammTrim5Ptr_;
|
||||
sammShapeLookup[236] = sammTrim5Ptr_;
|
||||
sammShapeLookup[55] = sammTrim5Ptr_;
|
||||
sammShapeLookup[59] = sammTrim5Ptr_;
|
||||
sammShapeLookup[179] = sammTrim5Ptr_;
|
||||
sammShapeLookup[115] = sammTrim5Ptr_;
|
||||
|
||||
// SAMM hexagonal prism (trim type 8): 1 model
|
||||
sammShapeLookup[255] = sammTrim8Ptr_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,149 +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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::fixCollapsedEdges()
|
||||
{
|
||||
cellFaces_.setSize(cellShapes_.size());
|
||||
|
||||
forAll(cellShapes_, celli)
|
||||
{
|
||||
cellFaces_[celli] = cellShapes_[celli].faces();
|
||||
}
|
||||
|
||||
// go through the faces and find if there exist faces with duplicate
|
||||
// vertices. If so, purge the duplicates and mark the mesh as a polyMesh
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
face& vertexLabels = curFaces[facei];
|
||||
|
||||
bool duplicatesFound = false;
|
||||
|
||||
forAll(vertexLabels, vI)
|
||||
{
|
||||
label curLabel = vertexLabels[vI];
|
||||
|
||||
label nFound = 0;
|
||||
|
||||
forAll(vertexLabels, searchI)
|
||||
{
|
||||
if (vertexLabels[searchI] == curLabel)
|
||||
{
|
||||
nFound++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nFound > 1)
|
||||
{
|
||||
duplicatesFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (duplicatesFound)
|
||||
{
|
||||
// this mesh cannot be described as a shapeMesh
|
||||
isShapeMesh_ = false;
|
||||
|
||||
// I am not allowed to reset the shape pointer to unknown
|
||||
// here as the shape is still needed to determine which face
|
||||
// of the shape is used in potential couple matches. This
|
||||
// will be done in the end using the purgeShapes()
|
||||
//
|
||||
|
||||
// create a new face without duplicates and replace original
|
||||
face newFace(vertexLabels.size());
|
||||
|
||||
label nNewVertices = 0;
|
||||
|
||||
forAll(vertexLabels, vI)
|
||||
{
|
||||
// In order for a face to be a valid entity, duplicate
|
||||
// vertices can only be consecutive (othervise, the
|
||||
// collapse creates an invalid face). We shall use this
|
||||
// property in the creation of the collapsed face
|
||||
|
||||
label curLabel = vertexLabels[vI];
|
||||
|
||||
bool found = false;
|
||||
|
||||
// search through all vertices from the new face. If the
|
||||
// current label has not been added, add it to the end.
|
||||
for (label searchI = 0; searchI < nNewVertices; searchI++)
|
||||
{
|
||||
if (newFace[searchI] == curLabel)
|
||||
{
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
newFace[nNewVertices] = curLabel;
|
||||
nNewVertices++;
|
||||
}
|
||||
}
|
||||
|
||||
newFace.setSize(nNewVertices);
|
||||
|
||||
// If the number of non-duplicate labels in the face is less
|
||||
// than three, the face has been collapsed in an invalid
|
||||
// manner. Error.
|
||||
|
||||
if (nNewVertices < 3)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "face " << facei << " of cell " << celli
|
||||
<< " is colapsed down to a point or edge, which is "
|
||||
<< "not permitted" << endl
|
||||
<< "original face: " << vertexLabels << endl
|
||||
<< "purged face: " << newFace << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
vertexLabels = newFace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,66 +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
|
||||
Purge cell shapes which have been rendered invalid by cell face collapse
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::purgeCellShapes()
|
||||
{
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
const faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
// Get model faces
|
||||
faceList shapeFaces = cellShapes_[celli].faces();
|
||||
|
||||
forAll(shapeFaces, facei)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
forAll(curFaces, i)
|
||||
{
|
||||
if (shapeFaces[facei] == curFaces[i])
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Info<< "Purging cell shape " << celli << endl;
|
||||
cellShapes_[celli] = cellShape(*unknownPtr_, labelList(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,258 +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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
#include "Time.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "oldCyclicPolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::readBoundary()
|
||||
{
|
||||
label nPatches=0, nFaces=0;
|
||||
labelList nPatchFaces(1000);
|
||||
|
||||
label lineIndex, sammLabel;
|
||||
label sammRegion, configNumber;
|
||||
|
||||
labelList pointLabels(4);
|
||||
labelList pointLabelsTri(3);
|
||||
|
||||
labelList patchLabels(1000, label(-1));
|
||||
|
||||
word patchType;
|
||||
patchTypes_.setSize(1000);
|
||||
patchNames_.setSize(1000);
|
||||
|
||||
fileName boundaryFileName(casePrefix_ + ".bnd");
|
||||
|
||||
{
|
||||
IFstream boundaryFile(boundaryFileName);
|
||||
|
||||
// Collect no. of faces (nFaces),
|
||||
// no. of patches (nPatches)
|
||||
// and for each of these patches the number of faces
|
||||
// (nPatchFaces[patchLabel])
|
||||
// and a conversion table from Samm regions to (Foam) patchLabels
|
||||
|
||||
if (boundaryFile.good())
|
||||
{
|
||||
forAll(nPatchFaces, faceLabel)
|
||||
{
|
||||
nPatchFaces[faceLabel] = 0;
|
||||
}
|
||||
|
||||
while ((boundaryFile >> lineIndex).good())
|
||||
{
|
||||
nFaces++;
|
||||
|
||||
// Skip point numbers
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
boundaryFile >> sammLabel;
|
||||
}
|
||||
|
||||
boundaryFile >> sammRegion;
|
||||
boundaryFile >> configNumber;
|
||||
boundaryFile >> patchType;
|
||||
|
||||
// Build translation table to convert samm patch to foam patch
|
||||
label patchLabel = patchLabels[sammRegion];
|
||||
if (patchLabel == -1)
|
||||
{
|
||||
patchLabel = nPatches;
|
||||
patchLabels[sammRegion] = patchLabel;
|
||||
patchTypes_[patchLabel] = patchType;
|
||||
patchNames_[patchLabel] = patchType + name(sammRegion);
|
||||
|
||||
nPatches++;
|
||||
|
||||
Info<< "Samm region " << sammRegion
|
||||
<< " with type " << patchType
|
||||
<< " is now Foam patch " << patchLabel << endl;
|
||||
|
||||
}
|
||||
|
||||
nPatchFaces[patchLabel]++;
|
||||
}
|
||||
|
||||
|
||||
Info<< nl
|
||||
<< "Setting size of shapePatchList to " << nPatches
|
||||
<< nl << endl;
|
||||
|
||||
nPatchFaces.setSize(nPatches);
|
||||
patchTypes_.setSize(nPatches);
|
||||
patchNames_.setSize(nPatches);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file "
|
||||
<< boundaryFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (nPatches > 0)
|
||||
{
|
||||
boundary_.setSize(nPatchFaces.size());
|
||||
patchTypes_.setSize(nPatchFaces.size());
|
||||
patchNames_.setSize(nPatchFaces.size());
|
||||
|
||||
// size the lists and reset the counters to be used again
|
||||
forAll(boundary_, patchLabel)
|
||||
{
|
||||
boundary_[patchLabel].setSize(nPatchFaces[patchLabel]);
|
||||
|
||||
nPatchFaces[patchLabel] = 0;
|
||||
}
|
||||
|
||||
IFstream boundaryFile(boundaryFileName);
|
||||
|
||||
for (label facei=0; facei<nFaces; facei++)
|
||||
{
|
||||
boundaryFile >> lineIndex;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
boundaryFile >> sammLabel;
|
||||
|
||||
// convert Samm label to Foam point label
|
||||
// through lookup-list starPointLabelLookup_
|
||||
pointLabels[i] = starPointLabelLookup_[sammLabel];
|
||||
|
||||
if (pointLabels[i] < 0)
|
||||
{
|
||||
Info<< "Boundary file not consistent with vertex file\n"
|
||||
<< "Samm vertex number " << sammLabel
|
||||
<< " does not exist\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boundaryFile >> sammRegion;
|
||||
label patchLabel = patchLabels[sammRegion];
|
||||
|
||||
boundaryFile >> configNumber;
|
||||
boundaryFile >> patchType;
|
||||
|
||||
if // Triangle
|
||||
(
|
||||
pointLabels[2] == pointLabels[3]
|
||||
)
|
||||
{
|
||||
//Info<< "Converting collapsed quad into triangle"
|
||||
// << " for face " << facei
|
||||
// << " in Samm boundary " << lineIndex << endl;
|
||||
|
||||
pointLabelsTri[0] = pointLabels[0];
|
||||
pointLabelsTri[1] = pointLabels[1];
|
||||
pointLabelsTri[2] = pointLabels[2];
|
||||
|
||||
boundary_[patchLabel][nPatchFaces[patchLabel]]
|
||||
= face(pointLabelsTri);
|
||||
}
|
||||
else
|
||||
{
|
||||
boundary_[patchLabel][nPatchFaces[patchLabel]]
|
||||
= face(pointLabels);
|
||||
}
|
||||
|
||||
// increment counter of faces in current patch
|
||||
nPatchFaces[patchLabel]++;
|
||||
}
|
||||
|
||||
forAll(boundary_, patchLabel)
|
||||
{
|
||||
word patchType = patchTypes_[patchLabel];
|
||||
|
||||
if (patchType == "SYMP")
|
||||
{
|
||||
patchTypes_[patchLabel] = symmetryPolyPatch::typeName;
|
||||
}
|
||||
else if (patchType == "WALL")
|
||||
{
|
||||
patchTypes_[patchLabel] = wallPolyPatch::typeName;
|
||||
}
|
||||
else if (patchType == "CYCL")
|
||||
{
|
||||
// incorrect. should be cyclicPatch but this
|
||||
// requires info on connected faces.
|
||||
patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchTypes_[patchLabel] = polyPatch::typeName;
|
||||
}
|
||||
|
||||
Info<< "Foam patch " << patchLabel
|
||||
<< " is of type " << patchTypes_[patchLabel]
|
||||
<< " with name " << patchNames_[patchLabel] << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No boundary faces in file "
|
||||
<< boundaryFileName
|
||||
<< endl;
|
||||
}
|
||||
|
||||
patchPhysicalTypes_.setSize(patchTypes_.size());
|
||||
|
||||
PtrList<dictionary> patchDicts;
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime_,
|
||||
runTime_.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
patchNames_,
|
||||
patchDicts,
|
||||
defaultFacesName_,
|
||||
defaultFacesType_
|
||||
);
|
||||
|
||||
forAll(patchDicts, patchi)
|
||||
{
|
||||
if (patchDicts.set(patchi))
|
||||
{
|
||||
const dictionary& dict = patchDicts[patchi];
|
||||
dict.readIfPresent("type", patchTypes_[patchi]);
|
||||
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchi]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,319 +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
|
||||
Create intermediate mesh from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::addRegularCell
|
||||
(
|
||||
const labelList& labels,
|
||||
const label nCreatedCells
|
||||
)
|
||||
{
|
||||
// Momory management
|
||||
static labelList labelsHex(8);
|
||||
static labelList labelsWedge(7);
|
||||
static labelList labelsPrism(6);
|
||||
static labelList labelsPyramid(5);
|
||||
static labelList labelsTet(4);
|
||||
static labelList labelsTetWedge(5);
|
||||
|
||||
if // Tetrahedron
|
||||
(
|
||||
labels[2] == labels[3]
|
||||
&& labels[4] == labels[5]
|
||||
&& labels[5] == labels[6]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
labelsTet[0] = labels[0];
|
||||
labelsTet[1] = labels[1];
|
||||
labelsTet[2] = labels[2];
|
||||
labelsTet[3] = labels[4];
|
||||
cellShapes_[nCreatedCells] = cellShape(*tetPtr_, labelsTet);
|
||||
}
|
||||
|
||||
else if // Square-based pyramid
|
||||
(
|
||||
labels[4] == labels[5]
|
||||
&& labels[5] == labels[6]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
labelsPyramid[0] = labels[0];
|
||||
labelsPyramid[1] = labels[1];
|
||||
labelsPyramid[2] = labels[2];
|
||||
labelsPyramid[3] = labels[3];
|
||||
labelsPyramid[4] = labels[4];
|
||||
cellShapes_[nCreatedCells] = cellShape(*pyrPtr_, labelsPyramid);
|
||||
}
|
||||
|
||||
else if // Tet Wedge
|
||||
(
|
||||
labels[2] == labels[3]
|
||||
&& labels[4] == labels[5]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
labelsTetWedge[0] = labels[0];
|
||||
labelsTetWedge[1] = labels[1];
|
||||
labelsTetWedge[2] = labels[2];
|
||||
labelsTetWedge[3] = labels[4];
|
||||
labelsTetWedge[4] = labels[6];
|
||||
cellShapes_[nCreatedCells] = cellShape(*tetWedgePtr_, labelsTetWedge);
|
||||
}
|
||||
|
||||
else if // Triangular prism
|
||||
(
|
||||
labels[2] == labels[3]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
labelsPrism[0] = labels[0];
|
||||
labelsPrism[1] = labels[1];
|
||||
labelsPrism[2] = labels[2];
|
||||
labelsPrism[3] = labels[4];
|
||||
labelsPrism[4] = labels[5];
|
||||
labelsPrism[5] = labels[6];
|
||||
cellShapes_[nCreatedCells] = cellShape(*prismPtr_, labelsPrism);
|
||||
}
|
||||
|
||||
else if // Wedge
|
||||
(
|
||||
labels[4] == labels[7]
|
||||
)
|
||||
{
|
||||
labelsWedge[0] = labels[7];
|
||||
labelsWedge[1] = labels[6];
|
||||
labelsWedge[2] = labels[5];
|
||||
labelsWedge[3] = labels[3];
|
||||
labelsWedge[4] = labels[2];
|
||||
labelsWedge[5] = labels[1];
|
||||
labelsWedge[6] = labels[0];
|
||||
cellShapes_[nCreatedCells] = cellShape(*wedgePtr_, labelsWedge);
|
||||
}
|
||||
|
||||
else // Hex
|
||||
{
|
||||
labelsHex[0] = labels[0];
|
||||
labelsHex[1] = labels[1];
|
||||
labelsHex[2] = labels[2];
|
||||
labelsHex[3] = labels[3];
|
||||
labelsHex[4] = labels[4];
|
||||
labelsHex[5] = labels[5];
|
||||
labelsHex[6] = labels[6];
|
||||
labelsHex[7] = labels[7];
|
||||
cellShapes_[nCreatedCells] = cellShape(*hexPtr_, labelsHex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::sammMesh::addSAMMcell
|
||||
(
|
||||
const label typeFlag,
|
||||
const labelList& globalLabels,
|
||||
const label nCreatedCells
|
||||
)
|
||||
{
|
||||
|
||||
// grab the shape from the table
|
||||
if (!sammShapeLookup[typeFlag] || !sammAddressingTable[typeFlag])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "SAMM type " << typeFlag << " has no registered label. BUG!"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const cellModel& curModel = *(sammShapeLookup[typeFlag]);
|
||||
|
||||
// get reference to the addressing list
|
||||
const label* addressing = sammAddressingTable[typeFlag];
|
||||
|
||||
// make a list of labels
|
||||
labelList sammCellLabels(curModel.nPoints(), -1);
|
||||
|
||||
forAll(sammCellLabels, labelI)
|
||||
{
|
||||
sammCellLabels[labelI] = globalLabels[addressing[labelI]];
|
||||
}
|
||||
|
||||
cellShapes_[nCreatedCells] = cellShape(curModel, sammCellLabels);
|
||||
}
|
||||
|
||||
|
||||
void Foam::sammMesh::readCells()
|
||||
{
|
||||
label nCells = 0;
|
||||
label maxLabel = -1;
|
||||
|
||||
fileName cellsFileName(casePrefix_ + ".cel");
|
||||
|
||||
{
|
||||
IFstream cellsFile(cellsFileName);
|
||||
|
||||
if (cellsFile.good())
|
||||
{
|
||||
label lineLabel, cellLabel = -1, pointLabel, regionLabel, typeFlag;
|
||||
|
||||
maxLabel = -1;
|
||||
while (!(cellsFile >> lineLabel).eof())
|
||||
{
|
||||
maxLabel = max(maxLabel, lineLabel);
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
cellsFile >> pointLabel;
|
||||
}
|
||||
|
||||
cellsFile >> regionLabel;
|
||||
cellsFile >> typeFlag;
|
||||
|
||||
if (lineLabel != cellLabel)
|
||||
{
|
||||
cellLabel = lineLabel;
|
||||
nCells++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file "
|
||||
<< cellsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Number of cells = " << nCells << endl << endl;
|
||||
|
||||
cellShapes_.setSize(nCells);
|
||||
|
||||
starCellLabelLookup_.setSize(maxLabel+1);
|
||||
|
||||
// reset point labels to invalid value
|
||||
forAll(starCellLabelLookup_, i)
|
||||
{
|
||||
starCellLabelLookup_[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
if (nCells > 0)
|
||||
{
|
||||
IFstream cellsFile(cellsFileName);
|
||||
|
||||
labelList labels(24, label(-1));
|
||||
label lineLabel, sammLabel, regionLabel, typeFlag;
|
||||
|
||||
for (label celli = 0; celli < nCells; celli++)
|
||||
{
|
||||
label nLabels = 0;
|
||||
|
||||
bool addOnToCell = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (nLabels > 24)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown SAMM cell. "
|
||||
<< "More than 24 vertices"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if ((cellsFile >> lineLabel).eof())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Reached end of cells file before "
|
||||
<< "all cells are read in."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// prepare for possible continuation
|
||||
nLabels += 8;
|
||||
|
||||
for (int i=nLabels-8; i<nLabels; i++)
|
||||
{
|
||||
cellsFile >> sammLabel;
|
||||
|
||||
if (sammLabel != 0)
|
||||
{
|
||||
// Convert Samm vertex number to point label
|
||||
labels[i] = starPointLabelLookup_[sammLabel];
|
||||
|
||||
if (labels[i] < 0)
|
||||
{
|
||||
Info<< "Cell file not consistent with vertex file. "
|
||||
<< "Samm vertex number " << sammLabel
|
||||
<< " does not exist\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
labels[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
cellsFile >> regionLabel;
|
||||
cellsFile >> typeFlag;
|
||||
|
||||
// check for continuation line
|
||||
if (!addOnToCell && typeFlag == 255)
|
||||
{
|
||||
addOnToCell = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
addOnToCell = false;
|
||||
}
|
||||
|
||||
} while (typeFlag == -1 || addOnToCell);
|
||||
|
||||
starCellLabelLookup_[lineLabel] = celli;
|
||||
|
||||
if (nLabels == 8)
|
||||
{
|
||||
addRegularCell(labels, celli);
|
||||
}
|
||||
else
|
||||
{
|
||||
addSAMMcell(typeFlag, labels, celli);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No cells in file "
|
||||
<< cellsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,177 +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
|
||||
Create intermediate mesh from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::readCouples()
|
||||
{
|
||||
fileName couplesFileName(casePrefix_ + ".cpl");
|
||||
|
||||
IFstream couplesFile(couplesFileName);
|
||||
|
||||
if (couplesFile.good())
|
||||
{
|
||||
Info<< "\nReading couples" << endl;
|
||||
|
||||
// A mesh with couples cannot be a shape mesh
|
||||
isShapeMesh_ = false;
|
||||
|
||||
label matchLabel, nEntries, typeFlag;
|
||||
label masterCell, masterFace;
|
||||
label slaveCell, slaveFace;
|
||||
|
||||
while (!(couplesFile >> matchLabel).eof())
|
||||
{
|
||||
// read number of entries and match type.
|
||||
// Note. At the moment, only integral matches are supported
|
||||
couplesFile >> nEntries;
|
||||
|
||||
couplesFile >> typeFlag;
|
||||
|
||||
if (typeFlag > 1)
|
||||
{
|
||||
Info
|
||||
<< "void sammMesh::readCouples() : "
|
||||
<< "couple " << matchLabel << " is not an integral match. "
|
||||
<< "Currently not supported" << endl;
|
||||
}
|
||||
|
||||
// read master cell and face
|
||||
couplesFile >> masterCell >> masterFace;
|
||||
|
||||
// get reference to master cell faces
|
||||
faceList& masterFaces = cellFaces_[masterCell - 1];
|
||||
|
||||
// Info<< "Master cell: " << masterCell - 1 << " index: "
|
||||
// << cellShapes_[masterCell - 1].model().index()
|
||||
// << " face: " <<
|
||||
// masterFaces
|
||||
// [
|
||||
// shapeFaceLookup
|
||||
// [cellShapes_[masterCell - 1].model().index()]
|
||||
// [masterFace]
|
||||
// ]
|
||||
// << endl;
|
||||
|
||||
// reset master face to zero size. It cannot be removed at this
|
||||
// stage because thisw would mess up the numbering in case of
|
||||
// more than one couple an a single master cell
|
||||
masterFaces
|
||||
[
|
||||
shapeFaceLookup
|
||||
[cellShapes_[masterCell - 1].model().index()]
|
||||
[masterFace]
|
||||
].setSize(0);
|
||||
|
||||
// number of slave faces
|
||||
label nSlavesToRead = nEntries - 1;
|
||||
|
||||
// get index for slave face add
|
||||
label slaveToAdd = masterFaces.size();
|
||||
|
||||
// reset size of master faces to accept new (couple) faces
|
||||
masterFaces.setSize(masterFaces.size() + nSlavesToRead);
|
||||
|
||||
for (int i = 0; i < nSlavesToRead; i++)
|
||||
{
|
||||
couplesFile >> slaveCell >> slaveFace;
|
||||
|
||||
masterFaces[slaveToAdd] =
|
||||
cellFaces_
|
||||
[
|
||||
slaveCell - 1
|
||||
]
|
||||
[
|
||||
shapeFaceLookup
|
||||
[cellShapes_[slaveCell - 1].model().index()]
|
||||
[slaveFace]
|
||||
].reverseFace();
|
||||
|
||||
// Info<< " slave cell: " << slaveCell - 1 << " index: "
|
||||
// << cellShapes_[slaveCell - 1].model().index()
|
||||
// << " face: " << masterFaces[slaveToAdd] << endl;
|
||||
|
||||
slaveToAdd++;
|
||||
|
||||
}
|
||||
// Info<< endl;
|
||||
|
||||
}
|
||||
|
||||
// Once all couples are read, remove zero size faces from all cells
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
label zeroSizeFound = 0;
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
if (curFaces[facei].empty())
|
||||
{
|
||||
zeroSizeFound++;
|
||||
}
|
||||
}
|
||||
|
||||
if (zeroSizeFound > 0)
|
||||
{
|
||||
// compress the list. A copy needs to made first
|
||||
faceList oldFaces = curFaces;
|
||||
|
||||
curFaces.setSize(curFaces.size() - zeroSizeFound);
|
||||
|
||||
label nFaces = 0;
|
||||
|
||||
forAll(oldFaces, facei)
|
||||
{
|
||||
if (oldFaces[facei].size())
|
||||
{
|
||||
curFaces[nFaces] = oldFaces[facei];
|
||||
|
||||
nFaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info
|
||||
<< "void sammMesh::readCouples() : "
|
||||
<< "Cannot read file "
|
||||
<< couplesFileName
|
||||
<< ". No matches defined."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,34 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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
|
||||
Create intermediate mesh from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define starMesh sammMesh
|
||||
#include "../star3ToFoam/readPoints.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,220 +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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// Cell shape models
|
||||
const Foam::cellModel* Foam::sammMesh::unknownPtr_ =
|
||||
Foam::cellModeller::lookup("unknown");
|
||||
const Foam::cellModel* Foam::sammMesh::hexPtr_ =
|
||||
Foam::cellModeller::lookup("hex");
|
||||
const Foam::cellModel* Foam::sammMesh::wedgePtr_ =
|
||||
Foam::cellModeller::lookup("wedge");
|
||||
const Foam::cellModel* Foam::sammMesh::prismPtr_ =
|
||||
Foam::cellModeller::lookup("prism");
|
||||
const Foam::cellModel* Foam::sammMesh::pyrPtr_ =
|
||||
Foam::cellModeller::lookup("pyr");
|
||||
const Foam::cellModel* Foam::sammMesh::tetPtr_ =
|
||||
Foam::cellModeller::lookup("tet");
|
||||
const Foam::cellModel* Foam::sammMesh::tetWedgePtr_ =
|
||||
Foam::cellModeller::lookup("tetWedge");
|
||||
|
||||
const Foam::cellModel* Foam::sammMesh::sammTrim1Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim1");
|
||||
const Foam::cellModel* Foam::sammMesh::sammTrim2Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim2");
|
||||
const Foam::cellModel* Foam::sammMesh::sammTrim3Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim3");
|
||||
const Foam::cellModel* Foam::sammMesh::sammTrim4Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim4");
|
||||
const Foam::cellModel* Foam::sammMesh::sammTrim5Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim5");
|
||||
const Foam::cellModel* Foam::sammMesh::sammTrim8Ptr_ =
|
||||
Foam::cellModeller::lookup("hexagonalPrism");
|
||||
|
||||
// lookup table giving OpenFOAM face number when looked up with shape index
|
||||
// (first index) and STAR face number
|
||||
// - first column is always -1
|
||||
// - last column is -1 for all but hexagonal prism
|
||||
// WARNING: Possible bug for sammTrim2
|
||||
// There is a possibility that the lookup table for SAMM shapes is based on
|
||||
// the rotation of the shape. This would imply that the table below would need
|
||||
// to be split between the regular shapes (3-9), which are OK, and the SAMM
|
||||
// shapes, for which the face lookup needs to be done based on the rotation.
|
||||
// However, at the moment I haven't got enough info to complete the toble and
|
||||
// there are no cases that break it. Please reconsider in the light of mode
|
||||
// information.
|
||||
const Foam::label Foam::sammMesh::shapeFaceLookup[19][9] =
|
||||
{
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 0 - empty+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 1 - empty+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 2 - empty+
|
||||
{-1, 4, 5, 2, 3, 0, 1, -1, -1}, // shape 3 - hex+
|
||||
{-1, 4, 5, 2, 3, 0, 1, -1, -1}, // shape 4 - wedge+
|
||||
{-1, 0, 1, 4, -1, 2, 3, -1, -1}, // shape 5 - prism+
|
||||
{-1, 0, -1, 4, 2, 1, 3, -1, -1}, // shape 6 - pyr+
|
||||
{-1, 3, -1, 2, -1, 1, 0, -1, -1}, // shape 7 - tet+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 8 - splitHex (empty)
|
||||
{-1, 0, -1, 1, -1, 2, 3, -1, -1}, // shape 9 - tetWedge+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 10 - empty+
|
||||
{-1, 5, 4, 0, 1, 2, 3, 6, -1}, // shape 11 - sammTrim1+
|
||||
// {-1, 1, 0, 2, 3, 4, 5, 6, -1}, // shape 12 - sammTrim2 ?
|
||||
{-1, 1, 0, 2, 4, 3, 5, 6, -1}, // shape 12 - sammTrim2 f(4)=4
|
||||
{-1, 5, 4, 0, 1, 2, 3, 6, -1}, // shape 13 - sammTrim3+
|
||||
{-1, 5, 4, 1, 0, 3, 2, 6, -1}, // shape 14 - sammTrim4
|
||||
{-1, 4, 3, 2, 5, 1, 0, -1, -1}, // shape 15 - sammTrim5
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 16 - empty
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 17 - empty
|
||||
{-1, 0, 1, 2, 5, 3, 6, 4, 7} // shape 18 - sammTrim8
|
||||
};
|
||||
|
||||
// SAMM cell lookup data
|
||||
|
||||
// List of pointers used instead of pointer list o avoid
|
||||
// de-allocation problems
|
||||
Foam::List<const Foam::cellModel*> Foam::sammMesh::sammShapeLookup
|
||||
(
|
||||
256,
|
||||
reinterpret_cast<cellModel*>(0)
|
||||
);
|
||||
|
||||
Foam::List<const Foam::label*> Foam::sammMesh::sammAddressingTable
|
||||
(
|
||||
256,
|
||||
reinterpret_cast<label*>(0)
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::createPolyMeshData()
|
||||
{
|
||||
Info<< "Creating a polyMesh" << endl;
|
||||
|
||||
createPolyCells();
|
||||
|
||||
Info<< "\nNumber of internal faces: "
|
||||
<< nInternalFaces_ << endl;
|
||||
|
||||
createPolyBoundary();
|
||||
|
||||
label nProblemCells = 0;
|
||||
|
||||
// check that there is no zeros in the cellPolys_
|
||||
forAll(cellPolys_, celli)
|
||||
{
|
||||
const labelList& curFaceLabels = cellPolys_[celli];
|
||||
|
||||
forAll(curFaceLabels, facei)
|
||||
{
|
||||
if (curFaceLabels[facei] == -1)
|
||||
{
|
||||
Info<< "cell " << celli
|
||||
<< " has got an unmatched face. "
|
||||
<< "Index: " << cellShapes_[celli].model().index() << endl
|
||||
// << "cell shape: " << cellShapes_[celli] << endl
|
||||
// << "shape faces: " << cellShapes_[celli].faces() << endl
|
||||
<< "cellPolys: " << cellPolys_[celli] << endl
|
||||
// << "cell faces: " << cellFaces_[celli]
|
||||
<< endl;
|
||||
|
||||
nProblemCells++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nProblemCells > 0)
|
||||
{
|
||||
Info<< "Number of problem cells: " << nProblemCells << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sammMesh::sammMesh
|
||||
(
|
||||
const fileName& prefix,
|
||||
const Time& rt,
|
||||
const scalar scaleFactor
|
||||
)
|
||||
:
|
||||
casePrefix_(prefix),
|
||||
runTime_(rt),
|
||||
points_(0),
|
||||
cellShapes_(0),
|
||||
boundary_(0),
|
||||
patchTypes_(0),
|
||||
defaultFacesName_("defaultFaces"),
|
||||
defaultFacesType_(emptyPolyPatch::typeName),
|
||||
patchNames_(0),
|
||||
patchPhysicalTypes_(0),
|
||||
starPointLabelLookup_(0),
|
||||
starCellLabelLookup_(0),
|
||||
cellFaces_(0),
|
||||
meshFaces_(0),
|
||||
cellPolys_(0),
|
||||
nInternalFaces_(0),
|
||||
polyBoundaryPatchStartIndices_(0),
|
||||
pointCellsPtr_(nullptr),
|
||||
isShapeMesh_(true)
|
||||
{
|
||||
// Fill in the lookup tables
|
||||
fillSammCellShapeTable();
|
||||
fillSammAddressingTable();
|
||||
|
||||
readPoints(scaleFactor);
|
||||
|
||||
readCells();
|
||||
|
||||
readBoundary();
|
||||
|
||||
fixCollapsedEdges();
|
||||
|
||||
readCouples();
|
||||
|
||||
// create boundary faces
|
||||
createBoundaryFaces();
|
||||
|
||||
// after all this is done do couples
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sammMesh::~sammMesh()
|
||||
{
|
||||
deleteDemandDrivenData(pointCellsPtr_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,253 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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::sammMesh
|
||||
|
||||
Description
|
||||
A messy mesh class which supports the possibility of creating a shapeMesh
|
||||
for regular Samm meshes (no arbitrary interfaces or collapsed SAMM cells).
|
||||
If any of these special feateres exist, the mesh is created as polyMesh
|
||||
|
||||
SourceFiles
|
||||
sammMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef sammMesh_H
|
||||
#define sammMesh_H
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellList.H"
|
||||
#include "polyPatchList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sammMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class sammMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the case
|
||||
fileName casePrefix_;
|
||||
|
||||
//- Database
|
||||
const Time& runTime_;
|
||||
|
||||
//- Points supporting the mesh
|
||||
pointField points_;
|
||||
|
||||
//- Cell shapes
|
||||
cellShapeList cellShapes_;
|
||||
|
||||
//- Boundary faces
|
||||
faceListList boundary_;
|
||||
|
||||
//- Boundary patch types
|
||||
wordList patchTypes_;
|
||||
|
||||
//- Default boundary patch name
|
||||
word defaultFacesName_;
|
||||
|
||||
//- Default boundary patch types
|
||||
word defaultFacesType_;
|
||||
|
||||
//- Boundary patch names
|
||||
wordList patchNames_;
|
||||
|
||||
//- Boundary patch physical types
|
||||
wordList patchPhysicalTypes_;
|
||||
|
||||
//- Point labels (SAMM point numbering is not necessarily contiguous)
|
||||
labelList starPointLabelLookup_;
|
||||
|
||||
//- Point labels (SAMM point numbering is not necessarily contiguous)
|
||||
labelList starCellLabelLookup_;
|
||||
|
||||
//- List of faces for every cell
|
||||
faceListList cellFaces_;
|
||||
|
||||
//- Global face list for polyMesh
|
||||
faceList meshFaces_;
|
||||
|
||||
//- Cells as polyhedra for polyMesh
|
||||
cellList cellPolys_;
|
||||
|
||||
//- Number of internal faces for polyMesh
|
||||
label nInternalFaces_;
|
||||
|
||||
//- Polyhedral mesh boundary patch start indices
|
||||
labelList polyBoundaryPatchStartIndices_;
|
||||
|
||||
//- Point-cell addressing. Used for topological analysis
|
||||
// Warning. This point cell addressing list potentially contains
|
||||
// duplicate cell entries. Use additional checking
|
||||
mutable labelListList* pointCellsPtr_;
|
||||
|
||||
//- Can the mesh be treated as a shapeMesh?
|
||||
bool isShapeMesh_;
|
||||
|
||||
// Private static data members
|
||||
|
||||
//- Pointers to cell models
|
||||
static const cellModel* unknownPtr_;
|
||||
static const cellModel* hexPtr_;
|
||||
static const cellModel* wedgePtr_;
|
||||
static const cellModel* prismPtr_;
|
||||
static const cellModel* pyrPtr_;
|
||||
static const cellModel* tetPtr_;
|
||||
static const cellModel* tetWedgePtr_;
|
||||
|
||||
static const cellModel* sammTrim1Ptr_;
|
||||
static const cellModel* sammTrim2Ptr_;
|
||||
static const cellModel* sammTrim3Ptr_;
|
||||
static const cellModel* sammTrim4Ptr_;
|
||||
static const cellModel* sammTrim5Ptr_;
|
||||
static const cellModel* sammTrim8Ptr_;
|
||||
|
||||
static const label shapeFaceLookup[19][9];
|
||||
|
||||
|
||||
//- SAMM addressing data
|
||||
static List<const cellModel*> sammShapeLookup;
|
||||
static List<const label*> sammAddressingTable;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
sammMesh(const sammMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const sammMesh&);
|
||||
|
||||
|
||||
//- Fill SAMM lookup tables
|
||||
void fillSammCellShapeTable();
|
||||
void fillSammAddressingTable();
|
||||
|
||||
|
||||
//- Read the points file
|
||||
void readPoints(const scalar scaleFactor);
|
||||
|
||||
|
||||
//- Read the cells file
|
||||
void readCells();
|
||||
|
||||
void addRegularCell
|
||||
(
|
||||
const labelList& labels,
|
||||
const label nCreatedCells
|
||||
);
|
||||
|
||||
void addSAMMcell
|
||||
(
|
||||
const label typeFlag,
|
||||
const labelList& globalLabels,
|
||||
const label nCreatedCells
|
||||
);
|
||||
|
||||
|
||||
//- Read the boundary file
|
||||
void readBoundary();
|
||||
|
||||
|
||||
//- Check and correct collapsed edges on faces
|
||||
// Note. If a collapsed edge is found, the mesh is no longer shapeMesh
|
||||
void fixCollapsedEdges();
|
||||
|
||||
//- Read couples
|
||||
void readCouples();
|
||||
|
||||
//- Calculate pointCells
|
||||
void calcPointCells() const;
|
||||
|
||||
const labelListList& pointCells() const;
|
||||
|
||||
//- Create boundary faces from the quads
|
||||
void createBoundaryFaces();
|
||||
|
||||
//- Specialist version of face comparison to deal with
|
||||
// PROSTAR boundary format idiosyncracies
|
||||
bool sammEqualFace
|
||||
(
|
||||
const face& boundaryFace,
|
||||
const face& cellFace
|
||||
) const;
|
||||
|
||||
//- Purge cell shapes
|
||||
void purgeCellShapes();
|
||||
|
||||
//- Make polyhedral cells and global faces if the mesh is polyhedral
|
||||
void createPolyCells();
|
||||
|
||||
//- Make polyhedral boundary from shape boundary
|
||||
// (adds more faces to the face list)
|
||||
void createPolyBoundary();
|
||||
|
||||
//- Make polyhedral mesh data (packing)
|
||||
void createPolyMeshData();
|
||||
|
||||
//- Add polyhedral boundary
|
||||
List<polyPatch* > polyBoundaryPatches(const polyMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from case name
|
||||
sammMesh
|
||||
(
|
||||
const fileName& prefix,
|
||||
const Time& rt,
|
||||
const scalar scaleFactor
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~sammMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Write mesh
|
||||
void writeMesh();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,79 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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/>.
|
||||
|
||||
Application
|
||||
sammToFoam
|
||||
|
||||
Group
|
||||
grpMeshConversionUtilities
|
||||
|
||||
Description
|
||||
Converts a Star-CD (v3) SAMM mesh to OpenFOAM format.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "sammMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
argList::validArgs.append("SAMM mesh file prefix");
|
||||
argList::addOption
|
||||
(
|
||||
"scale",
|
||||
"factor",
|
||||
"geometry scaling factor - default is 1"
|
||||
);
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
if (!args.check())
|
||||
{
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
sammMesh makeMesh(args[1], runTime, scaleFactor);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||
|
||||
Info<< "Writing mesh" << endl;
|
||||
makeMesh.writeMesh();
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1 +0,0 @@
|
||||
#include "sammMesh.H"
|
||||
@ -1,91 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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
|
||||
Create intermediate mesh files from SAMM files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "sammMesh.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sammMesh::writeMesh()
|
||||
{
|
||||
if (isShapeMesh_)
|
||||
{
|
||||
Info<< "This is a shapeMesh." << endl;
|
||||
|
||||
polyMesh pShapeMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
cellShapes_,
|
||||
boundary_,
|
||||
patchNames_,
|
||||
patchTypes_,
|
||||
defaultFacesName_,
|
||||
defaultFacesType_,
|
||||
patchPhysicalTypes_
|
||||
);
|
||||
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
pShapeMesh.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a polyMesh.
|
||||
|
||||
createPolyMeshData();
|
||||
|
||||
Info<< "This is a polyMesh" << endl;
|
||||
|
||||
polyMesh pMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
xferCopy(meshFaces_),
|
||||
xferCopy(cellPolys_)
|
||||
);
|
||||
|
||||
pMesh.addPatches(polyBoundaryPatches(pMesh));
|
||||
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
pMesh.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,19 +0,0 @@
|
||||
coupledFacePair.C
|
||||
starMesh.C
|
||||
readPoints.C
|
||||
/*readSeparatedPoints.C*/
|
||||
readCells.C
|
||||
readBoundary.C
|
||||
fixCollapsedEdges.C
|
||||
readCouples.C
|
||||
createCoupleMatches.C
|
||||
mergeCoupleFacePoints.C
|
||||
calcPointCells.C
|
||||
createPolyCells.C
|
||||
createBoundaryFaces.C
|
||||
createPolyBoundary.C
|
||||
purgeCellShapes.C
|
||||
writeMesh.C
|
||||
star3ToFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/star3ToFoam
|
||||
@ -1,7 +0,0 @@
|
||||
EXE_INC = \
|
||||
/* -DDEBUG_MERGE */ \
|
||||
/* -DDEBUG_COUPLE */ \
|
||||
/* -DDEBUG_COUPLE_INTERSECTION */ \
|
||||
/* -DDEBUG_RIGHT_HAND_WALK */ \
|
||||
/* -DDEBUG_FACE_ORDERING */ \
|
||||
/* -DDEBUG_COUPLE_PROJECTION */
|
||||
@ -1,139 +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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::calcPointCells() const
|
||||
{
|
||||
static const label UNIT_POINT_CELLS = 12;
|
||||
|
||||
if (pointCellsPtr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "pointCells already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
pointCellsPtr_ = new labelListList(points_.size());
|
||||
|
||||
labelListList& pc = *pointCellsPtr_;
|
||||
|
||||
forAll(pc, i)
|
||||
{
|
||||
pc[i].setSize(UNIT_POINT_CELLS);
|
||||
}
|
||||
|
||||
// Initialise the list of labels which will hold the count the
|
||||
// actual number of cells per point during the analysis
|
||||
labelList cellCount(points_.size());
|
||||
|
||||
forAll(cellCount, i)
|
||||
{
|
||||
cellCount[i] = 0;
|
||||
}
|
||||
|
||||
// Note. Unlike the standard point-cell algorithm, which asks the cell for
|
||||
// the supporting point labels, we need to work based on the cell faces.
|
||||
// This is because some of the faces for meshes with arbitrary interfaces
|
||||
// do not come from the cell shape, but from the slaves of the coupled
|
||||
// match. It is also adventageous to remove the duplicates from the
|
||||
// point-cell addressing, because this removes a lot of waste later.
|
||||
//
|
||||
|
||||
// For each cell
|
||||
forAll(cellShapes_, celli)
|
||||
{
|
||||
const faceList& faces = cellFaces_[celli];
|
||||
|
||||
forAll(faces, i)
|
||||
{
|
||||
// For each vertex
|
||||
const labelList& labels = faces[i];
|
||||
|
||||
forAll(labels, j)
|
||||
{
|
||||
// Set working point label
|
||||
label curPoint = labels[j];
|
||||
labelList& curPointCells = pc[curPoint];
|
||||
label curCount = cellCount[curPoint];
|
||||
|
||||
// check if the cell has been added before
|
||||
bool found = false;
|
||||
|
||||
for (label f = 0; f < curCount; f++)
|
||||
{
|
||||
if (curPointCells[f] == celli)
|
||||
{
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
||||
// If the list of pointCells is not big enough, double it
|
||||
if (curPointCells.size() <= curCount)
|
||||
{
|
||||
curPointCells.setSize(curPointCells.size()*2);
|
||||
}
|
||||
|
||||
// Enter the cell label in the point's cell list
|
||||
curPointCells[curCount] = celli;
|
||||
|
||||
// Increment the cell count for the point addressed
|
||||
cellCount[curPoint]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, truncate the lists made to their active size
|
||||
forAll(pc, i)
|
||||
{
|
||||
pc[i].setSize(cellCount[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::starMesh::pointCells() const
|
||||
{
|
||||
if (!pointCellsPtr_)
|
||||
{
|
||||
calcPointCells();
|
||||
}
|
||||
|
||||
return *pointCellsPtr_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,66 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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
|
||||
Data associated with a pair of coupled faces.
|
||||
1 represents integral match; all other number are arbitrary matches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coupledFacePair.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coupledFacePair::coupledFacePair
|
||||
(
|
||||
const label coupleNo,
|
||||
const label mC, const label mF,
|
||||
const label sC, const label sF,
|
||||
const label integral
|
||||
)
|
||||
:
|
||||
coupleID_(coupleNo),
|
||||
masterCellID_(mC),
|
||||
masterFaceID_(mF),
|
||||
slaveCellID_(sC),
|
||||
slaveFaceID_(sF),
|
||||
integralMatch_(integral == 1)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const coupledFacePair& c)
|
||||
{
|
||||
os << "Master cell: " << c.masterCellID_
|
||||
<< " face: " << c.masterFaceID_ << endl
|
||||
<< "Slave cell: " << c.slaveCellID_
|
||||
<< " face: " << c.slaveFaceID_ << endl
|
||||
<< "Integral: " << c.integralMatch_ << endl;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,146 +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::coupledFacePair
|
||||
|
||||
Description
|
||||
Data associated with a pair of coupled faces
|
||||
|
||||
SourceFiles
|
||||
coupledFacePair.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coupledFacePair_H
|
||||
#define coupledFacePair_H
|
||||
|
||||
#include "label.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class coupledFacePair;
|
||||
|
||||
Ostream& operator<<(Ostream&, const coupledFacePair&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class coupledFacePair Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class coupledFacePair
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- STAR couple ID
|
||||
label coupleID_;
|
||||
|
||||
//- Master cell (lower cell label)
|
||||
label masterCellID_;
|
||||
|
||||
//- Master face (lower cell label)
|
||||
label masterFaceID_;
|
||||
|
||||
//- Slave cell (higher cell label)
|
||||
label slaveCellID_;
|
||||
|
||||
//- Slave face (higher cell label)
|
||||
label slaveFaceID_;
|
||||
|
||||
//- Integral or arbitrary flag
|
||||
bool integralMatch_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
coupledFacePair
|
||||
(
|
||||
const label coupleNo, // STAR couple ID
|
||||
const label mC, const label mF, // master cell and face
|
||||
const label sC, const label sF, // slave cell and face
|
||||
const label integral
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return STAR couple ID
|
||||
label coupleID() const
|
||||
{
|
||||
return coupleID_;
|
||||
}
|
||||
|
||||
//- Return master cell
|
||||
label masterCell() const
|
||||
{
|
||||
return masterCellID_;
|
||||
}
|
||||
|
||||
//- Return master face
|
||||
label masterFace() const
|
||||
{
|
||||
return masterFaceID_;
|
||||
}
|
||||
|
||||
//- Return slave cell
|
||||
label slaveCell() const
|
||||
{
|
||||
return slaveCellID_;
|
||||
}
|
||||
|
||||
//- Return slave face
|
||||
label slaveFace() const
|
||||
{
|
||||
return slaveFaceID_;
|
||||
}
|
||||
|
||||
//- Is this an integral match?
|
||||
bool integralMatch() const
|
||||
{
|
||||
return integralMatch_;
|
||||
}
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const coupledFacePair&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,201 +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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Specialist version of face comparison to deal with
|
||||
// PROSTAR boundary format idiosyncracies
|
||||
bool Foam::starMesh::starEqualFace
|
||||
(
|
||||
const face& boundaryFace,
|
||||
const face& cellFace
|
||||
) const
|
||||
{
|
||||
// A PROSTAR boundary face is defined by 4 vertices irrespective
|
||||
// of its topology.
|
||||
// In order to deal with all possibilities, cell face is
|
||||
// considered equal if three of the vertices are the same.
|
||||
bool cellFaceHappy = false;
|
||||
|
||||
label nEqual = 0;
|
||||
|
||||
forAll(cellFace, cellFaceLabelI)
|
||||
{
|
||||
const label curCellFaceLabel = cellFace[cellFaceLabelI];
|
||||
|
||||
forAll(boundaryFace, bouFaceLabelI)
|
||||
{
|
||||
if (boundaryFace[bouFaceLabelI] == curCellFaceLabel)
|
||||
{
|
||||
nEqual++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nEqual >= 3)
|
||||
{
|
||||
cellFaceHappy = true;
|
||||
}
|
||||
|
||||
// Boundary face is happy if all of its vertices are recognised
|
||||
bool boundaryFaceHappy = true;
|
||||
|
||||
forAll(boundaryFace, bouFaceLabelI)
|
||||
{
|
||||
const label curBouFaceLabel = boundaryFace[bouFaceLabelI];
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll(cellFace, cellFaceLabelI)
|
||||
{
|
||||
if (curBouFaceLabel == cellFace[cellFaceLabelI])
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boundaryFaceHappy = boundaryFaceHappy && found;
|
||||
}
|
||||
|
||||
return (cellFaceHappy && boundaryFaceHappy);
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::markBoundaryFaces()
|
||||
{
|
||||
// set size of mark lists for the boundary
|
||||
boundaryCellIDs_.setSize(boundary_.size());
|
||||
boundaryCellFaceIDs_.setSize(boundary_.size());
|
||||
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
const faceList& patchFaces = boundary_[patchi];
|
||||
|
||||
// set size of patch lists
|
||||
labelList& curBoundaryCellIDs = boundaryCellIDs_[patchi];
|
||||
labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchi];
|
||||
|
||||
curBoundaryCellIDs.setSize(patchFaces.size());
|
||||
curBoundaryCellFaceIDs.setSize(patchFaces.size());
|
||||
|
||||
const labelListList& PointCells = pointCells();
|
||||
|
||||
forAll(patchFaces, facei)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
const face& curFace = patchFaces[facei];
|
||||
const labelList& facePoints = curFace;
|
||||
|
||||
forAll(facePoints, pointi)
|
||||
{
|
||||
const labelList& facePointCells =
|
||||
PointCells[facePoints[pointi]];
|
||||
|
||||
forAll(facePointCells, celli)
|
||||
{
|
||||
const label curCellIndex = facePointCells[celli];
|
||||
|
||||
const faceList& curCellFaces =
|
||||
cellFaces_[curCellIndex];
|
||||
|
||||
forAll(curCellFaces, cellFacei)
|
||||
{
|
||||
if (starEqualFace(curFace, curCellFaces[cellFacei]))
|
||||
{
|
||||
// Found the cell face corresponding to this face
|
||||
found = true;
|
||||
|
||||
// Set boundary face to the corresponding cell face
|
||||
curBoundaryCellIDs[facei] = curCellIndex;
|
||||
curBoundaryCellFaceIDs[facei] = cellFacei;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face " << facei
|
||||
<< " does not have neighbour cell."
|
||||
<< " Face : " << endl << curFace << endl
|
||||
<< "PROSTAR Command: vset,news,vlis";
|
||||
|
||||
forAll(curFace, spI)
|
||||
{
|
||||
if (curFace[spI] > -1 && curFace[spI] < starPointID_.size())
|
||||
{
|
||||
Info<< "," << starPointID_[curFace[spI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ",???";
|
||||
}
|
||||
}
|
||||
|
||||
FatalError
|
||||
<< " $ bset,add,vset,all"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::collectBoundaryFaces()
|
||||
{
|
||||
Info<< "Collecting boundary faces" << endl;
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
faceList& patchFaces = boundary_[patchi];
|
||||
|
||||
// set size of patch lists
|
||||
const labelList& curBoundaryCellIDs = boundaryCellIDs_[patchi];
|
||||
const labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchi];
|
||||
|
||||
forAll(curBoundaryCellIDs, facei)
|
||||
{
|
||||
patchFaces[facei] =
|
||||
cellFaces_[curBoundaryCellIDs[facei]]
|
||||
[curBoundaryCellFaceIDs[facei]];
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Finished collecting boundary faces" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,315 +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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "polyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::createPolyBoundary()
|
||||
{
|
||||
label nBoundaryFacesFound = 0;
|
||||
|
||||
polyBoundaryPatchStartIndices_.setSize(boundary_.size());
|
||||
|
||||
label nCreatedFaces = nInternalFaces_;
|
||||
|
||||
const labelListList& PointCells = pointCells();
|
||||
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
const faceList& curShapePatch = boundary_[patchi];
|
||||
|
||||
polyBoundaryPatchStartIndices_[patchi] = nCreatedFaces;
|
||||
|
||||
forAll(curShapePatch, facei)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
const face& curFace = curShapePatch[facei];
|
||||
|
||||
meshFaces_[nCreatedFaces] = curFace;
|
||||
|
||||
// Must find which cell this face belongs to in order to
|
||||
// mark it in the cellPolys_
|
||||
const labelList& facePoints = curFace;
|
||||
|
||||
forAll(facePoints, pointi)
|
||||
{
|
||||
const labelList& facePointCells =
|
||||
PointCells[facePoints[pointi]];
|
||||
|
||||
forAll(facePointCells, celli)
|
||||
{
|
||||
const faceList& curCellFaces =
|
||||
cellFaces_[facePointCells[celli]];
|
||||
|
||||
forAll(curCellFaces, cellFacei)
|
||||
{
|
||||
if (curCellFaces[cellFacei] == curFace)
|
||||
{
|
||||
// Found the cell face corresponding to this face
|
||||
found = true;
|
||||
|
||||
// Debugging
|
||||
if
|
||||
(
|
||||
cellPolys_[facePointCells[celli]][cellFacei]
|
||||
!= -1
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
cellPolys_[facePointCells[celli]][cellFacei]
|
||||
> nInternalFaces_
|
||||
)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Problem with face: " << curFace
|
||||
<< "\nProbably multiple definitions "
|
||||
<< "of a single boundary face. " << endl
|
||||
<< "Other boundary face: "
|
||||
<< curCellFaces[cellFacei]
|
||||
<< endl;
|
||||
|
||||
Info<< "PROSTAR Command: vset,news,vlis";
|
||||
forAll(curCellFaces[cellFacei], spI)
|
||||
{
|
||||
// check if the point is given by STAR
|
||||
// or created locally
|
||||
if
|
||||
(
|
||||
curCellFaces[cellFacei][spI] > -1
|
||||
&& curCellFaces[cellFacei][spI]
|
||||
< starPointID_.size()
|
||||
)
|
||||
{
|
||||
Info<< ","
|
||||
<< starPointID_
|
||||
[curCellFaces[cellFacei][spI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ",???";
|
||||
}
|
||||
}
|
||||
Info<< " $ bset,add,vset,all" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Problem with face: " << curFace
|
||||
<< "\nProbably trying to define a "
|
||||
<< "boundary face on a previously "
|
||||
<< "matched internal face. " << endl
|
||||
<< "Internal face: "
|
||||
<< curCellFaces[cellFacei]
|
||||
<< endl;
|
||||
|
||||
Info<< "PROSTAR Command: vset,news,vlis";
|
||||
forAll(curCellFaces[cellFacei], spI)
|
||||
{
|
||||
// check if the point is given by STAR
|
||||
// or created locally
|
||||
if
|
||||
(
|
||||
curCellFaces[cellFacei][spI] > -1
|
||||
&& curCellFaces[cellFacei][spI]
|
||||
< starPointID_.size()
|
||||
)
|
||||
{
|
||||
Info<< ","
|
||||
<< starPointID_
|
||||
[curCellFaces[cellFacei][spI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ",???";
|
||||
}
|
||||
}
|
||||
Info<< " $ bset,add,vset,all" << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
cellPolys_[facePointCells[celli]][cellFacei] =
|
||||
nCreatedFaces;
|
||||
|
||||
nBoundaryFacesFound++;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
|
||||
nCreatedFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// check all cellPolys_ to see if there are any missing faces
|
||||
label nMissingFaceFound = 0;
|
||||
|
||||
forAll(cellPolys_, celli)
|
||||
{
|
||||
const labelList& curFaces = cellPolys_[celli];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
if (curFaces[facei] < 0)
|
||||
{
|
||||
const face& missingFace = cellFaces_[celli][facei];
|
||||
|
||||
InfoInFunction
|
||||
<< "Missing face found in cell " << celli
|
||||
<< ".\nType: " << cellShapes_[celli].model().name()
|
||||
<< ". STAR cell number: " << starCellID_[celli]
|
||||
<< ". Face: " << missingFace << endl;
|
||||
|
||||
nMissingFaceFound++;
|
||||
|
||||
Info<< "PROSTAR Command: vset,news,vlis";
|
||||
forAll(missingFace, spI)
|
||||
{
|
||||
// check if the point is given by STAR or created locally
|
||||
if
|
||||
(
|
||||
missingFace[spI] > -1
|
||||
&& missingFace[spI] < starPointID_.size()
|
||||
)
|
||||
{
|
||||
Info<< "," << starPointID_[missingFace[spI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ",???";
|
||||
}
|
||||
}
|
||||
Info<< " $ bset,add,vset,all" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nMissingFaceFound > 0)
|
||||
{
|
||||
Info<< "Number of unmatched faces: " << nMissingFaceFound << endl;
|
||||
}
|
||||
|
||||
// reset the size of the face list
|
||||
meshFaces_.setSize(nCreatedFaces);
|
||||
|
||||
// check the mesh for face mismatch
|
||||
// (faces addressed once or more than twice)
|
||||
labelList markupFaces(meshFaces_.size(), 0);
|
||||
|
||||
forAll(cellPolys_, celli)
|
||||
{
|
||||
const labelList& curFaces = cellPolys_[celli];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
markupFaces[curFaces[facei]]++;
|
||||
}
|
||||
}
|
||||
|
||||
for (label i = nInternalFaces_; i < markupFaces.size(); i++)
|
||||
{
|
||||
markupFaces[i]++;
|
||||
}
|
||||
|
||||
label nProblemFacesFound = 0;
|
||||
|
||||
forAll(markupFaces, facei)
|
||||
{
|
||||
if (markupFaces[facei] != 2)
|
||||
{
|
||||
const face& problemFace = meshFaces_[facei];
|
||||
|
||||
InfoInFunction
|
||||
<< "Problem with face " << facei << ": addressed "
|
||||
<< markupFaces[facei] << " times (should be 2!). Face: "
|
||||
<< problemFace << endl;
|
||||
|
||||
nProblemFacesFound++;
|
||||
|
||||
Info<< "PROSTAR Command: vset,news,vlis";
|
||||
forAll(problemFace, spI)
|
||||
{
|
||||
// check if the point is given by STAR or created locally
|
||||
if
|
||||
(
|
||||
problemFace[spI] > -1
|
||||
&& problemFace[spI] < starPointID_.size()
|
||||
)
|
||||
{
|
||||
Info<< "," << starPointID_[problemFace[spI]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ",???";
|
||||
}
|
||||
}
|
||||
Info<< " $ bset,add,vset,all" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (nProblemFacesFound > 0)
|
||||
{
|
||||
Info<< "Number of incorrectly matched faces: "
|
||||
<< nProblemFacesFound << endl;
|
||||
}
|
||||
|
||||
Info<< "Number of boundary faces: " << nBoundaryFacesFound << endl;
|
||||
Info<< "Total number of faces: " << nCreatedFaces << endl;
|
||||
}
|
||||
|
||||
|
||||
Foam::List<Foam::polyPatch*>
|
||||
Foam::starMesh::polyBoundaryPatches(const polyMesh& pMesh)
|
||||
{
|
||||
List<polyPatch*> p(boundary_.size());
|
||||
|
||||
forAll(boundary_, patchi)
|
||||
{
|
||||
p[patchi] = polyPatch::New
|
||||
(
|
||||
patchTypes_[patchi],
|
||||
patchNames_[patchi],
|
||||
boundary_[patchi].size(),
|
||||
polyBoundaryPatchStartIndices_[patchi],
|
||||
patchi,
|
||||
pMesh.boundaryMesh()
|
||||
).ptr();
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,188 +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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::createPolyCells()
|
||||
{
|
||||
// loop through all cell faces and create connectivity. This will produce
|
||||
// a global face list and will describe all cells as lists of face labels
|
||||
|
||||
// count the maximum number of faces and set the size of the cellPolys_
|
||||
cellPolys_.setSize(cellShapes_.size());
|
||||
|
||||
label maxFaces = 0;
|
||||
|
||||
forAll(cellPolys_, celli)
|
||||
{
|
||||
cell& curCell = cellPolys_[celli];
|
||||
|
||||
curCell.setSize(cellFaces_[celli].size());
|
||||
|
||||
forAll(curCell, fI)
|
||||
{
|
||||
curCell[fI] = -1;
|
||||
}
|
||||
|
||||
maxFaces += cellFaces_[celli].size();
|
||||
}
|
||||
|
||||
Info<< "Maximum possible number of faces in mesh: " << maxFaces << endl;
|
||||
|
||||
meshFaces_.setSize(maxFaces);
|
||||
|
||||
// set reference to point-cell addressing
|
||||
const labelListList& PointCells = pointCells();
|
||||
|
||||
bool found = false;
|
||||
|
||||
nInternalFaces_ = 0;
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
// Note:
|
||||
// Insertion cannot be done in one go as the faces need to be
|
||||
// added into the list in the increasing order of neighbour
|
||||
// cells. Therefore, all neighbours will be detected first
|
||||
// and then added in the correct order.
|
||||
|
||||
const faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
// Record the neighbour cell
|
||||
labelList neiCells(curFaces.size(), -1);
|
||||
|
||||
// Record the face of neighbour cell
|
||||
labelList faceOfNeiCell(curFaces.size(), -1);
|
||||
|
||||
label nNeighbours = 0;
|
||||
|
||||
// For all faces ...
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
// Skip faces that have already been matched
|
||||
if (cellPolys_[celli][facei] >= 0) continue;
|
||||
|
||||
found = false;
|
||||
|
||||
const face& curFace = curFaces[facei];
|
||||
|
||||
// get the list of labels
|
||||
const labelList& curPoints = curFace;
|
||||
|
||||
// For all points
|
||||
forAll(curPoints, pointi)
|
||||
{
|
||||
// get the list of cells sharing this point
|
||||
const labelList& curNeighbours = PointCells[curPoints[pointi]];
|
||||
|
||||
// For all neighbours
|
||||
forAll(curNeighbours, neiI)
|
||||
{
|
||||
label curNei = curNeighbours[neiI];
|
||||
|
||||
// reject neighbours with the lower label. This should
|
||||
// also reject current cell.
|
||||
if (curNei > celli)
|
||||
{
|
||||
// get the list of search faces
|
||||
const faceList& searchFaces = cellFaces_[curNei];
|
||||
|
||||
forAll(searchFaces, neiFacei)
|
||||
{
|
||||
if (searchFaces[neiFacei] == curFace)
|
||||
{
|
||||
// match!!
|
||||
found = true;
|
||||
|
||||
// Record the neighbour cell and face
|
||||
neiCells[facei] = curNei;
|
||||
faceOfNeiCell[facei] = neiFacei;
|
||||
nNeighbours++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
if (found) break;
|
||||
} // End of current points
|
||||
} // End of current faces
|
||||
|
||||
// Add the faces in the increasing order of neighbours
|
||||
for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
|
||||
{
|
||||
// Find the lowest neighbour which is still valid
|
||||
label nextNei = -1;
|
||||
label minNei = cellPolys_.size();
|
||||
|
||||
forAll(neiCells, ncI)
|
||||
{
|
||||
if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
|
||||
{
|
||||
nextNei = ncI;
|
||||
minNei = neiCells[ncI];
|
||||
}
|
||||
}
|
||||
|
||||
if (nextNei > -1)
|
||||
{
|
||||
// Add the face to the list of faces
|
||||
meshFaces_[nInternalFaces_] = curFaces[nextNei];
|
||||
|
||||
// Mark for owner
|
||||
cellPolys_[celli][nextNei] = nInternalFaces_;
|
||||
|
||||
// Mark for neighbour
|
||||
cellPolys_[neiCells[nextNei]][faceOfNeiCell[nextNei]] =
|
||||
nInternalFaces_;
|
||||
|
||||
// Stop the neighbour from being used again
|
||||
neiCells[nextNei] = -1;
|
||||
|
||||
// Increment number of faces counter
|
||||
nInternalFaces_++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error in internal face insertion"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// I won't reset the size of internal faces, because more faces will be
|
||||
// added in createPolyBoundary()
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,148 +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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::fixCollapsedEdges()
|
||||
{
|
||||
cellFaces_.setSize(cellShapes_.size());
|
||||
|
||||
forAll(cellShapes_, celli)
|
||||
{
|
||||
cellFaces_[celli] = cellShapes_[celli].faces();
|
||||
}
|
||||
|
||||
// go through the faces and find if there exist faces with duplicate
|
||||
// vertices. If so, purge the duplicates and mark the mesh as a polyMesh
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
face& vertexLabels = curFaces[facei];
|
||||
|
||||
bool duplicatesFound = false;
|
||||
|
||||
forAll(vertexLabels, vI)
|
||||
{
|
||||
label curLabel = vertexLabels[vI];
|
||||
|
||||
label nFound = 0;
|
||||
|
||||
forAll(vertexLabels, searchI)
|
||||
{
|
||||
if (vertexLabels[searchI] == curLabel)
|
||||
{
|
||||
nFound++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nFound > 1)
|
||||
{
|
||||
duplicatesFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (duplicatesFound)
|
||||
{
|
||||
// this mesh cannot be described as a shapeMesh
|
||||
isShapeMesh_ = false;
|
||||
|
||||
// I am not allowed to reset the shape pointer to unknown
|
||||
// here as the shape is still needed to determine which face
|
||||
// of the shape is used in potential couple matches. This
|
||||
// will be done in the end using the purgeShapes()
|
||||
//
|
||||
|
||||
// create a new face without duplicates and replace original
|
||||
face newFace(vertexLabels.size());
|
||||
label nNewVertices = 0;
|
||||
|
||||
forAll(vertexLabels, vI)
|
||||
{
|
||||
// In order for a face to be a valid entity, duplicate
|
||||
// vertices can only be consecutive (othervise, the
|
||||
// collapse creates an invalid face). We shall use this
|
||||
// property in the creation of the collapsed face
|
||||
|
||||
label curLabel = vertexLabels[vI];
|
||||
|
||||
bool found = false;
|
||||
|
||||
// search through all vertices from the new face. If the
|
||||
// current label has not been added, add it to the end.
|
||||
for (label searchI = 0; searchI < nNewVertices; searchI++)
|
||||
{
|
||||
if (newFace[searchI] == curLabel)
|
||||
{
|
||||
found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
newFace[nNewVertices] = curLabel;
|
||||
nNewVertices++;
|
||||
}
|
||||
}
|
||||
|
||||
newFace.setSize(nNewVertices);
|
||||
|
||||
// If the number of non-duplicate labels in the face is less
|
||||
// than three, the face has been collapsed in an invalid
|
||||
// manner. Error.
|
||||
|
||||
if (nNewVertices < 3)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face " << facei << " of cell " << celli
|
||||
<< " is colapsed down to a point or edge, which is "
|
||||
<< "not permitted" << endl
|
||||
<< "original face: " << vertexLabels << endl
|
||||
<< "purged face: " << newFace << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
vertexLabels = newFace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,423 +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
|
||||
Merge duplicate points created by arbitrary face coupling and remove unused
|
||||
points.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::mergeCoupleFacePoints()
|
||||
{
|
||||
// mark all used points by looping through all faces in two goes.
|
||||
// First, go into every cell and find min edge length. Use a
|
||||
// fraction of that as a merge tolerance. Loop through all the
|
||||
// points of the cell and query a merge against every other point
|
||||
// of the same cell based on the current tolerance. If two points
|
||||
// merge, find out if any of them already belongs to a "merge set"
|
||||
// (group of points that merge together. If so, add the current
|
||||
// points into the merge set and make sure that the merge label
|
||||
// for the whole set is the lowest of all encountered vertices.
|
||||
// This is stored in a mergeSetID list, under the index of the
|
||||
// merge set. Once all cells (and thus points) are visited, go
|
||||
// through the renumbering list and for each merging point use the
|
||||
// label of the merge set as the new point label.
|
||||
// This is VERY fancy. Use care if/when changing.
|
||||
|
||||
Info<< endl << "Creating merge sets" << endl;
|
||||
|
||||
// Create a renumbering list for points
|
||||
// In the first instance the renumbering list is used as a
|
||||
// mergeSetID storage
|
||||
labelList renumberPoints(points_.size(), -1);
|
||||
|
||||
// create storage of mergeSetIDs
|
||||
label mergeIncrement = points_.size()/10;
|
||||
labelList mergeSetID(mergeIncrement, -1);
|
||||
|
||||
label nMergeSets = 0;
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
const faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
// create a list of all points for the cell with duplicates
|
||||
// and find the shortest edge length
|
||||
|
||||
label nPointsInCell = 0;
|
||||
|
||||
scalar pointMergeTol = GREAT;
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
nPointsInCell += curFaces[facei].size();
|
||||
|
||||
edgeList curEdges = curFaces[facei].edges();
|
||||
|
||||
forAll(curEdges, edgeI)
|
||||
{
|
||||
scalar length = curEdges[edgeI].mag(points_);
|
||||
|
||||
if (length < pointMergeTol)
|
||||
{
|
||||
pointMergeTol = length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set merge tolerance as a fraction of the shortest edge
|
||||
pointMergeTol /= 100.0;
|
||||
|
||||
// create a list of points
|
||||
labelList cellPoints(nPointsInCell);
|
||||
label nAddedPoints = 0;
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
const face& f = curFaces[facei];
|
||||
|
||||
forAll(f, fI)
|
||||
{
|
||||
cellPoints[nAddedPoints] = f[fI];
|
||||
nAddedPoints++;
|
||||
}
|
||||
}
|
||||
|
||||
// loop n-squared through the local points and merge them up
|
||||
for (label firstPI = 0; firstPI < cellPoints.size() - 1; firstPI++)
|
||||
{
|
||||
for
|
||||
(
|
||||
label otherPI = firstPI;
|
||||
otherPI < cellPoints.size();
|
||||
otherPI++
|
||||
)
|
||||
{
|
||||
if (cellPoints[firstPI] != cellPoints[otherPI])
|
||||
{
|
||||
label a = cellPoints[firstPI];
|
||||
label b = cellPoints[otherPI];
|
||||
|
||||
if (edge (a, b).mag(points_) < pointMergeTol)
|
||||
{
|
||||
// found a pair of points to merge
|
||||
#ifdef DEBUG_MERGE
|
||||
Info<< "Merging points " << a << " and " << b << endl;
|
||||
#endif
|
||||
|
||||
// are the two points in a merge group?
|
||||
label mergeSetA = -1;
|
||||
label mergeSetB = -1;
|
||||
|
||||
if (renumberPoints[a] > -1)
|
||||
{
|
||||
mergeSetA = renumberPoints[a];
|
||||
}
|
||||
|
||||
if (renumberPoints[b] > -1)
|
||||
{
|
||||
mergeSetB = renumberPoints[b];
|
||||
}
|
||||
|
||||
if (mergeSetA == -1 && mergeSetB == -1)
|
||||
{
|
||||
// add new merge group
|
||||
#ifdef DEBUG_MERGE
|
||||
Info<< "adding new merge group " << nMergeSets
|
||||
<< endl;
|
||||
#endif
|
||||
|
||||
// mark points as belonging to a new merge set
|
||||
renumberPoints[a] = nMergeSets;
|
||||
renumberPoints[b] = nMergeSets;
|
||||
|
||||
mergeSetID[nMergeSets] = min(a, b);
|
||||
nMergeSets++;
|
||||
|
||||
if (nMergeSets >= mergeSetID.size())
|
||||
{
|
||||
Info<< "Resizing mergeSetID" << endl;
|
||||
|
||||
mergeSetID.setSize
|
||||
(mergeSetID.size() + mergeIncrement);
|
||||
}
|
||||
}
|
||||
else if (mergeSetA == -1 && mergeSetB != -1)
|
||||
{
|
||||
#ifdef DEBUG_MERGE
|
||||
Info<< "adding point a into the merge set of b. "
|
||||
<< "a: " << a << endl;
|
||||
#endif
|
||||
|
||||
// add point a into the merge set of b
|
||||
renumberPoints[a] = mergeSetB;
|
||||
|
||||
// reset the min label of the mergeSet
|
||||
mergeSetID[mergeSetB] =
|
||||
min(a, mergeSetID[mergeSetB]);
|
||||
}
|
||||
else if (mergeSetA != -1 && mergeSetB == -1)
|
||||
{
|
||||
#ifdef DEBUG_MERGE
|
||||
Info<< "adding point b into the merge set of a. "
|
||||
<< "b: " << b << endl;
|
||||
#endif
|
||||
|
||||
// add point b into the merge set of a
|
||||
renumberPoints[b] = mergeSetA;
|
||||
|
||||
// reset the min label of the mergeSet
|
||||
mergeSetID[mergeSetA] =
|
||||
min(b, mergeSetID[mergeSetA]);
|
||||
}
|
||||
else if (mergeSetA != mergeSetB)
|
||||
{
|
||||
// Points already belong to two different merge
|
||||
// sets. Eliminate the higher merge set
|
||||
label minMerge = min(mergeSetA, mergeSetB);
|
||||
label maxMerge = max(mergeSetA, mergeSetB);
|
||||
|
||||
#ifdef DEBUG_MERGE
|
||||
Info<< "Points already belong to two "
|
||||
<< "different merge sets. "
|
||||
<< "Eliminate the higher merge set. Sets: "
|
||||
<< minMerge << " and " << maxMerge << endl;
|
||||
#endif
|
||||
|
||||
forAll(renumberPoints, elimI)
|
||||
{
|
||||
if (renumberPoints[elimI] == maxMerge)
|
||||
{
|
||||
renumberPoints[elimI] = minMerge;
|
||||
}
|
||||
}
|
||||
|
||||
// set the lower label
|
||||
mergeSetID[minMerge] =
|
||||
min(mergeSetID[minMerge], mergeSetID[maxMerge]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mergeSetID.setSize(nMergeSets);
|
||||
|
||||
Info<< "Finished creating merge sets. Number of merge sets: "
|
||||
<< nMergeSets << "." << endl;
|
||||
|
||||
// Insert the primary point renumbering into the list
|
||||
// Take care of possibly unused points in the list
|
||||
forAll(renumberPoints, pointi)
|
||||
{
|
||||
if (renumberPoints[pointi] < 0)
|
||||
{
|
||||
// point not merged
|
||||
renumberPoints[pointi] = pointi;
|
||||
}
|
||||
else
|
||||
{
|
||||
renumberPoints[pointi] = mergeSetID[renumberPoints[pointi]];
|
||||
}
|
||||
}
|
||||
|
||||
// Now every point carries either its own label or the lowest of
|
||||
// the labels of the points it is merged with. Now do PRELIMINARY
|
||||
// renumbering of all faces. This will only be used to see which
|
||||
// points are still used!
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
faceList& prelimFaces = cellFaces_[celli];
|
||||
|
||||
forAll(prelimFaces, facei)
|
||||
{
|
||||
face oldFacePoints = prelimFaces[facei];
|
||||
|
||||
face& prelimFacePoints = prelimFaces[facei];
|
||||
|
||||
forAll(prelimFacePoints, pointi)
|
||||
{
|
||||
if (renumberPoints[oldFacePoints[pointi]] < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error in point renumbering. Old face: "
|
||||
<< oldFacePoints << endl
|
||||
<< "prelim face: " << prelimFacePoints
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
prelimFacePoints[pointi] =
|
||||
renumberPoints[oldFacePoints[pointi]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// First step complete. Reset the renumbering list, mark all used points,
|
||||
// re-create the point list and renumber the whole lot
|
||||
renumberPoints = 0;
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
const faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
const face& curFacePoints = curFaces[facei];
|
||||
|
||||
forAll(curFacePoints, pointi)
|
||||
{
|
||||
renumberPoints[curFacePoints[pointi]]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(cellShapes_, celli)
|
||||
{
|
||||
const labelList& curLabels = cellShapes_[celli];
|
||||
|
||||
forAll(curLabels, pointi)
|
||||
{
|
||||
if (renumberPoints[curLabels[pointi]] == 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error in point merging for cell "
|
||||
<< celli << ". STAR index: " << starCellID_[celli]
|
||||
<< ". " << endl
|
||||
<< "Point index: " << curLabels[pointi] << " STAR index "
|
||||
<< starPointID_[curLabels[pointi]] << endl
|
||||
<< "Please check the geometry for the cell." << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label nUsedPoints = 0;
|
||||
|
||||
forAll(renumberPoints, pointi)
|
||||
{
|
||||
if (renumberPoints[pointi] > 0)
|
||||
{
|
||||
// This should be OK as the compressed points list will always
|
||||
// have less points that the original lists. Even if there is
|
||||
// no points removed, this will copy the list back onto itself
|
||||
//
|
||||
renumberPoints[pointi] = nUsedPoints;
|
||||
points_[nUsedPoints] = points_[pointi];
|
||||
|
||||
nUsedPoints++;
|
||||
}
|
||||
else
|
||||
{
|
||||
renumberPoints[pointi] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Total number of points: " << points_.size() << endl
|
||||
<< "Number of used points: " << nUsedPoints << endl;
|
||||
|
||||
// reset number of points which need to be sorted
|
||||
points_.setSize(nUsedPoints);
|
||||
|
||||
Info<< "Renumbering all faces" << endl;
|
||||
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
faceList& newFaces = cellFaces_[celli];
|
||||
|
||||
forAll(newFaces, facei)
|
||||
{
|
||||
face oldFacePoints = newFaces[facei];
|
||||
|
||||
face& newFacePoints = newFaces[facei];
|
||||
|
||||
forAll(newFacePoints, pointi)
|
||||
{
|
||||
if (renumberPoints[oldFacePoints[pointi]] < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error in point renumbering for point "
|
||||
<< oldFacePoints[pointi]
|
||||
<< ". Renumbering index is -1." << endl
|
||||
<< "Old face: " << oldFacePoints << endl
|
||||
<< "New face: " << newFacePoints << abort(FatalError);
|
||||
}
|
||||
|
||||
newFacePoints[pointi] = renumberPoints[oldFacePoints[pointi]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Renumbering all cell shapes" << endl;
|
||||
|
||||
forAll(cellShapes_, celli)
|
||||
{
|
||||
labelList oldLabels = cellShapes_[celli];
|
||||
|
||||
labelList& curLabels = cellShapes_[celli];
|
||||
|
||||
forAll(curLabels, pointi)
|
||||
{
|
||||
if (renumberPoints[curLabels[pointi]] < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error in point renumbering for cell "
|
||||
<< celli << ". STAR index: " << starCellID_[celli]
|
||||
<< ". " << endl
|
||||
<< "Point index: " << curLabels[pointi] << " STAR index "
|
||||
<< starPointID_[curLabels[pointi]] << " returns invalid "
|
||||
<< "renumbering index: "
|
||||
<< renumberPoints[curLabels[pointi]] << "." << endl
|
||||
<< "Old cellShape: " << oldLabels << endl
|
||||
<< "New cell shape: " << curLabels << abort(FatalError);
|
||||
}
|
||||
|
||||
curLabels[pointi] = renumberPoints[oldLabels[pointi]];
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Renumbering STAR point lookup" << endl;
|
||||
|
||||
labelList oldStarPointID = starPointID_;
|
||||
|
||||
starPointID_ = -1;
|
||||
|
||||
forAll(starPointID_, pointi)
|
||||
{
|
||||
if (renumberPoints[pointi] > -1)
|
||||
{
|
||||
starPointID_[renumberPoints[pointi]] = oldStarPointID[pointi];
|
||||
}
|
||||
}
|
||||
|
||||
// point-cell addressing has changed. Force it to be re-created
|
||||
deleteDemandDrivenData(pointCellsPtr_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,66 +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
|
||||
Purge cell shapes which have been rendered invalid by cell face collapse
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::purgeCellShapes()
|
||||
{
|
||||
forAll(cellFaces_, celli)
|
||||
{
|
||||
const faceList& curFaces = cellFaces_[celli];
|
||||
|
||||
// Get model faces
|
||||
faceList shapeFaces = cellShapes_[celli].faces();
|
||||
|
||||
forAll(shapeFaces, facei)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
forAll(curFaces, i)
|
||||
{
|
||||
if (shapeFaces[facei] == curFaces[i])
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Info<< "Purging cell shape " << celli << endl;
|
||||
cellShapes_[celli] = cellShape(*unknownPtr_, labelList(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,256 +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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "Time.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "oldCyclicPolyPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
#include "preservePatchTypes.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::readBoundary()
|
||||
{
|
||||
label nPatches=0, nFaces=0;
|
||||
labelList nPatchFaces(1000);
|
||||
|
||||
label lineIndex, starLabel;
|
||||
label starRegion, configNumber;
|
||||
|
||||
labelList pointLabels(4);
|
||||
labelList pointLabelsTri(3);
|
||||
|
||||
labelList patchLabels(1000, label(-1));
|
||||
|
||||
word patchType;
|
||||
patchTypes_.setSize(1000);
|
||||
patchNames_.setSize(1000);
|
||||
|
||||
fileName boundaryFileName(casePrefix_ + ".bnd");
|
||||
|
||||
{
|
||||
IFstream boundaryFile(boundaryFileName);
|
||||
|
||||
// Collect no. of faces (nFaces),
|
||||
// no. of patches (nPatches)
|
||||
// and for each of these patches the number of faces
|
||||
// (nPatchFaces[patchLabel])
|
||||
// and a conversion table from Star regions to (Foam) patchLabels
|
||||
|
||||
if (boundaryFile.good())
|
||||
{
|
||||
forAll(nPatchFaces, faceLabel)
|
||||
{
|
||||
nPatchFaces[faceLabel] = 0;
|
||||
}
|
||||
|
||||
while ((boundaryFile >> lineIndex).good())
|
||||
{
|
||||
nFaces++;
|
||||
|
||||
// Skip point numbers
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
boundaryFile >> starLabel;
|
||||
}
|
||||
|
||||
boundaryFile >> starRegion;
|
||||
boundaryFile >> configNumber;
|
||||
boundaryFile >> patchType;
|
||||
|
||||
// Build translation table to convert star patch to foam patch
|
||||
label patchLabel = patchLabels[starRegion];
|
||||
if (patchLabel == -1)
|
||||
{
|
||||
patchLabel = nPatches;
|
||||
patchLabels[starRegion] = patchLabel;
|
||||
patchTypes_[patchLabel] = patchType;
|
||||
patchNames_[patchLabel] = patchType + name(starRegion);
|
||||
|
||||
nPatches++;
|
||||
|
||||
Info<< "Star region " << starRegion
|
||||
<< " with type " << patchType
|
||||
<< " is now Foam patch " << patchLabel << endl;
|
||||
|
||||
}
|
||||
|
||||
nPatchFaces[patchLabel]++;
|
||||
}
|
||||
|
||||
|
||||
Info<< nl
|
||||
<< "Setting size of boundary to " << nPatches
|
||||
<< nl << endl;
|
||||
|
||||
nPatchFaces.setSize(nPatches);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file "
|
||||
<< boundaryFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (nPatches > 0)
|
||||
{
|
||||
boundary_.setSize(nPatchFaces.size());
|
||||
patchTypes_.setSize(nPatchFaces.size());
|
||||
patchNames_.setSize(nPatchFaces.size());
|
||||
|
||||
// size the lists and reset the counters to be used again
|
||||
forAll(boundary_, patchLabel)
|
||||
{
|
||||
boundary_[patchLabel].setSize(nPatchFaces[patchLabel]);
|
||||
|
||||
nPatchFaces[patchLabel] = 0;
|
||||
}
|
||||
|
||||
IFstream boundaryFile(boundaryFileName);
|
||||
|
||||
for (label facei=0; facei<nFaces; facei++)
|
||||
{
|
||||
boundaryFile >> lineIndex;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
boundaryFile >> starLabel;
|
||||
|
||||
// convert Star label to Foam point label
|
||||
// through lookup-list starPointLabelLookup_
|
||||
pointLabels[i] = starPointLabelLookup_[starLabel];
|
||||
|
||||
if (pointLabels[i] < 0)
|
||||
{
|
||||
Info<< "Boundary file not consistent with vertex file\n"
|
||||
<< "Star vertex number " << starLabel
|
||||
<< " does not exist\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boundaryFile >> starRegion;
|
||||
label patchLabel = patchLabels[starRegion];
|
||||
|
||||
boundaryFile >> configNumber;
|
||||
boundaryFile >> patchType;
|
||||
|
||||
if // Triangle
|
||||
(
|
||||
pointLabels[2] == pointLabels[3]
|
||||
)
|
||||
{
|
||||
//Info<< "Converting collapsed quad into triangle"
|
||||
// << " for face " << facei
|
||||
// << " in Star boundary " << lineIndex << endl;
|
||||
|
||||
pointLabelsTri[0] = pointLabels[0];
|
||||
pointLabelsTri[1] = pointLabels[1];
|
||||
pointLabelsTri[2] = pointLabels[2];
|
||||
|
||||
boundary_[patchLabel][nPatchFaces[patchLabel]]
|
||||
= face(pointLabelsTri);
|
||||
}
|
||||
else
|
||||
{
|
||||
boundary_[patchLabel][nPatchFaces[patchLabel]]
|
||||
= face(pointLabels);
|
||||
}
|
||||
|
||||
// increment counter of faces in current patch
|
||||
nPatchFaces[patchLabel]++;
|
||||
}
|
||||
|
||||
forAll(boundary_, patchLabel)
|
||||
{
|
||||
word patchType = patchTypes_[patchLabel];
|
||||
|
||||
if (patchType == "SYMP")
|
||||
{
|
||||
patchTypes_[patchLabel] = symmetryPolyPatch::typeName;
|
||||
}
|
||||
else if (patchType == "WALL")
|
||||
{
|
||||
patchTypes_[patchLabel] = wallPolyPatch::typeName;
|
||||
}
|
||||
else if (patchType == "CYCL")
|
||||
{
|
||||
// incorrect. should be cyclicPatch but this
|
||||
// requires info on connected faces.
|
||||
patchTypes_[patchLabel] = oldCyclicPolyPatch::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchTypes_[patchLabel] = polyPatch::typeName;
|
||||
}
|
||||
|
||||
Info<< "Foam patch " << patchLabel
|
||||
<< " is of type " << patchTypes_[patchLabel]
|
||||
<< " with name " << patchNames_[patchLabel] << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "no boundary faces in file "
|
||||
<< boundaryFileName
|
||||
<< endl;
|
||||
}
|
||||
|
||||
patchPhysicalTypes_.setSize(patchTypes_.size());
|
||||
|
||||
PtrList<dictionary> patchDicts;
|
||||
|
||||
preservePatchTypes
|
||||
(
|
||||
runTime_,
|
||||
runTime_.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
patchNames_,
|
||||
patchDicts,
|
||||
defaultFacesName_,
|
||||
defaultFacesType_
|
||||
);
|
||||
|
||||
forAll(patchDicts, patchi)
|
||||
{
|
||||
if (patchDicts.set(patchi))
|
||||
{
|
||||
const dictionary& dict = patchDicts[patchi];
|
||||
dict.readIfPresent("type", patchTypes_[patchi]);
|
||||
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchi]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,388 +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
|
||||
Create intermediate mesh from Prostar files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::addRegularCell
|
||||
(
|
||||
const labelList& labels,
|
||||
const label nCreatedCells
|
||||
)
|
||||
{
|
||||
// Momory management
|
||||
static labelList labelsHex(8);
|
||||
static labelList labelsPrism(6);
|
||||
static labelList labelsPyramid(5);
|
||||
static labelList labelsTet(4);
|
||||
static labelList labelsTetWedge(5);
|
||||
|
||||
label regularTypeFlag = -1;
|
||||
|
||||
// grab the shape from the table
|
||||
const cellModel* curModelPtr = reinterpret_cast<cellModel*>(0);
|
||||
|
||||
if // Tetrahedron
|
||||
(
|
||||
labels[2] == labels[3]
|
||||
&& labels[4] == labels[5]
|
||||
&& labels[5] == labels[6]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
regularTypeFlag = 0;
|
||||
curModelPtr = tetPtr_;
|
||||
}
|
||||
else if // Square-based pyramid
|
||||
(
|
||||
labels[4] == labels[5]
|
||||
&& labels[5] == labels[6]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
regularTypeFlag = 1;
|
||||
curModelPtr = pyrPtr_;
|
||||
}
|
||||
else if // Tet Wedge
|
||||
(
|
||||
labels[2] == labels[3]
|
||||
&& labels[4] == labels[5]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
regularTypeFlag = 2;
|
||||
curModelPtr = tetWedgePtr_;
|
||||
}
|
||||
else if // Triangular prism
|
||||
(
|
||||
labels[2] == labels[3]
|
||||
&& labels[6] == labels[7]
|
||||
)
|
||||
{
|
||||
regularTypeFlag = 3;
|
||||
curModelPtr = prismPtr_;
|
||||
}
|
||||
else if // Wedge
|
||||
(
|
||||
labels[4] == labels[7]
|
||||
)
|
||||
{
|
||||
regularTypeFlag = 4;
|
||||
curModelPtr = wedgePtr_;
|
||||
}
|
||||
else // Hex
|
||||
{
|
||||
regularTypeFlag = 5;
|
||||
curModelPtr = hexPtr_;
|
||||
}
|
||||
|
||||
labelList regularCellLabels(curModelPtr->nPoints(), -1);
|
||||
// get reference to the addressing list
|
||||
const label* addressing = regularAddressingTable[regularTypeFlag];
|
||||
|
||||
forAll(regularCellLabels, labelI)
|
||||
{
|
||||
regularCellLabels[labelI] = labels[addressing[labelI]];
|
||||
}
|
||||
|
||||
cellShapes_[nCreatedCells] = cellShape(*curModelPtr, regularCellLabels);
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::addSAMMcell
|
||||
(
|
||||
const labelList& labels,
|
||||
const label nCreatedCells
|
||||
)
|
||||
{
|
||||
// get type, reg and permutation flag
|
||||
label typeFlag = labels[21];
|
||||
// label regularityFlag = labels[22]; // Not used.
|
||||
label permutationFlag = labels[23];
|
||||
|
||||
// grab the shape from the table
|
||||
label sammTypeFlag = -1;
|
||||
const cellModel* curModelPtr = reinterpret_cast<cellModel*>(0);
|
||||
|
||||
switch (typeFlag)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sammTypeFlag = 1;
|
||||
curModelPtr = sammTrim1Ptr_;
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
sammTypeFlag = 2;
|
||||
curModelPtr = sammTrim2Ptr_;
|
||||
break;
|
||||
}
|
||||
|
||||
case 7:
|
||||
{
|
||||
if (labels[0] != -1)
|
||||
{
|
||||
sammTypeFlag = 3;
|
||||
curModelPtr = sammTrim3Ptr_;
|
||||
}
|
||||
else
|
||||
{
|
||||
sammTypeFlag = 5;
|
||||
curModelPtr = sammTrim5Ptr_;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 8:
|
||||
{
|
||||
sammTypeFlag = 4;
|
||||
curModelPtr = sammTrim4Ptr_;
|
||||
break;
|
||||
}
|
||||
|
||||
case 85:
|
||||
{
|
||||
sammTypeFlag = 8;
|
||||
curModelPtr = sammTrim8Ptr_;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "SAMM type " << sammTypeFlag << " is invalid"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// make a list of labels
|
||||
labelList sammCellLabels(curModelPtr->nPoints(), -1);
|
||||
// get reference to the addressing list
|
||||
const label* addressing = sammAddressingTable[sammTypeFlag];
|
||||
|
||||
forAll(sammCellLabels, labelI)
|
||||
{
|
||||
sammCellLabels[labelI] = labels[addressing[labelI]];
|
||||
}
|
||||
|
||||
cellShapes_[nCreatedCells] = cellShape(*curModelPtr, sammCellLabels);
|
||||
|
||||
// set permutation flag for cell
|
||||
starCellPermutation_[nCreatedCells] = permutationFlag;
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::readCells()
|
||||
{
|
||||
label nCells = 0;
|
||||
label maxLabel = -1;
|
||||
|
||||
fileName cellsFileName(casePrefix_ + ".cel");
|
||||
|
||||
{
|
||||
IFstream cellsFile(cellsFileName);
|
||||
|
||||
if (cellsFile.good())
|
||||
{
|
||||
label lineLabel, pointLabel, regionLabel, typeFlag;
|
||||
|
||||
maxLabel = -1;
|
||||
while (!(cellsFile >> lineLabel).eof())
|
||||
{
|
||||
maxLabel = max(maxLabel, lineLabel);
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
cellsFile >> pointLabel;
|
||||
}
|
||||
|
||||
cellsFile >> regionLabel;
|
||||
cellsFile >> typeFlag;
|
||||
|
||||
// lines with typeFlag of zero are continuation lines.
|
||||
if (typeFlag != 0)
|
||||
{
|
||||
nCells++;
|
||||
}
|
||||
|
||||
// backward compatibility: number of trailing rubbish in
|
||||
// STAR is unknown.
|
||||
// Fixed to cope with missing \n on last line.
|
||||
readToNl(cellsFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file " << cellsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Number of cells = " << nCells << endl << endl;
|
||||
|
||||
cellShapes_.setSize(nCells);
|
||||
starCellID_.setSize(nCells);
|
||||
starCellPermutation_.setSize(nCells);
|
||||
|
||||
// reset permutation to invalid value
|
||||
forAll(starCellPermutation_, i)
|
||||
{
|
||||
starCellPermutation_[i] = -1;
|
||||
}
|
||||
|
||||
starCellLabelLookup_.setSize(maxLabel+1);
|
||||
|
||||
// reset point labels to invalid value
|
||||
forAll(starCellLabelLookup_, i)
|
||||
{
|
||||
starCellLabelLookup_[i] = -1;
|
||||
}
|
||||
|
||||
if (nCells > 0)
|
||||
{
|
||||
IFstream cellsFile(cellsFileName);
|
||||
|
||||
labelList labels(24, label(-1));
|
||||
label lineLabel, starLabel, regionLabel, typeFlag;
|
||||
|
||||
for (label celli = 0; celli < nCells; celli++)
|
||||
{
|
||||
label nLabels = 0;
|
||||
|
||||
label addOnToCell = 0;
|
||||
|
||||
// reset the labels to -1. Debugging.
|
||||
forAll(labels, i)
|
||||
{
|
||||
labels[i] = -1;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if ((cellsFile >> lineLabel).eof())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Reached end of cells file before "
|
||||
<< "all cells are read in."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
nLabels += 8;
|
||||
|
||||
for (int i=nLabels-8; i<nLabels; i++)
|
||||
{
|
||||
cellsFile >> starLabel;
|
||||
|
||||
if (i < 21)
|
||||
{
|
||||
if (starLabel != 0)
|
||||
{
|
||||
// Convert Star vertex number to point label
|
||||
labels[i] = starPointLabelLookup_[starLabel];
|
||||
|
||||
if (labels[i] < 0)
|
||||
{
|
||||
Info<< "Cells not consistent with vertex file. "
|
||||
<< "Star vertex number " << starLabel
|
||||
<< " does not exist\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
labels[i] = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
labels[i] = starLabel;
|
||||
}
|
||||
}
|
||||
|
||||
cellsFile >> regionLabel;
|
||||
cellsFile >> typeFlag;
|
||||
|
||||
// check for continuation line
|
||||
if (typeFlag == -1)
|
||||
{
|
||||
addOnToCell = 2;
|
||||
}
|
||||
|
||||
// backward compatibility: number of trailing rubbish in
|
||||
// STAR is unknown.
|
||||
readToNl(cellsFile);
|
||||
|
||||
addOnToCell--;
|
||||
|
||||
} while (addOnToCell >= 0);
|
||||
|
||||
// Record STAR cell number (used for debugging)
|
||||
starCellID_[celli] = lineLabel;
|
||||
|
||||
// insert STAR lookup addressing
|
||||
starCellLabelLookup_[lineLabel] = celli;
|
||||
|
||||
if (nLabels == 8)
|
||||
{
|
||||
addRegularCell(labels, celli);
|
||||
}
|
||||
else
|
||||
{
|
||||
addSAMMcell(labels, celli);
|
||||
}
|
||||
|
||||
// check cell labels
|
||||
const labelList& curShapeLabels = cellShapes_[celli];
|
||||
|
||||
forAll(curShapeLabels, i)
|
||||
{
|
||||
if (curShapeLabels[i] < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Invalid vertex found in cell " << celli
|
||||
<< ". STAR cell no: " << lineLabel
|
||||
<< " labels: " << curShapeLabels
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "No cells in file " << cellsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,185 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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
|
||||
Create intermediate mesh from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::readCouples()
|
||||
{
|
||||
fileName couplesFileName(casePrefix_ + ".cpl");
|
||||
|
||||
label nCouples = 0;
|
||||
|
||||
// Count number of couples
|
||||
{
|
||||
IFstream couplesFile(couplesFileName);
|
||||
|
||||
if (couplesFile.good())
|
||||
{
|
||||
Info<< "\nReading couples" << endl;
|
||||
|
||||
label matchLabel, nEntries, typeFlag;
|
||||
label starMasterCell, rotXMasterFace;
|
||||
label starSlaveCell, rotXSlaveFace;
|
||||
|
||||
// count the number of entries to read
|
||||
while (!(couplesFile >> matchLabel).eof())
|
||||
{
|
||||
// read number of entries and match type flag.
|
||||
couplesFile >> nEntries;
|
||||
|
||||
couplesFile >> typeFlag;
|
||||
|
||||
// read master cell and face
|
||||
couplesFile >> starMasterCell >> rotXMasterFace;
|
||||
|
||||
// add number of couples from current match
|
||||
label nSlavesToRead = nEntries - 1;
|
||||
|
||||
nCouples += nSlavesToRead;
|
||||
|
||||
for (int i = 0; i < nSlavesToRead; i++)
|
||||
{
|
||||
couplesFile >> starSlaveCell >> rotXSlaveFace;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Number of couples = " << nCouples << endl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< endl << "No couple matches defined." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Read couples
|
||||
if (nCouples > 0)
|
||||
{
|
||||
// read couples
|
||||
couples_.setSize(nCouples);
|
||||
label couplei = 0;
|
||||
|
||||
// A mesh with couples cannot be a shape mesh
|
||||
isShapeMesh_ = false;
|
||||
|
||||
IFstream couplesFile(couplesFileName);
|
||||
|
||||
label matchLabel, nEntries, typeFlag;
|
||||
label starMasterCell, masterCell, rotXMasterFace, rotZeroMasterFace;
|
||||
label starSlaveCell, slaveCell, rotXSlaveFace, rotZeroSlaveFace;
|
||||
|
||||
while (!(couplesFile >> matchLabel).eof())
|
||||
{
|
||||
// read number of entries and match type flag.
|
||||
// Note. At the moment, only integral matches are supported
|
||||
couplesFile >> nEntries;
|
||||
|
||||
couplesFile >> typeFlag;
|
||||
|
||||
// read master cell and face
|
||||
couplesFile >> starMasterCell >> rotXMasterFace;
|
||||
|
||||
// translate the cell labels
|
||||
masterCell = starCellLabelLookup_[starMasterCell];
|
||||
|
||||
// translate the master face into rotation zero if applicable
|
||||
if (starCellPermutation_[masterCell] > -1)
|
||||
{
|
||||
const label curMasterPermutation =
|
||||
starCellPermutation_[masterCell];
|
||||
|
||||
rotZeroMasterFace =
|
||||
sammFacePermutationTable
|
||||
[curMasterPermutation]
|
||||
[rotXMasterFace];
|
||||
}
|
||||
else
|
||||
{
|
||||
rotZeroMasterFace = rotXMasterFace;
|
||||
}
|
||||
|
||||
// get master face index
|
||||
label masterFaceID =
|
||||
shapeFaceLookup
|
||||
[cellShapes_[masterCell].model().index()]
|
||||
[rotZeroMasterFace];
|
||||
|
||||
// number of slave faces
|
||||
label nSlavesToRead = nEntries - 1;
|
||||
|
||||
for (int i = 0; i < nSlavesToRead; i++)
|
||||
{
|
||||
couplesFile >> starSlaveCell >> rotXSlaveFace;
|
||||
|
||||
// translate the cell labels
|
||||
slaveCell = starCellLabelLookup_[starSlaveCell];
|
||||
|
||||
// translate the slave face into rotation zero if applicable
|
||||
if (starCellPermutation_[slaveCell] > -1)
|
||||
{
|
||||
const label curSlavePermutation =
|
||||
starCellPermutation_[slaveCell];
|
||||
|
||||
rotZeroSlaveFace =
|
||||
sammFacePermutationTable
|
||||
[curSlavePermutation]
|
||||
[rotXSlaveFace];
|
||||
}
|
||||
else
|
||||
{
|
||||
rotZeroSlaveFace = rotXSlaveFace;
|
||||
}
|
||||
|
||||
label slaveFaceID =
|
||||
shapeFaceLookup
|
||||
[cellShapes_[slaveCell].model().index()]
|
||||
[rotZeroSlaveFace];
|
||||
|
||||
// Set the couple
|
||||
couples_.set
|
||||
(
|
||||
couplei++,
|
||||
new coupledFacePair
|
||||
(
|
||||
matchLabel,
|
||||
masterCell, masterFaceID,
|
||||
slaveCell, slaveFaceID,
|
||||
typeFlag
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "finished reading couples" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,175 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
Create intermediate mesh from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::starMesh::readVtxLabel(IFstream& is)
|
||||
{
|
||||
char lcs[16];
|
||||
|
||||
for (int i=0; i<15; i++)
|
||||
{
|
||||
if (!is.good())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
is.get(lcs[i]);
|
||||
}
|
||||
|
||||
lcs[15] = '\0';
|
||||
|
||||
return atoi(lcs);
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::starMesh::readVtxCmpt(IFstream& is)
|
||||
{
|
||||
char lcs[17];
|
||||
|
||||
for (int i=0; i<16; i++)
|
||||
{
|
||||
is.get(lcs[i]);
|
||||
}
|
||||
|
||||
lcs[16] = '\0';
|
||||
|
||||
return scalar(atof(lcs));
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::readToNl(IFstream& is)
|
||||
{
|
||||
char c;
|
||||
do
|
||||
{
|
||||
is.get(c);
|
||||
} while (is && c != '\n');
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::readPoints(const scalar scaleFactor)
|
||||
{
|
||||
label nPoints = 0;
|
||||
label maxLabel = -1;
|
||||
|
||||
fileName pointsFileName(casePrefix_ + ".vrt");
|
||||
|
||||
{
|
||||
IFstream pointsFile(pointsFileName);
|
||||
|
||||
// Pass 1: get # points and maximum vertex label
|
||||
|
||||
if (pointsFile.good())
|
||||
{
|
||||
maxLabel = -1;
|
||||
while (pointsFile)
|
||||
{
|
||||
label pointLabel = readVtxLabel(pointsFile);
|
||||
|
||||
if (!pointsFile) break;
|
||||
|
||||
maxLabel = max(maxLabel, pointLabel);
|
||||
|
||||
readVtxCmpt(pointsFile);
|
||||
readVtxCmpt(pointsFile);
|
||||
readVtxCmpt(pointsFile);
|
||||
|
||||
readToNl(pointsFile);
|
||||
|
||||
nPoints++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file " << pointsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Number of points = " << nPoints << endl << endl;
|
||||
|
||||
points_.setSize(nPoints);
|
||||
|
||||
#ifdef starMesh_H
|
||||
starPointID_.setSize(nPoints);
|
||||
|
||||
// Reset STAR point ID, just in case
|
||||
starPointID_ = -1;
|
||||
#endif
|
||||
|
||||
starPointLabelLookup_.setSize(maxLabel+1);
|
||||
|
||||
// reset point labels to invalid value
|
||||
starPointLabelLookup_ = -1;
|
||||
|
||||
if (nPoints > 0)
|
||||
{
|
||||
// Pass 2: construct pointlist and conversion table
|
||||
// from Star vertex numbers to Foam pointLabels
|
||||
|
||||
IFstream pointsFile(pointsFileName);
|
||||
label pointLabel;
|
||||
|
||||
forAll(points_, p)
|
||||
{
|
||||
pointLabel = readVtxLabel(pointsFile);
|
||||
points_[p].x() = readVtxCmpt(pointsFile);
|
||||
points_[p].y() = readVtxCmpt(pointsFile);
|
||||
points_[p].z() = readVtxCmpt(pointsFile);
|
||||
|
||||
readToNl(pointsFile);
|
||||
|
||||
#ifdef starMesh_H
|
||||
starPointID_[p] = pointLabel;
|
||||
#endif
|
||||
|
||||
starPointLabelLookup_[pointLabel] = p;
|
||||
}
|
||||
|
||||
if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
|
||||
{
|
||||
points_ *= scaleFactor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "void starMesh::readPoints() : "
|
||||
<< "no points in file "
|
||||
<< pointsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,116 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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
|
||||
Create intermediate mesh from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::readPoints(const scalar scaleFactor)
|
||||
{
|
||||
label nPoints = 0;
|
||||
label maxLabel = -1;
|
||||
|
||||
fileName pointsFileName(casePrefix_ + ".vrt");
|
||||
|
||||
{
|
||||
IFstream pointsFile(pointsFileName);
|
||||
|
||||
// Pass 1: get # points and maximum vertex label
|
||||
|
||||
if (pointsFile.good())
|
||||
{
|
||||
label pointLabel;
|
||||
scalar x, y, z;
|
||||
|
||||
maxLabel = -1;
|
||||
while ((pointsFile >> pointLabel).good())
|
||||
{
|
||||
nPoints++;
|
||||
maxLabel = max(maxLabel, pointLabel);
|
||||
pointsFile >> x >> y >> z;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot read file " << pointsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Number of points = " << nPoints << endl << endl;
|
||||
|
||||
points_.setSize(nPoints);
|
||||
starPointID_.setSize(nPoints);
|
||||
|
||||
// Reset STAR point ID, just in case
|
||||
starPointID_ = -1;
|
||||
|
||||
starPointLabelLookup_.setSize(maxLabel+1);
|
||||
|
||||
// reset point labels to invalid value
|
||||
starPointLabelLookup_ = -1;
|
||||
|
||||
if (nPoints > 0)
|
||||
{
|
||||
// Pass 2: construct pointlist and conversion table
|
||||
// from Star vertex numbers to Foam pointLabels
|
||||
|
||||
IFstream pointsFile(pointsFileName);
|
||||
label pointLabel;
|
||||
|
||||
forAll(points_, p)
|
||||
{
|
||||
pointsFile
|
||||
>> pointLabel
|
||||
>> points_[p].x()
|
||||
>> points_[p].y()
|
||||
>> points_[p].z();
|
||||
|
||||
starPointID_[p] = pointLabel;
|
||||
starPointLabelLookup_[pointLabel] = p;
|
||||
}
|
||||
|
||||
if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
|
||||
{
|
||||
points_ *= scaleFactor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "void starMesh::readPoints() : "
|
||||
<< "no points in file "
|
||||
<< pointsFileName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,84 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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/>.
|
||||
|
||||
Application
|
||||
star3ToFoam
|
||||
|
||||
Group
|
||||
grpMeshConversionUtilities
|
||||
|
||||
Description
|
||||
Converts a Star-CD (v3) pro-STAR mesh into OpenFOAM format.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "starMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"convert pro-STAR (v3) mesh to OpenFOAM"
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::validArgs.append("pro-STAR prefix");
|
||||
argList::addOption
|
||||
(
|
||||
"scale",
|
||||
"factor",
|
||||
"geometry scaling factor - default is 1"
|
||||
);
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
if (!args.check())
|
||||
{
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
starMesh makeMesh(args[1], runTime, scaleFactor);
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||
|
||||
Info<< "Writing mesh" << endl;
|
||||
makeMesh.writeMesh();
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,295 +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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// Merge tolerances
|
||||
const Foam::scalar Foam::starMesh::smallMergeTol_ = 1e-3;
|
||||
const Foam::scalar Foam::starMesh::cpMergePointTol_ = 1e-4;
|
||||
|
||||
// Cell shape models
|
||||
const Foam::cellModel* Foam::starMesh::unknownPtr_ =
|
||||
Foam::cellModeller::lookup("unknown");
|
||||
const Foam::cellModel* Foam::starMesh::tetPtr_ =
|
||||
Foam::cellModeller::lookup("tet");
|
||||
const Foam::cellModel* Foam::starMesh::pyrPtr_ =
|
||||
Foam::cellModeller::lookup("pyr");
|
||||
const Foam::cellModel* Foam::starMesh::tetWedgePtr_ =
|
||||
Foam::cellModeller::lookup("tetWedge");
|
||||
const Foam::cellModel* Foam::starMesh::prismPtr_ =
|
||||
Foam::cellModeller::lookup("prism");
|
||||
const Foam::cellModel* Foam::starMesh::wedgePtr_ =
|
||||
Foam::cellModeller::lookup("wedge");
|
||||
const Foam::cellModel* Foam::starMesh::hexPtr_ =
|
||||
Foam::cellModeller::lookup("hex");
|
||||
|
||||
const Foam::cellModel* Foam::starMesh::sammTrim1Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim1");
|
||||
const Foam::cellModel* Foam::starMesh::sammTrim2Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim2");
|
||||
const Foam::cellModel* Foam::starMesh::sammTrim3Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim3");
|
||||
const Foam::cellModel* Foam::starMesh::sammTrim4Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim4");
|
||||
const Foam::cellModel* Foam::starMesh::sammTrim5Ptr_ =
|
||||
Foam::cellModeller::lookup("sammTrim5");
|
||||
const Foam::cellModel* Foam::starMesh::sammTrim8Ptr_ =
|
||||
Foam::cellModeller::lookup("hexagonalPrism");
|
||||
|
||||
// Regular cell point addressing
|
||||
// SAMM point addressing
|
||||
const Foam::label Foam::starMesh::regularAddressingTable[6][8] =
|
||||
{
|
||||
{ 0, 1, 2, 4, -1, -1, -1, -1}, // tet
|
||||
{ 0, 1, 2, 3, 4, -1, -1, -1}, // pyramid
|
||||
{ 0, 1, 2, 4, 6, -1, -1, -1}, // tet wedge
|
||||
{ 0, 1, 2, 4, 5, 6, -1, -1}, // prism
|
||||
{ 7, 6, 5, 3, 2, 1, 0, -1}, // wedge
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7} // hex
|
||||
};
|
||||
|
||||
|
||||
// SAMM point addressing
|
||||
const Foam::label Foam::starMesh::sammAddressingTable[9][12] =
|
||||
{
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // samm0 - empty
|
||||
{ 3, 2, 6, 7, 11, 9, 1, 5, 4, 12, -1, -1}, // samm1+
|
||||
{13, 5, 6, 2, 10, 12, 4, 7, 3, 11, -1, -1}, // samm2+
|
||||
{ 2, 3, 0, 1, 10, 11, 12, 4, 8, 9, -1, -1}, // samm3+
|
||||
{ 0, 1, 3, 4, 13, 8, 9, 10, 11, 12, -1, -1}, // samm4+
|
||||
{12, 7, 6, 5, 8, 11, 10, 9, -1, -1, -1, -1}, // samm5+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // samm6 - empty
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // samm7 - empty
|
||||
{11, 3, 15, 12, 4, 8, 10, 2, 14, 13, 5, 9} // samm8+
|
||||
};
|
||||
|
||||
|
||||
// lookup table giving OpenFOAM face number when looked up with shape index
|
||||
// (first index) and STAR face number
|
||||
// - first column is always -1
|
||||
// - last column is -1 for all but hexagonal prism
|
||||
// WARNING: Possible bug for sammTrim2
|
||||
// The lookup table for SAMM shapes is based on the rotation of the
|
||||
// shape. This would imply that the table below needs to be split between
|
||||
// the regular shapes (3-9), which are OK, and the SAMM shapes, for which
|
||||
// the face lookup needs to be done based on the rotation. Thus, for a samm
|
||||
// cell, firts find out the face index in the normal rotation using the cell
|
||||
// face permutation table and then use the index from the shape face lookup.
|
||||
// Additionally, have in mind that this silliness does not allow matches
|
||||
// on face 7 and 8 of the samm cell.
|
||||
|
||||
const Foam::label Foam::starMesh::sammFacePermutationTable[24][8] =
|
||||
{
|
||||
{-1, 1, 2, 3, 4, 5, 6, 7}, // permutation 0
|
||||
{-1, 3, 4, 5, 6, 1, 2, 7}, // permutation 1
|
||||
{-1, 5, 6, 1, 2, 3, 4, 7}, // permutation 2
|
||||
{-1, 1, 2, 5, 6, 4, 3, 7}, // permutation 3
|
||||
{-1, 3, 4, 1, 2, 6, 5, 7}, // permutation 4
|
||||
{-1, 5, 6, 3, 4, 2, 1, 7}, // permutation 5
|
||||
{-1, 1, 2, 4, 3, 6, 5, 7}, // permutation 6
|
||||
{-1, 3, 4, 6, 5, 2, 1, 7}, // permutation 7
|
||||
{-1, 5, 6, 2, 1, 4, 3, 7}, // permutation 8
|
||||
{-1, 1, 2, 6, 5, 3, 4, 7}, // permutation 9
|
||||
{-1, 3, 4, 2, 1, 5, 6, 7}, // permutation 10
|
||||
{-1, 5, 6, 4, 3, 1, 2, 7}, // permutation 11
|
||||
{-1, 2, 1, 5, 6, 3, 4, 7}, // permutation 12
|
||||
{-1, 4, 3, 1, 2, 5, 6, 7}, // permutation 13
|
||||
{-1, 6, 5, 3, 4, 1, 2, 7}, // permutation 14
|
||||
{-1, 2, 1, 3, 4, 6, 5, 7}, // permutation 15
|
||||
{-1, 4, 3, 5, 6, 2, 1, 7}, // permutation 16
|
||||
{-1, 6, 5, 1, 2, 4, 3, 7}, // permutation 17
|
||||
{-1, 2, 1, 6, 5, 4, 3, 7}, // permutation 18
|
||||
{-1, 4, 3, 2, 1, 6, 5, 7}, // permutation 19
|
||||
{-1, 6, 5, 4, 3, 2, 1, 7}, // permutation 20
|
||||
{-1, 2, 1, 4, 3, 5, 6, 7}, // permutation 21
|
||||
{-1, 4, 3, 6, 5, 1, 2, 7}, // permutation 22
|
||||
{-1, 6, 5, 2, 1, 3, 4, 7} // permutation 23
|
||||
};
|
||||
|
||||
const Foam::label Foam::starMesh::shapeFaceLookup[19][9] =
|
||||
{
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 0 - empty+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 1 - empty+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 2 - empty+
|
||||
{-1, 4, 5, 2, 3, 0, 1, -1, -1}, // shape 3 - hex+
|
||||
{-1, 1, 0, 5, 4, 2, 3, -1, -1}, // shape 4 - wedge+
|
||||
{-1, 0, 1, 4, -1, 2, 3, -1, -1}, // shape 5 - prism+
|
||||
{-1, 0, -1, 4, 2, 1, 3, -1, -1}, // shape 6 - pyr+
|
||||
{-1, 3, -1, 2, -1, 1, 0, -1, -1}, // shape 7 - tet+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 8 - splitHex (empty)
|
||||
{-1, 0, -1, 1, -1, 2, 3, -1, -1}, // shape 9 - tetWedge+
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 10 - empty+
|
||||
{-1, 1, 0, 3, 2, 5, 4, 6, -1}, // shape 11 - sammTrim1
|
||||
{-1, 5, 4, 1, 0, 3, 2, 6, -1}, // shape 12 - sammTrim2
|
||||
{-1, 2, 3, 0, 1, 4, 5, 6, -1}, // shape 13 - sammTrim3
|
||||
{-1, 2, 3, 0, 1, 4, 5, 6, -1}, // shape 14 - sammTrim4
|
||||
{-1, 5, 2, 4, 3, 1, 0, -1, -1}, // shape 15 - sammTrim5
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 16 - empty
|
||||
{-1, -1, -1, -1, -1, -1, -1, -1, -1}, // shape 17 - empty
|
||||
{-1, 1, 0, 6, 7, 2, 3, 4, 5} // shape 18 - sammTrim8
|
||||
};
|
||||
|
||||
|
||||
// The star to foam face order mapping tables are potentially incomplete
|
||||
// Currently available data is listed below.
|
||||
// 1) hex and degenerate hex: OK
|
||||
// samm trim 1:
|
||||
// star number: 1 2 3 4 5 6 7 8 In ROTATION 0
|
||||
// foam number: 5 4 1 0 3 2 6
|
||||
// confirmed: 1 0 3 2 5 4 6
|
||||
|
||||
// samm trim 2:
|
||||
// star number: 1 2 3 4 5 6 7 8 In ROTATION 0
|
||||
// foam number: 5 4 1 0 3 2 6
|
||||
// confirmed: 4 0 3 2
|
||||
|
||||
// samm trim 3:
|
||||
// star number: 1 2 3 4 5 6 7 8 In ROTATION 0
|
||||
// foam number: 2 3 0 1 4 5 6
|
||||
// confirmed:
|
||||
|
||||
// samm trim 4:
|
||||
// star number: 1 2 3 4 5 6 7 8 In ROTATION 0
|
||||
// foam number: 2 3 0 1 4 5 6
|
||||
// confirmed:
|
||||
|
||||
// samm trim 5:
|
||||
// star number: 1 2 3 4 5 6 7 8 In ROTATION 0
|
||||
// foam number: 2 4 3 1 0 5
|
||||
// confirmed: 5 2 4 3 1 0
|
||||
|
||||
// samm trim 8:
|
||||
// star number: 1 2 3 4 5 6 7 8 In ROTATION 0
|
||||
// foam number: 2 5 4 7 1 0 3 6
|
||||
// confirmed: 1 0 6
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::createPolyMeshData()
|
||||
{
|
||||
Info<< "Creating a polyMesh" << endl;
|
||||
|
||||
createPolyCells();
|
||||
|
||||
Info<< "\nNumber of internal faces: "
|
||||
<< nInternalFaces_ << endl;
|
||||
|
||||
createPolyBoundary();
|
||||
}
|
||||
|
||||
|
||||
void Foam::starMesh::clearExtraStorage()
|
||||
{
|
||||
Info<< "Clearing extra storage" << endl;
|
||||
|
||||
starPointLabelLookup_.setSize(0);
|
||||
starPointID_.setSize(0);
|
||||
starCellID_.setSize(0);
|
||||
starCellLabelLookup_.setSize(0);
|
||||
starCellPermutation_.setSize(0);
|
||||
cellFaces_.setSize(0);
|
||||
boundaryCellIDs_.setSize(0);
|
||||
boundaryCellFaceIDs_.setSize(0);
|
||||
couples_.clear();
|
||||
|
||||
deleteDemandDrivenData(pointCellsPtr_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::starMesh::starMesh
|
||||
(
|
||||
const fileName& prefix,
|
||||
const Time& rt,
|
||||
const scalar scaleFactor
|
||||
)
|
||||
:
|
||||
casePrefix_(prefix),
|
||||
runTime_(rt),
|
||||
points_(0),
|
||||
cellShapes_(0),
|
||||
boundary_(0),
|
||||
patchTypes_(0),
|
||||
defaultFacesName_("defaultFaces"),
|
||||
defaultFacesType_(emptyPolyPatch::typeName),
|
||||
patchNames_(0),
|
||||
patchPhysicalTypes_(0),
|
||||
starPointLabelLookup_(0),
|
||||
starPointID_(0),
|
||||
starCellID_(0),
|
||||
starCellLabelLookup_(0),
|
||||
starCellPermutation_(0),
|
||||
cellFaces_(0),
|
||||
boundaryCellIDs_(0),
|
||||
boundaryCellFaceIDs_(0),
|
||||
meshFaces_(0),
|
||||
cellPolys_(0),
|
||||
nInternalFaces_(0),
|
||||
polyBoundaryPatchStartIndices_(0),
|
||||
pointCellsPtr_(nullptr),
|
||||
couples_(0),
|
||||
isShapeMesh_(true)
|
||||
{
|
||||
readPoints(scaleFactor);
|
||||
|
||||
readCells();
|
||||
|
||||
readBoundary();
|
||||
|
||||
fixCollapsedEdges();
|
||||
|
||||
readCouples();
|
||||
|
||||
if (couples_.size())
|
||||
{
|
||||
createCoupleMatches();
|
||||
}
|
||||
|
||||
markBoundaryFaces();
|
||||
|
||||
mergeCoupleFacePoints();
|
||||
|
||||
purgeCellShapes();
|
||||
|
||||
collectBoundaryFaces();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::starMesh::~starMesh()
|
||||
{
|
||||
deleteDemandDrivenData(pointCellsPtr_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,318 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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::starMesh
|
||||
|
||||
Description
|
||||
A messy mesh class which supports the possibility of creating a shapeMesh
|
||||
for regular Star meshes (no arbitrary interfaces or collapsed SAMM cells).
|
||||
If any of these special feateres exist, the mesh is created as polyMesh
|
||||
|
||||
SourceFiles
|
||||
calcPointCells.C
|
||||
createBoundaryFaces.C
|
||||
createCoupleMatches.C
|
||||
createPolyBoundary.C
|
||||
createPolyCells.C
|
||||
fixCollapsedEdges.C
|
||||
mergeCoupleFacePoints.C
|
||||
readBoundary.C
|
||||
readCells.C
|
||||
readCouples.C
|
||||
readPoints.C
|
||||
starMesh.C
|
||||
writeMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef starMesh_H
|
||||
#define starMesh_H
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "cellShape.H"
|
||||
#include "cellList.H"
|
||||
#include "polyPatchList.H"
|
||||
#include "coupledFacePair.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class starMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class starMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the case
|
||||
fileName casePrefix_;
|
||||
|
||||
//- Database
|
||||
const Time& runTime_;
|
||||
|
||||
//- Points supporting the mesh
|
||||
pointField points_;
|
||||
|
||||
//- Cell shapes
|
||||
cellShapeList cellShapes_;
|
||||
|
||||
//- Boundary faces
|
||||
faceListList boundary_;
|
||||
|
||||
//- Boundary patch types
|
||||
wordList patchTypes_;
|
||||
|
||||
//- Default boundary patch name
|
||||
word defaultFacesName_;
|
||||
|
||||
//- Default boundary patch types
|
||||
word defaultFacesType_;
|
||||
|
||||
//- Boundary patch names
|
||||
wordList patchNames_;
|
||||
|
||||
//- Boundary patch physical types
|
||||
wordList patchPhysicalTypes_;
|
||||
|
||||
//- Point labels (STAR point numbering is not necessarily contiguous)
|
||||
labelList starPointLabelLookup_;
|
||||
|
||||
//- STAR point number for a given vertex
|
||||
labelList starPointID_;
|
||||
|
||||
//- STAR Cell number for a given cell
|
||||
labelList starCellID_;
|
||||
|
||||
//- Cell labels (STAR cell numbering is not necessarily contiguous)
|
||||
labelList starCellLabelLookup_;
|
||||
|
||||
//- STAR Cell permutation label
|
||||
labelList starCellPermutation_;
|
||||
|
||||
//- List of faces for every cell
|
||||
faceListList cellFaces_;
|
||||
|
||||
//- Cell ID for every boundary face. Used in two-tier boundary
|
||||
// reconstruction
|
||||
labelListList boundaryCellIDs_;
|
||||
|
||||
//- Cell face ID for every boundary face. Used in two-tier boundary
|
||||
// reconstruction
|
||||
labelListList boundaryCellFaceIDs_;
|
||||
|
||||
//- Global face list for polyMesh
|
||||
faceList meshFaces_;
|
||||
|
||||
//- Cells as polyhedra for polyMesh
|
||||
cellList cellPolys_;
|
||||
|
||||
//- Number of internal faces for polyMesh
|
||||
label nInternalFaces_;
|
||||
|
||||
//- Polyhedral mesh boundary patch start indices
|
||||
labelList polyBoundaryPatchStartIndices_;
|
||||
|
||||
//- Point-cell addressing. Used for topological analysis
|
||||
// Warning. This point cell addressing list potentially contains
|
||||
// duplicate cell entries. Use additional checking
|
||||
mutable labelListList* pointCellsPtr_;
|
||||
|
||||
//- List of face couples
|
||||
PtrList<coupledFacePair> couples_;
|
||||
|
||||
//- Can the mesh be treated as a shapeMesh?
|
||||
bool isShapeMesh_;
|
||||
|
||||
// Private static data members
|
||||
|
||||
//- Error on unity small tolerance
|
||||
static const scalar smallMergeTol_;
|
||||
|
||||
//- Couple match relative point merge tolerance
|
||||
static const scalar cpMergePointTol_;
|
||||
|
||||
//- Pointers to cell models
|
||||
static const cellModel* unknownPtr_;
|
||||
static const cellModel* tetPtr_;
|
||||
static const cellModel* pyrPtr_;
|
||||
static const cellModel* tetWedgePtr_;
|
||||
static const cellModel* prismPtr_;
|
||||
static const cellModel* wedgePtr_;
|
||||
static const cellModel* hexPtr_;
|
||||
|
||||
static const cellModel* sammTrim1Ptr_;
|
||||
static const cellModel* sammTrim2Ptr_;
|
||||
static const cellModel* sammTrim3Ptr_;
|
||||
static const cellModel* sammTrim4Ptr_;
|
||||
static const cellModel* sammTrim5Ptr_;
|
||||
static const cellModel* sammTrim8Ptr_;
|
||||
|
||||
//- Regular addressing data
|
||||
static const label regularAddressingTable[6][8];
|
||||
|
||||
//- SAMM addressing data
|
||||
static const label sammAddressingTable[9][12];
|
||||
|
||||
static const label sammFacePermutationTable[24][8];
|
||||
|
||||
static const label shapeFaceLookup[19][9];
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
starMesh(const starMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const starMesh&);
|
||||
|
||||
|
||||
//- Read fixed format vertex label
|
||||
static label readVtxLabel(IFstream&);
|
||||
|
||||
//- Read fixed format vertex coordinate component
|
||||
static scalar readVtxCmpt(IFstream&);
|
||||
|
||||
//- Read to nl
|
||||
static void readToNl(IFstream&);
|
||||
|
||||
//- Read the points file
|
||||
void readPoints(const scalar scaleFactor);
|
||||
|
||||
//- Read the cells file
|
||||
void readCells();
|
||||
|
||||
void addRegularCell
|
||||
(
|
||||
const labelList& labels,
|
||||
const label nCreatedCells
|
||||
);
|
||||
|
||||
void addSAMMcell
|
||||
(
|
||||
const labelList& labels,
|
||||
const label nCreatedCells
|
||||
);
|
||||
|
||||
//- Read the boundary file
|
||||
void readBoundary();
|
||||
|
||||
//- Check and correct collapsed edges on faces
|
||||
// Note. If a collapsed edge is found, the mesh is no longer shapeMesh
|
||||
void fixCollapsedEdges();
|
||||
|
||||
//- Read couples
|
||||
void readCouples();
|
||||
|
||||
//- Create couple matches
|
||||
void createCoupleMatches();
|
||||
|
||||
//- Calculate pointCells
|
||||
void calcPointCells() const;
|
||||
|
||||
const labelListList& pointCells() const;
|
||||
|
||||
//- Mark boundary faces from the quads
|
||||
void markBoundaryFaces();
|
||||
|
||||
//- Collect boundary faces from the quads
|
||||
void collectBoundaryFaces();
|
||||
|
||||
//- Specialist version of face comparison to deal with
|
||||
// PROSTAR boundary format idiosyncracies
|
||||
bool starEqualFace
|
||||
(
|
||||
const face& boundaryFace,
|
||||
const face& cellFace
|
||||
) const;
|
||||
|
||||
//- Merge couple face points
|
||||
void mergeCoupleFacePoints();
|
||||
|
||||
//- Point indexing structure used by sort to keep track of
|
||||
// the point labels
|
||||
struct pointIndex
|
||||
{
|
||||
label label_;
|
||||
double index_;
|
||||
};
|
||||
|
||||
//- Purge cell shapes
|
||||
void purgeCellShapes();
|
||||
|
||||
//- Make polyhedral cells and global faces if the mesh is polyhedral
|
||||
void createPolyCells();
|
||||
|
||||
//- Make polyhedral boundary from shape boundary
|
||||
// (adds more faces to the face list)
|
||||
void createPolyBoundary();
|
||||
|
||||
//- Make polyhedral mesh data (packing)
|
||||
void createPolyMeshData();
|
||||
|
||||
//- Add polyhedral boundary
|
||||
List<polyPatch*> polyBoundaryPatches(const polyMesh&);
|
||||
|
||||
//- Clear extra storage before creation of the mesh to remove
|
||||
// a memory peak
|
||||
void clearExtraStorage();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from case name
|
||||
starMesh
|
||||
(
|
||||
const fileName& prefix,
|
||||
const Time& rt,
|
||||
const scalar scaleFactor
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~starMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Write mesh
|
||||
void writeMesh();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,98 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 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
|
||||
Create intermediate mesh files from PROSTAR files
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "starMesh.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::starMesh::writeMesh()
|
||||
{
|
||||
if (isShapeMesh_)
|
||||
{
|
||||
Info<< "This is a shapeMesh." << endl;
|
||||
|
||||
Info<< "Default patch type set to empty" << endl;
|
||||
|
||||
clearExtraStorage();
|
||||
|
||||
polyMesh pShapeMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
cellShapes_,
|
||||
boundary_,
|
||||
patchNames_,
|
||||
patchTypes_,
|
||||
defaultFacesName_,
|
||||
defaultFacesType_,
|
||||
patchPhysicalTypes_
|
||||
);
|
||||
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
pShapeMesh.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a polyMesh.
|
||||
|
||||
createPolyMeshData();
|
||||
|
||||
Info<< "This is a polyMesh" << endl;
|
||||
|
||||
clearExtraStorage();
|
||||
|
||||
polyMesh pMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime_.constant(),
|
||||
runTime_
|
||||
),
|
||||
xferCopy(points_), // we could probably re-use the data
|
||||
xferCopy(meshFaces_),
|
||||
xferCopy(cellPolys_)
|
||||
);
|
||||
|
||||
// adding patches also checks the mesh
|
||||
pMesh.addPatches(polyBoundaryPatches(pMesh));
|
||||
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
pMesh.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,6 +48,9 @@ Usage
|
||||
Note
|
||||
Baffles are written as interfaces for later use
|
||||
|
||||
See Also
|
||||
Foam::cellTable, Foam::meshReader and Foam::fileFormats::STARCDMeshReader
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
@ -95,7 +98,7 @@ int main(int argc, char *argv[])
|
||||
scaleFactor = 1;
|
||||
}
|
||||
|
||||
meshReaders::STARCD::keepSolids = args.optionFound("solids");
|
||||
fileFormats::STARCDMeshReader::keepSolids = args.optionFound("solids");
|
||||
|
||||
// default to binary output, unless otherwise specified
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
@ -110,7 +113,7 @@ int main(int argc, char *argv[])
|
||||
// remove extensions and/or trailing '.'
|
||||
const fileName prefix = fileName(args[1]).lessExt();
|
||||
|
||||
meshReaders::STARCD reader(prefix, runTime, scaleFactor);
|
||||
fileFormats::STARCDMeshReader reader(prefix, runTime, scaleFactor);
|
||||
|
||||
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
||||
reader.writeMesh(mesh, format);
|
||||
|
||||
@ -51,8 +51,8 @@ case "$major" in
|
||||
then
|
||||
(
|
||||
wmake $targetType vtkPV3Readers
|
||||
PV3blockMeshReader/Allwmake $*
|
||||
PV3FoamReader/Allwmake $*
|
||||
PV3blockMeshReader/Allwmake $targetType $*
|
||||
PV3FoamReader/Allwmake $targetType $*
|
||||
)
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -52,8 +52,8 @@ case "$major" in
|
||||
then
|
||||
(
|
||||
wmake $targetType vtkPVReaders
|
||||
PVblockMeshReader/Allwmake $*
|
||||
PVFoamReader/Allwmake $*
|
||||
PVblockMeshReader/Allwmake $targetType $*
|
||||
PVFoamReader/Allwmake $targetType $*
|
||||
|
||||
# Dummy directory to trigger proper 'wclean all' behaviour
|
||||
# - the Allwclean will otherwise not be used
|
||||
|
||||
194
etc/cellModels
194
etc/cellModels
@ -10,7 +10,7 @@
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
14
|
||||
9
|
||||
(
|
||||
|
||||
unknown
|
||||
@ -258,198 +258,8 @@ splitHex
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// SAMM cell types
|
||||
sammTrim1
|
||||
{
|
||||
index 11;
|
||||
numberOfPoints 10;
|
||||
// Other somewhat exotic types
|
||||
|
||||
faces
|
||||
7
|
||||
(
|
||||
4(2 3 8 7) // x-min
|
||||
5(0 1 6 5 4) // x-max
|
||||
4(2 1 0 3) // y-min
|
||||
5(7 8 9 5 6) // y-max
|
||||
4(2 7 6 1) // z-min
|
||||
5(3 0 4 9 8) // z-max
|
||||
3(4 5 9) // cut
|
||||
);
|
||||
|
||||
edges
|
||||
15
|
||||
(
|
||||
(2 1) // x-direction
|
||||
(3 0)
|
||||
(8 9)
|
||||
(7 6)
|
||||
(2 7) // y-direction
|
||||
(3 8)
|
||||
(0 4)
|
||||
(1 6)
|
||||
(2 3) // z-direction
|
||||
(7 8)
|
||||
(6 5)
|
||||
(1 0)
|
||||
(4 5) // other
|
||||
(5 9)
|
||||
(10 5)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sammTrim2
|
||||
{
|
||||
index 12;
|
||||
numberOfPoints 10;
|
||||
|
||||
faces
|
||||
7
|
||||
(
|
||||
4(2 3 8 7) // x-min
|
||||
4(1 6 5 0) // x-max
|
||||
5(2 1 0 4 3) // y-min
|
||||
5(7 8 9 5 6) // y-max
|
||||
4(2 7 6 1) // z-min
|
||||
4(3 4 9 8) // z-max
|
||||
4(0 5 9 4) // other
|
||||
);
|
||||
|
||||
edges
|
||||
15
|
||||
(
|
||||
(2 1) // x-direction
|
||||
(3 4)
|
||||
(8 9)
|
||||
(7 6)
|
||||
(2 7) // y-direction
|
||||
(3 8)
|
||||
(4 9)
|
||||
(0 5)
|
||||
(1 6)
|
||||
(2 3) // z-direction
|
||||
(7 8)
|
||||
(6 5)
|
||||
(1 0)
|
||||
(9 5) // other
|
||||
(4 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sammTrim3
|
||||
{
|
||||
index 13;
|
||||
numberOfPoints 10;
|
||||
|
||||
faces
|
||||
7
|
||||
(
|
||||
5(2 3 9 8 7) // x-min
|
||||
4(1 5 4 0) // x-max
|
||||
4(2 1 0 3) // y-min
|
||||
3(7 8 6) // y-max
|
||||
5(2 7 6 5 1) // z-min
|
||||
4(3 0 4 9) // z-max
|
||||
5(4 5 6 8 9) // other
|
||||
);
|
||||
|
||||
edges
|
||||
15
|
||||
(
|
||||
(2 1) // x-direction
|
||||
(3 0)
|
||||
(7 6)
|
||||
(2 7) // y-direction
|
||||
(3 9)
|
||||
(0 4)
|
||||
(1 5)
|
||||
(2 3) // z-direction
|
||||
(1 0)
|
||||
(8 7)
|
||||
(8 9) // other
|
||||
(9 4)
|
||||
(4 5)
|
||||
(5 6)
|
||||
(6 8)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sammTrim4
|
||||
{
|
||||
index 14;
|
||||
numberOfPoints 10;
|
||||
|
||||
faces
|
||||
7
|
||||
(
|
||||
5(0 2 6 5 1) // x-min
|
||||
3(3 9 8) // x-max
|
||||
5(0 3 8 7 2) // y-min
|
||||
3(1 5 4) // y-max
|
||||
5(0 1 4 9 3) // z-min
|
||||
3(2 7 6) // z-max
|
||||
6(4 5 6 7 8 9) // other
|
||||
);
|
||||
|
||||
edges
|
||||
15
|
||||
(
|
||||
(0 3) // x-direction
|
||||
(1 4)
|
||||
(2 7)
|
||||
(0 1) // y-direction
|
||||
(2 6)
|
||||
(3 9)
|
||||
(0 2) // z-direction
|
||||
(3 8)
|
||||
(1 5)
|
||||
(4 5) // other
|
||||
(5 6)
|
||||
(6 7)
|
||||
(7 8)
|
||||
(8 9)
|
||||
(9 4)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sammTrim5
|
||||
{
|
||||
index 15;
|
||||
numberOfPoints 8;
|
||||
|
||||
faces
|
||||
6
|
||||
(
|
||||
4(2 3 7 6) // x-min
|
||||
3(1 5 0) // x-max
|
||||
5(2 1 0 4 3) // y-min
|
||||
4(2 6 5 1) // z-min
|
||||
3(3 4 7) // z-max
|
||||
5(0 5 6 7 4) // other
|
||||
);
|
||||
|
||||
edges
|
||||
12
|
||||
(
|
||||
(2 1) // x-direction
|
||||
(3 4)
|
||||
(2 6) // y-direction
|
||||
(3 7)
|
||||
(1 5)
|
||||
(2 3) // z-direction
|
||||
(1 0)
|
||||
(0 5) // other
|
||||
(5 6)
|
||||
(6 7)
|
||||
(7 4)
|
||||
(4 0)
|
||||
);
|
||||
}
|
||||
|
||||
// Equal to sammTrim8
|
||||
hexagonalPrism
|
||||
{
|
||||
index 18;
|
||||
|
||||
@ -126,7 +126,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from normal vector through the origin
|
||||
plane(const vector& normalVector);
|
||||
explicit plane(const vector& normalVector);
|
||||
|
||||
//- Construct from normal vector and point in plane
|
||||
plane
|
||||
@ -137,17 +137,17 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from three points in plane
|
||||
plane(const point& point1, const point& point2, const point& point3);
|
||||
plane(const point&, const point&, const point&);
|
||||
|
||||
//- Construct from coefficients for the
|
||||
// plane equation: ax + by + cz + d = 0
|
||||
plane(const scalarList& C);
|
||||
explicit plane(const scalarList& C);
|
||||
|
||||
//- Construct from dictionary
|
||||
plane(const dictionary& planeDict);
|
||||
explicit plane(const dictionary& planeDict);
|
||||
|
||||
//- Construct from Istream. Assumes the base + normal notation.
|
||||
plane(Istream& is);
|
||||
explicit plane(Istream& is);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
common/reader/meshReader.C
|
||||
common/reader/meshReaderAux.C
|
||||
common/reader/calcPointCells.C
|
||||
common/reader/createPolyCells.C
|
||||
common/reader/createPolyBoundary.C
|
||||
common/writer/meshWriter.C
|
||||
common/tables/boundaryRegion.C
|
||||
common/tables/cellTable.C
|
||||
|
||||
ensight/file/ensightFile.C
|
||||
ensight/file/ensightGeoFile.C
|
||||
ensight/readFile/ensightReadFile.C
|
||||
@ -7,18 +16,9 @@ ensight/part/ensightPartCells.C
|
||||
ensight/part/ensightPartFaces.C
|
||||
ensight/part/ensightParts.C
|
||||
|
||||
meshTables/boundaryRegion.C
|
||||
meshTables/cellTable.C
|
||||
|
||||
meshReader/meshReader.C
|
||||
meshReader/meshReaderAux.C
|
||||
meshReader/calcPointCells.C
|
||||
meshReader/createPolyCells.C
|
||||
meshReader/createPolyBoundary.C
|
||||
meshReader/starcd/STARCDMeshReader.C
|
||||
|
||||
meshWriter/meshWriter.C
|
||||
meshWriter/starcd/STARCDMeshWriter.C
|
||||
starcd/STARCDMeshReader.C
|
||||
starcd/STARCDMeshWriter.C
|
||||
|
||||
polyDualMesh/polyDualMesh.C
|
||||
|
||||
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,7 +90,12 @@ void Foam::meshReader::addPolyBoundaryFace
|
||||
const label nCreatedFaces
|
||||
)
|
||||
{
|
||||
addPolyBoundaryFace(identifier.cell, identifier.face, nCreatedFaces);
|
||||
addPolyBoundaryFace
|
||||
(
|
||||
identifier.cellId(),
|
||||
identifier.faceId(),
|
||||
nCreatedFaces
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +158,7 @@ void Foam::meshReader::createPolyBoundary()
|
||||
|
||||
forAll(idList, bndI)
|
||||
{
|
||||
label baffleI = idList[bndI].cell - baffleOffset;
|
||||
label baffleI = idList[bndI].cellId() - baffleOffset;
|
||||
|
||||
if
|
||||
(
|
||||
@ -189,13 +194,13 @@ void Foam::meshReader::createPolyBoundary()
|
||||
else if (patchPhysicalTypes_[patchi] == "monitoring")
|
||||
{
|
||||
// translate the "monitoring" pseudo-boundaries to face sets
|
||||
List<label> monitoring(idList.size());
|
||||
labelList monitoring(idList.size());
|
||||
|
||||
label monitorI = 0;
|
||||
forAll(idList, bndI)
|
||||
{
|
||||
label cellId = idList[bndI].cell;
|
||||
label faceId = idList[bndI].face;
|
||||
label cellId = idList[bndI].cellId();
|
||||
label faceId = idList[bndI].faceId();
|
||||
|
||||
// standard case: volume cells
|
||||
if (cellId < baffleOffset)
|
||||
@ -215,7 +220,7 @@ void Foam::meshReader::createPolyBoundary()
|
||||
forAll(idList, bndI)
|
||||
{
|
||||
// standard case: volume cells
|
||||
if (idList[bndI].cell < baffleOffset)
|
||||
if (idList[bndI].cellId() < baffleOffset)
|
||||
{
|
||||
addPolyBoundaryFace
|
||||
(
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -138,7 +138,7 @@ void Foam::meshReader::createPolyCells()
|
||||
<< endl;
|
||||
#endif
|
||||
|
||||
if (baffleIds_[baffleI][side].unused())
|
||||
if (baffleIds_[baffleI][side].notUsed())
|
||||
{
|
||||
baffleIds_[baffleI][side] = cellFaceIdentifier
|
||||
(
|
||||
@ -166,8 +166,8 @@ void Foam::meshReader::createPolyCells()
|
||||
{
|
||||
for (label side = 0; side < nNeighbours; ++side)
|
||||
{
|
||||
label neiCell = baffleIds_[baffleI][side].cell;
|
||||
label neiFace = baffleIds_[baffleI][side].face;
|
||||
label neiCell = baffleIds_[baffleI][side].cellId();
|
||||
label neiFace = baffleIds_[baffleI][side].faceId();
|
||||
|
||||
if (baffleIds_[baffleI][side].used())
|
||||
{
|
||||
@ -84,13 +84,7 @@ void Foam::meshReader::addFaceZones(polyMesh& mesh) const
|
||||
}
|
||||
|
||||
nZone = 0;
|
||||
for
|
||||
(
|
||||
HashTable<List<label>, word, string::hash>::const_iterator
|
||||
iter = monitoringSets_.begin();
|
||||
iter != monitoringSets_.end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIter(HashTable<labelList>, monitoringSets_, iter)
|
||||
{
|
||||
Info<< "faceZone " << nZone
|
||||
<< " (size: " << iter().size() << ") name: "
|
||||
@ -103,7 +97,7 @@ void Foam::meshReader::addFaceZones(polyMesh& mesh) const
|
||||
(
|
||||
iter.key(),
|
||||
iter(),
|
||||
List<bool>(iter().size(), false),
|
||||
boolList(iter().size(), false),
|
||||
nZone,
|
||||
mesh.faceZones()
|
||||
)
|
||||
@ -196,15 +190,13 @@ Foam::meshReader::meshReader
|
||||
const fileName& fileOrPrefix,
|
||||
const scalar scaleFactor
|
||||
)
|
||||
:
|
||||
:
|
||||
pointCellsPtr_(nullptr),
|
||||
nInternalFaces_(0),
|
||||
patchStarts_(0),
|
||||
patchSizes_(0),
|
||||
interfaces_(0),
|
||||
baffleIds_(0),
|
||||
meshFaces_(0),
|
||||
cellPolys_(0),
|
||||
monitoringSets_(),
|
||||
// protected
|
||||
geometryFile_(fileOrPrefix),
|
||||
scaleFactor_(scaleFactor),
|
||||
points_(0),
|
||||
@ -213,6 +205,10 @@ Foam::meshReader::meshReader
|
||||
patchTypes_(0),
|
||||
patchNames_(0),
|
||||
patchPhysicalTypes_(0),
|
||||
patchStarts_(0),
|
||||
patchSizes_(0),
|
||||
nInternalFaces_(0),
|
||||
meshFaces_(0),
|
||||
cellFaces_(0),
|
||||
baffleFaces_(0),
|
||||
cellTableId_(0),
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -21,13 +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/>.
|
||||
|
||||
Namespace
|
||||
Foam::meshReaders
|
||||
|
||||
Description
|
||||
A namespace for holding various types of mesh readers.
|
||||
|
||||
|
||||
Class
|
||||
Foam::meshReader
|
||||
|
||||
@ -59,7 +52,6 @@ SourceFiles
|
||||
#include "polyMesh.H"
|
||||
#include "HashTable.H"
|
||||
#include "IOstream.H"
|
||||
|
||||
#include "cellTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -76,64 +68,46 @@ class meshReader
|
||||
protected:
|
||||
|
||||
//- Identify cell faces in terms of cell Id and face Id
|
||||
class cellFaceIdentifier
|
||||
class cellFaceIdentifier : public labelPair
|
||||
{
|
||||
public:
|
||||
// Public data
|
||||
|
||||
//- Cell Id
|
||||
label cell;
|
||||
|
||||
//- Face Id
|
||||
label face;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
cellFaceIdentifier() : cell(-1), face(-1) {}
|
||||
//- Construct null, as invalid pair
|
||||
cellFaceIdentifier() : labelPair(-1, -1) {}
|
||||
|
||||
//- Construct from cell/face components
|
||||
cellFaceIdentifier(label c, label f) : cell(c), face(f) {}
|
||||
cellFaceIdentifier(label c, label f) : labelPair(c, f) {}
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- The cell id (readonly)
|
||||
const label& cellId() const
|
||||
{
|
||||
return first();
|
||||
}
|
||||
|
||||
//- The face id (readonly)
|
||||
const label& faceId() const
|
||||
{
|
||||
return second();
|
||||
}
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
//- Used if cell or face are non-negative
|
||||
//- Used if both cell or face are non-negative
|
||||
bool used() const
|
||||
{
|
||||
return (cell >= 0 && face >= 0);
|
||||
return (first() >= 0 && second() >= 0);
|
||||
}
|
||||
|
||||
//- Unused if cell or face are negative
|
||||
bool unused() const
|
||||
//- Unused if either cell or face are negative
|
||||
bool notUsed() const
|
||||
{
|
||||
return (cell < 0 || face < 0);
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
bool operator!=(const cellFaceIdentifier& cf) const
|
||||
{
|
||||
return (cell != cf.cell || face != cf.face);
|
||||
}
|
||||
|
||||
bool operator==(const cellFaceIdentifier& cf) const
|
||||
{
|
||||
return (cell == cf.cell && face == cf.face);
|
||||
}
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const cellFaceIdentifier& cf
|
||||
)
|
||||
{
|
||||
os << "(" << cf.cell << "/" << cf.face << ")";
|
||||
return os;
|
||||
return (first() < 0 || second() < 0);
|
||||
}
|
||||
};
|
||||
|
||||
@ -147,36 +121,26 @@ private:
|
||||
// duplicate cell entries. Use additional checking
|
||||
mutable labelListList* pointCellsPtr_;
|
||||
|
||||
//- Number of internal faces for polyMesh
|
||||
label nInternalFaces_;
|
||||
|
||||
//- Polyhedral mesh boundary patch start indices and dimensions
|
||||
labelList patchStarts_;
|
||||
labelList patchSizes_;
|
||||
|
||||
//- Association between two faces
|
||||
List<labelPair> interfaces_;
|
||||
|
||||
//- List of cells/faces id pairs for each baffle
|
||||
List<List<cellFaceIdentifier>> baffleIds_;
|
||||
|
||||
//- Global face list for polyMesh
|
||||
faceList meshFaces_;
|
||||
|
||||
//- Cells as polyhedra for polyMesh
|
||||
cellList cellPolys_;
|
||||
|
||||
//- Face sets for monitoring
|
||||
HashTable<List<label>, word, string::hash> monitoringSets_;
|
||||
HashTable<labelList> monitoringSets_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
meshReader(const meshReader&);
|
||||
meshReader(const meshReader&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const meshReader&);
|
||||
void operator=(const meshReader&) = delete;
|
||||
|
||||
//- Calculate pointCells
|
||||
void calcPointCells() const;
|
||||
@ -220,7 +184,7 @@ private:
|
||||
|
||||
void writeInterfaces(const objectRegistry&) const;
|
||||
|
||||
//- Write List<label> in constant/polyMesh
|
||||
//- Write labelList in constant/polyMesh
|
||||
void writeMeshLabelList
|
||||
(
|
||||
const objectRegistry& registry,
|
||||
@ -272,6 +236,16 @@ protected:
|
||||
//- Boundary patch physical types
|
||||
wordList patchPhysicalTypes_;
|
||||
|
||||
//- Polyhedral mesh boundary patch start indices and dimensions
|
||||
labelList patchStarts_;
|
||||
labelList patchSizes_;
|
||||
|
||||
//- Number of internal faces for polyMesh
|
||||
label nInternalFaces_;
|
||||
|
||||
//- Global face list for polyMesh
|
||||
faceList meshFaces_;
|
||||
|
||||
//- List of faces for every cell
|
||||
faceListList cellFaces_;
|
||||
|
||||
@ -49,7 +49,7 @@ Description
|
||||
\endverbatim
|
||||
|
||||
If the \a Label is missing, a value <tt>cellTable_{ID}</tt> will be
|
||||
inferred. If the \a MaterialType is missing, the value @a fluid will
|
||||
inferred. If the \a MaterialType is missing, the value \a fluid will
|
||||
be inferred.
|
||||
|
||||
SourceFiles
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -21,19 +21,11 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Namespace
|
||||
Foam::meshWriters
|
||||
|
||||
Description
|
||||
A namespace for holding various types of mesh writers.
|
||||
|
||||
|
||||
Class
|
||||
Foam::meshWriter
|
||||
|
||||
Description
|
||||
write OpenFOAM meshes and/or results to another CFD format
|
||||
- currently just STAR-CD
|
||||
Write OpenFOAM meshes and/or results to another CFD format.
|
||||
|
||||
\par Files
|
||||
|
||||
@ -65,9 +57,7 @@ Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
meshWriterI.H
|
||||
meshWriter.C
|
||||
meshWriterIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -92,10 +82,10 @@ class meshWriter
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
meshWriter(const meshWriter&);
|
||||
meshWriter(const meshWriter&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const meshWriter&);
|
||||
void operator=(const meshWriter&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
@ -137,7 +127,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Create a writer obejct
|
||||
//- Create a writer object
|
||||
meshWriter
|
||||
(
|
||||
const polyMesh&,
|
||||
@ -159,12 +149,13 @@ public:
|
||||
scaleFactor_ = scaling;
|
||||
}
|
||||
|
||||
//- Suppress writing bnd file
|
||||
//- Suppress writing boundary (bnd) file
|
||||
void noBoundary()
|
||||
{
|
||||
writeBoundary_ = false;
|
||||
}
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write volume mesh. Subclass must supply this method
|
||||
@ -35,15 +35,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::meshReaders::STARCD::defaultBoundaryName =
|
||||
const char* const Foam::fileFormats::STARCDMeshReader::defaultBoundaryName =
|
||||
"Default_Boundary_Region";
|
||||
|
||||
const char* const Foam::meshReaders::STARCD::defaultSolidBoundaryName =
|
||||
const char* const Foam::fileFormats::STARCDMeshReader::defaultSolidBoundaryName =
|
||||
"Default_Boundary_Solid";
|
||||
|
||||
bool Foam::meshReaders::STARCD::keepSolids = false;
|
||||
bool Foam::fileFormats::STARCDMeshReader::keepSolids = false;
|
||||
|
||||
const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] =
|
||||
const int Foam::fileFormats::STARCDMeshReader::starToFoamFaceAddr[4][6] =
|
||||
{
|
||||
{ 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex
|
||||
{ 0, 1, 4, -1, 2, 3 }, // 12 = pro-STAR prism
|
||||
@ -54,7 +54,7 @@ const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] =
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::meshReaders::STARCD::readToNewline(IFstream& is)
|
||||
void Foam::fileFormats::STARCDMeshReader::readToNewline(IFstream& is)
|
||||
{
|
||||
char ch = '\n';
|
||||
do
|
||||
@ -65,7 +65,7 @@ void Foam::meshReaders::STARCD::readToNewline(IFstream& is)
|
||||
}
|
||||
|
||||
|
||||
bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature)
|
||||
bool Foam::fileFormats::STARCDMeshReader::readHeader(IFstream& is, word fileSignature)
|
||||
{
|
||||
if (!is.good())
|
||||
{
|
||||
@ -95,7 +95,10 @@ bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature)
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::meshReaders::STARCD::readAux(const objectRegistry& registry)
|
||||
void Foam::fileFormats::STARCDMeshReader::readAux
|
||||
(
|
||||
const objectRegistry& registry
|
||||
)
|
||||
{
|
||||
boundaryRegion_.readDict(registry);
|
||||
cellTable_.readDict(registry);
|
||||
@ -115,7 +118,7 @@ Body:
|
||||
<vertexId> <x> <y> <z> [newline]
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
void Foam::meshReaders::STARCD::readPoints
|
||||
void Foam::fileFormats::STARCDMeshReader::readPoints
|
||||
(
|
||||
const fileName& inputName,
|
||||
const scalar scaleFactor
|
||||
@ -197,7 +200,6 @@ void Foam::meshReaders::STARCD::readPoints
|
||||
<< "no points in file " << inputName
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -241,7 +243,7 @@ for each cell face.
|
||||
Strictly speaking, we only need the cellModeller for adding boundaries.
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
void Foam::meshReaders::STARCD::readCells(const fileName& inputName)
|
||||
void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName)
|
||||
{
|
||||
const word fileSignature = "PROSTAR_CELL";
|
||||
label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0;
|
||||
@ -632,7 +634,10 @@ BAFFLE
|
||||
etc,
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
|
||||
void Foam::fileFormats::STARCDMeshReader::readBoundary
|
||||
(
|
||||
const fileName& inputName
|
||||
)
|
||||
{
|
||||
const word fileSignature = "PROSTAR_BOUNDARY";
|
||||
label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
|
||||
@ -979,7 +984,7 @@ void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
|
||||
//
|
||||
// remove unused points
|
||||
//
|
||||
void Foam::meshReaders::STARCD::cullPoints()
|
||||
void Foam::fileFormats::STARCDMeshReader::cullPoints()
|
||||
{
|
||||
label nPoints = points_.size();
|
||||
labelList oldToNew(nPoints, -1);
|
||||
@ -1039,7 +1044,7 @@ void Foam::meshReaders::STARCD::cullPoints()
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::meshReaders::STARCD::readGeometry(const scalar scaleFactor)
|
||||
bool Foam::fileFormats::STARCDMeshReader::readGeometry(const scalar scaleFactor)
|
||||
{
|
||||
readPoints(geometryFile_ + ".vrt", scaleFactor);
|
||||
readCells(geometryFile_ + ".cel");
|
||||
@ -1052,7 +1057,7 @@ bool Foam::meshReaders::STARCD::readGeometry(const scalar scaleFactor)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshReaders::STARCD::STARCD
|
||||
Foam::fileFormats::STARCDMeshReader::STARCDMeshReader
|
||||
(
|
||||
const fileName& prefix,
|
||||
const objectRegistry& registry,
|
||||
@ -1070,7 +1075,7 @@ Foam::meshReaders::STARCD::STARCD
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshReaders::STARCD::~STARCD()
|
||||
Foam::fileFormats::STARCDMeshReader::~STARCDMeshReader()
|
||||
{}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::meshReaders::STARCD
|
||||
Foam::fileFormats::STARCDMeshReader
|
||||
|
||||
Description
|
||||
Read pro-STAR vrt/cel/bnd files.
|
||||
@ -52,14 +52,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace meshReaders
|
||||
namespace fileFormats
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class meshReaders::STARCD Declaration
|
||||
Class fileFormats::STARCDMeshReader Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class STARCD
|
||||
class STARCDMeshReader
|
||||
:
|
||||
public meshReader
|
||||
{
|
||||
@ -119,10 +119,10 @@ private:
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
STARCD(const STARCD&);
|
||||
STARCDMeshReader(const STARCDMeshReader&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const STARCD&);
|
||||
void operator=(const STARCDMeshReader&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
@ -161,7 +161,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from case name
|
||||
STARCD
|
||||
STARCDMeshReader
|
||||
(
|
||||
const fileName& prefix,
|
||||
const objectRegistry&,
|
||||
@ -170,13 +170,13 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~STARCD();
|
||||
virtual ~STARCDMeshReader();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace meshReaders
|
||||
} // End namespace fileFormats
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -31,10 +31,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* Foam::meshWriters::STARCD::defaultBoundaryName =
|
||||
const char* Foam::fileFormats::STARCDMeshWriter::defaultBoundaryName =
|
||||
"Default_Boundary_Region";
|
||||
|
||||
const Foam::label Foam::meshWriters::STARCD::foamToStarFaceAddr[4][6] =
|
||||
const Foam::label Foam::fileFormats::STARCDMeshWriter::foamToStarFaceAddr[4][6] =
|
||||
{
|
||||
{ 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex
|
||||
{ 0, 1, 4, 5, 2, -1 }, // 12 = pro-STAR prism
|
||||
@ -45,7 +45,7 @@ const Foam::label Foam::meshWriters::STARCD::foamToStarFaceAddr[4][6] =
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::meshWriters::STARCD::findDefaultBoundary() const
|
||||
Foam::label Foam::fileFormats::STARCDMeshWriter::findDefaultBoundary() const
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
@ -64,7 +64,7 @@ Foam::label Foam::meshWriters::STARCD::findDefaultBoundary() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::meshWriters::STARCD::getCellTable()
|
||||
void Foam::fileFormats::STARCDMeshWriter::getCellTable()
|
||||
{
|
||||
// read constant/polyMesh/propertyName
|
||||
IOList<label> ioList
|
||||
@ -171,7 +171,7 @@ void Foam::meshWriters::STARCD::getCellTable()
|
||||
}
|
||||
|
||||
|
||||
void Foam::meshWriters::STARCD::writeHeader(Ostream& os, const char* filetype)
|
||||
void Foam::fileFormats::STARCDMeshWriter::writeHeader(Ostream& os, const char* filetype)
|
||||
{
|
||||
os << "PROSTAR_" << filetype << nl
|
||||
<< 4000
|
||||
@ -186,7 +186,7 @@ void Foam::meshWriters::STARCD::writeHeader(Ostream& os, const char* filetype)
|
||||
}
|
||||
|
||||
|
||||
void Foam::meshWriters::STARCD::writePoints(const fileName& prefix) const
|
||||
void Foam::fileFormats::STARCDMeshWriter::writePoints(const fileName& prefix) const
|
||||
{
|
||||
OFstream os(prefix + ".vrt");
|
||||
writeHeader(os, "VERTEX");
|
||||
@ -216,7 +216,10 @@ void Foam::meshWriters::STARCD::writePoints(const fileName& prefix) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::meshWriters::STARCD::writeCells(const fileName& prefix) const
|
||||
void Foam::fileFormats::STARCDMeshWriter::writeCells
|
||||
(
|
||||
const fileName& prefix
|
||||
) const
|
||||
{
|
||||
OFstream os(prefix + ".cel");
|
||||
writeHeader(os, "CELL");
|
||||
@ -358,7 +361,10 @@ void Foam::meshWriters::STARCD::writeCells(const fileName& prefix) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::meshWriters::STARCD::writeBoundary(const fileName& prefix) const
|
||||
void Foam::fileFormats::STARCDMeshWriter::writeBoundary
|
||||
(
|
||||
const fileName& prefix
|
||||
) const
|
||||
{
|
||||
OFstream os(prefix + ".bnd");
|
||||
writeHeader(os, "BOUNDARY");
|
||||
@ -464,7 +470,7 @@ void Foam::meshWriters::STARCD::writeBoundary(const fileName& prefix) const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshWriters::STARCD::STARCD
|
||||
Foam::fileFormats::STARCDMeshWriter::STARCDMeshWriter
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const scalar scaleFactor
|
||||
@ -480,13 +486,13 @@ Foam::meshWriters::STARCD::STARCD
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::meshWriters::STARCD::~STARCD()
|
||||
Foam::fileFormats::STARCDMeshWriter::~STARCDMeshWriter()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::meshWriters::STARCD::rmFiles(const fileName& baseName) const
|
||||
void Foam::fileFormats::STARCDMeshWriter::rmFiles(const fileName& baseName) const
|
||||
{
|
||||
rm(baseName + ".vrt");
|
||||
rm(baseName + ".cel");
|
||||
@ -495,7 +501,7 @@ void Foam::meshWriters::STARCD::rmFiles(const fileName& baseName) const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::meshWriters::STARCD::write(const fileName& meshName) const
|
||||
bool Foam::fileFormats::STARCDMeshWriter::write(const fileName& meshName) const
|
||||
{
|
||||
fileName baseName(meshName);
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::meshWriters::STARCD
|
||||
Foam::fileFormats::STARCDMeshWriter
|
||||
|
||||
Description
|
||||
Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
|
||||
@ -46,14 +46,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace meshWriters
|
||||
namespace fileFormats
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class meshWriters::STARCD Declaration
|
||||
Class fileFormats::STARCDMeshWriter Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class STARCD
|
||||
class STARCDMeshWriter
|
||||
:
|
||||
public meshWriter
|
||||
{
|
||||
@ -65,10 +65,10 @@ class STARCD
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
STARCD(const STARCD&);
|
||||
STARCDMeshWriter(const STARCDMeshWriter&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const STARCD&);
|
||||
void operator=(const STARCDMeshWriter&) = delete;
|
||||
|
||||
//- Pro-STAR 4+ header format
|
||||
static void writeHeader(Ostream&, const char* filetype);
|
||||
@ -97,16 +97,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Open a file for writing
|
||||
STARCD
|
||||
(
|
||||
const polyMesh&,
|
||||
const scalar scaleFactor = 1.0
|
||||
);
|
||||
//- Write mesh files in PROSTAR format
|
||||
STARCDMeshWriter(const polyMesh&, const scalar scaleFactor = 1.0);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~STARCD();
|
||||
virtual ~STARCDMeshWriter();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -130,7 +126,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace meshWriters
|
||||
} // End namespace fileFormats
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -2810,6 +2810,7 @@ bool Foam::snappyLayerDriver::writeLayerData
|
||||
dimensionedScalar("zero", dimless, 0),
|
||||
fixedValueFvPatchScalarField::typeName
|
||||
);
|
||||
volScalarField::Boundary& fldBf = fld.boundaryFieldRef();
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
forAll(patchIDs, i)
|
||||
{
|
||||
@ -2834,7 +2835,7 @@ bool Foam::snappyLayerDriver::writeLayerData
|
||||
}
|
||||
}
|
||||
|
||||
fld.boundaryFieldRef()[patchi] == pfld;
|
||||
fldBf[patchi] == pfld;
|
||||
}
|
||||
Info<< indent << fld.name()
|
||||
<< " : overall layer thickness (fraction"
|
||||
|
||||
Reference in New Issue
Block a user