Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	applications/utilities/surface/surfaceCheck/surfaceCheck.C
This commit is contained in:
mattijs
2016-11-02 12:06:05 +00:00
6084 changed files with 146043 additions and 122074 deletions

View File

@ -72,17 +72,17 @@ void modifyOrAddFace
(
polyTopoChange& meshMod,
const face& f,
const label faceI,
const label facei,
const label own,
const bool flipFaceFlux,
const label newPatchI,
const label newPatchi,
const label zoneID,
const bool zoneFlip,
PackedBoolList& modifiedFace
)
{
if (!modifiedFace[faceI])
if (!modifiedFace[facei])
{
// First usage of face. Modify.
meshMod.setAction
@ -90,17 +90,17 @@ void modifyOrAddFace
polyModifyFace
(
f, // modified face
faceI, // label of face
facei, // label of face
own, // owner
-1, // neighbour
flipFaceFlux, // face flip
newPatchI, // patch for face
newPatchi, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
modifiedFace[faceI] = 1;
modifiedFace[facei] = 1;
}
else
{
@ -114,9 +114,9 @@ void modifyOrAddFace
-1, // neighbour
-1, // master point
-1, // master edge
faceI, // master face
facei, // master face
flipFaceFlux, // face flip
newPatchI, // patch for face
newPatchi, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
@ -130,7 +130,7 @@ void subsetVolFields
(
const fvMeshSubset& subsetter,
const IOobjectList& objectsList,
const label patchI,
const label patchi,
const Type& exposedValue,
const word GeomVolType,
PtrList<GeometricField<Type, fvPatchField, volMesh>>& subFields
@ -156,17 +156,17 @@ void subsetVolFields
subFields.set(i, subsetter.interpolate(volField));
// Explicitly set exposed faces (in patchI) to exposedValue.
if (patchI >= 0)
// Explicitly set exposed faces (in patchi) to exposedValue.
if (patchi >= 0)
{
fvPatchField<Type>& fld =
subFields[i++].boundaryField()[patchI];
subFields[i++].boundaryFieldRef()[patchi];
label newStart = fld.patch().patch().start();
label oldPatchI = subsetter.patchMap()[patchI];
label oldPatchi = subsetter.patchMap()[patchi];
if (oldPatchI == -1)
if (oldPatchi == -1)
{
// New patch. Reset whole value.
fld = exposedValue;
@ -175,17 +175,17 @@ void subsetVolFields
{
// Reset those faces that originate from different patch
// or internal faces.
label oldSize = volField.boundaryField()[oldPatchI].size();
label oldSize = volField.boundaryField()[oldPatchi].size();
label oldStart = volField.boundaryField()
[
oldPatchI
oldPatchi
].patch().patch().start();
forAll(fld, j)
{
label oldFaceI = subsetter.faceMap()[newStart+j];
label oldFacei = subsetter.faceMap()[newStart+j];
if (oldFaceI < oldStart || oldFaceI >= oldStart+oldSize)
if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
{
fld[j] = exposedValue;
}
@ -202,7 +202,7 @@ void subsetSurfaceFields
(
const fvMeshSubset& subsetter,
const IOobjectList& objectsList,
const label patchI,
const label patchi,
const Type& exposedValue,
const word GeomSurfType,
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& subFields
@ -229,17 +229,17 @@ void subsetSurfaceFields
subFields.set(i, subsetter.interpolate(volField));
// Explicitly set exposed faces (in patchI) to exposedValue.
if (patchI >= 0)
// Explicitly set exposed faces (in patchi) to exposedValue.
if (patchi >= 0)
{
fvsPatchField<Type>& fld =
subFields[i++].boundaryField()[patchI];
subFields[i++].boundaryFieldRef()[patchi];
label newStart = fld.patch().patch().start();
label oldPatchI = subsetter.patchMap()[patchI];
label oldPatchi = subsetter.patchMap()[patchi];
if (oldPatchI == -1)
if (oldPatchi == -1)
{
// New patch. Reset whole value.
fld = exposedValue;
@ -248,17 +248,17 @@ void subsetSurfaceFields
{
// Reset those faces that originate from different patch
// or internal faces.
label oldSize = volField.boundaryField()[oldPatchI].size();
label oldSize = volField.boundaryField()[oldPatchi].size();
label oldStart = volField.boundaryField()
[
oldPatchI
oldPatchi
].patch().patch().start();
forAll(fld, j)
{
label oldFaceI = subsetter.faceMap()[newStart+j];
label oldFacei = subsetter.faceMap()[newStart+j];
if (oldFaceI < oldStart || oldFaceI >= oldStart+oldSize)
if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
{
fld[j] = exposedValue;
}
@ -295,16 +295,19 @@ void initCreatedPatches
{
GeoField& field = const_cast<GeoField&>(*fieldIter());
forAll(field.boundaryField(), patchi)
typename GeoField::Boundary& fieldBf =
field.boundaryFieldRef();
forAll(fieldBf, patchi)
{
if (map.oldPatchSizes()[patchi] == 0)
{
// Not mapped.
field.boundaryField()[patchi] = initValue;
fieldBf[patchi] = initValue;
if (field.boundaryField()[patchi].fixesValue())
if (fieldBf[patchi].fixesValue())
{
field.boundaryField()[patchi] == initValue;
fieldBf[patchi] == initValue;
}
}
}
@ -322,18 +325,18 @@ void createCoupledBaffles
{
const faceZoneMesh& faceZones = mesh.faceZones();
forAll(coupledWantedPatch, faceI)
forAll(coupledWantedPatch, facei)
{
if (coupledWantedPatch[faceI] != -1)
if (coupledWantedPatch[facei] != -1)
{
const face& f = mesh.faces()[faceI];
label zoneID = faceZones.whichZone(faceI);
const face& f = mesh.faces()[facei];
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Use owner side of face
@ -341,34 +344,34 @@ void createCoupledBaffles
(
meshMod,
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI], // owner
facei, // label of face
mesh.faceOwner()[facei], // owner
false, // face flip
coupledWantedPatch[faceI], // patch for face
coupledWantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add status
);
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
label zoneID = faceZones.whichZone(faceI);
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Use neighbour side of face
modifyOrAddFace
(
meshMod,
f.reverseFace(), // modified face
faceI, // label of face
mesh.faceNeighbour()[faceI],// owner
facei, // label of face
mesh.faceNeighbour()[facei],// owner
false, // face flip
coupledWantedPatch[faceI], // patch for face
coupledWantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add status
@ -390,29 +393,29 @@ void createCyclicCoupledBaffles
{
const faceZoneMesh& faceZones = mesh.faceZones();
forAll(cyclicMasterPatch, faceI)
forAll(cyclicMasterPatch, facei)
{
if (cyclicMasterPatch[faceI] != -1)
if (cyclicMasterPatch[facei] != -1)
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
label zoneID = faceZones.whichZone(faceI);
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
modifyOrAddFace
(
meshMod,
f.reverseFace(), // modified face
faceI, // label of face
mesh.faceNeighbour()[faceI], // owner
facei, // label of face
mesh.faceNeighbour()[facei], // owner
false, // face flip
cyclicMasterPatch[faceI], // patch for face
cyclicMasterPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add
@ -420,30 +423,30 @@ void createCyclicCoupledBaffles
}
}
forAll(cyclicSlavePatch, faceI)
forAll(cyclicSlavePatch, facei)
{
if (cyclicSlavePatch[faceI] != -1)
if (cyclicSlavePatch[facei] != -1)
{
const face& f = mesh.faces()[faceI];
if (mesh.isInternalFace(faceI))
const face& f = mesh.faces()[facei];
if (mesh.isInternalFace(facei))
{
label zoneID = faceZones.whichZone(faceI);
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
// Use owner side of face
modifyOrAddFace
(
meshMod,
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI], // owner
facei, // label of face
mesh.faceOwner()[facei], // owner
false, // face flip
cyclicSlavePatch[faceI], // patch for face
cyclicSlavePatch[facei], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
modifiedFace // modify or add status
@ -463,19 +466,19 @@ void createBaffles
{
const faceZoneMesh& faceZones = mesh.faceZones();
Info << "faceZone:createBaffle " << faceZones << endl;
forAll(wantedPatch, faceI)
forAll(wantedPatch, facei)
{
if (wantedPatch[faceI] != -1)
if (wantedPatch[facei] != -1)
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
label zoneID = faceZones.whichZone(faceI);
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.setAction
@ -483,26 +486,26 @@ void createBaffles
polyModifyFace
(
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI], // owner
facei, // label of face
mesh.faceOwner()[facei], // owner
-1, // neighbour
false, // face flip
wantedPatch[faceI], // patch for face
wantedPatch[facei], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
label zoneID = faceZones.whichZone(faceI);
label zoneID = faceZones.whichZone(facei);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.setAction
@ -510,13 +513,13 @@ void createBaffles
polyAddFace
(
f.reverseFace(), // modified face
mesh.faceNeighbour()[faceI],// owner
mesh.faceNeighbour()[facei],// owner
-1, // neighbour
-1, // masterPointID
-1, // masterEdgeID
faceI, // masterFaceID,
facei, // masterFaceID,
false, // face flip
wantedPatch[faceI], // patch for face
wantedPatch[facei], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
@ -530,9 +533,9 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{
label patchI = patches.findPatchID(patchName);
label patchi = patches.findPatchID(patchName);
if (patchI == -1)
if (patchi == -1)
{
FatalErrorInFunction
<< "Illegal patch " << patchName
@ -542,20 +545,20 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
// Check same patch for all procs
{
label newPatch = patchI;
label newPatch = patchi;
reduce(newPatch, minOp<label>());
if (newPatch != patchI)
if (newPatch != patchi)
{
FatalErrorInFunction
<< "Patch " << patchName
<< " should have the same patch index on all processors." << nl
<< "On my processor it has index " << patchI
<< "On my processor it has index " << patchi
<< " ; on some other processor it has index " << newPatch
<< exit(FatalError);
}
}
return patchI;
return patchi;
}
@ -645,7 +648,7 @@ int main(int argc, char *argv[])
{
faceSet fSet(mesh, setsAndPatches[setI][0]);
label patchI = findPatch
label patchi = findPatch
(
mesh.boundaryMesh(),
setsAndPatches[setI][1]
@ -662,7 +665,7 @@ int main(int argc, char *argv[])
<< " but also in patch " << wantedPatch[iter.key()]
<< exit(FatalError);
}
wantedPatch[iter.key()] = patchI;
wantedPatch[iter.key()] = patchi;
}
}
@ -687,7 +690,7 @@ int main(int argc, char *argv[])
);
faceSet fSet(mesh, coupledAndPatches[setI][0]);
label patchI = findPatch(patches, coupledAndPatches[setI][1]);
label patchi = findPatch(patches, coupledAndPatches[setI][1]);
forAllConstIter(faceSet, fSet, iter)
{
@ -700,14 +703,14 @@ int main(int argc, char *argv[])
<< " but also in patch " << coupledWantedPatch[iter.key()]
<< exit(FatalError);
}
coupledWantedPatch[iter.key()] = patchI;
coupledWantedPatch[iter.key()] = patchi;
cyclicWantedPatch_half0[iter.key()] = cyclicId;
cyclicWantedPatch_half1[iter.key()] = cyclicSlaveId;
}
}
// Exposed faces patch
label defaultPatchI = findPatch(mesh.boundaryMesh(), defaultPatch);
label defaultPatchi = findPatch(mesh.boundaryMesh(), defaultPatch);
//
@ -726,7 +729,7 @@ int main(int argc, char *argv[])
blockedCells.invert(mesh.nCells());
// Create subsetted mesh.
subsetter.setLargeCellSubset(blockedCells, defaultPatchI, true);
subsetter.setLargeCellSubset(blockedCells, defaultPatchi, true);
}
@ -784,7 +787,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
scalar(Zero),
volScalarField::typeName,
scalarFlds
@ -796,7 +799,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
vector(Zero),
volVectorField::typeName,
vectorFlds
@ -814,7 +817,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
sphericalTensor(Zero),
volSphericalTensorField::typeName,
sphericalTensorFlds
@ -826,7 +829,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
symmTensor(Zero),
volSymmTensorField::typeName,
symmTensorFlds
@ -838,7 +841,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
tensor(Zero),
volTensorField::typeName,
tensorFlds
@ -852,7 +855,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
scalar(Zero),
surfaceScalarField::typeName,
surfScalarFlds
@ -864,7 +867,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
vector(Zero),
surfaceVectorField::typeName,
surfVectorFlds
@ -882,7 +885,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
sphericalTensor(Zero),
surfaceSphericalTensorField::typeName,
surfSphericalTensorFlds
@ -902,7 +905,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
symmTensor(Zero),
surfaceSymmTensorField::typeName,
surfSymmTensorFlds
@ -914,7 +917,7 @@ int main(int argc, char *argv[])
(
subsetter,
objects,
defaultPatchI,
defaultPatchi,
tensor(Zero),
surfaceTensorField::typeName,
surfTensorFlds

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ defineTypeNameAndDebug(cellSplitter, 0);
void Foam::cellSplitter::getFaceInfo
(
const label faceI,
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
@ -54,12 +54,12 @@ void Foam::cellSplitter::getFaceInfo
{
patchID = -1;
if (!mesh_.isInternalFace(faceI))
if (!mesh_.isInternalFace(facei))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
patchID = mesh_.boundaryMesh().whichPatch(facei);
}
zoneID = mesh_.faceZones().whichZone(faceI);
zoneID = mesh_.faceZones().whichZone(facei);
zoneFlip = false;
@ -67,20 +67,20 @@ void Foam::cellSplitter::getFaceInfo
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
}
// Find the new owner of faceI (since the original cell has been split into
// Find the new owner of facei (since the original cell has been split into
// newCells
Foam::label Foam::cellSplitter::newOwner
(
const label faceI,
const label facei,
const Map<labelList>& cellToCells
) const
{
label oldOwn = mesh_.faceOwner()[faceI];
label oldOwn = mesh_.faceOwner()[facei];
Map<labelList>::const_iterator fnd = cellToCells.find(oldOwn);
@ -97,18 +97,18 @@ Foam::label Foam::cellSplitter::newOwner
const cell& cFaces = mesh_.cells()[oldOwn];
return newCells[findIndex(cFaces, faceI)];
return newCells[findIndex(cFaces, facei)];
}
}
Foam::label Foam::cellSplitter::newNeighbour
(
const label faceI,
const label facei,
const Map<labelList>& cellToCells
) const
{
label oldNbr = mesh_.faceNeighbour()[faceI];
label oldNbr = mesh_.faceNeighbour()[facei];
Map<labelList>::const_iterator fnd = cellToCells.find(oldNbr);
@ -125,7 +125,7 @@ Foam::label Foam::cellSplitter::newNeighbour
const cell& cFaces = mesh_.cells()[oldNbr];
return newCells[findIndex(cFaces, faceI)];
return newCells[findIndex(cFaces, facei)];
}
}
@ -164,11 +164,11 @@ void Foam::cellSplitter::setRefinement
forAllConstIter(Map<point>, cellToMidPoint, iter)
{
label cellI = iter.key();
label celli = iter.key();
label anchorPoint = mesh_.cellPoints()[cellI][0];
label anchorPoint = mesh_.cellPoints()[celli][0];
label addedPointI =
label addedPointi =
meshMod.setAction
(
polyAddPoint
@ -179,11 +179,11 @@ void Foam::cellSplitter::setRefinement
true // supports a cell
)
);
addedPoints_.insert(cellI, addedPointI);
addedPoints_.insert(celli, addedPointi);
//Pout<< "Added point " << addedPointI
// << iter() << " in cell " << cellI << " with centre "
// << mesh_.cellCentres()[cellI] << endl;
//Pout<< "Added point " << addedPointi
// << iter() << " in cell " << celli << " with centre "
// << mesh_.cellCentres()[celli] << endl;
}
@ -195,20 +195,20 @@ void Foam::cellSplitter::setRefinement
forAllConstIter(Map<point>, cellToMidPoint, iter)
{
label cellI = iter.key();
label celli = iter.key();
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
// Cells created for this cell.
labelList newCells(cFaces.size());
// First pyramid is the original cell
newCells[0] = cellI;
newCells[0] = celli;
// Add other pyramids
for (label i = 1; i < cFaces.size(); i++)
{
label addedCellI =
label addedCelli =
meshMod.setAction
(
polyAddCell
@ -216,18 +216,18 @@ void Foam::cellSplitter::setRefinement
-1, // master point
-1, // master edge
-1, // master face
cellI, // master cell
celli, // master cell
-1 // zone
)
);
newCells[i] = addedCellI;
newCells[i] = addedCelli;
}
cellToCells.insert(cellI, newCells);
cellToCells.insert(celli, newCells);
//Pout<< "Split cell " << cellI
// << " with centre " << mesh_.cellCentres()[cellI] << nl
//Pout<< "Split cell " << celli
// << " with centre " << mesh_.cellCentres()[celli] << nl
// << " faces:" << cFaces << nl
// << " into :" << newCells << endl;
}
@ -240,13 +240,13 @@ void Foam::cellSplitter::setRefinement
forAllConstIter(Map<point>, cellToMidPoint, iter)
{
label cellI = iter.key();
label celli = iter.key();
label midPointI = addedPoints_[cellI];
label midPointi = addedPoints_[celli];
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
const labelList& cEdges = mesh_.cellEdges()[cellI];
const labelList& cEdges = mesh_.cellEdges()[celli];
forAll(cEdges, i)
{
@ -255,11 +255,11 @@ void Foam::cellSplitter::setRefinement
// Get the faces on the cell using the edge
label face0, face1;
meshTools::getEdgeFaces(mesh_, cellI, edgeI, face0, face1);
meshTools::getEdgeFaces(mesh_, celli, edgeI, face0, face1);
// Get the cells on both sides of the face by indexing into cFaces.
// (since newly created cells are stored in cFaces order)
const labelList& newCells = cellToCells[cellI];
const labelList& newCells = cellToCells[celli];
label cell0 = newCells[findIndex(cFaces, face0)];
label cell1 = newCells[findIndex(cFaces, face1)];
@ -267,7 +267,7 @@ void Foam::cellSplitter::setRefinement
if (cell0 < cell1)
{
// Construct face to midpoint that is pointing away from
// (pyramid split off from) cellI
// (pyramid split off from) celli
const face& f0 = mesh_.faces()[face0];
@ -275,21 +275,21 @@ void Foam::cellSplitter::setRefinement
bool edgeInFaceOrder = (f0[f0.fcIndex(index)] == e[1]);
// Check if cellI is the face owner
// Check if celli is the face owner
face newF(3);
if (edgeInFaceOrder == (mesh_.faceOwner()[face0] == cellI))
if (edgeInFaceOrder == (mesh_.faceOwner()[face0] == celli))
{
// edge used in face order.
newF[0] = e[1];
newF[1] = e[0];
newF[2] = midPointI;
newF[2] = midPointi;
}
else
{
newF[0] = e[0];
newF[1] = e[1];
newF[2] = midPointI;
newF[2] = midPointi;
}
// Now newF points away from cell0
@ -313,7 +313,7 @@ void Foam::cellSplitter::setRefinement
else
{
// Construct face to midpoint that is pointing away from
// (pyramid split off from) cellI
// (pyramid split off from) celli
const face& f1 = mesh_.faces()[face1];
@ -321,21 +321,21 @@ void Foam::cellSplitter::setRefinement
bool edgeInFaceOrder = (f1[f1.fcIndex(index)] == e[1]);
// Check if cellI is the face owner
// Check if celli is the face owner
face newF(3);
if (edgeInFaceOrder == (mesh_.faceOwner()[face1] == cellI))
if (edgeInFaceOrder == (mesh_.faceOwner()[face1] == celli))
{
// edge used in face order.
newF[0] = e[1];
newF[1] = e[0];
newF[2] = midPointI;
newF[2] = midPointi;
}
else
{
newF[0] = e[0];
newF[1] = e[1];
newF[2] = midPointI;
newF[2] = midPointi;
}
// Now newF points away from cell1
@ -370,28 +370,28 @@ void Foam::cellSplitter::setRefinement
forAllConstIter(Map<point>, cellToMidPoint, iter)
{
label cellI = iter.key();
label celli = iter.key();
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
forAll(cFaces, i)
{
label faceI = cFaces[i];
label facei = cFaces[i];
faceUpToDate[faceI] = false;
faceUpToDate[facei] = false;
}
}
forAll(faceUpToDate, faceI)
forAll(faceUpToDate, facei)
{
if (!faceUpToDate[faceI])
if (!faceUpToDate[facei])
{
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
label newOwn = newOwner(faceI, cellToCells);
label newNbr = newNeighbour(faceI, cellToCells);
label newOwn = newOwner(facei, cellToCells);
label newNbr = newNeighbour(facei, cellToCells);
if (newOwn < newNbr)
{
@ -400,7 +400,7 @@ void Foam::cellSplitter::setRefinement
polyModifyFace
(
f,
faceI,
facei,
newOwn, // owner
newNbr, // neighbour
false, // flux flip
@ -418,7 +418,7 @@ void Foam::cellSplitter::setRefinement
polyModifyFace
(
f.reverseFace(),
faceI,
facei,
newNbr, // owner
newOwn, // neighbour
false, // flux flip
@ -433,17 +433,17 @@ void Foam::cellSplitter::setRefinement
}
else
{
label newOwn = newOwner(faceI, cellToCells);
label newOwn = newOwner(facei, cellToCells);
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
getFaceInfo(facei, patchID, zoneID, zoneFlip);
meshMod.setAction
(
polyModifyFace
(
mesh_.faces()[faceI],
faceI,
mesh_.faces()[facei],
facei,
newOwn, // owner
-1, // neighbour
false, // flux flip
@ -455,7 +455,7 @@ void Foam::cellSplitter::setRefinement
);
}
faceUpToDate[faceI] = true;
faceUpToDate[facei] = true;
}
}
}
@ -469,17 +469,17 @@ void Foam::cellSplitter::updateMesh(const mapPolyMesh& morphMap)
forAllConstIter(Map<label>, addedPoints_, iter)
{
label oldCellI = iter.key();
label oldCelli = iter.key();
label newCellI = morphMap.reverseCellMap()[oldCellI];
label newCelli = morphMap.reverseCellMap()[oldCelli];
label oldPointI = iter();
label oldPointi = iter();
label newPointI = morphMap.reversePointMap()[oldPointI];
label newPointi = morphMap.reversePointMap()[oldPointi];
if (newCellI >= 0 && newPointI >= 0)
if (newCelli >= 0 && newPointi >= 0)
{
newAddedPoints.insert(newCellI, newPointI);
newAddedPoints.insert(newCelli, newPointi);
}
}

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -71,7 +71,7 @@ class cellSplitter
//- Get patch and zone info for face
void getFaceInfo
(
const label faceI,
const label facei,
label& patchID,
label& zoneID,
label& zoneFlip
@ -80,14 +80,14 @@ class cellSplitter
//- Find the new owner (if any) of the face.
label newOwner
(
const label faceI,
const label facei,
const Map<labelList>& cellToCells
) const;
//- Find the new neighbour (if any) of the face.
label newNeighbour
(
const label faceI,
const label facei,
const Map<labelList>& cellToCells
) const;

View File

@ -82,9 +82,9 @@ label findPoint(const primitivePatch& pp, const point& nearPoint)
forAll(meshPoints, i)
{
label pointI = meshPoints[i];
label pointi = meshPoints[i];
scalar distSqr = magSqr(nearPoint - points[pointI]);
scalar distSqr = magSqr(nearPoint - points[pointi]);
if (distSqr < minDistSqr)
{
@ -92,12 +92,12 @@ label findPoint(const primitivePatch& pp, const point& nearPoint)
almostMinI = minI;
minDistSqr = distSqr;
minI = pointI;
minI = pointi;
}
else if (distSqr < almostMinDistSqr)
{
almostMinDistSqr = distSqr;
almostMinI = pointI;
almostMinI = pointi;
}
}
@ -226,9 +226,9 @@ label findFace
scalar almostMinDist = GREAT;
label almostMinI = -1;
forAll(pp, patchFaceI)
forAll(pp, patchFacei)
{
pointHit pHit(pp[patchFaceI].nearestPoint(nearPoint, points));
pointHit pHit(pp[patchFacei].nearestPoint(nearPoint, points));
if (pHit.hit())
{
@ -238,12 +238,12 @@ label findFace
almostMinI = minI;
minDist = pHit.distance();
minI = patchFaceI + mesh.nInternalFaces();
minI = patchFacei + mesh.nInternalFaces();
}
else if (pHit.distance() < almostMinDist)
{
almostMinDist = pHit.distance();
almostMinI = patchFaceI + mesh.nInternalFaces();
almostMinI = patchFacei + mesh.nInternalFaces();
}
}
}
@ -282,35 +282,35 @@ label findFace
// Find cell with cell centre close to given point.
label findCell(const primitiveMesh& mesh, const point& nearPoint)
{
label cellI = mesh.findCell(nearPoint);
label celli = mesh.findCell(nearPoint);
if (cellI != -1)
if (celli != -1)
{
scalar distToCcSqr = magSqr(nearPoint - mesh.cellCentres()[cellI]);
scalar distToCcSqr = magSqr(nearPoint - mesh.cellCentres()[celli]);
const labelList& cPoints = mesh.cellPoints()[cellI];
const labelList& cPoints = mesh.cellPoints()[celli];
label minI = -1;
scalar minDistSqr = GREAT;
forAll(cPoints, i)
{
label pointI = cPoints[i];
label pointi = cPoints[i];
scalar distSqr = magSqr(nearPoint - mesh.points()[pointI]);
scalar distSqr = magSqr(nearPoint - mesh.points()[pointi]);
if (distSqr < minDistSqr)
{
minDistSqr = distSqr;
minI = pointI;
minI = pointi;
}
}
// Decide if nearPoint unique enough.
Info<< "Found to point " << nearPoint << nl
<< " nearest cell : " << cellI
<< " nearest cell : " << celli
<< " distance " << Foam::sqrt(distToCcSqr)
<< " to cell centre " << mesh.cellCentres()[cellI] << nl
<< " to cell centre " << mesh.cellCentres()[celli] << nl
<< " nearest mesh point : " << minI
<< " distance " << Foam::sqrt(minDistSqr)
<< " to " << mesh.points()[minI] << nl
@ -321,11 +321,11 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint)
Info<< "Mesh point too close to nearest cell centre. Aborting"
<< endl;
cellI = -1;
celli = -1;
}
}
return cellI;
return celli;
}
@ -432,11 +432,11 @@ int main(int argc, char *argv[])
{
const Pair<point>& pts = pointsToMove[i];
label pointI = findPoint(allBoundary, pts.first());
label pointi = findPoint(allBoundary, pts.first());
if (pointI == -1 || !pointToPos.insert(pointI, pts.second()))
if (pointi == -1 || !pointToPos.insert(pointi, pts.second()))
{
Info<< "Could not insert mesh point " << pointI
Info<< "Could not insert mesh point " << pointi
<< " for input point " << pts.first() << nl
<< "Perhaps the point is already marked for moving?" << endl;
validInputs = false;
@ -473,11 +473,11 @@ int main(int argc, char *argv[])
{
const Pair<point>& pts = facesToTriangulate[i];
label faceI = findFace(mesh, allBoundary, pts.first());
label facei = findFace(mesh, allBoundary, pts.first());
if (faceI == -1 || !faceToDecompose.insert(faceI, pts.second()))
if (facei == -1 || !faceToDecompose.insert(facei, pts.second()))
{
Info<< "Could not insert mesh face " << faceI
Info<< "Could not insert mesh face " << facei
<< " for input point " << pts.first() << nl
<< "Perhaps the face is already marked for splitting?" << endl;
@ -494,11 +494,11 @@ int main(int argc, char *argv[])
{
const Pair<point>& pts = cellsToPyramidise[i];
label cellI = findCell(mesh, pts.first());
label celli = findCell(mesh, pts.first());
if (cellI == -1 || !cellToPyrCentre.insert(cellI, pts.second()))
if (celli == -1 || !cellToPyrCentre.insert(celli, pts.second()))
{
Info<< "Could not insert mesh cell " << cellI
Info<< "Could not insert mesh cell " << celli
<< " for input point " << pts.first() << nl
<< "Perhaps the cell is already marked for splitting?" << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -117,15 +117,15 @@ int main(int argc, char *argv[])
const polyPatch& pp = mesh.boundaryMesh()[iter.key()];
const labelList& meshPoints = pp.meshPoints();
forAll(meshPoints, pointI)
forAll(meshPoints, pointi)
{
label meshPointI = meshPoints[pointI];
label meshPointi = meshPoints[pointi];
const labelList& pCells = mesh.pointCells()[meshPointI];
const labelList& pCells = mesh.pointCells()[meshPointi];
forAll(pCells, pCellI)
forAll(pCells, pCelli)
{
cutCells.insert(pCells[pCellI]);
cutCells.insert(pCells[pCelli]);
}
}
}
@ -159,9 +159,9 @@ int main(int argc, char *argv[])
const polyPatch& pp = mesh.boundaryMesh()[iter.key()];
const labelList& meshPoints = pp.meshPoints();
forAll(meshPoints, pointI)
forAll(meshPoints, pointi)
{
vertOnPatch[meshPoints[pointI]] = true;
vertOnPatch[meshPoints[pointi]] = true;
}
}
@ -170,24 +170,24 @@ int main(int argc, char *argv[])
const polyPatch& pp = mesh.boundaryMesh()[iter.key()];
const labelList& meshPoints = pp.meshPoints();
forAll(meshPoints, pointI)
forAll(meshPoints, pointi)
{
label meshPointI = meshPoints[pointI];
label meshPointi = meshPoints[pointi];
const labelList& pEdges = mesh.pointEdges()[meshPointI];
const labelList& pEdges = mesh.pointEdges()[meshPointi];
forAll(pEdges, pEdgeI)
{
const label edgeI = pEdges[pEdgeI];
const edge& e = mesh.edges()[edgeI];
label otherPointI = e.otherVertex(meshPointI);
label otherPointi = e.otherVertex(meshPointi);
if (!vertOnPatch[otherPointI])
if (!vertOnPatch[otherPointi])
{
allCutEdges.append(edgeI);
if (e.start() == meshPointI)
if (e.start() == meshPointi)
{
allCutEdgeWeights.append(weight);
}

View File

@ -67,17 +67,17 @@ bool limitRefinementLevel
label oldNCells = refCells.size();
forAll(cellCells, cellI)
forAll(cellCells, celli)
{
const labelList& cCells = cellCells[cellI];
const labelList& cCells = cellCells[celli];
forAll(cCells, i)
{
if (refLevel[cCells[i]] > (refLevel[cellI]+1))
if (refLevel[cCells[i]] > (refLevel[celli]+1))
{
// Found neighbour with >=2 difference in refLevel.
refCells.insert(cellI);
refLevel[cellI]++;
refCells.insert(celli);
refLevel[celli]++;
break;
}
}
@ -224,9 +224,9 @@ int main(int argc, char *argv[])
List<polyPatch*> p(patches.size());
forAll(p, patchI)
forAll(p, patchi)
{
p[patchI] = patches[patchI].clone(fMesh.boundaryMesh()).ptr();
p[patchi] = patches[patchi].clone(fMesh.boundaryMesh()).ptr();
}
fMesh.addFvPatches(p);
@ -297,23 +297,25 @@ int main(int argc, char *argv[])
}
}
volScalarField::Boundary& postRefLevelBf =
postRefLevel.boundaryFieldRef();
// For volScalarField: set boundary values to same as cell.
// Note: could also put
// zeroGradient b.c. on postRefLevel and do evaluate.
forAll(postRefLevel.boundaryField(), patchI)
forAll(postRefLevel.boundaryField(), patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
fvPatchScalarField& bField = postRefLevel.boundaryField()[patchI];
fvPatchScalarField& bField = postRefLevelBf[patchi];
Info<< "Setting field for patch "<< endl;
forAll(bField, faceI)
forAll(bField, facei)
{
label own = mesh.faceOwner()[pp.start() + faceI];
label own = mesh.faceOwner()[pp.start() + facei];
bField[faceI] = postRefLevel[own];
bField[facei] = postRefLevel[own];
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,41 +138,41 @@ void cutBySurface
// Is a bit of a hack but allows us to reuse all the functionality
// in cellClassification.
forAll(cellType, cellI)
forAll(cellType, celli)
{
label cType = cellType[cellI];
label cType = cellType[celli];
if (cType == cellClassification::CUT)
{
if (selectCut)
{
cellType[cellI] = MESH;
cellType[celli] = MESH;
}
else
{
cellType[cellI] = NONMESH;
cellType[celli] = NONMESH;
}
}
else if (cType == cellClassification::INSIDE)
{
if (selectInside)
{
cellType[cellI] = MESH;
cellType[celli] = MESH;
}
else
{
cellType[cellI] = NONMESH;
cellType[celli] = NONMESH;
}
}
else if (cType == cellClassification::OUTSIDE)
{
if (selectOutside)
{
cellType[cellI] = MESH;
cellType[celli] = MESH;
}
else
{
cellType[cellI] = NONMESH;
cellType[celli] = NONMESH;
}
}
else
@ -195,15 +195,15 @@ void cutBySurface
label nRemoved = 0;
forAll(pts, pointI)
forAll(pts, pointi)
{
const point& pt = pts[pointI];
const point& pt = pts[pointi];
pointIndexHit hitInfo = tree.findNearest(pt, sqr(nearDist));
if (hitInfo.hit())
{
const labelList& pCells = mesh.pointCells()[pointI];
const labelList& pCells = mesh.pointCells()[pointi];
forAll(pCells, i)
{
@ -221,11 +221,11 @@ void cutBySurface
//
// label nRemoved = 0;
//
// forAll(nearest, pointI)
// forAll(nearest, pointi)
// {
// if (mag(nearest[pointI] - pts[pointI]) < nearDist)
// if (mag(nearest[pointi] - pts[pointi]) < nearDist)
// {
// const labelList& pCells = mesh.pointCells()[pointI];
// const labelList& pCells = mesh.pointCells()[pointi];
//
// forAll(pCells, i)
// {
@ -272,27 +272,27 @@ label selectOutsideCells
forAll(outsidePts, outsidePtI)
{
// Find cell containing point. Linear search.
label cellI = queryMesh.findCell(outsidePts[outsidePtI], -1, false);
label celli = queryMesh.findCell(outsidePts[outsidePtI], -1, false);
if (cellI != -1 && cellType[cellI] == MESH)
if (celli != -1 && cellType[celli] == MESH)
{
Info<< "Marking cell " << cellI << " containing outside point "
<< outsidePts[outsidePtI] << " with type " << cellType[cellI]
Info<< "Marking cell " << celli << " containing outside point "
<< outsidePts[outsidePtI] << " with type " << cellType[celli]
<< " ..." << endl;
//
// Mark this cell and its faces to start walking from
//
// Mark faces of cellI
const labelList& cFaces = mesh.cells()[cellI];
// Mark faces of celli
const labelList& cFaces = mesh.cells()[celli];
forAll(cFaces, i)
{
label faceI = cFaces[i];
label facei = cFaces[i];
if (outsideFacesMap.insert(faceI))
if (outsideFacesMap.insert(facei))
{
outsideFaces.append(faceI);
outsideFaces.append(facei);
outsideFacesInfo.append(meshInfo);
}
}
@ -314,15 +314,15 @@ label selectOutsideCells
label nChanged = 0;
forAll(allCellInfo, cellI)
forAll(allCellInfo, celli)
{
if (cellType[cellI] == MESH)
if (cellType[celli] == MESH)
{
// Original cell was selected for meshing. Check if cell was
// reached from outsidePoints
if (allCellInfo[cellI].type() != MESH)
if (allCellInfo[celli].type() != MESH)
{
cellType[cellI] = NONMESH;
cellType[celli] = NONMESH;
nChanged++;
}
}
@ -393,8 +393,8 @@ int main(int argc, char *argv[])
{
const point& outsidePoint = outsidePts[outsideI];
label cellI = queryMesh.findCell(outsidePoint, -1, false);
if (returnReduce(cellI, maxOp<label>()) == -1)
label celli = queryMesh.findCell(outsidePoint, -1, false);
if (returnReduce(celli, maxOp<label>()) == -1)
{
FatalErrorInFunction
<< "outsidePoint " << outsidePoint
@ -417,9 +417,9 @@ int main(int argc, char *argv[])
// Surface
autoPtr<triSurface> surf(NULL);
autoPtr<triSurface> surf(nullptr);
// Search engine on surface.
autoPtr<triSurfaceSearch> querySurf(NULL);
autoPtr<triSurfaceSearch> querySurf(nullptr);
if (useSurface)
{
@ -431,7 +431,7 @@ int main(int argc, char *argv[])
// Search engine on surface.
querySurf.reset(new triSurfaceSearch(surf));
// Set cellType[cellI] according to relation to surface
// Set cellType[celli] according to relation to surface
cutBySurface
(
mesh,

View File

@ -127,9 +127,9 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
const edgeList& edges = mesh.edges();
forAll(edges, edgeI)
forAll(edges, edgei)
{
const edge& e = edges[edgeI];
const edge& e = edges[edgei];
vector eVec(e.vec(mesh.points()));
@ -196,24 +196,24 @@ scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt)
// Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName)
{
label patchI = mesh.boundaryMesh().findPatchID(patchName);
label patchi = mesh.boundaryMesh().findPatchID(patchName);
if (patchI == -1)
if (patchi == -1)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size() + 1);
// Add empty patch as 0th entry (Note: only since subsetMesh wants this)
patchI = 0;
patchi = 0;
newPatches[patchI] =
newPatches[patchi] =
new emptyPolyPatch
(
Foam::word(patchName),
0,
mesh.nInternalFaces(),
patchI,
patchi,
patches,
emptyPolyPatch::typeName
);
@ -235,15 +235,15 @@ label addPatch(polyMesh& mesh, const word& patchName)
mesh.removeBoundary();
mesh.addPatches(newPatches);
Info<< "Created patch oldInternalFaces at " << patchI << endl;
Info<< "Created patch oldInternalFaces at " << patchi << endl;
}
else
{
Info<< "Reusing patch oldInternalFaces at " << patchI << endl;
Info<< "Reusing patch oldInternalFaces at " << patchi << endl;
}
return patchI;
return patchi;
}
@ -302,20 +302,20 @@ void addCutNeighbours
forAllConstIter(labelHashSet, cutCells, iter)
{
const label cellI = iter.key();
const labelList& cFaces = mesh.cells()[cellI];
const label celli = iter.key();
const labelList& cFaces = mesh.cells()[celli];
forAll(cFaces, i)
{
const label faceI = cFaces[i];
const label facei = cFaces[i];
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
label nbr = mesh.faceOwner()[faceI];
label nbr = mesh.faceOwner()[facei];
if (nbr == cellI)
if (nbr == celli)
{
nbr = mesh.faceNeighbour()[faceI];
nbr = mesh.faceNeighbour()[facei];
}
if (selectInside && inside.found(nbr))
@ -354,11 +354,11 @@ bool limitRefinementLevel
)
{
// Do simple check on validity of refinement level.
forAll(refLevel, cellI)
forAll(refLevel, celli)
{
if (!excludeCells.found(cellI))
if (!excludeCells.found(celli))
{
const labelList& cCells = mesh.cellCells()[cellI];
const labelList& cCells = mesh.cellCells()[celli];
forAll(cCells, i)
{
@ -366,13 +366,13 @@ bool limitRefinementLevel
if (!excludeCells.found(nbr))
{
if (refLevel[cellI] - refLevel[nbr] >= limitDiff)
if (refLevel[celli] - refLevel[nbr] >= limitDiff)
{
FatalErrorInFunction
<< "Level difference between neighbouring cells "
<< cellI << " and " << nbr
<< celli << " and " << nbr
<< " greater than or equal to " << limitDiff << endl
<< "refLevels:" << refLevel[cellI] << ' '
<< "refLevels:" << refLevel[celli] << ' '
<< refLevel[nbr] << abort(FatalError);
}
}
@ -386,8 +386,8 @@ bool limitRefinementLevel
forAllConstIter(labelHashSet, cutCells, iter)
{
// cellI will be refined.
const label cellI = iter.key();
const labelList& cCells = mesh.cellCells()[cellI];
const label celli = iter.key();
const labelList& cCells = mesh.cellCells()[celli];
forAll(cCells, i)
{
@ -395,7 +395,7 @@ bool limitRefinementLevel
if (!excludeCells.found(nbr) && !cutCells.found(nbr))
{
if (refLevel[cellI] + 1 - refLevel[nbr] >= limitDiff)
if (refLevel[celli] + 1 - refLevel[nbr] >= limitDiff)
{
addCutCells.insert(nbr);
}
@ -454,22 +454,22 @@ void doRefinement
refLevel.setSize(mesh.nCells());
for (label cellI = oldCells; cellI < mesh.nCells(); cellI++)
for (label celli = oldCells; celli < mesh.nCells(); celli++)
{
refLevel[cellI] = 0;
refLevel[celli] = 0;
}
const labelListList& addedCells = multiRef.addedCells();
forAll(addedCells, oldCellI)
forAll(addedCells, oldCelli)
{
const labelList& added = addedCells[oldCellI];
const labelList& added = addedCells[oldCelli];
if (added.size())
{
// Give all cells resulting from split the refinement level
// of the master.
label masterLevel = ++refLevel[oldCellI];
label masterLevel = ++refLevel[oldCelli];
forAll(added, i)
{
@ -485,7 +485,7 @@ void subsetMesh
(
polyMesh& mesh,
const label writeMesh,
const label patchI, // patchID for exposed faces
const label patchi, // patchID for exposed faces
const labelHashSet& cellsToRemove,
cellSet& cutCells,
labelIOList& refLevel
@ -506,7 +506,7 @@ void subsetMesh
(
cellLabels,
exposedFaces,
labelList(exposedFaces.size(), patchI),
labelList(exposedFaces.size(), patchi),
meshMod
);
@ -632,7 +632,7 @@ int main(int argc, char *argv[])
#include "createPolyMesh.H"
// If nessecary add oldInternalFaces patch
label newPatchI = addPatch(mesh, "oldInternalFaces");
label newPatchi = addPatch(mesh, "oldInternalFaces");
//
@ -725,9 +725,9 @@ int main(int argc, char *argv[])
meshSearch queryMesh(mesh, polyMesh::FACE_PLANES);
// Check all 'outside' points
forAll(outsidePts, outsideI)
forAll(outsidePts, outsidei)
{
const point& outsidePoint = outsidePts[outsideI];
const point& outsidePoint = outsidePts[outsidei];
if (queryMesh.findCell(outsidePoint, -1, false) == -1)
{
@ -857,7 +857,7 @@ int main(int argc, char *argv[])
{
// Subset mesh to remove inside cells altogether. Updates cutCells,
// refLevel.
subsetMesh(mesh, writeMesh, newPatchI, inside, cutCells, refLevel);
subsetMesh(mesh, writeMesh, newPatchi, inside, cutCells, refLevel);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -103,14 +103,14 @@ scalarField pack(const boolList& lst, const scalarField& elems)
// Given sin and cos of max angle between normals calculate whether f0 and f1
// on cellI make larger angle. Uses sinAngle only for quadrant detection.
// on celli make larger angle. Uses sinAngle only for quadrant detection.
bool largerAngle
(
const primitiveMesh& mesh,
const scalar cosAngle,
const scalar sinAngle,
const label cellI,
const label celli,
const label f0, // face label
const label f1,
@ -120,7 +120,7 @@ bool largerAngle
{
const labelList& own = mesh.faceOwner();
bool sameFaceOrder = !((own[f0] == cellI) ^ (own[f1] == cellI));
bool sameFaceOrder = !((own[f0] == celli) ^ (own[f1] == celli));
// Get cos between faceArea vectors. Correct so flat angle (180 degrees)
// gives -1.
@ -140,7 +140,7 @@ bool largerAngle
scalar fcCosAngle = n0 & c1c0;
if (own[f0] != cellI)
if (own[f0] != celli)
{
fcCosAngle = -fcCosAngle;
}
@ -193,7 +193,7 @@ bool largerAngle
bool splitHex
(
const polyMesh& mesh,
const label cellI,
const label celli,
const label edgeI,
DynamicList<label>& cutCells,
@ -217,13 +217,13 @@ bool splitHex
label leftFp = -1;
label rightFp = -1;
const cell& cFaces = mesh.cells()[cellI];
const cell& cFaces = mesh.cells()[celli];
forAll(cFaces, i)
{
label faceI = cFaces[i];
label facei = cFaces[i];
const face& f = faces[faceI];
const face& f = faces[facei];
label fp0 = findIndex(f, e[0]);
label fp1 = findIndex(f, e[1]);
@ -233,7 +233,7 @@ bool splitHex
if (fp1 != -1)
{
// Face uses e[1] but not e[0]
rightI = faceI;
rightI = facei;
rightFp = fp1;
if (leftI != -1)
@ -251,7 +251,7 @@ bool splitHex
}
else
{
leftI = faceI;
leftI = facei;
leftFp = fp0;
if (rightI != -1)
@ -290,7 +290,7 @@ bool splitHex
loopWeights[2] = -GREAT;
loopWeights[3] = -GREAT;
cutCells.append(cellI);
cutCells.append(celli);
cellLoops.append(loop);
cellEdgeWeights.append(loopWeights);
@ -298,13 +298,13 @@ bool splitHex
}
// Split cellI along edgeI with a plane along halfNorm direction.
// Split celli along edgeI with a plane along halfNorm direction.
bool splitCell
(
const polyMesh& mesh,
const geomCellLooper& cellCutter,
const label cellI,
const label celli,
const label edgeI,
const vector& halfNorm,
@ -342,7 +342,7 @@ bool splitCell
cellCutter.cut
(
cutPlane,
cellI,
celli,
vertIsCut,
edgeIsCut,
edgeWeight,
@ -352,7 +352,7 @@ bool splitCell
)
{
// Did manage to cut cell. Copy into overall list.
cutCells.append(cellI);
cutCells.append(celli);
cellLoops.append(loop);
cellEdgeWeights.append(loopWeights);
@ -400,15 +400,15 @@ void collectCuts
forAllConstIter(cellSet, cellsToCut, iter)
{
const label cellI = iter.key();
const labelList& cEdges = cellEdges[cellI];
const label celli = iter.key();
const labelList& cEdges = cellEdges[celli];
forAll(cEdges, i)
{
label edgeI = cEdges[i];
label f0, f1;
meshTools::getEdgeFaces(mesh, cellI, edgeI, f0, f1);
meshTools::getEdgeFaces(mesh, celli, edgeI, f0, f1);
vector n0 = faceAreas[f0];
n0 /= mag(n0);
@ -424,7 +424,7 @@ void collectCuts
minCos,
minSin,
cellI,
celli,
f0,
f1,
n0,
@ -434,13 +434,13 @@ void collectCuts
{
bool splitOk = false;
if (!geometry && cellShapes[cellI].model() == hex)
if (!geometry && cellShapes[celli].model() == hex)
{
splitOk =
splitHex
(
mesh,
cellI,
celli,
edgeI,
cutCells,
@ -452,7 +452,7 @@ void collectCuts
{
vector halfNorm;
if ((own[f0] == cellI) ^ (own[f1] == cellI))
if ((own[f0] == celli) ^ (own[f1] == celli))
{
// Opposite owner orientation
halfNorm = 0.5*(n0 - n1);
@ -469,7 +469,7 @@ void collectCuts
(
mesh,
cellCutter,
cellI,
celli,
edgeI,
halfNorm,
@ -606,9 +606,9 @@ int main(int argc, char *argv[])
if (!readSet)
{
// Try all cells for cutting
for (label cellI = 0; cellI < mesh.nCells(); cellI++)
for (label celli = 0; celli < mesh.nCells(); celli++)
{
cellsToCut.insert(cellI);
cellsToCut.insert(celli);
}
}
@ -661,13 +661,13 @@ int main(int argc, char *argv[])
}
// Remove cut cells from cellsToCut (Note:only relevant if -readSet)
forAll(cuts.cellLoops(), cellI)
forAll(cuts.cellLoops(), celli)
{
if (cuts.cellLoops()[cellI].size())
if (cuts.cellLoops()[celli].size())
{
//Info<< "Removing cut cell " << cellI << " from wishlist"
//Info<< "Removing cut cell " << celli << " from wishlist"
// << endl;
cellsToCut.erase(cellI);
cellsToCut.erase(celli);
}
}

View File

@ -18,7 +18,7 @@ $WM_THIRD_PARTY_DIR/makeCCMIO lib # libso
if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ]
then
wmake ccm26ToFoam
wmake $targetType ccm26ToFoam
fi
#------------------------------------------------------------------------------

View File

@ -71,32 +71,32 @@ labelList getInternalFaceOrder
labelList oldToNew(owner.size(), -1);
// First unassigned face
label newFaceI = 0;
label newFacei = 0;
forAll(cells, cellI)
forAll(cells, celli)
{
const labelList& cFaces = cells[cellI];
const labelList& cFaces = cells[celli];
SortableList<label> nbr(cFaces.size());
forAll(cFaces, i)
{
label faceI = cFaces[i];
label facei = cFaces[i];
label nbrCellI = neighbour[faceI];
label nbrCelli = neighbour[facei];
if (nbrCellI != -1)
if (nbrCelli != -1)
{
// Internal face. Get cell on other side.
if (nbrCellI == cellI)
if (nbrCelli == celli)
{
nbrCellI = owner[faceI];
nbrCelli = owner[facei];
}
if (cellI < nbrCellI)
if (celli < nbrCelli)
{
// CellI is master
nbr[i] = nbrCellI;
// Celli is master
nbr[i] = nbrCelli;
}
else
{
@ -117,15 +117,15 @@ labelList getInternalFaceOrder
{
if (nbr[i] != -1)
{
oldToNew[cFaces[nbr.indices()[i]]] = newFaceI++;
oldToNew[cFaces[nbr.indices()[i]]] = newFacei++;
}
}
}
// Keep boundary faces in same order.
for (label faceI = newFaceI; faceI < owner.size(); faceI++)
for (label facei = newFacei; facei < owner.size(); facei++)
{
oldToNew[faceI] = faceI;
oldToNew[facei] = facei;
}
return oldToNew;
@ -134,7 +134,7 @@ labelList getInternalFaceOrder
void storeCellInZone
(
const label cellI,
const label celli,
const label cellType,
Map<label>& typeToZone,
List<DynamicList<label>>& zoneCells
@ -155,12 +155,12 @@ void storeCellInZone
<< zoneI << endl;
typeToZone.insert(cellType, zoneI);
zoneCells[zoneI].append(cellI);
zoneCells[zoneI].append(celli);
}
else
{
// Existing zone for type
zoneCells[zoneFnd()].append(cellI);
zoneCells[zoneFnd()].append(celli);
}
}
}
@ -192,7 +192,7 @@ void ReadVertices
// any chunk. Normally this would be in a for loop.
CCMIOSize nVertices;
CCMIOEntitySize(&err, vertices, &nVertices, NULL);
CCMIOEntitySize(&err, vertices, &nVertices, nullptr);
List<int> mapData(nVertices, 0);
List<float> verts(3*nVertices, 0);
@ -211,9 +211,9 @@ void ReadVertices
CCMIOReadMap(&err, mapID, mapData.begin(), offset, offsetPlusSize);
//CCMIOSize size;
//CCMIOEntityDescription(&err, vertices, &size, NULL);
//CCMIOEntityDescription(&err, vertices, &size, nullptr);
//char *desc = new char[size + 1];
//CCMIOEntityDescription(&err, vertices, NULL, desc);
//CCMIOEntityDescription(&err, vertices, nullptr, desc);
//Pout<< "label: '" << desc << "'" << endl;
//delete [] desc;
@ -249,7 +249,7 @@ void ReadProblem
int i = 0;
while
(
CCMIONextEntity(NULL, problem, kCCMIOCellType, &i, &next)
CCMIONextEntity(nullptr, problem, kCCMIOCellType, &i, &next)
== kCCMIONoErr
)
{
@ -261,10 +261,10 @@ void ReadProblem
// an array to get the name because we do not know how long the
// string is yet. Many parameters to CCMIO functions that
// return
// data can be NULL if that data is not needed.)
// data can be nullptr if that data is not needed.)
if
(
CCMIOReadOptstr(NULL, next, "MaterialType", &size, NULL)
CCMIOReadOptstr(nullptr, next, "MaterialType", &size, nullptr)
== kCCMIONoErr
)
{
@ -286,19 +286,19 @@ void ReadProblem
int k = 0;
while
(
CCMIONextEntity(NULL, problem, kCCMIOBoundaryRegion, &k, &boundary)
CCMIONextEntity(nullptr, problem, kCCMIOBoundaryRegion, &k, &boundary)
== kCCMIONoErr
)
{
// Index of foam patch
label foamPatchI = -1;
label foamPatchi = -1;
// Read prostar id
int prostarI = -1;
if
(
CCMIOReadOpti(NULL, boundary, "ProstarRegionNumber", &prostarI)
CCMIOReadOpti(nullptr, boundary, "ProstarRegionNumber", &prostarI)
== kCCMIONoErr
)
{
@ -317,21 +317,27 @@ void ReadProblem
if (prostarToFoamPatch.found(prostarI))
{
foamPatchI = prostarToFoamPatch[prostarI];
foamPatchi = prostarToFoamPatch[prostarI];
// Read boundary type
int size;
if
(
CCMIOReadOptstr(NULL, boundary, "BoundaryType", &size, NULL)
== kCCMIONoErr
CCMIOReadOptstr
(
nullptr,
boundary,
"BoundaryType",
&size,
nullptr
) == kCCMIONoErr
)
{
char* s = new char[size + 1];
CCMIOReadOptstr(NULL, boundary, "BoundaryType", &size, s);
CCMIOReadOptstr(nullptr, boundary, "BoundaryType", &size, s);
s[size] = '\0';
foamPatchTypes[foamPatchI] = string::validate<word>(string(s));
foamPatchTypes[foamPatchi] = string::validate<word>(string(s));
delete [] s;
}
@ -346,42 +352,48 @@ void ReadProblem
if
(
CCMIOReadOptstr(NULL, boundary, "BoundaryName", &size, NULL)
== kCCMIONoErr
CCMIOReadOptstr
(
nullptr,
boundary,
"BoundaryName",
&size,
nullptr
) == kCCMIONoErr
)
{
char* name = new char[size + 1];
CCMIOReadOptstr(NULL, boundary, "BoundaryName", &size, name);
CCMIOReadOptstr(nullptr, boundary, "BoundaryName", &size, name);
name[size] = '\0';
foamPatchNames[foamPatchI] =
foamPatchNames[foamPatchi] =
string::validate<word>(string(name));
delete [] name;
}
else if
(
CCMIOReadOptstr(NULL, boundary, "Label", &size, NULL)
CCMIOReadOptstr(nullptr, boundary, "Label", &size, nullptr)
== kCCMIONoErr
)
{
char* name = new char[size + 1];
CCMIOReadOptstr(NULL, boundary, "Label", &size, name);
CCMIOReadOptstr(nullptr, boundary, "Label", &size, name);
name[size] = '\0';
foamPatchNames[foamPatchI] =
foamPatchNames[foamPatchi] =
string::validate<word>(string(name));
delete [] name;
}
else
{
foamPatchNames[foamPatchI] =
foamPatchTypes[foamPatchI]
+ Foam::name(foamPatchI);
Pout<< "Made up name:" << foamPatchNames[foamPatchI]
foamPatchNames[foamPatchi] =
foamPatchTypes[foamPatchi]
+ Foam::name(foamPatchi);
Pout<< "Made up name:" << foamPatchNames[foamPatchi]
<< endl;
}
Pout<< "Read patch:" << foamPatchI
<< " name:" << foamPatchNames[foamPatchI]
<< " foamPatchTypes:" << foamPatchTypes[foamPatchI]
Pout<< "Read patch:" << foamPatchi
<< " name:" << foamPatchNames[foamPatchi]
<< " foamPatchTypes:" << foamPatchTypes[foamPatchi]
<< endl;
}
@ -413,7 +425,7 @@ void ReadCells
CCMIOID id;
CCMIOGetEntity(&err, topology, kCCMIOCells, 0, &id);
CCMIOSize nCells;
CCMIOEntitySize(&err, id, &nCells, NULL);
CCMIOEntitySize(&err, id, &nCells, nullptr);
std::vector<int> mapData(nCells);
std::vector<int> cellType(nCells);
@ -437,7 +449,7 @@ void ReadCells
CCMIOGetEntity(&err, topology, kCCMIOInternalFaces, 0, &id);
CCMIOSize nInternalFaces;
CCMIOEntitySize(&err, id, &nInternalFaces, NULL);
CCMIOEntitySize(&err, id, &nInternalFaces, nullptr);
Pout<< "nInternalFaces:" << nInternalFaces << endl;
// Determine patch sizes before reading internal faces
@ -445,12 +457,12 @@ void ReadCells
int index = 0;
while
(
CCMIONextEntity(NULL, topology, kCCMIOBoundaryFaces, &index, &id)
CCMIONextEntity(nullptr, topology, kCCMIOBoundaryFaces, &index, &id)
== kCCMIONoErr
)
{
CCMIOSize size;
CCMIOEntitySize(&err, id, &size, NULL);
CCMIOEntitySize(&err, id, &size, nullptr);
Pout<< "Read kCCMIOBoundaryFaces entry with " << size
<< " faces." << endl;
@ -469,10 +481,10 @@ void ReadCells
mapData.resize(nInternalFaces);
CCMIOGetEntity(&err, topology, kCCMIOInternalFaces, 0, &id);
CCMIOSize size;
CCMIOReadFaces(&err, id, kCCMIOInternalFaces, NULL, &size, NULL,
CCMIOReadFaces(&err, id, kCCMIOInternalFaces, nullptr, &size, nullptr,
kCCMIOStart, kCCMIOEnd);
std::vector<int> faces(size);
CCMIOReadFaces(&err, id, kCCMIOInternalFaces, &mapID, NULL, &faces[0],
CCMIOReadFaces(&err, id, kCCMIOInternalFaces, &mapID, nullptr, &faces[0],
kCCMIOStart, kCCMIOEnd);
std::vector<int> faceCells(2*nInternalFaces);
CCMIOReadFaceCells(&err, id, kCCMIOInternalFaces, &faceCells[0],
@ -488,12 +500,12 @@ void ReadCells
unsigned int pos = 0;
for (unsigned int faceI = 0; faceI < nInternalFaces; faceI++)
for (unsigned int facei = 0; facei < nInternalFaces; facei++)
{
foamFaceMap[faceI] = mapData[faceI];
foamOwner[faceI] = faceCells[2*faceI];
foamNeighbour[faceI] = faceCells[2*faceI+1];
face& f = foamFaces[faceI];
foamFaceMap[facei] = mapData[facei];
foamOwner[facei] = faceCells[2*facei];
foamNeighbour[facei] = faceCells[2*facei+1];
face& f = foamFaces[facei];
f.setSize(faces[pos++]);
forAll(f, fp)
@ -509,22 +521,38 @@ void ReadCells
label regionI = 0;
while
(
CCMIONextEntity(NULL, topology, kCCMIOBoundaryFaces, &index, &id)
CCMIONextEntity(nullptr, topology, kCCMIOBoundaryFaces, &index, &id)
== kCCMIONoErr
)
{
CCMIOSize nFaces;
CCMIOEntitySize(&err, id, &nFaces, NULL);
CCMIOEntitySize(&err, id, &nFaces, nullptr);
mapData.resize(nFaces);
faceCells.resize(nFaces);
CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, NULL, &size, NULL,
CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, nullptr, &size, nullptr,
kCCMIOStart, kCCMIOEnd);
faces.resize(size);
CCMIOReadFaces(&err, id, kCCMIOBoundaryFaces, &mapID, NULL, &faces[0],
kCCMIOStart, kCCMIOEnd);
CCMIOReadFaceCells(&err, id, kCCMIOBoundaryFaces, &faceCells[0],
kCCMIOStart, kCCMIOEnd);
CCMIOReadFaces
(
&err,
id,
kCCMIOBoundaryFaces,
&mapID,
nullptr,
&faces[0],
kCCMIOStart,
kCCMIOEnd
);
CCMIOReadFaceCells
(
&err,
id,
kCCMIOBoundaryFaces,
&faceCells[0],
kCCMIOStart,
kCCMIOEnd
);
CCMIOReadMap(&err, mapID, &mapData[0], kCCMIOStart, kCCMIOEnd);
CheckError(err, "Error reading boundary faces");
@ -532,7 +560,7 @@ void ReadCells
int prostarI;
if
(
CCMIOReadOpti(NULL, id, "ProstarRegionNumber", &prostarI)
CCMIOReadOpti(nullptr, id, "ProstarRegionNumber", &prostarI)
== kCCMIONoErr
)
{
@ -563,12 +591,12 @@ void ReadCells
for (unsigned int i = 0; i < nFaces; i++)
{
label foamFaceI = foamPatchStarts[regionI] + i;
label foamFacei = foamPatchStarts[regionI] + i;
foamFaceMap[foamFaceI] = mapData[i];
foamOwner[foamFaceI] = faceCells[i];
foamNeighbour[foamFaceI] = -1;
face& f = foamFaces[foamFaceI];
foamFaceMap[foamFacei] = mapData[i];
foamOwner[foamFacei] = faceCells[i];
foamNeighbour[foamFacei] = -1;
face& f = foamFaces[foamFacei];
f.setSize(faces[pos++]);
forAll(f, fp)
@ -645,12 +673,12 @@ int main(int argc, char *argv[])
}
// Open the file. Because we did not initialize 'err' we need to pass
// in NULL (which always means kCCMIONoErr) and then assign the return
// value to 'err'.).
// in nullptr (which always means kCCMIONoErr) and then assign the
// return value to 'err'.).
CCMIOID root;
CCMIOError err = CCMIOOpenFile
(
NULL,
nullptr,
ccmFile.c_str(),
kCCMIORead,
&root
@ -665,9 +693,9 @@ int main(int argc, char *argv[])
CheckError(err, "Error opening state");
unsigned int size;
CCMIOEntityDescription(&err, state, &size, NULL);
CCMIOEntityDescription(&err, state, &size, nullptr);
char *desc = new char[size + 1];
CCMIOEntityDescription(&err, state, NULL, desc);
CCMIOEntityDescription(&err, state, nullptr, desc);
Pout<< "Reading state '" << kDefaultState << "' (" << desc << ")"
<< endl;
delete [] desc;
@ -684,7 +712,7 @@ int main(int argc, char *argv[])
processor,
&vertices,
&topology,
NULL,
nullptr,
&solution
);
@ -698,8 +726,8 @@ int main(int argc, char *argv[])
processor,
&vertices,
&topology,
NULL,
NULL
nullptr,
nullptr
);
if (err != kCCMIONoErr)
{
@ -807,19 +835,19 @@ int main(int argc, char *argv[])
// Renumber vertex labels to Foam point labels
{
label maxCCMPointI = max(foamPointMap);
labelList toFoamPoints(invert(maxCCMPointI+1, foamPointMap));
label maxCCMPointi = max(foamPointMap);
labelList toFoamPoints(invert(maxCCMPointi+1, foamPointMap));
forAll(foamFaces, faceI)
forAll(foamFaces, facei)
{
inplaceRenumber(toFoamPoints, foamFaces[faceI]);
inplaceRenumber(toFoamPoints, foamFaces[facei]);
}
}
// Renumber cell labels
{
label maxCCMCellI = max(foamCellMap);
labelList toFoamCells(invert(maxCCMCellI+1, foamCellMap));
label maxCCMCelli = max(foamCellMap);
labelList toFoamCells(invert(maxCCMCelli+1, foamCellMap));
inplaceRenumber(toFoamCells, foamOwner);
inplaceRenumber(toFoamCells, foamNeighbour);
@ -837,15 +865,15 @@ int main(int argc, char *argv[])
// Set owner/neighbour so owner < neighbour
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(foamNeighbour, faceI)
forAll(foamNeighbour, facei)
{
label nbr = foamNeighbour[faceI];
label own = foamOwner[faceI];
label nbr = foamNeighbour[facei];
label own = foamOwner[facei];
if (nbr >= foamCellType.size() || own >= foamCellType.size())
{
FatalErrorInFunction
<< "face:" << faceI
<< "face:" << facei
<< " nbr:" << nbr
<< " own:" << own
<< " nCells:" << foamCellType.size()
@ -856,15 +884,15 @@ int main(int argc, char *argv[])
{
if (nbr < own)
{
foamOwner[faceI] = foamNeighbour[faceI];
foamNeighbour[faceI] = own;
foamFaces[faceI].flip();
foamOwner[facei] = foamNeighbour[facei];
foamNeighbour[facei] = own;
foamFaces[facei].flip();
}
}
// And check the face
const face& f = foamFaces[faceI];
const face& f = foamFaces[facei];
forAll(f, fp)
{
@ -903,9 +931,9 @@ int main(int argc, char *argv[])
);
// Reorder faces accordingly
forAll(foamCells, cellI)
forAll(foamCells, celli)
{
inplaceRenumber(oldToNew, foamCells[cellI]);
inplaceRenumber(oldToNew, foamCells[celli]);
}
// Reorder faces.
@ -935,40 +963,40 @@ int main(int argc, char *argv[])
// Create patches. Use patch types to determine what Foam types to generate.
List<polyPatch*> newPatches(foamPatchNames.size());
label meshFaceI = foamPatchStarts[0];
label meshFacei = foamPatchStarts[0];
forAll(newPatches, patchI)
forAll(newPatches, patchi)
{
const word& patchName = foamPatchNames[patchI];
const word& patchType = foamPatchTypes[patchI];
const word& patchName = foamPatchNames[patchi];
const word& patchType = foamPatchTypes[patchi];
Pout<< "Patch:" << patchName << " start at:" << meshFaceI
<< " size:" << foamPatchSizes[patchI]
<< " end at:" << meshFaceI+foamPatchSizes[patchI]
Pout<< "Patch:" << patchName << " start at:" << meshFacei
<< " size:" << foamPatchSizes[patchi]
<< " end at:" << meshFacei+foamPatchSizes[patchi]
<< endl;
if (patchType == "wall")
{
newPatches[patchI] =
newPatches[patchi] =
new wallPolyPatch
(
patchName,
foamPatchSizes[patchI],
meshFaceI,
patchI,
foamPatchSizes[patchi],
meshFacei,
patchi,
mesh.boundaryMesh(),
patchType
);
}
else if (patchType == "symmetryplane")
{
newPatches[patchI] =
newPatches[patchi] =
new symmetryPolyPatch
(
patchName,
foamPatchSizes[patchI],
meshFaceI,
patchI,
foamPatchSizes[patchi],
meshFacei,
patchi,
mesh.boundaryMesh(),
patchType
);
@ -976,13 +1004,13 @@ int main(int argc, char *argv[])
else if (patchType == "empty")
{
// Note: not ccm name, introduced by us above.
newPatches[patchI] =
newPatches[patchi] =
new emptyPolyPatch
(
patchName,
foamPatchSizes[patchI],
meshFaceI,
patchI,
foamPatchSizes[patchi],
meshFacei,
patchi,
mesh.boundaryMesh(),
patchType
);
@ -991,25 +1019,25 @@ int main(int argc, char *argv[])
{
// All other ccm types become straight polyPatch:
// 'inlet', 'outlet', ...
newPatches[patchI] =
newPatches[patchi] =
new polyPatch
(
patchName,
foamPatchSizes[patchI],
meshFaceI,
patchI,
foamPatchSizes[patchi],
meshFacei,
patchi,
mesh.boundaryMesh(),
word::null
);
}
meshFaceI += foamPatchSizes[patchI];
meshFacei += foamPatchSizes[patchi];
}
if (meshFaceI != foamOwner.size())
if (meshFacei != foamOwner.size())
{
FatalErrorInFunction
<< "meshFaceI:" << meshFaceI
<< "meshFacei:" << meshFacei
<< " nFaces:" << foamOwner.size()
<< abort(FatalError);
}
@ -1030,12 +1058,12 @@ int main(int argc, char *argv[])
// Storage for cell zones.
List<DynamicList<label>> zoneCells(0);
forAll(foamCellType, cellI)
forAll(foamCellType, celli)
{
storeCellInZone
(
cellI,
foamCellType[cellI],
celli,
foamCellType[celli],
typeToZone,
zoneCells
);
@ -1100,9 +1128,9 @@ int main(int argc, char *argv[])
dimensionedScalar("cellId", dimless, 0.0)
);
forAll(foamCellMap, cellI)
forAll(foamCellMap, celli)
{
cellIdField[cellI] = foamCellMap[cellI];
cellIdField[celli] = foamCellMap[celli];
}
// Construct field with calculated bc to hold cell type.
@ -1120,9 +1148,9 @@ int main(int argc, char *argv[])
dimensionedScalar("cellType", dimless, 0.0)
);
forAll(foamCellType, cellI)
forAll(foamCellType, celli)
{
cellTypeField[cellI] = foamCellType[cellI];
cellTypeField[celli] = foamCellType[celli];
}
Info<< "Writing cellIds as volScalarField to " << cellIdField.objectPath()

View File

@ -280,11 +280,11 @@ label findFace(const polyMesh& mesh, const face& f)
forAll(pFaces, i)
{
label faceI = pFaces[i];
label facei = pFaces[i];
if (mesh.faces()[faceI] == f)
if (mesh.faces()[facei] == f)
{
return faceI;
return facei;
}
}
@ -318,7 +318,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
fileName ansysFile(args.additionalArgs()[0]);
fileName ansysFile(args[1]);
ifstream ansysStream(ansysFile.c_str());
if (!ansysStream)
@ -488,18 +488,18 @@ int main(int argc, char *argv[])
faceListList boundary(slPatchCells.size());
wordList patchNames(slPatchCells.size());
forAll(slPatchCells, patchI)
forAll(slPatchCells, patchi)
{
SLList<face> patchFaces;
SLList<label>::iterator cellIter(slPatchCells[patchI].begin());
SLList<label>::iterator faceIter(slPatchCellFaces[patchI].begin());
SLList<label>::iterator cellIter(slPatchCells[patchi].begin());
SLList<label>::iterator faceIter(slPatchCellFaces[patchi].begin());
for
(
;
cellIter != slPatchCells[patchI].end()
&& faceIter != slPatchCellFaces[patchI].end();
cellIter != slPatchCells[patchi].end()
&& faceIter != slPatchCellFaces[patchi].end();
++cellIter, ++faceIter
)
{
@ -516,8 +516,8 @@ int main(int argc, char *argv[])
);
}
boundary[patchI] = patchFaces;
patchNames[patchI] = word("patch") + name(patchI + 1);
boundary[patchi] = patchFaces;
patchNames[patchi] = word("patch") + name(patchi + 1);
}
@ -525,10 +525,10 @@ int main(int argc, char *argv[])
// Lookup the face labels for all the boundary faces
//
labelListList boundaryFaceLabels(boundary.size());
forAll(boundary, patchI)
forAll(boundary, patchi)
{
const faceList& bFaces = boundary[patchI];
labelList& bFaceLabels = boundaryFaceLabels[patchI];
const faceList& bFaces = boundary[patchi];
labelList& bFaceLabels = boundaryFaceLabels[patchi];
bFaceLabels.setSize(bFaces.size());
forAll(bFaces, i)
{
@ -541,24 +541,24 @@ int main(int argc, char *argv[])
// faces go into faceZones and external faces go into patches.
List<faceList> patchFaces(slPatchCells.size());
labelList patchNFaces(slPatchCells.size(), 0);
forAll(boundary, patchI)
forAll(boundary, patchi)
{
const faceList& bFaces = boundary[patchI];
const labelList& bFaceLabels = boundaryFaceLabels[patchI];
const faceList& bFaces = boundary[patchi];
const labelList& bFaceLabels = boundaryFaceLabels[patchi];
patchFaces[patchI].setSize(bFaces.size());
patchFaces[patchi].setSize(bFaces.size());
forAll(bFaces, i)
{
if (!dummyMesh().isInternalFace(bFaceLabels[i]))
{
patchFaces[patchI][patchNFaces[patchI]++] = bFaces[i];
patchFaces[patchi][patchNFaces[patchi]++] = bFaces[i];
}
}
patchFaces[patchI].setSize(patchNFaces[patchI]);
patchFaces[patchi].setSize(patchNFaces[patchi]);
Info<< "Patch " << patchI << " named " << patchNames[patchI]
<< ": " << boundary[patchI].size() << " faces" << endl;
Info<< "Patch " << patchi << " named " << patchNames[patchi]
<< ": " << boundary[patchi].size() << " faces" << endl;
}
// We no longer need the dummyMesh
@ -586,14 +586,14 @@ int main(int argc, char *argv[])
);
// Add information to dictionary
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
if (!patchDicts.set(patchI))
if (!patchDicts.set(patchi))
{
patchDicts.set(patchI, new dictionary());
patchDicts.set(patchi, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", polyPatch::typeName, false);
patchDicts[patchi].add("type", polyPatch::typeName, false);
}
@ -622,27 +622,27 @@ int main(int argc, char *argv[])
DynamicList<cellZone*> cz;
// FaceZones
forAll(boundaryFaceLabels, patchI)
forAll(boundaryFaceLabels, patchi)
{
if (boundaryFaceLabels[patchI].size())
if (boundaryFaceLabels[patchi].size())
{
// Re-do the boundaryFaceLabels since the boundary face
// labels will be different on the pShapeMesh.
const faceList& bFaces = boundary[patchI];
labelList& bFaceLabels = boundaryFaceLabels[patchI];
const faceList& bFaces = boundary[patchi];
labelList& bFaceLabels = boundaryFaceLabels[patchi];
forAll(bFaceLabels, i)
{
bFaceLabels[i] = findFace(pShapeMesh, bFaces[i]);
}
Info<< "Creating faceZone " << patchNames[patchI]
Info<< "Creating faceZone " << patchNames[patchi]
<< " with " << bFaceLabels.size() << " faces" << endl;
fz.append
(
new faceZone
(
patchNames[patchI],
patchNames[patchi],
bFaceLabels,
boolList(bFaceLabels.size(), false),
fz.size(),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -106,14 +106,14 @@ int main(int argc, char *argv[])
{
label no, blkNo, patchLabel;
forAll(cfxPatchTypes, patchI)
forAll(cfxPatchTypes, patchi)
{
// Grab patch type and name
cfxFile >> cfxPatchTypes[patchI] >> cfxPatchNames[patchI] >> no;
cfxFile >> cfxPatchTypes[patchi] >> cfxPatchNames[patchi] >> no;
// Grab patch range
patchRanges[patchI].setSize(6);
labelList& curRange = patchRanges[patchI];
patchRanges[patchi].setSize(6);
labelList& curRange = patchRanges[patchi];
forAll(curRange, rI)
{
@ -125,9 +125,9 @@ int main(int argc, char *argv[])
// 0 = solid (3-D patch),
// 1 = high i, 2 = high j, 3 = high k
// 4 = low i, 5 = low j, 6 = low k
cfxFile >> patchDirections[patchI] >> blkNo >> patchLabel;
cfxFile >> patchDirections[patchi] >> blkNo >> patchLabel;
patchMasterBlocks[patchI] = blkNo - 1;
patchMasterBlocks[patchi] = blkNo - 1;
}
}
@ -181,9 +181,9 @@ int main(int argc, char *argv[])
faceListList rawPatches(npatch);
forAll(rawPatches, patchI)
forAll(rawPatches, patchi)
{
const word& patchType = cfxPatchTypes[patchI];
const word& patchType = cfxPatchTypes[patchi];
// reject volume patches
if
@ -192,17 +192,17 @@ int main(int argc, char *argv[])
|| patchType == "SOLCON" || patchType == "USER3D"
)
{
patchMasterBlocks[patchI] = -1;
rawPatches[patchI].setSize(0);
patchMasterBlocks[patchi] = -1;
rawPatches[patchi].setSize(0);
}
else
{
// read and create a 2-D patch
rawPatches[patchI] =
blocks[patchMasterBlocks[patchI]].patchFaces
rawPatches[patchi] =
blocks[patchMasterBlocks[patchi]].patchFaces
(
patchDirections[patchI],
patchRanges[patchI]
patchDirections[patchi],
patchRanges[patchi]
);
}
@ -257,11 +257,11 @@ int main(int argc, char *argv[])
const labelList& blockPFacePoints =
blockPFaces[blockPFaceLabel];
forAll(blockPFacePoints, blockPFacePointI)
forAll(blockPFacePoints, blockPFacePointi)
{
forAll(blockPFacePoints, blockPFacePointI2)
forAll(blockPFacePoints, blockPFacePointi2)
{
if (blockPFacePointI != blockPFacePointI2)
if (blockPFacePointi != blockPFacePointi2)
{
sqrMergeTol =
min
@ -270,9 +270,9 @@ int main(int argc, char *argv[])
magSqr
(
blockPpoints
[blockPFacePoints[blockPFacePointI]]
[blockPFacePoints[blockPFacePointi]]
- blockPpoints
[blockPFacePoints[blockPFacePointI2]]
[blockPFacePoints[blockPFacePointi2]]
)
);
}
@ -294,7 +294,7 @@ int main(int argc, char *argv[])
labelList& cp = curPairs[blockPFaceLabel];
cp.setSize(blockPFacePoints.size());
forAll(blockPFacePoints, blockPFacePointI)
forAll(blockPFacePoints, blockPFacePointi)
{
found = false;
@ -303,16 +303,16 @@ int main(int argc, char *argv[])
const labelList& blockNFacePoints =
blockNFaces[blockNFaceLabel];
forAll(blockNFacePoints, blockNFacePointI)
forAll(blockNFacePoints, blockNFacePointi)
{
if
(
magSqr
(
blockPpoints
[blockPFacePoints[blockPFacePointI]]
[blockPFacePoints[blockPFacePointi]]
- blockNpoints
[blockNFacePoints[blockNFacePointI]]
[blockNFacePoints[blockNFacePointi]]
)
< sqrMergeTol
)
@ -320,15 +320,15 @@ int main(int argc, char *argv[])
// Found a new pair
found = true;
cp[blockPFacePointI] =
blockNFacePoints[blockNFacePointI];
cp[blockPFacePointi] =
blockNFacePoints[blockNFacePointi];
label PpointLabel =
blockPFacePoints[blockPFacePointI]
blockPFacePoints[blockPFacePointi]
+ blockOffsets[blockPlabel];
label NpointLabel =
blockNFacePoints[blockNFacePointI]
blockNFacePoints[blockNFacePointi]
+ blockOffsets[blockNlabel];
label minPN = min(PpointLabel, NpointLabel);
@ -384,14 +384,14 @@ int main(int argc, char *argv[])
const labelList& cp = curPairs[blockPFaceLabel];
forAll(cp, blockPFacePointI)
forAll(cp, blockPFacePointi)
{
label PpointLabel =
blockPFacePoints[blockPFacePointI]
blockPFacePoints[blockPFacePointi]
+ blockOffsets[blockPlabel];
label NpointLabel =
cp[blockPFacePointI]
cp[blockPFacePointi]
+ blockOffsets[blockNlabel];
if
@ -443,16 +443,16 @@ int main(int argc, char *argv[])
const labelList& blockPFacePoints
= blockPFaces[blockPFaceLabel];
forAll(blockPFacePoints, blockPFacePointI)
forAll(blockPFacePoints, blockPFacePointi)
{
label PpointLabel =
blockPFacePoints[blockPFacePointI]
blockPFacePoints[blockPFacePointi]
+ blockOffsets[blockPlabel];
if (pointMergeList[PpointLabel] == -1)
{
FatalErrorInFunction
<< "Unable to merge point " << blockPFacePointI
<< "Unable to merge point " << blockPFacePointi
<< " of face " << blockPFaceLabel
<< " of block " << blockPlabel
<< abort(FatalError);
@ -465,16 +465,16 @@ int main(int argc, char *argv[])
const labelList& blockNFacePoints
= blockNFaces[blockNFaceLabel];
forAll(blockNFacePoints, blockNFacePointI)
forAll(blockNFacePoints, blockNFacePointi)
{
label NpointLabel =
blockNFacePoints[blockNFacePointI]
blockNFacePoints[blockNFacePointi]
+ blockOffsets[blockNlabel];
if (pointMergeList[NpointLabel] == -1)
{
FatalErrorInFunction
<< "Unable to merge point " << blockNFacePointI
<< "Unable to merge point " << blockNFacePointi
<< " of face " << blockNFaceLabel
<< " of block " << blockNlabel
<< abort(FatalError);
@ -553,16 +553,16 @@ int main(int argc, char *argv[])
{
labelListList curBlockCells = blocks[blockI].blockCells();
forAll(curBlockCells, blockCellI)
forAll(curBlockCells, blockCelli)
{
labelList cellPoints(curBlockCells[blockCellI].size());
labelList cellPoints(curBlockCells[blockCelli].size());
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
cellPoints[pointI] =
cellPoints[pointi] =
pointMergeList
[
curBlockCells[blockCellI][pointI]
curBlockCells[blockCelli][pointi]
+ blockOffsets[blockI]
];
}
@ -583,30 +583,30 @@ int main(int argc, char *argv[])
label nCreatedPatches = 0;
forAll(rawPatches, patchI)
forAll(rawPatches, patchi)
{
if (rawPatches[patchI].size() && cfxPatchTypes[patchI] != "BLKBDY")
if (rawPatches[patchi].size() && cfxPatchTypes[patchi] != "BLKBDY")
{
// Check if this name has been already created
label existingPatch = -1;
for (label oldPatchI = 0; oldPatchI < nCreatedPatches; oldPatchI++)
for (label oldPatchi = 0; oldPatchi < nCreatedPatches; oldPatchi++)
{
if (patchNames[oldPatchI] == cfxPatchNames[patchI])
if (patchNames[oldPatchi] == cfxPatchNames[patchi])
{
existingPatch = oldPatchI;
existingPatch = oldPatchi;
break;
}
}
const faceList& curRawPatch = rawPatches[patchI];
label curBlock = patchMasterBlocks[patchI];
const faceList& curRawPatch = rawPatches[patchi];
label curBlock = patchMasterBlocks[patchi];
if (existingPatch >= 0)
{
Info<< "CFX patch " << patchI
<< ", of type " << cfxPatchTypes[patchI]
<< ", name " << cfxPatchNames[patchI]
Info<< "CFX patch " << patchi
<< ", of type " << cfxPatchTypes[patchi]
<< ", name " << cfxPatchNames[patchi]
<< " already exists as OpenFOAM patch " << existingPatch
<< ". Adding faces." << endl;
@ -614,19 +614,19 @@ int main(int argc, char *argv[])
label oldSize = renumberedPatch.size();
renumberedPatch.setSize(oldSize + curRawPatch.size());
forAll(curRawPatch, faceI)
forAll(curRawPatch, facei)
{
const face& oldFace = curRawPatch[faceI];
const face& oldFace = curRawPatch[facei];
face& newFace = renumberedPatch[oldSize + faceI];
face& newFace = renumberedPatch[oldSize + facei];
newFace.setSize(oldFace.size());
forAll(oldFace, pointI)
forAll(oldFace, pointi)
{
newFace[pointI] =
newFace[pointi] =
pointMergeList
[
oldFace[pointI]
oldFace[pointi]
+ blockOffsets[curBlock]
];
}
@ -638,66 +638,66 @@ int main(int argc, char *argv[])
faceList& renumberedPatch = boundary[nCreatedPatches];
renumberedPatch.setSize(curRawPatch.size());
forAll(curRawPatch, faceI)
forAll(curRawPatch, facei)
{
const face& oldFace = curRawPatch[faceI];
const face& oldFace = curRawPatch[facei];
face& newFace = renumberedPatch[faceI];
face& newFace = renumberedPatch[facei];
newFace.setSize(oldFace.size());
forAll(oldFace, pointI)
forAll(oldFace, pointi)
{
newFace[pointI] =
newFace[pointi] =
pointMergeList
[
oldFace[pointI]
oldFace[pointi]
+ blockOffsets[curBlock]
];
}
}
Info<< "CFX patch " << patchI
<< ", of type " << cfxPatchTypes[patchI]
<< ", name " << cfxPatchNames[patchI]
Info<< "CFX patch " << patchi
<< ", of type " << cfxPatchTypes[patchi]
<< ", name " << cfxPatchNames[patchi]
<< " converted into OpenFOAM patch " << nCreatedPatches
<< " type ";
if (cfxPatchTypes[patchI] == "WALL")
if (cfxPatchTypes[patchi] == "WALL")
{
Info<< "wall." << endl;
patchTypes[nCreatedPatches] = wallPolyPatch::typeName;
patchNames[nCreatedPatches] = cfxPatchNames[patchI];
patchNames[nCreatedPatches] = cfxPatchNames[patchi];
nCreatedPatches++;
}
else if (cfxPatchTypes[patchI] == "SYMMET")
else if (cfxPatchTypes[patchi] == "SYMMET")
{
Info<< "symmetryPlane." << endl;
patchTypes[nCreatedPatches] = symmetryPolyPatch::typeName;
patchNames[nCreatedPatches] = cfxPatchNames[patchI];
patchNames[nCreatedPatches] = cfxPatchNames[patchi];
nCreatedPatches++;
}
else if
(
cfxPatchTypes[patchI] == "INLET"
|| cfxPatchTypes[patchI] == "OUTLET"
|| cfxPatchTypes[patchI] == "PRESS"
|| cfxPatchTypes[patchI] == "CNDBDY"
|| cfxPatchTypes[patchI] == "USER2D"
cfxPatchTypes[patchi] == "INLET"
|| cfxPatchTypes[patchi] == "OUTLET"
|| cfxPatchTypes[patchi] == "PRESS"
|| cfxPatchTypes[patchi] == "CNDBDY"
|| cfxPatchTypes[patchi] == "USER2D"
)
{
Info<< "generic." << endl;
patchTypes[nCreatedPatches] = polyPatch::typeName;
patchNames[nCreatedPatches] = cfxPatchNames[patchI];
patchNames[nCreatedPatches] = cfxPatchNames[patchi];
nCreatedPatches++;
}
else
{
FatalErrorInFunction
<< "Unrecognised CFX patch type "
<< cfxPatchTypes[patchI]
<< cfxPatchTypes[patchi]
<< abort(FatalError);
}
}
@ -722,14 +722,14 @@ int main(int argc, char *argv[])
);
// Add information to dictionary
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
if (!patchDicts.set(patchI))
if (!patchDicts.set(patchi))
{
patchDicts.set(patchI, new dictionary());
patchDicts.set(patchi, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", patchTypes[patchI], false);
patchDicts[patchi].add("type", patchTypes[patchi], false);
}
polyMesh pShapeMesh

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -367,9 +367,9 @@ faceList hexBlock::patchFaces(const label direc, const labelList& range) const
else if (blockHandedness_ == left)
{
// turn all faces inside out
forAll(result, faceI)
forAll(result, facei)
{
result[faceI].flip();
result[facei].flip();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,24 +85,24 @@ cellShape create3DCellShape
// make a list of outward-pointing faces
labelListList localFaces(faceLabels.size());
forAll(faceLabels, faceI)
forAll(faceLabels, facei)
{
const label curFaceLabel = faceLabels[faceI];
const label curFaceLabel = faceLabels[facei];
const labelList& curFace = faces[curFaceLabel];
if (owner[curFaceLabel] == cellIndex)
{
localFaces[faceI] = curFace;
localFaces[facei] = curFace;
}
else if (neighbour[curFaceLabel] == cellIndex)
{
// Reverse the face
localFaces[faceI].setSize(curFace.size());
localFaces[facei].setSize(curFace.size());
forAllReverse(curFace, i)
{
localFaces[faceI][curFace.size() - i - 1] =
localFaces[facei][curFace.size() - i - 1] =
curFace[i];
}
}
@ -144,20 +144,20 @@ cellShape create3DCellShape
bool found = false;
forAll(localFaces, meshFaceI)
forAll(localFaces, meshFacei)
{
if (localFaces[meshFaceI].size() == firstModelFace.size())
if (localFaces[meshFacei].size() == firstModelFace.size())
{
// Match. Insert points into the pointLabels
found = true;
const labelList& curMeshFace = localFaces[meshFaceI];
const labelList& curMeshFace = localFaces[meshFacei];
meshFaceUsed[meshFaceI] = true;
meshFaceUsed[meshFacei] = true;
forAll(curMeshFace, pointI)
forAll(curMeshFace, pointi)
{
pointLabels[firstModelFace[pointI]] = curMeshFace[pointI];
pointLabels[firstModelFace[pointi]] = curMeshFace[pointi];
}
break;
@ -173,26 +173,26 @@ cellShape create3DCellShape
<< abort(FatalError);
}
for (label modelFaceI = 1; modelFaceI < modelFaces.size(); modelFaceI++)
for (label modelFacei = 1; modelFacei < modelFaces.size(); modelFacei++)
{
// get the next model face
const labelList& curModelFace =
modelFaces
[faceMatchingOrder[fluentCellModelID][modelFaceI]];
[faceMatchingOrder[fluentCellModelID][modelFacei]];
found = false;
// Loop through mesh faces until a match is found
forAll(localFaces, meshFaceI)
forAll(localFaces, meshFacei)
{
if
(
!meshFaceUsed[meshFaceI]
&& localFaces[meshFaceI].size() == curModelFace.size()
!meshFaceUsed[meshFacei]
&& localFaces[meshFacei].size() == curModelFace.size()
)
{
// A possible match. A mesh face will be rotated, so make a copy
labelList meshFaceLabels = localFaces[meshFaceI];
labelList meshFaceLabels = localFaces[meshFacei];
for
(
@ -204,12 +204,12 @@ cellShape create3DCellShape
// try matching the face
label nMatchedLabels = 0;
forAll(meshFaceLabels, pointI)
forAll(meshFaceLabels, pointi)
{
if
(
pointLabels[curModelFace[pointI]]
== meshFaceLabels[pointI]
pointLabels[curModelFace[pointi]]
== meshFaceLabels[pointi]
)
{
nMatchedLabels++;
@ -225,13 +225,13 @@ cellShape create3DCellShape
if (found)
{
// match found. Insert mesh face
forAll(meshFaceLabels, pointI)
forAll(meshFaceLabels, pointi)
{
pointLabels[curModelFace[pointI]] =
meshFaceLabels[pointI];
pointLabels[curModelFace[pointi]] =
meshFaceLabels[pointi];
}
meshFaceUsed[meshFaceI] = true;
meshFaceUsed[meshFacei] = true;
break;
}
@ -258,7 +258,7 @@ cellShape create3DCellShape
// A model face is not matched. Shape detection failed
FatalErrorInFunction
<< "Cannot find match for face "
<< modelFaceI
<< modelFacei
<< ".\nModel: " << curModel.name() << " model face: "
<< curModelFace << " Mesh faces: " << localFaces
<< "Matched points: " << pointLabels

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,7 +47,7 @@ cellShape extrudedQuadCellShape
faceList& frontAndBackFaces
)
{
static const cellModel* hexModelPtr_ = NULL;
static const cellModel* hexModelPtr_ = nullptr;
if (!hexModelPtr_)
{
@ -67,9 +67,9 @@ cellShape extrudedQuadCellShape
// make a list of outward-pointing faces
labelListList localFaces(4);
forAll(faceLabels, faceI)
forAll(faceLabels, facei)
{
const label curFaceLabel = faceLabels[faceI];
const label curFaceLabel = faceLabels[facei];
const face& curFace = faces[curFaceLabel];
@ -83,18 +83,18 @@ cellShape extrudedQuadCellShape
if (owner[curFaceLabel] == cellIndex)
{
localFaces[faceI] = curFace;
localFaces[facei] = curFace;
}
else if (neighbour[curFaceLabel] == cellIndex)
{
// Reverse the face. Note: it is necessary to reverse by
// hand to preserve connectivity of a 2-D mesh.
//
localFaces[faceI].setSize(curFace.size());
localFaces[facei].setSize(curFace.size());
forAllReverse(curFace, i)
{
localFaces[faceI][curFace.size() - i - 1] =
localFaces[facei][curFace.size() - i - 1] =
curFace[i];
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,7 +48,7 @@ cellShape extrudedTriangleCellShape
faceList& frontAndBackFaces
)
{
static const cellModel* prismModelPtr_ = NULL;
static const cellModel* prismModelPtr_ = nullptr;
if (!prismModelPtr_)
{
@ -69,9 +69,9 @@ cellShape extrudedTriangleCellShape
// make a list of outward-pointing faces
labelListList localFaces(3);
forAll(faceLabels, faceI)
forAll(faceLabels, facei)
{
const label curFaceLabel = faceLabels[faceI];
const label curFaceLabel = faceLabels[facei];
const face& curFace = faces[curFaceLabel];
@ -85,18 +85,18 @@ cellShape extrudedTriangleCellShape
if (owner[curFaceLabel] == cellIndex)
{
localFaces[faceI] = curFace;
localFaces[facei] = curFace;
}
else if (neighbour[curFaceLabel] == cellIndex)
{
// Reverse the face. Note: it is necessary to reverse by
// hand to preserve connectivity of a 2-D mesh.
//
localFaces[faceI].setSize(curFace.size());
localFaces[facei].setSize(curFace.size());
forAllReverse(curFace, i)
{
localFaces[faceI][curFace.size() - i - 1] =
localFaces[facei][curFace.size() - i - 1] =
curFace[i];
}
}

View File

@ -240,11 +240,11 @@ endOfSection {space}")"{space}
%{
// Point data
label pointGroupNumberOfComponents = 3;
label pointI = 0; // index used for reading points
label pointi = 0; // index used for reading points
// Face data
label faceGroupElementType = -1;
label faceI = 0;
label facei = 0;
// Cell data
label cellGroupElementType = -1;
@ -346,7 +346,7 @@ endOfSection {space}")"{space}
readHexLabel(pointGroupDataStream);
// In FOAM, indices start from zero - adjust
pointI = pointGroupStartIndex.last() - 1;
pointi = pointGroupStartIndex.last() - 1;
// reset number of components to default
pointGroupNumberOfComponents = 3;
@ -384,8 +384,8 @@ endOfSection {space}")"{space}
scalar x = readScalar(vertexXyzStream);
scalar y = readScalar(vertexXyzStream);
points[pointI] = point(x, y, 0);
pointI++;
points[pointi] = point(x, y, 0);
pointi++;
}
<readPoints3D>{spaceNl}{scalarList} {
@ -397,19 +397,19 @@ endOfSection {space}")"{space}
scalar y = readScalar(vertexXyzStream);
scalar z = readScalar(vertexXyzStream);
points[pointI] = convertToMeters*point(x, y, z);
pointI++;
points[pointi] = convertToMeters*point(x, y, z);
pointi++;
}
<readPoints2D,readPoints3D>{spaceNl}{endOfSection} {
// check read of points
if (pointI != pointGroupEndIndex.last())
if (pointi != pointGroupEndIndex.last())
{
Info<< "problem with reading points: "
<< "start index: " << pointGroupStartIndex.last()
<< " end index: " << pointGroupEndIndex.last()
<< " last points read: " << pointI << endl;
<< " last points read: " << pointi << endl;
}
yy_pop_state();
@ -461,7 +461,7 @@ endOfSection {space}")"{space}
faceGroupElementType = readHexLabel(faceGroupDataStream);
// In FOAM, indices start from zero - adjust
faceI = faceGroupStartIndex.last() - 1;
facei = faceGroupStartIndex.last() - 1;
}
<readNumberOfFaces,readFaceGroupData>{spaceNl}{endOfSection} {
@ -486,7 +486,7 @@ endOfSection {space}")"{space}
IStringStream mixedFaceStream(YYText());
face& curFaceLabels = faces[faceI];
face& curFaceLabels = faces[facei];
// set size of label list
curFaceLabels.setSize(readLabel(mixedFaceStream));
@ -497,16 +497,16 @@ endOfSection {space}")"{space}
}
// read neighbour and owner. Neighbour comes first
neighbour[faceI] = readHexLabel(mixedFaceStream) - 1;
owner[faceI] = readHexLabel(mixedFaceStream) - 1;
faceI++;
neighbour[facei] = readHexLabel(mixedFaceStream) - 1;
owner[facei] = readHexLabel(mixedFaceStream) - 1;
facei++;
}
<readFacesUniform>{spaceNl}{hexLabelList} {
IStringStream mixedFaceStream(YYText());
face& curFaceLabels = faces[faceI];
face& curFaceLabels = faces[facei];
// set size of label list. This is OK because in Fluent the type
// for edge is 2, for triangle is 3 and for quad is 4
@ -518,20 +518,20 @@ endOfSection {space}")"{space}
}
// read neighbour and owner. Neighbour comes first
neighbour[faceI] = readHexLabel(mixedFaceStream) - 1;
owner[faceI] = readHexLabel(mixedFaceStream) - 1;
faceI++;
neighbour[facei] = readHexLabel(mixedFaceStream) - 1;
owner[facei] = readHexLabel(mixedFaceStream) - 1;
facei++;
}
<readFacesMixed,readFacesUniform>{spaceNl}{endOfSection} {
// check read of fluentFaces
if (faceI != faceGroupEndIndex.last())
if (facei != faceGroupEndIndex.last())
{
Info<< "problem with reading fluentFaces: "
<< "start index: " << faceGroupStartIndex.last()
<< " end index: " << faceGroupEndIndex.last()
<< " last fluentFaces read: " << faceI << endl;
<< " last fluentFaces read: " << facei << endl;
}
yy_pop_state();
@ -847,11 +847,11 @@ label findFace(const primitiveMesh& mesh, const face& f)
forAll(pFaces, i)
{
label faceI = pFaces[i];
label facei = pFaces[i];
if (f == mesh.faces()[faceI])
if (f == mesh.faces()[facei])
{
return faceI;
return facei;
}
}
@ -935,23 +935,23 @@ int main(int argc, char *argv[])
// fill in owner and neighbour
forAll(owner, faceI)
forAll(owner, facei)
{
if (owner[faceI] > -1)
if (owner[facei] > -1)
{
label curCell = owner[faceI];
cellFaces[curCell][nFacesInCell[curCell] ] = faceI;
label curCell = owner[facei];
cellFaces[curCell][nFacesInCell[curCell] ] = facei;
nFacesInCell[curCell]++;
}
}
forAll(neighbour, faceI)
forAll(neighbour, facei)
{
if (neighbour[faceI] > -1)
if (neighbour[facei] > -1)
{
label curCell = neighbour[faceI];
cellFaces[curCell][nFacesInCell[curCell] ] = faceI;
label curCell = neighbour[facei];
cellFaces[curCell][nFacesInCell[curCell] ] = facei;
nFacesInCell[curCell]++;
}
@ -989,18 +989,18 @@ int main(int argc, char *argv[])
// points given by Fluent need to represent the FRONT plane of the
// geometry. Therefore, the extrusion will be in -z direction
//
forAll(oldPoints, pointI)
forAll(oldPoints, pointi)
{
points[nNewPoints] = oldPoints[pointI];
points[nNewPoints] = oldPoints[pointi];
points[nNewPoints].z() = zOffset;
nNewPoints++;
}
forAll(oldPoints, pointI)
forAll(oldPoints, pointi)
{
points[nNewPoints] = oldPoints[pointI];
points[nNewPoints] = oldPoints[pointi];
points[nNewPoints].z() = -zOffset;
@ -1065,17 +1065,17 @@ int main(int argc, char *argv[])
}
// Create new faces
forAll(faces, faceI)
forAll(faces, facei)
{
if (faces[faceI].size() != 2)
if (faces[facei].size() != 2)
{
FatalErrorInFunction
<< "fluentMeshToFoam: a 2-D face defined with "
<< faces[faceI].size() << " points." << endl;
<< faces[facei].size() << " points." << endl;
}
labelList& newFace = faces[faceI];
labelList& newFace = faces[facei];
newFace.setSize(4);
@ -1128,16 +1128,16 @@ int main(int argc, char *argv[])
// area vector points into the domain. Turn them round before making patches
// for Foam compatibility
forAll(faces, faceI)
forAll(faces, facei)
{
if (owner[faceI] == -1)
if (owner[facei] == -1)
{
// reverse face
labelList oldFace = faces[faceI];
labelList oldFace = faces[facei];
forAllReverse(oldFace, i)
{
faces[faceI][oldFace.size() - i - 1] =
faces[facei][oldFace.size() - i - 1] =
oldFace[i];
}
}
@ -1244,7 +1244,7 @@ int main(int argc, char *argv[])
faceList patchFaces(faceGroupEndIndexIter() - faceLabel);
forAll(patchFaces, faceI)
forAll(patchFaces, facei)
{
if
(
@ -1252,14 +1252,14 @@ int main(int argc, char *argv[])
|| faces[faceLabel].size() == 4
)
{
patchFaces[faceI] = face(faces[faceLabel]);
patchFaces[facei] = face(faces[faceLabel]);
faceLabel++;
}
else
{
FatalErrorInFunction
<< "unrecognised face shape with "
<< patchFaces[faceI].size() << " vertices"
<< patchFaces[facei].size() << " vertices"
<< abort(FatalError);
}
}
@ -1380,9 +1380,9 @@ int main(int argc, char *argv[])
label nBoundaries = 0;
forAll(patches, patchI)
forAll(patches, patchi)
{
const faceList& bFaces = patches[patchI];
const faceList& bFaces = patches[patchi];
label sz = bFaces.size();
labelList meshFaces(sz,-1);
@ -1405,7 +1405,7 @@ int main(int argc, char *argv[])
if
(
patchTypes[patchI] != "internal"
patchTypes[patchi] != "internal"
&& !pShapeMesh.isInternalFace(meshFaces[0])
)
{
@ -1415,34 +1415,34 @@ int main(int argc, char *argv[])
//and mark patch number to global list
forAll(meshFaces, i)
{
label faceI = meshFaces[i];
label facei = meshFaces[i];
if (pShapeMesh.isInternalFace(faceI))
if (pShapeMesh.isInternalFace(facei))
{
FatalErrorInFunction
<< "Face " << faceI << " on new patch "
<< patchNames[patchI]
<< "Face " << facei << " on new patch "
<< patchNames[patchi]
<< " is not an external face of the mesh." << endl
<< exit(FatalError);
}
if (facePatchID[faceI - pShapeMesh.nInternalFaces()]!= -1)
if (facePatchID[facei - pShapeMesh.nInternalFaces()]!= -1)
{
FatalErrorInFunction
<< "Face " << faceI << " on new patch "
<< patchNames[patchI]
<< "Face " << facei << " on new patch "
<< patchNames[patchi]
<< " has already been marked for repatching to"
<< " patch "
<< facePatchID[faceI - pShapeMesh.nInternalFaces()]
<< facePatchID[facei - pShapeMesh.nInternalFaces()]
<< exit(FatalError);
}
facePatchID[faceI - pShapeMesh.nInternalFaces()] = nBoundaries;
facePatchID[facei - pShapeMesh.nInternalFaces()] = nBoundaries;
}
//add to boundary patch
Info<< "Adding new patch " << patchNames[patchI]
<< " of type " << patchTypes[patchI]
Info<< "Adding new patch " << patchNames[patchi]
<< " of type " << patchTypes[patchi]
<< " as patch " << nBoundaries << endl;
// Add patch to new patch list
@ -1450,8 +1450,8 @@ int main(int argc, char *argv[])
(
polyPatch::New
(
patchTypes[patchI],
patchNames[patchI],
patchTypes[patchi],
patchNames[patchi],
sz,
cMeshFace,
nBoundaries,
@ -1463,7 +1463,7 @@ int main(int argc, char *argv[])
}
else
{
Info<< "Patch " << patchNames[patchI]
Info<< "Patch " << patchNames[patchi]
<< " is internal to the mesh "
<< " and is not being added to the boundary."
<< endl;
@ -1524,9 +1524,9 @@ int main(int argc, char *argv[])
// Change patch ids
forAll(facePatchID, idI)
{
label faceI = idI + pShapeMesh.nInternalFaces();
label facei = idI + pShapeMesh.nInternalFaces();
repatcher.changePatchID(faceI, facePatchID[idI]);
repatcher.changePatchID(facei, facePatchID[idI]);
}
repatcher.repatch();
@ -1538,12 +1538,12 @@ int main(int argc, char *argv[])
// Re-do face matching to write sets
if (writeSets)
{
forAll(patches, patchI)
forAll(patches, patchi)
{
const faceList& bFaces = patches[patchI];
const faceList& bFaces = patches[patchi];
label sz = bFaces.size();
faceSet pFaceSet(pShapeMesh, patchNames[patchI], sz);
faceSet pFaceSet(pShapeMesh, patchNames[patchi], sz);
forAll(bFaces, j)
{
@ -1551,7 +1551,7 @@ int main(int argc, char *argv[])
label cMeshFace = findFace(pShapeMesh, f);
pFaceSet.insert(cMeshFace);
}
Info<< "Writing patch " << patchNames[patchI]
Info<< "Writing patch " << patchNames[patchi]
<< " of size " << sz << " to faceSet" << endl;
pFaceSet.instance() = pShapeMesh.instance();
@ -1629,15 +1629,15 @@ int main(int argc, char *argv[])
);
DynamicList<label> zoneFaces(pShapeMesh.nFaces());
forAll(pShapeMesh.faceNeighbour(), faceI)
forAll(pShapeMesh.faceNeighbour(), facei)
{
label nei = pShapeMesh.faceNeighbour()[faceI];
label own = pShapeMesh.faceOwner()[faceI];
label nei = pShapeMesh.faceNeighbour()[facei];
label own = pShapeMesh.faceOwner()[facei];
if (nei != -1)
{
if (zoneCell[nei] && zoneCell[own])
{
zoneFaces.append(faceI);
zoneFaces.append(facei);
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -113,13 +113,13 @@ void Foam::fluentFvMesh::writeFluentMesh() const
const pointField& p = points();
forAll(p, pointI)
forAll(p, pointi)
{
fluentMeshFile
<< " "
<< p[pointI].x() << " "
<< p[pointI].y()
<< " " << p[pointI].z() << std::endl;
<< p[pointi].x() << " "
<< p[pointi].y()
<< " " << p[pointi].z() << std::endl;
}
fluentMeshFile
@ -135,9 +135,9 @@ void Foam::fluentFvMesh::writeFluentMesh() const
<< "(13 (2 1 "
<< own.size() << " 2 0)" << std::endl << "(" << std::endl;
forAll(own, faceI)
forAll(own, facei)
{
const labelList& l = fcs[faceI];
const labelList& l = fcs[facei];
fluentMeshFile << " ";
@ -148,8 +148,8 @@ void Foam::fluentFvMesh::writeFluentMesh() const
fluentMeshFile << l[lI] + 1 << " ";
}
fluentMeshFile << nei[faceI] + 1 << " ";
fluentMeshFile << own[faceI] + 1 << std::endl;
fluentMeshFile << nei[facei] + 1 << " ";
fluentMeshFile << own[facei] + 1 << std::endl;
}
fluentMeshFile << "))" << std::endl;
@ -157,31 +157,31 @@ void Foam::fluentFvMesh::writeFluentMesh() const
label nWrittenFaces = own.size();
// Writing boundary faces
forAll(boundary(), patchI)
forAll(boundary(), patchi)
{
const faceUList& patchFaces = boundaryMesh()[patchI];
const faceUList& patchFaces = boundaryMesh()[patchi];
const labelList& patchFaceCells =
boundaryMesh()[patchI].faceCells();
boundaryMesh()[patchi].faceCells();
// The face group will be offset by 10 from the patch label
// Write header
fluentMeshFile
<< "(13 (" << patchI + 10 << " " << nWrittenFaces + 1
<< "(13 (" << patchi + 10 << " " << nWrittenFaces + 1
<< " " << nWrittenFaces + patchFaces.size() << " ";
nWrittenFaces += patchFaces.size();
// Write patch type
if (isA<wallFvPatch>(boundary()[patchI]))
if (isA<wallFvPatch>(boundary()[patchi]))
{
fluentMeshFile << 3;
}
else if
(
isA<symmetryPlaneFvPatch>(boundary()[patchI])
|| isA<symmetryFvPatch>(boundary()[patchI])
isA<symmetryPlaneFvPatch>(boundary()[patchi])
|| isA<symmetryFvPatch>(boundary()[patchi])
)
{
fluentMeshFile << 7;
@ -194,9 +194,9 @@ void Foam::fluentFvMesh::writeFluentMesh() const
fluentMeshFile
<<" 0)" << std::endl << "(" << std::endl;
forAll(patchFaces, faceI)
forAll(patchFaces, facei)
{
const labelList& l = patchFaces[faceI];
const labelList& l = patchFaces[facei];
fluentMeshFile << " ";
@ -210,7 +210,7 @@ void Foam::fluentFvMesh::writeFluentMesh() const
fluentMeshFile << l[lI] + 1 << " ";
}
fluentMeshFile << patchFaceCells[faceI] + 1 << " 0" << std::endl;
fluentMeshFile << patchFaceCells[facei] + 1 << " 0" << std::endl;
}
fluentMeshFile << "))" << std::endl;
@ -230,21 +230,21 @@ void Foam::fluentFvMesh::writeFluentMesh() const
bool hasWarned = false;
forAll(cells, cellI)
forAll(cells, celli)
{
if (cells[cellI].model() == tet)
if (cells[celli].model() == tet)
{
fluentMeshFile << " " << 2;
}
else if (cells[cellI].model() == hex)
else if (cells[celli].model() == hex)
{
fluentMeshFile << " " << 4;
}
else if (cells[cellI].model() == pyr)
else if (cells[celli].model() == pyr)
{
fluentMeshFile << " " << 5;
}
else if (cells[cellI].model() == prism)
else if (cells[celli].model() == prism)
{
fluentMeshFile << " " << 6;
}
@ -256,7 +256,7 @@ void Foam::fluentFvMesh::writeFluentMesh() const
WarningInFunction
<< "foamMeshToFluent: cell shape for cell "
<< cellI << " only supported by Fluent polyhedral meshes."
<< celli << " only supported by Fluent polyhedral meshes."
<< nl
<< " Suppressing any further messages for polyhedral"
<< " cells." << endl;
@ -275,20 +275,20 @@ void Foam::fluentFvMesh::writeFluentMesh() const
fluentMeshFile << "(39 (2 interior interior-1)())" << std::endl;
// Writing boundary patch types
forAll(boundary(), patchI)
forAll(boundary(), patchi)
{
fluentMeshFile
<< "(39 (" << patchI + 10 << " ";
<< "(39 (" << patchi + 10 << " ";
// Write patch type
if (isA<wallFvPatch>(boundary()[patchI]))
if (isA<wallFvPatch>(boundary()[patchi]))
{
fluentMeshFile << "wall ";
}
else if
(
isA<symmetryPlaneFvPatch>(boundary()[patchI])
|| isA<symmetryFvPatch>(boundary()[patchI])
isA<symmetryPlaneFvPatch>(boundary()[patchi])
|| isA<symmetryFvPatch>(boundary()[patchi])
)
{
fluentMeshFile << "symmetry ";
@ -299,7 +299,7 @@ void Foam::fluentFvMesh::writeFluentMesh() const
}
fluentMeshFile
<< boundary()[patchI].name() << ")())" << std::endl;
<< boundary()[patchi].name() << ")())" << std::endl;
}
}

View File

@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,15 +31,15 @@ Description
Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
Usage
- foamToStarMesh [OPTION] \n
Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
\b foamToStarMesh [OPTION]
\param -noBnd \n
Suppress writing the \c .bnd file
Options:
- \par -noBnd
Suppress writing the \c .bnd file
\param -scale \<factor\>\n
Specify an alternative geometry scaling factor.
The default is \b 1000 (scale \em [m] to \em [mm]).
- \par -scale \<factor\>
Specify an alternative geometry scaling factor.
The default is \b 1000 (scale \em [m] to \em [mm]).
Note
The cellTable information available in the files
@ -47,8 +47,8 @@ Note
will be used if available. Otherwise the cellZones are used when
creating the cellTable information.
See Also
Foam::cellTable, Foam::meshWriter and Foam::meshWriters::STARCD
See also
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"))
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,15 +31,15 @@ Description
Reads an OpenFOAM mesh and writes the boundaries in a surface format.
Usage
- foamToSurface [OPTION] \n
Reads an OpenFOAM mesh and writes the boundaries in a surface format.
\b foamToSurface [OPTION]
\param -scale \<factor\>\n
Specify an alternative geometry scaling factor.
Eg, use \b 1000 to scale \em [m] to \em [mm].
Options:
- \par -scale \<factor\>
Specify an alternative geometry scaling factor.
E.g. use \b 1000 to scale \em [m] to \em [mm].
\param -tri \n
Triangulate surface.
- \par -tri
Triangulate surface.
\*---------------------------------------------------------------------------*/

View File

@ -331,14 +331,14 @@ mtype {space}"MTYPE:"{space}
IStringStream elementStream(YYText());
label cellI(readLabel(elementStream));
label celli(readLabel(elementStream));
label cellType(readLabel(elementStream));
label nVertices(readLabel(elementStream));
// reset number of continuation lines
nCellContinuationLines = 0;
cellMap[curNumberOfCells] = cellI;
cellMap[curNumberOfCells] = celli;
cellTypes[curNumberOfCells] = cellType;
cellLabels.set(curNumberOfCells, new labelList(nVertices));
@ -666,38 +666,38 @@ int main(int argc, char *argv[])
// make a point mapping array
label maxPointIndex = 0;
forAll(pointMap, pointI)
forAll(pointMap, pointi)
{
if (pointMap[pointI] > maxPointIndex)
if (pointMap[pointi] > maxPointIndex)
{
maxPointIndex = pointMap[pointI];
maxPointIndex = pointMap[pointi];
}
}
labelList pointLookup(maxPointIndex + 1, -1);
forAll(pointMap, pointI)
forAll(pointMap, pointi)
{
pointLookup[pointMap[pointI] ] = pointI;
pointLookup[pointMap[pointi] ] = pointi;
}
// make a cell mapping array
label maxCellIndex = 0;
forAll(cellMap, cellI)
forAll(cellMap, celli)
{
if (cellMap[cellI] > maxCellIndex)
if (cellMap[celli] > maxCellIndex)
{
maxCellIndex = cellMap[cellI];
maxCellIndex = cellMap[celli];
}
}
labelList cellLookup(maxCellIndex + 1);
forAll(cellMap, cellI)
forAll(cellMap, celli)
{
cellLookup[cellMap[cellI] ] = cellI;
cellLookup[cellMap[celli] ] = celli;
}
const cellModel& hex = *(cellModeller::lookup("hex"));
@ -712,23 +712,23 @@ int main(int argc, char *argv[])
cellShapeList cells(cellLabels.size());
forAll(cellTypes, cellI)
forAll(cellTypes, celli)
{
const labelList& curCellLabels = cellLabels[cellI];
const labelList& curCellLabels = cellLabels[celli];
// Tetrahedron
if (cellTypes[cellI] == 6)
if (cellTypes[celli] == 6)
{
labelsTet[0] = pointLookup[curCellLabels[0] ];
labelsTet[1] = pointLookup[curCellLabels[2] ];
labelsTet[2] = pointLookup[curCellLabels[3] ];
labelsTet[3] = pointLookup[curCellLabels[1] ];
cells[cellI] = cellShape(tet, labelsTet);
cells[celli] = cellShape(tet, labelsTet);
}
// Square-based pyramid
else if (cellTypes[cellI] == 7)
else if (cellTypes[celli] == 7)
{
labelsPyramid[0] = pointLookup[curCellLabels[0] ];
labelsPyramid[1] = pointLookup[curCellLabels[1] ];
@ -736,11 +736,11 @@ int main(int argc, char *argv[])
labelsPyramid[3] = pointLookup[curCellLabels[2] ];
labelsPyramid[4] = pointLookup[curCellLabels[4] ];
cells[cellI] = cellShape(pyr, labelsPyramid);
cells[celli] = cellShape(pyr, labelsPyramid);
}
// Triangular prism
else if (cellTypes[cellI] == 5)
else if (cellTypes[celli] == 5)
{
labelsPrism[0] = pointLookup[curCellLabels[0] ];
labelsPrism[1] = pointLookup[curCellLabels[1] ];
@ -749,11 +749,11 @@ int main(int argc, char *argv[])
labelsPrism[4] = pointLookup[curCellLabels[4] ];
labelsPrism[5] = pointLookup[curCellLabels[5] ];
cells[cellI] = cellShape(prism, labelsPrism);
cells[celli] = cellShape(prism, labelsPrism);
}
// Hex
else if (cellTypes[cellI] == 4)
else if (cellTypes[celli] == 4)
{
labelsHex[0] = pointLookup[curCellLabels[0] ];
labelsHex[1] = pointLookup[curCellLabels[1] ];
@ -764,7 +764,7 @@ int main(int argc, char *argv[])
labelsHex[6] = pointLookup[curCellLabels[7] ];
labelsHex[7] = pointLookup[curCellLabels[6] ];
cells[cellI] = cellShape(hex, labelsHex);
cells[celli] = cellShape(hex, labelsHex);
}
}
@ -783,26 +783,26 @@ int main(int argc, char *argv[])
faceListList boundary(patchCells.size());
forAll(patchCells, patchI)
forAll(patchCells, patchi)
{
labelList& curCells = patchCells[patchI];
labelList& curFaces = patchCellFaces[patchI];
labelList& curCells = patchCells[patchi];
labelList& curFaces = patchCellFaces[patchi];
faceList& patchFaces = boundary[patchI];
faceList& patchFaces = boundary[patchi];
patchFaces.setSize(curCells.size());
forAll(curCells, faceI)
forAll(curCells, facei)
{
patchFaces[faceI] =
cells[cellLookup[curCells[faceI] ] ].faces()
patchFaces[facei] =
cells[cellLookup[curCells[facei] ] ].faces()
[
faceIndex
[
// this picks a cell type
cells[cellLookup[curCells[faceI] ] ]
cells[cellLookup[curCells[facei] ] ]
.model().index()
]
[curFaces[faceI] - 1] // this gives a fluent face - 1
[curFaces[facei] - 1] // this gives a fluent face - 1
];
}
@ -834,14 +834,14 @@ int main(int argc, char *argv[])
);
// Add information to dictionary
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
if (!patchDicts.set(patchI))
if (!patchDicts.set(patchi))
{
patchDicts.set(patchI, new dictionary());
patchDicts.set(patchi, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", polyPatch::typeName, false);
patchDicts[patchi].add("type", polyPatch::typeName, false);
}
polyMesh pShapeMesh

View File

@ -128,9 +128,9 @@ label findFace(const primitivePatch& pp, const labelList& meshF)
// meshF vertices (in any order ;-)
forAll(pFaces, i)
{
label faceI = pFaces[i];
label facei = pFaces[i];
const face& f = pp[faceI];
const face& f = pp[facei];
// Count uses of vertices of meshF for f
label nMatched = 0;
@ -145,7 +145,7 @@ label findFace(const primitivePatch& pp, const labelList& meshF)
if (nMatched == meshF.size())
{
return faceI;
return facei;
}
}
@ -160,9 +160,9 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
forAll(pFaces, i)
{
label faceI = pFaces[i];
label facei = pFaces[i];
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
// Count uses of vertices of meshF for f
label nMatched = 0;
@ -177,7 +177,7 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
if (nMatched == meshF.size())
{
return faceI;
return facei;
}
}
return -1;
@ -215,7 +215,7 @@ bool correctOrientation(const pointField& points, const cellShape& shape)
void storeCellInZone
(
const label regPhys,
const label cellI,
const label celli,
Map<label>& physToZone,
labelList& zoneToPhys,
@ -236,12 +236,12 @@ void storeCellInZone
physToZone.insert(regPhys, zoneI);
zoneToPhys[zoneI] = regPhys;
zoneCells[zoneI].append(cellI);
zoneCells[zoneI].append(celli);
}
else
{
// Existing zone for region
zoneCells[zoneFnd()].append(cellI);
zoneCells[zoneFnd()].append(celli);
}
}
@ -303,7 +303,7 @@ void readPoints(IFstream& inFile, pointField& points, Map<label>& mshToFoam)
points.setSize(nVerts);
mshToFoam.resize(2*nVerts);
for (label pointI = 0; pointI < nVerts; pointI++)
for (label pointi = 0; pointi < nVerts; pointi++)
{
label mshLabel;
scalar xVal, yVal, zVal;
@ -314,13 +314,13 @@ void readPoints(IFstream& inFile, pointField& points, Map<label>& mshToFoam)
lineStr >> mshLabel >> xVal >> yVal >> zVal;
point& pt = points[pointI];
point& pt = points[pointi];
pt.x() = xVal;
pt.y() = yVal;
pt.z() = zVal;
mshToFoam.insert(mshLabel, pointI);
mshToFoam.insert(mshLabel, pointi);
}
Info<< "Vertices read:" << mshToFoam.size() << endl;
@ -462,7 +462,7 @@ void readCells
// Storage for all cells. Too big. Shrink later
cells.setSize(nElems);
label cellI = 0;
label celli = 0;
label nTet = 0;
label nPyr = 0;
label nPrism = 0;
@ -521,28 +521,28 @@ void readCells
Map<label>::iterator regFnd = physToPatch.find(regPhys);
label patchI = -1;
label patchi = -1;
if (regFnd == physToPatch.end())
{
// New region. Allocate patch for it.
patchI = patchFaces.size();
patchi = patchFaces.size();
patchFaces.setSize(patchI + 1);
patchToPhys.setSize(patchI + 1);
patchFaces.setSize(patchi + 1);
patchToPhys.setSize(patchi + 1);
Info<< "Mapping region " << regPhys << " to Foam patch "
<< patchI << endl;
physToPatch.insert(regPhys, patchI);
patchToPhys[patchI] = regPhys;
<< patchi << endl;
physToPatch.insert(regPhys, patchi);
patchToPhys[patchi] = regPhys;
}
else
{
// Existing patch for region
patchI = regFnd();
patchi = regFnd();
}
// Add triangle to correct patchFaces.
patchFaces[patchI].append(triPoints);
patchFaces[patchi].append(triPoints);
}
else if (elmType == MSHQUAD)
{
@ -554,35 +554,35 @@ void readCells
Map<label>::iterator regFnd = physToPatch.find(regPhys);
label patchI = -1;
label patchi = -1;
if (regFnd == physToPatch.end())
{
// New region. Allocate patch for it.
patchI = patchFaces.size();
patchi = patchFaces.size();
patchFaces.setSize(patchI + 1);
patchToPhys.setSize(patchI + 1);
patchFaces.setSize(patchi + 1);
patchToPhys.setSize(patchi + 1);
Info<< "Mapping region " << regPhys << " to Foam patch "
<< patchI << endl;
physToPatch.insert(regPhys, patchI);
patchToPhys[patchI] = regPhys;
<< patchi << endl;
physToPatch.insert(regPhys, patchi);
patchToPhys[patchi] = regPhys;
}
else
{
// Existing patch for region
patchI = regFnd();
patchi = regFnd();
}
// Add quad to correct patchFaces.
patchFaces[patchI].append(quadPoints);
patchFaces[patchi].append(quadPoints);
}
else if (elmType == MSHTET)
{
storeCellInZone
(
regPhys,
cellI,
celli,
physToZone,
zoneToPhys,
zoneCells
@ -594,7 +594,7 @@ void readCells
renumber(mshToFoam, tetPoints);
cells[cellI++] = cellShape(tet, tetPoints);
cells[celli++] = cellShape(tet, tetPoints);
nTet++;
}
@ -603,7 +603,7 @@ void readCells
storeCellInZone
(
regPhys,
cellI,
celli,
physToZone,
zoneToPhys,
zoneCells
@ -615,7 +615,7 @@ void readCells
renumber(mshToFoam, pyrPoints);
cells[cellI++] = cellShape(pyr, pyrPoints);
cells[celli++] = cellShape(pyr, pyrPoints);
nPyr++;
}
@ -624,7 +624,7 @@ void readCells
storeCellInZone
(
regPhys,
cellI,
celli,
physToZone,
zoneToPhys,
zoneCells
@ -636,13 +636,13 @@ void readCells
renumber(mshToFoam, prismPoints);
cells[cellI] = cellShape(prism, prismPoints);
cells[celli] = cellShape(prism, prismPoints);
const cellShape& cell = cells[cellI];
const cellShape& cell = cells[celli];
if (!keepOrientation && !correctOrientation(points, cell))
{
Info<< "Inverting prism " << cellI << endl;
Info<< "Inverting prism " << celli << endl;
// Reorder prism.
prismPoints[0] = cell[0];
prismPoints[1] = cell[2];
@ -651,10 +651,10 @@ void readCells
prismPoints[4] = cell[4];
prismPoints[5] = cell[5];
cells[cellI] = cellShape(prism, prismPoints);
cells[celli] = cellShape(prism, prismPoints);
}
cellI++;
celli++;
nPrism++;
}
@ -663,7 +663,7 @@ void readCells
storeCellInZone
(
regPhys,
cellI,
celli,
physToZone,
zoneToPhys,
zoneCells
@ -677,13 +677,13 @@ void readCells
renumber(mshToFoam, hexPoints);
cells[cellI] = cellShape(hex, hexPoints);
cells[celli] = cellShape(hex, hexPoints);
const cellShape& cell = cells[cellI];
const cellShape& cell = cells[celli];
if (!keepOrientation && !correctOrientation(points, cell))
{
Info<< "Inverting hex " << cellI << endl;
Info<< "Inverting hex " << celli << endl;
// Reorder hex.
hexPoints[0] = cell[4];
hexPoints[1] = cell[5];
@ -694,10 +694,10 @@ void readCells
hexPoints[6] = cell[2];
hexPoints[7] = cell[3];
cells[cellI] = cellShape(hex, hexPoints);
cells[celli] = cellShape(hex, hexPoints);
}
cellI++;
celli++;
nHex++;
}
@ -721,11 +721,11 @@ void readCells
}
cells.setSize(cellI);
cells.setSize(celli);
forAll(patchFaces, patchI)
forAll(patchFaces, patchi)
{
patchFaces[patchI].shrink();
patchFaces[patchi].shrink();
}
@ -896,22 +896,22 @@ int main(int argc, char *argv[])
wordList boundaryPatchNames(boundaryFaces.size());
forAll(boundaryPatchNames, patchI)
forAll(boundaryPatchNames, patchi)
{
label physReg = patchToPhys[patchI];
label physReg = patchToPhys[patchi];
Map<word>::const_iterator iter = physicalNames.find(physReg);
if (iter != physicalNames.end())
{
boundaryPatchNames[patchI] = iter();
boundaryPatchNames[patchi] = iter();
}
else
{
boundaryPatchNames[patchI] = word("patch") + name(patchI);
boundaryPatchNames[patchi] = word("patch") + name(patchi);
}
Info<< "Patch " << patchI << " gets name "
<< boundaryPatchNames[patchI] << endl;
Info<< "Patch " << patchi << " gets name "
<< boundaryPatchNames[patchi] << endl;
}
Info<< endl;
@ -954,34 +954,34 @@ int main(int argc, char *argv[])
// Go through all the patchFaces and find corresponding face in pp.
forAll(patchFaces, patchI)
forAll(patchFaces, patchi)
{
const DynamicList<face>& pFaces = patchFaces[patchI];
const DynamicList<face>& pFaces = patchFaces[patchi];
Info<< "Finding faces of patch " << patchI << endl;
Info<< "Finding faces of patch " << patchi << endl;
forAll(pFaces, i)
{
const face& f = pFaces[i];
// Find face in pp using all vertices of f.
label patchFaceI = findFace(pp, f);
label patchFacei = findFace(pp, f);
if (patchFaceI != -1)
if (patchFacei != -1)
{
label meshFaceI = pp.start() + patchFaceI;
label meshFacei = pp.start() + patchFacei;
repatcher.changePatchID(meshFaceI, patchI);
repatcher.changePatchID(meshFacei, patchi);
}
else
{
// Maybe internal face? If so add to faceZone with same index
// - might be useful.
label meshFaceI = findInternalFace(mesh, f);
label meshFacei = findInternalFace(mesh, f);
if (meshFaceI != -1)
if (meshFacei != -1)
{
zoneFaces[patchI].append(meshFaceI);
zoneFaces[patchi].append(meshFacei);
}
else
{
@ -1119,22 +1119,22 @@ int main(int argc, char *argv[])
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
{
List<polyPatch*> newPatchPtrList((mesh.boundaryMesh().size() - 1));
label newPatchI = 0;
forAll(mesh.boundaryMesh(), patchI)
label newPatchi = 0;
forAll(mesh.boundaryMesh(), patchi)
{
if (patchI != defaultPatchID)
if (patchi != defaultPatchID)
{
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const polyPatch& patch = mesh.boundaryMesh()[patchi];
newPatchPtrList[newPatchI] = patch.clone
newPatchPtrList[newPatchi] = patch.clone
(
mesh.boundaryMesh(),
newPatchI,
newPatchi,
patch.size(),
patch.start()
).ptr();
newPatchI++;
newPatchi++;
}
}
repatcher.changePatches(newPatchPtrList);

View File

@ -215,20 +215,20 @@ void readPoints
string line;
is.getLine(line);
label pointI = readLabel(IStringStream(line.substr(0, 10))());
label pointi = readLabel(IStringStream(line.substr(0, 10))());
if (pointI == -1)
if (pointi == -1)
{
break;
}
else if (pointI != points.size()+1 && !hasWarned)
else if (pointi != points.size()+1 && !hasWarned)
{
hasWarned = true;
IOWarningInFunction
(
is
) << "Points not in order starting at point " << pointI
) << "Points not in order starting at point " << pointi
//<< " at line " << is.lineNumber()
//<< abort(FatalError);
<< endl;
@ -240,7 +240,7 @@ void readPoints
pt[1] = readUnvScalar(line.substr(25, 25));
pt[2] = readUnvScalar(line.substr(50, 25));
unvPointID.append(pointI);
unvPointID.append(pointi);
points.append(pt);
}
@ -253,15 +253,15 @@ void readPoints
void addAndExtend
(
DynamicList<label>& indizes,
label cellI,
label celli,
label val
)
{
if (indizes.size() < (cellI+1))
if (indizes.size() < (celli+1))
{
indizes.setSize(cellI+1,-1);
indizes.setSize(celli+1,-1);
}
indizes[cellI] = val;
indizes[celli] = val;
}
// Reads cells section. Read region as well? Not handled yet but should just
@ -282,9 +282,9 @@ void readCells
// Invert point numbering.
label maxUnvPoint = 0;
forAll(unvPointID, pointI)
forAll(unvPointID, pointi)
{
maxUnvPoint = max(maxUnvPoint, unvPointID[pointI]);
maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]);
}
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
@ -307,16 +307,16 @@ void readCells
break;
}
label cellI, feID, physProp, matProp, colour, nNodes;
label celli, feID, physProp, matProp, colour, nNodes;
IStringStream lineStr(line);
lineStr
>> cellI >> feID >> physProp >> matProp >> colour >> nNodes;
>> celli >> feID >> physProp >> matProp >> colour >> nNodes;
if (foundFeType.insert(feID))
{
Info<< "First occurrence of element type " << feID
<< " for cell " << cellI << " at line "
<< " for cell " << celli << " at line "
<< is.lineNumber() << endl;
}
@ -341,7 +341,7 @@ void readCells
lineStr
>> cVerts[0] >> cVerts[1] >> cVerts[2];
boundaryFaces.append(cVerts);
boundaryFaceIndices.append(cellI);
boundaryFaceIndices.append(celli);
}
else if (feID == 44 || feID == 94)
{
@ -353,7 +353,7 @@ void readCells
lineStr
>> cVerts[0] >> cVerts[1] >> cVerts[2] >> cVerts[3];
boundaryFaces.append(cVerts);
boundaryFaceIndices.append(cellI);
boundaryFaceIndices.append(celli);
}
else if (feID == 111)
{
@ -367,12 +367,12 @@ void readCells
cellVerts.append(cellShape(tet, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
addAndExtend(cellCorrespondence,celli,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
Info<< "Line:" << is.lineNumber()
<< " element:" << cellI
<< " element:" << celli
<< " type:" << feID
<< " collapsed from " << cVerts << nl
<< " to:" << cellVerts.last()
@ -392,12 +392,12 @@ void readCells
cellVerts.append(cellShape(prism, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
addAndExtend(cellCorrespondence,celli,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
Info<< "Line:" << is.lineNumber()
<< " element:" << cellI
<< " element:" << celli
<< " type:" << feID
<< " collapsed from " << cVerts << nl
<< " to:" << cellVerts.last()
@ -417,12 +417,12 @@ void readCells
cellVerts.append(cellShape(hex, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
addAndExtend(cellCorrespondence,celli,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
Info<< "Line:" << is.lineNumber()
<< " element:" << cellI
<< " element:" << celli
<< " type:" << feID
<< " collapsed from " << cVerts << nl
<< " to:" << cellVerts.last()
@ -449,12 +449,12 @@ void readCells
cellVerts.append(cellShape(tet, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
addAndExtend(cellCorrespondence,celli,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
Info<< "Line:" << is.lineNumber()
<< " element:" << cellI
<< " element:" << celli
<< " type:" << feID
<< " collapsed from " << cVerts << nl
<< " to:" << cellVerts.last()
@ -608,10 +608,10 @@ void readDOFS
}
IStringStream lineStr(line);
label pointI;
lineStr >> pointI;
label pointi;
lineStr >> pointi;
vertices.append(pointI);
vertices.append(pointi);
}
Info<< "For DOF set " << group
@ -628,16 +628,16 @@ void readDOFS
// Returns -1 or group that all of the vertices of f are in,
label findPatch(const List<labelHashSet>& dofGroups, const face& f)
{
forAll(dofGroups, patchI)
forAll(dofGroups, patchi)
{
if (dofGroups[patchI].found(f[0]))
if (dofGroups[patchi].found(f[0]))
{
bool allInGroup = true;
// Check rest of face
for (label fp = 1; fp < f.size(); fp++)
{
if (!dofGroups[patchI].found(f[fp]))
if (!dofGroups[patchi].found(f[fp]))
{
allInGroup = false;
break;
@ -646,7 +646,7 @@ label findPatch(const List<labelHashSet>& dofGroups, const face& f)
if (allInGroup)
{
return patchI;
return patchi;
}
}
}
@ -784,56 +784,56 @@ int main(int argc, char *argv[])
// Invert point numbering.
label maxUnvPoint = 0;
forAll(unvPointID, pointI)
forAll(unvPointID, pointi)
{
maxUnvPoint = max(maxUnvPoint, unvPointID[pointI]);
maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]);
}
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
// Renumber vertex numbers on cells
forAll(cellVerts, cellI)
forAll(cellVerts, celli)
{
labelList foamVerts
(
renumber
(
unvToFoam,
static_cast<labelList&>(cellVerts[cellI])
static_cast<labelList&>(cellVerts[celli])
)
);
if (findIndex(foamVerts, -1) != -1)
{
FatalErrorInFunction
<< "Cell " << cellI
<< " unv vertices " << cellVerts[cellI]
<< "Cell " << celli
<< " unv vertices " << cellVerts[celli]
<< " has some undefined vertices " << foamVerts
<< abort(FatalError);
}
// Bit nasty: replace vertex list.
cellVerts[cellI].transfer(foamVerts);
cellVerts[celli].transfer(foamVerts);
}
// Renumber vertex numbers on boundaryFaces
forAll(boundaryFaces, bFaceI)
forAll(boundaryFaces, bFacei)
{
labelList foamVerts(renumber(unvToFoam, boundaryFaces[bFaceI]));
labelList foamVerts(renumber(unvToFoam, boundaryFaces[bFacei]));
if (findIndex(foamVerts, -1) != -1)
{
FatalErrorInFunction
<< "Boundary face " << bFaceI
<< " unv vertices " << boundaryFaces[bFaceI]
<< "Boundary face " << bFacei
<< " unv vertices " << boundaryFaces[bFacei]
<< " has some undefined vertices " << foamVerts
<< abort(FatalError);
}
// Bit nasty: replace vertex list.
boundaryFaces[bFaceI].transfer(foamVerts);
boundaryFaces[bFacei].transfer(foamVerts);
}
@ -853,15 +853,15 @@ int main(int argc, char *argv[])
{
HashTable<label, face, Hash<face>> faceToFaceID(boundaryFaces.size());
forAll(boundaryFaces, faceI)
forAll(boundaryFaces, facei)
{
SortableList<label> sortedVerts(boundaryFaces[faceI]);
faceToFaceID.insert(face(sortedVerts), faceI);
SortableList<label> sortedVerts(boundaryFaces[facei]);
faceToFaceID.insert(face(sortedVerts), facei);
}
forAll(cellVerts, cellI)
forAll(cellVerts, celli)
{
faceList faces = cellVerts[cellI].faces();
faceList faces = cellVerts[celli].faces();
forAll(faces, i)
{
SortableList<label> sortedVerts(faces[i]);
@ -870,31 +870,31 @@ int main(int argc, char *argv[])
if (fnd != faceToFaceID.end())
{
label faceI = fnd();
int stat = face::compare(faces[i], boundaryFaces[faceI]);
label facei = fnd();
int stat = face::compare(faces[i], boundaryFaces[facei]);
if (stat == 1)
{
// Same orientation. Cell is owner.
own[faceI] = cellI;
own[facei] = celli;
}
else if (stat == -1)
{
// Opposite orientation. Cell is neighbour.
nei[faceI] = cellI;
nei[facei] = celli;
}
}
}
}
label nReverse = 0;
forAll(own, faceI)
forAll(own, facei)
{
if (own[faceI] == -1 && nei[faceI] != -1)
if (own[facei] == -1 && nei[facei] != -1)
{
// Boundary face with incorrect orientation
boundaryFaces[faceI] = boundaryFaces[faceI].reverseFace();
Swap(own[faceI], nei[faceI]);
boundaryFaces[facei] = boundaryFaces[facei].reverseFace();
Swap(own[facei], nei[facei]);
nReverse++;
}
}
@ -906,12 +906,12 @@ int main(int argc, char *argv[])
label cnt = 0;
forAll(own, faceI)
forAll(own, facei)
{
if (own[faceI] != -1 && nei[faceI] != -1)
if (own[facei] != -1 && nei[facei] != -1)
{
faceToCell[1].insert(faceI, own[faceI]);
faceToCell[0].insert(faceI, nei[faceI]);
faceToCell[1].insert(facei, own[facei]);
faceToCell[0].insert(facei, nei[facei]);
cnt++;
}
}
@ -940,40 +940,40 @@ int main(int argc, char *argv[])
<< " DOF sets to detect boundary faces."<< endl;
// Renumber vertex numbers on contraints
forAll(dofVertIndices, patchI)
forAll(dofVertIndices, patchi)
{
inplaceRenumber(unvToFoam, dofVertIndices[patchI]);
inplaceRenumber(unvToFoam, dofVertIndices[patchi]);
}
// Build labelHashSet of points per dofGroup/patch
List<labelHashSet> dofGroups(dofVertIndices.size());
forAll(dofVertIndices, patchI)
forAll(dofVertIndices, patchi)
{
const labelList& foamVerts = dofVertIndices[patchI];
const labelList& foamVerts = dofVertIndices[patchi];
forAll(foamVerts, i)
{
dofGroups[patchI].insert(foamVerts[i]);
dofGroups[patchi].insert(foamVerts[i]);
}
}
List<DynamicList<face>> dynPatchFaces(dofVertIndices.size());
forAll(cellVerts, cellI)
forAll(cellVerts, celli)
{
const cellShape& shape = cellVerts[cellI];
const cellShape& shape = cellVerts[celli];
const faceList shapeFaces(shape.faces());
forAll(shapeFaces, i)
{
label patchI = findPatch(dofGroups, shapeFaces[i]);
label patchi = findPatch(dofGroups, shapeFaces[i]);
if (patchI != -1)
if (patchi != -1)
{
dynPatchFaces[patchI].append(shapeFaces[i]);
dynPatchFaces[patchi].append(shapeFaces[i]);
}
}
}
@ -981,9 +981,9 @@ int main(int argc, char *argv[])
// Transfer
patchFaceVerts.setSize(dynPatchFaces.size());
forAll(dynPatchFaces, patchI)
forAll(dynPatchFaces, patchi)
{
patchFaceVerts[patchI].transfer(dynPatchFaces[patchI]);
patchFaceVerts[patchi].transfer(dynPatchFaces[patchi]);
}
}
else
@ -1008,12 +1008,12 @@ int main(int argc, char *argv[])
boundaryFaceToIndex.insert(boundaryFaceIndices[i], i);
}
forAll(patchFaceVerts, patchI)
forAll(patchFaceVerts, patchi)
{
Info << patchI << ": " << patchNames[patchI] << " is " << flush;
Info << patchi << ": " << patchNames[patchi] << " is " << flush;
faceList& patchFaces = patchFaceVerts[patchI];
const labelList& faceIndices = patchFaceIndices[patchI];
faceList& patchFaces = patchFaceVerts[patchi];
const labelList& faceIndices = patchFaceIndices[patchi];
patchFaces.setSize(faceIndices.size());
@ -1024,13 +1024,13 @@ int main(int argc, char *argv[])
{
if (boundaryFaceToIndex.found(faceIndices[i]))
{
label bFaceI = boundaryFaceToIndex[faceIndices[i]];
label bFacei = boundaryFaceToIndex[faceIndices[i]];
if (own[bFaceI] != -1 && nei[bFaceI] == -1)
if (own[bFacei] != -1 && nei[bFacei] == -1)
{
patchFaces[cnt] = boundaryFaces[bFaceI];
patchFaces[cnt] = boundaryFaces[bFacei];
cnt++;
if (alreadyOnBoundary.found(bFaceI))
if (alreadyOnBoundary.found(bFacei))
{
duplicateFaces = true;
}
@ -1040,14 +1040,14 @@ int main(int argc, char *argv[])
if (cnt != patchFaces.size() || duplicateFaces)
{
isAPatch[patchI] = false;
isAPatch[patchi] = false;
if (verbose)
{
if (cnt != patchFaces.size())
{
WarningInFunction
<< "For patch " << patchI << " there were "
<< "For patch " << patchi << " there were "
<< patchFaces.size()-cnt
<< " faces not used because they seem"
<< " to be internal. "
@ -1058,7 +1058,7 @@ int main(int argc, char *argv[])
{
WarningInFunction
<< "Patch "
<< patchI << " has faces that are already "
<< patchi << " has faces that are already "
<< " in use on other boundary-patches,"
<< " Assuming faceZoneset." << endl;
}
@ -1078,13 +1078,13 @@ int main(int argc, char *argv[])
<< "The face index " << faceIndices[i]
<< " was not found amongst the cells."
<< " This kills the theory that "
<< patchNames[patchI] << " is a cell zone"
<< patchNames[patchi] << " is a cell zone"
<< endl
<< abort(FatalError);
}
theCells[i] = cellCorrespondence[faceIndices[i]];
}
cellZones.insert(patchNames[patchI], theCells);
cellZones.insert(patchNames[patchi], theCells);
}
else
{
@ -1094,7 +1094,7 @@ int main(int argc, char *argv[])
{
theFaces[i] = boundaryFaceToIndex[faceIndices[i]];
}
faceZones.insert(patchNames[patchI],theFaces);
faceZones.insert(patchNames[patchi],theFaces);
}
}
else
@ -1103,8 +1103,8 @@ int main(int argc, char *argv[])
forAll(patchFaces, i)
{
label bFaceI = boundaryFaceToIndex[faceIndices[i]];
alreadyOnBoundary.insert(bFaceI);
label bFacei = boundaryFaceToIndex[faceIndices[i]];
alreadyOnBoundary.insert(bFacei);
}
}
}
@ -1143,14 +1143,14 @@ int main(int argc, char *argv[])
DynamicList<word> usedPatchNames;
DynamicList<faceList> usedPatchFaceVerts;
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
if (isAPatch[patchI])
if (isAPatch[patchi])
{
Info<< " " << patchNames[patchI] << '\t'
<< patchFaceVerts[patchI].size() << nl;
usedPatchNames.append(patchNames[patchI]);
usedPatchFaceVerts.append(patchFaceVerts[patchI]);
Info<< " " << patchNames[patchi] << '\t'
<< patchFaceVerts[patchi].size() << nl;
usedPatchNames.append(patchNames[patchi]);
usedPatchFaceVerts.append(patchFaceVerts[patchi]);
}
}
usedPatchNames.shrink();

View File

@ -546,14 +546,14 @@ preservePatchTypes
defaultFacesType
);
// Add information to dictionary
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
if (!patchDicts.set(patchI))
if (!patchDicts.set(patchi))
{
patchDicts.set(patchI, new dictionary());
patchDicts.set(patchi, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", patchTypes[patchI], false);
patchDicts[patchi].add("type", patchTypes[patchi], false);
}
// Build the mesh and write it out

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,24 +95,24 @@ int main(int argc, char *argv[])
if (readHex)
{
for (label cellI = 0; cellI < nCells; cellI++)
for (label celli = 0; celli < nCells; celli++)
{
for (label cp = 0; cp < 8; cp++)
{
mshStream >> hexPoints[cp];
}
cells[cellI] = cellShape(hex, hexPoints);
cells[celli] = cellShape(hex, hexPoints);
}
}
else
{
for (label cellI = 0; cellI < nCells; cellI++)
for (label celli = 0; celli < nCells; celli++)
{
for (label cp = 0; cp < 4; cp++)
{
mshStream >> tetPoints[cp];
}
cells[cellI] = cellShape(tet, tetPoints);
cells[celli] = cellShape(tet, tetPoints);
}
}
@ -126,13 +126,13 @@ int main(int argc, char *argv[])
pointField points(nPoints);
for (label pointI = 0; pointI < nPoints; pointI++)
for (label pointi = 0; pointi < nPoints; pointi++)
{
scalar x, y, z;
mshStream >> x >> y >> z;
points[pointI] = point(x, y, z);
points[pointi] = point(x, y, z);
}

View File

@ -108,13 +108,13 @@ int main(int argc, char *argv[])
pointField points(nNodes);
forAll(points, pointI)
forAll(points, pointi)
{
scalar x,y,z;
str >> x >> y >> z;
points[pointI] = point(x, y, z);
points[pointi] = point(x, y, z);
}
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
labelList tetPoints(4);
forAll(cells, cellI)
forAll(cells, celli)
{
label domain(readLabel(str));
@ -147,7 +147,7 @@ int main(int argc, char *argv[])
tetPoints[2] = readLabel(str) - 1;
tetPoints[3] = readLabel(str) - 1;
cells[cellI] = cellShape(tet, tetPoints);
cells[celli] = cellShape(tet, tetPoints);
}
@ -168,31 +168,31 @@ int main(int argc, char *argv[])
// Boundary faces as three vertices
HashTable<label, triFace, Hash<triFace>> vertsToBoundary(nFaces);
forAll(boundaryFaces, faceI)
forAll(boundaryFaces, facei)
{
label patchI(readLabel(str));
label patchi(readLabel(str));
if (patchI < 0)
if (patchi < 0)
{
FatalErrorInFunction
<< "Invalid boundary region number " << patchI
<< "Invalid boundary region number " << patchi
<< " on line " << str.lineNumber()
<< exit(FatalError);
}
maxPatch = max(maxPatch, patchI);
maxPatch = max(maxPatch, patchi);
triFace tri(readLabel(str)-1, readLabel(str)-1, readLabel(str)-1);
// Store boundary face as is for now. Later on reverse it.
boundaryFaces[faceI].setSize(3);
boundaryFaces[faceI][0] = tri[0];
boundaryFaces[faceI][1] = tri[1];
boundaryFaces[faceI][2] = tri[2];
boundaryPatch[faceI] = patchI;
boundaryFaces[facei].setSize(3);
boundaryFaces[facei][0] = tri[0];
boundaryFaces[facei][1] = tri[1];
boundaryFaces[facei][2] = tri[2];
boundaryPatch[facei] = patchi;
vertsToBoundary.insert(tri, faceI);
vertsToBoundary.insert(tri, facei);
}
label nPatches = maxPatch + 1;
@ -202,9 +202,9 @@ int main(int argc, char *argv[])
// For storage reasons I store the triangles and loop over the cells instead
// of the other way around (store cells and loop over triangles) though
// that would be faster.
forAll(cells, cellI)
forAll(cells, celli)
{
const cellShape& cll = cells[cellI];
const cellShape& cll = cells[celli];
// Get the four (outwards pointing) faces of the cell
faceList tris(cll.faces());
@ -220,7 +220,7 @@ int main(int argc, char *argv[])
if (iter != vertsToBoundary.end())
{
label faceI = iter();
label facei = iter();
const triFace& tri = iter.key();
// Determine orientation of tri v.s. cell centre.
@ -231,7 +231,7 @@ int main(int argc, char *argv[])
if (((fc - cc) & fn) < 0)
{
// Boundary face points inwards. Flip.
boundaryFaces[faceI].flip();
boundaryFaces[facei].flip();
}
// Done this face so erase from hash
@ -257,9 +257,9 @@ int main(int argc, char *argv[])
wordList patchNames(nPatches);
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
patchNames[patchI] = word("patch") + name(patchI);
patchNames[patchi] = word("patch") + name(patchi);
}
wordList patchTypes(nPatches, polyPatch::typeName);
@ -271,24 +271,24 @@ int main(int argc, char *argv[])
// Sort boundaryFaces by patch.
List<DynamicList<face>> allPatchFaces(nPatches);
forAll(boundaryPatch, faceI)
forAll(boundaryPatch, facei)
{
label patchI = boundaryPatch[faceI];
label patchi = boundaryPatch[facei];
allPatchFaces[patchI].append(boundaryFaces[faceI]);
allPatchFaces[patchi].append(boundaryFaces[facei]);
}
Info<< "Patches:" << nl
<< "\tNeutral Boundary\tPatch name\tSize" << nl
<< "\t----------------\t----------\t----" << endl;
forAll(allPatchFaces, patchI)
forAll(allPatchFaces, patchi)
{
Info<< '\t' << patchI << "\t\t\t"
<< patchNames[patchI] << "\t\t"
<< allPatchFaces[patchI].size() << endl;
Info<< '\t' << patchi << "\t\t\t"
<< patchNames[patchi] << "\t\t"
<< allPatchFaces[patchi].size() << endl;
patchFaces[patchI].transfer(allPatchFaces[patchI]);
patchFaces[patchi].transfer(allPatchFaces[patchi]);
}
Info<< endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -464,9 +464,9 @@ faceList hexBlock::patchFaces(const label direc, const labelList& range) const
else if (blockHandedness_ == left)
{
// turn all faces inside out
forAll(result, faceI)
forAll(result, facei)
{
result[faceI].flip();
result[facei].flip();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -210,16 +210,16 @@ int main(int argc, char *argv[])
{
labelListList curBlockCells = blocks[blockI].blockCells();
forAll(curBlockCells, blockCellI)
forAll(curBlockCells, blockCelli)
{
labelList cellPoints(curBlockCells[blockCellI].size());
labelList cellPoints(curBlockCells[blockCelli].size());
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
cellPoints[pointI] =
cellPoints[pointi] =
oldToNew
[
curBlockCells[blockCellI][pointI]
curBlockCells[blockCelli][pointi]
+ blockOffsets[blockI]
];
}

View File

@ -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

View File

@ -1,139 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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_;
}
// ************************************************************************* //

View File

@ -1,126 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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);
}
}
}
}
// ************************************************************************* //

View File

@ -1,144 +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 "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;
}
// ************************************************************************* //

View File

@ -1,188 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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()
}
// ************************************************************************* //

View File

@ -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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -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_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -1,149 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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;
}
}
}
}
}
// ************************************************************************* //

View File

@ -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
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;
}
}
}
}
// ************************************************************************* //

View File

@ -1,258 +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 "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]);
}
}
}
// ************************************************************************* //

View File

@ -1,319 +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 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);
}
}
// ************************************************************************* //

View File

@ -1,177 +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 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;
}
}
// ************************************************************************* //

View File

@ -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"
// ************************************************************************* //

View File

@ -1,220 +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"
#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_(NULL),
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_);
}
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //

View File

@ -1 +0,0 @@
#include "sammMesh.H"

View File

@ -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();
}
}
// ************************************************************************* //

View File

@ -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

View File

@ -1,7 +0,0 @@
EXE_INC = \
/* -DDEBUG_MERGE */ \
/* -DDEBUG_COUPLE */ \
/* -DDEBUG_COUPLE_INTERSECTION */ \
/* -DDEBUG_RIGHT_HAND_WALK */ \
/* -DDEBUG_FACE_ORDERING */ \
/* -DDEBUG_COUPLE_PROJECTION */

View File

@ -1,139 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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_;
}
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //

View File

@ -1,139 +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/>.
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
{
/*---------------------------------------------------------------------------*\
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
// ************************************************************************* //

View File

@ -1,201 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// 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;
}
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //

View File

@ -1,188 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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()
}
// ************************************************************************* //

View File

@ -1,148 +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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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;
}
}
}
}
}
// ************************************************************************* //

View File

@ -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_);
}
// ************************************************************************* //

View File

@ -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
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;
}
}
}
}
// ************************************************************************* //

View File

@ -1,256 +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 "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]);
}
}
}
// ************************************************************************* //

View File

@ -1,388 +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::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);
}
}
// ************************************************************************* //

View File

@ -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;
}
}
// ************************************************************************* //

View File

@ -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);
}
}
// ************************************************************************* //

View File

@ -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);
}
}
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //

View File

@ -1,295 +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 "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_(NULL),
couples_(0),
isShapeMesh_(true)
{
readPoints(scaleFactor);
readCells();
readBoundary();
fixCollapsedEdges();
readCouples();
if (couples_.size())
{
createCoupleMatches();
}
markBoundaryFaces();
mergeCoupleFacePoints();
purgeCellShapes();
collectBoundaryFaces();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::starMesh::~starMesh()
{
deleteDemandDrivenData(pointCellsPtr_);
}
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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();
}
}
// ************************************************************************* //

View File

@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,22 +31,25 @@ Description
Converts a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
Usage
- star4ToFoam [OPTION] ccmMesh\n
convert pro-STAR mesh to OpenFOAM
\b star4ToFoam [OPTION] prostarMesh
\param -ascii \n
Write in ASCII format instead of binary
Options:
- \par -ascii
Write in ASCII format instead of binary
\param -scale \<factor\>\n
Specify an alternative geometry scaling factor.
The default is \b 0.001 (scale \em [mm] to \em [m]).
- \par -scale \<factor\>
Specify an alternative geometry scaling factor.
The default is \b 0.001 (scale \em [mm] to \em [m]).
\param -solids \n
Treat any solid cells present just like fluid cells.
The default is to discard them.
- \par -solids
Treat any solid cells present just like fluid cells.
The default is to discard them.
Note
- baffles are written as interfaces for later use
Baffles are written as interfaces for later use
See Also
Foam::cellTable, Foam::meshReader and Foam::fileFormats::STARCDMeshReader
\*---------------------------------------------------------------------------*/
@ -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);

View File

@ -83,11 +83,11 @@ label findFace(const primitiveMesh& mesh, const face& f)
forAll(pFaces, i)
{
label faceI = pFaces[i];
label facei = pFaces[i];
if (mesh.faces()[faceI] == f)
if (mesh.faces()[facei] == f)
{
return faceI;
return facei;
}
}
@ -194,7 +194,7 @@ int main(int argc, char *argv[])
{
labelList pointIndex(nNodes);
label pointI = 0;
label pointi = 0;
while (nodeStream.good())
{
@ -221,15 +221,15 @@ int main(int argc, char *argv[])
}
// Store point and node number.
points[pointI] = point(x, y, z);
nodeToPoint.insert(nodeI, pointI);
pointI++;
points[pointi] = point(x, y, z);
nodeToPoint.insert(nodeI, pointi);
pointi++;
}
}
if (pointI != nNodes)
if (pointi != nNodes)
{
FatalIOErrorInFunction(nodeStream)
<< "Only " << pointI << " nodes present instead of " << nNodes
<< "Only " << pointi << " nodes present instead of " << nNodes
<< " from header." << exit(FatalIOError);
}
}
@ -282,7 +282,7 @@ int main(int argc, char *argv[])
labelList tetPoints(4);
cellShapeList cells(nTets);
label cellI = 0;
label celli = 0;
while (eleStream.good())
{
@ -302,7 +302,7 @@ int main(int argc, char *argv[])
tetPoints[i] = nodeToPoint[nodeI];
}
cells[cellI++] = cellShape(tet, tetPoints);
cells[celli++] = cellShape(tet, tetPoints);
// Skip attributes
for (label i = 0; i < nElemAttr; i++)
@ -394,7 +394,7 @@ int main(int argc, char *argv[])
boundaryPatch.setSize(nFaces);
boundaryPatch = -1;
label faceI = 0;
label facei = 0;
// Region to patch conversion
Map<label> regionToPatch;
@ -409,9 +409,9 @@ int main(int argc, char *argv[])
{
IStringStream faceLine(line);
label tetGenFaceI, dummy, region;
label tetGenFacei, dummy, region;
faceLine >> tetGenFaceI;
faceLine >> tetGenFacei;
// Read face and reverse orientation (Foam needs outwards
// pointing)
@ -425,7 +425,7 @@ int main(int argc, char *argv[])
if (findFace(mesh, f) >= mesh.nInternalFaces())
{
boundaryFaces[faceI] = f;
boundaryFaces[facei] = f;
if (nFaceAttr > 0)
{
@ -434,27 +434,27 @@ int main(int argc, char *argv[])
// Get Foam patchID and update region->patch table.
label patchI = 0;
label patchi = 0;
Map<label>::iterator patchFind =
regionToPatch.find(region);
if (patchFind == regionToPatch.end())
{
patchI = nPatches;
patchi = nPatches;
Info<< "Mapping tetgen region " << region
<< " to Foam patch "
<< patchI << endl;
<< patchi << endl;
regionToPatch.insert(region, nPatches++);
}
else
{
patchI = patchFind();
patchi = patchFind();
}
boundaryPatch[faceI] = patchI;
boundaryPatch[facei] = patchi;
// Skip remaining attributes
for (label i = 1; i < nFaceAttr; i++)
@ -463,15 +463,15 @@ int main(int argc, char *argv[])
}
}
faceI++;
facei++;
}
}
}
// Trim
boundaryFaces.setSize(faceI);
boundaryPatch.setSize(faceI);
boundaryFaces.setSize(facei);
boundaryPatch.setSize(facei);
// Print region to patch mapping
@ -489,9 +489,9 @@ int main(int argc, char *argv[])
faceListList patchFaces(nPatches);
wordList patchNames(nPatches);
forAll(patchNames, patchI)
forAll(patchNames, patchi)
{
patchNames[patchI] = word("patch") + name(patchI);
patchNames[patchi] = word("patch") + name(patchi);
}
wordList patchTypes(nPatches, polyPatch::typeName);
@ -503,21 +503,21 @@ int main(int argc, char *argv[])
// Sort boundaryFaces by patch using boundaryPatch.
List<DynamicList<face>> allPatchFaces(nPatches);
forAll(boundaryPatch, faceI)
forAll(boundaryPatch, facei)
{
label patchI = boundaryPatch[faceI];
label patchi = boundaryPatch[facei];
allPatchFaces[patchI].append(boundaryFaces[faceI]);
allPatchFaces[patchi].append(boundaryFaces[facei]);
}
Info<< "Patch sizes:" << endl;
forAll(allPatchFaces, patchI)
forAll(allPatchFaces, patchi)
{
Info<< " " << patchNames[patchI] << " : "
<< allPatchFaces[patchI].size() << endl;
Info<< " " << patchNames[patchi] << " : "
<< allPatchFaces[patchi].size() << endl;
patchFaces[patchI].transfer(allPatchFaces[patchI]);
patchFaces[patchi].transfer(allPatchFaces[patchi]);
}
Info<< endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,9 +72,9 @@ void writePoints(const polyMesh& mesh, const fileName& timeName)
OFstream pointStream(pointFile);
forAll(mesh.points(), pointI)
forAll(mesh.points(), pointi)
{
writeOBJ(mesh.points()[pointI], pointStream);
writeOBJ(mesh.points()[pointi], pointStream);
vertI++;
}
@ -109,9 +109,9 @@ void writePoints
forAll(cellLabels, i)
{
label cellI = cellLabels[i];
label celli = cellLabels[i];
const labelList& cEdges = mesh.cellEdges()[cellI];
const labelList& cEdges = mesh.cellEdges()[celli];
forAll(cEdges, cEdgeI)
{
@ -158,21 +158,21 @@ void writePoints
void writePoints
(
const polyMesh& mesh,
const label cellI,
const label celli,
const fileName& timeName
)
{
fileName fName
(
mesh.time().path()
/ "meshPoints_" + timeName + '_' + name(cellI) + ".obj"
/ "meshPoints_" + timeName + '_' + name(celli) + ".obj"
);
Info<< "Writing mesh points and edges to " << fName << endl;
OFstream pointStream(fName);
const cell& cFaces = mesh.cells()[cellI];
const cell& cFaces = mesh.cells()[celli];
meshTools::writeOBJ(pointStream, mesh.faces(), mesh.points(), cFaces);
}
@ -192,9 +192,9 @@ void writeFaceCentres(const polyMesh& mesh,const fileName& timeName)
OFstream faceStream(faceFile);
forAll(mesh.faceCentres(), faceI)
forAll(mesh.faceCentres(), facei)
{
writeOBJ(mesh.faceCentres()[faceI], faceStream);
writeOBJ(mesh.faceCentres()[facei], faceStream);
}
}
@ -210,9 +210,9 @@ void writeCellCentres(const polyMesh& mesh, const fileName& timeName)
OFstream cellStream(cellFile);
forAll(mesh.cellCentres(), cellI)
forAll(mesh.cellCentres(), celli)
{
writeOBJ(mesh.cellCentres()[cellI], cellStream);
writeOBJ(mesh.cellCentres()[celli], cellStream);
}
}
@ -225,9 +225,9 @@ void writePatchCentres
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
fileName faceFile
(
@ -238,9 +238,9 @@ void writePatchCentres
OFstream patchFaceStream(faceFile);
forAll(pp.faceCentres(), faceI)
forAll(pp.faceCentres(), facei)
{
writeOBJ(pp.faceCentres()[faceI], patchFaceStream);
writeOBJ(pp.faceCentres()[facei], patchFaceStream);
}
}
}
@ -254,9 +254,9 @@ void writePatchFaces
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
fileName faceFile
(
@ -268,14 +268,14 @@ void writePatchFaces
OFstream patchFaceStream(faceFile);
forAll(pp.localPoints(), pointI)
forAll(pp.localPoints(), pointi)
{
writeOBJ(pp.localPoints()[pointI], patchFaceStream);
writeOBJ(pp.localPoints()[pointi], patchFaceStream);
}
forAll(pp.localFaces(), faceI)
forAll(pp.localFaces(), facei)
{
const face& f = pp.localFaces()[faceI];
const face& f = pp.localFaces()[facei];
patchFaceStream<< 'f';
@ -297,9 +297,9 @@ void writePatchBoundaryEdges
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
fileName edgeFile
(
@ -311,9 +311,9 @@ void writePatchBoundaryEdges
OFstream patchEdgeStream(edgeFile);
forAll(pp.localPoints(), pointI)
forAll(pp.localPoints(), pointi)
{
writeOBJ(pp.localPoints()[pointI], patchEdgeStream);
writeOBJ(pp.localPoints()[pointi], patchEdgeStream);
}
for (label edgeI = pp.nInternalEdges(); edgeI < pp.nEdges(); edgeI++)
@ -332,11 +332,11 @@ void writePatchBoundaryEdges
void writePointCells
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const fileName& timeName
)
{
const labelList& pCells = mesh.pointCells()[pointI];
const labelList& pCells = mesh.pointCells()[pointi];
labelHashSet allEdges(6*pCells.size());
@ -354,7 +354,7 @@ void writePointCells
fileName pFile
(
mesh.time().path()
/ "pointEdges_" + timeName + '_' + name(pointI) + ".obj"
/ "pointEdges_" + timeName + '_' + name(pointi) + ".obj"
);
Info<< "Writing pointEdges to " << pFile << endl;
@ -467,19 +467,19 @@ int main(int argc, char *argv[])
}
if (doCell)
{
label cellI = args.optionRead<label>("cell");
label celli = args.optionRead<label>("cell");
writePoints(mesh, cellI, runTime.timeName());
writePoints(mesh, celli, runTime.timeName());
}
if (doPoint)
{
label pointI = args.optionRead<label>("point");
label pointi = args.optionRead<label>("point");
writePointCells(mesh, pointI, runTime.timeName());
writePointCells(mesh, pointi, runTime.timeName());
}
if (doFace)
{
label faceI = args.optionRead<label>("face");
label facei = args.optionRead<label>("face");
fileName fName
(
@ -487,7 +487,7 @@ int main(int argc, char *argv[])
/ "meshPoints_"
+ runTime.timeName()
+ '_'
+ name(faceI)
+ name(facei)
+ ".obj"
);
@ -495,7 +495,7 @@ int main(int argc, char *argv[])
OFstream str(fName);
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
meshTools::writeOBJ(str, faceList(1, f), mesh.points());
}

View File

@ -3,13 +3,11 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake -all $targetType blockMesh
wmake -all $targetType extrude
wmake -all $targetType extrude2DMesh
wmake -all $targetType snappyHexMesh
wmake -all blockMesh
wmake -all extrude
wmake -all extrude2DMesh
wmake -all snappyHexMesh
foamyMesh/Allwmake $*
foamyMesh/Allwmake $targetType $*
#------------------------------------------------------------------------------

View File

@ -1,3 +1,3 @@
blockMeshApp.C
blockMesh.C
EXE = $(FOAM_APPBIN)/blockMesh

View File

@ -1,9 +1,11 @@
EXE_INC = \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lblockMesh \
-lmeshTools \
-lfileFormats \
-ldynamicMesh

View File

@ -31,23 +31,23 @@ Description
A multi-block mesh generator.
Uses the block mesh description found in
\a system/blockMeshDict
or \a system/\<region\>/blockMeshDict
or \a constant/polyMesh/blockMeshDict
or \a constant/\<region\>/polyMesh/blockMeshDict
- \c system/blockMeshDict
- \c system/\<region\>/blockMeshDict
- \c constant/polyMesh/blockMeshDict
- \c constant/\<region\>/polyMesh/blockMeshDict
Usage
\b blockMesh [OPTION]
- blockMesh [OPTION]
Options:
- \par -blockTopology
Write the topology as a set of edges in OBJ format.
\param -blockTopology \n
Write the topology as a set of edges in OBJ format.
- \par -region \<name\>
Specify an alternative mesh region.
\param -region \<name\> \n
Specify an alternative mesh region.
\param -dict \<filename\> \n
Specify alternative dictionary for the block mesh description.
- \par -dict \<filename\>
Specify alternative dictionary for the block mesh description.
\*---------------------------------------------------------------------------*/
@ -86,6 +86,27 @@ int main(int argc, char *argv[])
"specify alternative dictionary for the blockMesh description"
);
argList::addNote
(
"Block description\n"
"\n"
" For a given block, the correspondence between the ordering of\n"
" vertex labels and face labels is shown below.\n"
" For vertex numbering in the sequence 0 to 7 (block, centre):\n"
" faces 0 (f0) and 1 are left and right, respectively;\n"
" faces 2 and 3 are bottom and top;\n"
" and faces 4 and 5 are front the back:\n"
"\n"
" 4 ---- 5\n"
" f3 |\\ |\\ f5\n"
" | | 7 ---- 6 \\\n"
" | 0 |--- 1 | \\\n"
" | \\| \\| f4\n"
" f2 3 ---- 2\n"
"\n"
" f0 ----- f1\n"
);
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
@ -158,8 +179,6 @@ int main(int argc, char *argv[])
Info<< "Creating block mesh from\n "
<< meshDictIO.objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIO);
blockMesh blocks(meshDict, regionName);
@ -191,10 +210,10 @@ int main(int argc, char *argv[])
const pointField& cellCentres = topo.cellCentres();
forAll(cellCentres, cellI)
forAll(cellCentres, celli)
{
//point cc = b.blockShape().centre(b.points());
const point& cc = cellCentres[cellI];
const point& cc = cellCentres[celli];
str << "v " << cc.x() << ' ' << cc.y() << ' ' << cc.z() << nl;
}
@ -260,7 +279,7 @@ int main(int argc, char *argv[])
List<DynamicList<label>> zoneCells(nZones);
// Running cell counter
label cellI = 0;
label celli = 0;
// Largest zone so far
label freeZoneI = 0;
@ -268,8 +287,8 @@ int main(int argc, char *argv[])
forAll(blocks, blockI)
{
const block& b = blocks[blockI];
const labelListList& blockCells = b.cells();
const word& zoneName = b.blockDef().zoneName();
const List<FixedList<label, 8>> blockCells = b.cells();
const word& zoneName = b.zoneName();
if (zoneName.size())
{
@ -292,12 +311,12 @@ int main(int argc, char *argv[])
forAll(blockCells, i)
{
zoneCells[zoneI].append(cellI++);
zoneCells[zoneI].append(celli++);
}
}
else
{
cellI += b.cells().size();
celli += b.cells().size();
}
}
@ -361,11 +380,11 @@ int main(int argc, char *argv[])
<< "Patches" << nl
<< "----------------" << nl;
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& p = patches[patchI];
const polyPatch& p = patches[patchi];
Info<< " " << "patch " << patchI
Info<< " " << "patch " << patchi
<< " (start: " << p.start()
<< " size: " << p.size()
<< ") name: " << p.name()

View File

@ -186,11 +186,11 @@ void updateFaceLabels(const mapPolyMesh& map, labelList& faceLabels)
forAll(faceLabels, i)
{
label oldFaceI = faceLabels[i];
label oldFacei = faceLabels[i];
if (reverseMap[oldFaceI] >= 0)
if (reverseMap[oldFacei] >= 0)
{
newFaceLabels[newI++] = reverseMap[oldFaceI];
newFaceLabels[newI++] = reverseMap[oldFacei];
}
}
newFaceLabels.setSize(newI);
@ -206,11 +206,11 @@ void updateCellSet(const mapPolyMesh& map, labelHashSet& cellLabels)
forAll(cellLabels, i)
{
label oldCellI = cellLabels[i];
label oldCelli = cellLabels[i];
if (reverseMap[oldCellI] >= 0)
if (reverseMap[oldCelli] >= 0)
{
newCellLabels.insert(reverseMap[oldCellI]);
newCellLabels.insert(reverseMap[oldCelli]);
}
}
cellLabels.transfer(newCellLabels);
@ -227,16 +227,16 @@ void changeFrontBackPatches
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
label frontPatchI = findPatchID(patches, frontPatchName);
label backPatchI = findPatchID(patches, backPatchName);
label frontPatchi = findPatchID(patches, frontPatchName);
label backPatchi = findPatchID(patches, backPatchName);
DynamicList<polyPatch*> newPatches(patches.size());
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp(patches[patchI]);
const polyPatch& pp(patches[patchi]);
if (patchI == frontPatchI || patchI == backPatchI)
if (patchi == frontPatchi || patchi == backPatchi)
{
newPatches.append
(
@ -398,32 +398,32 @@ int main(int argc, char *argv[])
polyTopoChange meshMod(mesh);
forAll(meshFaces, i)
{
label meshFaceI = meshFaces[i];
label meshFacei = meshFaces[i];
label patchI = patches.whichPatch(meshFaceI);
label own = mesh.faceOwner()[meshFaceI];
label patchi = patches.whichPatch(meshFacei);
label own = mesh.faceOwner()[meshFacei];
label nei = -1;
if (patchI == -1)
if (patchi == -1)
{
nei = mesh.faceNeighbour()[meshFaceI];
nei = mesh.faceNeighbour()[meshFacei];
}
label zoneI = mesh.faceZones().whichZone(meshFaceI);
label zoneI = mesh.faceZones().whichZone(meshFacei);
bool zoneFlip = false;
if (zoneI != -1)
{
label index = mesh.faceZones()[zoneI].whichFace(meshFaceI);
label index = mesh.faceZones()[zoneI].whichFace(meshFacei);
zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
}
meshMod.modifyFace
(
mesh.faces()[meshFaceI].reverseFace(), // modified face
meshFaceI, // label of face
mesh.faces()[meshFacei].reverseFace(), // modified face
meshFacei, // label of face
own, // owner
nei, // neighbour
true, // face flip
patchI, // patch for face
patchi, // patch for face
zoneI, // zone for face
zoneFlip // face flip in zone
);
@ -533,11 +533,11 @@ int main(int argc, char *argv[])
if (nAdded > 0)
{
DynamicList<polyPatch*> newPatches(nPatches);
forAll(mesh.boundaryMesh(), patchI)
forAll(mesh.boundaryMesh(), patchi)
{
newPatches.append
(
mesh.boundaryMesh()[patchI].clone
mesh.boundaryMesh()[patchi].clone
(
mesh.boundaryMesh()
).ptr()
@ -545,16 +545,16 @@ int main(int argc, char *argv[])
}
for
(
label patchI = mesh.boundaryMesh().size();
patchI < nPatches;
patchI++
label patchi = mesh.boundaryMesh().size();
patchi < nPatches;
patchi++
)
{
label nbrProcI = patchToNbrProc[patchI];
label nbrProci = patchToNbrProc[patchi];
Pout<< "Adding patch " << patchI
Pout<< "Adding patch " << patchi
<< " between " << Pstream::myProcNo()
<< " and " << nbrProcI
<< " and " << nbrProci
<< endl;
newPatches.append
@ -563,10 +563,10 @@ int main(int argc, char *argv[])
(
0, // size
mesh.nFaces(), // start
patchI, // index
patchi, // index
mesh.boundaryMesh(),// polyBoundaryMesh
Pstream::myProcNo(),// myProcNo
nbrProcI // neighbProcNo
nbrProci // neighbProcNo
)
);
}
@ -593,25 +593,25 @@ int main(int argc, char *argv[])
// Determine points and extrusion
pointField layer0Points(extrudePatch.nPoints());
pointField displacement(extrudePatch.nPoints());
forAll(displacement, pointI)
forAll(displacement, pointi)
{
const vector& patchNormal = extrudePatchPointNormals[pointI];
const vector& patchNormal = extrudePatchPointNormals[pointi];
// layer0 point
layer0Points[pointI] = model()
layer0Points[pointi] = model()
(
extrudePatch.localPoints()[pointI],
extrudePatch.localPoints()[pointi],
patchNormal,
0
);
// layerN point
point extrudePt = model()
(
extrudePatch.localPoints()[pointI],
extrudePatch.localPoints()[pointi],
patchNormal,
model().nLayers()
);
displacement[pointI] = extrudePt - layer0Points[pointI];
displacement[pointi] = extrudePt - layer0Points[pointi];
}
@ -676,27 +676,27 @@ int main(int argc, char *argv[])
);
// Reset points according to extrusion model
forAll(layerExtrude.addedPoints(), pointI)
forAll(layerExtrude.addedPoints(), pointi)
{
const labelList& pPoints = layerExtrude.addedPoints()[pointI];
forAll(pPoints, pPointI)
const labelList& pPoints = layerExtrude.addedPoints()[pointi];
forAll(pPoints, pPointi)
{
label meshPointI = pPoints[pPointI];
label meshPointi = pPoints[pPointi];
point modelPt
(
model()
(
extrudePatch.localPoints()[pointI],
extrudePatchPointNormals[pointI],
pPointI+1 // layer
extrudePatch.localPoints()[pointi],
extrudePatchPointNormals[pointi],
pPointi+1 // layer
)
);
const_cast<DynamicList<point>&>
(
meshMod().points()
)[meshPointI] = modelPt;
)[meshPointi] = modelPt;
}
}
@ -705,10 +705,10 @@ int main(int argc, char *argv[])
const labelListList& layerFaces = layerExtrude.layerFaces();
backPatchFaces.setSize(layerFaces.size());
frontPatchFaces.setSize(layerFaces.size());
forAll(backPatchFaces, patchFaceI)
forAll(backPatchFaces, patchFacei)
{
backPatchFaces[patchFaceI] = layerFaces[patchFaceI].first();
frontPatchFaces[patchFaceI] = layerFaces[patchFaceI].last();
backPatchFaces[patchFacei] = layerFaces[patchFacei].first();
frontPatchFaces[patchFacei] = layerFaces[patchFacei].last();
}
@ -761,9 +761,9 @@ int main(int argc, char *argv[])
layerExtrude.layerFaces()
)
);
forAll(addedCells, faceI)
forAll(addedCells, facei)
{
const labelList& aCells = addedCells[faceI];
const labelList& aCells = addedCells[facei];
forAll(aCells, i)
{
addedCellsSet.insert(aCells[i]);

View File

@ -167,32 +167,32 @@ label addPatch
DynamicList<polyPatch*>& newPatches
)
{
label patchI = findPatchID(newPatches, patchName);
label patchi = findPatchID(newPatches, patchName);
if (patchI != -1)
if (patchi != -1)
{
if (isA<PatchType>(*newPatches[patchI]))
if (isA<PatchType>(*newPatches[patchi]))
{
// Already there
return patchI;
return patchi;
}
else
{
FatalErrorInFunction
<< "Already have patch " << patchName
<< " but of type " << newPatches[patchI]->type()
<< " but of type " << newPatches[patchi]->type()
<< exit(FatalError);
}
}
patchI = newPatches.size();
patchi = newPatches.size();
label startFaceI = 0;
if (patchI > 0)
label startFacei = 0;
if (patchi > 0)
{
const polyPatch& pp = *newPatches.last();
startFaceI = pp.start()+pp.size();
startFacei = pp.start()+pp.size();
}
@ -203,13 +203,13 @@ label addPatch
PatchType::typeName,
patchName,
0, // size
startFaceI, // nFaces
patchI,
startFacei, // nFaces
patchi,
patches
).ptr()
);
return patchI;
return patchi;
}
@ -222,38 +222,38 @@ label addPatch
DynamicList<polyPatch*>& newPatches
)
{
label patchI = findPatchID(newPatches, patchName);
label patchi = findPatchID(newPatches, patchName);
if (patchI != -1)
if (patchi != -1)
{
if (isA<PatchType>(*newPatches[patchI]))
if (isA<PatchType>(*newPatches[patchi]))
{
// Already there
return patchI;
return patchi;
}
else
{
FatalErrorInFunction
<< "Already have patch " << patchName
<< " but of type " << newPatches[patchI]->type()
<< " but of type " << newPatches[patchi]->type()
<< exit(FatalError);
}
}
patchI = newPatches.size();
patchi = newPatches.size();
label startFaceI = 0;
if (patchI > 0)
label startFacei = 0;
if (patchi > 0)
{
const polyPatch& pp = *newPatches.last();
startFaceI = pp.start()+pp.size();
startFacei = pp.start()+pp.size();
}
dictionary patchDict(dict);
patchDict.set("type", PatchType::typeName);
patchDict.set("nFaces", 0);
patchDict.set("startFace", startFaceI);
patchDict.set("startFace", startFacei);
newPatches.append
(
@ -261,12 +261,12 @@ label addPatch
(
patchName,
patchDict,
patchI,
patchi,
patches
).ptr()
);
return patchI;
return patchi;
}
@ -290,60 +290,60 @@ void deleteEmptyPatches(fvMesh& mesh)
// Add all the non-empty, non-processor patches
forAll(masterNames, masterI)
{
label patchI = patches.findPatchID(masterNames[masterI]);
label patchi = patches.findPatchID(masterNames[masterI]);
if (patchI != -1)
if (patchi != -1)
{
if (isA<processorPolyPatch>(patches[patchI]))
if (isA<processorPolyPatch>(patches[patchi]))
{
// Similar named processor patch? Not 'possible'.
if (patches[patchI].size() == 0)
if (patches[patchi].size() == 0)
{
Pout<< "Deleting processor patch " << patchI
<< " name:" << patches[patchI].name()
Pout<< "Deleting processor patch " << patchi
<< " name:" << patches[patchi].name()
<< endl;
oldToNew[patchI] = --notUsedI;
oldToNew[patchi] = --notUsedI;
}
else
{
oldToNew[patchI] = usedI++;
oldToNew[patchi] = usedI++;
}
}
else
{
// Common patch.
if (returnReduce(patches[patchI].size(), sumOp<label>()) == 0)
if (returnReduce(patches[patchi].size(), sumOp<label>()) == 0)
{
Pout<< "Deleting patch " << patchI
<< " name:" << patches[patchI].name()
Pout<< "Deleting patch " << patchi
<< " name:" << patches[patchi].name()
<< endl;
oldToNew[patchI] = --notUsedI;
oldToNew[patchi] = --notUsedI;
}
else
{
oldToNew[patchI] = usedI++;
oldToNew[patchi] = usedI++;
}
}
}
}
// Add remaining patches at the end
forAll(patches, patchI)
forAll(patches, patchi)
{
if (oldToNew[patchI] == -1)
if (oldToNew[patchi] == -1)
{
// Unique to this processor. Note: could check that these are
// only processor patches.
if (patches[patchI].size() == 0)
if (patches[patchi].size() == 0)
{
Pout<< "Deleting processor patch " << patchI
<< " name:" << patches[patchI].name()
Pout<< "Deleting processor patch " << patchi
<< " name:" << patches[patchi].name()
<< endl;
oldToNew[patchI] = --notUsedI;
oldToNew[patchi] = --notUsedI;
}
else
{
oldToNew[patchI] = usedI++;
oldToNew[patchi] = usedI++;
}
}
}
@ -429,14 +429,14 @@ void checkZoneInside
forAll(extrudeMeshFaces, i)
{
label faceI = extrudeMeshFaces[i];
label facei = extrudeMeshFaces[i];
label zoneI = zoneID[i];
if (isInternal[zoneI] != mesh.isInternalFace(faceI))
if (isInternal[zoneI] != mesh.isInternalFace(facei))
{
FatalErrorInFunction
<< "Zone " << zoneNames[zoneI]
<< " is not consistently all internal or all boundary faces."
<< " Face " << faceI << " at " << mesh.faceCentres()[faceI]
<< " Face " << facei << " at " << mesh.faceCentres()[facei]
<< " is the first occurrence."
<< exit(FatalError);
}
@ -535,17 +535,17 @@ label findUncoveredPatchFace
const labelList& eFaces = mesh.edgeFaces()[meshEdgeI];
forAll(eFaces, i)
{
label faceI = eFaces[i];
label patchI = pbm.whichPatch(faceI);
label facei = eFaces[i];
label patchi = pbm.whichPatch(facei);
if
(
patchI != -1
&& !pbm[patchI].coupled()
&& !extrudeFaceSet.found(faceI)
patchi != -1
&& !pbm[patchi].coupled()
&& !extrudeFaceSet.found(facei)
)
{
return faceI;
return facei;
}
}
return -1;
@ -571,17 +571,17 @@ label findUncoveredCyclicPatchFace
const labelList& eFaces = mesh.edgeFaces()[meshEdgeI];
forAll(eFaces, i)
{
label faceI = eFaces[i];
label patchI = pbm.whichPatch(faceI);
label facei = eFaces[i];
label patchi = pbm.whichPatch(facei);
if
(
patchI != -1
&& isA<cyclicPolyPatch>(pbm[patchI])
&& !extrudeFaceSet.found(faceI)
patchi != -1
&& isA<cyclicPolyPatch>(pbm[patchi])
&& !extrudeFaceSet.found(facei)
)
{
return faceI;
return facei;
}
}
return -1;
@ -708,14 +708,14 @@ void countExtrudePatches
// so choose any uncovered one. If none found put face in
// undetermined zone 'side' patch
label faceI = findUncoveredPatchFace
label facei = findUncoveredPatchFace
(
mesh,
UIndirectList<label>(extrudeMeshFaces, eFaces),
extrudeMeshEdges[edgeI]
);
if (faceI == -1)
if (facei == -1)
{
zoneSidePatch[minZoneID[edgeI]]++;
}
@ -876,9 +876,9 @@ void addCoupledPatches
{
forAll(eFaces, i)
{
label procI = procID[eFaces[i]];
minProcID[edgeI] = min(minProcID[edgeI], procI);
maxProcID[edgeI] = max(maxProcID[edgeI], procI);
label proci = procID[eFaces[i]];
minProcID[edgeI] = min(minProcID[edgeI], proci);
maxProcID[edgeI] = max(maxProcID[edgeI], proci);
}
}
}
@ -918,36 +918,36 @@ void addCoupledPatches
)
{
// coupled boundary edge. Find matching patch.
label nbrProcI = minProcID[edgeI];
if (nbrProcI == Pstream::myProcNo())
label nbrProci = minProcID[edgeI];
if (nbrProci == Pstream::myProcNo())
{
nbrProcI = maxProcID[edgeI];
nbrProci = maxProcID[edgeI];
}
if (nbrProcI == Pstream::myProcNo())
if (nbrProci == Pstream::myProcNo())
{
// Cyclic patch since both procs the same. This cyclic should
// already exist in newPatches so no adding necessary.
label faceI = findUncoveredCyclicPatchFace
label facei = findUncoveredCyclicPatchFace
(
mesh,
UIndirectList<label>(extrudeMeshFaces, eFaces),
extrudeMeshEdges[edgeI]
);
if (faceI != -1)
if (facei != -1)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
label newPatchI = findPatchID
label newPatchi = findPatchID
(
newPatches,
patches[patches.whichPatch(faceI)].name()
patches[patches.whichPatch(facei)].name()
);
sidePatchID[edgeI] = newPatchI;
sidePatchID[edgeI] = newPatchi;
}
else
{
@ -961,7 +961,7 @@ void addCoupledPatches
// Processor patch
word name
(
processorPolyPatch::newName(Pstream::myProcNo(), nbrProcI)
processorPolyPatch::newName(Pstream::myProcNo(), nbrProci)
);
sidePatchID[edgeI] = findPatchID(newPatches, name);
@ -970,7 +970,7 @@ void addCoupledPatches
{
dictionary patchDict;
patchDict.add("myProcNo", Pstream::myProcNo());
patchDict.add("neighbProcNo", nbrProcI);
patchDict.add("neighbProcNo", nbrProci);
sidePatchID[edgeI] = addPatch<processorPolyPatch>
(
@ -1157,9 +1157,9 @@ tmp<pointField> calcOffset
forAll(fc, i)
{
label meshFaceI = pp.start()+i;
label patchFaceI = mag(extruder.faceToFaceMap()[meshFaceI])-1;
point patchFc = extrudePatch[patchFaceI].centre
label meshFacei = pp.start()+i;
label patchFacei = mag(extruder.faceToFaceMap()[meshFacei])-1;
point patchFc = extrudePatch[patchFacei].centre
(
extrudePatch.points()
);
@ -1180,24 +1180,28 @@ void setCouplingInfo
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size(), static_cast<polyPatch*>(NULL));
List<polyPatch*> newPatches
(
patches.size(),
static_cast<polyPatch*>(nullptr)
);
forAll(zoneToPatch, zoneI)
{
label patchI = zoneToPatch[zoneI];
label patchi = zoneToPatch[zoneI];
if (patchI != -1)
if (patchi != -1)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if (isA<mappedWallPolyPatch>(pp))
{
newPatches[patchI] = new mappedWallPolyPatch
newPatches[patchi] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
patchi,
sampleRegion, // sampleRegion
mode, // sampleMode
pp.name(), // samplePatch
@ -1208,11 +1212,11 @@ void setCouplingInfo
}
}
forAll(newPatches, patchI)
forAll(newPatches, patchi)
{
if (!newPatches[patchI])
if (!newPatches[patchi])
{
newPatches[patchI] = patches[patchI].clone(patches).ptr();
newPatches[patchi] = patches[patchi].clone(patches).ptr();
}
}
@ -1308,26 +1312,26 @@ void extrudeGeometricProperties
// Work out layers. Guaranteed in columns so no fancy parallel bits.
forAll(extruder.faceToFaceMap(), faceI)
forAll(extruder.faceToFaceMap(), facei)
{
if (extruder.faceToFaceMap()[faceI] != 0)
if (extruder.faceToFaceMap()[facei] != 0)
{
// 'horizontal' face
label patchFaceI = mag(extruder.faceToFaceMap()[faceI])-1;
label patchFacei = mag(extruder.faceToFaceMap()[facei])-1;
label cellI = regionMesh.faceOwner()[faceI];
if (regionMesh.isInternalFace(faceI))
label celli = regionMesh.faceOwner()[facei];
if (regionMesh.isInternalFace(facei))
{
cellI = max(cellI, regionMesh.faceNeighbour()[faceI]);
celli = max(celli, regionMesh.faceNeighbour()[facei]);
}
// Calculate layer from cell numbering (see createShellMesh)
label layerI = (cellI % model.nLayers());
label layerI = (celli % model.nLayers());
if
(
!regionMesh.isInternalFace(faceI)
&& extruder.faceToFaceMap()[faceI] > 0
!regionMesh.isInternalFace(facei)
&& extruder.faceToFaceMap()[facei] > 0
)
{
// Top face
@ -1336,20 +1340,20 @@ void extrudeGeometricProperties
// Recalculate based on extrusion model
faceCentres[faceI] = model
faceCentres[facei] = model
(
patchFaceCentres[patchFaceI],
extrudePatch.faceNormals()[patchFaceI],
patchFaceCentres[patchFacei],
extrudePatch.faceNormals()[patchFacei],
layerI
);
}
else
{
// 'vertical face
label patchEdgeI = extruder.faceToEdgeMap()[faceI];
label patchEdgeI = extruder.faceToEdgeMap()[facei];
label layerI =
(
regionMesh.faceOwner()[faceI]
regionMesh.faceOwner()[facei]
% model.nLayers()
);
@ -1369,7 +1373,7 @@ void extrudeGeometricProperties
);
// Interpolate
faceCentres[faceI] = 0.5*(pt0+pt1);
faceCentres[facei] = 0.5*(pt0+pt1);
}
}
@ -1388,29 +1392,29 @@ void extrudeGeometricProperties
regionMesh.nCells()
);
forAll(extruder.cellToFaceMap(), cellI)
forAll(extruder.cellToFaceMap(), celli)
{
label patchFaceI = extruder.cellToFaceMap()[cellI];
label patchFacei = extruder.cellToFaceMap()[celli];
// Calculate layer from cell numbering (see createShellMesh)
label layerI = (cellI % model.nLayers());
label layerI = (celli % model.nLayers());
// Recalculate based on extrusion model
point pt0 = model
(
patchFaceCentres[patchFaceI],
extrudePatch.faceNormals()[patchFaceI],
patchFaceCentres[patchFacei],
extrudePatch.faceNormals()[patchFacei],
layerI
);
point pt1 = model
(
patchFaceCentres[patchFaceI],
extrudePatch.faceNormals()[patchFaceI],
patchFaceCentres[patchFacei],
extrudePatch.faceNormals()[patchFacei],
layerI+1
);
// Interpolate
cellCentres[cellI] = 0.5*(pt0+pt1);
cellCentres[celli] = 0.5*(pt0+pt1);
}
@ -1420,29 +1424,29 @@ void extrudeGeometricProperties
OBJstream faceStr(regionMesh.time().path()/"faceCentres.obj");
OBJstream cellStr(regionMesh.time().path()/"cellCentres.obj");
forAll(faceCentres, faceI)
forAll(faceCentres, facei)
{
Pout<< "Model :" << faceCentres[faceI] << endl
<< "regionMesh:" << regionMesh.faceCentres()[faceI] << endl;
Pout<< "Model :" << faceCentres[facei] << endl
<< "regionMesh:" << regionMesh.faceCentres()[facei] << endl;
faceStr.write
(
linePointRef
(
faceCentres[faceI],
regionMesh.faceCentres()[faceI]
faceCentres[facei],
regionMesh.faceCentres()[facei]
)
);
}
forAll(cellCentres, cellI)
forAll(cellCentres, celli)
{
Pout<< "Model :" << cellCentres[cellI] << endl
<< "regionMesh:" << regionMesh.cellCentres()[cellI] << endl;
Pout<< "Model :" << cellCentres[celli] << endl
<< "regionMesh:" << regionMesh.cellCentres()[celli] << endl;
cellStr.write
(
linePointRef
(
cellCentres[cellI],
regionMesh.cellCentres()[cellI]
cellCentres[celli],
regionMesh.cellCentres()[celli]
)
);
}
@ -1801,8 +1805,8 @@ int main(int argc, char *argv[])
const faceSet& fz = zones[i];
forAllConstIter(faceSet, fz, iter)
{
label faceI = iter.key();
if (mesh.isInternalFace(faceI))
label facei = iter.key();
if (mesh.isInternalFace(facei))
{
FatalIOErrorInFunction(dict)
<< "faceSet " << fz.name()
@ -1810,13 +1814,13 @@ int main(int argc, char *argv[])
<< " This is not permitted."
<< exit(FatalIOError);
}
extrudeMeshFaces[nExtrudeFaces] = faceI;
zoneFaces[nExtrudeFaces] = mesh.faces()[faceI];
extrudeMeshFaces[nExtrudeFaces] = facei;
zoneFaces[nExtrudeFaces] = mesh.faces()[facei];
zoneID[nExtrudeFaces] = i;
zoneFlipMap[nExtrudeFaces] = false;
nExtrudeFaces++;
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
isInternal[i] = true;
}
@ -1861,8 +1865,8 @@ int main(int argc, char *argv[])
const faceSet& fz = shadowZones[i];
forAllConstIter(faceSet, fz, iter)
{
label faceI = iter.key();
if (mesh.isInternalFace(faceI))
label facei = iter.key();
if (mesh.isInternalFace(facei))
{
FatalIOErrorInFunction(dict)
<< "faceSet " << fz.name()
@ -1870,7 +1874,7 @@ int main(int argc, char *argv[])
<< " This is not permitted."
<< exit(FatalIOError);
}
extrudeMeshShadowFaces[nShadowFaces] = faceI;
extrudeMeshShadowFaces[nShadowFaces] = facei;
zoneShadowFlipMap[nShadowFaces] = false;
zoneShadowID[nShadowFaces] = i;
nShadowFaces++;
@ -1959,17 +1963,17 @@ int main(int argc, char *argv[])
DynamicList<polyPatch*> regionPatches(patches.size());
// Copy all non-local patches since these are used on boundary edges of
// the extrusion
forAll(patches, patchI)
forAll(patches, patchi)
{
if (!isA<processorPolyPatch>(patches[patchI]))
if (!isA<processorPolyPatch>(patches[patchi]))
{
label newPatchI = regionPatches.size();
label newPatchi = regionPatches.size();
regionPatches.append
(
patches[patchI].clone
patches[patchi].clone
(
patches,
newPatchI,
newPatchi,
0, // size
0 // start
).ptr()
@ -2011,9 +2015,9 @@ int main(int argc, char *argv[])
// Clone existing patches
DynamicList<polyPatch*> newPatches(patches.size());
forAll(patches, patchI)
forAll(patches, patchi)
{
newPatches.append(patches[patchI].clone(patches).ptr());
newPatches.append(patches[patchi].clone(patches).ptr());
}
// Add new patches
@ -2045,10 +2049,10 @@ int main(int argc, char *argv[])
labelList extrudeTopPatchID(extrudePatch.size());
labelList extrudeBottomPatchID(extrudePatch.size());
forAll(zoneID, faceI)
forAll(zoneID, facei)
{
extrudeTopPatchID[faceI] = interRegionTopPatch[zoneID[faceI]];
extrudeBottomPatchID[faceI] = interRegionBottomPatch[zoneID[faceI]];
extrudeTopPatchID[facei] = interRegionTopPatch[zoneID[facei]];
extrudeBottomPatchID[facei] = interRegionBottomPatch[zoneID[facei]];
}
@ -2129,10 +2133,10 @@ int main(int argc, char *argv[])
// // Add all the newPatches to the mesh and fields
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// {
// forAll(newPatches, patchI)
// forAll(newPatches, patchi)
// {
// Pout<< "Adding patch " << patchI
// << " name:" << newPatches[patchI]->name()
// Pout<< "Adding patch " << patchi
// << " name:" << newPatches[patchi]->name()
// << endl;
// }
// //label nOldPatches = mesh.boundary().size();
@ -2142,12 +2146,12 @@ int main(int argc, char *argv[])
// //// Add calculated fvPatchFields for the added patches
// //for
// //(
// // label patchI = nOldPatches;
// // patchI < mesh.boundary().size();
// // patchI++
// // label patchi = nOldPatches;
// // patchi < mesh.boundary().size();
// // patchi++
// //)
// //{
// // Pout<< "ADDing calculated to patch " << patchI
// // Pout<< "ADDing calculated to patch " << patchi
// // << endl;
// // addCalculatedPatchFields(mesh);
// //}
@ -2234,21 +2238,21 @@ int main(int argc, char *argv[])
}
else
{
label faceI = findUncoveredPatchFace
label facei = findUncoveredPatchFace
(
mesh,
UIndirectList<label>(extrudeMeshFaces, eFaces),
extrudeMeshEdges[edgeI]
);
if (faceI != -1)
if (facei != -1)
{
label newPatchI = findPatchID
label newPatchi = findPatchID
(
regionPatches,
patches[patches.whichPatch(faceI)].name()
patches[patches.whichPatch(facei)].name()
);
ePatches.setSize(eFaces.size(), newPatchI);
ePatches.setSize(eFaces.size(), newPatchi);
}
else
{
@ -2286,10 +2290,10 @@ int main(int argc, char *argv[])
// Per local region an originating point
labelList localRegionPoints(localToGlobalRegion.size());
forAll(pointLocalRegions, faceI)
forAll(pointLocalRegions, facei)
{
const face& f = extrudePatch.localFaces()[faceI];
const face& pRegions = pointLocalRegions[faceI];
const face& f = extrudePatch.localFaces()[facei];
const face& pRegions = pointLocalRegions[facei];
forAll(pRegions, fp)
{
localRegionPoints[pRegions[fp]] = f[fp];
@ -2301,13 +2305,13 @@ int main(int argc, char *argv[])
{
pointField localSum(localToGlobalRegion.size(), Zero);
forAll(pointLocalRegions, faceI)
forAll(pointLocalRegions, facei)
{
const face& pRegions = pointLocalRegions[faceI];
const face& pRegions = pointLocalRegions[facei];
forAll(pRegions, fp)
{
label localRegionI = pRegions[fp];
localSum[localRegionI] += extrudePatch.faceNormals()[faceI];
localSum[localRegionI] += extrudePatch.faceNormals()[facei];
}
}
@ -2340,13 +2344,13 @@ int main(int argc, char *argv[])
scalar thickness = model().sumThickness(1);
forAll(pointLocalRegions, faceI)
forAll(pointLocalRegions, facei)
{
const face& f = extrudeFaces[faceI];
const face& f = extrudeFaces[facei];
forAll(f, fp)
{
label region = pointLocalRegions[faceI][fp];
label region = pointLocalRegions[facei][fp];
const point& pt = extrudePoints[f[fp]];
meshTools::writeOBJ(str, pt);
@ -2411,10 +2415,10 @@ int main(int argc, char *argv[])
);
// Add the new patches
forAll(regionPatches, patchI)
forAll(regionPatches, patchi)
{
polyPatch* ppPtr = regionPatches[patchI];
regionPatches[patchI] = ppPtr->clone(regionMesh.boundaryMesh()).ptr();
polyPatch* ppPtr = regionPatches[patchi];
regionPatches[patchi] = ppPtr->clone(regionMesh.boundaryMesh()).ptr();
delete ppPtr;
}
regionMesh.clearOut();
@ -2443,16 +2447,16 @@ int main(int argc, char *argv[])
(
meshMod.points()
);
label meshPointI = extrudePatch.localPoints().size();
label meshPointi = extrudePatch.localPoints().size();
forAll(localRegionPoints, regionI)
{
label pointI = localRegionPoints[regionI];
point pt = extrudePatch.localPoints()[pointI];
label pointi = localRegionPoints[regionI];
point pt = extrudePatch.localPoints()[pointi];
const vector& n = localRegionNormals[regionI];
for (label layerI = 1; layerI <= model().nLayers(); layerI++)
{
newPoints[meshPointI++] = model()(pt, n, layerI);
newPoints[meshPointi++] = model()(pt, n, layerI);
}
}
@ -2477,20 +2481,20 @@ int main(int argc, char *argv[])
List<pointField> topOffsets(zoneNames.size());
List<pointField> bottomOffsets(zoneNames.size());
forAll(regionMesh.boundaryMesh(), patchI)
forAll(regionMesh.boundaryMesh(), patchi)
{
const polyPatch& pp = regionMesh.boundaryMesh()[patchI];
const polyPatch& pp = regionMesh.boundaryMesh()[patchi];
if (isA<mappedWallPolyPatch>(pp))
{
if (findIndex(interRegionTopPatch, patchI) != -1)
if (findIndex(interRegionTopPatch, patchi) != -1)
{
label zoneI = findIndex(interRegionTopPatch, patchI);
label zoneI = findIndex(interRegionTopPatch, patchi);
topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
}
else if (findIndex(interRegionBottomPatch, patchI) != -1)
else if (findIndex(interRegionBottomPatch, patchi) != -1)
{
label zoneI = findIndex(interRegionBottomPatch, patchI);
label zoneI = findIndex(interRegionBottomPatch, patchi);
bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
}
}
@ -2686,20 +2690,20 @@ int main(int argc, char *argv[])
polyTopoChange meshMod(mesh);
// Modify faces to be in bottom (= always coupled) patch
forAll(extrudeMeshFaces, zoneFaceI)
forAll(extrudeMeshFaces, zoneFacei)
{
label meshFaceI = extrudeMeshFaces[zoneFaceI];
label zoneI = zoneID[zoneFaceI];
bool flip = zoneFlipMap[zoneFaceI];
const face& f = mesh.faces()[meshFaceI];
label meshFacei = extrudeMeshFaces[zoneFacei];
label zoneI = zoneID[zoneFacei];
bool flip = zoneFlipMap[zoneFacei];
const face& f = mesh.faces()[meshFacei];
if (!flip)
{
meshMod.modifyFace
(
f, // modified face
meshFaceI, // label of face being modified
mesh.faceOwner()[meshFaceI],// owner
meshFacei, // label of face being modified
mesh.faceOwner()[meshFacei],// owner
-1, // neighbour
false, // face flip
interMeshBottomPatch[zoneI],// patch for face
@ -2707,13 +2711,13 @@ int main(int argc, char *argv[])
flip // face flip in zone
);
}
else if (mesh.isInternalFace(meshFaceI))
else if (mesh.isInternalFace(meshFacei))
{
meshMod.modifyFace
(
f.reverseFace(), // modified face
meshFaceI, // label of modified face
mesh.faceNeighbour()[meshFaceI],// owner
meshFacei, // label of modified face
mesh.faceNeighbour()[meshFacei],// owner
-1, // neighbour
true, // face flip
interMeshBottomPatch[zoneI], // patch for face
@ -2725,20 +2729,20 @@ int main(int argc, char *argv[])
if (zoneShadowNames.size() > 0) //if there is a top faceZone specified
{
forAll(extrudeMeshFaces, zoneFaceI)
forAll(extrudeMeshFaces, zoneFacei)
{
label meshFaceI = extrudeMeshShadowFaces[zoneFaceI];
label zoneI = zoneShadowID[zoneFaceI];
bool flip = zoneShadowFlipMap[zoneFaceI];
const face& f = mesh.faces()[meshFaceI];
label meshFacei = extrudeMeshShadowFaces[zoneFacei];
label zoneI = zoneShadowID[zoneFacei];
bool flip = zoneShadowFlipMap[zoneFacei];
const face& f = mesh.faces()[meshFacei];
if (!flip)
{
meshMod.modifyFace
(
f, // modified face
meshFaceI, // face being modified
mesh.faceOwner()[meshFaceI],// owner
meshFacei, // face being modified
mesh.faceOwner()[meshFacei],// owner
-1, // neighbour
false, // face flip
interMeshTopPatch[zoneI], // patch for face
@ -2746,13 +2750,13 @@ int main(int argc, char *argv[])
flip // face flip in zone
);
}
else if (mesh.isInternalFace(meshFaceI))
else if (mesh.isInternalFace(meshFacei))
{
meshMod.modifyFace
(
f.reverseFace(), // modified face
meshFaceI, // label modified face
mesh.faceNeighbour()[meshFaceI],// owner
meshFacei, // label modified face
mesh.faceNeighbour()[meshFacei],// owner
-1, // neighbour
true, // face flip
interMeshTopPatch[zoneI], // patch for face
@ -2765,25 +2769,25 @@ int main(int argc, char *argv[])
else
{
// Add faces (using same points) to be in top patch
forAll(extrudeMeshFaces, zoneFaceI)
forAll(extrudeMeshFaces, zoneFacei)
{
label meshFaceI = extrudeMeshFaces[zoneFaceI];
label zoneI = zoneID[zoneFaceI];
bool flip = zoneFlipMap[zoneFaceI];
const face& f = mesh.faces()[meshFaceI];
label meshFacei = extrudeMeshFaces[zoneFacei];
label zoneI = zoneID[zoneFacei];
bool flip = zoneFlipMap[zoneFacei];
const face& f = mesh.faces()[meshFacei];
if (!flip)
{
if (mesh.isInternalFace(meshFaceI))
if (mesh.isInternalFace(meshFacei))
{
meshMod.addFace
(
f.reverseFace(), // modified face
mesh.faceNeighbour()[meshFaceI],// owner
mesh.faceNeighbour()[meshFacei],// owner
-1, // neighbour
-1, // master point
-1, // master edge
meshFaceI, // master face
meshFacei, // master face
true, // flip flux
interMeshTopPatch[zoneI], // patch for face
-1, // zone for face
@ -2796,11 +2800,11 @@ int main(int argc, char *argv[])
meshMod.addFace
(
f, // face
mesh.faceOwner()[meshFaceI], // owner
mesh.faceOwner()[meshFacei], // owner
-1, // neighbour
-1, // master point
-1, // master edge
meshFaceI, // master face
meshFacei, // master face
false, // flip flux
interMeshTopPatch[zoneI], // patch for face
-1, // zone for face

View File

@ -2,11 +2,10 @@
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType extrude2DMesh
wmake
wmake $targetType
#------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,12 +39,12 @@ namespace Foam
void Foam::extrude2DMesh::check2D() const
{
const faceList& faces = mesh_.faces();
forAll(faces, faceI)
forAll(faces, facei)
{
if (faces[faceI].size() != 2)
if (faces[facei].size() != 2)
{
FatalErrorInFunction
<< "Face " << faceI << " size " << faces[faceI].size()
<< "Face " << facei << " size " << faces[facei].size()
<< " is not of size 2: mesh is not a valid two-dimensional "
<< "mesh" << exit(FatalError);
}
@ -92,8 +92,8 @@ Foam::extrude2DMesh::extrude2DMesh
model_(model),
modelType_(dict.lookup("extrudeModel")),
patchType_(dict.lookup("patchType")),
frontPatchI_(-1),
backPatchI_(-1)
frontPatchi_(-1),
backPatchi_(-1)
{
check2D();
}
@ -111,17 +111,17 @@ void Foam::extrude2DMesh::addFrontBackPatches()
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
frontPatchI_ = patches.findPatchID("front");
backPatchI_ = patches.findPatchID("back");
frontPatchi_ = patches.findPatchID("front");
backPatchi_ = patches.findPatchID("back");
// Add patch.
List<polyPatch*> newPatches(patches.size() + 2);
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
newPatches[patchI] =
newPatches[patchi] =
pp.clone
(
patches,
@ -131,59 +131,59 @@ void Foam::extrude2DMesh::addFrontBackPatches()
).ptr();
}
if (frontPatchI_ == -1)
if (frontPatchi_ == -1)
{
frontPatchI_ = patches.size();
frontPatchi_ = patches.size();
newPatches[frontPatchI_] =
newPatches[frontPatchi_] =
polyPatch::New
(
patchType_,
"front",
0,
mesh_.nFaces(),
frontPatchI_,
frontPatchi_,
patches
).ptr();
// newPatches[frontPatchI_] = polyPatch::New
// newPatches[frontPatchi_] = polyPatch::New
// (
// "front",
// patchDict_,
// frontPatchI_,
// frontPatchi_,
// patches
// ).ptr();
Info<< "Adding patch " << newPatches[frontPatchI_]->name()
<< " at index " << frontPatchI_
Info<< "Adding patch " << newPatches[frontPatchi_]->name()
<< " at index " << frontPatchi_
<< " for front faces." << nl << endl;
}
if (backPatchI_ == -1)
if (backPatchi_ == -1)
{
backPatchI_ = patches.size() + 1;
backPatchi_ = patches.size() + 1;
newPatches[backPatchI_] =
newPatches[backPatchi_] =
polyPatch::New
(
patchType_,
"back",
0,
mesh_.nFaces(),
backPatchI_,
backPatchi_,
patches
).ptr();
// newPatches[frontPatchI_] = polyPatch::New
// newPatches[frontPatchi_] = polyPatch::New
// (
// "back",
// patchDict_,
// backPatchI_,
// backPatchi_,
// patches
// ).ptr();
Info<< "Adding patch " << newPatches[backPatchI_]->name()
<< " at index " << backPatchI_
Info<< "Adding patch " << newPatches[backPatchi_]->name()
<< " at index " << backPatchi_
<< " for back faces." << nl << endl;
}
@ -205,15 +205,15 @@ void Foam::extrude2DMesh::setRefinement
{
label offset = layer * mesh_.nCells();
forAll(mesh_.cells(), cellI)
forAll(mesh_.cells(), celli)
{
meshMod.addCell
(
-1, //masterPointID,
-1, //masterEdgeID,
-1, //masterFaceID,
cellI + offset, //masterCellID,
mesh_.cellZones().whichZone(cellI) //zoneID
celli + offset, //masterCellID,
mesh_.cellZones().whichZone(celli) //zoneID
);
}
}
@ -226,13 +226,13 @@ void Foam::extrude2DMesh::setRefinement
{
label offset = layer * points.size();
forAll(points, pointI)
forAll(points, pointi)
{
// Don't need the surface normal for either linearDirection or
// wedge. Will need to add to be able to use others.
point newPoint = model_
(
points[pointI],
points[pointi],
vector(),
layer
);
@ -240,7 +240,7 @@ void Foam::extrude2DMesh::setRefinement
meshMod.addPoint
(
newPoint,
pointI + offset,
pointi + offset,
-1, // zoneID
true // inCell
);
@ -262,18 +262,18 @@ void Foam::extrude2DMesh::setRefinement
label currentLayerOffset = layer * mesh_.nPoints();
label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
{
label zoneID = mesh_.faceZones().whichZone(faceI);
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID != -1)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
face newFace(4);
const face& f = faces[faceI];
const face& f = faces[facei];
newFace[0] = f[0] + currentLayerOffset;
newFace[1] = f[1] + currentLayerOffset;
newFace[2] = f[1] + nextLayerOffset;
@ -281,15 +281,15 @@ void Foam::extrude2DMesh::setRefinement
//{
// vector n = newFace.normal(pointField(meshMod.points()));
// label own = mesh_.faceOwner()[faceI];
// label own = mesh_.faceOwner()[facei];
// const labelList& ownPoints = mesh_.cellPoints()[own];
// point ownCc = sum(pointField(mesh_.points(), ownPoints))/ownPoints.size();
// label nei = mesh_.faceNeighbour()[faceI];
// label nei = mesh_.faceNeighbour()[facei];
// const labelList& neiPoints = mesh_.cellPoints()[nei];
// point neiCc = sum(pointField(mesh_.points(), neiPoints))/neiPoints.size();
// vector d = neiCc - ownCc;
// Pout<< "face:" << faceI << " at:" << f.centre(mesh_.points()) << endl
// Pout<< "face:" << facei << " at:" << f.centre(mesh_.points()) << endl
// << " own:" << own << " at:" << ownCc << endl
// << " nei:" << nei << " at:" << neiCc << endl
// << " sign:" << (n & d) << endl
@ -301,8 +301,8 @@ void Foam::extrude2DMesh::setRefinement
meshMod.addFace
(
newFace,
mesh_.faceOwner()[faceI] + offset, // own
mesh_.faceNeighbour()[faceI] + offset, // nei
mesh_.faceOwner()[facei] + offset, // own
mesh_.faceNeighbour()[facei] + offset, // nei
-1, // masterPointID
-1, // masterEdgeID
nFaces++, // masterFaceID
@ -315,36 +315,36 @@ void Foam::extrude2DMesh::setRefinement
if (debug)
{
Info<< newFace << " "
<< mesh_.faceOwner()[faceI] + offset << " "
<< mesh_.faceNeighbour()[faceI] + offset << " "
<< mesh_.faceOwner()[facei] + offset << " "
<< mesh_.faceNeighbour()[facei] + offset << " "
<< nFaces - 1
<< endl;
}
}
}
forAll(patches, patchI)
forAll(patches, patchi)
{
for (label layer=0; layer < nLayers; layer++)
{
label currentLayerOffset = layer*mesh_.nPoints();
label nextLayerOffset = currentLayerOffset + mesh_.nPoints();
label startFaceI = patches[patchI].start();
label endFaceI = startFaceI + patches[patchI].size();
label startFacei = patches[patchi].start();
label endFacei = startFacei + patches[patchi].size();
for (label faceI = startFaceI; faceI < endFaceI; faceI++)
for (label facei = startFacei; facei < endFacei; facei++)
{
label zoneID = mesh_.faceZones().whichZone(faceI);
label zoneID = mesh_.faceZones().whichZone(facei);
bool zoneFlip = false;
if (zoneID != -1)
{
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
face newFace(4);
const face& f = faces[faceI];
const face& f = faces[facei];
newFace[0] = f[0] + currentLayerOffset;
newFace[1] = f[1] + currentLayerOffset;
newFace[2] = f[1] + nextLayerOffset;
@ -355,13 +355,13 @@ void Foam::extrude2DMesh::setRefinement
meshMod.addFace
(
newFace,
mesh_.faceOwner()[faceI] + offset, // own
mesh_.faceOwner()[facei] + offset, // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
nFaces++, // masterFaceID
false, // flipFaceFlux
patchI, // patchID
patchi, // patchID
zoneID, // zoneID
zoneFlip // zoneFlip
);
@ -369,7 +369,7 @@ void Foam::extrude2DMesh::setRefinement
if (debug)
{
Info<< newFace << " "
<< mesh_.faceOwner()[faceI] + offset << " "
<< mesh_.faceOwner()[facei] + offset << " "
<< nFaces - 1
<< endl;
}
@ -379,52 +379,52 @@ void Foam::extrude2DMesh::setRefinement
// Add extra internal faces that need special treatment for owners and
// neighbours.
forAll(mesh_.cells(), cellI)
forAll(mesh_.cells(), celli)
{
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
face frontFace(cFaces.size());
// Make a loop out of faces.
label nextFaceI = cFaces[0];
label nextFacei = cFaces[0];
const face& f = faces[nextFaceI];
const face& f = faces[nextFacei];
label nextPointI;
if (mesh_.faceOwner()[nextFaceI] == cellI)
label nextPointi;
if (mesh_.faceOwner()[nextFacei] == celli)
{
frontFace[0] = f[0];
nextPointI = f[1];
nextPointi = f[1];
}
else
{
frontFace[0] = f[1];
nextPointI = f[0];
nextPointi = f[0];
}
for (label i = 1; i < frontFace.size(); i++)
{
frontFace[i] = nextPointI;
frontFace[i] = nextPointi;
// Find face containing pointI
forAll(cFaces, cFaceI)
// Find face containing pointi
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
if (faceI != nextFaceI)
label facei = cFaces[cFacei];
if (facei != nextFacei)
{
const face& f = faces[faceI];
const face& f = faces[facei];
if (f[0] == nextPointI)
if (f[0] == nextPointi)
{
nextPointI = f[1];
nextFaceI = faceI;
nextPointi = f[1];
nextFacei = facei;
break;
}
else if (f[1] == nextPointI)
else if (f[1] == nextPointi)
{
nextPointI = f[0];
nextFaceI = faceI;
nextPointi = f[0];
nextFacei = facei;
break;
}
}
@ -444,13 +444,13 @@ void Foam::extrude2DMesh::setRefinement
label nei = -1;
if (layer != nLayers - 1)
{
nei = cellI + offset + mesh_.nCells();
nei = celli + offset + mesh_.nCells();
}
meshMod.addFace
(
frontFace,
cellI + offset, // own
celli + offset, // own
nei, // nei
-1, // masterPointID
-1, // masterEdgeID
@ -464,7 +464,7 @@ void Foam::extrude2DMesh::setRefinement
if (debug)
{
Info<< frontFace << " "
<< cellI + offset << " "
<< celli + offset << " "
<< nei << " "
<< nFaces - 1
<< endl;
@ -475,52 +475,52 @@ void Foam::extrude2DMesh::setRefinement
// Generate front and back faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(mesh_.cells(), cellI)
forAll(mesh_.cells(), celli)
{
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
face frontFace(cFaces.size());
// Make a loop out of faces.
label nextFaceI = cFaces[0];
label nextFacei = cFaces[0];
const face& f = faces[nextFaceI];
const face& f = faces[nextFacei];
label nextPointI;
if (mesh_.faceOwner()[nextFaceI] == cellI)
label nextPointi;
if (mesh_.faceOwner()[nextFacei] == celli)
{
frontFace[0] = f[0];
nextPointI = f[1];
nextPointi = f[1];
}
else
{
frontFace[0] = f[1];
nextPointI = f[0];
nextPointi = f[0];
}
for (label i = 1; i < frontFace.size(); i++)
{
frontFace[i] = nextPointI;
frontFace[i] = nextPointi;
// Find face containing pointI
forAll(cFaces, cFaceI)
// Find face containing pointi
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
if (faceI != nextFaceI)
label facei = cFaces[cFacei];
if (facei != nextFacei)
{
const face& f = faces[faceI];
const face& f = faces[facei];
if (f[0] == nextPointI)
if (f[0] == nextPointi)
{
nextPointI = f[1];
nextFaceI = faceI;
nextPointi = f[1];
nextFacei = facei;
break;
}
else if (f[1] == nextPointI)
else if (f[1] == nextPointi)
{
nextPointI = f[0];
nextFaceI = faceI;
nextPointi = f[0];
nextFacei = facei;
break;
}
}
@ -531,13 +531,13 @@ void Foam::extrude2DMesh::setRefinement
meshMod.addFace
(
frontFace.reverseFace(),
cellI, // own
celli, // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
nFaces++, // masterFaceID
false, // flipFaceFlux
backPatchI_, // patchID
backPatchi_, // patchID
-1, // zoneID
false // zoneFlip
);
@ -545,7 +545,7 @@ void Foam::extrude2DMesh::setRefinement
if (debug)
{
Info<< nl<<frontFace.reverseFace() << " "
<< cellI << " "
<< celli << " "
<< nFaces - 1
<< endl;
}
@ -561,13 +561,13 @@ void Foam::extrude2DMesh::setRefinement
meshMod.addFace
(
frontFace,
cellI + offset, // own
celli + offset, // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
nFaces++, // masterFaceID
false, // flipFaceFlux
frontPatchI_, // patchID
frontPatchi_, // patchID
-1, // zoneID
false // zoneFlip
);
@ -575,7 +575,7 @@ void Foam::extrude2DMesh::setRefinement
if (debug)
{
Info<< frontFace << " "
<< cellI + offset << " "
<< celli + offset << " "
<< nFaces - 1
<< endl;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,8 +76,8 @@ class extrude2DMesh
const word patchType_;
label frontPatchI_;
label backPatchI_;
label frontPatchi_;
label backPatchi_;
// Private Member Functions
@ -128,14 +128,14 @@ public:
void distribute(const mapDistributePolyMesh&)
{}
label frontPatchI() const
label frontPatchi() const
{
return frontPatchI_;
return frontPatchi_;
}
label backPatchI() const
label backPatchi() const
{
return backPatchI_;
return backPatchi_;
}
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,11 +101,11 @@ Foam::labelList Foam::patchToPoly2DMesh::internalFaceOrder()
labelList oldToNew(owner_.size(), -1);
label newFaceI = 0;
label newFacei = 0;
forAll(faceEdges, faceI)
forAll(faceEdges, facei)
{
const labelList& fEdges = faceEdges[faceI];
const labelList& fEdges = faceEdges[facei];
// Neighbouring faces
SortableList<label> nbr(fEdges.size(), -1);
@ -115,17 +115,17 @@ Foam::labelList Foam::patchToPoly2DMesh::internalFaceOrder()
{
// Internal edge. Get the face on other side.
label nbrFaceI = neighbour_[fEdges[feI]];
label nbrFacei = neighbour_[fEdges[feI]];
if (nbrFaceI == faceI)
if (nbrFacei == facei)
{
nbrFaceI = owner_[fEdges[feI]];
nbrFacei = owner_[fEdges[feI]];
}
if (faceI < nbrFaceI)
if (facei < nbrFacei)
{
// faceI is master
nbr[feI] = nbrFaceI;
// facei is master
nbr[feI] = nbrFacei;
}
}
}
@ -136,7 +136,7 @@ Foam::labelList Foam::patchToPoly2DMesh::internalFaceOrder()
{
if (nbr[i] != -1)
{
oldToNew[fEdges[nbr.indices()[i]]] = newFaceI++;
oldToNew[fEdges[nbr.indices()[i]]] = newFacei++;
}
}
}
@ -152,11 +152,11 @@ void Foam::patchToPoly2DMesh::addPatchFacesToFaces()
label offset = patch_.nInternalEdges();
face f(2);
forAll(patchNames_, patchI)
forAll(patchNames_, patchi)
{
forAllConstIter(EdgeMap<label>, mapEdgesRegion_, eIter)
{
if (eIter() == patchI)
if (eIter() == patchi)
{
f[0] = meshPoints[eIter.key().start()];
f[1] = meshPoints[eIter.key().end()];
@ -183,12 +183,12 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
for
(
label bFaceI = nInternalEdges;
bFaceI < faces_.size();
++bFaceI
label bFacei = nInternalEdges;
bFacei < faces_.size();
++bFacei
)
{
const face& e = faces_[bFaceI];
const face& e = faces_[bFacei];
bool matched = false;
@ -209,14 +209,14 @@ void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
label fp = findIndex(f, e[0]);
newOwner[bFaceI] = owner_[bEdgeI];
newOwner[bFacei] = owner_[bEdgeI];
if (f.nextLabel(fp) != e[1])
{
Info<< "Flipping" << endl;
faces_[bFaceI][0] = e[1];
faces_[bFaceI][1] = e[0];
faces_[bFacei][0] = e[1];
faces_[bFacei][1] = e[0];
}
nMatched++;
@ -333,10 +333,10 @@ void Foam::patchToPoly2DMesh::createMesh()
createPolyMeshComponents();
label startFace = patch_.nInternalEdges();
forAll(patchNames_, patchI)
forAll(patchNames_, patchi)
{
patchStarts_[patchI] = startFace;
startFace += patchSizes_[patchI];
patchStarts_[patchi] = startFace;
startFace += patchSizes_[patchi];
}
}

View File

@ -81,28 +81,28 @@ static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames;
// pointField layer1Points(fMesh.nPoints());
// pointField displacement(fMesh.nPoints());
// forAll(layer0Points, pointI)
// forAll(layer0Points, pointi)
// {
// const labelList& meshPoints = fMesh.meshPoints();
// label meshPointI = meshPoints[pointI];
// label meshPointi = meshPoints[pointi];
// layer0Points[meshPointI] = model
// layer0Points[meshPointi] = model
// (
// fMesh.points()[meshPointI],
// fMesh.pointNormals()[pointI],
// fMesh.points()[meshPointi],
// fMesh.pointNormals()[pointi],
// 0
// );
// layer1Points[meshPointI] = model
// layer1Points[meshPointi] = model
// (
// fMesh.points()[meshPointI],
// fMesh.pointNormals()[pointI],
// fMesh.points()[meshPointi],
// fMesh.pointNormals()[pointi],
// 1
// );
// displacement[pointI] =
// layer1Points[meshPointI]
// - layer0Points[meshPointI];
// displacement[pointi] =
// layer1Points[meshPointi]
// - layer0Points[meshPointi];
// }
// fMesh.movePoints(layer0Points);
@ -211,14 +211,14 @@ int main(int argc, char *argv[])
Info<< "Constructing patches." << endl;
List<polyPatch*> patches(poly2DMesh.patchNames().size());
forAll(patches, patchI)
forAll(patches, patchi)
{
patches[patchI] = new polyPatch
patches[patchi] = new polyPatch
(
poly2DMesh.patchNames()[patchI],
poly2DMesh.patchSizes()[patchI],
poly2DMesh.patchStarts()[patchI],
patchI,
poly2DMesh.patchNames()[patchi],
poly2DMesh.patchSizes()[patchi],
poly2DMesh.patchStarts()[patchi],
patchi,
mesh().boundaryMesh(),
polyPatch::typeName
);

View File

@ -2,7 +2,6 @@
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
if [ -d "$CGAL_ARCH_PATH/include/CGAL" ] || \

View File

@ -1,2 +1,2 @@
cellSizeAndAlignmentGrid.C
EXE = $(FOAM_USER_APPBIN)/cellSizeAndAlignmentGrid
EXE = $(FOAM_APPBIN)/cellSizeAndAlignmentGrid

View File

@ -25,8 +25,6 @@ EXE_INC = \
EXE_LIBS = \
$(CGAL_LIBS) \
-lmpfr \
-lboost_thread \
-lconformalVoronoiMesh \
-lfiniteVolume \
-lmeshTools \

View File

@ -537,9 +537,9 @@ int main(int argc, char *argv[])
// Enforce the boundary conditions
const triad& fixedAlignment = fixedAlignments[pI];
forAll(pPoints, adjPointI)
forAll(pPoints, adjPointi)
{
const label adjPointIndex = pPoints[adjPointI];
const label adjPointIndex = pPoints[adjPointi];
scalar dist = mag(points[pI] - points[adjPointIndex]);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,13 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
class cv2DControls;
Ostream& operator<<(Ostream&, const cv2DControls&);
/*---------------------------------------------------------------------------*\
Class cv2DControls Declaration
\*---------------------------------------------------------------------------*/

View File

@ -91,9 +91,9 @@ void Foam::DelaunayMesh<Triangulation>::addPatches
label nPatches = patchFaces.size();
patchDicts.setSize(nPatches);
forAll(patchDicts, patchI)
forAll(patchDicts, patchi)
{
patchDicts.set(patchI, new dictionary());
patchDicts.set(patchi, new dictionary());
}
label nBoundaryFaces = 0;
@ -109,16 +109,16 @@ void Foam::DelaunayMesh<Triangulation>::addPatches
faces.setSize(nInternalFaces + nBoundaryFaces);
owner.setSize(nInternalFaces + nBoundaryFaces);
label faceI = nInternalFaces;
label facei = nInternalFaces;
forAll(patchFaces, p)
{
forAll(patchFaces[p], f)
{
faces[faceI] = patchFaces[p][f];
owner[faceI] = patchOwners[p][f];
faces[facei] = patchFaces[p][f];
owner[facei] = patchOwners[p][f];
faceI++;
facei++;
}
}
}
@ -429,7 +429,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
// Index the cells
label cellI = 0;
label celli = 0;
for
(
@ -445,11 +445,11 @@ Foam::DelaunayMesh<Triangulation>::createMesh
&& cit->real()
)
{
cellMap[cit->cellIndex()] = cellI++;
cellMap[cit->cellIndex()] = celli++;
}
}
label faceI = 0;
label facei = 0;
labelList verticesOnTriFace(3, label(-1));
face newFace(verticesOnTriFace);
@ -566,16 +566,16 @@ Foam::DelaunayMesh<Triangulation>::createMesh
neighbourCell = c1I;
}
faces[faceI] = newFace;
owner[faceI] = ownerCell;
neighbour[faceI] = neighbourCell;
faceI++;
faces[facei] = newFace;
owner[facei] = ownerCell;
neighbour[facei] = neighbourCell;
facei++;
}
}
faces.setSize(faceI);
owner.setSize(faceI);
neighbour.setSize(faceI);
faces.setSize(facei);
owner.setSize(facei);
neighbour.setSize(facei);
sortFaces(faces, owner, neighbour);
@ -583,7 +583,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
addPatches
(
faceI,
facei,
faces,
owner,
patchDicts,

View File

@ -51,28 +51,28 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
forAll(toProc, i)
{
label procI = toProc[i];
label proci = toProc[i];
nSend[procI]++;
nSend[proci]++;
}
// 2. Size sendMap
labelListList sendMap(Pstream::nProcs());
forAll(nSend, procI)
forAll(nSend, proci)
{
sendMap[procI].setSize(nSend[procI]);
sendMap[proci].setSize(nSend[proci]);
nSend[procI] = 0;
nSend[proci] = 0;
}
// 3. Fill sendMap
forAll(toProc, i)
{
label procI = toProc[i];
label proci = toProc[i];
sendMap[procI][nSend[procI]++] = i;
sendMap[proci][nSend[proci]++] = i;
}
// 4. Send over how many I need to receive
@ -93,17 +93,17 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
label constructSize = constructMap[Pstream::myProcNo()].size();
forAll(constructMap, procI)
forAll(constructMap, proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
label nRecv = recvSizes[procI];
label nRecv = recvSizes[proci];
constructMap[procI].setSize(nRecv);
constructMap[proci].setSize(nRecv);
for (label i = 0; i < nRecv; i++)
{
constructMap[procI][i] = constructSize++;
constructMap[proci][i] = constructSize++;
}
}
}
@ -201,16 +201,16 @@ Foam::labelList Foam::DistributedDelaunayMesh<Triangulation>::overlapProcessors
{
DynamicList<label> toProc(Pstream::nProcs());
forAll(allBackgroundMeshBounds_(), procI)
forAll(allBackgroundMeshBounds_(), proci)
{
// Test against the bounding box of the processor
if
(
!isLocal(procI)
&& allBackgroundMeshBounds_()[procI].overlaps(centre, radiusSqr)
!isLocal(proci)
&& allBackgroundMeshBounds_()[proci].overlaps(centre, radiusSqr)
)
{
toProc.append(procI);
toProc.append(proci);
}
}
@ -366,9 +366,9 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells
if (cellToCheck.found(cit->cellIndex()))
{
// Get the neighbours and check them
for (label adjCellI = 0; adjCellI < 4; ++adjCellI)
for (label adjCelli = 0; adjCelli < 4; ++adjCelli)
{
Cell_handle citNeighbor = cit->neighbor(adjCellI);
Cell_handle citNeighbor = cit->neighbor(adjCelli);
// Ignore if has far point or previously visited
if
@ -432,7 +432,7 @@ void Foam::DistributedDelaunayMesh<Triangulation>::markVerticesToRefer
forAll(citOverlaps, cOI)
{
label procI = citOverlaps[cOI];
label proci = citOverlaps[cOI];
for (int i = 0; i < 4; i++)
{
@ -451,11 +451,11 @@ void Foam::DistributedDelaunayMesh<Triangulation>::markVerticesToRefer
// Using the hashSet to ensure that each vertex is only
// referred once to each processor.
// Do not refer a vertex to its own processor.
if (vProcIndex != procI)
if (vProcIndex != proci)
{
if (referralVertices[procI].insert(procIndexPair))
if (referralVertices[proci].insert(procIndexPair))
{
targetProcessor.append(procI);
targetProcessor.append(proci);
parallelInfluenceVertices.append
(
@ -501,9 +501,9 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
pointMap.distribute(parallelVertices);
for (label procI = 0; procI < Pstream::nProcs(); procI++)
for (label proci = 0; proci < Pstream::nProcs(); proci++)
{
const labelList& constructMap = pointMap.constructMap()[procI];
const labelList& constructMap = pointMap.constructMap()[proci];
if (constructMap.size())
{
@ -841,11 +841,11 @@ void Foam::DistributedDelaunayMesh<Triangulation>::sync(const boundBox& bb)
/Pstream::nProcs();
PtrList<labelPairHashSet> referralVertices(Pstream::nProcs());
forAll(referralVertices, procI)
forAll(referralVertices, proci)
{
if (!isLocal(procI))
if (!isLocal(proci))
{
referralVertices.set(procI, new labelPairHashSet(nApproxReferred));
referralVertices.set(proci, new labelPairHashSet(nApproxReferred));
}
}
@ -957,7 +957,7 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
}
else if (lt == Triangulation::OUTSIDE_CONVEX_HULL)
{
// @todo Can this be optimised?
// TODO: Can this be optimised?
//
// Only want to insert if a connection is formed between
// pointToInsert and an internal or internal boundary point.

View File

@ -24,8 +24,7 @@ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \
-IPrintTable \
-I/usr/include
-IPrintTable
LIB_LIBS = \
${CGAL_LIBS} \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -86,9 +86,9 @@ void Foam::PrintTable<KeyType, DataType>::print
List<label> largestProcSize(Pstream::nProcs(), 0);
forAll(procData, procI)
forAll(procData, proci)
{
const HashTableData& procIData = procData[procI];
const HashTableData& procIData = procData[proci];
for
(
@ -108,7 +108,7 @@ void Foam::PrintTable<KeyType, DataType>::print
HashTable<DataType, label>& key = combinedTable[iter.key()];
key.insert(procI, iter());
key.insert(proci, iter());
for
(
@ -145,11 +145,11 @@ void Foam::PrintTable<KeyType, DataType>::print
os.width(largestKeyLength);
os << indent << "# Proc";
forAll(procData, procI)
forAll(procData, proci)
{
os << tab;
os.width(largestDataLength);
os << procI;
os << proci;
}
if (printSum)

View File

@ -57,28 +57,28 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
forAll(toProc, i)
{
label procI = toProc[i];
label proci = toProc[i];
nSend[procI]++;
nSend[proci]++;
}
// 2. Size sendMap
labelListList sendMap(Pstream::nProcs());
forAll(nSend, procI)
forAll(nSend, proci)
{
sendMap[procI].setSize(nSend[procI]);
sendMap[proci].setSize(nSend[proci]);
nSend[procI] = 0;
nSend[proci] = 0;
}
// 3. Fill sendMap
forAll(toProc, i)
{
label procI = toProc[i];
label proci = toProc[i];
sendMap[procI][nSend[procI]++] = i;
sendMap[proci][nSend[proci]++] = i;
}
// 4. Send over how many I need to receive
@ -99,17 +99,17 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
label constructSize = constructMap[Pstream::myProcNo()].size();
forAll(constructMap, procI)
forAll(constructMap, proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
label nRecv = recvSizes[procI];
label nRecv = recvSizes[proci];
constructMap[procI].setSize(nRecv);
constructMap[proci].setSize(nRecv);
for (label i = 0; i < nRecv; i++)
{
constructMap[procI][i] = constructSize++;
constructMap[proci][i] = constructSize++;
}
}
}
@ -150,8 +150,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
decompositionMethod& decomposer =
decompositionModel::New(mesh_).decomposer();
volScalarField::InternalField& icellWeights = cellWeights.internalField();
volScalarField::Internal& icellWeights = cellWeights;
// For each cell in the mesh has it been determined if it is fully
// inside, outside, or overlaps the surface
@ -166,13 +165,13 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
while (true)
{
// Determine/update the status of each cell
forAll(volumeStatus, cellI)
forAll(volumeStatus, celli)
{
if (volumeStatus[cellI] == volumeType::UNKNOWN)
if (volumeStatus[celli] == volumeType::UNKNOWN)
{
treeBoundBox cellBb
(
mesh_.cells()[cellI].points
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
@ -181,15 +180,15 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if (geometry.overlaps(cellBb))
{
volumeStatus[cellI] = volumeType::MIXED;
volumeStatus[celli] = volumeType::MIXED;
}
else if (geometry.inside(cellBb.midpoint()))
{
volumeStatus[cellI] = volumeType::INSIDE;
volumeStatus[celli] = volumeType::INSIDE;
}
else
{
volumeStatus[cellI] = volumeType::OUTSIDE;
volumeStatus[celli] = volumeType::OUTSIDE;
}
}
}
@ -213,17 +212,17 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
forAll(newCellsToRefine, nCTRI)
{
label cellI = newCellsToRefine[nCTRI];
label celli = newCellsToRefine[nCTRI];
if (volumeStatus[cellI] == volumeType::MIXED)
if (volumeStatus[celli] == volumeType::MIXED)
{
volumeStatus[cellI] = volumeType::UNKNOWN;
volumeStatus[celli] = volumeType::UNKNOWN;
}
icellWeights[cellI] = max
icellWeights[celli] = max
(
1.0,
icellWeights[cellI]/8.0
icellWeights[celli]/8.0
);
}
@ -261,17 +260,17 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
List<volumeType> newVolumeStatus(cellMap.size());
forAll(cellMap, newCellI)
forAll(cellMap, newCelli)
{
label oldCellI = cellMap[newCellI];
label oldCelli = cellMap[newCelli];
if (oldCellI == -1)
if (oldCelli == -1)
{
newVolumeStatus[newCellI] = volumeType::UNKNOWN;
newVolumeStatus[newCelli] = volumeType::UNKNOWN;
}
else
{
newVolumeStatus[newCellI] = volumeStatus[oldCellI];
newVolumeStatus[newCelli] = volumeStatus[oldCelli];
}
}
@ -285,13 +284,13 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
}
// Determine/update the status of each cell
forAll(volumeStatus, cellI)
forAll(volumeStatus, celli)
{
if (volumeStatus[cellI] == volumeType::UNKNOWN)
if (volumeStatus[celli] == volumeType::UNKNOWN)
{
treeBoundBox cellBb
(
mesh_.cells()[cellI].points
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
@ -300,15 +299,15 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if (geometry.overlaps(cellBb))
{
volumeStatus[cellI] = volumeType::MIXED;
volumeStatus[celli] = volumeType::MIXED;
}
else if (geometry.inside(cellBb.midpoint()))
{
volumeStatus[cellI] = volumeType::INSIDE;
volumeStatus[celli] = volumeType::INSIDE;
}
else
{
volumeStatus[cellI] = volumeType::OUTSIDE;
volumeStatus[celli] = volumeType::OUTSIDE;
}
}
}
@ -320,11 +319,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
DynamicList<label> cellsToRemove;
forAll(volumeStatus, cellI)
forAll(volumeStatus, celli)
{
if (volumeStatus[cellI] == volumeType::OUTSIDE)
if (volumeStatus[celli] == volumeType::OUTSIDE)
{
cellsToRemove.append(cellI);
cellsToRemove.append(celli);
}
}
@ -371,17 +370,17 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
List<volumeType> newVolumeStatus(cellMap.size());
forAll(cellMap, newCellI)
forAll(cellMap, newCelli)
{
label oldCellI = cellMap[newCellI];
label oldCelli = cellMap[newCelli];
if (oldCellI == -1)
if (oldCelli == -1)
{
newVolumeStatus[newCellI] = volumeType::UNKNOWN;
newVolumeStatus[newCelli] = volumeType::UNKNOWN;
}
else
{
newVolumeStatus[newCellI] = volumeStatus[oldCellI];
newVolumeStatus[newCelli] = volumeStatus[oldCelli];
}
}
@ -476,36 +475,36 @@ void Foam::backgroundMeshDecomposition::printMeshData
// globalIndex globalBoundaryFaces(mesh.nFaces()-mesh.nInternalFaces());
for (label procI = 0; procI < Pstream::nProcs(); procI++)
for (label proci = 0; proci < Pstream::nProcs(); proci++)
{
Info<< "Processor " << procI << " "
<< "Number of cells = " << globalCells.localSize(procI)
Info<< "Processor " << proci << " "
<< "Number of cells = " << globalCells.localSize(proci)
<< endl;
// label nProcFaces = 0;
// const labelList& nei = patchNeiProcNo[procI];
// const labelList& nei = patchNeiProcNo[proci];
// forAll(patchNeiProcNo[procI], i)
// forAll(patchNeiProcNo[proci], i)
// {
// Info<< " Number of faces shared with processor "
// << patchNeiProcNo[procI][i] << " = " << patchSize[procI][i]
// << patchNeiProcNo[proci][i] << " = " << patchSize[proci][i]
// << endl;
// nProcFaces += patchSize[procI][i];
// nProcFaces += patchSize[proci][i];
// }
// Info<< " Number of processor patches = " << nei.size() << nl
// << " Number of processor faces = " << nProcFaces << nl
// << " Number of boundary faces = "
// << globalBoundaryFaces.localSize(procI) << endl;
// << globalBoundaryFaces.localSize(proci) << endl;
}
}
bool Foam::backgroundMeshDecomposition::refineCell
(
label cellI,
label celli,
volumeType volType,
scalar& weightEstimate
) const
@ -517,7 +516,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
treeBoundBox cellBb
(
mesh_.cells()[cellI].points
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
@ -634,34 +633,34 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
volScalarField& cellWeights
) const
{
volScalarField::InternalField& icellWeights = cellWeights.internalField();
volScalarField::Internal& icellWeights = cellWeights;
labelHashSet cellsToRefine;
// Determine/update the status of each cell
forAll(volumeStatus, cellI)
forAll(volumeStatus, celli)
{
if (volumeStatus[cellI] == volumeType::MIXED)
if (volumeStatus[celli] == volumeType::MIXED)
{
if (meshCutter_.cellLevel()[cellI] < minLevels_)
if (meshCutter_.cellLevel()[celli] < minLevels_)
{
cellsToRefine.insert(cellI);
cellsToRefine.insert(celli);
}
}
if (volumeStatus[cellI] != volumeType::OUTSIDE)
if (volumeStatus[celli] != volumeType::OUTSIDE)
{
if
(
refineCell
(
cellI,
volumeStatus[cellI],
icellWeights[cellI]
celli,
volumeStatus[celli],
icellWeights[celli]
)
)
{
cellsToRefine.insert(cellI);
cellsToRefine.insert(celli);
}
}
}
@ -723,10 +722,10 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
point bbMin(GREAT, GREAT, GREAT);
point bbMax(-GREAT, -GREAT, -GREAT);
forAll(allBackgroundMeshBounds_, procI)
forAll(allBackgroundMeshBounds_, proci)
{
bbMin = min(bbMin, allBackgroundMeshBounds_[procI].min());
bbMax = max(bbMax, allBackgroundMeshBounds_[procI].max());
bbMin = min(bbMin, allBackgroundMeshBounds_[proci].min());
bbMax = max(bbMax, allBackgroundMeshBounds_[proci].max());
}
globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax);
@ -867,7 +866,7 @@ Foam::backgroundMeshDecomposition::distribute
mesh_.write();
}
volScalarField::InternalField& icellWeights = cellWeights.internalField();
volScalarField::Internal& icellWeights = cellWeights;
while (true)
{
@ -899,8 +898,8 @@ Foam::backgroundMeshDecomposition::distribute
{
Info<< " cellWeightLimit " << cellWeightLimit << endl;
Pout<< " sum(cellWeights) " << sum(cellWeights.internalField())
<< " max(cellWeights) " << max(cellWeights.internalField())
Pout<< " sum(cellWeights) " << sum(cellWeights.primitiveField())
<< " max(cellWeights) " << max(cellWeights.primitiveField())
<< endl;
}
@ -937,9 +936,9 @@ Foam::backgroundMeshDecomposition::distribute
forAll(newCellsToRefine, nCTRI)
{
label cellI = newCellsToRefine[nCTRI];
label celli = newCellsToRefine[nCTRI];
icellWeights[cellI] /= 8.0;
icellWeights[celli] /= 8.0;
}
// Mesh changing engine.
@ -1116,13 +1115,13 @@ Foam::labelList Foam::backgroundMeshDecomposition::processorNearestPosition
label nCandidates = 0;
forAll(allBackgroundMeshBounds_, procI)
forAll(allBackgroundMeshBounds_, proci)
{
// Candidate points may lie just outside a processor box, increase
// test range by using overlaps rather than contains
if (allBackgroundMeshBounds_[procI].overlaps(pt, sqr(SMALL*100)))
if (allBackgroundMeshBounds_[proci].overlaps(pt, sqr(SMALL*100)))
{
toCandidateProc.append(procI);
toCandidateProc.append(proci);
testPoints.append(pt);
nCandidates++;
@ -1239,17 +1238,17 @@ Foam::backgroundMeshDecomposition::intersectsProcessors
label nCandidates = 0;
forAll(allBackgroundMeshBounds_, procI)
forAll(allBackgroundMeshBounds_, proci)
{
// It is assumed that the sphere in question overlaps the source
// processor, so don't test it, unless includeOwnProcessor is true
if
(
(includeOwnProcessor || procI != Pstream::myProcNo())
&& allBackgroundMeshBounds_[procI].intersects(s, e, p)
(includeOwnProcessor || proci != Pstream::myProcNo())
&& allBackgroundMeshBounds_[proci].intersects(s, e, p)
)
{
toCandidateProc.append(procI);
toCandidateProc.append(proci);
testStarts.append(s);
testEnds.append(e);
@ -1333,7 +1332,7 @@ bool Foam::backgroundMeshDecomposition::overlapsOtherProcessors
const scalar& radiusSqr
) const
{
forAll(allBackgroundMeshBounds_, procI)
forAll(allBackgroundMeshBounds_, proci)
{
if (bFTreePtr_().findNearest(centre, radiusSqr).hit())
{
@ -1353,19 +1352,19 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
{
DynamicList<label> toProc(Pstream::nProcs());
forAll(allBackgroundMeshBounds_, procI)
forAll(allBackgroundMeshBounds_, proci)
{
// Test against the bounding box of the processor
if
(
procI != Pstream::myProcNo()
&& allBackgroundMeshBounds_[procI].overlaps(centre, radiusSqr)
proci != Pstream::myProcNo()
&& allBackgroundMeshBounds_[proci].overlaps(centre, radiusSqr)
)
{
// Expensive test
// if (bFTreePtr_().findNearest(centre, radiusSqr).hit())
{
toProc.append(procI);
toProc.append(proci);
}
}
}
@ -1397,19 +1396,19 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
//
// label nCandidates = 0;
//
// forAll(allBackgroundMeshBounds_, procI)
// forAll(allBackgroundMeshBounds_, proci)
// {
// // It is assumed that the sphere in question overlaps the source
// // processor, so don't test it, unless includeOwnProcessor is true
// if
// (
// (includeOwnProcessor || procI != Pstream::myProcNo())
// && allBackgroundMeshBounds_[procI].overlaps(c, rSqr)
// (includeOwnProcessor || proci != Pstream::myProcNo())
// && allBackgroundMeshBounds_[proci].overlaps(c, rSqr)
// )
// {
// if (bFTreePtr_().findNearest(c, rSqr).hit())
// {
// toCandidateProc.append(procI);
// toCandidateProc.append(proci);
// testCentres.append(c);
// testRadiusSqrs.append(rSqr);
//
@ -1432,7 +1431,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
//// map().distribute(testCentres);
//// map().distribute(testRadiusSqrs);
//
// // @todo This is faster, but results in more vertices being referred
// // TODO: This is faster, but results in more vertices being referred
// boolList sphereOverlapsCandidate(testCentres.size(), true);
//// boolList sphereOverlapsCandidate(testCentres.size(), false);
////
@ -1522,17 +1521,17 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
//
// label nCandidates = 0;
//
// forAll(allBackgroundMeshBounds_, procI)
// forAll(allBackgroundMeshBounds_, proci)
// {
// // It is assumed that the sphere in question overlaps the source
// // processor, so don't test it, unless includeOwnProcessor is true
// if
// (
// (includeOwnProcessor || procI != Pstream::myProcNo())
// && allBackgroundMeshBounds_[procI].overlaps(cc, rSqr)
// (includeOwnProcessor || proci != Pstream::myProcNo())
// && allBackgroundMeshBounds_[proci].overlaps(cc, rSqr)
// )
// {
// toCandidateProc.append(procI);
// toCandidateProc.append(proci);
//
// nCandidates++;
// }
@ -1549,7 +1548,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors
// map().distribute(testCentres);
// map().distribute(testRadiusSqrs);
//
// // @todo This is faster, but results in more vertices being referred
// // TODO: This is faster, but results in more vertices being referred
//// boolList sphereOverlapsCandidate(testCentres.size(), true);
// boolList sphereOverlapsCandidate(testCentres.size(), false);
//

View File

@ -161,7 +161,7 @@ class backgroundMeshDecomposition
// it
bool refineCell
(
label cellI,
label celli,
volumeType volType,
scalar& weightEstimate
) const;

View File

@ -64,11 +64,11 @@ Foam::labelList Foam::backgroundMeshDecomposition::processorPosition
label nCandidates = 0;
forAll(allBackgroundMeshBounds_, procI)
forAll(allBackgroundMeshBounds_, proci)
{
if (allBackgroundMeshBounds_[procI].contains(pt))
if (allBackgroundMeshBounds_[proci].contains(pt))
{
toCandidateProc.append(procI);
toCandidateProc.append(proci);
testPoints.append(pt);
nCandidates++;

View File

@ -97,7 +97,7 @@ Foam::scalarField Foam::cellShapeControl::cellSize
Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
{
scalarList bary;
FixedList<scalar, 4> bary;
cellShapeControlMesh::Cell_handle ch;
shapeControlMesh_.barycentricCoords(pt, bary, ch);
@ -172,7 +172,7 @@ Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
Foam::tensor Foam::cellShapeControl::cellAlignment(const point& pt) const
{
scalarList bary;
FixedList<scalar, 4> bary;
cellShapeControlMesh::Cell_handle ch;
shapeControlMesh_.barycentricCoords(pt, bary, ch);
@ -244,7 +244,7 @@ void Foam::cellShapeControl::cellSizeAndAlignment
tensor& alignment
) const
{
scalarList bary;
FixedList<scalar, 4> bary;
cellShapeControlMesh::Cell_handle ch;
shapeControlMesh_.barycentricCoords(pt, bary, ch);

View File

@ -450,7 +450,7 @@ Foam::cellShapeControlMesh::~cellShapeControlMesh()
void Foam::cellShapeControlMesh::barycentricCoords
(
const Foam::point& pt,
scalarList& bary,
FixedList<scalar, 4>& bary,
Cell_handle& ch
) const
{
@ -744,7 +744,7 @@ Foam::label Foam::cellShapeControlMesh::estimateCellCount
{
if (!cit->hasFarPoint() && !is_infinite(cit))
{
// @todo Check if tet centre is on the processor..
// TODO: Check if tet centre is on the processor..
CGAL::Tetrahedron_3<baseK> tet
(
cit->vertex(0)->point(),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -122,7 +122,7 @@ public:
void barycentricCoords
(
const Foam::point& pt,
scalarList& bary,
FixedList<scalar, 4>& bary,
Cell_handle& ch
) const;

View File

@ -94,7 +94,7 @@ Foam::fileControl::~fileControl()
//
//Foam::scalar Foam::fileControl::cellSize(const point& pt) const
//{
// scalarList bary;
// FixedList<scalar, 4> bary;
// Cell_handle ch;
//
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
@ -112,7 +112,7 @@ Foam::fileControl::~fileControl()
////- Return the cell alignment at the given location
//Foam::tensor Foam::fileControl::cellAlignment(const point& pt) const
//{
// scalarList bary;
// FixedList<scalar, 4> bary;
// Cell_handle ch;
//
// triangulatedMesh_.barycentricCoords(pt, bary, ch);
@ -144,7 +144,7 @@ Foam::fileControl::~fileControl()
// tensor& alignment
//) const
//{
// scalarList bary;
// FixedList<scalar, 4> bary;
// Cell_handle ch;
//
// triangulatedMesh_.barycentricCoords(pt, bary, ch);

View File

@ -31,7 +31,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(controlMeshRefinement, 0);
defineTypeNameAndDebug(controlMeshRefinement, 0);
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -396,7 +396,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
<< ", alignment difference = " << alignmentDiff << endl;
}
// @todo Also need to base it on the alignments
// TODO: Also need to base it on the alignments
if
(
sizeDiff/interpolatedCellSize > 0.1
@ -561,7 +561,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
Info<< " size difference = " << sizeDiff << endl;
}
// @todo Also need to base it on the alignments
// TODO: Also need to base it on the alignments
if (sizeDiff/interpolatedCellSize > 0.1)
{
insertPoint = true;

Some files were not shown because too many files have changed in this diff Show More