mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -21,6 +21,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
|
||||
-IvectorTools
|
||||
|
||||
EXE_LIBS = \
|
||||
|
||||
@ -279,11 +279,9 @@ Foam::tmp<Foam::pointField> Foam::DelaunayMeshTools::allPoints
|
||||
const Triangulation& t
|
||||
)
|
||||
{
|
||||
tmp<pointField> tpts(new pointField(t.number_of_vertices(), point::max));
|
||||
tmp<pointField> tpts(new pointField(t.vertexCount(), point::max));
|
||||
pointField& pts = tpts();
|
||||
|
||||
label nVert = 0;
|
||||
|
||||
for
|
||||
(
|
||||
typename Triangulation::Finite_vertices_iterator vit =
|
||||
@ -292,9 +290,9 @@ Foam::tmp<Foam::pointField> Foam::DelaunayMeshTools::allPoints
|
||||
++vit
|
||||
)
|
||||
{
|
||||
if (vit->internalOrBoundaryPoint())
|
||||
if (vit->internalOrBoundaryPoint() && !vit->referred())
|
||||
{
|
||||
pts[nVert++] = topoint(vit->point());
|
||||
pts[vit->index()] = topoint(vit->point());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
|
||||
-IPrintTable \
|
||||
-I../vectorTools
|
||||
|
||||
@ -32,4 +33,5 @@ LIB_LIBS = \
|
||||
-ltriSurface \
|
||||
-ldynamicMesh \
|
||||
-lsurfMesh \
|
||||
-lsampling
|
||||
-lsampling \
|
||||
-lautoMesh
|
||||
|
||||
@ -600,6 +600,29 @@ private:
|
||||
PackedBoolList& boundaryFacesToRemove
|
||||
);
|
||||
|
||||
//- From meshRefinementBaffles.C. Use insidePoint for a surface to
|
||||
// determine the cell zone.
|
||||
void findCellZoneInsideWalk
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& locationSurfaces,
|
||||
const labelList& faceToSurface,
|
||||
labelList& cellToSurface
|
||||
) const;
|
||||
|
||||
//- Calculate the cell zones from cellCentres using all closed surfaces
|
||||
labelList calcCellZones(const pointField& cellCentres) const;
|
||||
|
||||
//- Calculate the face zones
|
||||
void calcFaceZones
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const pointField& cellCentres,
|
||||
const labelList& cellToSurface,
|
||||
labelList& faceToSurface,
|
||||
boolList& flipMap
|
||||
) const;
|
||||
|
||||
//- Tet mesh calculation
|
||||
void calcTetMesh
|
||||
(
|
||||
@ -712,9 +735,6 @@ private:
|
||||
bool includeEmptyPatches = false
|
||||
) const;
|
||||
|
||||
//- Create the cell centres to use for the mesh
|
||||
void createCellCentres(pointField& cellCentres) const;
|
||||
|
||||
//- Sort the faces, owner and neighbour lists into
|
||||
// upper-triangular order. For internal faces only, use
|
||||
// before adding patch faces
|
||||
|
||||
@ -2852,32 +2852,6 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::createCellCentres
|
||||
(
|
||||
pointField& cellCentres
|
||||
) const
|
||||
{
|
||||
cellCentres.setSize(number_of_vertices(), point::max);
|
||||
|
||||
label vertI = 0;
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
vit != finite_vertices_end();
|
||||
++vit
|
||||
)
|
||||
{
|
||||
if (vit->internalOrBoundaryPoint())
|
||||
{
|
||||
cellCentres[vertI++] = topoint(vit->point());
|
||||
}
|
||||
}
|
||||
|
||||
cellCentres.setSize(vertI);
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::sortFaces
|
||||
(
|
||||
faceList& faces,
|
||||
@ -3095,7 +3069,7 @@ Foam::labelList Foam::conformalVoronoiMesh::removeUnusedCells
|
||||
{
|
||||
Info<< nl << "Removing unused cells" << endl;
|
||||
|
||||
PackedBoolList cellUsed(number_of_vertices(), false);
|
||||
PackedBoolList cellUsed(vertexCount(), false);
|
||||
|
||||
// Scan all faces to find all of the cells that are used
|
||||
|
||||
|
||||
@ -35,6 +35,11 @@ License
|
||||
#include "pointMesh.H"
|
||||
#include "indexedVertexOps.H"
|
||||
#include "DelaunayMeshTools.H"
|
||||
#include "surfaceZonesInfo.H"
|
||||
#include "polyModifyCell.H"
|
||||
#include "polyModifyFace.H"
|
||||
#include "syncTools.H"
|
||||
#include "regionSplit.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -402,6 +407,376 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::findCellZoneInsideWalk
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& locationSurfaces, // indices of surfaces with inside point
|
||||
const labelList& faceToSurface, // per face index of named surface
|
||||
labelList& cellToSurface
|
||||
) const
|
||||
{
|
||||
// Analyse regions. Reuse regionsplit
|
||||
boolList blockedFace(mesh.nFaces());
|
||||
//selectSeparatedCoupledFaces(blockedFace);
|
||||
|
||||
forAll(faceToSurface, faceI)
|
||||
{
|
||||
if (faceToSurface[faceI] == -1)
|
||||
{
|
||||
blockedFace[faceI] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
blockedFace[faceI] = true;
|
||||
}
|
||||
}
|
||||
// No need to sync since namedSurfaceIndex already is synced
|
||||
|
||||
// Set region per cell based on walking
|
||||
regionSplit cellRegion(mesh, blockedFace);
|
||||
blockedFace.clear();
|
||||
|
||||
|
||||
// Force calculation of face decomposition (used in findCell)
|
||||
(void)mesh.tetBasePtIs();
|
||||
|
||||
const PtrList<surfaceZonesInfo>& surfZones =
|
||||
geometryToConformTo().surfZones();
|
||||
|
||||
// For all locationSurface find the cell
|
||||
forAll(locationSurfaces, i)
|
||||
{
|
||||
label surfI = locationSurfaces[i];
|
||||
|
||||
const Foam::point& insidePoint = surfZones[surfI].zoneInsidePoint();
|
||||
|
||||
const word& surfName = geometryToConformTo().geometry().names()[surfI];
|
||||
|
||||
Info<< " For surface " << surfName
|
||||
<< " finding inside point " << insidePoint
|
||||
<< endl;
|
||||
|
||||
// Find the region containing the insidePoint
|
||||
label keepRegionI = -1;
|
||||
|
||||
label cellI = mesh.findCell(insidePoint);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
keepRegionI = cellRegion[cellI];
|
||||
}
|
||||
reduce(keepRegionI, maxOp<label>());
|
||||
|
||||
Info<< " For surface " << surfName
|
||||
<< " found point " << insidePoint << " in cell " << cellI
|
||||
<< " in global region " << keepRegionI
|
||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||
|
||||
if (keepRegionI == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"conformalVoronoiMesh::findCellZoneInsideWalk"
|
||||
"(const polyMesh&, const labelList&"
|
||||
", const labelList&, labelList&)"
|
||||
) << "Point " << insidePoint
|
||||
<< " is not inside the mesh." << nl
|
||||
<< "Bounding box of the mesh:" << mesh.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Set all cells with this region
|
||||
forAll(cellRegion, cellI)
|
||||
{
|
||||
if (cellRegion[cellI] == keepRegionI)
|
||||
{
|
||||
if (cellToSurface[cellI] == -2)
|
||||
{
|
||||
cellToSurface[cellI] = surfI;
|
||||
}
|
||||
else if (cellToSurface[cellI] != surfI)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"conformalVoronoiMesh::findCellZoneInsideWalk"
|
||||
"(const labelList&, const labelList&"
|
||||
", const labelList&, const labelList&)"
|
||||
) << "Cell " << cellI
|
||||
<< " at " << mesh.cellCentres()[cellI]
|
||||
<< " is inside surface " << surfName
|
||||
<< " but already marked as being in zone "
|
||||
<< cellToSurface[cellI] << endl
|
||||
<< "This can happen if your surfaces are not"
|
||||
<< " (sufficiently) closed."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::conformalVoronoiMesh::calcCellZones
|
||||
(
|
||||
const pointField& cellCentres
|
||||
) const
|
||||
{
|
||||
labelList cellToSurface(cellCentres.size(), -1);
|
||||
|
||||
const PtrList<surfaceZonesInfo>& surfZones =
|
||||
geometryToConformTo().surfZones();
|
||||
|
||||
// Get list of closed surfaces
|
||||
labelList closedNamedSurfaces
|
||||
(
|
||||
surfaceZonesInfo::getAllClosedNamedSurfaces
|
||||
(
|
||||
surfZones,
|
||||
geometryToConformTo().geometry(),
|
||||
geometryToConformTo().surfaces()
|
||||
)
|
||||
);
|
||||
|
||||
forAll(closedNamedSurfaces, i)
|
||||
{
|
||||
label surfI = closedNamedSurfaces[i];
|
||||
|
||||
const searchableSurface& surface =
|
||||
allGeometry()[geometryToConformTo().surfaces()[surfI]];
|
||||
|
||||
const surfaceZonesInfo::areaSelectionAlgo selectionMethod =
|
||||
surfZones[surfI].zoneInside();
|
||||
|
||||
if
|
||||
(
|
||||
selectionMethod != surfaceZonesInfo::INSIDE
|
||||
&& selectionMethod != surfaceZonesInfo::OUTSIDE
|
||||
&& selectionMethod != surfaceZonesInfo::INSIDEPOINT
|
||||
)
|
||||
{
|
||||
FatalErrorIn("conformalVoronoiMesh::calcCellZones(..)")
|
||||
<< "Trying to use surface "
|
||||
<< surface.name()
|
||||
<< " which has non-geometric inside selection method "
|
||||
<< surfaceZonesInfo::areaSelectionAlgoNames[selectionMethod]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
{
|
||||
List<volumeType> volType;
|
||||
surface.getVolumeType(cellCentres, volType);
|
||||
|
||||
bool selectInside = true;
|
||||
if (selectionMethod == surfaceZonesInfo::INSIDEPOINT)
|
||||
{
|
||||
List<volumeType> volTypeInsidePoint;
|
||||
surface.getVolumeType
|
||||
(
|
||||
pointField(1, surfZones[surfI].zoneInsidePoint()),
|
||||
volTypeInsidePoint
|
||||
);
|
||||
|
||||
if (volTypeInsidePoint[0] == volumeType::OUTSIDE)
|
||||
{
|
||||
selectInside = false;
|
||||
}
|
||||
}
|
||||
else if (selectionMethod == surfaceZonesInfo::OUTSIDE)
|
||||
{
|
||||
selectInside = false;
|
||||
}
|
||||
|
||||
forAll(volType, pointI)
|
||||
{
|
||||
if (cellToSurface[pointI] == -1)
|
||||
{
|
||||
if
|
||||
(
|
||||
(
|
||||
volType[pointI] == volumeType::INSIDE
|
||||
&& selectInside
|
||||
)
|
||||
|| (
|
||||
volType[pointI] == volumeType::OUTSIDE
|
||||
&& !selectInside
|
||||
)
|
||||
)
|
||||
{
|
||||
cellToSurface[pointI] = surfI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cellToSurface;
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::calcFaceZones
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const pointField& cellCentres,
|
||||
const labelList& cellToSurface,
|
||||
labelList& faceToSurface,
|
||||
boolList& flipMap
|
||||
) const
|
||||
{
|
||||
faceToSurface.setSize(mesh.nFaces(), -1);
|
||||
flipMap.setSize(mesh.nFaces(), false);
|
||||
|
||||
const faceList& faces = mesh.faces();
|
||||
const labelList& faceOwner = mesh.faceOwner();
|
||||
const labelList& faceNeighbour = mesh.faceNeighbour();
|
||||
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
const label ownerSurfaceI = cellToSurface[faceOwner[faceI]];
|
||||
|
||||
if (mesh.isInternalFace(faceI))
|
||||
{
|
||||
const label neiSurfaceI = cellToSurface[faceNeighbour[faceI]];
|
||||
|
||||
flipMap[faceI] =
|
||||
(
|
||||
ownerSurfaceI == max(ownerSurfaceI, neiSurfaceI)
|
||||
? false
|
||||
: true
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
(ownerSurfaceI >= 0 || neiSurfaceI >= 0)
|
||||
&& ownerSurfaceI != neiSurfaceI
|
||||
)
|
||||
{
|
||||
if (ownerSurfaceI > neiSurfaceI)
|
||||
{
|
||||
faceToSurface[faceI] = ownerSurfaceI;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceToSurface[faceI] = neiSurfaceI;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ownerSurfaceI >= 0)
|
||||
{
|
||||
faceToSurface[faceI] = ownerSurfaceI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const PtrList<surfaceZonesInfo>& surfZones =
|
||||
geometryToConformTo().surfZones();
|
||||
|
||||
labelList insidePointNamedSurfaces
|
||||
(
|
||||
surfaceZonesInfo::getInsidePointNamedSurfaces(surfZones)
|
||||
);
|
||||
|
||||
// Use intersection of cellCentre connections
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
if
|
||||
(
|
||||
mesh.isInternalFace(faceI)
|
||||
&& faceToSurface[faceI] < 0
|
||||
)
|
||||
{
|
||||
const label own = faceOwner[faceI];
|
||||
const label nei = faceNeighbour[faceI];
|
||||
|
||||
pointIndexHit surfHit;
|
||||
label hitSurface;
|
||||
|
||||
geometryToConformTo().findSurfaceAnyIntersection
|
||||
(
|
||||
cellCentres[own],
|
||||
cellCentres[nei],
|
||||
surfHit,
|
||||
hitSurface
|
||||
);
|
||||
|
||||
if (surfHit.hit())
|
||||
{
|
||||
if (findIndex(insidePointNamedSurfaces, hitSurface) != -1)
|
||||
{
|
||||
faceToSurface[faceI] = hitSurface;
|
||||
|
||||
vectorField norm;
|
||||
geometryToConformTo().getNormal
|
||||
(
|
||||
hitSurface,
|
||||
List<pointIndexHit>(1, surfHit),
|
||||
norm
|
||||
);
|
||||
|
||||
const vector fN = faces[faceI].normal(mesh.points());
|
||||
|
||||
if ((norm[0] & fN/(mag(fN) + SMALL)) < 0)
|
||||
{
|
||||
flipMap[faceI] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flipMap[faceI] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
labelList neiCellSurface(mesh.nFaces()-mesh.nInternalFaces());
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
label ownSurface = cellToSurface[faceOwner[faceI]];
|
||||
neiCellSurface[faceI - mesh.nInternalFaces()] = ownSurface;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, neiCellSurface);
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
label ownSurface = cellToSurface[faceOwner[faceI]];
|
||||
label neiSurface = neiCellSurface[faceI-mesh.nInternalFaces()];
|
||||
|
||||
if (faceToSurface[faceI] == -1 && (ownSurface != neiSurface))
|
||||
{
|
||||
// Give face the max cell zone
|
||||
faceToSurface[faceI] = max(ownSurface, neiSurface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sync
|
||||
syncTools::syncFaceList(mesh, faceToSurface, maxEqOp<label>());
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
@ -883,7 +1258,11 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
// Check that the patch is not empty on every processor
|
||||
reduce(totalPatchSize, sumOp<label>());
|
||||
|
||||
if (totalPatchSize > 0)
|
||||
if
|
||||
(
|
||||
totalPatchSize > 0
|
||||
// && !geometryToConformTo().surfZones().set(p)
|
||||
)
|
||||
{
|
||||
patches[nValidPatches] = polyPatch::New
|
||||
(
|
||||
@ -898,6 +1277,145 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
}
|
||||
}
|
||||
|
||||
patches.setSize(nValidPatches);
|
||||
|
||||
mesh.addFvPatches(patches);
|
||||
|
||||
|
||||
// Add zones to mesh
|
||||
{
|
||||
Info<< " Adding zones to mesh" << endl;
|
||||
|
||||
const PtrList<surfaceZonesInfo>& surfZones =
|
||||
geometryToConformTo().surfZones();
|
||||
|
||||
labelList cellToSurface(calcCellZones(cellCentres));
|
||||
|
||||
labelList faceToSurface;
|
||||
boolList flipMap;
|
||||
|
||||
calcFaceZones
|
||||
(
|
||||
mesh,
|
||||
cellCentres,
|
||||
cellToSurface,
|
||||
faceToSurface,
|
||||
flipMap
|
||||
);
|
||||
|
||||
labelList insidePointNamedSurfaces
|
||||
(
|
||||
surfaceZonesInfo::getInsidePointNamedSurfaces(surfZones)
|
||||
);
|
||||
|
||||
findCellZoneInsideWalk
|
||||
(
|
||||
mesh,
|
||||
insidePointNamedSurfaces,
|
||||
faceToSurface,
|
||||
cellToSurface
|
||||
);
|
||||
|
||||
labelList namedSurfaces(surfaceZonesInfo::getNamedSurfaces(surfZones));
|
||||
|
||||
forAll(namedSurfaces, i)
|
||||
{
|
||||
label surfI = namedSurfaces[i];
|
||||
|
||||
Info<< incrIndent << indent << "Surface : "
|
||||
<< geometryToConformTo().geometry().names()[surfI] << nl
|
||||
<< indent << " faceZone : "
|
||||
<< surfZones[surfI].faceZoneName() << nl
|
||||
<< indent << " cellZone : "
|
||||
<< surfZones[surfI].cellZoneName()
|
||||
<< decrIndent << endl;
|
||||
}
|
||||
|
||||
// Add zones to mesh
|
||||
labelList surfaceToFaceZone =
|
||||
surfaceZonesInfo::addFaceZonesToMesh
|
||||
(
|
||||
surfZones,
|
||||
namedSurfaces,
|
||||
mesh
|
||||
);
|
||||
|
||||
labelList surfaceToCellZone =
|
||||
surfaceZonesInfo::addCellZonesToMesh
|
||||
(
|
||||
surfZones,
|
||||
namedSurfaces,
|
||||
mesh
|
||||
);
|
||||
|
||||
// Topochange container
|
||||
polyTopoChange meshMod(mesh);
|
||||
|
||||
forAll(cellToSurface, cellI)
|
||||
{
|
||||
label surfaceI = cellToSurface[cellI];
|
||||
|
||||
if (surfaceI >= 0)
|
||||
{
|
||||
label zoneI = surfaceToCellZone[surfaceI];
|
||||
|
||||
if (zoneI >= 0)
|
||||
{
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyCell
|
||||
(
|
||||
cellI,
|
||||
false, // removeFromZone
|
||||
zoneI
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const labelList& faceOwner = mesh.faceOwner();
|
||||
const labelList& faceNeighbour = mesh.faceNeighbour();
|
||||
|
||||
forAll(faceToSurface, faceI)
|
||||
{
|
||||
if (!mesh.isInternalFace(faceI))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
label surfaceI = faceToSurface[faceI];
|
||||
|
||||
if (surfaceI >= 0)
|
||||
{
|
||||
label own = faceOwner[faceI];
|
||||
label nei = faceNeighbour[faceI];
|
||||
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
mesh.faces()[faceI], // modified face
|
||||
faceI, // label of face
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
false, // face flip
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
surfaceToFaceZone[surfaceI], // zone for face
|
||||
flipMap[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Change the mesh (no inflation, parallel sync)
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Add indirectPatchFaces to a face zone
|
||||
{
|
||||
labelList addr(boundaryFacesToRemove.count());
|
||||
@ -928,10 +1446,6 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
);
|
||||
}
|
||||
|
||||
patches.setSize(nValidPatches);
|
||||
|
||||
mesh.addFvPatches(patches);
|
||||
|
||||
timeCheck("Before fvMesh filtering");
|
||||
|
||||
autoPtr<polyMeshFilter> meshFilter;
|
||||
|
||||
@ -265,6 +265,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
allGeometryToSurfaces_(),
|
||||
normalVolumeTypes_(),
|
||||
patchNames_(),
|
||||
surfZones_(),
|
||||
regionOffset_(),
|
||||
patchInfo_(),
|
||||
globalBounds_(),
|
||||
@ -275,157 +276,198 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
surfaceConformationDict.subDict("geometryToConformTo")
|
||||
);
|
||||
|
||||
const label nSurf = surfacesDict.size();
|
||||
|
||||
const dictionary& additionalFeaturesDict
|
||||
(
|
||||
surfaceConformationDict.subDict("additionalFeatures")
|
||||
);
|
||||
|
||||
|
||||
// Wildcard specification : loop over all surface, all regions
|
||||
// and try to find a match.
|
||||
|
||||
// Count number of surfaces.
|
||||
label surfI = 0;
|
||||
forAll(allGeometry.names(), geomI)
|
||||
{
|
||||
const word& geomName = allGeometry_.names()[geomI];
|
||||
|
||||
if (surfacesDict.found(geomName))
|
||||
{
|
||||
surfI++;
|
||||
}
|
||||
}
|
||||
|
||||
const label nAddFeat = additionalFeaturesDict.size();
|
||||
|
||||
Info<< nl << "Reading geometryToConformTo" << endl;
|
||||
|
||||
surfaces_.setSize(nSurf, -1);
|
||||
|
||||
allGeometryToSurfaces_.setSize(allGeometry_.size(), -1);
|
||||
|
||||
normalVolumeTypes_.setSize(nSurf);
|
||||
normalVolumeTypes_.setSize(surfI);
|
||||
surfaces_.setSize(surfI);
|
||||
surfZones_.setSize(surfI);
|
||||
|
||||
// Features may be attached to host surfaces or independent
|
||||
features_.setSize(nSurf + nAddFeat);
|
||||
features_.setSize(surfI + nAddFeat);
|
||||
|
||||
label featureI = 0;
|
||||
|
||||
regionOffset_.setSize(nSurf, 0);
|
||||
regionOffset_.setSize(surfI, 0);
|
||||
|
||||
PtrList<dictionary> globalPatchInfo(nSurf);
|
||||
List<Map<autoPtr<dictionary> > > regionPatchInfo(nSurf);
|
||||
List<sideVolumeType> globalVolumeTypes(nSurf);
|
||||
List<Map<sideVolumeType> > regionVolumeTypes(nSurf);
|
||||
PtrList<dictionary> globalPatchInfo(surfI);
|
||||
List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
|
||||
List<sideVolumeType> globalVolumeTypes(surfI);
|
||||
List<Map<sideVolumeType> > regionVolumeTypes(surfI);
|
||||
|
||||
label surfI = 0;
|
||||
HashSet<word> unmatchedKeys(surfacesDict.toc());
|
||||
|
||||
forAllConstIter(dictionary, surfacesDict, iter)
|
||||
surfI = 0;
|
||||
forAll(allGeometry_.names(), geomI)
|
||||
{
|
||||
word surfaceName = iter().keyword();
|
||||
const word& geomName = allGeometry_.names()[geomI];
|
||||
|
||||
surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName);
|
||||
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
||||
|
||||
if (surfaces_[surfI] < 0)
|
||||
if (ePtr)
|
||||
{
|
||||
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
|
||||
<< "No surface " << surfaceName << " found. "
|
||||
<< "Valid geometry is " << nl << allGeometry_.names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
const dictionary& dict = ePtr->dict();
|
||||
unmatchedKeys.erase(ePtr->keyword());
|
||||
|
||||
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
||||
surfaces_[surfI] = geomI;
|
||||
|
||||
Info<< nl << " " << surfaceName << endl;
|
||||
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||
|
||||
const wordList& regionNames =
|
||||
allGeometry_.regionNames()[surfaces_[surfI]];
|
||||
|
||||
patchNames_.append(regionNames);
|
||||
|
||||
const dictionary& surfaceSubDict(surfacesDict.subDict(surfaceName));
|
||||
|
||||
globalVolumeTypes[surfI] =
|
||||
(
|
||||
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
||||
[
|
||||
surfaceSubDict.lookupOrDefault<word>("meshableSide", "inside")
|
||||
]
|
||||
);
|
||||
|
||||
if (!globalVolumeTypes[surfI])
|
||||
{
|
||||
if (!allGeometry_[surfaces_[surfI]].hasVolumeType())
|
||||
// Surface zones
|
||||
if (dict.found("faceZone"))
|
||||
{
|
||||
WarningIn("conformationSurfaces::conformationSurfaces(..)")
|
||||
<< "Non-baffle surface "
|
||||
<< allGeometry_[surfaces_[surfI]].name()
|
||||
<< " does not allow inside/outside queries."
|
||||
<< " This usually is an error." << endl;
|
||||
surfZones_.set(surfI, new surfaceZonesInfo(surface, dict));
|
||||
}
|
||||
}
|
||||
|
||||
// Load patch info
|
||||
if (surfaceSubDict.found("patchInfo"))
|
||||
{
|
||||
globalPatchInfo.set
|
||||
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
||||
|
||||
Info<< nl << " " << geomName << endl;
|
||||
|
||||
const wordList& regionNames =
|
||||
allGeometry_.regionNames()[surfaces_[surfI]];
|
||||
|
||||
patchNames_.append(regionNames);
|
||||
|
||||
globalVolumeTypes[surfI] =
|
||||
(
|
||||
surfI,
|
||||
surfaceSubDict.subDict("patchInfo").clone()
|
||||
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
||||
[
|
||||
dict.lookupOrDefault<word>
|
||||
(
|
||||
"meshableSide",
|
||||
"inside"
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
readFeatures
|
||||
(
|
||||
surfI,
|
||||
surfaceSubDict,
|
||||
surfaceName,
|
||||
featureI
|
||||
);
|
||||
|
||||
const wordList& rNames = allGeometry_[surfaces_[surfI]].regions();
|
||||
|
||||
if (surfaceSubDict.found("regions"))
|
||||
{
|
||||
const dictionary& regionsDict = surfaceSubDict.subDict("regions");
|
||||
|
||||
forAll(rNames, regionI)
|
||||
if (!globalVolumeTypes[surfI])
|
||||
{
|
||||
const word& regionName = rNames[regionI];
|
||||
|
||||
if (regionsDict.found(regionName))
|
||||
if (!surface.hasVolumeType())
|
||||
{
|
||||
Info<< " region " << regionName << endl;
|
||||
|
||||
// Get the dictionary for region
|
||||
const dictionary& regionDict = regionsDict.subDict
|
||||
(
|
||||
regionName
|
||||
);
|
||||
|
||||
if (regionDict.found("patchInfo"))
|
||||
{
|
||||
regionPatchInfo[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
regionDict.subDict("patchInfo").clone()
|
||||
);
|
||||
}
|
||||
|
||||
regionVolumeTypes[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
||||
[
|
||||
regionDict.lookupOrDefault<word>
|
||||
(
|
||||
"meshableSide",
|
||||
"inside"
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
readFeatures(regionDict, regionName, featureI);
|
||||
WarningIn("conformationSurfaces::conformationSurfaces(..)")
|
||||
<< "Non-baffle surface "
|
||||
<< surface.name()
|
||||
<< " does not allow inside/outside queries."
|
||||
<< " This usually is an error." << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surfI++;
|
||||
// Load patch info
|
||||
if (dict.found("patchInfo"))
|
||||
{
|
||||
globalPatchInfo.set
|
||||
(
|
||||
surfI,
|
||||
dict.subDict("patchInfo").clone()
|
||||
);
|
||||
}
|
||||
|
||||
readFeatures
|
||||
(
|
||||
surfI,
|
||||
dict,
|
||||
geomName,
|
||||
featureI
|
||||
);
|
||||
|
||||
const wordList& rNames = surface.regions();
|
||||
|
||||
if (dict.found("regions"))
|
||||
{
|
||||
const dictionary& regionsDict = dict.subDict("regions");
|
||||
|
||||
forAll(rNames, regionI)
|
||||
{
|
||||
const word& regionName = rNames[regionI];
|
||||
|
||||
if (regionsDict.found(regionName))
|
||||
{
|
||||
Info<< " region " << regionName << endl;
|
||||
|
||||
// Get the dictionary for region
|
||||
const dictionary& regionDict = regionsDict.subDict
|
||||
(
|
||||
regionName
|
||||
);
|
||||
|
||||
if (regionDict.found("patchInfo"))
|
||||
{
|
||||
regionPatchInfo[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
regionDict.subDict("patchInfo").clone()
|
||||
);
|
||||
}
|
||||
|
||||
regionVolumeTypes[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
||||
[
|
||||
regionDict.lookupOrDefault<word>
|
||||
(
|
||||
"meshableSide",
|
||||
"inside"
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
readFeatures(regionDict, regionName, featureI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surfI++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (unmatchedKeys.size() > 0)
|
||||
{
|
||||
IOWarningIn
|
||||
(
|
||||
"conformationSurfaces::conformationSurfaces(..)",
|
||||
surfacesDict
|
||||
) << "Not all entries in conformationSurfaces dictionary were used."
|
||||
<< " The following entries were not used : "
|
||||
<< unmatchedKeys.sortedToc()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// Calculate local to global region offset
|
||||
label nRegions = 0;
|
||||
|
||||
forAll(surfaces_, surfI)
|
||||
{
|
||||
regionOffset_[surfI] = nRegions;
|
||||
nRegions += allGeometry_[surfaces_[surfI]].regions().size();
|
||||
|
||||
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||
nRegions += surface.regions().size();
|
||||
}
|
||||
|
||||
// Rework surface specific information into information per global region
|
||||
@ -434,7 +476,9 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
forAll(surfaces_, surfI)
|
||||
{
|
||||
label nRegions = allGeometry_[surfaces_[surfI]].regions().size();
|
||||
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||
|
||||
label nRegions = surface.regions().size();
|
||||
|
||||
// Initialise to global (i.e. per surface)
|
||||
for (label i = 0; i < nRegions; i++)
|
||||
@ -1165,13 +1209,7 @@ Foam::label Foam::conformationSurfaces::findPatch(const point& pt) const
|
||||
pointIndexHit surfHit;
|
||||
label hitSurface;
|
||||
|
||||
findSurfaceNearest
|
||||
(
|
||||
pt,
|
||||
sqr(GREAT),
|
||||
surfHit,
|
||||
hitSurface
|
||||
);
|
||||
findSurfaceNearest(pt, sqr(GREAT), surfHit, hitSurface);
|
||||
|
||||
return getPatchID(hitSurface, surfHit);
|
||||
}
|
||||
@ -1229,11 +1267,7 @@ void Foam::conformationSurfaces::getNormal
|
||||
vectorField& normal
|
||||
) const
|
||||
{
|
||||
allGeometry_[hitSurface].getNormal
|
||||
(
|
||||
surfHit,
|
||||
normal
|
||||
);
|
||||
allGeometry_[hitSurface].getNormal(surfHit, normal);
|
||||
|
||||
const label patchID = regionOffset_[allGeometryToSurfaces_[hitSurface]];
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#include "extendedFeatureEdgeMesh.H"
|
||||
#include "boolList.H"
|
||||
#include "volumeType.H"
|
||||
#include "surfaceZonesInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class conformationSurfaces Declaration
|
||||
Class conformationSurfaces Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class conformationSurfaces
|
||||
@ -86,6 +87,9 @@ class conformationSurfaces
|
||||
// surfaces to be reproduced in the meshed geometry
|
||||
List<word> patchNames_;
|
||||
|
||||
//- List of surface zone (face and cell zone) information
|
||||
PtrList<surfaceZonesInfo> surfZones_;
|
||||
|
||||
//- The offset between the patch indices of the individual surface and
|
||||
// the entry in the overall patch list
|
||||
labelList regionOffset_;
|
||||
@ -170,6 +174,9 @@ public:
|
||||
//- Return the patch names
|
||||
inline const List<word>& patchNames() const;
|
||||
|
||||
//- Return the surfaceZonesInfo
|
||||
inline const PtrList<surfaceZonesInfo>& surfZones() const;
|
||||
|
||||
//- Return the patch info
|
||||
inline const PtrList<dictionary>& patchInfo() const;
|
||||
|
||||
|
||||
@ -56,6 +56,13 @@ const Foam::List<Foam::word>& Foam::conformationSurfaces::patchNames() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::PtrList<Foam::surfaceZonesInfo>&
|
||||
Foam::conformationSurfaces::surfZones() const
|
||||
{
|
||||
return surfZones_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::PtrList<Foam::dictionary>&
|
||||
Foam::conformationSurfaces::patchInfo() const
|
||||
{
|
||||
|
||||
@ -23,6 +23,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/autoMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
$(CGAL_LIBS) \
|
||||
|
||||
@ -98,19 +98,8 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
|
||||
labelList surfaces(surfI);
|
||||
wordList names(surfI);
|
||||
wordList faceZoneNames(surfI);
|
||||
wordList cellZoneNames(surfI);
|
||||
List<refinementSurfaces::areaSelectionAlgo> zoneInside
|
||||
(
|
||||
surfI,
|
||||
refinementSurfaces::NONE
|
||||
);
|
||||
pointField zoneInsidePoints(surfI);
|
||||
List<refinementSurfaces::faceZoneType> faceType
|
||||
(
|
||||
surfI,
|
||||
refinementSurfaces::INTERNAL
|
||||
);
|
||||
PtrList<surfaceZonesInfo> surfZones(surfI);
|
||||
|
||||
labelList regionOffset(surfI);
|
||||
|
||||
labelList globalMinLevel(surfI, 0);
|
||||
@ -123,21 +112,24 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
List<Map<scalar> > regionAngle(surfI);
|
||||
List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
|
||||
|
||||
HashSet<word> unmatchedKeys(surfacesDict.toc());
|
||||
|
||||
surfI = 0;
|
||||
forAll(allGeometry.names(), geomI)
|
||||
{
|
||||
const word& geomName = allGeometry.names()[geomI];
|
||||
|
||||
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
||||
|
||||
// Definition of surfaces to conform to
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (surfacesDict.found(geomName))
|
||||
if (ePtr)
|
||||
{
|
||||
const dictionary& shapeDict = ePtr->dict();
|
||||
unmatchedKeys.erase(ePtr->keyword());
|
||||
|
||||
names[surfI] = geomName;
|
||||
surfaces[surfI] = geomI;
|
||||
|
||||
const dictionary& shapeDict = shapeControlDict.subDict(geomName);
|
||||
const searchableSurface& surface = allGeometry[geomI];
|
||||
|
||||
// Find the index in shapeControlDict
|
||||
// Invert surfaceCellSize to get the refinementLevel
|
||||
@ -160,107 +152,26 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
globalMaxLevel[surfI] = refLevel;
|
||||
globalLevelIncr[surfI] = gapLevelIncrement;
|
||||
|
||||
const dictionary& dict = surfacesDict.subDict(geomName);
|
||||
|
||||
// Global zone names per surface
|
||||
if (dict.readIfPresent("faceZone", faceZoneNames[surfI]))
|
||||
{
|
||||
// Read optional entry to determine inside of faceZone
|
||||
|
||||
word method;
|
||||
bool hasSide = dict.readIfPresent("cellZoneInside", method);
|
||||
if (hasSide)
|
||||
{
|
||||
zoneInside[surfI] =
|
||||
refinementSurfaces::areaSelectionAlgoNames[method];
|
||||
if (zoneInside[surfI] == refinementSurfaces::INSIDEPOINT)
|
||||
{
|
||||
dict.lookup("insidePoint") >> zoneInsidePoints[surfI];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check old syntax
|
||||
bool inside;
|
||||
if (dict.readIfPresent("zoneInside", inside))
|
||||
{
|
||||
hasSide = true;
|
||||
zoneInside[surfI] =
|
||||
(
|
||||
inside
|
||||
? refinementSurfaces::INSIDE
|
||||
: refinementSurfaces::OUTSIDE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Read optional cellZone name
|
||||
|
||||
if (dict.readIfPresent("cellZone", cellZoneNames[surfI]))
|
||||
{
|
||||
if
|
||||
(
|
||||
(
|
||||
zoneInside[surfI] == refinementSurfaces::INSIDE
|
||||
|| zoneInside[surfI] == refinementSurfaces::OUTSIDE
|
||||
)
|
||||
&& !allGeometry[surfaces[surfI]].hasVolumeType()
|
||||
)
|
||||
{
|
||||
IOWarningIn
|
||||
(
|
||||
"createRefinementSurfaces(..)",
|
||||
dict
|
||||
) << "Illegal entry zoneInside "
|
||||
<< refinementSurfaces::areaSelectionAlgoNames
|
||||
[
|
||||
zoneInside[surfI]
|
||||
]
|
||||
<< " for faceZone "
|
||||
<< faceZoneNames[surfI]
|
||||
<< " since surface " << names[surfI]
|
||||
<< " is not closed." << endl;
|
||||
}
|
||||
}
|
||||
else if (hasSide)
|
||||
{
|
||||
IOWarningIn
|
||||
(
|
||||
"createRefinementSurfaces(..)",
|
||||
dict
|
||||
) << "Unused entry zoneInside for faceZone "
|
||||
<< faceZoneNames[surfI]
|
||||
<< " since no cellZone specified."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// How to handle faces on faceZone
|
||||
word faceTypeMethod;
|
||||
if (dict.readIfPresent("faceType", faceTypeMethod))
|
||||
{
|
||||
faceType[surfI] =
|
||||
refinementSurfaces::faceZoneTypeNames[faceTypeMethod];
|
||||
}
|
||||
}
|
||||
// Surface zones
|
||||
surfZones.set(surfI, new surfaceZonesInfo(surface, shapeDict));
|
||||
|
||||
|
||||
// Global perpendicular angle
|
||||
if (dict.found("patchInfo"))
|
||||
if (shapeDict.found("patchInfo"))
|
||||
{
|
||||
globalPatchInfo.set
|
||||
(
|
||||
surfI,
|
||||
dict.subDict("patchInfo").clone()
|
||||
shapeDict.subDict("patchInfo").clone()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Per region override of patchInfo
|
||||
|
||||
if (dict.found("regions"))
|
||||
if (shapeDict.found("regions"))
|
||||
{
|
||||
const dictionary& regionsDict = dict.subDict("regions");
|
||||
const dictionary& regionsDict = shapeDict.subDict("regions");
|
||||
const wordList& regionNames =
|
||||
allGeometry[surfaces[surfI]].regions();
|
||||
|
||||
@ -333,6 +244,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surfI++;
|
||||
}
|
||||
}
|
||||
@ -403,11 +315,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
allGeometry,
|
||||
surfaces,
|
||||
names,
|
||||
faceZoneNames,
|
||||
cellZoneNames,
|
||||
zoneInside,
|
||||
zoneInsidePoints,
|
||||
faceType,
|
||||
surfZones,
|
||||
regionOffset,
|
||||
minLevel,
|
||||
maxLevel,
|
||||
@ -706,11 +614,6 @@ int main(int argc, char *argv[])
|
||||
"boundBox",
|
||||
"simplify the surface using snappyHexMesh starting from a boundBox"
|
||||
);
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
"writeLevel",
|
||||
"write pointLevel and cellLevel postprocessing files"
|
||||
);
|
||||
Foam::argList::addOption
|
||||
(
|
||||
"patches",
|
||||
@ -732,7 +635,6 @@ int main(int argc, char *argv[])
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
const bool checkGeometry = args.optionFound("checkGeometry");
|
||||
const bool surfaceSimplify = args.optionFound("surfaceSimplify");
|
||||
const bool writeLevel = args.optionFound("writeLevel");
|
||||
|
||||
autoPtr<fvMesh> meshPtr;
|
||||
|
||||
@ -944,6 +846,8 @@ int main(int argc, char *argv[])
|
||||
autoLayerDriver::debug = debug;
|
||||
}
|
||||
|
||||
const bool writeLevel = meshDict.lookupOrDefault<bool>("writeLevel", false);
|
||||
|
||||
|
||||
// Read geometry
|
||||
// ~~~~~~~~~~~~~
|
||||
@ -1188,7 +1092,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< surfaces.names()[surfI] << ':' << nl << nl;
|
||||
|
||||
if (surfaces.faceZoneNames()[surfI].empty())
|
||||
if (surfaces.surfZones()[surfI].faceZoneName().empty())
|
||||
{
|
||||
// 'Normal' surface
|
||||
forAll(regNames, i)
|
||||
|
||||
@ -39,6 +39,31 @@ using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||
volField
|
||||
(
|
||||
const fvMeshSubset& meshSubsetter,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
)
|
||||
{
|
||||
if (meshSubsetter.hasSubMesh())
|
||||
{
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> > tfld
|
||||
(
|
||||
meshSubsetter.interpolate(vf)
|
||||
);
|
||||
tfld().checkOut();
|
||||
tfld().rename(vf.name());
|
||||
return tfld;
|
||||
}
|
||||
else
|
||||
{
|
||||
return vf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Field<Type> map
|
||||
(
|
||||
@ -680,7 +705,7 @@ void ensightPointField
|
||||
template<class Type>
|
||||
void ensightField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const ensightMesh& eMesh,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
@ -690,14 +715,11 @@ void ensightField
|
||||
Ostream& ensightCaseFile
|
||||
)
|
||||
{
|
||||
// Read field
|
||||
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, eMesh.mesh());
|
||||
|
||||
if (nodeValues)
|
||||
{
|
||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > pfld
|
||||
(
|
||||
volPointInterpolation::New(eMesh.mesh()).interpolate(vf)
|
||||
volPointInterpolation::New(vf.mesh()).interpolate(vf)
|
||||
);
|
||||
pfld().rename(vf.name());
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,13 +35,24 @@ SourceFiles
|
||||
#define ensightField_H
|
||||
|
||||
#include "ensightMesh.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Wrapper to get hold of the field or the subsetted field
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||
volField
|
||||
(
|
||||
const Foam::fvMeshSubset&,
|
||||
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void ensightField
|
||||
(
|
||||
const Foam::IOobject& fieldObject,
|
||||
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
|
||||
const Foam::ensightMesh& eMesh,
|
||||
const Foam::fileName& postProcPath,
|
||||
const Foam::word& prepend,
|
||||
|
||||
@ -57,14 +57,6 @@ void Foam::ensightMesh::correct()
|
||||
nFaceZonePrims_ = 0;
|
||||
boundaryFaceToBeIncluded_.clear();
|
||||
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
if (!noPatches_)
|
||||
{
|
||||
// Patches are output. Check that they're synced.
|
||||
@ -111,6 +103,16 @@ void Foam::ensightMesh::correct()
|
||||
}
|
||||
else
|
||||
{
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||
const cellModel& wedge = *(cellModeller::lookup("wedge"));
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
|
||||
|
||||
// Count the shapes
|
||||
labelList& tets = meshCellSets_.tets;
|
||||
labelList& pyrs = meshCellSets_.pyrs;
|
||||
@ -926,8 +928,10 @@ void Foam::ensightMesh::writeAllNSided
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeAllInternalPoints
|
||||
void Foam::ensightMesh::writeAllPoints
|
||||
(
|
||||
const label ensightPartI,
|
||||
const word& ensightPartName,
|
||||
const pointField& uniquePoints,
|
||||
const label nPoints,
|
||||
ensightStream& ensightGeometryFile
|
||||
@ -937,49 +941,8 @@ void Foam::ensightMesh::writeAllInternalPoints
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile.writePartHeader(1);
|
||||
ensightGeometryFile.write("internalMesh");
|
||||
ensightGeometryFile.write("coordinates");
|
||||
ensightGeometryFile.write(nPoints);
|
||||
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
ensightGeometryFile.write(uniquePoints.component(d));
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pointsComponent(fromSlave);
|
||||
ensightGeometryFile.write(pointsComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeAllPatchPoints
|
||||
(
|
||||
const label ensightPatchI,
|
||||
const word& patchName,
|
||||
const pointField& uniquePoints,
|
||||
const label nPoints,
|
||||
ensightStream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
barrier();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile.writePartHeader(ensightPatchI);
|
||||
ensightGeometryFile.write(patchName.c_str());
|
||||
ensightGeometryFile.writePartHeader(ensightPartI);
|
||||
ensightGeometryFile.write(ensightPartName.c_str());
|
||||
ensightGeometryFile.write("coordinates");
|
||||
ensightGeometryFile.write(nPoints);
|
||||
|
||||
@ -998,11 +961,7 @@ void Foam::ensightMesh::writeAllPatchPoints
|
||||
{
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
OPstream toMaster
|
||||
(
|
||||
Pstream::scheduled,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
@ -1076,8 +1035,10 @@ void Foam::ensightMesh::write
|
||||
|
||||
const pointField uniquePoints(mesh_.points(), uniquePointMap_);
|
||||
|
||||
writeAllInternalPoints
|
||||
writeAllPoints
|
||||
(
|
||||
1,
|
||||
"internalMesh",
|
||||
uniquePoints,
|
||||
nPoints,
|
||||
ensightGeometryFile
|
||||
@ -1166,7 +1127,7 @@ void Foam::ensightMesh::write
|
||||
inplaceRenumber(pointToGlobal, patchFaces[i]);
|
||||
}
|
||||
|
||||
writeAllPatchPoints
|
||||
writeAllPoints
|
||||
(
|
||||
ensightPatchI++,
|
||||
patchName,
|
||||
@ -1271,7 +1232,7 @@ void Foam::ensightMesh::write
|
||||
inplaceRenumber(pointToGlobal, faceZoneMasterFaces[i]);
|
||||
}
|
||||
|
||||
writeAllPatchPoints
|
||||
writeAllPoints
|
||||
(
|
||||
ensightPatchI++,
|
||||
faceZoneName,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -244,17 +244,10 @@ private:
|
||||
ensightStream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllInternalPoints
|
||||
void writeAllPoints
|
||||
(
|
||||
const pointField& uniquePoints,
|
||||
const label nPoints,
|
||||
ensightStream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllPatchPoints
|
||||
(
|
||||
label ensightPatchI,
|
||||
const word& patchName,
|
||||
const label ensightPartI,
|
||||
const word& ensightPartName,
|
||||
const pointField& uniquePoints,
|
||||
const label nPoints,
|
||||
ensightStream& ensightGeometryFile
|
||||
|
||||
@ -46,6 +46,9 @@ Usage
|
||||
\param -faceZones zoneList \n
|
||||
Specify faceZones to write, with wildcards
|
||||
|
||||
\param -cellZone zoneName \n
|
||||
Specify single cellZone to write (not lagrangian)
|
||||
|
||||
Note
|
||||
Parallel support for cloud data is not supported
|
||||
- writes to \a EnSight directory to avoid collisions with foamToEnsightParts
|
||||
@ -72,6 +75,9 @@ Note
|
||||
|
||||
#include "fvc.H"
|
||||
|
||||
#include "cellSet.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -128,6 +134,12 @@ int main(int argc, char *argv[])
|
||||
"wordReList",
|
||||
"specify faceZones to write - eg '( slice \"mfp-.*\" )'."
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"cellZone",
|
||||
"word",
|
||||
"specify cellZone to write"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
@ -212,9 +224,28 @@ int main(int argc, char *argv[])
|
||||
zonePatterns = wordReList(args.optionLookup("faceZones")());
|
||||
}
|
||||
|
||||
word cellZoneName;
|
||||
const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
|
||||
|
||||
fvMeshSubset meshSubsetter(mesh);
|
||||
if (doCellZone)
|
||||
{
|
||||
Info<< "Converting cellZone " << cellZoneName
|
||||
<< " only (puts outside faces into patch "
|
||||
<< mesh.boundaryMesh()[0].name()
|
||||
<< ")" << endl;
|
||||
const cellZone& cz = mesh.cellZones()[cellZoneName];
|
||||
cellSet c0(mesh, "c0", labelHashSet(cz));
|
||||
meshSubsetter.setLargeCellSubset(c0, 0);
|
||||
}
|
||||
|
||||
ensightMesh eMesh
|
||||
(
|
||||
mesh,
|
||||
(
|
||||
meshSubsetter.hasSubMesh()
|
||||
? meshSubsetter.subMesh()
|
||||
: meshSubsetter.baseMesh()
|
||||
),
|
||||
args.optionFound("noPatches"),
|
||||
selectedPatches,
|
||||
patchPatterns,
|
||||
@ -349,6 +380,17 @@ int main(int argc, char *argv[])
|
||||
Info<< "Translating time = " << runTime.timeName() << nl;
|
||||
|
||||
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
||||
if (timeIndex != 0 && meshSubsetter.hasSubMesh())
|
||||
{
|
||||
Info<< "Converting cellZone " << cellZoneName
|
||||
<< " only (puts outside faces into patch "
|
||||
<< mesh.boundaryMesh()[0].name()
|
||||
<< ")" << endl;
|
||||
const cellZone& cz = mesh.cellZones()[cellZoneName];
|
||||
cellSet c0(mesh, "c0", labelHashSet(cz));
|
||||
meshSubsetter.setLargeCellSubset(c0, 0);
|
||||
}
|
||||
|
||||
|
||||
if (meshState != polyMesh::UNCHANGED)
|
||||
{
|
||||
@ -406,9 +448,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (volFieldTypes[i] == volScalarField::typeName)
|
||||
{
|
||||
volScalarField vf(fieldObject, mesh);
|
||||
ensightField<scalar>
|
||||
(
|
||||
fieldObject,
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
@ -420,9 +463,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (volFieldTypes[i] == volVectorField::typeName)
|
||||
{
|
||||
volVectorField vf(fieldObject, mesh);
|
||||
ensightField<vector>
|
||||
(
|
||||
fieldObject,
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
@ -434,9 +478,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (volFieldTypes[i] == volSphericalTensorField::typeName)
|
||||
{
|
||||
volSphericalTensorField vf(fieldObject, mesh);
|
||||
ensightField<sphericalTensor>
|
||||
(
|
||||
fieldObject,
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
@ -448,9 +493,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (volFieldTypes[i] == volSymmTensorField::typeName)
|
||||
{
|
||||
volSymmTensorField vf(fieldObject, mesh);
|
||||
ensightField<symmTensor>
|
||||
(
|
||||
fieldObject,
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
@ -462,9 +508,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (volFieldTypes[i] == volTensorField::typeName)
|
||||
{
|
||||
volTensorField vf(fieldObject, mesh);
|
||||
ensightField<tensor>
|
||||
(
|
||||
fieldObject,
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
|
||||
@ -952,8 +952,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAllConstIter(dictionary, dict, iter)
|
||||
{
|
||||
if (!iter().isDict())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const dictionary& surfaceDict = iter().dict();
|
||||
|
||||
if (!surfaceDict.found("extractionMethod"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const word extractionMethod = surfaceDict.lookup("extractionMethod");
|
||||
|
||||
const fileName surfFileName = iter().keyword();
|
||||
const fileName sFeatFileName = surfFileName.lessExt().name();
|
||||
|
||||
@ -971,8 +983,6 @@ int main(int argc, char *argv[])
|
||||
const Switch closeness =
|
||||
surfaceDict.lookupOrDefault<Switch>("closeness", "off");
|
||||
|
||||
const word extractionMethod = surfaceDict.lookup("extractionMethod");
|
||||
|
||||
|
||||
Info<< nl << "Feature line extraction is only valid on closed manifold "
|
||||
<< "surfaces." << endl;
|
||||
|
||||
Reference in New Issue
Block a user