Merge commit '10725e9' into nextRelease
Conflicts: ListOfContributors
This commit is contained in:
commit
b973a15b4d
503 changed files with 1813089 additions and 3 deletions
|
@ -1,13 +1,19 @@
|
||||||
# -*- mode: org; -*-
|
# -*- mode: org; -*-
|
||||||
#
|
#
|
||||||
#+TITLE: *Cumulative List of Contributors for foam-extend-3.1*
|
#+TITLE: *Cumulative List of Contributors for foam-extend-3.0*
|
||||||
#+AUTHOR: Hrvoje Jasak
|
#+AUTHOR: Hrvoje Jasak.
|
||||||
#+DATE: 8 June 2014
|
#+DATE: 10 January 2014
|
||||||
#+LINK: http://foam-extend.org
|
#+LINK: http://foam-extend.org
|
||||||
#+OPTIONS: author:nil
|
#+OPTIONS: author:nil
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
* List of Contributors
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
* List of Contributors
|
* List of Contributors
|
||||||
|
|
||||||
(If your name is missing in the list, please contact the maintainers at
|
(If your name is missing in the list, please contact the maintainers at
|
||||||
|
@ -43,6 +49,7 @@
|
||||||
Peter Janas
|
Peter Janas
|
||||||
Mattijs Janssens
|
Mattijs Janssens
|
||||||
Klas Jareteg
|
Klas Jareteg
|
||||||
|
Franjo Juretic
|
||||||
Aleksandar Karac
|
Aleksandar Karac
|
||||||
Dennis Kingsley
|
Dennis Kingsley
|
||||||
Nikola Kornev
|
Nikola Kornev
|
||||||
|
|
146
applications/utilities/mesh/cfMesh/FLMAToSurface/FLMAToSurface.C
Normal file
146
applications/utilities/mesh/cfMesh/FLMAToSurface/FLMAToSurface.C
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads the AVL's surface mesh
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "triSurfModifier.H"
|
||||||
|
#include "triFaceList.H"
|
||||||
|
#include "labelLongList.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
fileName outFileName(args.args()[2]);
|
||||||
|
|
||||||
|
if( inFileName.ext() != "flma" )
|
||||||
|
{
|
||||||
|
Info << "Cannot convert this mesh" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create the surface mesh
|
||||||
|
triSurf ts;
|
||||||
|
triSurfModifier tsm(ts);
|
||||||
|
|
||||||
|
label counter;
|
||||||
|
|
||||||
|
IFstream inFile(inFileName);
|
||||||
|
|
||||||
|
inFile >> counter;
|
||||||
|
|
||||||
|
//- read vertices
|
||||||
|
pointField& points = tsm.pointsAccess();
|
||||||
|
points.setSize(counter);
|
||||||
|
forAll(points, pointI)
|
||||||
|
{
|
||||||
|
point& p = points[pointI];
|
||||||
|
|
||||||
|
inFile >> p.x();
|
||||||
|
inFile >> p.y();
|
||||||
|
inFile >> p.z();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read facets
|
||||||
|
inFile >> counter;
|
||||||
|
geometricSurfacePatchList patches(1);
|
||||||
|
patches[0].name() = "patch";
|
||||||
|
LongList<labelledTri>& triangles = tsm.facetsAccess();
|
||||||
|
triangles.setSize(counter);
|
||||||
|
forAll(triangles, triI)
|
||||||
|
{
|
||||||
|
inFile >> counter;
|
||||||
|
|
||||||
|
if( counter != 3 )
|
||||||
|
{
|
||||||
|
Info << "Facet " << triI << " is not a triangle!!" << endl;
|
||||||
|
Warning << "Cannot convert this surface!" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(label j=0;j<3;++j)
|
||||||
|
inFile >> triangles[triI][2-j];
|
||||||
|
|
||||||
|
triangles[triI].region() = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read cell types
|
||||||
|
inFile >> counter;
|
||||||
|
forAll(triangles, triI)
|
||||||
|
inFile >> counter;
|
||||||
|
|
||||||
|
//- start reading selections
|
||||||
|
inFile >> counter;
|
||||||
|
for(label selI=0;selI<counter;++selI)
|
||||||
|
{
|
||||||
|
//- read selection name
|
||||||
|
word selName;
|
||||||
|
inFile >> selName;
|
||||||
|
|
||||||
|
//- read selection type
|
||||||
|
label selType;
|
||||||
|
inFile >> selType;
|
||||||
|
|
||||||
|
//- read selection entries
|
||||||
|
label size;
|
||||||
|
inFile >> size;
|
||||||
|
labelLongList entries(size);
|
||||||
|
for(label i=0;i<size;++i)
|
||||||
|
inFile >> entries[i];
|
||||||
|
|
||||||
|
//- store cell selections
|
||||||
|
if( selType == 2 )
|
||||||
|
{
|
||||||
|
Info << "Adding subset " << selName << endl;
|
||||||
|
const label setID = ts.addFacetSubset(selName);
|
||||||
|
|
||||||
|
forAll(entries, i)
|
||||||
|
ts.addFacetToSubset(setID, entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- write the surface
|
||||||
|
ts.writeSurface(outFileName);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
FLMAToSurface.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/FLMAToSurface
|
|
@ -0,0 +1,6 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/triSurface/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ltriSurface -lmeshLibrary -lmeshTools
|
216
applications/utilities/mesh/cfMesh/FPMAToMesh/FPMAToMesh.C
Normal file
216
applications/utilities/mesh/cfMesh/FPMAToMesh/FPMAToMesh.C
Normal file
|
@ -0,0 +1,216 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Writes the mesh in fpma format readable by AVL's CfdWM
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
|
#include "Map.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
fileName inFileName;
|
||||||
|
|
||||||
|
Info << "Reading mesh from file " << endl;
|
||||||
|
cin >> inFileName;
|
||||||
|
|
||||||
|
IFstream file(inFileName);
|
||||||
|
|
||||||
|
polyMeshGen pmg(runTime);
|
||||||
|
polyMeshGenModifier meshModifier(pmg);
|
||||||
|
|
||||||
|
label counter;
|
||||||
|
|
||||||
|
//- read the number of vertices
|
||||||
|
pointFieldPMG& points = meshModifier.pointsAccess();
|
||||||
|
file >> counter;
|
||||||
|
|
||||||
|
//- read points from file
|
||||||
|
points.setSize(counter);
|
||||||
|
forAll(points, pointI)
|
||||||
|
{
|
||||||
|
point p;
|
||||||
|
file >> p.x();
|
||||||
|
file >> p.y();
|
||||||
|
file >> p.z();
|
||||||
|
|
||||||
|
points[pointI] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read the number of faces
|
||||||
|
file >> counter;
|
||||||
|
|
||||||
|
faceListPMG& faces = meshModifier.facesAccess();
|
||||||
|
|
||||||
|
//- read faces from file
|
||||||
|
faces.setSize(counter);
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
file >> counter;
|
||||||
|
|
||||||
|
face f;
|
||||||
|
f.setSize(counter);
|
||||||
|
|
||||||
|
forAll(f, pI)
|
||||||
|
file >> f[pI];
|
||||||
|
|
||||||
|
faces[faceI] = f.reverseFace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read the number of cells
|
||||||
|
file >> counter;
|
||||||
|
|
||||||
|
//- read cells from file
|
||||||
|
cellListPMG& cells = meshModifier.cellsAccess();
|
||||||
|
cells.setSize(counter);
|
||||||
|
|
||||||
|
forAll(cells, cellI)
|
||||||
|
{
|
||||||
|
file >> counter;
|
||||||
|
|
||||||
|
cell& c = cells[cellI];
|
||||||
|
|
||||||
|
c.setSize(counter);
|
||||||
|
|
||||||
|
forAll(c, fI)
|
||||||
|
file >> c[fI];
|
||||||
|
}
|
||||||
|
|
||||||
|
//- read selections
|
||||||
|
file >> counter;
|
||||||
|
|
||||||
|
wordList patchNames;
|
||||||
|
Map<label> subsetToPatch;
|
||||||
|
|
||||||
|
for(label setI=0;setI<counter;++setI)
|
||||||
|
{
|
||||||
|
word sName;
|
||||||
|
file >> sName;
|
||||||
|
|
||||||
|
label type;
|
||||||
|
file >> type;
|
||||||
|
|
||||||
|
label nEntries;
|
||||||
|
file >> nEntries;
|
||||||
|
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
//- face selection
|
||||||
|
const label id = pmg.addFaceSubset(sName);
|
||||||
|
|
||||||
|
patchNames.setSize(patchNames.size()+1);
|
||||||
|
patchNames[patchNames.size()-1] = sName;
|
||||||
|
subsetToPatch.insert(id, patchNames.size()-1);
|
||||||
|
|
||||||
|
Info << "Reading face selection " << sName << endl;
|
||||||
|
|
||||||
|
for(label i=0;i<nEntries;++i)
|
||||||
|
{
|
||||||
|
label entryI;
|
||||||
|
file >> entryI;
|
||||||
|
pmg.addFaceToSubset(id, entryI);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
//- cell selection
|
||||||
|
const label id = pmg.addCellSubset(sName);
|
||||||
|
|
||||||
|
for(label i=0;i<nEntries;++i)
|
||||||
|
{
|
||||||
|
label entryI;
|
||||||
|
file >> entryI;
|
||||||
|
pmg.addCellToSubset(id, entryI);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
//- node selection
|
||||||
|
const label id = pmg.addPointSubset(sName);
|
||||||
|
|
||||||
|
for(label i=0;i<nEntries;++i)
|
||||||
|
{
|
||||||
|
label entryI;
|
||||||
|
file >> entryI;
|
||||||
|
pmg.addPointToSubset(id, entryI);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create patches from face selections
|
||||||
|
VRWGraph boundaryFaces;
|
||||||
|
labelLongList boundaryOwner;
|
||||||
|
labelLongList boundaryPatches;
|
||||||
|
|
||||||
|
const labelList& owner = pmg.owner();
|
||||||
|
DynList<label> faceSubsets;
|
||||||
|
pmg.faceSubsetIndices(faceSubsets);
|
||||||
|
|
||||||
|
forAll(faceSubsets, setI)
|
||||||
|
{
|
||||||
|
labelLongList setFaces;
|
||||||
|
pmg.facesInSubset(faceSubsets[setI], setFaces);
|
||||||
|
|
||||||
|
forAll(setFaces, i)
|
||||||
|
{
|
||||||
|
boundaryFaces.appendList(faces[setFaces[i]]);
|
||||||
|
boundaryOwner.append(owner[setFaces[i]]);
|
||||||
|
boundaryPatches.append(subsetToPatch[faceSubsets[setI]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmg.removeFaceSubset(faceSubsets[setI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
meshModifier.reorderBoundaryFaces();
|
||||||
|
meshModifier.replaceBoundary
|
||||||
|
(
|
||||||
|
patchNames,
|
||||||
|
boundaryFaces,
|
||||||
|
boundaryOwner,
|
||||||
|
boundaryPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
pmg.write();
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
3
applications/utilities/mesh/cfMesh/FPMAToMesh/Make/files
Normal file
3
applications/utilities/mesh/cfMesh/FPMAToMesh/Make/files
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FPMAToMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/FPMAToMesh
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lmeshLibrary \
|
||||||
|
-lmeshTools
|
|
@ -0,0 +1,3 @@
|
||||||
|
cartesian2DMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/cartesian2DMesh
|
|
@ -0,0 +1,11 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lmeshTools \
|
||||||
|
-ltriSurface \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshLibrary
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Generates cartesian mesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
Generates a 2D cartesian mesh
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "cartesian2DMeshGenerator.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
//- 2d cartesian mesher cannot be run in parallel
|
||||||
|
argList::noParallel();
|
||||||
|
|
||||||
|
cartesian2DMeshGenerator cmg(runTime);
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
|
||||||
|
<< "ClockTime = " << runTime.elapsedClockTime() << " s" << endl;
|
||||||
|
|
||||||
|
cmg.writeMesh();
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
cartesianMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/cartesianMesh
|
|
@ -0,0 +1,11 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lmeshTools \
|
||||||
|
-ltriSurface \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshLibrary
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Generates cartesian mesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
- takes a triangulated surface and generates a cartesian mesh
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "objectRegistry.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "cartesianMeshGenerator.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
cartesianMeshGenerator cmg(runTime);
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
|
||||||
|
<< "ClockTime = " << runTime.elapsedClockTime() << " s" << endl;
|
||||||
|
|
||||||
|
cmg.writeMesh();
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
copySurfaceParts.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/copySurfaceParts
|
|
@ -0,0 +1,6 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = -ltriSurface -lmeshLibrary -lmeshTools
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
#include "fileName.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
#include "triSurfaceCopyParts.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
argList::validArgs.append("patch/subset name");
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
const fileName inFileName(args.args()[1]);
|
||||||
|
const fileName outFileName(args.args()[2]);
|
||||||
|
|
||||||
|
if( outFileName == inFileName )
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Output file " << outFileName
|
||||||
|
<< " would overwrite the input file."
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
wordList patches(1);
|
||||||
|
patches[0] = args.args()[3];
|
||||||
|
|
||||||
|
triSurf originalSurface(inFileName);
|
||||||
|
|
||||||
|
triSurfaceCopyParts copyPart(originalSurface);
|
||||||
|
|
||||||
|
triSurf copy;
|
||||||
|
|
||||||
|
copyPart.copySurface(patches, copy);
|
||||||
|
|
||||||
|
copy.writeSurface(outFileName);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
extrudeEdgesInto2DSurface.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/extrudeEdgesInto2DSurface
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ltriSurface -lmeshLibrary -lmeshTools
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads the surface mesh, remove the selected facets
|
||||||
|
and writes the modified mesh into a new file
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "triSurfaceExtrude2DEdges.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
fileName outFileName(args.args()[2]);
|
||||||
|
|
||||||
|
//- read the input surface
|
||||||
|
triSurf origSurf(inFileName);
|
||||||
|
|
||||||
|
//- remove the selected facets
|
||||||
|
triSurfaceExtrude2DEdges extruder(origSurf);
|
||||||
|
|
||||||
|
const triSurf* newSurfacePtr = extruder.extrudeSurface();
|
||||||
|
|
||||||
|
if( !newSurfacePtr )
|
||||||
|
FatalError << "Extruding of the edge mesh failed!" << exit(FatalError);
|
||||||
|
|
||||||
|
//- write the modified surface mesh
|
||||||
|
newSurfacePtr->writeSurface(outFileName);
|
||||||
|
|
||||||
|
deleteDemandDrivenData(newSurfacePtr);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
3
applications/utilities/mesh/cfMesh/meshToFPMA/Make/files
Normal file
3
applications/utilities/mesh/cfMesh/meshToFPMA/Make/files
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
meshToFPMA.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/meshToFPMA
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lmeshLibrary \
|
||||||
|
-lmeshTools
|
58
applications/utilities/mesh/cfMesh/meshToFPMA/meshToFPMA.C
Normal file
58
applications/utilities/mesh/cfMesh/meshToFPMA/meshToFPMA.C
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Writes the mesh in fpma format readable by AVL's CfdWM
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "writeMeshFPMA.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
polyMeshGen pmg(runTime);
|
||||||
|
pmg.read();
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
polyMeshGenModifier(pmg).addBufferCells();
|
||||||
|
createFIRESelections(pmg);
|
||||||
|
}
|
||||||
|
|
||||||
|
writeMeshFPMA(pmg, "convertedMesh");
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
patchesToSubsets.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/patchesToSubsets
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ltriSurface -lmeshLibrary -lmeshTools
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads the AVL's surface mesh
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "triFaceList.H"
|
||||||
|
#include "labelLongList.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
fileName outFileName(args.args()[2]);
|
||||||
|
|
||||||
|
if( outFileName.ext() != "fms" )
|
||||||
|
Warning << "The subsets cann only be saved in the .fms format" << endl;
|
||||||
|
|
||||||
|
triSurf origSurf(inFileName);
|
||||||
|
|
||||||
|
wordList patchNames(origSurf.patches().size());
|
||||||
|
forAll(origSurf.patches(), patchI)
|
||||||
|
patchNames[patchI] = origSurf.patches()[patchI].name();
|
||||||
|
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
labelLongList subsetFacets;
|
||||||
|
forAll(origSurf, triI)
|
||||||
|
{
|
||||||
|
if( origSurf[triI].region() == patchI )
|
||||||
|
subsetFacets.append(triI);
|
||||||
|
}
|
||||||
|
|
||||||
|
const label subsetId = origSurf.addFacetSubset(patchNames[patchI]);
|
||||||
|
|
||||||
|
forAll(subsetFacets, i)
|
||||||
|
origSurf.addFacetToSubset(subsetId, subsetFacets[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
origSurf.writeSurface(outFileName);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
3
applications/utilities/mesh/cfMesh/preparePar/Make/files
Normal file
3
applications/utilities/mesh/cfMesh/preparePar/Make/files
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
preparePar.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/preparePar
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/triSurface/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ltriSurface -lmeshTools -lmeshLibrary
|
100
applications/utilities/mesh/cfMesh/preparePar/preparePar.C
Normal file
100
applications/utilities/mesh/cfMesh/preparePar/preparePar.C
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Prepares the case for a parallel mesh generation run
|
||||||
|
|
||||||
|
Description
|
||||||
|
- creates processor* directories which contain data for processors
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
IOdictionary meshDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"meshDict",
|
||||||
|
runTime.system(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
IOdictionary decomposeParDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"decomposeParDict",
|
||||||
|
runTime.system(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const label nProcessors
|
||||||
|
(
|
||||||
|
readLabel(decomposeParDict.lookup("numberOfSubdomains"))
|
||||||
|
);
|
||||||
|
|
||||||
|
for(label procI=0;procI<nProcessors;++procI)
|
||||||
|
{
|
||||||
|
fileName file("processor");
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << procI;
|
||||||
|
file += ss.str();
|
||||||
|
Info << "Creating " << file << endl;
|
||||||
|
|
||||||
|
//- create a directory for processor data
|
||||||
|
mkDir(runTime.path()/file);
|
||||||
|
|
||||||
|
//- copy the contents of the const directory into processor*
|
||||||
|
cp(runTime.path()/"constant", runTime.path()/file);
|
||||||
|
|
||||||
|
//- generate 0 directories for
|
||||||
|
mkDir(runTime.path()/file/"0");
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
removeSurfaceFacets.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/removeSurfaceFacets
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ltriSurface -lmeshLibrary -lmeshTools
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads the surface mesh, remove the selected facets
|
||||||
|
and writes the modified mesh into a new file
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "triSurfaceRemoveFacets.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
argList::validArgs.append("Subset/patch name");
|
||||||
|
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
fileName outFileName(args.args()[2]);
|
||||||
|
word patchName(args.args()[3]);
|
||||||
|
|
||||||
|
//- read the input surface
|
||||||
|
triSurf origSurf(inFileName);
|
||||||
|
|
||||||
|
//- remove the selected facets
|
||||||
|
triSurfaceRemoveFacets rsf(origSurf);
|
||||||
|
|
||||||
|
rsf.selectFacetsInPatch(patchName);
|
||||||
|
|
||||||
|
rsf.removeFacets();
|
||||||
|
|
||||||
|
//- write the modified surface mesh
|
||||||
|
origSurf.writeSurface(outFileName);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
subsetToPatch.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/subsetToPatch
|
|
@ -0,0 +1,7 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(FOAM_SRC)/triSurface/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ltriSurface -lmeshTools -lmeshLibrary
|
170
applications/utilities/mesh/cfMesh/subsetToPatch/subsetToPatch.C
Normal file
170
applications/utilities/mesh/cfMesh/subsetToPatch/subsetToPatch.C
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates surface patches from surface subsets
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void makePatchFromSubset
|
||||||
|
(
|
||||||
|
triSurf& origSurf,
|
||||||
|
const DynList<word>& subsetNames
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//- create new list of patches
|
||||||
|
geometricSurfacePatchList newPatches
|
||||||
|
(
|
||||||
|
origSurf.patches().size() + subsetNames.size()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- set names of the new patches
|
||||||
|
forAll(origSurf.patches(), patchI)
|
||||||
|
newPatches[patchI].name() = origSurf.patches()[patchI].name();
|
||||||
|
|
||||||
|
forAll(subsetNames, subsetI)
|
||||||
|
newPatches[origSurf.patches().size()+subsetI].name() =
|
||||||
|
subsetNames[subsetI];
|
||||||
|
|
||||||
|
//- create new triangles
|
||||||
|
LongList<labelledTri> newTriangles(origSurf.facets());
|
||||||
|
|
||||||
|
//- set patches for all triangles
|
||||||
|
forAll(subsetNames, subsetI)
|
||||||
|
{
|
||||||
|
const label subsetID = origSurf.facetSubsetIndex(subsetNames[subsetI]);
|
||||||
|
|
||||||
|
labelLongList subsetFaces;
|
||||||
|
origSurf.facetsInSubset(subsetID, subsetFaces);
|
||||||
|
|
||||||
|
const label regionI = origSurf.patches().size() + subsetI;
|
||||||
|
|
||||||
|
forAll(subsetFaces, fI)
|
||||||
|
{
|
||||||
|
newTriangles[subsetFaces[fI]].region() = regionI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- remove patches with no elements
|
||||||
|
labelList nTrianglesInPatch(newPatches.size(), 0);
|
||||||
|
forAll(newTriangles, triI)
|
||||||
|
++nTrianglesInPatch[newTriangles[triI].region()];
|
||||||
|
|
||||||
|
Map<label> newPatchLabel;
|
||||||
|
label counter(0);
|
||||||
|
forAll(nTrianglesInPatch, patchI)
|
||||||
|
{
|
||||||
|
if( nTrianglesInPatch[patchI] )
|
||||||
|
newPatchLabel.insert(patchI, counter++);
|
||||||
|
}
|
||||||
|
|
||||||
|
geometricSurfacePatchList copyPatches(counter);
|
||||||
|
counter = 0;
|
||||||
|
forAll(newPatches, patchI)
|
||||||
|
{
|
||||||
|
if( newPatchLabel.found(patchI) )
|
||||||
|
{
|
||||||
|
copyPatches[newPatchLabel[patchI]].name() =
|
||||||
|
newPatches[patchI].name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newPatches = copyPatches;
|
||||||
|
|
||||||
|
//- renumber the patches in the list of triangles
|
||||||
|
forAll(newTriangles, triI)
|
||||||
|
newTriangles[triI].region() =
|
||||||
|
newPatchLabel[newTriangles[triI].region()];
|
||||||
|
|
||||||
|
//- delete subsets converted to patches
|
||||||
|
forAll(subsetNames, subsetI)
|
||||||
|
{
|
||||||
|
const label subsetID = origSurf.facetSubsetIndex(subsetNames[subsetI]);
|
||||||
|
origSurf.removeFacetSubset(subsetID);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- update subsets
|
||||||
|
origSurf.updateFacetsSubsets(newPatchLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("subset");
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
word subsetName(args.args()[2]);
|
||||||
|
|
||||||
|
triSurf* origSurfPtr = new triSurf(inFileName);
|
||||||
|
|
||||||
|
DynList<word> subsetNames;
|
||||||
|
const label subsetID = origSurfPtr->facetSubsetIndex(subsetName);
|
||||||
|
if( subsetID >= 0 )
|
||||||
|
{
|
||||||
|
Warning << "Subset " << subsetName
|
||||||
|
<< " checking subsets containing this string!" << endl;
|
||||||
|
|
||||||
|
DynList<label> existingSubsets;
|
||||||
|
origSurfPtr->facetSubsetIndices(existingSubsets);
|
||||||
|
|
||||||
|
forAll(existingSubsets, subsetI)
|
||||||
|
{
|
||||||
|
const word sName =
|
||||||
|
origSurfPtr->facetSubsetName(existingSubsets[subsetI]);
|
||||||
|
|
||||||
|
if( sName.substr(0, subsetName.size()) == subsetName )
|
||||||
|
{
|
||||||
|
subsetNames.append(sName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Converting " << subsetNames.size() << " subsets" << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subsetNames.append(subsetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
makePatchFromSubset(*origSurfPtr, subsetNames);
|
||||||
|
origSurfPtr->writeSurface(inFileName);
|
||||||
|
deleteDemandDrivenData(origSurfPtr);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
surfaceFeatureEdges.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/surfaceFeatureEdges
|
|
@ -0,0 +1,5 @@
|
||||||
|
EXE_INC = -I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = -ltriSurface -lmeshLibrary -lmeshTools
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
#include "fileName.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "triSurfaceDetectFeatureEdges.H"
|
||||||
|
#include "triSurfacePatchManipulator.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
argList::validOptions.insert("angle", "scalar");
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
fileName outFileName(args.args()[2]);
|
||||||
|
|
||||||
|
if (outFileName == inFileName)
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Output file " << outFileName
|
||||||
|
<< " would overwrite the input file."
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar tol(45.0);
|
||||||
|
if( args.options().found("angle") )
|
||||||
|
{
|
||||||
|
const scalar ang = readScalar(IStringStream(args.options()["angle"])());
|
||||||
|
tol = ang;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info << "Using 45 deg as default angle!" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
triSurf originalSurface(inFileName);
|
||||||
|
|
||||||
|
triSurfaceDetectFeatureEdges edgeDetector(originalSurface, tol);
|
||||||
|
edgeDetector.detectFeatureEdges();
|
||||||
|
|
||||||
|
if( outFileName.ext() == "fms" || outFileName.ext() == "FMS" )
|
||||||
|
{
|
||||||
|
Info << "Writing : " << outFileName << endl;
|
||||||
|
originalSurface.writeSurface(outFileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
triSurfacePatchManipulator manipulator(originalSurface);
|
||||||
|
const triSurf* newSurfPtr = manipulator.surfaceWithPatches();
|
||||||
|
|
||||||
|
Info << "Writing : " << outFileName << endl;
|
||||||
|
newSurfPtr->writeSurface(outFileName);
|
||||||
|
|
||||||
|
deleteDemandDrivenData(newSurfPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,3 @@
|
||||||
|
surfaceGenerateBoundingBox.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/surfaceGenerateBoundingBox
|
|
@ -0,0 +1,6 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = -ltriSurface -lmeshLibrary -lmeshTools
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Finds feature edges and corners of a triangulated surface
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
#include "fileName.H"
|
||||||
|
#include "triSurface.H"
|
||||||
|
#include "boundBox.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "triSurfaceDetectFeatureEdges.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.clear();
|
||||||
|
argList::validArgs.append("input surface file");
|
||||||
|
argList::validArgs.append("output surface file");
|
||||||
|
argList::validArgs.append("x-neg");
|
||||||
|
argList::validArgs.append("x-pos");
|
||||||
|
argList::validArgs.append("y-neg");
|
||||||
|
argList::validArgs.append("y-pos");
|
||||||
|
argList::validArgs.append("z-neg");
|
||||||
|
argList::validArgs.append("z-pos");
|
||||||
|
|
||||||
|
argList args(argc, argv);
|
||||||
|
|
||||||
|
fileName inFileName(args.args()[1]);
|
||||||
|
fileName outFileName(args.args()[2]);
|
||||||
|
|
||||||
|
if (outFileName == inFileName)
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Output file " << outFileName
|
||||||
|
<< " would overwrite the input file."
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
triSurface origSurface(inFileName);
|
||||||
|
const pointField& points = origSurface.points();
|
||||||
|
|
||||||
|
const boundBox bb(points);
|
||||||
|
|
||||||
|
vector negOffset, posOffset;
|
||||||
|
for(label i=3;i<9;++i)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << args.args()[i];
|
||||||
|
|
||||||
|
scalar s;
|
||||||
|
ss >> s;
|
||||||
|
|
||||||
|
if( i % 2 )
|
||||||
|
{
|
||||||
|
negOffset[(i-3)/2] = s;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
posOffset[(i-3)/2] = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Neg offset " << negOffset << endl;
|
||||||
|
Info << "Pos offset " << posOffset << endl;
|
||||||
|
|
||||||
|
const boundBox newBB(bb.min()-negOffset, bb.max()+posOffset);
|
||||||
|
Info << "Surface bounding box " << bb << endl;
|
||||||
|
Info << "Generated bounding box " << newBB << endl;
|
||||||
|
|
||||||
|
//- generate bounding box points
|
||||||
|
const label nPoints = points.size();
|
||||||
|
pointField newPoints(nPoints+8);
|
||||||
|
forAll(points, pointI)
|
||||||
|
newPoints[pointI] = points[pointI];
|
||||||
|
|
||||||
|
newPoints[nPoints] = newBB.min();
|
||||||
|
newPoints[nPoints+1] =
|
||||||
|
point(newBB.max().x(), newBB.min().y(), newBB.min().z());
|
||||||
|
newPoints[nPoints+2] =
|
||||||
|
point(newBB.min().x(), newBB.max().y(), newBB.min().z());
|
||||||
|
newPoints[nPoints+3] =
|
||||||
|
point(newBB.max().x(), newBB.max().y(), newBB.min().z());
|
||||||
|
newPoints[nPoints+4] =
|
||||||
|
point(newBB.min().x(), newBB.min().y(), newBB.max().z());
|
||||||
|
newPoints[nPoints+5] =
|
||||||
|
point(newBB.max().x(), newBB.min().y(), newBB.max().z());
|
||||||
|
newPoints[nPoints+6] =
|
||||||
|
point(newBB.min().x(), newBB.max().y(), newBB.max().z());
|
||||||
|
newPoints[nPoints+7] = newBB.max();
|
||||||
|
|
||||||
|
//- generate bounding bound triangles
|
||||||
|
const label nTriangles = origSurface.size();
|
||||||
|
List<labelledTri> newTriangles(nTriangles+12);
|
||||||
|
forAll(origSurface, triI)
|
||||||
|
newTriangles[triI] = origSurface[triI];
|
||||||
|
|
||||||
|
//- create patches
|
||||||
|
const label nPatches = origSurface.patches().size();
|
||||||
|
geometricSurfacePatchList newPatches(nPatches+6);
|
||||||
|
forAll(origSurface.patches(), patchI)
|
||||||
|
newPatches[patchI] = origSurface.patches()[patchI];
|
||||||
|
newPatches[nPatches].name() = "xMin";
|
||||||
|
newPatches[nPatches+1].name() = "xMax";
|
||||||
|
newPatches[nPatches+2].name() = "yMin";
|
||||||
|
newPatches[nPatches+3].name() = "yMax";
|
||||||
|
newPatches[nPatches+4].name() = "zMin";
|
||||||
|
newPatches[nPatches+5].name() = "zMax";
|
||||||
|
|
||||||
|
//- negative x direction
|
||||||
|
newTriangles[nTriangles] =
|
||||||
|
labelledTri(nPoints, nPoints+6, nPoints+2, nPatches);
|
||||||
|
newTriangles[nTriangles+1] =
|
||||||
|
labelledTri(nPoints, nPoints+4, nPoints+6, nPatches);
|
||||||
|
//- positive x direction
|
||||||
|
newTriangles[nTriangles+2] =
|
||||||
|
labelledTri(nPoints+1, nPoints+3, nPoints+7, nPatches+1);
|
||||||
|
newTriangles[nTriangles+3] =
|
||||||
|
labelledTri(nPoints+1, nPoints+7, nPoints+5, nPatches+1);
|
||||||
|
//- negative y direction
|
||||||
|
newTriangles[nTriangles+4] =
|
||||||
|
labelledTri(nPoints, nPoints+1, nPoints+5, nPatches+2);
|
||||||
|
newTriangles[nTriangles+5] =
|
||||||
|
labelledTri(nPoints, nPoints+5, nPoints+4, nPatches+2);
|
||||||
|
//- positive y direction
|
||||||
|
newTriangles[nTriangles+6] =
|
||||||
|
labelledTri(nPoints+2, nPoints+7, nPoints+3, nPatches+3);
|
||||||
|
newTriangles[nTriangles+7] =
|
||||||
|
labelledTri(nPoints+2, nPoints+6, nPoints+7, nPatches+3);
|
||||||
|
//- negative z direction
|
||||||
|
newTriangles[nTriangles+8] =
|
||||||
|
labelledTri(nPoints, nPoints+2, nPoints+3, nPatches+4);
|
||||||
|
newTriangles[nTriangles+9] =
|
||||||
|
labelledTri(nPoints, nPoints+3, nPoints+1, nPatches+4);
|
||||||
|
//- positive z direction
|
||||||
|
newTriangles[nTriangles+10] =
|
||||||
|
labelledTri(nPoints+4, nPoints+7, nPoints+6, nPatches+5);
|
||||||
|
newTriangles[nTriangles+11] =
|
||||||
|
labelledTri(nPoints+4, nPoints+5, nPoints+7, nPatches+5);
|
||||||
|
|
||||||
|
//- write the surface
|
||||||
|
triSurface newSurface(newTriangles, newPatches, newPoints);
|
||||||
|
newSurface.write(outFileName);
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
3
applications/utilities/mesh/cfMesh/tetMesh/Make/files
Normal file
3
applications/utilities/mesh/cfMesh/tetMesh/Make/files
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
tetMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/tetMesh
|
11
applications/utilities/mesh/cfMesh/tetMesh/Make/options
Normal file
11
applications/utilities/mesh/cfMesh/tetMesh/Make/options
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/cfMesh/meshLibrary/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lmeshTools \
|
||||||
|
-ltriSurface \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshLibrary
|
61
applications/utilities/mesh/cfMesh/tetMesh/tetMesh.C
Normal file
61
applications/utilities/mesh/cfMesh/tetMesh/tetMesh.C
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Generates tetrahedral mesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
- takes a triangulated surface and generates a tetrahedral mesh
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "tetMeshGenerator.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
//- tetrahedral mesher cannot be run in parallel yet
|
||||||
|
argList::noParallel();
|
||||||
|
|
||||||
|
tetMeshGenerator tmg(runTime);
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
|
||||||
|
<< "ClockTime = " << runTime.elapsedClockTime() << endl;
|
||||||
|
|
||||||
|
tmg.writeMesh();
|
||||||
|
|
||||||
|
Info << "End\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
BIN
doc/cfMesh/User Guide - cfMesh v1.0.pdf
Normal file
BIN
doc/cfMesh/User Guide - cfMesh v1.0.pdf
Normal file
Binary file not shown.
|
@ -6,5 +6,6 @@ set -x
|
||||||
wmake $makeType autoMesh
|
wmake $makeType autoMesh
|
||||||
wmake $makeType blockMesh
|
wmake $makeType blockMesh
|
||||||
wmake $makeType extrudeModel
|
wmake $makeType extrudeModel
|
||||||
|
wmake $makeType cfMesh/meshLibrary
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|
389
src/mesh/cfMesh/meshLibrary/Make/files
Normal file
389
src/mesh/cfMesh/meshLibrary/Make/files
Normal file
|
@ -0,0 +1,389 @@
|
||||||
|
|
||||||
|
meshSurfaceEngine = utilities/surfaceTools/meshSurfaceEngine
|
||||||
|
meshSurfacePartitioner = utilities/surfaceTools/meshSurfacePartitioner
|
||||||
|
boundaryLayers = utilities/boundaryLayers
|
||||||
|
checkMeshDict = utilities/checkMeshDict
|
||||||
|
|
||||||
|
meshSurfaceCheckInvertedVertices = utilities/surfaceTools/meshSurfaceCheckInvertedVertices
|
||||||
|
meshSurfaceCheckEdgeTypes = utilities/surfaceTools/meshSurfaceCheckEdgeTypes
|
||||||
|
meshSurfaceCutter = utilities/surfaceTools/meshSurfaceCutter
|
||||||
|
meshSurfaceMapper = utilities/surfaceTools/meshSurfaceMapper
|
||||||
|
meshSurfaceMapper2D = utilities/surfaceTools/meshSurfaceMapper2D
|
||||||
|
edgeExtraction = utilities/surfaceTools/edgeExtraction
|
||||||
|
edgeExtractor = $(edgeExtraction)/edgeExtractor
|
||||||
|
meshSurfaceEdgeExtractor = utilities/surfaceTools/meshSurfaceEdgeExtractor
|
||||||
|
meshSurfaceEdgeExtractorNonTopo = utilities/surfaceTools/meshSurfaceEdgeExtractorNonTopo
|
||||||
|
meshSurfaceEdgeExtractor2D = utilities/surfaceTools/meshSurfaceEdgeExtractor2D
|
||||||
|
correctEdgesBetweenPatches = utilities/surfaceTools/correctEdgesBetweenPatches
|
||||||
|
|
||||||
|
decomposeCellsNearConcaveEdges = utilities/surfaceTools/decomposeCellsNearConcaveEdges
|
||||||
|
renameBoundaryPatches = utilities/surfaceTools/renameBoundaryPatches
|
||||||
|
|
||||||
|
intersectionTools = utilities/intersectionTools
|
||||||
|
findCellsIntersectingSurface = $(intersectionTools)/findCellsIntersectingSurface
|
||||||
|
|
||||||
|
meshOptimizer = utilities/smoothers/geometry/meshOptimizer
|
||||||
|
tetMeshOptimisation = $(meshOptimizer)/tetMeshOptimisation
|
||||||
|
simplexSmoother = $(tetMeshOptimisation)/advancedSmoothers/simplexSmoother
|
||||||
|
knuppMetric = $(tetMeshOptimisation)/advancedSmoothers/knuppMetric
|
||||||
|
meshUntangler = $(tetMeshOptimisation)/advancedSmoothers/meshUntangler
|
||||||
|
quadricMetric = $(tetMeshOptimisation)/advancedSmoothers/quadricMetric
|
||||||
|
volumeOptimizer = $(tetMeshOptimisation)/advancedSmoothers/volumeOptimizer
|
||||||
|
|
||||||
|
meshSurfaceOptimizer = utilities/smoothers/geometry/meshSurfaceOptimizer
|
||||||
|
surfaceOptimizer = $(meshSurfaceOptimizer)/advancedSurfaceSmoothers/surfaceOptimizer
|
||||||
|
surfaceMorpherCells = utilities/surfaceTools/surfaceMorpherCells
|
||||||
|
|
||||||
|
utilitiesOctrees = utilities/octrees
|
||||||
|
meshOctree = utilities/octrees/meshOctree
|
||||||
|
meshOctreeCube = utilities/octrees/meshOctree/meshOctreeCube
|
||||||
|
meshOctreeInsideOutside = utilities/octrees/meshOctree/meshOctreeInsideOutside
|
||||||
|
meshOctreeCreator = utilities/octrees/meshOctree/meshOctreeCreator
|
||||||
|
meshOctreeAddressing = utilities/octrees/meshOctree/meshOctreeAddressing
|
||||||
|
meshOctreeModifier = utilities/octrees/meshOctree/meshOctreeModifier
|
||||||
|
meshOctreeAutoRef = utilities/octrees/meshOctree/meshOctreeAutomaticRefinement
|
||||||
|
patchRefinement = utilities/octrees/meshOctree/refinementControls/patchRefinement
|
||||||
|
objectRefinement = utilities/octrees/meshOctree/refinementControls/objectRefinement
|
||||||
|
helperFunctions = utilities/helperFunctions
|
||||||
|
createFacesFromChain = utilities/helperClasses/createFacesFromChain
|
||||||
|
sortEdgesIntoChains = utilities/helperClasses/sortEdgesIntoChains
|
||||||
|
trianglePlaneIntersections = utilities/helperClasses/trianglePlaneIntersections
|
||||||
|
tetCreatorOctree = utilities/tetrahedra/tetCreatorOctree
|
||||||
|
faceDecomposition = utilities/faceDecomposition
|
||||||
|
decomposeCells = utilities/decomposeCells
|
||||||
|
|
||||||
|
topology = utilities/smoothers/topology
|
||||||
|
topologicalCleaner = $(topology)/topologicalCleaner
|
||||||
|
checkBoundaryFacesSharingTwoEdges = $(topology)/checkBoundaryFacesSharingTwoEdges
|
||||||
|
checkCellConnectionsOverFaces = $(topology)/checkCellConnectionsOverFaces
|
||||||
|
checkIrregularSurfaceConnections = $(topology)/checkIrregularSurfaceConnections
|
||||||
|
checkNonMappableCellConnections = $(topology)/checkNonMappableCellConnections
|
||||||
|
|
||||||
|
triSurfaceTools = utilities/triSurfaceTools
|
||||||
|
triSurfaceCleanupDuplicates = $(triSurfaceTools)/triSurfaceCleanupDuplicates
|
||||||
|
triSurfaceCopyParts = $(triSurfaceTools)/triSurfaceCopyParts
|
||||||
|
triSurfaceCurvatureEstimator = $(triSurfaceTools)/triSurfaceCurvatureEstimator
|
||||||
|
triSurfacePartitioner = $(triSurfaceTools)/triSurfacePartitioner
|
||||||
|
triSurfaceDetectFeatureEdges = $(triSurfaceTools)/triSurfaceDetectFeatureEdges
|
||||||
|
triSurfaceClassifyEdges = $(triSurfaceTools)/triSurfaceClassifyEdges
|
||||||
|
triSurfacePatchManipulator = $(triSurfaceTools)/triSurfacePatchManipulator
|
||||||
|
triSurfaceRemoveFacets = $(triSurfaceTools)/triSurfaceRemoveFacets
|
||||||
|
triSurfaceExtrude2DEdges = $(triSurfaceTools)/triSurfaceExtrude2DEdges
|
||||||
|
triSurfaceMetaData = $(triSurfaceTools)/triSurfaceMetaData
|
||||||
|
|
||||||
|
polyMeshGen = utilities/meshes/polyMeshGen
|
||||||
|
boundaryPatch = utilities/meshes/polyMeshGen/boundaryPatch
|
||||||
|
polyMeshGen2DEngine = utilities/meshes/polyMeshGen2DEngine
|
||||||
|
polyMeshGenModifier = utilities/meshes/polyMeshGenModifier
|
||||||
|
polyMeshGenAddressing = utilities/meshes/polyMeshGenAddressing
|
||||||
|
polyMeshGenChecks = utilities/meshes/polyMeshGenChecks
|
||||||
|
partTetMesh = utilities/meshes/partTetMesh
|
||||||
|
partTriMesh = utilities/meshes/partTriMesh
|
||||||
|
primitiveMesh = utilities/meshes/primitiveMesh
|
||||||
|
triSurf = utilities/meshes/triSurf
|
||||||
|
cell = utilities/meshes/primitives/cell
|
||||||
|
edge = utilities/meshes/primitives/edge
|
||||||
|
face = utilities/meshes/primitives/face
|
||||||
|
|
||||||
|
containers = utilities/containers
|
||||||
|
VRWGraph = $(containers)/VRWGraph
|
||||||
|
VRWGraphList = $(containers)/VRWGraphList
|
||||||
|
graphs = $(containers)/Graphs
|
||||||
|
lists = $(containers)/Lists
|
||||||
|
|
||||||
|
meshZipper = utilities/meshZipper
|
||||||
|
|
||||||
|
writeAsFPMA = utilities/dataConversion/foamToFPMA
|
||||||
|
|
||||||
|
polyMeshExtractor = pMeshLibrary/polyMeshExtractor
|
||||||
|
polyMeshGenerator = pMeshLibrary/polyMeshGenerator
|
||||||
|
|
||||||
|
cartesianMeshExtractor = cartesianMesh/cartesianMeshExtractor
|
||||||
|
cartesianMeshGenerator = cartesianMesh/cartesianMeshGenerator
|
||||||
|
|
||||||
|
cartesian2DMeshGenerator = cartesian2DMesh/cartesian2DMeshGenerator
|
||||||
|
|
||||||
|
tetMeshExtractor = tetMesh/tetMeshExtractor
|
||||||
|
tetMeshExtractorOctree = tetMesh/tetMeshExtractorOctree
|
||||||
|
tetMeshGenerator = tetMesh/tetMeshGenerator
|
||||||
|
|
||||||
|
$(checkMeshDict)/checkMeshDict.C
|
||||||
|
|
||||||
|
$(lists)/pointFieldPMG.C
|
||||||
|
$(lists)/faceListPMG.C
|
||||||
|
|
||||||
|
$(VRWGraph)/VRWGraph.C
|
||||||
|
$(VRWGraph)/VRWGraphSMPModifier.C
|
||||||
|
|
||||||
|
$(VRWGraphList)/VRWGraphList.C
|
||||||
|
|
||||||
|
$(graphs)/cellIOGraph.C
|
||||||
|
$(graphs)/faceIOGraph.C
|
||||||
|
|
||||||
|
$(polyMeshGen)/polyMeshGen.C
|
||||||
|
$(polyMeshGen)/polyMeshGenPoints.C
|
||||||
|
$(polyMeshGen)/polyMeshGenFaces.C
|
||||||
|
$(polyMeshGen)/polyMeshGenCells.C
|
||||||
|
|
||||||
|
$(polyMeshGen2DEngine)/polyMeshGen2DEngine.C
|
||||||
|
|
||||||
|
$(boundaryPatch)/boundaryPatchBase.C
|
||||||
|
$(boundaryPatch)/boundaryPatch.C
|
||||||
|
$(boundaryPatch)/processorBoundaryPatch.C
|
||||||
|
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierRemoveUnusedVertices.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierRemoveFaces.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierRemoveCells.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierReorderBoundaryFaces.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierAddCells.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierAddProcessorFaces.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierAddBufferCells.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierReplaceBoundary.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierZipUpCells.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierRenumberMesh.C
|
||||||
|
$(polyMeshGenModifier)/polyMeshGenModifierAddCellByCell.C
|
||||||
|
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressing.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingCellCells.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingCellEdges.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingCellPoints.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingCentresAndAreas.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingCentresAndVols.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingClear.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingUpdateGeometry.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingEdgeCells.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingEdgeFaces.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingFaceEdges.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingEdges.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingPointCells.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingPointEdges.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingPointFaces.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingPointPoints.C
|
||||||
|
$(polyMeshGenAddressing)/polyMeshGenAddressingParallelAddressing.C
|
||||||
|
|
||||||
|
$(polyMeshGenChecks)/polyMeshGenChecks.C
|
||||||
|
$(polyMeshGenChecks)/polyMeshGenChecksGeometry.C
|
||||||
|
$(polyMeshGenChecks)/polyMeshGenChecksTopology.C
|
||||||
|
|
||||||
|
$(partTetMesh)/partTetMesh.C
|
||||||
|
$(partTetMesh)/partTetMeshAddressing.C
|
||||||
|
$(partTetMesh)/partTetMeshParallelAddressing.C
|
||||||
|
$(partTetMesh)/partTetMeshSimplex.C
|
||||||
|
|
||||||
|
$(partTriMesh)/partTriMesh.C
|
||||||
|
$(partTriMesh)/partTriMeshAddressing.C
|
||||||
|
$(partTriMesh)/partTriMeshParallelAddressing.C
|
||||||
|
$(partTriMesh)/partTriMeshSimplex.C
|
||||||
|
|
||||||
|
$(triSurf)/triSurf.C
|
||||||
|
$(triSurf)/triSurfPoints.C
|
||||||
|
$(triSurf)/triSurfFacets.C
|
||||||
|
$(triSurf)/triSurfFeatureEdges.C
|
||||||
|
$(triSurf)/triSurfAddressing.C
|
||||||
|
$(triSurf)/triSurfModifier.C
|
||||||
|
|
||||||
|
$(findCellsIntersectingSurface)/findCellsIntersectingSurface.C
|
||||||
|
|
||||||
|
$(tetCreatorOctree)/tetCreatorOctree.C
|
||||||
|
$(tetCreatorOctree)/tetCreatorOctreePointsAndAddressing.C
|
||||||
|
$(tetCreatorOctree)/tetCreatorOctreeFromFacesWithCentreNode.C
|
||||||
|
$(tetCreatorOctree)/tetCreatorOctreeTetsAroundEdges.C
|
||||||
|
$(tetCreatorOctree)/tetCreatorOctreeTetsAroundSplitEdges.C
|
||||||
|
$(tetCreatorOctree)/tetCreatorOctreeTetsFromSplitFaces.C
|
||||||
|
|
||||||
|
$(faceDecomposition)/faceDecomposition.C
|
||||||
|
$(faceDecomposition)/decomposeFaces.C
|
||||||
|
|
||||||
|
$(helperFunctions)/helperFunctionsStringConversion.C
|
||||||
|
|
||||||
|
$(sortEdgesIntoChains)/sortEdgesIntoChains.C
|
||||||
|
|
||||||
|
$(surfaceMorpherCells)/surfaceMorpherCells.C
|
||||||
|
$(surfaceMorpherCells)/surfaceMorpherCellsMorphInternalFaces.C
|
||||||
|
$(surfaceMorpherCells)/surfaceMorpherCellsCreateBoundaryFaces.C
|
||||||
|
|
||||||
|
$(decomposeCells)/decomposeCells.C
|
||||||
|
$(decomposeCells)/decomposeCellsPyramids.C
|
||||||
|
$(decomposeCells)/decomposeCellsDecomposition.C
|
||||||
|
|
||||||
|
$(topologicalCleaner)/topologicalCleaner.C
|
||||||
|
$(topologicalCleaner)/topologyCleanerNonConsecutiveBoundaryVertices.C
|
||||||
|
$(topologicalCleaner)/topologicalCleanerInvalidVertices.C
|
||||||
|
$(topologicalCleaner)/topologyCleanerNonMappableCells.C
|
||||||
|
$(checkCellConnectionsOverFaces)/checkCellConnectionsOverFaces.C
|
||||||
|
$(checkIrregularSurfaceConnections)/checkIrregularSurfaceConnections.C
|
||||||
|
$(checkIrregularSurfaceConnections)/checkIrregularSurfaceConnectionsFunctions.C
|
||||||
|
$(checkNonMappableCellConnections)/checkNonMappableCellConnections.C
|
||||||
|
$(checkBoundaryFacesSharingTwoEdges)/checkBoundaryFacesSharingTwoEdges.C
|
||||||
|
|
||||||
|
$(boundaryLayers)/boundaryLayers.C
|
||||||
|
$(boundaryLayers)/boundaryLayersCreateVertices.C
|
||||||
|
$(boundaryLayers)/boundaryLayersFacesAndCells.C
|
||||||
|
$(boundaryLayers)/boundaryLayerCells.C
|
||||||
|
$(boundaryLayers)/boundaryLayersCheckTopologyOfBndFaces.C
|
||||||
|
$(boundaryLayers)/boundaryLayersWrapperLayer.C
|
||||||
|
$(boundaryLayers)/extrudeLayer.C
|
||||||
|
$(boundaryLayers)/refineBoundaryLayers.C
|
||||||
|
$(boundaryLayers)/refineBoundaryLayersFunctions.C
|
||||||
|
$(boundaryLayers)/refineBoundaryLayersFaces.C
|
||||||
|
$(boundaryLayers)/refineBoundaryLayersCells.C
|
||||||
|
|
||||||
|
$(meshSurfaceEngine)/meshSurfaceEngine.C
|
||||||
|
$(meshSurfaceEngine)/meshSurfaceEngineCalculateBoundaryNodesAndFaces.C
|
||||||
|
$(meshSurfaceEngine)/meshSurfaceEngineParallelAddressing.C
|
||||||
|
$(meshSurfaceEngine)/meshSurfaceEngineModifier.C
|
||||||
|
|
||||||
|
$(meshSurfacePartitioner)/meshSurfacePartitioner.C
|
||||||
|
$(meshSurfacePartitioner)/meshSurfacePartitionerFunctions.C
|
||||||
|
|
||||||
|
$(meshSurfaceCheckInvertedVertices)/meshSurfaceCheckInvertedVertices.C
|
||||||
|
|
||||||
|
$(meshSurfaceCheckEdgeTypes)/meshSurfaceCheckEdgeTypes.C
|
||||||
|
|
||||||
|
$(meshSurfaceMapper)/meshSurfaceMapper.C
|
||||||
|
$(meshSurfaceMapper)/meshSurfaceMapperMapVertices.C
|
||||||
|
$(meshSurfaceMapper)/meshSurfaceMapperCornersAndEdges.C
|
||||||
|
$(meshSurfaceMapper)/meshSurfaceMapperPremapVertices.C
|
||||||
|
|
||||||
|
$(meshSurfaceMapper2D)/meshSurfaceMapper2D.C
|
||||||
|
$(meshSurfaceMapper2D)/meshSurfaceMapper2DMapVertices.C
|
||||||
|
$(meshSurfaceMapper2D)/meshSurfaceMapper2DPremapVertices.C
|
||||||
|
|
||||||
|
$(edgeExtractor)/edgeExtractor.C
|
||||||
|
$(edgeExtractor)/edgeExtractorCorners.C
|
||||||
|
|
||||||
|
$(meshSurfaceEdgeExtractorNonTopo)/meshSurfaceEdgeExtractorNonTopo.C
|
||||||
|
$(meshSurfaceEdgeExtractorNonTopo)/meshSurfaceEdgeExtractorNonTopoDistributeFaces.C
|
||||||
|
|
||||||
|
$(meshSurfaceEdgeExtractor2D)/meshSurfaceEdgeExtractor2D.C
|
||||||
|
$(meshSurfaceEdgeExtractor2D)/meshSurfaceEdgeExtractor2DDistributeFaces.C
|
||||||
|
|
||||||
|
$(correctEdgesBetweenPatches)/correctEdgesBetweenPatches.C
|
||||||
|
$(correctEdgesBetweenPatches)/correctEdgesBetweenPatchesDistributeFaces.C
|
||||||
|
|
||||||
|
$(renameBoundaryPatches)/renameBoundaryPatches.C
|
||||||
|
|
||||||
|
$(meshOptimizer)/meshOptimizer.C
|
||||||
|
$(meshOptimizer)/meshOptimizerOptimizePoint.C
|
||||||
|
$(meshOptimizer)/meshOptimizerOptimizePointParallel.C
|
||||||
|
$(meshOptimizer)/meshOptimizerOptimizeSurface.C
|
||||||
|
$(meshOptimizer)/optimizeMeshFV.C
|
||||||
|
|
||||||
|
$(tetMeshOptimisation)/tetMeshOptimisation.C
|
||||||
|
$(tetMeshOptimisation)/tetMeshOptimisationParallel.C
|
||||||
|
|
||||||
|
$(simplexSmoother)/simplexSmoother.C
|
||||||
|
|
||||||
|
$(knuppMetric)/knuppMetric.C
|
||||||
|
|
||||||
|
$(meshUntangler)/meshUntangler.C
|
||||||
|
$(meshUntangler)/meshUntanglerCutRegion.C
|
||||||
|
$(meshUntangler)/meshUntanglerCutRegionPoints.C
|
||||||
|
$(meshUntangler)/meshUntanglerCutRegionEdges.C
|
||||||
|
$(meshUntangler)/meshUntanglerCutRegionFaces.C
|
||||||
|
$(meshUntangler)/meshUntanglerCutRegionTieBreak.C
|
||||||
|
|
||||||
|
$(quadricMetric)/quadricMetric.C
|
||||||
|
|
||||||
|
$(volumeOptimizer)/volumeOptimizer.C
|
||||||
|
$(volumeOptimizer)/volumeOptimizerEvaluateGradients.C
|
||||||
|
|
||||||
|
$(meshSurfaceOptimizer)/meshSurfaceOptimizer.C
|
||||||
|
$(meshSurfaceOptimizer)/meshSurfaceOptimizerCalculateTrianglesAndAddressing.C
|
||||||
|
$(meshSurfaceOptimizer)/meshSurfaceOptimizerOptimizePoint.C
|
||||||
|
$(meshSurfaceOptimizer)/meshSurfaceOptimizerOptimizeSurface.C
|
||||||
|
$(meshSurfaceOptimizer)/meshSurfaceOptimizerOptimizePointParallel.C
|
||||||
|
|
||||||
|
$(surfaceOptimizer)/surfaceOptimizer.C
|
||||||
|
|
||||||
|
$(meshOctreeCube)/meshOctreeCube.C
|
||||||
|
$(meshOctreeCube)/meshOctreeCubeIntersections.C
|
||||||
|
$(meshOctreeCube)/meshOctreeCubeRecursiveFunctions.C
|
||||||
|
$(meshOctreeCube)/meshOctreeCubeRefine.C
|
||||||
|
$(meshOctreeCube)/meshOctreeCubeCoordinatesIntersections.C
|
||||||
|
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifier.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierRefineSelectedBoxes.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierEnsureCorrectRegularity.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierParallelRefinement.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierDistributeLeavesToProcessors.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierLoadDistribution.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierReduceMemoryConsumption.C
|
||||||
|
$(meshOctreeModifier)/meshOctreeModifierUpdateCommunicationPattern.C
|
||||||
|
|
||||||
|
$(meshOctreeInsideOutside)/meshOctreeInsideOutside.C
|
||||||
|
|
||||||
|
$(meshOctreeCreator)/meshOctreeCreator.C
|
||||||
|
$(meshOctreeCreator)/meshOctreeCreatorAdjustOctreeToSurface.C
|
||||||
|
$(meshOctreeCreator)/meshOctreeCreatorCreateOctreeBoxes.C
|
||||||
|
$(meshOctreeCreator)/meshOctreeCreatorFrontalMarking.C
|
||||||
|
$(meshOctreeCreator)/meshOctreeCreatorLoadDistribution.C
|
||||||
|
|
||||||
|
$(meshOctreeAddressing)/meshOctreeAddressing.C
|
||||||
|
$(meshOctreeAddressing)/meshOctreeAddressingCreation.C
|
||||||
|
$(meshOctreeAddressing)/meshOctreeAddressingGluedMesh.C
|
||||||
|
$(meshOctreeAddressing)/meshOctreeAddressingIrregularConnections.C
|
||||||
|
$(meshOctreeAddressing)/meshOctreeAddressingParallelAddressing.C
|
||||||
|
|
||||||
|
$(meshOctreeAutoRef)/meshOctreeAutomaticRefinement.C
|
||||||
|
$(meshOctreeAutoRef)/meshOctreeAutomaticRefinementRef.C
|
||||||
|
|
||||||
|
$(meshOctree)/meshOctree.C
|
||||||
|
$(meshOctree)/meshOctreeCubePatches.C
|
||||||
|
$(meshOctree)/meshOctreeNeighbourSearches.C
|
||||||
|
$(meshOctree)/meshOctreeFindNearestSurfacePoint.C
|
||||||
|
$(meshOctree)/meshOctreeInsideCalculations.C
|
||||||
|
$(meshOctree)/meshOctreeParallelCommunication.C
|
||||||
|
|
||||||
|
$(patchRefinement)/patchRefinement.C
|
||||||
|
$(objectRefinement)/objectRefinement.C
|
||||||
|
$(objectRefinement)/newObjectRefinement.C
|
||||||
|
$(objectRefinement)/sphereRefinement.C
|
||||||
|
$(objectRefinement)/lineRefinement.C
|
||||||
|
$(objectRefinement)/coneRefinement.C
|
||||||
|
$(objectRefinement)/boxRefinement.C
|
||||||
|
|
||||||
|
$(triSurfaceCleanupDuplicates)/triSurfaceCleanupDuplicates.C
|
||||||
|
$(triSurfaceCleanupDuplicates)/triSurfaceCleanupDuplicatesFunctions.C
|
||||||
|
|
||||||
|
$(triSurfaceCopyParts)/triSurfaceCopyParts.C
|
||||||
|
|
||||||
|
$(triSurfacePartitioner)/triSurfacePartitioner.C
|
||||||
|
$(triSurfacePartitioner)/triSurfacePartitionerCreateAddressing.C
|
||||||
|
|
||||||
|
$(triSurfaceCurvatureEstimator)/triSurfaceCurvatureEstimator.C
|
||||||
|
$(triSurfaceCurvatureEstimator)/triSurfaceCurvatureEstimatorCalculate.C
|
||||||
|
|
||||||
|
$(triSurfaceDetectFeatureEdges)/triSurfaceDetectFeatureEdges.C
|
||||||
|
$(triSurfaceDetectFeatureEdges)/triSurfaceDetectFeatureEdgesFunctions.C
|
||||||
|
|
||||||
|
$(triSurfaceClassifyEdges)/triSurfaceClassifyEdges.C
|
||||||
|
$(triSurfaceClassifyEdges)/triSurfaceClassifyEdgesFunctions.C
|
||||||
|
|
||||||
|
$(triSurfacePatchManipulator)/triSurfacePatchManipulator.C
|
||||||
|
$(triSurfacePatchManipulator)/triSurfacePatchManipulatorFunctions.C
|
||||||
|
|
||||||
|
$(triSurfaceRemoveFacets)/triSurfaceRemoveFacets.C
|
||||||
|
$(triSurfaceRemoveFacets)/triSurfaceRemoveFacetsFunctions.C
|
||||||
|
|
||||||
|
$(triSurfaceExtrude2DEdges)/triSurfaceExtrude2DEdges.C
|
||||||
|
|
||||||
|
$(triSurfaceMetaData)/triSurfaceMetaData.C
|
||||||
|
|
||||||
|
$(cartesianMeshExtractor)/cartesianMeshExtractor.C
|
||||||
|
$(cartesianMeshExtractor)/cartesianMeshExtractorPointsAndAddressing.C
|
||||||
|
$(cartesianMeshExtractor)/cartesianMeshExtractorPolyMesh.C
|
||||||
|
$(cartesianMeshExtractor)/cartesianMeshExtractorDecomposeSplitHexes.C
|
||||||
|
|
||||||
|
$(cartesianMeshGenerator)/cartesianMeshGenerator.C
|
||||||
|
|
||||||
|
$(cartesian2DMeshGenerator)/cartesian2DMeshGenerator.C
|
||||||
|
|
||||||
|
$(tetMeshExtractorOctree)/tetMeshExtractorOctree.C
|
||||||
|
|
||||||
|
$(tetMeshGenerator)/tetMeshGenerator.C
|
||||||
|
|
||||||
|
$(writeAsFPMA)/writeMeshFPMA.C
|
||||||
|
$(writeAsFPMA)/fpmaMesh.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libmeshLibrary
|
10
src/mesh/cfMesh/meshLibrary/Make/options
Normal file
10
src/mesh/cfMesh/meshLibrary/Make/options
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
OMP_FLAGS = -DUSE_OMP -fopenmp
|
||||||
|
#else
|
||||||
|
OMP_FLAGS =
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
$(OMP_FLAGS) \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
|
@ -0,0 +1,318 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cartesian2DMeshGenerator.H"
|
||||||
|
#include "polyMeshGen2DEngine.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "triSurfacePatchManipulator.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "meshOctreeCreator.H"
|
||||||
|
#include "cartesianMeshExtractor.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "meshSurfaceMapper2D.H"
|
||||||
|
#include "meshSurfaceEdgeExtractor2D.H"
|
||||||
|
#include "meshSurfaceOptimizer.H"
|
||||||
|
#include "topologicalCleaner.H"
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "refineBoundaryLayers.H"
|
||||||
|
#include "renameBoundaryPatches.H"
|
||||||
|
#include "checkMeshDict.H"
|
||||||
|
#include "checkCellConnectionsOverFaces.H"
|
||||||
|
#include "checkIrregularSurfaceConnections.H"
|
||||||
|
#include "checkNonMappableCellConnections.H"
|
||||||
|
#include "checkBoundaryFacesSharingTwoEdges.H"
|
||||||
|
#include "triSurfaceMetaData.H"
|
||||||
|
|
||||||
|
//#define DEBUG
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::createCartesianMesh()
|
||||||
|
{
|
||||||
|
//- create polyMesh from octree boxes
|
||||||
|
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
|
||||||
|
|
||||||
|
if( meshDict_.found("decomposePolyhedraIntoTetsAndPyrs") )
|
||||||
|
{
|
||||||
|
if( readBool(meshDict_.lookup("decomposePolyhedraIntoTetsAndPyrs")) )
|
||||||
|
cme.decomposeSplitHexes();
|
||||||
|
}
|
||||||
|
|
||||||
|
cme.createMesh();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_FAILURE);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::surfacePreparation()
|
||||||
|
{
|
||||||
|
//- removes unnecessary cells and morph the boundary
|
||||||
|
//- such that there is only one boundary face per cell
|
||||||
|
//- It also checks topology of cells after morphing is performed
|
||||||
|
bool changed;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
changed = false;
|
||||||
|
|
||||||
|
checkIrregularSurfaceConnections checkConnections(mesh_);
|
||||||
|
if( checkConnections.checkAndFixIrregularConnections() )
|
||||||
|
changed = true;
|
||||||
|
|
||||||
|
if( checkNonMappableCellConnections(mesh_).removeCells() )
|
||||||
|
changed = true;
|
||||||
|
|
||||||
|
if( checkCellConnectionsOverFaces(mesh_).checkCellGroups() )
|
||||||
|
changed = true;
|
||||||
|
} while( changed );
|
||||||
|
|
||||||
|
checkBoundaryFacesSharingTwoEdges(mesh_).improveTopology();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_FAILURE);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::mapMeshToSurface()
|
||||||
|
{
|
||||||
|
//- calculate mesh surface
|
||||||
|
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
|
||||||
|
|
||||||
|
//- pre-map mesh surface
|
||||||
|
meshSurfaceMapper2D mapper(*msePtr, *octreePtr_);
|
||||||
|
|
||||||
|
mapper.adjustZCoordinates();
|
||||||
|
|
||||||
|
mapper.preMapVertices();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_FAILURE);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//- map mesh surface on the geometry surface
|
||||||
|
mapper.mapVerticesOntoSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
deleteDemandDrivenData(msePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::mapEdgesAndCorners()
|
||||||
|
{
|
||||||
|
meshSurfaceEdgeExtractor2D(mesh_, *octreePtr_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::optimiseMeshSurface()
|
||||||
|
{
|
||||||
|
meshSurfaceEngine mse(mesh_);
|
||||||
|
meshSurfaceOptimizer optimizer(mse, *octreePtr_);
|
||||||
|
optimizer.optimizeSurface2D();
|
||||||
|
optimizer.untangleSurface2D();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::generateBoundaryLayers()
|
||||||
|
{
|
||||||
|
boundaryLayers bl(mesh_);
|
||||||
|
|
||||||
|
bl.activate2DMode();
|
||||||
|
|
||||||
|
bl.addLayerForAllPatches();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::refBoundaryLayers()
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("boundaryLayers") )
|
||||||
|
{
|
||||||
|
refineBoundaryLayers refLayers(mesh_);
|
||||||
|
|
||||||
|
refineBoundaryLayers::readSettings(meshDict_, refLayers);
|
||||||
|
|
||||||
|
refLayers.activate2DMode();
|
||||||
|
|
||||||
|
refLayers.refineLayers();
|
||||||
|
|
||||||
|
meshSurfaceEngine mse(mesh_);
|
||||||
|
meshSurfaceOptimizer optimizer(mse, *octreePtr_);
|
||||||
|
|
||||||
|
optimizer.untangleSurface2D();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::replaceBoundaries()
|
||||||
|
{
|
||||||
|
renameBoundaryPatches rbp(mesh_, meshDict_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::renumberMesh()
|
||||||
|
{
|
||||||
|
polyMeshGenModifier(mesh_).renumberMesh();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::generateMesh()
|
||||||
|
{
|
||||||
|
createCartesianMesh();
|
||||||
|
|
||||||
|
surfacePreparation();
|
||||||
|
|
||||||
|
mapMeshToSurface();
|
||||||
|
|
||||||
|
mapEdgesAndCorners();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
|
||||||
|
generateBoundaryLayers();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
|
||||||
|
refBoundaryLayers();
|
||||||
|
|
||||||
|
renumberMesh();
|
||||||
|
|
||||||
|
replaceBoundaries();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from objectRegistry
|
||||||
|
cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
|
||||||
|
:
|
||||||
|
db_(time),
|
||||||
|
surfacePtr_(NULL),
|
||||||
|
meshDict_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"meshDict",
|
||||||
|
db_.system(),
|
||||||
|
db_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
),
|
||||||
|
octreePtr_(NULL),
|
||||||
|
mesh_(time)
|
||||||
|
{
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
checkMeshDict cmd(meshDict_);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
surfaceFile = ".."/surfaceFile;
|
||||||
|
|
||||||
|
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
|
||||||
|
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
//- save meta data with the mesh (surface mesh + its topology info)
|
||||||
|
triSurfaceMetaData sMetaData(*surfacePtr_);
|
||||||
|
const dictionary& surfMetaDict = sMetaData.metaData();
|
||||||
|
|
||||||
|
mesh_.metaData().add("surfaceFile", surfaceFile);
|
||||||
|
mesh_.metaData().add("surfaceMeta", surfMetaDict);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( surfacePtr_->featureEdges().size() != 0 )
|
||||||
|
{
|
||||||
|
//- create surface patches based on the feature edges
|
||||||
|
//- and update the meshDict based on the given data
|
||||||
|
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
||||||
|
|
||||||
|
const triSurf* surfaceWithPatches =
|
||||||
|
manipulator.surfaceWithPatches(&meshDict_);
|
||||||
|
|
||||||
|
//- delete the old surface and assign the new one
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
surfacePtr_ = surfaceWithPatches;
|
||||||
|
}
|
||||||
|
|
||||||
|
octreePtr_ = new meshOctree(*surfacePtr_, true);
|
||||||
|
|
||||||
|
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
||||||
|
|
||||||
|
generateMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
cartesian2DMeshGenerator::~cartesian2DMeshGenerator()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
deleteDemandDrivenData(octreePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesian2DMeshGenerator::writeMesh() const
|
||||||
|
{
|
||||||
|
mesh_.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
cartesian2DMeshGenerator
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates a 2D cartesian mesh from the quadtree
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cartesian2DMeshGenerator.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cartesian2DMeshGenerator_H
|
||||||
|
#define cartesian2DMeshGenerator_H
|
||||||
|
|
||||||
|
#include "polyMeshGen.H"
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class triSurf;
|
||||||
|
class meshOctree;
|
||||||
|
class Time;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cartesian2DMeshGenerator Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cartesian2DMeshGenerator
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- reference to Time
|
||||||
|
const Time& db_;
|
||||||
|
|
||||||
|
//- pointer to the surface
|
||||||
|
const triSurf* surfacePtr_;
|
||||||
|
|
||||||
|
//- IOdictionary containing information about cell sizes, etc..
|
||||||
|
IOdictionary meshDict_;
|
||||||
|
|
||||||
|
//- pointer to the octree
|
||||||
|
meshOctree* octreePtr_;
|
||||||
|
|
||||||
|
//- mesh
|
||||||
|
polyMeshGen mesh_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- create cartesian mesh
|
||||||
|
void createCartesianMesh();
|
||||||
|
|
||||||
|
//- prepare mesh surface
|
||||||
|
void surfacePreparation();
|
||||||
|
|
||||||
|
//- map mesh to the surface and untangle surface
|
||||||
|
void mapMeshToSurface();
|
||||||
|
|
||||||
|
//- capture edges and corners
|
||||||
|
void mapEdgesAndCorners();
|
||||||
|
|
||||||
|
//- optimise surface mesh
|
||||||
|
void optimiseMeshSurface();
|
||||||
|
|
||||||
|
//- add boundary layers
|
||||||
|
void generateBoundaryLayers();
|
||||||
|
|
||||||
|
//- refine boundary layers
|
||||||
|
void refBoundaryLayers();
|
||||||
|
|
||||||
|
//- replace boundaries
|
||||||
|
void replaceBoundaries();
|
||||||
|
|
||||||
|
//- renumber the mesh
|
||||||
|
void renumberMesh();
|
||||||
|
|
||||||
|
//- generate mesh
|
||||||
|
void generateMesh();
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
cartesian2DMeshGenerator(const cartesian2DMeshGenerator&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const cartesian2DMeshGenerator&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from time
|
||||||
|
cartesian2DMeshGenerator(const Time&);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~cartesian2DMeshGenerator();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- write the mesh
|
||||||
|
void writeMesh() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cartesianMeshExtractor.H"
|
||||||
|
#include "meshOctree.H"
|
||||||
|
|
||||||
|
// #define DEBUGSearch
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesianMeshExtractor::clearOut()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(leafCellLabelPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from octree and mesh data
|
||||||
|
cartesianMeshExtractor::cartesianMeshExtractor
|
||||||
|
(
|
||||||
|
meshOctree& octree,
|
||||||
|
const IOdictionary& meshDict,
|
||||||
|
polyMeshGen& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
octreeCheck_(octree, meshDict, false),
|
||||||
|
mesh_(mesh),
|
||||||
|
decomposeSplitHexes_(false),
|
||||||
|
leafCellLabelPtr_(new labelList(octree.numberOfLeaves(), -1))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
cartesianMeshExtractor::~cartesianMeshExtractor()
|
||||||
|
{
|
||||||
|
clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesianMeshExtractor::decomposeSplitHexes()
|
||||||
|
{
|
||||||
|
decomposeSplitHexes_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshExtractor::createMesh()
|
||||||
|
{
|
||||||
|
Info << "Extracting polyMesh" << endl;
|
||||||
|
|
||||||
|
//- create points and pointLeaves addressing
|
||||||
|
createPointsAndAddressing();
|
||||||
|
|
||||||
|
//- create the mesh
|
||||||
|
createPolyMesh();
|
||||||
|
|
||||||
|
//- decompose split-hex cells into tetrahedra and pyramids
|
||||||
|
decomposeSplitHexesIntoTetsAndPyramids();
|
||||||
|
|
||||||
|
//- remove unused vertices
|
||||||
|
polyMeshGenModifier(mesh_).removeUnusedVertices();
|
||||||
|
|
||||||
|
Info << "Mesh has :" << nl
|
||||||
|
<< mesh_.points().size() << " vertices " << nl
|
||||||
|
<< mesh_.faces().size() << " faces" << nl
|
||||||
|
<< mesh_.cells().size() << " cells" << endl;
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
label nCells = mesh_.cells().size();
|
||||||
|
reduce(nCells, sumOp<label>());
|
||||||
|
Info << "Total number of cells " << nCells << endl;
|
||||||
|
}
|
||||||
|
if( mesh_.cells().size() == 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void cartesianMeshExtractor::createMesh()"
|
||||||
|
) << "There are no cells in the mesh!"
|
||||||
|
<< nl << "The reasons for this can be fwofold:"
|
||||||
|
<< nl << "1. Inadequate mesh resolution."
|
||||||
|
<< nl << "2. You maxCellSize is a multiplier of the domain length."
|
||||||
|
<< " This can be reolved by reducing the maxCellSize by a fraction."
|
||||||
|
<< "i.e. 2.49999 instead of 2.5." << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Finished extracting polyMesh" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
cartesianMeshExtractor
|
||||||
|
|
||||||
|
Description
|
||||||
|
Generates the cartesian mesh template from the octree
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cartesianMeshExtractor.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cartesianMeshExtractor_H
|
||||||
|
#define cartesianMeshExtractor_H
|
||||||
|
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "meshOctreeAddressing.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class IOdictionary;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cartesianMeshExtractor Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cartesianMeshExtractor
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- reference to the octree addressing
|
||||||
|
meshOctreeAddressing octreeCheck_;
|
||||||
|
|
||||||
|
//- reference to the mesh
|
||||||
|
polyMeshGen& mesh_;
|
||||||
|
|
||||||
|
//- decompose split hex cells
|
||||||
|
bool decomposeSplitHexes_;
|
||||||
|
|
||||||
|
//- cell label for a given leaf
|
||||||
|
labelList* leafCellLabelPtr_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- delete all freestore data
|
||||||
|
void clearOut();
|
||||||
|
|
||||||
|
//- create vertices and pointLeaves addressing
|
||||||
|
void createPointsAndAddressing();
|
||||||
|
|
||||||
|
//- create mesh data
|
||||||
|
void createPolyMesh();
|
||||||
|
|
||||||
|
//- decompose split hexes into pyramids and tets
|
||||||
|
void decomposeSplitHexesIntoTetsAndPyramids();
|
||||||
|
|
||||||
|
// Private copy constructor
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
cartesianMeshExtractor(const cartesianMeshExtractor&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const cartesianMeshExtractor&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from octree and mesh data
|
||||||
|
cartesianMeshExtractor
|
||||||
|
(
|
||||||
|
meshOctree& octree,
|
||||||
|
const IOdictionary& meshDict,
|
||||||
|
polyMeshGen& mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~cartesianMeshExtractor();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- decompose split hexes into standard cells
|
||||||
|
void decomposeSplitHexes();
|
||||||
|
|
||||||
|
//- create the mesh with the above options
|
||||||
|
void createMesh();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cartesianMeshExtractor.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "decomposeFaces.H"
|
||||||
|
#include "decomposeCells.H"
|
||||||
|
#include "hexMatcher.H"
|
||||||
|
|
||||||
|
//#define DEBUGMesh
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
|
||||||
|
{
|
||||||
|
if( !decomposeSplitHexes_ ) return;
|
||||||
|
|
||||||
|
Info << "Decomposing split-hex cells" << endl;
|
||||||
|
|
||||||
|
const faceListPMG& faces = mesh_.faces();
|
||||||
|
|
||||||
|
//- decompose faces which have more than 4 vertices
|
||||||
|
boolList decompose(faces.size(), false);
|
||||||
|
|
||||||
|
label nDecomposed(0);
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
if( faces[faceI].size() > 4 )
|
||||||
|
{
|
||||||
|
++nDecomposed;
|
||||||
|
|
||||||
|
decompose[faceI] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reduce(nDecomposed, sumOp<label>());
|
||||||
|
|
||||||
|
Info << "Decomposing " << nDecomposed
|
||||||
|
<< " faces with more than 4 vertices" << endl;
|
||||||
|
|
||||||
|
if( nDecomposed != 0 )
|
||||||
|
{
|
||||||
|
//- decompose marked faces into triangles
|
||||||
|
decomposeFaces(mesh_).decomposeMeshFaces(decompose);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- decompose cells with 24 faces
|
||||||
|
const cellListPMG& cells = mesh_.cells();
|
||||||
|
decompose.setSize(cells.size());
|
||||||
|
decompose = false;
|
||||||
|
|
||||||
|
hexMatcher hex;
|
||||||
|
forAll(cells, cellI)
|
||||||
|
{
|
||||||
|
if( !hex.matchShape(true, faces, mesh_.owner(), cellI, cells[cellI]) )
|
||||||
|
{
|
||||||
|
++nDecomposed;
|
||||||
|
decompose[cellI] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reduce(nDecomposed, sumOp<label>());
|
||||||
|
|
||||||
|
Info << "Decomposing " << nDecomposed
|
||||||
|
<< " cells into tetrahedra and pyramids" << endl;
|
||||||
|
|
||||||
|
if( nDecomposed )
|
||||||
|
{
|
||||||
|
//- decompose marked cells into tets and pyramids
|
||||||
|
decomposeCells dc(mesh_);
|
||||||
|
dc.decomposeMesh(decompose);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Finished decomposing split-hex cells" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cartesianMeshExtractor.H"
|
||||||
|
#include "meshOctree.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
void cartesianMeshExtractor::createPointsAndAddressing()
|
||||||
|
{
|
||||||
|
Info << "Creating octree vertices" << endl;
|
||||||
|
|
||||||
|
Info << "Octree nodes " << octreeCheck_.numberOfNodes() << endl;
|
||||||
|
|
||||||
|
//- set the size of the point field
|
||||||
|
pointFieldPMG& points = mesh_.points();
|
||||||
|
points.setSize(octreeCheck_.numberOfNodes());
|
||||||
|
|
||||||
|
//- store vertices into the pointField
|
||||||
|
const pointField& octreePoints = octreeCheck_.octreePoints();
|
||||||
|
|
||||||
|
forAll(points, pointI)
|
||||||
|
points[pointI] = octreePoints[pointI];
|
||||||
|
|
||||||
|
Info << "Finished creating octree vertices" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,432 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cartesianMeshExtractor.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "meshOctree.H"
|
||||||
|
#include "labelledPair.H"
|
||||||
|
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "helperFunctions.H"
|
||||||
|
#include "helperFunctionsPar.H"
|
||||||
|
#include "decomposeFaces.H"
|
||||||
|
#include "decomposeCells.H"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
//#define DEBUGMesh
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesianMeshExtractor::createPolyMesh()
|
||||||
|
{
|
||||||
|
Info << "Creating polyMesh from octree" << endl;
|
||||||
|
|
||||||
|
const meshOctree& octree = octreeCheck_.octree();
|
||||||
|
|
||||||
|
//- give labels to cubes which will be used as mesh cells
|
||||||
|
const List<direction>& cType = octreeCheck_.boxType();
|
||||||
|
|
||||||
|
labelList& leafCellLabel = *leafCellLabelPtr_;
|
||||||
|
label nCells(0);
|
||||||
|
forAll(cType, leafI)
|
||||||
|
{
|
||||||
|
if(
|
||||||
|
Pstream::parRun() &&
|
||||||
|
(octree.returnLeaf(leafI).procNo() != Pstream::myProcNo())
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( cType[leafI] & meshOctreeAddressing::MESHCELL )
|
||||||
|
{
|
||||||
|
leafCellLabel[leafI] = nCells++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- access to mesh data
|
||||||
|
polyMeshGenModifier meshModifier(mesh_);
|
||||||
|
faceListPMG& faces = meshModifier.facesAccess();
|
||||||
|
cellListPMG& cells = meshModifier.cellsAccess();
|
||||||
|
|
||||||
|
//- start creating octree mesh
|
||||||
|
cells.setSize(nCells);
|
||||||
|
List<direction> nFacesInCell(nCells, direction(0));
|
||||||
|
label nFaces(0);
|
||||||
|
|
||||||
|
const VRWGraph& octreeFaces = octreeCheck_.octreeFaces();
|
||||||
|
const labelLongList& owner = octreeCheck_.octreeFaceOwner();
|
||||||
|
const labelLongList& neighbour = octreeCheck_.octreeFaceNeighbour();
|
||||||
|
|
||||||
|
//- map storing box label and a direction for each processor face
|
||||||
|
//- The map stores data in the same order on both sides of processor
|
||||||
|
//- boundaries. This is a consequence of Morton ordering of
|
||||||
|
//- leaf boxes in the octree.
|
||||||
|
std::map<label, labelLongList> procFaces;
|
||||||
|
|
||||||
|
forAll(octreeFaces, faceI)
|
||||||
|
{
|
||||||
|
const label own = owner[faceI];
|
||||||
|
const label nei = neighbour[faceI];
|
||||||
|
|
||||||
|
const label ownLabel = leafCellLabel[own];
|
||||||
|
label neiLabel(-1);
|
||||||
|
if( nei != -1 )
|
||||||
|
neiLabel = leafCellLabel[nei];
|
||||||
|
|
||||||
|
if( (ownLabel != -1) && (neiLabel != -1) )
|
||||||
|
{
|
||||||
|
++nFaces;
|
||||||
|
++nFacesInCell[ownLabel];
|
||||||
|
++nFacesInCell[neiLabel];
|
||||||
|
}
|
||||||
|
else if( ownLabel != -1 )
|
||||||
|
{
|
||||||
|
++nFaces;
|
||||||
|
++nFacesInCell[ownLabel];
|
||||||
|
|
||||||
|
if( (nei != -1) && (cType[nei] & meshOctreeAddressing::MESHCELL) )
|
||||||
|
{
|
||||||
|
const label procNo = octree.returnLeaf(nei).procNo();
|
||||||
|
|
||||||
|
procFaces[procNo].append(faceI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( neiLabel != -1 )
|
||||||
|
{
|
||||||
|
++nFaces;
|
||||||
|
++nFacesInCell[neiLabel];
|
||||||
|
|
||||||
|
if( (own != -1) && (cType[own] & meshOctreeAddressing::MESHCELL) )
|
||||||
|
{
|
||||||
|
const label procNo = octree.returnLeaf(own).procNo();
|
||||||
|
|
||||||
|
procFaces[procNo].append(faceI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- case is a serial run
|
||||||
|
faces.setSize(nFaces);
|
||||||
|
forAll(cells, cI)
|
||||||
|
cells[cI].setSize(nFacesInCell[cI]);
|
||||||
|
nFacesInCell = 0;
|
||||||
|
|
||||||
|
//- calculate faces in processor patches
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
PtrList<processorBoundaryPatch>& procBoundaries =
|
||||||
|
meshModifier.procBoundariesAccess();
|
||||||
|
|
||||||
|
//- set the number of procBoundaries
|
||||||
|
procBoundaries.setSize(procFaces.size());
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << Pstream::myProcNo();
|
||||||
|
const word name("processor"+ss.str()+"to");
|
||||||
|
label nProcBoundaries(nFaces), patchI(0);
|
||||||
|
|
||||||
|
//- allocate memory for processor patches
|
||||||
|
std::map<label, labelLongList>::const_iterator iter;
|
||||||
|
for(iter=procFaces.begin();iter!=procFaces.end();++iter)
|
||||||
|
{
|
||||||
|
const label procI = iter->first;
|
||||||
|
|
||||||
|
std::ostringstream ssNei;
|
||||||
|
ssNei << procI;
|
||||||
|
procBoundaries.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
|
new processorBoundaryPatch
|
||||||
|
(
|
||||||
|
name+ssNei.str(),
|
||||||
|
"processor",
|
||||||
|
iter->second.size(),
|
||||||
|
0,
|
||||||
|
Pstream::myProcNo(),
|
||||||
|
procI
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
nProcBoundaries -= iter->second.size();
|
||||||
|
++patchI;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create processor faces
|
||||||
|
//- they need to be created here because of the correct ordering
|
||||||
|
patchI = 0;
|
||||||
|
for(iter=procFaces.begin();iter!=procFaces.end();++iter)
|
||||||
|
{
|
||||||
|
procBoundaries[patchI].patchStart() = nProcBoundaries;
|
||||||
|
|
||||||
|
const labelLongList& patchFaces = iter->second;
|
||||||
|
|
||||||
|
forAll(patchFaces, pfI)
|
||||||
|
{
|
||||||
|
const label fLabel = patchFaces[pfI];
|
||||||
|
const label own = owner[fLabel];
|
||||||
|
const label nei = neighbour[fLabel];
|
||||||
|
|
||||||
|
const label curCell = leafCellLabel[own];
|
||||||
|
label neiCell(-1);
|
||||||
|
if( nei != -1 )
|
||||||
|
neiCell = leafCellLabel[nei];
|
||||||
|
|
||||||
|
//- create a processor face
|
||||||
|
if( neiCell == -1 )
|
||||||
|
{
|
||||||
|
//- add a face
|
||||||
|
faces[nProcBoundaries].setSize(octreeFaces[fLabel].size());
|
||||||
|
forAllRow(octreeFaces, fLabel, pI)
|
||||||
|
faces[nProcBoundaries][pI] = octreeFaces(fLabel, pI);
|
||||||
|
cells[curCell][nFacesInCell[curCell]++] = nProcBoundaries++;
|
||||||
|
}
|
||||||
|
else if( curCell == -1 )
|
||||||
|
{
|
||||||
|
//- add a reversed face
|
||||||
|
faces[nProcBoundaries].setSize(octreeFaces[fLabel].size());
|
||||||
|
label i(0);
|
||||||
|
faces[nProcBoundaries][i++] = octreeFaces(fLabel, 0);
|
||||||
|
for(label pI=octreeFaces.sizeOfRow(fLabel)-1;pI>0;--pI)
|
||||||
|
faces[nProcBoundaries][i++] = octreeFaces(fLabel, pI);
|
||||||
|
cells[neiCell][nFacesInCell[neiCell]++] = nProcBoundaries++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void cartesianMeshExtractor::createPolyMesh()"
|
||||||
|
) << "Face " << octreeFaces[fLabel] << " causes problems!"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( procBoundaries[patchI].patchSize() !=
|
||||||
|
(nProcBoundaries - procBoundaries[patchI].patchStart())
|
||||||
|
)
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"cartesianMeshExtractor::createPolyMesh()"
|
||||||
|
) << "Invalid patch size!" << Pstream::myProcNo()
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
++patchI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nFaces = 0;
|
||||||
|
|
||||||
|
forAll(octreeFaces, faceI)
|
||||||
|
{
|
||||||
|
const label own = owner[faceI];
|
||||||
|
const label nei = neighbour[faceI];
|
||||||
|
|
||||||
|
const label ownLabel = leafCellLabel[own];
|
||||||
|
label neiLabel(-1);
|
||||||
|
if( nei != -1 )
|
||||||
|
neiLabel = leafCellLabel[nei];
|
||||||
|
|
||||||
|
if( (ownLabel != -1) && (neiLabel != -1) )
|
||||||
|
{
|
||||||
|
//- internal face
|
||||||
|
faces[nFaces].setSize(octreeFaces.sizeOfRow(faceI));
|
||||||
|
forAllRow(octreeFaces, faceI, pI)
|
||||||
|
faces[nFaces][pI] = octreeFaces(faceI, pI);
|
||||||
|
|
||||||
|
cells[ownLabel][nFacesInCell[ownLabel]++] = nFaces;
|
||||||
|
cells[neiLabel][nFacesInCell[neiLabel]++] = nFaces;
|
||||||
|
++nFaces;
|
||||||
|
}
|
||||||
|
else if( ownLabel != -1 )
|
||||||
|
{
|
||||||
|
if( (nei != -1) && (cType[nei] & meshOctreeAddressing::MESHCELL) )
|
||||||
|
{
|
||||||
|
//- face at a parallel boundary
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- boundary face
|
||||||
|
faces[nFaces].setSize(octreeFaces.sizeOfRow(faceI));
|
||||||
|
forAllRow(octreeFaces, faceI, pI)
|
||||||
|
faces[nFaces][pI] = octreeFaces(faceI, pI);
|
||||||
|
|
||||||
|
cells[ownLabel][nFacesInCell[ownLabel]++] = nFaces;
|
||||||
|
++nFaces;
|
||||||
|
}
|
||||||
|
else if( neiLabel != -1 )
|
||||||
|
{
|
||||||
|
if( (own != -1) && (cType[own] & meshOctreeAddressing::MESHCELL) )
|
||||||
|
{
|
||||||
|
//- face at a parallel boundary
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- boundary face
|
||||||
|
faces[nFaces].setSize(octreeFaces.sizeOfRow(faceI));
|
||||||
|
faces[nFaces][0] = octreeFaces(faceI, 0);
|
||||||
|
for(label pI=octreeFaces.sizeOfRow(faceI)-1;pI>0;--pI)
|
||||||
|
faces[nFaces][octreeFaces.sizeOfRow(faceI)-pI] =
|
||||||
|
octreeFaces(faceI, pI);
|
||||||
|
|
||||||
|
cells[neiLabel][nFacesInCell[neiLabel]++] = nFaces;
|
||||||
|
++nFaces;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef DEBUGMesh
|
||||||
|
label nProcBoundaries(0);
|
||||||
|
forAll(procBoundaries, patchI)
|
||||||
|
nProcBoundaries += procBoundaries[patchI].patchSize();
|
||||||
|
|
||||||
|
if( faces.size() != (nProcBoundaries + nFaces) )
|
||||||
|
{
|
||||||
|
Serr << "Number of faces " << faces.size() << endl;
|
||||||
|
Serr << "Number of processor boundaries " << nProcBoundaries << endl;
|
||||||
|
Serr << "Number of domain faces " << nFaces << endl;
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void cartesianMeshExtractor::createPolyMesh()"
|
||||||
|
) << Pstream::myProcNo() << "This mesh is invalid!"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
vectorField closedness(cells.size(), vector::zero);
|
||||||
|
const labelList& owner = mesh_.owner();
|
||||||
|
const labelList& neighbour = mesh_.neighbour();
|
||||||
|
forAll(owner, faceI)
|
||||||
|
if( owner[faceI] == -1 )
|
||||||
|
{
|
||||||
|
Info << "faces " << faces << endl;
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void cartesianMeshExtractor::createPolyMesh"
|
||||||
|
"("
|
||||||
|
"pointFieldPMG& points,"
|
||||||
|
"faceListPMG& faces,"
|
||||||
|
"cellListPMG& cells"
|
||||||
|
")"
|
||||||
|
) << "Face " << faceI
|
||||||
|
<< " has no owner and neighbour!!" << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
const vector area = faces[faceI].normal(mesh_.points());
|
||||||
|
closedness[owner[faceI]] += area;
|
||||||
|
if( neighbour[faceI] != -1 )
|
||||||
|
closedness[neighbour[faceI]] -= area;
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(closedness, cellI)
|
||||||
|
if( mag(closedness[cellI]) > 1e-10 )
|
||||||
|
Info << "Cell " << cellI << " is not closed by "
|
||||||
|
<< closedness[cellI] << endl;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
meshModifier.reorderBoundaryFaces();
|
||||||
|
|
||||||
|
if( octree.isQuadtree() )
|
||||||
|
{
|
||||||
|
//- generate empty patches
|
||||||
|
//- search for faces with a dominant z coordinate and store them
|
||||||
|
//- into an empty patch
|
||||||
|
meshSurfaceEngine mse(mesh_);
|
||||||
|
const vectorField& fNormals = mse.faceNormals();
|
||||||
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
const labelList& fOwner = mse.faceOwners();
|
||||||
|
const vectorField& fCentres = mse.faceCentres();
|
||||||
|
|
||||||
|
const boundBox& bb = octree.rootBox();
|
||||||
|
const scalar tZ = 0.05 * (bb.max().z() - bb.min().z());
|
||||||
|
|
||||||
|
wordList patchNames(3);
|
||||||
|
patchNames[0] = "defaultFaces";
|
||||||
|
patchNames[1] = "unusedFacesBottom";
|
||||||
|
patchNames[2] = "unusedFacesTop";
|
||||||
|
|
||||||
|
VRWGraph boundaryFaces;
|
||||||
|
labelLongList newFaceOwner;
|
||||||
|
labelLongList newFacePatch;
|
||||||
|
|
||||||
|
forAll(fNormals, bfI)
|
||||||
|
{
|
||||||
|
//- store the face and its owner
|
||||||
|
boundaryFaces.appendList(bFaces[bfI]);
|
||||||
|
newFaceOwner.append(fOwner[bfI]);
|
||||||
|
|
||||||
|
const vector& fNormal = fNormals[bfI];
|
||||||
|
|
||||||
|
if( Foam::mag(fNormal.z()) > Foam::mag(fNormal.x() + fNormal.y()) )
|
||||||
|
{
|
||||||
|
if( Foam::mag(fCentres[bfI].z() - bb.min().z()) < tZ )
|
||||||
|
{
|
||||||
|
newFacePatch.append(1);
|
||||||
|
}
|
||||||
|
else if( Foam::mag(fCentres[bfI].z() - bb.max().z()) < tZ )
|
||||||
|
{
|
||||||
|
newFacePatch.append(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void cartesianMeshExtractor::createPolyMesh()"
|
||||||
|
) << "Cannot distribute the face!!" << exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newFacePatch.append(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- replace the boundary with faces in correct patches
|
||||||
|
meshModifier.replaceBoundary
|
||||||
|
(
|
||||||
|
patchNames,
|
||||||
|
boundaryFaces,
|
||||||
|
newFaceOwner,
|
||||||
|
newFacePatch
|
||||||
|
);
|
||||||
|
|
||||||
|
meshModifier.boundariesAccess()[1].patchType() = "empty";
|
||||||
|
meshModifier.boundariesAccess()[2].patchType() = "empty";
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Finished creating polyMesh" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,336 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cartesianMeshGenerator.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "triSurfacePatchManipulator.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "meshOctreeCreator.H"
|
||||||
|
#include "cartesianMeshExtractor.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "meshSurfaceMapper.H"
|
||||||
|
#include "meshSurfaceEdgeExtractorNonTopo.H"
|
||||||
|
#include "meshOptimizer.H"
|
||||||
|
#include "meshSurfaceOptimizer.H"
|
||||||
|
#include "topologicalCleaner.H"
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "refineBoundaryLayers.H"
|
||||||
|
#include "renameBoundaryPatches.H"
|
||||||
|
#include "checkMeshDict.H"
|
||||||
|
#include "checkCellConnectionsOverFaces.H"
|
||||||
|
#include "checkIrregularSurfaceConnections.H"
|
||||||
|
#include "checkNonMappableCellConnections.H"
|
||||||
|
#include "checkBoundaryFacesSharingTwoEdges.H"
|
||||||
|
#include "triSurfaceMetaData.H"
|
||||||
|
|
||||||
|
//#define DEBUG
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::createCartesianMesh()
|
||||||
|
{
|
||||||
|
//- create polyMesh from octree boxes
|
||||||
|
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
|
||||||
|
|
||||||
|
if( meshDict_.found("decomposePolyhedraIntoTetsAndPyrs") )
|
||||||
|
{
|
||||||
|
if( readBool(meshDict_.lookup("decomposePolyhedraIntoTetsAndPyrs")) )
|
||||||
|
cme.decomposeSplitHexes();
|
||||||
|
}
|
||||||
|
|
||||||
|
cme.createMesh();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::surfacePreparation()
|
||||||
|
{
|
||||||
|
//- removes unnecessary cells and morph the boundary
|
||||||
|
//- such that there is only one boundary face per cell
|
||||||
|
//- It also checks topology of cells after morphing is performed
|
||||||
|
bool changed;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
changed = false;
|
||||||
|
|
||||||
|
checkIrregularSurfaceConnections checkConnections(mesh_);
|
||||||
|
if( checkConnections.checkAndFixIrregularConnections() )
|
||||||
|
changed = true;
|
||||||
|
|
||||||
|
if( checkNonMappableCellConnections(mesh_).removeCells() )
|
||||||
|
changed = true;
|
||||||
|
|
||||||
|
if( checkCellConnectionsOverFaces(mesh_).checkCellGroups() )
|
||||||
|
changed = true;
|
||||||
|
} while( changed );
|
||||||
|
|
||||||
|
checkBoundaryFacesSharingTwoEdges(mesh_).improveTopology();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
returnReduce(1, sumOp<label>());
|
||||||
|
::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::mapMeshToSurface()
|
||||||
|
{
|
||||||
|
//- calculate mesh surface
|
||||||
|
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
|
||||||
|
|
||||||
|
//- pre-map mesh surface
|
||||||
|
meshSurfaceMapper mapper(*msePtr, *octreePtr_);
|
||||||
|
mapper.preMapVertices();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
returnReduce(1, sumOp<label>());
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//- map mesh surface on the geometry surface
|
||||||
|
mapper.mapVerticesOntoSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//- untangle surface faces
|
||||||
|
meshSurfaceOptimizer(*msePtr, *octreePtr_).untangleSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
deleteDemandDrivenData(msePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::mapEdgesAndCorners()
|
||||||
|
{
|
||||||
|
meshSurfaceEdgeExtractorNonTopo(mesh_, *octreePtr_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::optimiseMeshSurface()
|
||||||
|
{
|
||||||
|
meshSurfaceEngine mse(mesh_);
|
||||||
|
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::generateBoundaryLayers()
|
||||||
|
{
|
||||||
|
//- add boundary layers
|
||||||
|
boundaryLayers bl(mesh_);
|
||||||
|
bl.addLayerForAllPatches();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::refBoundaryLayers()
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("boundaryLayers") )
|
||||||
|
{
|
||||||
|
refineBoundaryLayers refLayers(mesh_);
|
||||||
|
|
||||||
|
refineBoundaryLayers::readSettings(meshDict_, refLayers);
|
||||||
|
|
||||||
|
refLayers.refineLayers();
|
||||||
|
|
||||||
|
meshOptimizer optimizer(mesh_);
|
||||||
|
optimizer.untangleMeshFV();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::optimiseFinalMesh()
|
||||||
|
{
|
||||||
|
//- untangle the surface if needed
|
||||||
|
meshSurfaceEngine mse(mesh_);
|
||||||
|
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
|
||||||
|
deleteDemandDrivenData(octreePtr_);
|
||||||
|
|
||||||
|
//- final optimisation
|
||||||
|
meshOptimizer optimizer(mesh_);
|
||||||
|
optimizer.optimizeMeshFV();
|
||||||
|
optimizer.optimizeLowQualityFaces();
|
||||||
|
optimizer.untangleMeshFV();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::replaceBoundaries()
|
||||||
|
{
|
||||||
|
renameBoundaryPatches rbp(mesh_, meshDict_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::renumberMesh()
|
||||||
|
{
|
||||||
|
polyMeshGenModifier(mesh_).renumberMesh();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(EXIT_SUCCESS);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::generateMesh()
|
||||||
|
{
|
||||||
|
createCartesianMesh();
|
||||||
|
|
||||||
|
surfacePreparation();
|
||||||
|
|
||||||
|
mapMeshToSurface();
|
||||||
|
|
||||||
|
mapEdgesAndCorners();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
|
||||||
|
generateBoundaryLayers();
|
||||||
|
|
||||||
|
optimiseFinalMesh();
|
||||||
|
|
||||||
|
refBoundaryLayers();
|
||||||
|
|
||||||
|
renumberMesh();
|
||||||
|
|
||||||
|
replaceBoundaries();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from objectRegistry
|
||||||
|
cartesianMeshGenerator::cartesianMeshGenerator(const Time& time)
|
||||||
|
:
|
||||||
|
db_(time),
|
||||||
|
surfacePtr_(NULL),
|
||||||
|
meshDict_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"meshDict",
|
||||||
|
db_.system(),
|
||||||
|
db_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
),
|
||||||
|
octreePtr_(NULL),
|
||||||
|
mesh_(time)
|
||||||
|
{
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
checkMeshDict cmd(meshDict_);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
surfaceFile = ".."/surfaceFile;
|
||||||
|
|
||||||
|
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
|
||||||
|
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
//- save meta data with the mesh (surface mesh + its topology info)
|
||||||
|
triSurfaceMetaData sMetaData(*surfacePtr_);
|
||||||
|
const dictionary& surfMetaDict = sMetaData.metaData();
|
||||||
|
|
||||||
|
mesh_.metaData().add("surfaceFile", surfaceFile);
|
||||||
|
mesh_.metaData().add("surfaceMeta", surfMetaDict);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( surfacePtr_->featureEdges().size() != 0 )
|
||||||
|
{
|
||||||
|
//- create surface patches based on the feature edges
|
||||||
|
//- and update the meshDict based on the given data
|
||||||
|
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
||||||
|
|
||||||
|
const triSurf* surfaceWithPatches =
|
||||||
|
manipulator.surfaceWithPatches(&meshDict_);
|
||||||
|
|
||||||
|
//- delete the old surface and assign the new one
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
surfacePtr_ = surfaceWithPatches;
|
||||||
|
}
|
||||||
|
|
||||||
|
octreePtr_ = new meshOctree(*surfacePtr_);
|
||||||
|
|
||||||
|
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
|
||||||
|
|
||||||
|
generateMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
cartesianMeshGenerator::~cartesianMeshGenerator()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
deleteDemandDrivenData(octreePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void cartesianMeshGenerator::writeMesh() const
|
||||||
|
{
|
||||||
|
mesh_.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,141 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
cartesianMeshGenerator
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates cartesian mesh from the octree
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cartesianMeshGenerator.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cartesianMeshGenerator_H
|
||||||
|
#define cartesianMeshGenerator_H
|
||||||
|
|
||||||
|
#include "polyMeshGen.H"
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
//#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class triSurf;
|
||||||
|
class meshOctree;
|
||||||
|
class Time;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cartesianMeshGenerator Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cartesianMeshGenerator
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- reference to Time
|
||||||
|
const Time& db_;
|
||||||
|
|
||||||
|
//- pointer to the surface
|
||||||
|
const triSurf* surfacePtr_;
|
||||||
|
|
||||||
|
//- IOdictionary containing information about cell sizes, etc..
|
||||||
|
IOdictionary meshDict_;
|
||||||
|
|
||||||
|
//- pointer to the octree
|
||||||
|
meshOctree* octreePtr_;
|
||||||
|
|
||||||
|
//- mesh
|
||||||
|
polyMeshGen mesh_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- create cartesian mesh
|
||||||
|
void createCartesianMesh();
|
||||||
|
|
||||||
|
//- prepare mesh surface
|
||||||
|
void surfacePreparation();
|
||||||
|
|
||||||
|
//- map mesh to the surface and untangle surface
|
||||||
|
void mapMeshToSurface();
|
||||||
|
|
||||||
|
//- capture edges and corners
|
||||||
|
void mapEdgesAndCorners();
|
||||||
|
|
||||||
|
//- optimise surface mesh
|
||||||
|
void optimiseMeshSurface();
|
||||||
|
|
||||||
|
//- add boundary layers
|
||||||
|
void generateBoundaryLayers();
|
||||||
|
|
||||||
|
//- refine boundary layers
|
||||||
|
void refBoundaryLayers();
|
||||||
|
|
||||||
|
//- mesh optimisation
|
||||||
|
void optimiseFinalMesh();
|
||||||
|
|
||||||
|
//- replace boundaries
|
||||||
|
void replaceBoundaries();
|
||||||
|
|
||||||
|
//- renumber the mesh
|
||||||
|
void renumberMesh();
|
||||||
|
|
||||||
|
//- generate mesh
|
||||||
|
void generateMesh();
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
cartesianMeshGenerator(const cartesianMeshGenerator&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const cartesianMeshGenerator&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from time
|
||||||
|
cartesianMeshGenerator(const Time&);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~cartesianMeshGenerator();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- write the mesh
|
||||||
|
void writeMesh() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,289 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "tetMeshExtractorOctree.H"
|
||||||
|
#include "meshOctree.H"
|
||||||
|
#include "triSurface.H"
|
||||||
|
#include "polyMeshGenModifierAddCellByCell.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
# ifdef USE_OMP
|
||||||
|
#include <omp.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
// #define DEBUGTets
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void tetMeshExtractorOctree::createPoints()
|
||||||
|
{
|
||||||
|
polyMeshGenModifier meshModifier ( mesh_ );
|
||||||
|
pointFieldPMG& points = meshModifier.pointsAccess();
|
||||||
|
|
||||||
|
const LongList<point>& tetPoints = tetCreator_.tetPoints();
|
||||||
|
|
||||||
|
points.setSize(tetPoints.size());
|
||||||
|
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp parallel for
|
||||||
|
# endif
|
||||||
|
forAll(tetPoints, pointI)
|
||||||
|
points[pointI] = tetPoints[pointI];
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshExtractorOctree::createPolyMesh()
|
||||||
|
{
|
||||||
|
polyMeshGenModifier meshModifier ( mesh_ );
|
||||||
|
|
||||||
|
faceListPMG& faces = meshModifier.facesAccess();
|
||||||
|
cellListPMG& cells = meshModifier.cellsAccess();
|
||||||
|
meshModifier.boundariesAccess().setSize ( 0 );
|
||||||
|
meshModifier.procBoundariesAccess().setSize ( 0 );
|
||||||
|
|
||||||
|
const LongList<partTet>& tets = tetCreator_.tets();
|
||||||
|
|
||||||
|
VRWGraph pTets;
|
||||||
|
pTets.reverseAddressing(mesh_.points().size(), tets);
|
||||||
|
|
||||||
|
//- set the number of cells
|
||||||
|
cells.setSize(tets.size());
|
||||||
|
|
||||||
|
//- all faces of tetrahedral cells
|
||||||
|
faces.setSize(4*tets.size());
|
||||||
|
boolList removeFace(faces.size());
|
||||||
|
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp parallel if( tets.size() > 1000 )
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
//- set face labels
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp for
|
||||||
|
# endif
|
||||||
|
forAll(removeFace, faceI)
|
||||||
|
removeFace[faceI] = false;
|
||||||
|
|
||||||
|
//- set sizes of cells and create all faces
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp for schedule(dynamic, 20)
|
||||||
|
# endif
|
||||||
|
forAll(tets, elmtI)
|
||||||
|
{
|
||||||
|
cells[elmtI].setSize(4);
|
||||||
|
|
||||||
|
const partTet& elmt = tets[elmtI];
|
||||||
|
|
||||||
|
//tessellationElement telmt(elmt[0], elmt[1], elmt[2], elmt[3]);
|
||||||
|
|
||||||
|
label faceI = 4 * elmtI;
|
||||||
|
|
||||||
|
//- first face
|
||||||
|
cells[elmtI][0] = faceI;
|
||||||
|
|
||||||
|
face& f0 = faces[faceI];
|
||||||
|
f0.setSize(3);
|
||||||
|
|
||||||
|
f0[0] = elmt.a();
|
||||||
|
f0[1] = elmt.c();
|
||||||
|
f0[2] = elmt.b();
|
||||||
|
|
||||||
|
++faceI;
|
||||||
|
|
||||||
|
//- second face
|
||||||
|
cells[elmtI][1] = faceI;
|
||||||
|
|
||||||
|
face& f1 = faces[faceI];
|
||||||
|
f1.setSize(3);
|
||||||
|
|
||||||
|
f1[0] = elmt.a();
|
||||||
|
f1[1] = elmt.b();
|
||||||
|
f1[2] = elmt.d();
|
||||||
|
|
||||||
|
++faceI;
|
||||||
|
|
||||||
|
//- third face
|
||||||
|
cells[elmtI][2] = faceI;
|
||||||
|
|
||||||
|
face& f2 = faces[faceI];
|
||||||
|
f2.setSize ( 3 );
|
||||||
|
|
||||||
|
f2[0] = elmt.b();
|
||||||
|
f2[1] = elmt.c();
|
||||||
|
f2[2] = elmt.d();
|
||||||
|
|
||||||
|
++faceI;
|
||||||
|
|
||||||
|
//- fourth face
|
||||||
|
cells[elmtI][3] = faceI;
|
||||||
|
|
||||||
|
face& f3 = faces[faceI];
|
||||||
|
f3.setSize ( 3 );
|
||||||
|
|
||||||
|
f3[0] = elmt.c();
|
||||||
|
f3[1] = elmt.a();
|
||||||
|
f3[2] = elmt.d();
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp barrier
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//- find duplicate faces
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp for schedule(dynamic, 20)
|
||||||
|
# endif
|
||||||
|
forAll(cells, cellI)
|
||||||
|
{
|
||||||
|
cell& c = cells[cellI];
|
||||||
|
|
||||||
|
forAll(c, fI)
|
||||||
|
{
|
||||||
|
const face& f = faces[c[fI]];
|
||||||
|
const label pointI = f[0];
|
||||||
|
|
||||||
|
forAllRow(pTets, pointI, ptI)
|
||||||
|
{
|
||||||
|
//- do not check cells with greater labels
|
||||||
|
//- they cannot be face owners
|
||||||
|
if( pTets(pointI, ptI) >= cellI )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const cell& otherTet = cells[pTets(pointI, ptI)];
|
||||||
|
|
||||||
|
//- check faces created from a tet
|
||||||
|
forAll(otherTet, ofI)
|
||||||
|
{
|
||||||
|
//- do not compare faces with greater labels
|
||||||
|
//- they shall not be removed here
|
||||||
|
if( otherTet[ofI] >= c[fI] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- check if the faces are equal
|
||||||
|
if( f == faces[otherTet[ofI]] )
|
||||||
|
{
|
||||||
|
removeFace[c[fI]] = true;
|
||||||
|
c[fI] = otherTet[ofI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- remove duplicate faces
|
||||||
|
label nFaces(0);
|
||||||
|
labelLongList newFaceLabel(faces.size(), -1);
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
if( !removeFace[faceI] )
|
||||||
|
{
|
||||||
|
if( nFaces < faceI )
|
||||||
|
faces[nFaces].transfer(faces[faceI]);
|
||||||
|
|
||||||
|
newFaceLabel[faceI] = nFaces;
|
||||||
|
++nFaces;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- set the size of faces
|
||||||
|
faces.setSize(nFaces);
|
||||||
|
|
||||||
|
//- change cells
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp for schedule(dynamic, 40)
|
||||||
|
# endif
|
||||||
|
forAll(cells, cellI)
|
||||||
|
{
|
||||||
|
cell& c = cells[cellI];
|
||||||
|
|
||||||
|
DynList<label> newC;
|
||||||
|
|
||||||
|
forAll(c, fI)
|
||||||
|
{
|
||||||
|
if( newFaceLabel[c[fI]] != -1 )
|
||||||
|
newC.append(newFaceLabel[c[fI]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
c.setSize(newC.size());
|
||||||
|
forAll(c, fI)
|
||||||
|
c[fI] = newC[fI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from octree and mesh data
|
||||||
|
tetMeshExtractorOctree::tetMeshExtractorOctree
|
||||||
|
(
|
||||||
|
const meshOctree& octree,
|
||||||
|
const IOdictionary& meshDict,
|
||||||
|
polyMeshGen& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
tetCreator_(octree, meshDict),
|
||||||
|
mesh_(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tetMeshExtractorOctree::~tetMeshExtractorOctree()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void tetMeshExtractorOctree::createMesh()
|
||||||
|
{
|
||||||
|
Info << "Extracting tetMesh" << endl;
|
||||||
|
|
||||||
|
//- copy tet points into the mesh
|
||||||
|
createPoints();
|
||||||
|
|
||||||
|
//- create the mesh
|
||||||
|
createPolyMesh();
|
||||||
|
|
||||||
|
polyMeshGenModifier(mesh_).reorderBoundaryFaces();
|
||||||
|
polyMeshGenModifier(mesh_).removeUnusedVertices();
|
||||||
|
|
||||||
|
Info << "Mesh has :" << nl
|
||||||
|
<< mesh_.points().size() << " vertices " << nl
|
||||||
|
<< mesh_.faces().size() << " faces" << nl
|
||||||
|
<< mesh_.cells().size() << " cells" << endl;
|
||||||
|
|
||||||
|
Info << "Finished extracting tetMesh" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
tetMeshExtractorOctree
|
||||||
|
|
||||||
|
Description
|
||||||
|
A class which extracts tet mesh out of an octree structure
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
tetMeshExtractorOctree.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef tetMeshExtractorOctree_H
|
||||||
|
#define tetMeshExtractorOctree_H
|
||||||
|
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "partTet.H"
|
||||||
|
#include "tetCreatorOctree.H"
|
||||||
|
#include "VRWGraph.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class tetMeshExtractorOctree Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class tetMeshExtractorOctree
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- create tets
|
||||||
|
tetCreatorOctree tetCreator_;
|
||||||
|
|
||||||
|
//- reference to the mesh
|
||||||
|
polyMeshGen& mesh_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- copy tetPoints_ into mesh
|
||||||
|
void createPoints();
|
||||||
|
|
||||||
|
//- create mesh data
|
||||||
|
void createPolyMesh();
|
||||||
|
|
||||||
|
// Private copy constructor
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
tetMeshExtractorOctree ( const tetMeshExtractorOctree& );
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator= ( const tetMeshExtractorOctree& );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from octree and mesh data
|
||||||
|
tetMeshExtractorOctree
|
||||||
|
(
|
||||||
|
const meshOctree& octree,
|
||||||
|
const IOdictionary& meshDict,
|
||||||
|
polyMeshGen& mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~tetMeshExtractorOctree();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
void createMesh();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,328 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "tetMeshGenerator.H"
|
||||||
|
#include "triSurf.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "meshOctreeCreator.H"
|
||||||
|
#include "meshOctreeAutomaticRefinement.H"
|
||||||
|
#include "tetMeshExtractorOctree.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "meshSurfaceMapper.H"
|
||||||
|
#include "meshSurfaceEdgeExtractorNonTopo.H"
|
||||||
|
#include "surfaceMorpherCells.H"
|
||||||
|
#include "meshOptimizer.H"
|
||||||
|
#include "meshSurfaceOptimizer.H"
|
||||||
|
#include "topologicalCleaner.H"
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "renameBoundaryPatches.H"
|
||||||
|
#include "checkMeshDict.H"
|
||||||
|
#include "triSurfacePatchManipulator.H"
|
||||||
|
#include "refineBoundaryLayers.H"
|
||||||
|
#include "triSurfaceMetaData.H"
|
||||||
|
|
||||||
|
//#define DEBUG
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void tetMeshGenerator::createTetMesh()
|
||||||
|
{
|
||||||
|
//- create tet Mesh from octree and Delaunay tets
|
||||||
|
tetMeshExtractorOctree tme(*octreePtr_, meshDict_, mesh_);
|
||||||
|
|
||||||
|
tme.createMesh();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::surfacePreparation()
|
||||||
|
{
|
||||||
|
//- removes unnecessary cells and morph the boundary
|
||||||
|
//- such that there is only one boundary face per cell
|
||||||
|
//- It also checks topology of cells after morphing is performed
|
||||||
|
do
|
||||||
|
{
|
||||||
|
surfaceMorpherCells* cmPtr = new surfaceMorpherCells(mesh_);
|
||||||
|
cmPtr->morphMesh();
|
||||||
|
deleteDemandDrivenData(cmPtr);
|
||||||
|
}
|
||||||
|
while( topologicalCleaner(mesh_).cleanTopology() );
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::mapMeshToSurface()
|
||||||
|
{
|
||||||
|
//- calculate mesh surface
|
||||||
|
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
|
||||||
|
|
||||||
|
//- map mesh surface on the geometry surface
|
||||||
|
meshSurfaceMapper(*msePtr, *octreePtr_).mapVerticesOntoSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//- untangle surface faces
|
||||||
|
meshSurfaceOptimizer(*msePtr, *octreePtr_).untangleSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
deleteDemandDrivenData(msePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::mapEdgesAndCorners()
|
||||||
|
{
|
||||||
|
meshSurfaceEdgeExtractorNonTopo(mesh_, *octreePtr_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::optimiseMeshSurface()
|
||||||
|
{
|
||||||
|
meshSurfaceEngine mse(mesh_);
|
||||||
|
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::generateBoudaryLayers()
|
||||||
|
{
|
||||||
|
if( meshDict_.found("boundaryLayers") )
|
||||||
|
{
|
||||||
|
boundaryLayers bl(mesh_);
|
||||||
|
|
||||||
|
const dictionary& bndLayers = meshDict_.subDict("boundaryLayers");
|
||||||
|
|
||||||
|
if( bndLayers.found("nLayers") )
|
||||||
|
{
|
||||||
|
const label nLayers = readLabel(bndLayers.lookup("nLayers"));
|
||||||
|
|
||||||
|
if( nLayers > 0 )
|
||||||
|
bl.addLayerForAllPatches();
|
||||||
|
}
|
||||||
|
else if( bndLayers.found("patchBoundaryLayers") )
|
||||||
|
{
|
||||||
|
const dictionary& patchLayers =
|
||||||
|
bndLayers.subDict("patchBoundaryLayers");
|
||||||
|
const wordList createLayers = patchLayers.toc();
|
||||||
|
|
||||||
|
forAll(createLayers, patchI)
|
||||||
|
bl.addLayerForPatch(createLayers[patchI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::optimiseFinalMesh()
|
||||||
|
{
|
||||||
|
//- final optimisation
|
||||||
|
meshOptimizer optimizer(mesh_);
|
||||||
|
|
||||||
|
optimizer.optimizeSurface(*octreePtr_);
|
||||||
|
|
||||||
|
deleteDemandDrivenData(octreePtr_);
|
||||||
|
|
||||||
|
optimizer.optimizeMeshFV();
|
||||||
|
optimizer.optimizeLowQualityFaces();
|
||||||
|
optimizer.optimizeMeshFV();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::refBoundaryLayers()
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("boundaryLayers") )
|
||||||
|
{
|
||||||
|
refineBoundaryLayers refLayers(mesh_);
|
||||||
|
|
||||||
|
refineBoundaryLayers::readSettings(meshDict_, refLayers);
|
||||||
|
|
||||||
|
refLayers.refineLayers();
|
||||||
|
|
||||||
|
meshOptimizer optimizer(mesh_);
|
||||||
|
|
||||||
|
optimizer.untangleMeshFV();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::replaceBoundaries()
|
||||||
|
{
|
||||||
|
renameBoundaryPatches rbp(mesh_, meshDict_);
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::renumberMesh()
|
||||||
|
{
|
||||||
|
polyMeshGenModifier(mesh_).renumberMesh();
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
mesh_.write();
|
||||||
|
//::exit(0);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void tetMeshGenerator::generateMesh()
|
||||||
|
{
|
||||||
|
createTetMesh();
|
||||||
|
|
||||||
|
surfacePreparation();
|
||||||
|
|
||||||
|
mapMeshToSurface();
|
||||||
|
|
||||||
|
mapEdgesAndCorners();
|
||||||
|
|
||||||
|
optimiseMeshSurface();
|
||||||
|
|
||||||
|
generateBoudaryLayers();
|
||||||
|
|
||||||
|
optimiseFinalMesh();
|
||||||
|
|
||||||
|
refBoundaryLayers();
|
||||||
|
|
||||||
|
renumberMesh();
|
||||||
|
|
||||||
|
replaceBoundaries();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from Time
|
||||||
|
tetMeshGenerator::tetMeshGenerator(const Time& time)
|
||||||
|
:
|
||||||
|
runTime_(time),
|
||||||
|
surfacePtr_(NULL),
|
||||||
|
meshDict_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"meshDict",
|
||||||
|
runTime_.system(),
|
||||||
|
runTime_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
),
|
||||||
|
octreePtr_(NULL),
|
||||||
|
mesh_(time)
|
||||||
|
{
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
checkMeshDict cmd(meshDict_);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileName surfaceFile = meshDict_.lookup("surfaceFile");
|
||||||
|
|
||||||
|
surfacePtr_ = new triSurf(runTime_.path()/surfaceFile);
|
||||||
|
|
||||||
|
if( true )
|
||||||
|
{
|
||||||
|
//- save meta data with the mesh (surface mesh + its topology info)
|
||||||
|
triSurfaceMetaData sMetaData(*surfacePtr_);
|
||||||
|
const dictionary& surfMetaDict = sMetaData.metaData();
|
||||||
|
|
||||||
|
mesh_.metaData().add("surfaceFile", surfaceFile);
|
||||||
|
mesh_.metaData().add("surfaceMeta", surfMetaDict);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( surfacePtr_->featureEdges().size() != 0 )
|
||||||
|
{
|
||||||
|
//- create surface patches based on the feature edges
|
||||||
|
//- and update the meshDict based on the given data
|
||||||
|
triSurfacePatchManipulator manipulator(*surfacePtr_);
|
||||||
|
|
||||||
|
const triSurf* surfaceWithPatches =
|
||||||
|
manipulator.surfaceWithPatches(&meshDict_);
|
||||||
|
|
||||||
|
//- delete the old surface and assign the new one
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
surfacePtr_ = surfaceWithPatches;
|
||||||
|
}
|
||||||
|
|
||||||
|
octreePtr_ = new meshOctree(*surfacePtr_);
|
||||||
|
|
||||||
|
meshOctreeCreator* octreeCreatorPtr =
|
||||||
|
new meshOctreeCreator(*octreePtr_, meshDict_);
|
||||||
|
octreeCreatorPtr->createOctreeBoxes();
|
||||||
|
deleteDemandDrivenData(octreeCreatorPtr);
|
||||||
|
|
||||||
|
generateMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tetMeshGenerator::~tetMeshGenerator()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(surfacePtr_);
|
||||||
|
deleteDemandDrivenData(octreePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void tetMeshGenerator::writeMesh() const
|
||||||
|
{
|
||||||
|
mesh_.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,141 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
tetMeshGenerator
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates cartesian mesh from the octree
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
tetMeshGenerator.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef tetMeshGenerator_H
|
||||||
|
#define tetMeshGenerator_H
|
||||||
|
|
||||||
|
#include "polyMeshGen.H"
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
//#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class triSurf;
|
||||||
|
class meshOctree;
|
||||||
|
class Time;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class tetMeshGenerator Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class tetMeshGenerator
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- reference to Time
|
||||||
|
const Time& runTime_;
|
||||||
|
|
||||||
|
//- pointer to the surface
|
||||||
|
const triSurf* surfacePtr_;
|
||||||
|
|
||||||
|
//- IOdictionary containing information about cell sizes, etc..
|
||||||
|
IOdictionary meshDict_;
|
||||||
|
|
||||||
|
//- pointer to the octree
|
||||||
|
meshOctree* octreePtr_;
|
||||||
|
|
||||||
|
//- mesh
|
||||||
|
polyMeshGen mesh_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- create cartesian mesh
|
||||||
|
void createTetMesh();
|
||||||
|
|
||||||
|
//- prepare mesh surface
|
||||||
|
void surfacePreparation();
|
||||||
|
|
||||||
|
//- map mesh to the surface and untangle surface
|
||||||
|
void mapMeshToSurface();
|
||||||
|
|
||||||
|
//- capture edges and corners
|
||||||
|
void mapEdgesAndCorners();
|
||||||
|
|
||||||
|
//- optimise surface mesh
|
||||||
|
void optimiseMeshSurface();
|
||||||
|
|
||||||
|
//- add boundary layers
|
||||||
|
void generateBoudaryLayers();
|
||||||
|
|
||||||
|
//- mesh optimisation
|
||||||
|
void optimiseFinalMesh();
|
||||||
|
|
||||||
|
//- refine boundary layers
|
||||||
|
void refBoundaryLayers();
|
||||||
|
|
||||||
|
//- replace boundaries
|
||||||
|
void replaceBoundaries();
|
||||||
|
|
||||||
|
//- renumber the mesh
|
||||||
|
void renumberMesh();
|
||||||
|
|
||||||
|
//- generate mesh
|
||||||
|
void generateMesh();
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
tetMeshGenerator(const tetMeshGenerator&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const tetMeshGenerator&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from time
|
||||||
|
tetMeshGenerator(const Time&);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
~tetMeshGenerator();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- write the mesh
|
||||||
|
void writeMesh() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,829 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "helperFunctions.H"
|
||||||
|
#include "helperFunctionsPar.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "VRWGraphList.H"
|
||||||
|
|
||||||
|
#include "labelledPair.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
//#define DEBUGLayer
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
#include "polyMeshGenAddressing.H"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void boundaryLayers::createLayerCells(const labelList& patchLabels)
|
||||||
|
{
|
||||||
|
Info << "Starting creating layer cells" << endl;
|
||||||
|
|
||||||
|
const meshSurfaceEngine& mse = surfaceEngine();
|
||||||
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
const edgeList& edges = mse.edges();
|
||||||
|
const VRWGraph& faceEdges = mse.faceEdges();
|
||||||
|
const VRWGraph& edgeFaces = mse.edgeFaces();
|
||||||
|
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
|
||||||
|
const labelList& faceOwners = mse.faceOwners();
|
||||||
|
const labelList& bp = mse.bp();
|
||||||
|
const VRWGraph& pointFaces = mse.pointFaces();
|
||||||
|
|
||||||
|
const meshSurfacePartitioner& mPart = surfacePartitioner();
|
||||||
|
const VRWGraph& pointPatches = mPart.pointPatches();
|
||||||
|
|
||||||
|
//- mark patches which will be extruded into layer cells
|
||||||
|
boolList treatPatches(mesh_.boundaries().size(), false);
|
||||||
|
forAll(patchLabels, patchI)
|
||||||
|
{
|
||||||
|
const label pLabel = patchLabels[patchI];
|
||||||
|
forAll(treatPatchesWithPatch_[pLabel], i)
|
||||||
|
treatPatches[treatPatchesWithPatch_[pLabel][i]] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create new faces at parallel boundaries
|
||||||
|
const Map<label>* otherProcPatchPtr(NULL);
|
||||||
|
const Map<label>* otherFaceProcPtr(NULL);
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
createNewFacesParallel(treatPatches);
|
||||||
|
|
||||||
|
otherProcPatchPtr = &mse.otherEdgeFacePatch();
|
||||||
|
otherFaceProcPtr = &mse.otherEdgeFaceAtProc();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create lists for new boundary faces
|
||||||
|
VRWGraph newBoundaryFaces;
|
||||||
|
labelLongList newBoundaryOwners;
|
||||||
|
labelLongList newBoundaryPatches;
|
||||||
|
|
||||||
|
//- create storage for new cells
|
||||||
|
VRWGraphList cellsToAdd;
|
||||||
|
|
||||||
|
//- create layer cells and store boundary faces
|
||||||
|
const label nOldCells = mesh_.cells().size();
|
||||||
|
forAll(bFaces, bfI)
|
||||||
|
{
|
||||||
|
if( treatPatches[boundaryFacePatches[bfI]] )
|
||||||
|
{
|
||||||
|
const face& f = bFaces[bfI];
|
||||||
|
const label pKey = patchKey_[boundaryFacePatches[bfI]];
|
||||||
|
|
||||||
|
DynList<DynList<label> > cellFaces;
|
||||||
|
|
||||||
|
DynList<label> newF;
|
||||||
|
|
||||||
|
//- store the current boundary face
|
||||||
|
newF.clear();
|
||||||
|
newF.append(f[0]);
|
||||||
|
for(label pI=f.size()-1;pI>0;--pI)
|
||||||
|
newF.append(f[pI]);
|
||||||
|
cellFaces.append(newF);
|
||||||
|
|
||||||
|
//- create parallel face
|
||||||
|
forAll(f, pI)
|
||||||
|
newF[pI] = findNewNodeLabel(f[pI], pKey);
|
||||||
|
|
||||||
|
cellFaces.append(newF);
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(newF);
|
||||||
|
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
|
||||||
|
newBoundaryPatches.append(boundaryFacePatches[bfI]);
|
||||||
|
|
||||||
|
//- create quad faces
|
||||||
|
newF.setSize(4);
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
newF[0] = f[pI];
|
||||||
|
newF[1] = f.nextLabel(pI);
|
||||||
|
newF[2] = findNewNodeLabel(newF[1], pKey);
|
||||||
|
newF[3] = findNewNodeLabel(f[pI], pKey);
|
||||||
|
|
||||||
|
cellFaces.append(newF);
|
||||||
|
|
||||||
|
//- check if the face is at the boundary
|
||||||
|
//- of the treated partitions
|
||||||
|
const label edgeI = faceEdges(bfI, pI);
|
||||||
|
if( edgeFaces.sizeOfRow(edgeI) == 2 )
|
||||||
|
{
|
||||||
|
label neiFace = edgeFaces(edgeI, 0);
|
||||||
|
if( neiFace == bfI )
|
||||||
|
neiFace = edgeFaces(edgeI, 1);
|
||||||
|
|
||||||
|
if( !treatPatches[boundaryFacePatches[neiFace]] )
|
||||||
|
{
|
||||||
|
newBoundaryFaces.appendList(newF);
|
||||||
|
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
|
||||||
|
newBoundaryPatches.append(boundaryFacePatches[neiFace]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( edgeFaces.sizeOfRow(edgeI) == 1 )
|
||||||
|
{
|
||||||
|
const Map<label>& otherProcPatch = *otherProcPatchPtr;
|
||||||
|
if( !treatPatches[otherProcPatch[edgeI]] )
|
||||||
|
{
|
||||||
|
//- face is a new boundary face
|
||||||
|
newBoundaryFaces.appendList(newF);
|
||||||
|
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
|
||||||
|
newBoundaryPatches.append(otherProcPatch[edgeI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Info << "Adding cell " << cellFaces << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
cellsToAdd.appendGraph(cellFaces);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Info << "Storing original boundary face "
|
||||||
|
<< bfI << " into patch " << boundaryFacePatches[bfI] << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(bFaces[bfI]);
|
||||||
|
newBoundaryOwners.append(faceOwners[bfI]);
|
||||||
|
newBoundaryPatches.append(boundaryFacePatches[bfI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- data for parallel execution
|
||||||
|
boolList procPoint;
|
||||||
|
LongList<DynList<label, 4> > pointProcFaces;
|
||||||
|
LongList<labelPair> faceAtPatches;
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
procPoint.setSize(nPoints_);
|
||||||
|
procPoint = false;
|
||||||
|
|
||||||
|
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
|
||||||
|
const labelList& bPoints = mse.boundaryPoints();
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
Map<label>::const_iterator iter=globalToLocal.begin();
|
||||||
|
iter!=globalToLocal.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label bpI = iter();
|
||||||
|
procPoint[bPoints[bpI]] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create cells at edges
|
||||||
|
forAll(edgeFaces, edgeI)
|
||||||
|
{
|
||||||
|
//- do not consider edges with no faces attached to it
|
||||||
|
if( edgeFaces.sizeOfRow(edgeI) == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- cells are generated at the processor with the lowest label
|
||||||
|
if(
|
||||||
|
(edgeFaces.sizeOfRow(edgeI) == 1) &&
|
||||||
|
(otherFaceProcPtr->operator[](edgeI) < Pstream::myProcNo())
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- check if the edge is a feature edge
|
||||||
|
const label patchI = boundaryFacePatches[edgeFaces(edgeI, 0)];
|
||||||
|
|
||||||
|
label patchJ;
|
||||||
|
if( otherProcPatchPtr && otherProcPatchPtr->found(edgeI) )
|
||||||
|
{
|
||||||
|
patchJ = otherProcPatchPtr->operator[](edgeI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patchJ = boundaryFacePatches[edgeFaces(edgeI, 1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
if( patchI == patchJ )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- check if the faces attached to the edge have different keys
|
||||||
|
const label pKeyI = patchKey_[patchI];
|
||||||
|
const label pKeyJ = patchKey_[patchJ];
|
||||||
|
|
||||||
|
if( pKeyI == pKeyJ )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const edge& e = edges[edgeI];
|
||||||
|
if( otherVrts_.find(e.start()) == otherVrts_.end() )
|
||||||
|
continue;
|
||||||
|
if( otherVrts_.find(e.end()) == otherVrts_.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- generate faces of the bnd layer cell
|
||||||
|
FixedList<FixedList<label, 4>, 6> cellFaces;
|
||||||
|
createNewCellFromEdge(e, pKeyI, pKeyJ, cellFaces);
|
||||||
|
|
||||||
|
//- store boundary faces
|
||||||
|
newBoundaryFaces.appendList(cellFaces[1]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(patchJ);
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(cellFaces[3]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(patchI);
|
||||||
|
|
||||||
|
//- check if face 5 is a boundary face or at an inter-processor boundary
|
||||||
|
const label bps = bp[e.start()];
|
||||||
|
label unusedPatch(-1);
|
||||||
|
forAllRow(pointPatches, bps, i)
|
||||||
|
{
|
||||||
|
const label ptchI = pointPatches(bps, i);
|
||||||
|
|
||||||
|
if( ptchI == patchI )
|
||||||
|
continue;
|
||||||
|
if( ptchI == patchJ )
|
||||||
|
continue;
|
||||||
|
if( unusedPatch != -1 )
|
||||||
|
{
|
||||||
|
unusedPatch = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
unusedPatch = ptchI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( unusedPatch != -1 && treatedPatch_[unusedPatch] )
|
||||||
|
{
|
||||||
|
//- add a face in the empty patch in case of 2D layer generation
|
||||||
|
newBoundaryFaces.appendList(cellFaces[5]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(unusedPatch);
|
||||||
|
}
|
||||||
|
else if( Pstream::parRun() && procPoint[e.start()] )
|
||||||
|
{
|
||||||
|
//- add a face at inter-pocessor boundary
|
||||||
|
pointProcFaces.append(cellFaces[5]);
|
||||||
|
faceAtPatches.append(labelPair(patchI, patchJ));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- check if face 4 is a boundary face or at an inter-processor boundary
|
||||||
|
const label bpe = bp[e.end()];
|
||||||
|
unusedPatch = -1;
|
||||||
|
forAllRow(pointPatches, bpe, i)
|
||||||
|
{
|
||||||
|
const label ptchI = pointPatches(bpe, i);
|
||||||
|
|
||||||
|
if( ptchI == patchI )
|
||||||
|
continue;
|
||||||
|
if( ptchI == patchJ )
|
||||||
|
continue;
|
||||||
|
if( unusedPatch != -1 )
|
||||||
|
{
|
||||||
|
unusedPatch = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
unusedPatch = ptchI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( unusedPatch != -1 && treatedPatch_[unusedPatch] )
|
||||||
|
{
|
||||||
|
//- add a face in the empty patch in case of 2D layer generation
|
||||||
|
newBoundaryFaces.appendList(cellFaces[4]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(unusedPatch);
|
||||||
|
}
|
||||||
|
else if( Pstream::parRun() && procPoint[e.end()] )
|
||||||
|
{
|
||||||
|
//- add a face at inter-pocessor boundary
|
||||||
|
pointProcFaces.append(cellFaces[4]);
|
||||||
|
faceAtPatches.append(labelPair(patchI, patchJ));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- append cell to the queue
|
||||||
|
cellsToAdd.appendGraph(cellFaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create cells for corner nodes
|
||||||
|
typedef std::map<std::pair<label, label>, label> mPairToLabelType;
|
||||||
|
typedef std::map<label, mPairToLabelType> mPointsType;
|
||||||
|
typedef std::map<label, DynList<label, 3> > ppType;
|
||||||
|
|
||||||
|
ppType nodePatches;
|
||||||
|
labelHashSet parPoint;
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
const labelList& bPoints = mse.boundaryPoints();
|
||||||
|
const VRWGraph& pProcs = mse.bpAtProcs();
|
||||||
|
const labelList& globalPointLabel = mse.globalBoundaryPointLabel();
|
||||||
|
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
|
||||||
|
|
||||||
|
std::map<label, labelLongList> facesToSend;
|
||||||
|
|
||||||
|
typedef std::map<label, DynList<DynList<label, 8>, 8> > ppfType;
|
||||||
|
|
||||||
|
ppfType parPointFaces;
|
||||||
|
ppType parPointPatches;
|
||||||
|
|
||||||
|
forAllConstIter(mPointsType, otherVrts_, iter)
|
||||||
|
{
|
||||||
|
//- skip points on feature edges
|
||||||
|
if( iter->second.size() == 2 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const label bpI = bp[iter->first];
|
||||||
|
|
||||||
|
if( pProcs.sizeOfRow(bpI) != 0 )
|
||||||
|
{
|
||||||
|
parPoint.insert(iter->first);
|
||||||
|
|
||||||
|
//- point is at a parallel boundary
|
||||||
|
label pMin = pProcs(bpI, 0);
|
||||||
|
forAllRow(pProcs, bpI, i)
|
||||||
|
{
|
||||||
|
const label prI = pProcs(bpI, i);
|
||||||
|
|
||||||
|
if( facesToSend.find(prI) == facesToSend.end() )
|
||||||
|
facesToSend.insert
|
||||||
|
(
|
||||||
|
std::make_pair(prI, labelLongList())
|
||||||
|
);
|
||||||
|
|
||||||
|
if( prI < pMin )
|
||||||
|
pMin = prI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Pstream::myProcNo() == pMin )
|
||||||
|
{
|
||||||
|
DynList<label, 3>& pPatches = parPointPatches[bpI];
|
||||||
|
pPatches.setSize(pointFaces.sizeOfRow(bpI));
|
||||||
|
|
||||||
|
DynList<DynList<label, 8>, 8>& pFaces = parPointFaces[bpI];
|
||||||
|
pFaces.setSize(pPatches.size());
|
||||||
|
|
||||||
|
forAllRow(pointFaces, bpI, pfI)
|
||||||
|
{
|
||||||
|
const label bfI = pointFaces(bpI, pfI);
|
||||||
|
const face& bf = bFaces[bfI];
|
||||||
|
|
||||||
|
pPatches[pfI] = boundaryFacePatches[bfI];
|
||||||
|
|
||||||
|
DynList<label, 8>& bfCopy = pFaces[pfI];
|
||||||
|
bfCopy.setSize(bf.size());
|
||||||
|
forAll(bf, pI)
|
||||||
|
bfCopy[pI] = globalPointLabel[bp[bf[pI]]];
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
labelLongList& stp = facesToSend[pMin];
|
||||||
|
|
||||||
|
//- send the data to the processor with the lowest label
|
||||||
|
//- data is flatenned as follows
|
||||||
|
//- 1. the number of faces and global point label
|
||||||
|
//- 2. number of points in the face
|
||||||
|
//- 3. patch label
|
||||||
|
//- 4. global labels of face points
|
||||||
|
stp.append(globalPointLabel[bpI]);
|
||||||
|
stp.append(pointFaces.sizeOfRow(bpI));
|
||||||
|
forAllRow(pointFaces, bpI, pfI)
|
||||||
|
{
|
||||||
|
const label bfI = pointFaces(bpI, pfI);
|
||||||
|
const face& bf = bFaces[bfI];
|
||||||
|
|
||||||
|
stp.append(bf.size());
|
||||||
|
stp.append(boundaryFacePatches[bfI]);
|
||||||
|
forAll(bf, pI)
|
||||||
|
stp.append(globalPointLabel[bp[bf[pI]]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- exchange data with other processors
|
||||||
|
labelLongList receivedData;
|
||||||
|
help::exchangeMap(facesToSend, receivedData);
|
||||||
|
|
||||||
|
label counter(0);
|
||||||
|
while( counter < receivedData.size() )
|
||||||
|
{
|
||||||
|
const label bpI = globalToLocal[receivedData[counter++]];
|
||||||
|
const label nFaces = receivedData[counter++];
|
||||||
|
for(label fI=0;fI<nFaces;++fI)
|
||||||
|
{
|
||||||
|
DynList<label, 8> f(receivedData[counter++]);
|
||||||
|
parPointPatches[bpI].append(receivedData[counter++]);
|
||||||
|
forAll(f, pI)
|
||||||
|
f[pI] = receivedData[counter++];
|
||||||
|
parPointFaces[bpI].append(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- sort faces sharing corners at the parallel boundaries
|
||||||
|
forAllIter(ppfType, parPointFaces, iter)
|
||||||
|
{
|
||||||
|
DynList<DynList<label, 8>, 8>& pFaces = iter->second;
|
||||||
|
DynList<label, 3>& fPatches = parPointPatches[iter->first];
|
||||||
|
const label gpI = globalPointLabel[iter->first];
|
||||||
|
|
||||||
|
for(label i=0;i<pFaces.size();++i)
|
||||||
|
{
|
||||||
|
const DynList<label, 8>& bf = pFaces[i];
|
||||||
|
const label pos = bf.containsAtPosition(gpI);
|
||||||
|
const edge e(bf[pos], bf[bf.fcIndex(pos)]);
|
||||||
|
|
||||||
|
for(label j=i+1;j<pFaces.size();++j)
|
||||||
|
{
|
||||||
|
const DynList<label, 8>& obf = pFaces[j];
|
||||||
|
if( obf.contains(e.start()) && obf.contains(e.end()) )
|
||||||
|
{
|
||||||
|
DynList<label, 8> add;
|
||||||
|
add = pFaces[i+1];
|
||||||
|
pFaces[i+1] = pFaces[j];
|
||||||
|
pFaces[j] = add;
|
||||||
|
|
||||||
|
const label pAdd = fPatches[i+1];
|
||||||
|
fPatches[i+1] = fPatches[j];
|
||||||
|
fPatches[j] = pAdd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DynList<label, 3> patchIDs;
|
||||||
|
forAll(fPatches, fpI)
|
||||||
|
patchIDs.appendIfNotIn(fPatches[fpI]);
|
||||||
|
|
||||||
|
nodePatches.insert(std::make_pair(bPoints[iter->first], patchIDs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- sort out point which are not at inter-processor boundaries
|
||||||
|
forAllConstIter(mPointsType, otherVrts_, iter)
|
||||||
|
{
|
||||||
|
if( iter->second.size() == 2 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( parPoint.found(iter->first) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const label bpI = bp[iter->first];
|
||||||
|
|
||||||
|
//- ensure correct orientation
|
||||||
|
DynList<label> pFaces(pointFaces.sizeOfRow(bpI));
|
||||||
|
forAll(pFaces, fI)
|
||||||
|
pFaces[fI] = pointFaces(bpI, fI);
|
||||||
|
|
||||||
|
for(label i=0;i<pFaces.size();++i)
|
||||||
|
{
|
||||||
|
const face& bf = bFaces[pFaces[i]];
|
||||||
|
const edge e = bf.faceEdge(bf.which(iter->first));
|
||||||
|
|
||||||
|
for(label j=i+1;j<pFaces.size();++j)
|
||||||
|
{
|
||||||
|
const face& obf = bFaces[pFaces[j]];
|
||||||
|
if(
|
||||||
|
(obf.which(e.start()) >= 0) &&
|
||||||
|
(obf.which(e.end()) >= 0)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label add = pFaces[i+1];
|
||||||
|
pFaces[i+1] = pFaces[j];
|
||||||
|
pFaces[j] = add;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DynList<label, 3> patchIDs;
|
||||||
|
forAll(pFaces, patchI)
|
||||||
|
{
|
||||||
|
patchIDs.appendIfNotIn(boundaryFacePatches[pFaces[patchI]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodePatches.insert(std::make_pair(iter->first, patchIDs));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create layer cells for corner nodes
|
||||||
|
forAllIter(ppType, nodePatches, iter)
|
||||||
|
{
|
||||||
|
const DynList<label, 3>& patchIDs = iter->second;
|
||||||
|
DynList<label, 3> pKeys;
|
||||||
|
forAll(patchIDs, patchI)
|
||||||
|
{
|
||||||
|
const label pKey = patchKey_[patchIDs[patchI]];
|
||||||
|
|
||||||
|
if( pKey < 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pKeys.appendIfNotIn(pKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pKeys.size() != 3 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Pout << "Creating corner cell at point " << iter->first << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
FixedList<FixedList<label, 4>, 6> cellFaces;
|
||||||
|
createNewCellFromNode(iter->first, pKeys, cellFaces);
|
||||||
|
|
||||||
|
//- store boundary faces
|
||||||
|
newBoundaryFaces.appendList(cellFaces[1]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(patchIDs[0]);
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(cellFaces[3]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(patchIDs[1]);
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(cellFaces[5]);
|
||||||
|
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
|
||||||
|
newBoundaryPatches.append(patchIDs[2]);
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
if( procPoint[iter->first] )
|
||||||
|
{
|
||||||
|
pointProcFaces.append(cellFaces[0]);
|
||||||
|
faceAtPatches.append(labelPair(patchIDs[1], patchIDs[2]));
|
||||||
|
|
||||||
|
pointProcFaces.append(cellFaces[2]);
|
||||||
|
faceAtPatches.append(labelPair(patchIDs[0], patchIDs[2]));
|
||||||
|
|
||||||
|
pointProcFaces.append(cellFaces[4]);
|
||||||
|
faceAtPatches.append(labelPair(patchIDs[0], patchIDs[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Info << "Adding corner cell " << cellFaces << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//- append cell to the queue
|
||||||
|
cellsToAdd.appendGraph(cellFaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
//- create faces at parallel boundaries created from
|
||||||
|
//- points at parallel boundaries
|
||||||
|
createNewFacesFromPointsParallel
|
||||||
|
(
|
||||||
|
pointProcFaces,
|
||||||
|
faceAtPatches
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create mesh modifier
|
||||||
|
polyMeshGenModifier meshModifier(mesh_);
|
||||||
|
|
||||||
|
meshModifier.addCells(cellsToAdd);
|
||||||
|
|
||||||
|
cellsToAdd.clear();
|
||||||
|
meshModifier.reorderBoundaryFaces();
|
||||||
|
meshModifier.replaceBoundary
|
||||||
|
(
|
||||||
|
patchNames_,
|
||||||
|
newBoundaryFaces,
|
||||||
|
newBoundaryOwners,
|
||||||
|
newBoundaryPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- delete meshSurfaceEngine
|
||||||
|
this->clearOut();
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
mesh_.addressingData().checkMesh(true);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
Info << "Finished creating layer cells" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::createNewFacesFromPointsParallel
|
||||||
|
(
|
||||||
|
const LongList<DynList<label, 4> >& faceCandidates,
|
||||||
|
const LongList<labelPair>& candidatePatches
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const meshSurfaceEngine& mse = this->surfaceEngine();
|
||||||
|
const labelList& bPoints = mse.boundaryPoints();
|
||||||
|
const labelList& bp = mse.bp();
|
||||||
|
const VRWGraph& bpAtProcs = mse.bpAtProcs();
|
||||||
|
const labelList& globalPointLabel = mse.globalBoundaryPointLabel();
|
||||||
|
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
|
||||||
|
|
||||||
|
labelList otherFaceProc(faceCandidates.size(), -1);
|
||||||
|
//- some faces may appear more than once
|
||||||
|
//- such faces are ordinary internal faces
|
||||||
|
VRWGraph pointFaceCandidates(nPoints_);
|
||||||
|
forAll(faceCandidates, fI)
|
||||||
|
{
|
||||||
|
forAll(faceCandidates[fI], pI)
|
||||||
|
pointFaceCandidates.append(faceCandidates[fI][pI], fI);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolList duplicateFace(faceCandidates.size(), false);
|
||||||
|
List<labelledPair> pointOfOrigin(faceCandidates.size());
|
||||||
|
std::map<labelledPair, label> pointOfOriginToFaceLabel;
|
||||||
|
forAll(faceCandidates, fI)
|
||||||
|
{
|
||||||
|
const DynList<label, 4>& f = faceCandidates[fI];
|
||||||
|
|
||||||
|
const label pointI = f[0];
|
||||||
|
|
||||||
|
const labelledPair lp
|
||||||
|
(
|
||||||
|
globalPointLabel[bp[pointI]],
|
||||||
|
Pair<label>
|
||||||
|
(
|
||||||
|
patchKey_[candidatePatches[fI][0]],
|
||||||
|
patchKey_[candidatePatches[fI][1]]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if(
|
||||||
|
pointOfOriginToFaceLabel.find(lp) != pointOfOriginToFaceLabel.end()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
duplicateFace[fI] = true;
|
||||||
|
pointOfOrigin[fI] = lp;
|
||||||
|
duplicateFace[pointOfOriginToFaceLabel[lp]] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointOfOrigin[fI] = lp;
|
||||||
|
|
||||||
|
pointOfOriginToFaceLabel.insert(std::make_pair(lp, fI));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- find the processor patch for each processor boundary face
|
||||||
|
//- the key of the algorithm is the point from which the face was created
|
||||||
|
//- by sending the point label and the associated patches, it will be
|
||||||
|
//- possible to find the other processor containing that face
|
||||||
|
std::map<label, LongList<labelledPair> > exchangeData;
|
||||||
|
const DynList<label>& neiProcs = mse.bpNeiProcs();
|
||||||
|
forAll(neiProcs, procI)
|
||||||
|
{
|
||||||
|
const label neiProcI = neiProcs[procI];
|
||||||
|
|
||||||
|
if( neiProcI == Pstream::myProcNo() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( exchangeData.find(neiProcI) == exchangeData.end() )
|
||||||
|
exchangeData.insert
|
||||||
|
(
|
||||||
|
std::make_pair(neiProcI, LongList<labelledPair>())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(faceCandidates, fI)
|
||||||
|
{
|
||||||
|
if( duplicateFace[fI] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const label bpI = bp[faceCandidates[fI][0]];
|
||||||
|
|
||||||
|
forAllRow(bpAtProcs, bpI, procI)
|
||||||
|
{
|
||||||
|
const label neiProcNo = bpAtProcs(bpI, procI);
|
||||||
|
if( neiProcNo == Pstream::myProcNo() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
LongList<labelledPair>& dataToSend = exchangeData[neiProcNo];
|
||||||
|
dataToSend.append(pointOfOrigin[fI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- exchange the data with other processors
|
||||||
|
std::map<label, List<labelledPair> > receivedMap;
|
||||||
|
help::exchangeMap(exchangeData, receivedMap);
|
||||||
|
exchangeData.clear();
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
std::map<label, List<labelledPair> >::const_iterator
|
||||||
|
iter=receivedMap.begin();
|
||||||
|
iter!=receivedMap.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const List<labelledPair>& receivedData = iter->second;
|
||||||
|
|
||||||
|
forAll(receivedData, i)
|
||||||
|
{
|
||||||
|
const labelledPair& lpp = receivedData[i];
|
||||||
|
const label gpI = lpp.pairLabel();
|
||||||
|
const label pointI = bPoints[globalToLocal[gpI]];
|
||||||
|
const labelPair& lp = lpp.pair();
|
||||||
|
|
||||||
|
forAllRow(pointFaceCandidates, pointI, i)
|
||||||
|
{
|
||||||
|
const label fI = pointFaceCandidates(pointI, i);
|
||||||
|
const DynList<label, 4>& f = faceCandidates[fI];
|
||||||
|
|
||||||
|
const labelPair pk
|
||||||
|
(
|
||||||
|
patchKey_[candidatePatches[fI][0]],
|
||||||
|
patchKey_[candidatePatches[fI][1]]
|
||||||
|
);
|
||||||
|
|
||||||
|
const labelPair rpk
|
||||||
|
(
|
||||||
|
patchKey_[candidatePatches[fI][1]],
|
||||||
|
patchKey_[candidatePatches[fI][0]]
|
||||||
|
);
|
||||||
|
|
||||||
|
if(
|
||||||
|
(f[0] == pointI) && ((pk == lp) || (rpk == lp))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//- found the processor containing other face
|
||||||
|
otherFaceProc[pointOfOriginToFaceLabel[lpp]] = iter->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
receivedMap.clear();
|
||||||
|
|
||||||
|
//- sort the points in ascending order
|
||||||
|
//- this ensures the correct order of faces at the processor boundaries
|
||||||
|
sort(pointOfOrigin);
|
||||||
|
|
||||||
|
Map<label> otherProcToProcPatch;
|
||||||
|
forAll(mesh_.procBoundaries(), patchI)
|
||||||
|
{
|
||||||
|
const processorBoundaryPatch& wp = mesh_.procBoundaries()[patchI];
|
||||||
|
otherProcToProcPatch.insert(wp.neiProcNo(), patchI);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- store processor faces
|
||||||
|
VRWGraph newProcFaces;
|
||||||
|
labelLongList newProc;
|
||||||
|
|
||||||
|
forAll(pointOfOrigin, i)
|
||||||
|
{
|
||||||
|
const label fI = pointOfOriginToFaceLabel[pointOfOrigin[i]];
|
||||||
|
|
||||||
|
if( duplicateFace[fI] || (otherFaceProc[fI] == -1) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( !otherProcToProcPatch.found(otherFaceProc[fI]) )
|
||||||
|
{
|
||||||
|
otherProcToProcPatch.insert
|
||||||
|
(
|
||||||
|
otherFaceProc[fI],
|
||||||
|
polyMeshGenModifier(mesh_).addProcessorPatch
|
||||||
|
(
|
||||||
|
otherFaceProc[fI]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
newProcFaces.appendList(faceCandidates[fI]);
|
||||||
|
newProc.append(otherProcToProcPatch[otherFaceProc[fI]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
polyMeshGenModifier(mesh_).addProcessorFaces(newProcFaces, newProc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,645 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "helperFunctions.H"
|
||||||
|
#include "helperFunctionsPar.H"
|
||||||
|
#include "meshSurfaceCheckInvertedVertices.H"
|
||||||
|
#include "meshSurfacePartitioner.H"
|
||||||
|
#include "polyMeshGen2DEngine.H"
|
||||||
|
|
||||||
|
#include "labelledPoint.H"
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
# ifdef USE_OMP
|
||||||
|
#include <omp.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
//#define DEBUGLayer
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const meshSurfaceEngine& boundaryLayers::surfaceEngine() const
|
||||||
|
{
|
||||||
|
if( !msePtr_ )
|
||||||
|
msePtr_ = new meshSurfaceEngine(mesh_);
|
||||||
|
|
||||||
|
return *msePtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const meshSurfacePartitioner& boundaryLayers::surfacePartitioner() const
|
||||||
|
{
|
||||||
|
if( !meshPartitionerPtr_ )
|
||||||
|
meshPartitionerPtr_ = new meshSurfacePartitioner(surfaceEngine());
|
||||||
|
|
||||||
|
return *meshPartitionerPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::findPatchesToBeTreatedTogether()
|
||||||
|
{
|
||||||
|
if( geometryAnalysed_ )
|
||||||
|
return;
|
||||||
|
|
||||||
|
forAll(treatPatchesWithPatch_, patchI)
|
||||||
|
treatPatchesWithPatch_[patchI].append(patchI);
|
||||||
|
|
||||||
|
const meshSurfaceEngine& mse = surfaceEngine();
|
||||||
|
|
||||||
|
const pointFieldPMG& points = mesh_.points();
|
||||||
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
const edgeList& edges = mse.edges();
|
||||||
|
const VRWGraph& eFaces = mse.edgeFaces();
|
||||||
|
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
|
||||||
|
|
||||||
|
const meshSurfacePartitioner& mPart = surfacePartitioner();
|
||||||
|
const VRWGraph& pPatches = mPart.pointPatches();
|
||||||
|
|
||||||
|
//- patches must be treated together if there exist a corner where
|
||||||
|
//- more than three patches meet
|
||||||
|
const labelHashSet& corners = mPart.corners();
|
||||||
|
forAllConstIter(labelHashSet, corners, it)
|
||||||
|
{
|
||||||
|
const label bpI = it.key();
|
||||||
|
|
||||||
|
if( mPart.numberOfFeatureEdgesAtPoint(bpI) != 3 )
|
||||||
|
{
|
||||||
|
labelHashSet commonPatches;
|
||||||
|
DynList<label> allPatches;
|
||||||
|
|
||||||
|
forAllRow(pPatches, bpI, patchI)
|
||||||
|
{
|
||||||
|
const DynList<label>& tpwp =
|
||||||
|
treatPatchesWithPatch_[pPatches(bpI, patchI)];
|
||||||
|
|
||||||
|
forAll(tpwp, pJ)
|
||||||
|
{
|
||||||
|
if( commonPatches.found(tpwp[pJ]) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
commonPatches.insert(tpwp[pJ]);
|
||||||
|
allPatches.append(tpwp[pJ]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAllRow(pPatches, bpI, patchI)
|
||||||
|
treatPatchesWithPatch_[pPatches(bpI, patchI)] = allPatches;
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Info << "Corner " << bpI << " is shared by patches "
|
||||||
|
<< pPatches[bpI] << endl;
|
||||||
|
Info << "All patches " << allPatches << endl;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- patches must be treated together for concave geometries
|
||||||
|
//- edgeClassification map counts the number of convex and concave edges
|
||||||
|
//- for a given patch. The first counts convex edges and the second counts
|
||||||
|
//- concave ones. If the number of concave edges is of the considerable
|
||||||
|
//- percentage, it is treated as O-topology
|
||||||
|
meshSurfaceCheckInvertedVertices vertexCheck(mse);
|
||||||
|
const labelHashSet& invertedVertices = vertexCheck.invertedVertices();
|
||||||
|
|
||||||
|
std::map<std::pair<label, label>, Pair<label> > edgeClassification;
|
||||||
|
labelLongList procEdges;
|
||||||
|
forAll(eFaces, eI)
|
||||||
|
{
|
||||||
|
if( eFaces.sizeOfRow(eI) != 2 )
|
||||||
|
{
|
||||||
|
procEdges.append(eI);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- check if the any of the face vertices is tangled
|
||||||
|
const edge& e = edges[eI];
|
||||||
|
if( invertedVertices.found(e[0]) || invertedVertices.found(e[1]) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const label patch0 = boundaryFacePatches[eFaces(eI, 0)];
|
||||||
|
const label patch1 = boundaryFacePatches[eFaces(eI, 1)];
|
||||||
|
if( patch0 != patch1 )
|
||||||
|
{
|
||||||
|
std::pair<label, label> pp
|
||||||
|
(
|
||||||
|
Foam::min(patch0, patch1),
|
||||||
|
Foam::max(patch0, patch1)
|
||||||
|
);
|
||||||
|
if( edgeClassification.find(pp) == edgeClassification.end() )
|
||||||
|
edgeClassification.insert
|
||||||
|
(
|
||||||
|
std::make_pair(pp, Pair<label>(0, 0))
|
||||||
|
);
|
||||||
|
|
||||||
|
const face& f1 = bFaces[eFaces(eI, 0)];
|
||||||
|
const face& f2 = bFaces[eFaces(eI, 1)];
|
||||||
|
if( !help::isSharedEdgeConvex(points, f1, f2) )
|
||||||
|
{
|
||||||
|
++edgeClassification[pp].second();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++edgeClassification[pp].first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
//- check faces over processor edges
|
||||||
|
const labelList& globalEdgeLabel = mse.globalBoundaryEdgeLabel();
|
||||||
|
const VRWGraph& beAtProcs = mse.beAtProcs();
|
||||||
|
const Map<label>& globalToLocal = mse.globalToLocalBndEdgeAddressing();
|
||||||
|
|
||||||
|
const DynList<label>& neiProcs = mse.beNeiProcs();
|
||||||
|
const Map<label>& otherProcPatches = mse.otherEdgeFacePatch();
|
||||||
|
const Map<label>& otherFaceProc = mse.otherEdgeFaceAtProc();
|
||||||
|
|
||||||
|
//- send faces sharing processor edges to other processors
|
||||||
|
//- faces are flattened into a single contiguous array
|
||||||
|
const labelList& bp = mse.bp();
|
||||||
|
const labelList& globalPointLabel = mse.globalBoundaryPointLabel();
|
||||||
|
const Map<label>& globalPointToLocal =
|
||||||
|
mse.globalToLocalBndPointAddressing();
|
||||||
|
|
||||||
|
std::map<label, LongList<labelledPoint> > exchangePoints;
|
||||||
|
forAll(neiProcs, procI)
|
||||||
|
{
|
||||||
|
exchangePoints.insert
|
||||||
|
(
|
||||||
|
std::make_pair(neiProcs[procI], LongList<labelledPoint>())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- store faces for sending
|
||||||
|
forAll(procEdges, eI)
|
||||||
|
{
|
||||||
|
const label beI = procEdges[eI];
|
||||||
|
if( eFaces.sizeOfRow(beI) == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const edge& e = edges[beI];
|
||||||
|
if( invertedVertices.found(e[0]) || invertedVertices.found(e[1]) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- do not send data if the face on other processor
|
||||||
|
//- is in the same patch
|
||||||
|
if( otherProcPatches[beI] == boundaryFacePatches[eFaces(beI, 0)] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const face& f = bFaces[eFaces(beI, 0)];
|
||||||
|
|
||||||
|
forAllRow(beAtProcs, beI, procI)
|
||||||
|
{
|
||||||
|
const label neiProc = beAtProcs(beI, procI);
|
||||||
|
if( neiProc == Pstream::myProcNo() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- each face is sent as follows
|
||||||
|
//- 1. global edge label
|
||||||
|
//- 2. number of face nodes
|
||||||
|
//- 3. faces nodes and vertex coordinates
|
||||||
|
LongList<labelledPoint>& dps = exchangePoints[neiProc];
|
||||||
|
dps.append(labelledPoint(globalEdgeLabel[beI], point()));
|
||||||
|
dps.append(labelledPoint(f.size(), point()));
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
dps.append
|
||||||
|
(
|
||||||
|
labelledPoint
|
||||||
|
(
|
||||||
|
globalPointLabel[bp[f[pI]]],
|
||||||
|
points[f[pI]]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LongList<labelledPoint> receivedData;
|
||||||
|
help::exchangeMap(exchangePoints, receivedData);
|
||||||
|
|
||||||
|
//- receive faces from other processors
|
||||||
|
Map<label> transferredPointToLocal;
|
||||||
|
|
||||||
|
label counter(0);
|
||||||
|
while( counter < receivedData.size() )
|
||||||
|
{
|
||||||
|
const label beI =
|
||||||
|
globalToLocal[receivedData[counter++].pointLabel()];
|
||||||
|
face f(receivedData[counter++].pointLabel());
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
const labelledPoint& lp = receivedData[counter++];
|
||||||
|
if( globalPointToLocal.found(lp.pointLabel()) )
|
||||||
|
{
|
||||||
|
//- this point already exist on this processor
|
||||||
|
f[pI] = globalPointToLocal[lp.pointLabel()];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//- this point does not exist on this processor
|
||||||
|
//- add it to the local list of points
|
||||||
|
//- it will be deleted when this procedure is finished
|
||||||
|
if( !transferredPointToLocal.found(lp.pointLabel()) )
|
||||||
|
{
|
||||||
|
//- this point has not yet been received
|
||||||
|
transferredPointToLocal.insert
|
||||||
|
(
|
||||||
|
lp.pointLabel(),
|
||||||
|
points.size()
|
||||||
|
);
|
||||||
|
mesh_.points().append(lp.coordinates());
|
||||||
|
}
|
||||||
|
|
||||||
|
f[pI] = transferredPointToLocal[lp.pointLabel()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const label patch0 = boundaryFacePatches[eFaces(beI, 0)];
|
||||||
|
const label patch1 = otherProcPatches[beI];
|
||||||
|
|
||||||
|
std::pair<label, label> pp
|
||||||
|
(
|
||||||
|
Foam::min(patch0, patch1),
|
||||||
|
Foam::max(patch0, patch1)
|
||||||
|
);
|
||||||
|
if( edgeClassification.find(pp) == edgeClassification.end() )
|
||||||
|
edgeClassification.insert
|
||||||
|
(
|
||||||
|
std::make_pair(pp, Pair<label>(0, 0))
|
||||||
|
);
|
||||||
|
|
||||||
|
if(
|
||||||
|
(otherFaceProc[beI] > Pstream::myProcNo()) &&
|
||||||
|
!help::isSharedEdgeConvex(points, bFaces[eFaces(beI, 0)], f)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++edgeClassification[pp].second();
|
||||||
|
}
|
||||||
|
else if( otherFaceProc[beI] > Pstream::myProcNo() )
|
||||||
|
{
|
||||||
|
++edgeClassification[pp].first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- set the size of points back to their original number
|
||||||
|
mesh_.points().setSize(nPoints_);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<std::pair<label, label>, Pair<label> >::const_iterator it;
|
||||||
|
for(it=edgeClassification.begin();it!=edgeClassification.end();++it)
|
||||||
|
{
|
||||||
|
const std::pair<label, label>& edgePair = it->first;
|
||||||
|
const Pair<label>& nConvexAndConcave = it->second;
|
||||||
|
|
||||||
|
if( nConvexAndConcave.second() != 0 )
|
||||||
|
{
|
||||||
|
//- number of concave edges is greater than the number
|
||||||
|
//- of the convex ones. Treat patches together.
|
||||||
|
const label patch0 = edgePair.first;
|
||||||
|
const label patch1 = edgePair.second;
|
||||||
|
|
||||||
|
//- avoid adding unused patches in case of 2D meshing
|
||||||
|
if( treatedPatch_[patch0] || treatedPatch_[patch1] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
treatPatchesWithPatch_[patch0].append(patch1);
|
||||||
|
treatPatchesWithPatch_[patch1].append(patch0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
//- make sure that all processors have the same graph
|
||||||
|
labelLongList flattenedPatches;
|
||||||
|
forAll(treatPatchesWithPatch_, patchI)
|
||||||
|
{
|
||||||
|
if( treatPatchesWithPatch_[patchI].size() <= 1 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
flattenedPatches.append(patchI);
|
||||||
|
flattenedPatches.append(treatPatchesWithPatch_[patchI].size());
|
||||||
|
forAll(treatPatchesWithPatch_[patchI], itemI)
|
||||||
|
flattenedPatches.append(treatPatchesWithPatch_[patchI][itemI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
labelListList procPatches(Pstream::nProcs());
|
||||||
|
procPatches[Pstream::myProcNo()].setSize(flattenedPatches.size());
|
||||||
|
forAll(flattenedPatches, i)
|
||||||
|
procPatches[Pstream::myProcNo()][i] = flattenedPatches[i];
|
||||||
|
Pstream::gatherList(procPatches);
|
||||||
|
Pstream::scatterList(procPatches);
|
||||||
|
|
||||||
|
forAll(procPatches, procI)
|
||||||
|
{
|
||||||
|
if( procI == Pstream::myProcNo() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const labelList& cPatches = procPatches[procI];
|
||||||
|
label counter(0);
|
||||||
|
|
||||||
|
while( counter < cPatches.size() )
|
||||||
|
{
|
||||||
|
const label patchI = cPatches[counter++];
|
||||||
|
const label size = cPatches[counter++];
|
||||||
|
for(label i=0;i<size;++i)
|
||||||
|
treatPatchesWithPatch_[patchI].appendIfNotIn
|
||||||
|
(
|
||||||
|
cPatches[counter++]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- final adjusting of patches which shall be treated together
|
||||||
|
boolList confirmed(treatPatchesWithPatch_.size(), false);
|
||||||
|
forAll(treatPatchesWithPatch_, patchI)
|
||||||
|
{
|
||||||
|
if( treatPatchesWithPatch_[patchI].size() <= 1 )
|
||||||
|
{
|
||||||
|
confirmed[patchI] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( confirmed[patchI] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::set<label> commonPatches;
|
||||||
|
commonPatches.insert(patchI);
|
||||||
|
|
||||||
|
DynList<label> front;
|
||||||
|
front.append(patchI);
|
||||||
|
confirmed[patchI] = true;
|
||||||
|
|
||||||
|
while( front.size() )
|
||||||
|
{
|
||||||
|
const label fPatch = front.removeLastElement();
|
||||||
|
|
||||||
|
forAll(treatPatchesWithPatch_[fPatch], i)
|
||||||
|
{
|
||||||
|
const label patchJ = treatPatchesWithPatch_[fPatch][i];
|
||||||
|
|
||||||
|
if( confirmed[patchJ] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
front.append(patchJ);
|
||||||
|
confirmed[patchJ] = true;
|
||||||
|
commonPatches.insert(patchJ);
|
||||||
|
forAll(treatPatchesWithPatch_[patchJ], j)
|
||||||
|
commonPatches.insert(treatPatchesWithPatch_[patchJ][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAllConstIter(std::set<label>, commonPatches, it)
|
||||||
|
{
|
||||||
|
const label patchJ = *it;
|
||||||
|
|
||||||
|
treatPatchesWithPatch_[patchJ].clear();
|
||||||
|
forAllConstIter(std::set<label>, commonPatches, iter)
|
||||||
|
treatPatchesWithPatch_[patchJ].append(*iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
for(it=edgeClassification.begin();it!=edgeClassification.end();++it)
|
||||||
|
{
|
||||||
|
const std::pair<label, label>& edgePair = it->first;
|
||||||
|
const Pair<label>& nConvexAndConcave = it->second;
|
||||||
|
Info << "Pair of patches " << edgePair.first << " "
|
||||||
|
<< edgePair.second << " is " << nConvexAndConcave << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "Patch names " << patchNames_ << endl;
|
||||||
|
Info << "Treat patches with patch " << treatPatchesWithPatch_ << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
geometryAnalysed_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::addLayerForPatch(const label patchLabel)
|
||||||
|
{
|
||||||
|
if( treatedPatch_[patchLabel] )
|
||||||
|
return;
|
||||||
|
|
||||||
|
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
|
||||||
|
|
||||||
|
if( returnReduce(boundaries[patchLabel].patchSize(), sumOp<label>()) == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
boolList treatPatches(boundaries.size(), false);
|
||||||
|
if( patchWiseLayers_ )
|
||||||
|
{
|
||||||
|
forAll(treatPatchesWithPatch_[patchLabel], pI)
|
||||||
|
treatPatches[treatPatchesWithPatch_[patchLabel][pI]] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(treatedPatch_, patchI)
|
||||||
|
if( !treatedPatch_[patchI] )
|
||||||
|
treatPatches[patchI] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
newLabelForVertex_.setSize(nPoints_);
|
||||||
|
newLabelForVertex_ = -1;
|
||||||
|
otherVrts_.clear();
|
||||||
|
patchKey_.clear();
|
||||||
|
|
||||||
|
createNewVertices(treatPatches);
|
||||||
|
|
||||||
|
createNewFacesAndCells(treatPatches);
|
||||||
|
|
||||||
|
forAll(treatPatches, patchI)
|
||||||
|
if( treatPatches[patchI] )
|
||||||
|
treatedPatch_[patchI] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from mesh reference
|
||||||
|
boundaryLayers::boundaryLayers
|
||||||
|
(
|
||||||
|
polyMeshGen& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mesh_(mesh),
|
||||||
|
msePtr_(NULL),
|
||||||
|
meshPartitionerPtr_(NULL),
|
||||||
|
patchWiseLayers_(true),
|
||||||
|
terminateLayersAtConcaveEdges_(false),
|
||||||
|
patchNames_(),
|
||||||
|
treatedPatch_(),
|
||||||
|
treatPatchesWithPatch_(),
|
||||||
|
newLabelForVertex_(),
|
||||||
|
otherVrts_(),
|
||||||
|
patchKey_(),
|
||||||
|
nPoints_(mesh.points().size()),
|
||||||
|
geometryAnalysed_(false)
|
||||||
|
{
|
||||||
|
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
|
||||||
|
patchNames_.setSize(boundaries.size());
|
||||||
|
forAll(boundaries, patchI)
|
||||||
|
patchNames_[patchI] = boundaries[patchI].patchName();
|
||||||
|
|
||||||
|
treatedPatch_.setSize(boundaries.size());
|
||||||
|
treatedPatch_ = false;
|
||||||
|
|
||||||
|
treatPatchesWithPatch_.setSize(boundaries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
boundaryLayers::~boundaryLayers()
|
||||||
|
{
|
||||||
|
clearOut();
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
polyMeshGenModifier(mesh_).removeUnusedVertices();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void boundaryLayers::addLayerForPatch(const word& patchName)
|
||||||
|
{
|
||||||
|
if( !geometryAnalysed_ )
|
||||||
|
findPatchesToBeTreatedTogether();
|
||||||
|
|
||||||
|
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
|
||||||
|
|
||||||
|
forAll(boundaries, patchI)
|
||||||
|
if( boundaries[patchI].patchName() == patchName )
|
||||||
|
addLayerForPatch(patchI);
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::createOTopologyLayers()
|
||||||
|
{
|
||||||
|
patchWiseLayers_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::terminateLayersAtConcaveEdges()
|
||||||
|
{
|
||||||
|
terminateLayersAtConcaveEdges_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::activate2DMode()
|
||||||
|
{
|
||||||
|
polyMeshGen2DEngine mesh2DEngine(mesh_);
|
||||||
|
const boolList& zMinPoint = mesh2DEngine.zMinPoints();
|
||||||
|
const boolList& zMaxPoint = mesh2DEngine.zMaxPoints();
|
||||||
|
|
||||||
|
const faceList::subList& bFaces = surfaceEngine().boundaryFaces();
|
||||||
|
const labelList& facePatch = surfaceEngine().boundaryFacePatches();
|
||||||
|
|
||||||
|
boolList allZMax(mesh_.boundaries().size(), true);
|
||||||
|
boolList allZMin(mesh_.boundaries().size(), true);
|
||||||
|
|
||||||
|
# ifdef USE_OMP
|
||||||
|
# pragma omp parallel for schedule(dynamic, 50)
|
||||||
|
# endif
|
||||||
|
forAll(bFaces, bfI)
|
||||||
|
{
|
||||||
|
const face& bf = bFaces[bfI];
|
||||||
|
|
||||||
|
forAll(bf, pI)
|
||||||
|
{
|
||||||
|
if( !zMinPoint[bf[pI]] )
|
||||||
|
allZMin[facePatch[bfI]] = false;
|
||||||
|
if( !zMaxPoint[bf[pI]] )
|
||||||
|
allZMax[facePatch[bfI]] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- mark empty patches as already used
|
||||||
|
forAll(allZMin, patchI)
|
||||||
|
{
|
||||||
|
if( allZMin[patchI] ^ allZMax[patchI] )
|
||||||
|
{
|
||||||
|
treatedPatch_[patchI] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(treatPatchesWithPatch_, patchI)
|
||||||
|
{
|
||||||
|
DynList<label>& patches = treatPatchesWithPatch_[patchI];
|
||||||
|
|
||||||
|
for(label i=patches.size()-1;i>=0;--i)
|
||||||
|
if( treatedPatch_[patches[i]] )
|
||||||
|
patches.removeElement(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::addLayerForAllPatches()
|
||||||
|
{
|
||||||
|
if( !geometryAnalysed_ )
|
||||||
|
findPatchesToBeTreatedTogether();
|
||||||
|
|
||||||
|
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
|
||||||
|
|
||||||
|
if( !patchWiseLayers_ )
|
||||||
|
{
|
||||||
|
forAll(boundaries, patchI)
|
||||||
|
addLayerForPatch(patchI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newLabelForVertex_.setSize(nPoints_);
|
||||||
|
newLabelForVertex_ = -1;
|
||||||
|
otherVrts_.clear();
|
||||||
|
patchKey_.clear();
|
||||||
|
|
||||||
|
//- avoid generating bnd layer at empty patches in case of 2D meshing
|
||||||
|
label counter(0);
|
||||||
|
forAll(treatedPatch_, patchI)
|
||||||
|
if( !treatedPatch_[patchI] )
|
||||||
|
++counter;
|
||||||
|
|
||||||
|
labelList treatedPatches(counter);
|
||||||
|
counter = 0;
|
||||||
|
forAll(treatedPatch_, i)
|
||||||
|
if( !treatedPatch_[i] )
|
||||||
|
treatedPatches[counter++] = i;
|
||||||
|
|
||||||
|
//- create bnd layer vertices
|
||||||
|
createNewVertices(treatedPatches);
|
||||||
|
|
||||||
|
//- create bnd layer cells
|
||||||
|
createLayerCells(treatedPatches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,287 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
boundaryLayers
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates boundary layers
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
boundaryLayers.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef boundaryLayers_H
|
||||||
|
#define boundaryLayers_H
|
||||||
|
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "meshSurfacePartitioner.H"
|
||||||
|
#include "DynList.H"
|
||||||
|
#include "labelLongList.H"
|
||||||
|
#include "Map.H"
|
||||||
|
#include "labelPair.H"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class meshSurfaceEngine;
|
||||||
|
class meshSurfacePartitioner;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class boundaryLayers Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class boundaryLayers
|
||||||
|
{
|
||||||
|
//- Reference to the mesh
|
||||||
|
polyMeshGen& mesh_;
|
||||||
|
|
||||||
|
//- pointer to mesh surface engine
|
||||||
|
mutable meshSurfaceEngine* msePtr_;
|
||||||
|
|
||||||
|
//- poiner to meshSurfacePartitioner
|
||||||
|
mutable meshSurfacePartitioner* meshPartitionerPtr_;
|
||||||
|
|
||||||
|
//- shall I create patch-wise layers (true)
|
||||||
|
//- O-topology layer (false)
|
||||||
|
bool patchWiseLayers_;
|
||||||
|
|
||||||
|
//- shall the layers be terminated at concave edges (true)
|
||||||
|
bool terminateLayersAtConcaveEdges_;
|
||||||
|
|
||||||
|
//- patch names
|
||||||
|
wordList patchNames_;
|
||||||
|
|
||||||
|
//- helper which contains information if a boundary layer
|
||||||
|
//- has already been extruded for a given patch
|
||||||
|
boolList treatedPatch_;
|
||||||
|
|
||||||
|
//- extrude patches with patch
|
||||||
|
List<DynList<label> > treatPatchesWithPatch_;
|
||||||
|
|
||||||
|
//- label of a new node (helper)
|
||||||
|
labelLongList newLabelForVertex_;
|
||||||
|
|
||||||
|
//- map storing labels of new vertices created at node
|
||||||
|
//- and corner vertices
|
||||||
|
std::map<label, std::map<std::pair<label, label>, label> > otherVrts_;
|
||||||
|
|
||||||
|
//- a key assigned to each patch. It is needed to search in otherVrts_
|
||||||
|
labelList patchKey_;
|
||||||
|
|
||||||
|
//- number of vertices in the mesh
|
||||||
|
label nPoints_;
|
||||||
|
|
||||||
|
//- has the geometry been analysed
|
||||||
|
bool geometryAnalysed_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- Return const reference to meshSurfaceEngine
|
||||||
|
const meshSurfaceEngine& surfaceEngine() const;
|
||||||
|
|
||||||
|
//- return const reference to meshSurfacePartitioner
|
||||||
|
const meshSurfacePartitioner& surfacePartitioner() const;
|
||||||
|
|
||||||
|
//- find if any other patches need to be treated together
|
||||||
|
//- with the given one
|
||||||
|
void findPatchesToBeTreatedTogether();
|
||||||
|
|
||||||
|
//- find vertices of the selected patches
|
||||||
|
void findPatchVertices
|
||||||
|
(
|
||||||
|
const boolList& treatPatches,
|
||||||
|
List<direction>& patchVertex
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- check and correct the topology of boundary faces where
|
||||||
|
//- the layers terminate
|
||||||
|
void checkTopologyOfBoundaryFaces(const labelList& patchLabels);
|
||||||
|
|
||||||
|
//- create new vertex
|
||||||
|
point createNewVertex
|
||||||
|
(
|
||||||
|
const label bpI,
|
||||||
|
const boolList& treatPatches,
|
||||||
|
const List<direction>& pVertices
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- create new vertices for the selected patches
|
||||||
|
void createNewVertices
|
||||||
|
(
|
||||||
|
const boolList& treatPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- create new vertices such that layers for selected patches
|
||||||
|
//- are generated in a single run
|
||||||
|
void createNewVertices
|
||||||
|
(
|
||||||
|
const labelList& patchLabels
|
||||||
|
);
|
||||||
|
|
||||||
|
//- creates new vertices for vertices at parallel boundaries
|
||||||
|
void createNewPartitionVerticesParallel
|
||||||
|
(
|
||||||
|
const labelLongList& procPoints,
|
||||||
|
const List<direction>& pVertices,
|
||||||
|
const boolList& treatPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- creates new vertices from vertices at parallel boundaries
|
||||||
|
//- which are also at the border of the treated partitions
|
||||||
|
void createNewEdgeVerticesParallel
|
||||||
|
(
|
||||||
|
const labelLongList& procPoints,
|
||||||
|
const List<direction>& pVertices,
|
||||||
|
const boolList& treatPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- create a layer of cells
|
||||||
|
void createNewFacesAndCells
|
||||||
|
(
|
||||||
|
const boolList& treatPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- create new faces at parallel boundaries
|
||||||
|
//- faces are extruded from edges
|
||||||
|
void createNewFacesParallel
|
||||||
|
(
|
||||||
|
const boolList& treatPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- create new faces at parallel boundaries
|
||||||
|
//- faces are created from points at parallel boundaries
|
||||||
|
//- the function takes a reference to the faces which are the candidates
|
||||||
|
//- to create faces at parallel boundaries
|
||||||
|
void createNewFacesFromPointsParallel
|
||||||
|
(
|
||||||
|
const LongList<DynList<label, 4> >& faceCandidates,
|
||||||
|
const LongList<labelPair>& candidatePatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- create layer cells in one go
|
||||||
|
//- this is much faster than layer by layer
|
||||||
|
void createLayerCells(const labelList& patchLabels);
|
||||||
|
|
||||||
|
//- helper function finding a new face label for multiply extruded nodes
|
||||||
|
inline label findNewNodeLabel
|
||||||
|
(
|
||||||
|
const label pointI,
|
||||||
|
const label pKey
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- creating hex cells near feature edges
|
||||||
|
inline void createNewCellFromEdge
|
||||||
|
(
|
||||||
|
const edge& e,
|
||||||
|
const label pKeyI,
|
||||||
|
const label pKeyJ,
|
||||||
|
FixedList<FixedList<label, 4>, 6>& cellFaces
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- creating hex cells near corners
|
||||||
|
inline void createNewCellFromNode
|
||||||
|
(
|
||||||
|
const label pointI,
|
||||||
|
const DynList<label, 3>& pKeys,
|
||||||
|
FixedList<FixedList<label, 4>, 6>& cellFaces
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- create a bnd layer for a given patch
|
||||||
|
void addLayerForPatch(const label patchLabel);
|
||||||
|
|
||||||
|
//- delete meshSurfaceEngine
|
||||||
|
inline void clearOut()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(msePtr_);
|
||||||
|
deleteDemandDrivenData(meshPartitionerPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enumerators
|
||||||
|
enum vertexTypes
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
PATCHNODE = 1,
|
||||||
|
EDGENODE = 2,
|
||||||
|
CORNERNODE = 4,
|
||||||
|
PARALLELBOUNDARY = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Disallow bitwise copy construct
|
||||||
|
boundaryLayers(const boundaryLayers&);
|
||||||
|
|
||||||
|
//- Disallow bitwise assignment
|
||||||
|
void operator=(const boundaryLayers&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh reference
|
||||||
|
boundaryLayers(polyMeshGen& mesh);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~boundaryLayers();
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
//- adds layer for a given patch
|
||||||
|
void addLayerForPatch(const word& patchName);
|
||||||
|
|
||||||
|
//- create O-topology layers (used as flag)
|
||||||
|
void createOTopologyLayers();
|
||||||
|
|
||||||
|
//- terminate boundary layers at concave edges (used as a flag)
|
||||||
|
void terminateLayersAtConcaveEdges();
|
||||||
|
|
||||||
|
//- avoid generating layers for empty patches in case of a 2D mesh
|
||||||
|
//- used as a flag prior to addLayerForAllPatches
|
||||||
|
void activate2DMode();
|
||||||
|
|
||||||
|
//- add layers for all patches
|
||||||
|
void addLayerForAllPatches();
|
||||||
|
|
||||||
|
//- add wrapper layer
|
||||||
|
//- this function is intended for usage before surface recovery
|
||||||
|
void addWrapperLayer();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "boundaryLayersI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,274 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "decomposeCells.H"
|
||||||
|
#include "helperFunctions.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
//#define DEBUGLayer
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
|
||||||
|
{
|
||||||
|
if( !patchWiseLayers_ )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Info << "Checking topology of boundary faces" << endl;
|
||||||
|
|
||||||
|
labelHashSet usedPatches;
|
||||||
|
forAll(patchLabels, i)
|
||||||
|
usedPatches.insert(patchLabels[i]);
|
||||||
|
|
||||||
|
//- create a set of patch pairs. These are pairs at which the layers
|
||||||
|
//- shall be terminated
|
||||||
|
std::set<std::pair<label, label> > terminatedPairs;
|
||||||
|
forAll(treatPatchesWithPatch_, patchI)
|
||||||
|
{
|
||||||
|
const DynList<label>& otherPatches = treatPatchesWithPatch_[patchI];
|
||||||
|
|
||||||
|
forAll(otherPatches, patchJ)
|
||||||
|
{
|
||||||
|
if( patchI == otherPatches[patchJ] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
terminatedPairs.insert
|
||||||
|
(
|
||||||
|
std::make_pair
|
||||||
|
(
|
||||||
|
Foam::min(patchI, otherPatches[patchJ]),
|
||||||
|
Foam::max(patchI, otherPatches[patchJ])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool changed;
|
||||||
|
label nDecomposed(0);
|
||||||
|
boolList decomposeCell(mesh_.cells().size(), false);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
changed = false;
|
||||||
|
|
||||||
|
const meshSurfaceEngine& mse = this->surfaceEngine();
|
||||||
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
const labelList& faceOwner = mse.faceOwners();
|
||||||
|
const labelList& facePatches = mse.boundaryFacePatches();
|
||||||
|
const VRWGraph& faceEdges = mse.faceEdges();
|
||||||
|
const VRWGraph& edgeFaces = mse.edgeFaces();
|
||||||
|
|
||||||
|
const Map<label>& otherProcPatch = mse.otherEdgeFacePatch();
|
||||||
|
|
||||||
|
VRWGraph newBoundaryFaces;
|
||||||
|
labelLongList newBoundaryOwners;
|
||||||
|
labelLongList newBoundaryPatches;
|
||||||
|
|
||||||
|
forAll(bFaces, bfI)
|
||||||
|
{
|
||||||
|
const face& bf = bFaces[bfI];
|
||||||
|
const label fPatch = facePatches[bfI];
|
||||||
|
|
||||||
|
if( !usedPatches.found(fPatch) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- find patches of neighbour faces
|
||||||
|
labelList neiPatches(bf.size());
|
||||||
|
forAll(bf, eI)
|
||||||
|
{
|
||||||
|
const label beI = faceEdges(bfI, eI);
|
||||||
|
|
||||||
|
if( edgeFaces.sizeOfRow(beI) == 2 )
|
||||||
|
{
|
||||||
|
label neiFace = edgeFaces(beI, 0);
|
||||||
|
if( neiFace == bfI )
|
||||||
|
neiFace = edgeFaces(beI, 1);
|
||||||
|
|
||||||
|
neiPatches[eI] = facePatches[neiFace];
|
||||||
|
}
|
||||||
|
else if( edgeFaces.sizeOfRow(beI) == 1 )
|
||||||
|
{
|
||||||
|
//- edge is at a parallel boundary
|
||||||
|
neiPatches[eI] = otherProcPatch[beI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- find feature edges and check if the patches meeting there
|
||||||
|
//- shall be treated together.
|
||||||
|
bool storedFace(false);
|
||||||
|
forAll(neiPatches, eI)
|
||||||
|
{
|
||||||
|
if( neiPatches[eI] == fPatch )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::pair<label, label> pp
|
||||||
|
(
|
||||||
|
Foam::min(fPatch, neiPatches[eI]),
|
||||||
|
Foam::max(fPatch, neiPatches[eI])
|
||||||
|
);
|
||||||
|
|
||||||
|
if( terminatedPairs.find(pp) == terminatedPairs.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- create a new face from this edge and the neighbouring edges
|
||||||
|
bool usePrev(false), useNext(false);
|
||||||
|
if( neiPatches[neiPatches.rcIndex(eI)] == fPatch )
|
||||||
|
{
|
||||||
|
usePrev = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::pair<label, label> ppPrev
|
||||||
|
(
|
||||||
|
Foam::min(fPatch, neiPatches[neiPatches.rcIndex(eI)]),
|
||||||
|
Foam::max(fPatch, neiPatches[neiPatches.rcIndex(eI)])
|
||||||
|
);
|
||||||
|
|
||||||
|
if( terminatedPairs.find(ppPrev) == terminatedPairs.end() )
|
||||||
|
usePrev = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( neiPatches[neiPatches.fcIndex(eI)] == fPatch )
|
||||||
|
{
|
||||||
|
useNext = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::pair<label, label> ppNext
|
||||||
|
(
|
||||||
|
Foam::min(fPatch, neiPatches[neiPatches.fcIndex(eI)]),
|
||||||
|
Foam::max(fPatch, neiPatches[neiPatches.fcIndex(eI)])
|
||||||
|
);
|
||||||
|
|
||||||
|
if( terminatedPairs.find(ppNext) == terminatedPairs.end() )
|
||||||
|
useNext = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynList<edge> removeEdges;
|
||||||
|
if( useNext && usePrev )
|
||||||
|
{
|
||||||
|
removeEdges.setSize(3);
|
||||||
|
removeEdges[0] = bf.faceEdge(neiPatches.rcIndex(eI));
|
||||||
|
removeEdges[1] = bf.faceEdge(eI);
|
||||||
|
removeEdges[2] = bf.faceEdge(neiPatches.fcIndex(eI));
|
||||||
|
}
|
||||||
|
else if( useNext )
|
||||||
|
{
|
||||||
|
removeEdges.setSize(2);
|
||||||
|
removeEdges[0] = bf.faceEdge(neiPatches.fcIndex(eI));
|
||||||
|
removeEdges[1] = bf.faceEdge(eI);
|
||||||
|
}
|
||||||
|
else if( usePrev )
|
||||||
|
{
|
||||||
|
removeEdges.setSize(2);
|
||||||
|
removeEdges[0] = bf.faceEdge(neiPatches.rcIndex(eI));
|
||||||
|
removeEdges[1] = bf.faceEdge(eI);
|
||||||
|
}
|
||||||
|
|
||||||
|
const face cutFace = help::removeEdgesFromFace(bf, removeEdges);
|
||||||
|
if( cutFace.size() > 2 )
|
||||||
|
{
|
||||||
|
newBoundaryFaces.appendList(cutFace);
|
||||||
|
newBoundaryOwners.append(faceOwner[bfI]);
|
||||||
|
newBoundaryPatches.append(fPatch);
|
||||||
|
}
|
||||||
|
const face rFace = help::createFaceFromRemovedPart(bf, cutFace);
|
||||||
|
if( rFace.size() > 2 )
|
||||||
|
{
|
||||||
|
newBoundaryFaces.appendList(rFace);
|
||||||
|
newBoundaryOwners.append(faceOwner[bfI]);
|
||||||
|
newBoundaryPatches.append(fPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (cutFace.size() > 2) && (rFace.size() > 2) )
|
||||||
|
{
|
||||||
|
decomposeCell[faceOwner[bfI]] = true;
|
||||||
|
changed = true;
|
||||||
|
++nDecomposed;
|
||||||
|
}
|
||||||
|
|
||||||
|
storedFace = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !storedFace )
|
||||||
|
{
|
||||||
|
newBoundaryFaces.appendList(bf);
|
||||||
|
newBoundaryOwners.append(faceOwner[bfI]);
|
||||||
|
newBoundaryPatches.append(fPatch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Finally, replace the boundary faces
|
||||||
|
reduce(changed, maxOp<bool>());
|
||||||
|
|
||||||
|
if( changed )
|
||||||
|
{
|
||||||
|
polyMeshGenModifier(mesh_).replaceBoundary
|
||||||
|
(
|
||||||
|
patchNames_,
|
||||||
|
newBoundaryFaces,
|
||||||
|
newBoundaryOwners,
|
||||||
|
newBoundaryPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
} while( changed );
|
||||||
|
|
||||||
|
//- decompose owner cells adjacent to the decomposed faces
|
||||||
|
reduce(nDecomposed, sumOp<label>());
|
||||||
|
|
||||||
|
if( nDecomposed != 0 )
|
||||||
|
{
|
||||||
|
FatalError << "Critical. Not tested" << exit(FatalError);
|
||||||
|
decomposeCells dc(mesh_);
|
||||||
|
dc.decomposeMesh(decomposeCell);
|
||||||
|
|
||||||
|
clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh_.write();
|
||||||
|
Info << "Finished checking topology" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,328 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "helperFunctions.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
#include "VRWGraphList.H"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
//#define DEBUGLayer
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void boundaryLayers::createNewFacesAndCells(const boolList& treatPatches)
|
||||||
|
{
|
||||||
|
Info << "Starting creating layer cells" << endl;
|
||||||
|
|
||||||
|
const meshSurfaceEngine& mse = surfaceEngine();
|
||||||
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
const VRWGraph& faceEdges = mse.faceEdges();
|
||||||
|
const VRWGraph& edgeFaces = mse.edgeFaces();
|
||||||
|
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
|
||||||
|
const labelList& faceOwners = mse.faceOwners();
|
||||||
|
|
||||||
|
//- this is used for parallel runs
|
||||||
|
const Map<label>* otherProcPatchPtr(NULL);
|
||||||
|
|
||||||
|
if( Pstream::parRun() )
|
||||||
|
{
|
||||||
|
createNewFacesParallel(treatPatches);
|
||||||
|
|
||||||
|
otherProcPatchPtr = &mse.otherEdgeFacePatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create lists for new boundary faces
|
||||||
|
VRWGraph newBoundaryFaces;
|
||||||
|
labelLongList newBoundaryOwners;
|
||||||
|
labelLongList newBoundaryPatches;
|
||||||
|
|
||||||
|
//- create storage for new cells
|
||||||
|
VRWGraphList cellsToAdd;
|
||||||
|
|
||||||
|
//- create layer cells and store boundary faces
|
||||||
|
const label nOldCells = mesh_.cells().size();
|
||||||
|
forAll(bFaces, bfI)
|
||||||
|
if( treatPatches[boundaryFacePatches[bfI]] )
|
||||||
|
{
|
||||||
|
const face& f = bFaces[bfI];
|
||||||
|
|
||||||
|
faceList cellFaces(f.size() + 2);
|
||||||
|
|
||||||
|
label fI(0);
|
||||||
|
|
||||||
|
//- store boundary face
|
||||||
|
cellFaces[fI++] = f.reverseFace();
|
||||||
|
|
||||||
|
//- create parallel face
|
||||||
|
face newF(f.size());
|
||||||
|
forAll(f, pI)
|
||||||
|
newF[pI] = newLabelForVertex_[f[pI]];
|
||||||
|
cellFaces[fI++] = newF;
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(newF);
|
||||||
|
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
|
||||||
|
newBoundaryPatches.append(boundaryFacePatches[bfI]);
|
||||||
|
|
||||||
|
//- create quad faces
|
||||||
|
newF.setSize(4);
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
newF[0] = f[pI];
|
||||||
|
newF[1] = f.nextLabel(pI);
|
||||||
|
newF[2] = newLabelForVertex_[f.nextLabel(pI)];
|
||||||
|
newF[3] = newLabelForVertex_[f[pI]];
|
||||||
|
|
||||||
|
cellFaces[fI++] = newF;
|
||||||
|
|
||||||
|
//- check if the face is at the boundary
|
||||||
|
//- of the treated partitions
|
||||||
|
const label edgeI = faceEdges(bfI, pI);
|
||||||
|
if( edgeFaces.sizeOfRow(edgeI) == 2 )
|
||||||
|
{
|
||||||
|
label neiFace = edgeFaces(edgeI, 0);
|
||||||
|
if( neiFace == bfI )
|
||||||
|
neiFace = edgeFaces(edgeI, 1);
|
||||||
|
|
||||||
|
if( !treatPatches[boundaryFacePatches[neiFace]] )
|
||||||
|
{
|
||||||
|
newBoundaryFaces.appendList(newF);
|
||||||
|
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
|
||||||
|
newBoundaryPatches.append(boundaryFacePatches[neiFace]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( edgeFaces.sizeOfRow(edgeI) == 1 )
|
||||||
|
{
|
||||||
|
const Map<label>& otherProcPatch = *otherProcPatchPtr;
|
||||||
|
if( !treatPatches[otherProcPatch[edgeI]] )
|
||||||
|
{
|
||||||
|
newBoundaryFaces.appendList(newF);
|
||||||
|
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
|
||||||
|
newBoundaryPatches.append(otherProcPatch[edgeI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cellsToAdd.appendGraph(cellFaces);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Info << "Storing original boundary face "
|
||||||
|
<< bfI << " into patch " << boundaryFacePatches[bfI] << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
newBoundaryFaces.appendList(bFaces[bfI]);
|
||||||
|
newBoundaryOwners.append(faceOwners[bfI]);
|
||||||
|
newBoundaryPatches.append(boundaryFacePatches[bfI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create mesh modifier
|
||||||
|
polyMeshGenModifier meshModifier(mesh_);
|
||||||
|
|
||||||
|
meshModifier.addCells(cellsToAdd);
|
||||||
|
cellsToAdd.clear();
|
||||||
|
meshModifier.reorderBoundaryFaces();
|
||||||
|
meshModifier.replaceBoundary
|
||||||
|
(
|
||||||
|
patchNames_,
|
||||||
|
newBoundaryFaces,
|
||||||
|
newBoundaryOwners,
|
||||||
|
newBoundaryPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- delete meshSurfaceEngine
|
||||||
|
this->clearOut();
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
mesh_.addressingData().checkMesh(true);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
Info << "Finished creating layer cells" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void boundaryLayers::createNewFacesParallel
|
||||||
|
(
|
||||||
|
const boolList& treatPatches
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const meshSurfaceEngine& mse = surfaceEngine();
|
||||||
|
const faceList::subList& bFaces = mse.boundaryFaces();
|
||||||
|
const VRWGraph& faceEdges = mse.faceEdges();
|
||||||
|
const VRWGraph& edgeFaces = mse.edgeFaces();
|
||||||
|
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
|
||||||
|
const labelList& globalEdgeLabel = mse.globalBoundaryEdgeLabel();
|
||||||
|
const Map<label>& globalToLocal = mse.globalToLocalBndEdgeAddressing();
|
||||||
|
|
||||||
|
const Map<label>& otherProcPatch = mse.otherEdgeFacePatch();
|
||||||
|
const Map<label>& otherFaceProc = mse.otherEdgeFaceAtProc();
|
||||||
|
|
||||||
|
//- the next stage is the generation of processor faces
|
||||||
|
//- this step can be done without any communication, but only if the faces
|
||||||
|
//- are added in the same order on both processors
|
||||||
|
//- this will be achieved by sorting edges according to their global labes
|
||||||
|
//- another difficulty here is that new processor patches may occur
|
||||||
|
//- during this procedure
|
||||||
|
Map<label> otherProcToProcPatch;
|
||||||
|
forAll(mesh_.procBoundaries(), patchI)
|
||||||
|
{
|
||||||
|
const processorBoundaryPatch& wp = mesh_.procBoundaries()[patchI];
|
||||||
|
otherProcToProcPatch.insert(wp.neiProcNo(), patchI);
|
||||||
|
}
|
||||||
|
|
||||||
|
label nTreatedEdges(0);
|
||||||
|
boolList treatEdge(edgeFaces.size(), false);
|
||||||
|
for
|
||||||
|
(
|
||||||
|
Map<label>::const_iterator iter=globalToLocal.begin();
|
||||||
|
iter!=globalToLocal.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label beI = iter();
|
||||||
|
|
||||||
|
if( edgeFaces.sizeOfRow(beI) != 1 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(
|
||||||
|
treatPatches[boundaryFacePatches[edgeFaces(beI, 0)]] &&
|
||||||
|
treatPatches[otherProcPatch[beI]]
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++nTreatedEdges;
|
||||||
|
treatEdge[beI] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create a list of treated edges and sort the list
|
||||||
|
labelList treatedEdgeLabels(nTreatedEdges);
|
||||||
|
nTreatedEdges = 0;
|
||||||
|
forAll(treatEdge, beI)
|
||||||
|
if( treatEdge[beI] )
|
||||||
|
{
|
||||||
|
treatedEdgeLabels[nTreatedEdges++] = globalEdgeLabel[beI];
|
||||||
|
}
|
||||||
|
treatedEdgeLabels.setSize(nTreatedEdges);
|
||||||
|
|
||||||
|
sort(treatedEdgeLabels);
|
||||||
|
|
||||||
|
//- create additional processor patches if needed
|
||||||
|
forAll(treatedEdgeLabels, eI)
|
||||||
|
{
|
||||||
|
const label beI = globalToLocal[treatedEdgeLabels[eI]];
|
||||||
|
|
||||||
|
if( !otherProcToProcPatch.found(otherFaceProc[beI]) )
|
||||||
|
{
|
||||||
|
otherProcToProcPatch.insert
|
||||||
|
(
|
||||||
|
otherFaceProc[beI],
|
||||||
|
polyMeshGenModifier(mesh_).addProcessorPatch
|
||||||
|
(
|
||||||
|
otherFaceProc[beI]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- create new processor faces
|
||||||
|
VRWGraph newProcFaces;
|
||||||
|
labelLongList faceProcPatch;
|
||||||
|
FixedList<label, 4> newF;
|
||||||
|
forAll(treatedEdgeLabels, geI)
|
||||||
|
{
|
||||||
|
const label beI = globalToLocal[treatedEdgeLabels[geI]];
|
||||||
|
|
||||||
|
if( edgeFaces.sizeOfRow(beI) == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const label bfI = edgeFaces(beI, 0);
|
||||||
|
const label pos = faceEdges.containsAtPosition(bfI, beI);
|
||||||
|
const edge e = bFaces[bfI].faceEdge(pos);
|
||||||
|
|
||||||
|
if( otherFaceProc[beI] > Pstream::myProcNo() )
|
||||||
|
{
|
||||||
|
newF[0] = e.start();
|
||||||
|
newF[1] = e.end();
|
||||||
|
if( patchKey_.size() != 0 )
|
||||||
|
{
|
||||||
|
newF[2] =
|
||||||
|
findNewNodeLabel(e.end(), patchKey_[otherProcPatch[beI]]);
|
||||||
|
newF[3] =
|
||||||
|
findNewNodeLabel(e.start(), patchKey_[otherProcPatch[beI]]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newF[2] = newLabelForVertex_[e.end()];
|
||||||
|
newF[3] = newLabelForVertex_[e.start()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newF[0] = e.end();
|
||||||
|
if( patchKey_.size() != 0 )
|
||||||
|
{
|
||||||
|
newF[1] =
|
||||||
|
findNewNodeLabel
|
||||||
|
(
|
||||||
|
e.end(),
|
||||||
|
patchKey_[boundaryFacePatches[bfI]]
|
||||||
|
);
|
||||||
|
newF[2] =
|
||||||
|
findNewNodeLabel
|
||||||
|
(
|
||||||
|
e.start(),
|
||||||
|
patchKey_[boundaryFacePatches[bfI]]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newF[1] = newLabelForVertex_[e.end()];
|
||||||
|
newF[2] = newLabelForVertex_[e.start()];
|
||||||
|
}
|
||||||
|
newF[3] = e.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
newProcFaces.appendList(newF);
|
||||||
|
faceProcPatch.append(otherProcToProcPatch[otherFaceProc[beI]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- add faces into the mesh
|
||||||
|
polyMeshGenModifier(mesh_).addProcessorFaces(newProcFaces, faceProcPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,299 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
label boundaryLayers::findNewNodeLabel
|
||||||
|
(
|
||||||
|
const label pointI,
|
||||||
|
const label pKey
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if( otherVrts_.find(pointI) != otherVrts_.end() )
|
||||||
|
{
|
||||||
|
const std::map
|
||||||
|
<
|
||||||
|
label, std::map<std::pair<label, label>, label>
|
||||||
|
>::const_iterator it = otherVrts_.find(pointI);
|
||||||
|
const std::map<std::pair<label, label>, label>& m = it->second;
|
||||||
|
|
||||||
|
std::map<std::pair<label, label>, label>::const_iterator mit;
|
||||||
|
if( m.size() == 2 )
|
||||||
|
{
|
||||||
|
for(mit=m.begin();mit!=m.end();++mit)
|
||||||
|
{
|
||||||
|
if( mit->first.first != pKey )
|
||||||
|
return mit->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(mit=m.begin();mit!=m.end();++mit)
|
||||||
|
{
|
||||||
|
if( mit->first.first == pKey )
|
||||||
|
continue;
|
||||||
|
if( mit->first.second == pKey )
|
||||||
|
continue;
|
||||||
|
if( mit->first.first == mit->first.second )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return mit->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newLabelForVertex_[pointI];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void boundaryLayers::createNewCellFromEdge
|
||||||
|
(
|
||||||
|
const edge& e,
|
||||||
|
const label pKeyI,
|
||||||
|
const label pKeyJ,
|
||||||
|
FixedList<FixedList<label, 4>, 6>& cellFaces
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const std::map<std::pair<label, label>, label>& ms =
|
||||||
|
otherVrts_.find(e.start())->second;
|
||||||
|
const std::map<std::pair<label, label>, label>& me =
|
||||||
|
otherVrts_.find(e.end())->second;
|
||||||
|
|
||||||
|
# ifdef DEBUGLayer
|
||||||
|
Info << "Creating cell for edge " << edgeI << " with nodes " << e << endl;
|
||||||
|
Info << "pKeyI " << pKeyI << endl;
|
||||||
|
Info << "pKeyJ " << pKeyJ << endl;
|
||||||
|
std::map<std::pair<label, label>, label>::const_iterator iter;
|
||||||
|
for(iter=ms.begin();iter!=ms.end();++iter)
|
||||||
|
Info << "1. Pair (" << iter->first.first << ", "
|
||||||
|
<< iter->first.second << ") has value " << iter->second << endl;
|
||||||
|
for(iter=me.begin();iter!=me.end();++iter)
|
||||||
|
Info << "2. Pair (" << iter->first.first << ", "
|
||||||
|
<< iter->first.second << ") has value " << iter->second << endl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
label p0s(-1), p1s(-1), ns(-1), p0e(-1), p1e(-1), ne(-1);
|
||||||
|
|
||||||
|
if( ms.size() == 2 )
|
||||||
|
{
|
||||||
|
p0s = ms.find(std::pair<label, label>(pKeyI, pKeyI))->second;
|
||||||
|
p1s = ms.find(std::pair<label, label>(pKeyJ, pKeyJ))->second;
|
||||||
|
ns = newLabelForVertex_[e.start()];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::map<std::pair<label, label>, label>::const_iterator it;
|
||||||
|
for(it=ms.begin();it!=ms.end();++it)
|
||||||
|
{
|
||||||
|
if(
|
||||||
|
(it->first.first != pKeyJ) && (it->first.second != pKeyJ)
|
||||||
|
&& (it->first.first != it->first.second)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
p0s = it->second;
|
||||||
|
}
|
||||||
|
else if(
|
||||||
|
(it->first.first != pKeyI) && (it->first.second != pKeyI)
|
||||||
|
&& (it->first.first != it->first.second)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
p1s = it->second;
|
||||||
|
}
|
||||||
|
else if(
|
||||||
|
(it->first.first == it->first.second) &&
|
||||||
|
(it->first.first != pKeyI) && (it->first.first != pKeyJ)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ns = it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( me.size() == 2 )
|
||||||
|
{
|
||||||
|
p0e = me.find(std::pair<label, label>(pKeyI, pKeyI))->second;
|
||||||
|
p1e = me.find(std::pair<label, label>(pKeyJ, pKeyJ))->second;
|
||||||
|
ne = newLabelForVertex_[e.end()];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::map<std::pair<label, label>, label>::const_iterator it;
|
||||||
|
for(it=me.begin();it!=me.end();++it)
|
||||||
|
{
|
||||||
|
if(
|
||||||
|
(it->first.first != pKeyJ) && (it->first.second != pKeyJ)
|
||||||
|
&& (it->first.first != it->first.second)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
p0e = it->second;
|
||||||
|
}
|
||||||
|
else if(
|
||||||
|
(it->first.first != pKeyI) && (it->first.second != pKeyI)
|
||||||
|
&& (it->first.first != it->first.second)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
p1e = it->second;
|
||||||
|
}
|
||||||
|
else if(
|
||||||
|
(it->first.first == it->first.second) &&
|
||||||
|
(it->first.first != pKeyI) && (it->first.first != pKeyJ)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ne = it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- F0
|
||||||
|
cellFaces[0][0] = e.end();
|
||||||
|
cellFaces[0][1] = e.start();
|
||||||
|
cellFaces[0][2] = p1s;
|
||||||
|
cellFaces[0][3] = p1e;
|
||||||
|
|
||||||
|
//- F1
|
||||||
|
cellFaces[1][0] = p0e;
|
||||||
|
cellFaces[1][1] = ne;
|
||||||
|
cellFaces[1][2] = ns;
|
||||||
|
cellFaces[1][3] = p0s;
|
||||||
|
|
||||||
|
//- F2
|
||||||
|
cellFaces[2][0] = e.start();
|
||||||
|
cellFaces[2][1] = e.end();
|
||||||
|
cellFaces[2][2] = p0e;
|
||||||
|
cellFaces[2][3] = p0s;
|
||||||
|
|
||||||
|
//- F3
|
||||||
|
cellFaces[3][0] = p1s;
|
||||||
|
cellFaces[3][1] = ns;
|
||||||
|
cellFaces[3][2] = ne;
|
||||||
|
cellFaces[3][3] = p1e;
|
||||||
|
|
||||||
|
//- F4
|
||||||
|
cellFaces[4][0] = e.end();
|
||||||
|
cellFaces[4][1] = p1e;
|
||||||
|
cellFaces[4][2] = ne;
|
||||||
|
cellFaces[4][3] = p0e;
|
||||||
|
|
||||||
|
//- F5
|
||||||
|
cellFaces[5][0] = e.start();
|
||||||
|
cellFaces[5][1] = p0s;
|
||||||
|
cellFaces[5][2] = ns;
|
||||||
|
cellFaces[5][3] = p1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void boundaryLayers::createNewCellFromNode
|
||||||
|
(
|
||||||
|
const label pointI,
|
||||||
|
const DynList<label, 3>& pKeys,
|
||||||
|
FixedList<FixedList<label, 4>, 6>& cellFaces
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const std::map<std::pair<label, label>, label>& m =
|
||||||
|
otherVrts_.find(pointI)->second;
|
||||||
|
|
||||||
|
//- create labels before creating cells
|
||||||
|
const label n = newLabelForVertex_[pointI];
|
||||||
|
const label p00 =
|
||||||
|
m.find(std::pair<label, label>(pKeys[0], pKeys[0]))->second;
|
||||||
|
const label p11 =
|
||||||
|
m.find(std::pair<label, label>(pKeys[1], pKeys[1]))->second;
|
||||||
|
const label p22 =
|
||||||
|
m.find(std::pair<label, label>(pKeys[2], pKeys[2]))->second;
|
||||||
|
|
||||||
|
std::pair<label, label> pr;
|
||||||
|
pr.first = pKeys[0];
|
||||||
|
pr.second = pKeys[1];
|
||||||
|
if( m.find(pr) == m.end() )
|
||||||
|
{
|
||||||
|
pr.first = pKeys[1];
|
||||||
|
pr.second = pKeys[0];
|
||||||
|
}
|
||||||
|
const label p01 = m.find(pr)->second;
|
||||||
|
|
||||||
|
pr.first = pKeys[0];
|
||||||
|
pr.second = pKeys[2];
|
||||||
|
if( m.find(pr) == m.end() )
|
||||||
|
{
|
||||||
|
pr.first = pKeys[2];
|
||||||
|
pr.second = pKeys[0];
|
||||||
|
}
|
||||||
|
const label p02 = m.find(pr)->second;
|
||||||
|
|
||||||
|
pr.first = pKeys[1];
|
||||||
|
pr.second = pKeys[2];
|
||||||
|
if( m.find(pr) == m.end() )
|
||||||
|
{
|
||||||
|
pr.first = pKeys[2];
|
||||||
|
pr.second = pKeys[1];
|
||||||
|
}
|
||||||
|
const label p12 = m.find(pr)->second;
|
||||||
|
|
||||||
|
//- create the cell and append it
|
||||||
|
|
||||||
|
//- F0
|
||||||
|
cellFaces[0][0] = pointI;
|
||||||
|
cellFaces[0][1] = p02;
|
||||||
|
cellFaces[0][2] = p00;
|
||||||
|
cellFaces[0][3] = p01;
|
||||||
|
//- F1
|
||||||
|
cellFaces[1][0] = p12;
|
||||||
|
cellFaces[1][1] = p11;
|
||||||
|
cellFaces[1][2] = n;
|
||||||
|
cellFaces[1][3] = p22;
|
||||||
|
|
||||||
|
//- F2
|
||||||
|
cellFaces[2][0] = pointI;
|
||||||
|
cellFaces[2][1] = p01;
|
||||||
|
cellFaces[2][2] = p11;
|
||||||
|
cellFaces[2][3] = p12;
|
||||||
|
//- F3
|
||||||
|
cellFaces[3][0] = p02;
|
||||||
|
cellFaces[3][1] = p22;
|
||||||
|
cellFaces[3][2] = n;
|
||||||
|
cellFaces[3][3] = p00;
|
||||||
|
//- F4
|
||||||
|
cellFaces[4][0] = pointI;
|
||||||
|
cellFaces[4][1] = p12;
|
||||||
|
cellFaces[4][2] = p22;
|
||||||
|
cellFaces[4][3] = p02;
|
||||||
|
//- F5
|
||||||
|
cellFaces[5][0] = p01;
|
||||||
|
cellFaces[5][1] = p00;
|
||||||
|
cellFaces[5][2] = n;
|
||||||
|
cellFaces[5][3] = p11;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "boundaryLayers.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void boundaryLayers::addWrapperLayer()
|
||||||
|
{
|
||||||
|
createOTopologyLayers();
|
||||||
|
|
||||||
|
if( treatedPatch_[0] ) return;
|
||||||
|
|
||||||
|
const meshSurfaceEngine& mse = surfaceEngine();
|
||||||
|
|
||||||
|
const labelList& bPoints = mse.boundaryPoints();
|
||||||
|
|
||||||
|
boolList treatPatches(mesh_.boundaries().size(), true);
|
||||||
|
|
||||||
|
labelLongList newLabelForVertex(nPoints_, -1);
|
||||||
|
|
||||||
|
pointFieldPMG& points = mesh_.points();
|
||||||
|
points.setSize(points.size() + bPoints.size());
|
||||||
|
forAll(bPoints, bpI)
|
||||||
|
{
|
||||||
|
points[nPoints_] = points[bPoints[bpI]];
|
||||||
|
newLabelForVertex[bPoints[bpI]] = nPoints_++;
|
||||||
|
}
|
||||||
|
|
||||||
|
createNewFacesAndCells(treatPatches);
|
||||||
|
|
||||||
|
forAll(treatPatches, patchI)
|
||||||
|
if( treatPatches[patchI] )
|
||||||
|
treatedPatch_[patchI] = true;
|
||||||
|
|
||||||
|
//- delete surface engine
|
||||||
|
clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
1385
src/mesh/cfMesh/meshLibrary/utilities/boundaryLayers/extrudeLayer.C
Normal file
1385
src/mesh/cfMesh/meshLibrary/utilities/boundaryLayers/extrudeLayer.C
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,217 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
extrudeLayer
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates a sheet of prismatic cells from the selected faces in
|
||||||
|
the direction of the specified cell for each face
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
extrudeLayer.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef extrudeLayer_H
|
||||||
|
#define extrudeLayer_H
|
||||||
|
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "VRWGraphList.H"
|
||||||
|
#include "labelPair.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class extrudeLayer Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class extrudeLayer
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the mesh
|
||||||
|
polyMeshGen& mesh_;
|
||||||
|
|
||||||
|
//- thickness
|
||||||
|
const scalar thickness_;
|
||||||
|
|
||||||
|
//- number of points in the original mesh
|
||||||
|
const label nOrigPoints_;
|
||||||
|
|
||||||
|
//- number of faces in the original mesh
|
||||||
|
const label nOrigFaces_;
|
||||||
|
|
||||||
|
//- number of cells in the original mesh
|
||||||
|
const label nOrigCells_;
|
||||||
|
|
||||||
|
//- pairs of faces making the extruded front
|
||||||
|
LongList<labelPair> extrudedFaces_;
|
||||||
|
|
||||||
|
//- store the orientation of the extruded front
|
||||||
|
//- true if the pair has the same orientation and false otherwise
|
||||||
|
LongList<bool> pairOrientation_;
|
||||||
|
|
||||||
|
//- original point label
|
||||||
|
labelLongList origPointLabel_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- duplicate faces which will be extruded
|
||||||
|
void createDuplicateFrontFaces(const LongList<labelPair>&);
|
||||||
|
|
||||||
|
//- create new vertices and open the mesh
|
||||||
|
void createNewVertices();
|
||||||
|
|
||||||
|
//- move points to make space for the new cells
|
||||||
|
void movePoints();
|
||||||
|
|
||||||
|
//- create layer cells
|
||||||
|
void createLayerCells();
|
||||||
|
|
||||||
|
//- create new faces at parallel boundaries
|
||||||
|
void createNewFacesParallel();
|
||||||
|
|
||||||
|
//- update boundary patches
|
||||||
|
void updateBoundary();
|
||||||
|
|
||||||
|
// Nested classes
|
||||||
|
//- this class provides addressing data needed for generating
|
||||||
|
//- cells emerging as a consequence of self-intersecting layers
|
||||||
|
class addressingCalculator
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- const reference to mesh faces
|
||||||
|
const faceListPMG& faces_;
|
||||||
|
|
||||||
|
//- const reference to extruded face pairs
|
||||||
|
const LongList<labelPair>& extrudedFaces_;
|
||||||
|
|
||||||
|
//- const reference telling the orientation of each face pair
|
||||||
|
LongList<bool> pairOrientation_;
|
||||||
|
|
||||||
|
//- const reference to the extruded faces at points
|
||||||
|
const VRWGraph& pointExtruded_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Construct from faces, extruded face pairs and
|
||||||
|
// point-extrudedfaces addressing
|
||||||
|
addressingCalculator
|
||||||
|
(
|
||||||
|
const faceListPMG& faces,
|
||||||
|
const LongList<labelPair>& extrudedFaces,
|
||||||
|
const LongList<bool>& pairOrientation,
|
||||||
|
const VRWGraph& pointFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~addressingCalculator();
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
//- return label of the original face for the given face
|
||||||
|
inline label origFaceLabel(const label extrudedI) const;
|
||||||
|
|
||||||
|
//- return position of point in extruded face
|
||||||
|
inline label positionInFace
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label pointI
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- return point label in the original face
|
||||||
|
inline label origPointLabel
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label pos
|
||||||
|
) const;
|
||||||
|
|
||||||
|
inline label origPoint
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label pointI
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- find face sharing an edge with the given face
|
||||||
|
inline label faceSharingEdge
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label eI
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- find faces attached to both points
|
||||||
|
inline void facesSharingEdge
|
||||||
|
(
|
||||||
|
const label start,
|
||||||
|
const label end,
|
||||||
|
DynList<label>&
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Enumerators
|
||||||
|
enum extrudeLayerTypes_
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
FRONTVERTEX = 1,
|
||||||
|
FRONTVERTEXPROCBND = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Disallow bitwise copy construct
|
||||||
|
extrudeLayer(const extrudeLayer&);
|
||||||
|
|
||||||
|
//- Disallow bitwise assignment
|
||||||
|
void operator=(const extrudeLayer&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh, extrusion faces, thickness and number of layers
|
||||||
|
extrudeLayer
|
||||||
|
(
|
||||||
|
polyMeshGen& mesh,
|
||||||
|
const LongList<labelPair>& extrusionFront,
|
||||||
|
const scalar thickness = -1.0
|
||||||
|
);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~extrudeLayer();
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "extrudeLayerI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline label extrudeLayer::addressingCalculator::origFaceLabel
|
||||||
|
(
|
||||||
|
const label extrudedI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return extrudedFaces_[extrudedI].second();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline label extrudeLayer::addressingCalculator::positionInFace
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label pointI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const face& f = faces_[extrudedFaces_[extrudedI].first()];
|
||||||
|
|
||||||
|
return f.which(pointI);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline label extrudeLayer::addressingCalculator::origPointLabel
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label pos
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const face& of = faces_[extrudedFaces_[extrudedI].second()];
|
||||||
|
|
||||||
|
if( pairOrientation_[extrudedI] )
|
||||||
|
{
|
||||||
|
return of[pos];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return of[(of.size()-pos)%of.size()];
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"label extrudeLayer::addressingCalculator::origPointLabel"
|
||||||
|
"(const label, const label) const"
|
||||||
|
) << "Cannot find point for the given position" << abort(FatalError);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline label extrudeLayer::addressingCalculator::origPoint
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label pointI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const face& f = faces_[extrudedFaces_[extrudedI].first()];
|
||||||
|
const face& of = faces_[extrudedFaces_[extrudedI].second()];
|
||||||
|
const label pos = f.which(pointI);
|
||||||
|
|
||||||
|
if( pairOrientation_[extrudedI] )
|
||||||
|
{
|
||||||
|
return of[pos];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return of[(of.size()-pos)%of.size()];
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"label extrudeLayer::addressingCalculator::origPoint"
|
||||||
|
"(const label, const label) const"
|
||||||
|
) << "Cannot find point for the given position" << abort(FatalError);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline label extrudeLayer::addressingCalculator::faceSharingEdge
|
||||||
|
(
|
||||||
|
const label extrudedI,
|
||||||
|
const label eI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const face& f = faces_[extrudedFaces_[extrudedI].first()];
|
||||||
|
|
||||||
|
const label pointI = f[eI];
|
||||||
|
const label nextI = f.nextLabel(eI);
|
||||||
|
|
||||||
|
label otherFace(-1);
|
||||||
|
forAllRow(pointExtruded_, pointI, pfI)
|
||||||
|
{
|
||||||
|
const label currFaceI = pointExtruded_(pointI, pfI);
|
||||||
|
|
||||||
|
if( currFaceI == extrudedI )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( pointExtruded_.contains(nextI, currFaceI) )
|
||||||
|
{
|
||||||
|
if( otherFace != -1 )
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"label extrudeLayer::addressingCalculator::faceSharingEdge"
|
||||||
|
"(const label, const label) const"
|
||||||
|
) << "Expected only one such face"
|
||||||
|
<< abort(FatalError);
|
||||||
|
|
||||||
|
otherFace = currFaceI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return otherFace;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void extrudeLayer::addressingCalculator::facesSharingEdge
|
||||||
|
(
|
||||||
|
const label start,
|
||||||
|
const label end,
|
||||||
|
DynList<label>& edgeFaces
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
edgeFaces.clear();
|
||||||
|
|
||||||
|
forAllRow(pointExtruded_, start, pfI)
|
||||||
|
{
|
||||||
|
const label currFaceI = pointExtruded_(start, pfI);
|
||||||
|
|
||||||
|
if( pointExtruded_.contains(end, currFaceI) )
|
||||||
|
edgeFaces.append(currFaceI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
@ -0,0 +1,357 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "refineBoundaryLayers.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const meshSurfaceEngine& refineBoundaryLayers::surfaceEngine() const
|
||||||
|
{
|
||||||
|
if( !msePtr_ )
|
||||||
|
msePtr_ = new meshSurfaceEngine(mesh_);
|
||||||
|
|
||||||
|
return *msePtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
refineBoundaryLayers::refineBoundaryLayers(polyMeshGen& mesh)
|
||||||
|
:
|
||||||
|
mesh_(mesh),
|
||||||
|
msePtr_(NULL),
|
||||||
|
globalNumLayers_(1),
|
||||||
|
globalThicknessRatio_(1.0),
|
||||||
|
globalMaxThicknessFirstLayer_(VGREAT),
|
||||||
|
numLayersForPatch_(),
|
||||||
|
thicknessRatioForPatch_(),
|
||||||
|
maxThicknessForPatch_(),
|
||||||
|
discontinuousLayersForPatch_(),
|
||||||
|
done_(false),
|
||||||
|
is2DMesh_(false),
|
||||||
|
nLayersAtBndFace_(),
|
||||||
|
splitEdges_(),
|
||||||
|
splitEdgesAtPoint_(),
|
||||||
|
newVerticesForSplitEdge_(),
|
||||||
|
facesFromFace_(),
|
||||||
|
newFaces_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
refineBoundaryLayers::~refineBoundaryLayers()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(msePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void refineBoundaryLayers::avoidRefinement()
|
||||||
|
{
|
||||||
|
globalNumLayers_ = 1;
|
||||||
|
numLayersForPatch_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::activate2DMode()
|
||||||
|
{
|
||||||
|
is2DMesh_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setGlobalNumberOfLayers(const label nLayers)
|
||||||
|
{
|
||||||
|
if( nLayers < 2 )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::setGlobalNumberOfLayers(const label)"
|
||||||
|
) << "The specified global number of boundary layers is less than 2"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
globalNumLayers_ = nLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setGlobalThicknessRatio(const scalar thicknessRatio)
|
||||||
|
{
|
||||||
|
if( thicknessRatio < 1.0 )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::setGlobalThicknessRatio(const scalar)"
|
||||||
|
) << "The specified global thickness ratio is less than 1.0" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
globalThicknessRatio_ = thicknessRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer
|
||||||
|
(
|
||||||
|
const scalar maxThickness
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( maxThickness <= 0.0 )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
|
||||||
|
"(const scalar)"
|
||||||
|
) << "The specified global maximum thickness of the first"
|
||||||
|
<< " boundary layer is negative!!" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
globalMaxThicknessFirstLayer_ = maxThickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setNumberOfLayersForPatch
|
||||||
|
(
|
||||||
|
const word& patchName,
|
||||||
|
const label nLayers
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( nLayers < 2 )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::setNumberOfLayersForPatch"
|
||||||
|
"(const word&, const label)"
|
||||||
|
) << "The specified number of boundary layers for patch " << patchName
|
||||||
|
<< " is less than 2" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
numLayersForPatch_[patchName] = nLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setThicknessRatioForPatch
|
||||||
|
(
|
||||||
|
const word& patchName,
|
||||||
|
const scalar thicknessRatio
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( thicknessRatio < 1.0 )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::setThicknessRatioForPatch"
|
||||||
|
"(const word&, const scalar)"
|
||||||
|
) << "The specified thickness ratio for patch " << patchName
|
||||||
|
<< " is less than 1.0" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
thicknessRatioForPatch_[patchName] = thicknessRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setMaxThicknessOfFirstLayerForPatch
|
||||||
|
(
|
||||||
|
const word& patchName,
|
||||||
|
const scalar maxThickness
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( maxThickness <= 0.0 )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
|
||||||
|
"(const word&, const scalar)"
|
||||||
|
) << "The specified maximum thickness of the first boundary layer "
|
||||||
|
<< "for patch " << patchName << " is negative!!" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxThicknessForPatch_[patchName] = maxThickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::setInteruptForPatch(const word& patchName)
|
||||||
|
{
|
||||||
|
discontinuousLayersForPatch_.insert(patchName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::refineLayers()
|
||||||
|
{
|
||||||
|
bool refinePatch(false);
|
||||||
|
for
|
||||||
|
(
|
||||||
|
std::map<word, label>::const_iterator it=numLayersForPatch_.begin();
|
||||||
|
it!=numLayersForPatch_.end();
|
||||||
|
++it
|
||||||
|
)
|
||||||
|
if( it->second > 1 )
|
||||||
|
refinePatch = true;
|
||||||
|
|
||||||
|
if( (globalNumLayers_ < 2) && !refinePatch )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Info << "Starting refining boundary layers" << endl;
|
||||||
|
|
||||||
|
if( done_ )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::refineLayers()"
|
||||||
|
) << "Boundary layers are already refined! Stopping refinement" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
analyseLayers();
|
||||||
|
|
||||||
|
if( !findSplitEdges() )
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void refineBoundaryLayers::refineLayers()"
|
||||||
|
) << "Boundary layers do not exist in the mesh! Cannot refine" << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
generateNewVertices();
|
||||||
|
|
||||||
|
generateNewFaces();
|
||||||
|
|
||||||
|
generateNewCells();
|
||||||
|
|
||||||
|
done_ = true;
|
||||||
|
|
||||||
|
Info << "Finished refining boundary layers" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void refineBoundaryLayers::readSettings
|
||||||
|
(
|
||||||
|
const dictionary& meshDict,
|
||||||
|
refineBoundaryLayers& refLayers
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( meshDict.isDict("boundaryLayers") )
|
||||||
|
{
|
||||||
|
const dictionary& bndLayers = meshDict.subDict("boundaryLayers");
|
||||||
|
|
||||||
|
//- read global properties
|
||||||
|
if( bndLayers.found("nLayers") )
|
||||||
|
{
|
||||||
|
const label nLayers = readLabel(bndLayers.lookup("nLayers"));
|
||||||
|
refLayers.setGlobalNumberOfLayers(nLayers);
|
||||||
|
}
|
||||||
|
if( bndLayers.found("thicknessRatio") )
|
||||||
|
{
|
||||||
|
const scalar ratio = readScalar(bndLayers.lookup("thicknessRatio"));
|
||||||
|
refLayers.setGlobalThicknessRatio(ratio);
|
||||||
|
}
|
||||||
|
if( bndLayers.found("maxFirstLayerThickness") )
|
||||||
|
{
|
||||||
|
const scalar maxFirstThickness =
|
||||||
|
readScalar(bndLayers.lookup("maxFirstLayerThickness"));
|
||||||
|
refLayers.setGlobalMaxThicknessOfFirstLayer(maxFirstThickness);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- patch-based properties
|
||||||
|
if( bndLayers.isDict("patchBoundaryLayers") )
|
||||||
|
{
|
||||||
|
const dictionary& patchBndLayers =
|
||||||
|
bndLayers.subDict("patchBoundaryLayers");
|
||||||
|
const wordList patchNames = patchBndLayers.toc();
|
||||||
|
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
const word pName = patchNames[patchI];
|
||||||
|
|
||||||
|
if( patchBndLayers.isDict(pName) )
|
||||||
|
{
|
||||||
|
const dictionary& patchDict =
|
||||||
|
patchBndLayers.subDict(pName);
|
||||||
|
|
||||||
|
if( patchDict.found("nLayers") )
|
||||||
|
{
|
||||||
|
const label nLayers =
|
||||||
|
readLabel(patchDict.lookup("nLayers"));
|
||||||
|
|
||||||
|
refLayers.setNumberOfLayersForPatch(pName, nLayers);
|
||||||
|
}
|
||||||
|
if( patchDict.found("thicknessRatio") )
|
||||||
|
{
|
||||||
|
const scalar ratio =
|
||||||
|
readScalar(patchDict.lookup("thicknessRatio"));
|
||||||
|
refLayers.setThicknessRatioForPatch(pName, ratio);
|
||||||
|
}
|
||||||
|
if( patchDict.found("maxFirstLayerThickness") )
|
||||||
|
{
|
||||||
|
const scalar maxFirstThickness =
|
||||||
|
readScalar
|
||||||
|
(
|
||||||
|
patchDict.lookup("maxFirstLayerThickness")
|
||||||
|
);
|
||||||
|
refLayers.setMaxThicknessOfFirstLayerForPatch
|
||||||
|
(
|
||||||
|
pName,
|
||||||
|
maxFirstThickness
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if( patchDict.found("allowDiscontinuity") )
|
||||||
|
{
|
||||||
|
const bool allowDiscontinuity =
|
||||||
|
readBool(patchDict.lookup("allowDiscontinuity"));
|
||||||
|
|
||||||
|
if( allowDiscontinuity )
|
||||||
|
refLayers.setInteruptForPatch(pName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Warning << "Cannot refine layer for patch "
|
||||||
|
<< patchNames[patchI] << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//- the layer will not be refined
|
||||||
|
refLayers.avoidRefinement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,406 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
refineBoundaryLayers
|
||||||
|
|
||||||
|
Description
|
||||||
|
Refine existing boundary layers
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
refineBoundaryLayers.C
|
||||||
|
refineBoundaryLayersFunctions.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef refineBoundaryLayers_H
|
||||||
|
#define refineBoundaryLayers_H
|
||||||
|
|
||||||
|
#include "polyMeshGenModifier.H"
|
||||||
|
#include "meshSurfaceEngine.H"
|
||||||
|
#include "DynList.H"
|
||||||
|
#include "labelLongList.H"
|
||||||
|
#include "labelPair.H"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class meshSurfaceEngine;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class refineBoundaryLayers Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class refineBoundaryLayers
|
||||||
|
{
|
||||||
|
//- Reference to the mesh
|
||||||
|
polyMeshGen& mesh_;
|
||||||
|
|
||||||
|
//- pointer to mesh surface engine
|
||||||
|
mutable meshSurfaceEngine* msePtr_;
|
||||||
|
|
||||||
|
//- global number of boundary layers
|
||||||
|
label globalNumLayers_;
|
||||||
|
|
||||||
|
//- global thickness ratio
|
||||||
|
scalar globalThicknessRatio_;
|
||||||
|
|
||||||
|
//- global maximum thickness of the first layer
|
||||||
|
scalar globalMaxThicknessFirstLayer_;
|
||||||
|
|
||||||
|
//- number of boundary layers for user-selected patches
|
||||||
|
std::map<word, label> numLayersForPatch_;
|
||||||
|
|
||||||
|
//- local thickness ratio for selected patches
|
||||||
|
std::map<word, scalar> thicknessRatioForPatch_;
|
||||||
|
|
||||||
|
//- local maximum layer thickness for selected patches
|
||||||
|
std::map<word, scalar> maxThicknessForPatch_;
|
||||||
|
|
||||||
|
//- allow discontinuous layers for patch
|
||||||
|
std::set<word> discontinuousLayersForPatch_;
|
||||||
|
|
||||||
|
//- check whether the refinement is already executed
|
||||||
|
bool done_;
|
||||||
|
|
||||||
|
//- a flag whether a 2D mesh generation is active or not
|
||||||
|
bool is2DMesh_;
|
||||||
|
|
||||||
|
//- information about existing boundary layers at patches
|
||||||
|
//- only available layers
|
||||||
|
labelList layerAtPatch_;
|
||||||
|
|
||||||
|
//- which patches are part of a single layer
|
||||||
|
List<DynList<word> > patchesInLayer_;
|
||||||
|
|
||||||
|
//- a containing the number of layers which shall be generated above
|
||||||
|
//- a boundary face
|
||||||
|
labelList nLayersAtBndFace_;
|
||||||
|
|
||||||
|
//- a list of edges which shall be refined
|
||||||
|
LongList<edge> splitEdges_;
|
||||||
|
|
||||||
|
//- split edges at point
|
||||||
|
VRWGraph splitEdgesAtPoint_;
|
||||||
|
|
||||||
|
//- new vertices for on edges which shall be refined
|
||||||
|
VRWGraph newVerticesForSplitEdge_;
|
||||||
|
|
||||||
|
//- a graph containing information which new faces were generated
|
||||||
|
//- from an existing face
|
||||||
|
VRWGraph facesFromFace_;
|
||||||
|
|
||||||
|
//- a graph containing faces after layer refinement
|
||||||
|
VRWGraph newFaces_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- Return reference to meshSurfaceEngine
|
||||||
|
const meshSurfaceEngine& surfaceEngine() const;
|
||||||
|
|
||||||
|
//- analyse layers to check their topology
|
||||||
|
void analyseLayers();
|
||||||
|
|
||||||
|
//- calculate addressing for a boundary cell
|
||||||
|
void calculateAddressing
|
||||||
|
(
|
||||||
|
const label bfI,
|
||||||
|
label& baseFace,
|
||||||
|
DynList<edge, 48>& edges,
|
||||||
|
DynList<DynList<label, 2>, 48>& edgeFaces,
|
||||||
|
DynList<DynList<label, 10>, 24>& faceEdges
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- find bnd layer hairs for a boundary face
|
||||||
|
bool findHairsForFace(const label, DynList<edge>&) const;
|
||||||
|
|
||||||
|
//- find edges which shall be split due to refinement
|
||||||
|
bool findSplitEdges();
|
||||||
|
|
||||||
|
//- generate new points on edges, faces and in cells
|
||||||
|
void generateNewVertices();
|
||||||
|
|
||||||
|
//- refine a given face and return the new faces
|
||||||
|
//- generates new points at cross-split faces
|
||||||
|
void refineFace
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
const FixedList<label, 2>& nLayersInDirection,
|
||||||
|
DynList<DynList<label, 4>, 128>& newFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
//- generate a matrix of points generated by splitting a face
|
||||||
|
//- and return them in the local i, j system of the face
|
||||||
|
void sortFacePoints
|
||||||
|
(
|
||||||
|
const label faceI,
|
||||||
|
DynList<DynList<label> >& facePoints,
|
||||||
|
const label transpose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- generate a matrix of faces generated by splitting a face
|
||||||
|
//- and return them in the local i, j, system of the face
|
||||||
|
void sortFaceFaces
|
||||||
|
(
|
||||||
|
const label faceI,
|
||||||
|
DynList<DynList<label> >& faceFaces,
|
||||||
|
const label transpose = false
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- map split edges onto a cell
|
||||||
|
void generateNewFaces();
|
||||||
|
|
||||||
|
//- generate new cells for a prism with one boundary face
|
||||||
|
void generateNewCellsPrism
|
||||||
|
(
|
||||||
|
const label cellI,
|
||||||
|
DynList<DynList<DynList<label, 8>, 10> >& cellsFromCell
|
||||||
|
);
|
||||||
|
|
||||||
|
//- a helper function which stores faces generated from
|
||||||
|
//- an existing face into new cells
|
||||||
|
void storeFacesIntoCells
|
||||||
|
(
|
||||||
|
const label faceI,
|
||||||
|
const bool reverseOrientation,
|
||||||
|
const label normalDirection,
|
||||||
|
const bool maxCoordinate,
|
||||||
|
const label nLayersI,
|
||||||
|
const label nLayersJ,
|
||||||
|
const label nLayersK,
|
||||||
|
DynList<DynList<DynList<label, 4>, 6>, 256>& cellsFromCell
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- generate new cells and add them to the mesh
|
||||||
|
void generateNewCells();
|
||||||
|
|
||||||
|
// Nested classes
|
||||||
|
class refineEdgeHexCell
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- label of cell
|
||||||
|
const label cellI_;
|
||||||
|
|
||||||
|
//- number of cells in local direction i
|
||||||
|
label nLayersI_;
|
||||||
|
|
||||||
|
//- number of cells in locatiol direction j
|
||||||
|
label nLayersJ_;
|
||||||
|
|
||||||
|
//- container for new cells
|
||||||
|
DynList<DynList<DynList<label, 4>, 6>, 256> cellsFromCell_;
|
||||||
|
|
||||||
|
//- reference to the boundary layer class
|
||||||
|
refineBoundaryLayers& bndLayers_;
|
||||||
|
|
||||||
|
//- faces sorted into directions of a hex shape
|
||||||
|
FixedList<label, 6> faceInDirection_;
|
||||||
|
|
||||||
|
//- information about orientation of faces
|
||||||
|
//- false means the orientation as expected
|
||||||
|
//- true means wrong orientation
|
||||||
|
FixedList<bool, 6> faceOrientation_;
|
||||||
|
|
||||||
|
//- points on cross-split faces
|
||||||
|
FixedList<DynList<DynList<label> >, 2> cellPoints_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- populate faceInDirection_nad wrongFaceOrientation_
|
||||||
|
void determineFacesInDirections();
|
||||||
|
|
||||||
|
//- populate new cells with new faces generated from already
|
||||||
|
//- existing faces
|
||||||
|
void populateExistingFaces();
|
||||||
|
|
||||||
|
//- generate new internal faces and tore them to new cells
|
||||||
|
void generateMissingFaces();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
//- construct from cell label and the refineBoundaryLayers
|
||||||
|
refineEdgeHexCell(const label cellI, refineBoundaryLayers& ref);
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
inline const DynList<DynList<DynList<label, 4>, 6>, 256>&
|
||||||
|
newCells() const
|
||||||
|
{
|
||||||
|
return cellsFromCell_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class refineCornerHexCell
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- label of cell
|
||||||
|
const label cellI_;
|
||||||
|
|
||||||
|
//- number of cells in local direction i
|
||||||
|
label nLayersI_;
|
||||||
|
|
||||||
|
//- number of cells in local direction j
|
||||||
|
label nLayersJ_;
|
||||||
|
|
||||||
|
//- number of cells in local direction k
|
||||||
|
label nLayersK_;
|
||||||
|
|
||||||
|
//- split edge in directions
|
||||||
|
FixedList<label, 3> splitEdgeInDirection_;
|
||||||
|
|
||||||
|
//- container for new cells
|
||||||
|
DynList<DynList<DynList<label, 4>, 6>, 256> cellsFromCell_;
|
||||||
|
|
||||||
|
//- reference to the boundary layer class
|
||||||
|
refineBoundaryLayers& bndLayers_;
|
||||||
|
|
||||||
|
//- faces sorted into directions of a hex shape
|
||||||
|
FixedList<label, 6> faceInDirection_;
|
||||||
|
|
||||||
|
//- information about orientation of faces
|
||||||
|
//- false means the orientation as expected
|
||||||
|
//- true means wrong orientation
|
||||||
|
FixedList<bool, 6> faceOrientation_;
|
||||||
|
|
||||||
|
//- points on cross-split faces
|
||||||
|
FixedList<DynList<DynList<label> >, 6> facePoints_;
|
||||||
|
|
||||||
|
//- points inside the cell
|
||||||
|
DynList<DynList<DynList<label> > > cellPoints_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- populate faceInDirection_nad wrongFaceOrientation_
|
||||||
|
void determineFacesInDirections();
|
||||||
|
|
||||||
|
//- populate new cells with new faces generated from already
|
||||||
|
//- existing faces
|
||||||
|
void populateExistingFaces();
|
||||||
|
|
||||||
|
//- generate missing points inside the cell
|
||||||
|
void generateNewPoints();
|
||||||
|
|
||||||
|
//- generate new internal faces and tore them to new cells
|
||||||
|
void generateMissingFaces();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
//- construct from cell label and the refineBoundaryLayers
|
||||||
|
refineCornerHexCell
|
||||||
|
(
|
||||||
|
const label cellI,
|
||||||
|
refineBoundaryLayers& ref
|
||||||
|
);
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
inline const DynList<DynList<DynList<label, 4>, 6>, 256>&
|
||||||
|
newCells() const
|
||||||
|
{
|
||||||
|
return cellsFromCell_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Disallow bitwise copy construct
|
||||||
|
refineBoundaryLayers(const refineBoundaryLayers&);
|
||||||
|
|
||||||
|
//- Disallow bitwise assignment
|
||||||
|
void operator=(const refineBoundaryLayers&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh reference
|
||||||
|
refineBoundaryLayers(polyMeshGen& mesh);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~refineBoundaryLayers();
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
//- set no refinement flag
|
||||||
|
void avoidRefinement();
|
||||||
|
|
||||||
|
//- activate 2D layer refinement
|
||||||
|
void activate2DMode();
|
||||||
|
|
||||||
|
//- set the global number of boundary layers
|
||||||
|
void setGlobalNumberOfLayers(const label nLayers);
|
||||||
|
|
||||||
|
//- set the global thickness ratio (default is 1)
|
||||||
|
void setGlobalThicknessRatio(const scalar thicknessRatio);
|
||||||
|
|
||||||
|
//- set the maximum thickness of the first boundary layer
|
||||||
|
void setGlobalMaxThicknessOfFirstLayer(const scalar maxThickness);
|
||||||
|
|
||||||
|
//- set the number of layers for a patch
|
||||||
|
//- the settings override the global settings
|
||||||
|
void setNumberOfLayersForPatch
|
||||||
|
(
|
||||||
|
const word& patchName,
|
||||||
|
const label nLayers
|
||||||
|
);
|
||||||
|
|
||||||
|
//- set the thickness ratio for a patch
|
||||||
|
//- it overrides the global settings
|
||||||
|
void setThicknessRatioForPatch
|
||||||
|
(
|
||||||
|
const word& patchName,
|
||||||
|
const scalar thicknessRatio
|
||||||
|
);
|
||||||
|
|
||||||
|
//- set the maximum thickness of the first layer for a patch
|
||||||
|
void setMaxThicknessOfFirstLayerForPatch
|
||||||
|
(
|
||||||
|
const word& patchName,
|
||||||
|
const scalar maxThickness
|
||||||
|
);
|
||||||
|
|
||||||
|
//- set whether the settings for a given patch are valid for the
|
||||||
|
//- patch only, or whether they extend over th whole sheet
|
||||||
|
//- the selected patch belongs to
|
||||||
|
//- the default behaviour is to apply the patch settings to the whole
|
||||||
|
//- sheet
|
||||||
|
void setInteruptForPatch(const word& patchName);
|
||||||
|
|
||||||
|
//- performs refinement based on the given settings
|
||||||
|
void refineLayers();
|
||||||
|
|
||||||
|
//- read the settings from dictionary
|
||||||
|
static void readSettings(const dictionary&, refineBoundaryLayers&);
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,903 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "checkMeshDict.H"
|
||||||
|
#include "patchRefinementList.H"
|
||||||
|
#include "PtrList.H"
|
||||||
|
#include "LongList.H"
|
||||||
|
#include "objectRefinement.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void checkMeshDict::checkPatchCellSize() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("patchCellSize") )
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("patchCellSize") )
|
||||||
|
{
|
||||||
|
const dictionary& dict = meshDict_.subDict("patchCellSize");
|
||||||
|
|
||||||
|
const wordList patchNames = dict.toc();
|
||||||
|
patchNames.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patchRefinementList prl(meshDict_.lookup("patchCellSize"));
|
||||||
|
prl.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkSubsetCellSize() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("subsetCellSize") )
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("subsetCellSize") )
|
||||||
|
{
|
||||||
|
const dictionary& dict = meshDict_.subDict("subsetCellSize");
|
||||||
|
|
||||||
|
const wordList subsetNames = dict.toc();
|
||||||
|
subsetNames.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patchRefinementList prl(meshDict_.lookup("patchCellSize"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkLocalRefinementLevel() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("localRefinement") )
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("localRefinement") )
|
||||||
|
{
|
||||||
|
const dictionary& refDict = meshDict_.subDict("localRefinement");
|
||||||
|
const wordList entries = refDict.toc();
|
||||||
|
|
||||||
|
forAll(entries, dictI)
|
||||||
|
{
|
||||||
|
const dictionary& dict = refDict.subDict(entries[dictI]);
|
||||||
|
|
||||||
|
if( dict.found("cellSize") )
|
||||||
|
{
|
||||||
|
const scalar cs = readScalar(dict.lookup("cellSize"));
|
||||||
|
|
||||||
|
if( cs > 0.0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkLocalRefinementLevel() const"
|
||||||
|
) << "Cell size for " << entries[dictI]
|
||||||
|
<< " is negative" << endl;
|
||||||
|
}
|
||||||
|
else if( dict.found("additionalRefinementLevels") )
|
||||||
|
{
|
||||||
|
const label nLevels =
|
||||||
|
readLabel(dict.lookup("additionalRefinementLevels"));
|
||||||
|
|
||||||
|
if( nLevels > 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkLocalRefinementLevel() const"
|
||||||
|
) << "Refinement level for " << entries[dictI]
|
||||||
|
<< " is negative" << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkLocalRefinementLevel() const"
|
||||||
|
) << "Cannot read keyword"
|
||||||
|
<< " additionalRefinementLevels or cellSize"
|
||||||
|
<< "for " << entries[dictI] << exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkLocalRefinementLevel() const"
|
||||||
|
) << "Cannot read localRefinement" << exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkKeepCellsIntersectingPatches() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("keepCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("keepCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
const dictionary& dict =
|
||||||
|
meshDict_.subDict("keepCellsIntersectingPatches");
|
||||||
|
|
||||||
|
const wordList patchNames = dict.toc();
|
||||||
|
patchNames.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wordList kcip(meshDict_.lookup("keepCellsIntersectingPatches"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkRemoveCellsIntersectingPatches() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("removeCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("removeCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
const dictionary& dict =
|
||||||
|
meshDict_.subDict("removeCellsIntersectingPatches");
|
||||||
|
|
||||||
|
const wordList patchNames = dict.toc();
|
||||||
|
patchNames.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wordList kcip(meshDict_.lookup("removeCellsIntersectingPatches"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkObjectRefinements() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("objectRefinements") )
|
||||||
|
{
|
||||||
|
PtrList<objectRefinement> refObjects;
|
||||||
|
|
||||||
|
if( meshDict_.isDict("objectRefinements") )
|
||||||
|
{
|
||||||
|
const dictionary& dict = meshDict_.subDict("objectRefinements");
|
||||||
|
const wordList objectNames = dict.toc();
|
||||||
|
|
||||||
|
refObjects.setSize(objectNames.size());
|
||||||
|
|
||||||
|
forAll(refObjects, objectI)
|
||||||
|
{
|
||||||
|
const entry& objectEntry =
|
||||||
|
dict.lookupEntry(objectNames[objectI], false, false);
|
||||||
|
|
||||||
|
refObjects.set
|
||||||
|
(
|
||||||
|
objectI,
|
||||||
|
objectRefinement::New
|
||||||
|
(
|
||||||
|
objectEntry.keyword(),
|
||||||
|
objectEntry.dict()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Istream& is = meshDict_.lookup("objectRefinements");
|
||||||
|
|
||||||
|
PtrList<entry> objectEntries(is);
|
||||||
|
refObjects.setSize(objectEntries.size());
|
||||||
|
|
||||||
|
forAll(refObjects, objectI)
|
||||||
|
{
|
||||||
|
refObjects.set
|
||||||
|
(
|
||||||
|
objectI,
|
||||||
|
objectRefinement::New
|
||||||
|
(
|
||||||
|
objectEntries[objectI].keyword(),
|
||||||
|
objectEntries[objectI].dict()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkBoundaryLayers() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("boundaryLayers") )
|
||||||
|
{
|
||||||
|
const dictionary& bndLayers = meshDict_.subDict("boundaryLayers");
|
||||||
|
|
||||||
|
//- read global properties
|
||||||
|
if( bndLayers.found("nLayers") )
|
||||||
|
{
|
||||||
|
readLabel(bndLayers.lookup("nLayers"));
|
||||||
|
}
|
||||||
|
if( bndLayers.found("thicknessRatio") )
|
||||||
|
{
|
||||||
|
readScalar(bndLayers.lookup("thicknessRatio"));
|
||||||
|
}
|
||||||
|
if( bndLayers.found("maxFirstLayerThickness") )
|
||||||
|
{
|
||||||
|
readScalar(bndLayers.lookup("maxFirstLayerThickness"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- patch-based properties
|
||||||
|
if( bndLayers.isDict("patchBoundaryLayers") )
|
||||||
|
{
|
||||||
|
const dictionary& patchBndLayers =
|
||||||
|
bndLayers.subDict("patchBoundaryLayers");
|
||||||
|
const wordList patchNames = patchBndLayers.toc();
|
||||||
|
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
const word pName = patchNames[patchI];
|
||||||
|
|
||||||
|
if( patchBndLayers.isDict(pName) )
|
||||||
|
{
|
||||||
|
const dictionary& patchDict =
|
||||||
|
patchBndLayers.subDict(pName);
|
||||||
|
|
||||||
|
if( patchDict.found("nLayers") )
|
||||||
|
{
|
||||||
|
readLabel(patchDict.lookup("nLayers"));
|
||||||
|
}
|
||||||
|
if( patchDict.found("thicknessRatio") )
|
||||||
|
{
|
||||||
|
readScalar(patchDict.lookup("thicknessRatio"));
|
||||||
|
}
|
||||||
|
if( patchDict.found("maxFirstLayerThickness") )
|
||||||
|
{
|
||||||
|
readScalar(patchDict.lookup("maxFirstLayerThickness"));
|
||||||
|
}
|
||||||
|
if( patchDict.found("allowDiscontinuity") )
|
||||||
|
{
|
||||||
|
readBool(patchDict.lookup("allowDiscontinuity"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Warning << "Cannot refine layer for patch "
|
||||||
|
<< patchNames[patchI] << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkRenameBoundary() const
|
||||||
|
{
|
||||||
|
if( meshDict_.found("renameBoundary") )
|
||||||
|
{
|
||||||
|
const dictionary& dict = meshDict_.subDict("renameBoundary");
|
||||||
|
if( dict.found("newPatchNames") )
|
||||||
|
{
|
||||||
|
if( dict.isDict("newPatchNames") )
|
||||||
|
{
|
||||||
|
const dictionary& patchDicts = dict.subDict("newPatchNames");
|
||||||
|
|
||||||
|
const wordList patchNames = patchDicts.toc();
|
||||||
|
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
const word& pName = patchNames[patchI];
|
||||||
|
|
||||||
|
if( !patchDicts.isDict(pName) )
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkRenameBoundary() const"
|
||||||
|
) << "Entry " << pName
|
||||||
|
<< " is not a dictionary" << exit(FatalError);
|
||||||
|
|
||||||
|
const dictionary dict = patchDicts.subDict(pName);
|
||||||
|
|
||||||
|
if( !dict.found("newName") )
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkRenameBoundary() const"
|
||||||
|
) << "Dictionary " << pName
|
||||||
|
<< " does not contain a newName keyword"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const PtrList<entry> patchesToRename
|
||||||
|
(
|
||||||
|
dict.lookup("newPatchNames")
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(patchesToRename, patchI)
|
||||||
|
{
|
||||||
|
const word& pName = patchesToRename[patchI].keyword();
|
||||||
|
|
||||||
|
const dictionary dict = patchesToRename[patchI].dict();
|
||||||
|
|
||||||
|
if( !dict.found("newName") )
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void checkMeshDict::checkRenameBoundary() const"
|
||||||
|
) << "Dictionary " << pName
|
||||||
|
<< " does not contain a newName keyword"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::checkEntries() const
|
||||||
|
{
|
||||||
|
checkPatchCellSize();
|
||||||
|
|
||||||
|
checkSubsetCellSize();
|
||||||
|
|
||||||
|
checkKeepCellsIntersectingPatches();
|
||||||
|
|
||||||
|
checkRemoveCellsIntersectingPatches();
|
||||||
|
|
||||||
|
checkObjectRefinements();
|
||||||
|
|
||||||
|
checkBoundaryLayers();
|
||||||
|
|
||||||
|
checkRenameBoundary();
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updatePatchCellSize
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( meshDict_.found("patchCellSize") )
|
||||||
|
{
|
||||||
|
LongList<patchRefinement> updatedPatchRefinement;
|
||||||
|
|
||||||
|
if( meshDict_.isDict("patchCellSize") )
|
||||||
|
{
|
||||||
|
const dictionary dict = meshDict_.subDict("patchCellSize");
|
||||||
|
|
||||||
|
const wordList patchNames = dict.toc();
|
||||||
|
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
const word& pName = patchNames[patchI];
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const wordList& updatedPatchNames = it->second;
|
||||||
|
|
||||||
|
const dictionary& pDict = dict.subDict(pName);
|
||||||
|
const scalar cellSize = readScalar(pDict.lookup("cellSize"));
|
||||||
|
|
||||||
|
forAll(updatedPatchNames, nameI)
|
||||||
|
updatedPatchRefinement.append
|
||||||
|
(
|
||||||
|
patchRefinement
|
||||||
|
(
|
||||||
|
updatedPatchNames[nameI],
|
||||||
|
cellSize
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patchRefinementList prl(meshDict_.lookup("patchCellSize"));
|
||||||
|
forAll(prl, prlI)
|
||||||
|
{
|
||||||
|
const word& pName = prl[prlI].patchName();
|
||||||
|
const scalar cellSize = prl[prlI].cellSize();
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const wordList& updatedPatchNames = it->second;
|
||||||
|
forAll(updatedPatchNames, nameI)
|
||||||
|
updatedPatchRefinement.append
|
||||||
|
(
|
||||||
|
patchRefinement
|
||||||
|
(
|
||||||
|
updatedPatchNames[nameI],
|
||||||
|
cellSize
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meshDict_.add("patchCellSize", updatedPatchRefinement, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updateSubsetCellSize
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updateLocalRefinementLevel
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( meshDict_.found("localRefinement") )
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("localRefinement") )
|
||||||
|
{
|
||||||
|
dictionary& dict = meshDict_.subDict("localRefinement");
|
||||||
|
|
||||||
|
const wordList entries = dict.toc();
|
||||||
|
|
||||||
|
forAll(entries, dictI)
|
||||||
|
{
|
||||||
|
const word& pName = entries[dictI];
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const wordList& updatedPatchNames = it->second;
|
||||||
|
|
||||||
|
const dictionary& pDict = dict.subDict(pName);
|
||||||
|
dictionary copy;
|
||||||
|
if( pDict.found("additionalRefinementLevels") )
|
||||||
|
{
|
||||||
|
const label nLevels =
|
||||||
|
readLabel(pDict.lookup("additionalRefinementLevels"));
|
||||||
|
|
||||||
|
copy.add("additionalRefinementLevels", nLevels);
|
||||||
|
}
|
||||||
|
else if( pDict.found("cellSize") )
|
||||||
|
{
|
||||||
|
const scalar cs = readScalar(pDict.lookup("cellSize"));
|
||||||
|
|
||||||
|
copy.add("cellSize", cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- add new patches
|
||||||
|
forAll(updatedPatchNames, nameI)
|
||||||
|
dict.add(updatedPatchNames[nameI], copy);
|
||||||
|
|
||||||
|
//- remove the current patch
|
||||||
|
dict.remove(pName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updateKeepCellsIntersectingPatches
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( meshDict_.found("keepCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
LongList<word> updatedPatchNames;
|
||||||
|
if( meshDict_.isDict("keepCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
const dictionary& dict =
|
||||||
|
meshDict_.subDict("keepCellsIntersectingPatches");
|
||||||
|
|
||||||
|
const wordList patchNames = dict.toc();
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
const word& pName = patchNames[patchI];
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
updatedPatchNames.append(pName);
|
||||||
|
|
||||||
|
const wordList& newPatchNames = it->second;
|
||||||
|
|
||||||
|
forAll(newPatchNames, nameI)
|
||||||
|
updatedPatchNames.append(newPatchNames[nameI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wordList kcip(meshDict_.lookup("keepCellsIntersectingPatches"));
|
||||||
|
|
||||||
|
forAll(kcip, i)
|
||||||
|
{
|
||||||
|
const word& pName = kcip[i];
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
updatedPatchNames.append(pName);
|
||||||
|
|
||||||
|
const wordList& newPatchNames = it->second;
|
||||||
|
|
||||||
|
forAll(newPatchNames, nameI)
|
||||||
|
updatedPatchNames.append(newPatchNames[nameI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meshDict_.add("keepCellsIntersectingPatches", updatedPatchNames, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void checkMeshDict::updateRemoveCellsIntersectingPatches
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( meshDict_.found("removeCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
LongList<word> updatedPatchNames;
|
||||||
|
if( meshDict_.isDict("removeCellsIntersectingPatches") )
|
||||||
|
{
|
||||||
|
const dictionary& dict =
|
||||||
|
meshDict_.subDict("removeCellsIntersectingPatches");
|
||||||
|
|
||||||
|
const wordList patchNames = dict.toc();
|
||||||
|
forAll(patchNames, patchI)
|
||||||
|
{
|
||||||
|
const word& pName = patchNames[patchI];
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
updatedPatchNames.append(pName);
|
||||||
|
|
||||||
|
const wordList& newPatchNames = it->second;
|
||||||
|
|
||||||
|
forAll(newPatchNames, nameI)
|
||||||
|
updatedPatchNames.append(newPatchNames[nameI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wordList kcip(meshDict_.lookup("removeCellsIntersectingPatches"));
|
||||||
|
|
||||||
|
forAll(kcip, i)
|
||||||
|
{
|
||||||
|
const word& pName = kcip[i];
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
updatedPatchNames.append(pName);
|
||||||
|
|
||||||
|
const wordList& newPatchNames = it->second;
|
||||||
|
|
||||||
|
forAll(newPatchNames, nameI)
|
||||||
|
updatedPatchNames.append(newPatchNames[nameI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meshDict_.add
|
||||||
|
(
|
||||||
|
"removeCellsIntersectingPatches",
|
||||||
|
updatedPatchNames,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updateObjectRefinements
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updateBoundaryLayers
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( meshDict_.isDict("boundaryLayers") )
|
||||||
|
{
|
||||||
|
dictionary& bndLayersDict = meshDict_.subDict("boundaryLayers");
|
||||||
|
if( bndLayersDict.isDict("patchBoundaryLayers") )
|
||||||
|
{
|
||||||
|
dictionary& patchBndLayers =
|
||||||
|
bndLayersDict.subDict("patchBoundaryLayers");
|
||||||
|
|
||||||
|
const wordList patchLayers = patchBndLayers.toc();
|
||||||
|
|
||||||
|
forAll(patchLayers, patchI)
|
||||||
|
{
|
||||||
|
const word& pName = patchLayers[patchI];
|
||||||
|
|
||||||
|
dictionary dict = patchBndLayers.subDict(pName);
|
||||||
|
|
||||||
|
const std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
const wordList& newNames = it->second;
|
||||||
|
|
||||||
|
forAll(newNames, i)
|
||||||
|
{
|
||||||
|
patchBndLayers.add(newNames[i], dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
patchBndLayers.remove(pName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkMeshDict::updateRenameBoundary
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch,
|
||||||
|
const std::map<word, word>& patchTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictionary newDict;
|
||||||
|
|
||||||
|
newDict.add("newPatchNames", dictionary());
|
||||||
|
|
||||||
|
if( meshDict_.found("renameBoundary") )
|
||||||
|
{
|
||||||
|
const dictionary& dict = meshDict_.subDict("renameBoundary");
|
||||||
|
|
||||||
|
//- transfer or generate the default name entry
|
||||||
|
if( dict.found("defaultName") )
|
||||||
|
{
|
||||||
|
const word name(dict.lookup("defaultName"));
|
||||||
|
newDict.add("defaultName", name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newDict.add("defaultName", "walls");
|
||||||
|
}
|
||||||
|
|
||||||
|
//- transfer or generate the defaultType entry
|
||||||
|
if( dict.found("defaultType") )
|
||||||
|
{
|
||||||
|
const word type(dict.lookup("defaultType"));
|
||||||
|
newDict.add("defaultType", type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newDict.add("defaultType", "wall");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dict.found("newPatchNames") )
|
||||||
|
{
|
||||||
|
//- stores the updated dictionary
|
||||||
|
dictionary& newPatchesDict = newDict.subDict("newPatchNames");
|
||||||
|
|
||||||
|
if( dict.isDict("newPatchNames") )
|
||||||
|
{
|
||||||
|
//- current state of the dictionary
|
||||||
|
const dictionary& patchDicts = dict.subDict("newPatchNames");
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it;
|
||||||
|
for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
|
||||||
|
{
|
||||||
|
const word& pName = it->first;
|
||||||
|
const wordList& newNames = it->second;
|
||||||
|
|
||||||
|
if( patchDicts.found(pName) )
|
||||||
|
{
|
||||||
|
//- patch renaming is already requested by the user
|
||||||
|
//- use the new name for all newly created patches
|
||||||
|
const dictionary& patchDict = patchDicts.subDict(pName);
|
||||||
|
if( !patchDict.found("newName") )
|
||||||
|
continue;
|
||||||
|
if( !patchDict.found("type") )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const word newName(patchDict.lookup("newName"));
|
||||||
|
const word newType(patchDict.lookup("type"));
|
||||||
|
|
||||||
|
forAll(newNames, i)
|
||||||
|
{
|
||||||
|
dictionary newPatchDict;
|
||||||
|
newPatchDict.add("newName", newName);
|
||||||
|
newPatchDict.add("type", newType);
|
||||||
|
|
||||||
|
newPatchesDict.add(newNames[i], newPatchDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//- rename all newly create patches
|
||||||
|
//- with the original name
|
||||||
|
forAll(newNames, i)
|
||||||
|
{
|
||||||
|
dictionary newPatchDict;
|
||||||
|
|
||||||
|
newPatchDict.add("newName", it->first);
|
||||||
|
std::map<word, word>::const_iterator tIter =
|
||||||
|
patchTypes.find(it->first);
|
||||||
|
newPatchDict.add("type", tIter->second);
|
||||||
|
|
||||||
|
newPatchesDict.add(newNames[i], newPatchDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const PtrList<entry> patchEntries(dict.lookup("newPatchNames"));
|
||||||
|
|
||||||
|
forAll(patchEntries, entryI)
|
||||||
|
{
|
||||||
|
const word& pName = patchEntries[entryI].keyword();
|
||||||
|
dictionary patchDict(patchEntries[entryI].dict());
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it =
|
||||||
|
patchesFromPatch.find(pName);
|
||||||
|
|
||||||
|
if( it == patchesFromPatch.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const wordList& newNames = it->second;
|
||||||
|
|
||||||
|
forAll(newNames, i)
|
||||||
|
newPatchesDict.add(newNames[i], patchDict, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it;
|
||||||
|
for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
|
||||||
|
{
|
||||||
|
const word& pName = it->first;
|
||||||
|
const wordList& newNames = it->second;
|
||||||
|
|
||||||
|
if( newPatchesDict.found(pName) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//- rename all newly created patches
|
||||||
|
//- with the original name
|
||||||
|
forAll(newNames, i)
|
||||||
|
{
|
||||||
|
dictionary newPatchDict;
|
||||||
|
|
||||||
|
newPatchDict.add("newName", it->first);
|
||||||
|
std::map<word, word>::const_iterator tIter =
|
||||||
|
patchTypes.find(it->first);
|
||||||
|
newPatchDict.add("type", tIter->second);
|
||||||
|
|
||||||
|
newPatchesDict.add(newNames[i], newPatchDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//- newPatchNames is not used
|
||||||
|
dictionary& newPatchesDict = newDict.subDict("newPatchNames");
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it;
|
||||||
|
for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
|
||||||
|
{
|
||||||
|
const wordList& newPatchNames = it->second;
|
||||||
|
|
||||||
|
forAll(newPatchNames, i)
|
||||||
|
{
|
||||||
|
const word& pName = newPatchNames[i];
|
||||||
|
dictionary newPatchDict;
|
||||||
|
newPatchDict.add("newName", it->first);
|
||||||
|
std::map<word, word>::const_iterator tIter =
|
||||||
|
patchTypes.find(it->first);
|
||||||
|
newPatchDict.add("type", tIter->second);
|
||||||
|
|
||||||
|
newPatchesDict.add(pName, newPatchDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- delete all previus entries from the dictionary
|
||||||
|
meshDict_.subDict("renameBoundary").clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//- create the dictionary if it has not existed before
|
||||||
|
newDict.add("defaultName", "walls");
|
||||||
|
newDict.add("defaultType", "wall");
|
||||||
|
|
||||||
|
dictionary& newPatchesDict = newDict.subDict("newPatchNames");
|
||||||
|
|
||||||
|
std::map<word, wordList>::const_iterator it;
|
||||||
|
for(it=patchesFromPatch.begin();it!=patchesFromPatch.end();++it)
|
||||||
|
{
|
||||||
|
const wordList& newPatchNames = it->second;
|
||||||
|
|
||||||
|
forAll(newPatchNames, i)
|
||||||
|
{
|
||||||
|
const word& pName = newPatchNames[i];
|
||||||
|
dictionary newPatchDict;
|
||||||
|
newPatchDict.add("newName", it->first);
|
||||||
|
std::map<word, word>::const_iterator tIter =
|
||||||
|
patchTypes.find(it->first);
|
||||||
|
newPatchDict.add("type", tIter->second);
|
||||||
|
|
||||||
|
newPatchesDict.add(pName, newPatchDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meshDict_.add("renameBoundary", newDict, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
checkMeshDict::checkMeshDict
|
||||||
|
(
|
||||||
|
IOdictionary& meshDict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
meshDict_(meshDict)
|
||||||
|
{
|
||||||
|
checkEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
checkMeshDict::~checkMeshDict()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void checkMeshDict::updateDictionaries
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesFromPatch,
|
||||||
|
const std::map<word, word>& patchTypes,
|
||||||
|
const bool renamePatches
|
||||||
|
)
|
||||||
|
{
|
||||||
|
updatePatchCellSize(patchesFromPatch);
|
||||||
|
|
||||||
|
updateSubsetCellSize(patchesFromPatch);
|
||||||
|
|
||||||
|
updateLocalRefinementLevel(patchesFromPatch);
|
||||||
|
|
||||||
|
updateKeepCellsIntersectingPatches(patchesFromPatch);
|
||||||
|
|
||||||
|
updateRemoveCellsIntersectingPatches(patchesFromPatch);
|
||||||
|
|
||||||
|
updateObjectRefinements(patchesFromPatch);
|
||||||
|
|
||||||
|
updateBoundaryLayers(patchesFromPatch);
|
||||||
|
|
||||||
|
if( renamePatches )
|
||||||
|
updateRenameBoundary(patchesFromPatch, patchTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,148 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
checkMeshDict
|
||||||
|
|
||||||
|
Description
|
||||||
|
Check whether the meshDict file is set correctly
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
checkMeshDict.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef checkMeshDict_H
|
||||||
|
#define checkMeshDict_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class checkMeshDict Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class checkMeshDict
|
||||||
|
{
|
||||||
|
//- Reference to the mesh
|
||||||
|
IOdictionary& meshDict_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- check patchCellSize entry
|
||||||
|
void checkPatchCellSize() const;
|
||||||
|
|
||||||
|
//- check subsetCellSize entry
|
||||||
|
void checkSubsetCellSize() const;
|
||||||
|
|
||||||
|
//- check local refinement level
|
||||||
|
void checkLocalRefinementLevel() const;
|
||||||
|
|
||||||
|
//- check keepCellsIntersectingPatches entry
|
||||||
|
void checkKeepCellsIntersectingPatches() const;
|
||||||
|
|
||||||
|
//- check removeCellsIntersectingPatches entry
|
||||||
|
void checkRemoveCellsIntersectingPatches() const;
|
||||||
|
|
||||||
|
//- check objectRefinements entry
|
||||||
|
void checkObjectRefinements() const;
|
||||||
|
|
||||||
|
//- check entry for boundary layers
|
||||||
|
void checkBoundaryLayers() const;
|
||||||
|
|
||||||
|
//- check renameBoundary entry
|
||||||
|
void checkRenameBoundary() const;
|
||||||
|
|
||||||
|
//- perform all checks
|
||||||
|
void checkEntries() const;
|
||||||
|
|
||||||
|
//- update patchCellSize entry
|
||||||
|
void updatePatchCellSize(const std::map<word, wordList>&);
|
||||||
|
|
||||||
|
//- update subsetCellSize entry
|
||||||
|
void updateSubsetCellSize(const std::map<word, wordList>&);
|
||||||
|
|
||||||
|
//- update local refinement
|
||||||
|
void updateLocalRefinementLevel(const std::map<word, wordList>&);
|
||||||
|
|
||||||
|
//- check keepCellsIntersectingPatches entry
|
||||||
|
void updateKeepCellsIntersectingPatches
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- check removeCellsIntersectingPatches entry
|
||||||
|
void updateRemoveCellsIntersectingPatches
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- check objectRefinements entry
|
||||||
|
void updateObjectRefinements(const std::map<word, wordList>&);
|
||||||
|
|
||||||
|
//- check entry for boundary layers
|
||||||
|
void updateBoundaryLayers(const std::map<word, wordList>&);
|
||||||
|
|
||||||
|
//- check renameBoundary entry
|
||||||
|
void updateRenameBoundary
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>&,
|
||||||
|
const std::map<word, word>&
|
||||||
|
);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from IOdictionary
|
||||||
|
checkMeshDict(IOdictionary& meshDict);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~checkMeshDict();
|
||||||
|
|
||||||
|
// Public member functions
|
||||||
|
|
||||||
|
//- update meshDict based on modification of patches in the surface
|
||||||
|
void updateDictionaries
|
||||||
|
(
|
||||||
|
const std::map<word, wordList>& patchesForPatch,
|
||||||
|
const std::map<word, word>& patchTypes,
|
||||||
|
const bool renamePatches = true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "DynList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Construct from Istream
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
Foam::DynList<T, staticSize>::DynList(Istream& is)
|
||||||
|
:
|
||||||
|
UList<T>(),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"template<class T, Foam::label staticSize>"
|
||||||
|
"\nFoam::DynList<T, staticSize>::DynList(Istream& is)"
|
||||||
|
) << "Not implemented" << exit(FatalError);
|
||||||
|
|
||||||
|
List<T> helper(is);
|
||||||
|
|
||||||
|
nextFree_ = helper.size();
|
||||||
|
UList<T>::swap(helper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
|
(
|
||||||
|
Foam::Ostream& os,
|
||||||
|
const Foam::DynList<T, staticSize>& DL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UList<T> helper(const_cast<T*>(DL.begin()), DL.nextFree_);
|
||||||
|
os << helper;
|
||||||
|
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
Foam::Istream& Foam::operator>>
|
||||||
|
(
|
||||||
|
Foam::Istream& is,
|
||||||
|
Foam::DynList<T, staticSize>& DL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"template<class T, Foam::label staticSize>"
|
||||||
|
"\nFoam::Istream& Foam::operator>>"
|
||||||
|
"(Foam::Istream& is, Foam::DynList<T, staticSize>& DL)"
|
||||||
|
) << "Not implemented" << exit(FatalError);
|
||||||
|
|
||||||
|
is >> static_cast<List<T>&>(DL);
|
||||||
|
DL.nextFree_ = DL.List<T>::size();
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,245 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
DynList
|
||||||
|
|
||||||
|
Description
|
||||||
|
A dynamic list is a 1-D vector of objects of type T which resizes
|
||||||
|
itself as necessary to accept the new objects. Internal storage
|
||||||
|
is a compact array and the list can be shrunk to compact storage.
|
||||||
|
The increase of list size is controlled by three template parameters,
|
||||||
|
which allows the list storage to either increase by the given increment
|
||||||
|
or the given multiplier and divider (allowing non-integer multiples).
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
DynListI.H
|
||||||
|
DynList.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef DynList_H
|
||||||
|
#define DynList_H
|
||||||
|
|
||||||
|
#include "UList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * Forward declaration of template friend fuctions * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, label staticSize>
|
||||||
|
class DynList;
|
||||||
|
|
||||||
|
template<class T, label staticSize>
|
||||||
|
Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const DynList<T, staticSize>&
|
||||||
|
);
|
||||||
|
template<class T, label staticSize>
|
||||||
|
Istream& operator>>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
DynList<T, staticSize>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class DynList Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T, label staticSize = 16>
|
||||||
|
class DynList
|
||||||
|
:
|
||||||
|
public UList<T>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- statically allocated data (used for short lists)
|
||||||
|
T staticData_[staticSize];
|
||||||
|
|
||||||
|
//- Number of next free element
|
||||||
|
label nextFree_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- allocate list size
|
||||||
|
inline void allocateSize(const label);
|
||||||
|
|
||||||
|
//- check if index is inside the scope (used for debugging only)
|
||||||
|
inline void checkIndex(const label) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline DynList();
|
||||||
|
|
||||||
|
//- Construct given size
|
||||||
|
explicit inline DynList(const label);
|
||||||
|
|
||||||
|
//- Construct from given size and defualt value
|
||||||
|
explicit inline DynList(const label, const T&);
|
||||||
|
|
||||||
|
//- Construct from UList. nextFree_ set to size().
|
||||||
|
explicit inline DynList(const UList<T>&);
|
||||||
|
|
||||||
|
//- Construct from other ListType
|
||||||
|
template<class ListType>
|
||||||
|
inline DynList(const ListType&);
|
||||||
|
|
||||||
|
//- Copy constructor
|
||||||
|
inline DynList(const DynList<T, staticSize>&);
|
||||||
|
|
||||||
|
//- Construct from Istream. nextFree_ set to size().
|
||||||
|
explicit DynList(Istream&);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
inline ~DynList();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Size of the active part of the list.
|
||||||
|
//- Direct over-ride of list size member function
|
||||||
|
inline label size() const;
|
||||||
|
|
||||||
|
//- Number of bytes used by the active part of the list
|
||||||
|
//- Direct over-ride of list byteSize member function
|
||||||
|
inline label byteSize() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Reset size of List.
|
||||||
|
void setSize(const label);
|
||||||
|
|
||||||
|
//- Clear the list, i.e. set next free to zero.
|
||||||
|
// Allocated size does not change
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
//- Shrink the List<T> to the number of elements used
|
||||||
|
void shrink();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Append an element at the end of the list
|
||||||
|
inline void append(const T& e);
|
||||||
|
|
||||||
|
//- Append an element at the end of the list if it is not yet
|
||||||
|
//- present in the list (takes linear time)
|
||||||
|
inline void appendIfNotIn(const T& e);
|
||||||
|
|
||||||
|
//- check if the element is in the list (takes linear time)
|
||||||
|
inline bool contains(const T& e) const;
|
||||||
|
inline label containsAtPosition(const T& e) const;
|
||||||
|
|
||||||
|
//- return a const reference to the last element
|
||||||
|
inline const T& lastElement() const;
|
||||||
|
|
||||||
|
//- Return and remove the last element
|
||||||
|
inline T removeLastElement();
|
||||||
|
inline T removeElement(const label i);
|
||||||
|
|
||||||
|
//- return a refence to the element. Resize the list if necessary
|
||||||
|
inline T& newElmt(const label);
|
||||||
|
|
||||||
|
//- Return non-const access to an element,
|
||||||
|
//- resizing the list if necessary
|
||||||
|
inline T& operator()(const label);
|
||||||
|
|
||||||
|
//- return access to an element
|
||||||
|
inline const T& operator[](const label) const;
|
||||||
|
inline T& operator[](const label);
|
||||||
|
|
||||||
|
//- return forward and reverse circular indices
|
||||||
|
inline label fcIndex(const label index, const label offset = 1) const;
|
||||||
|
inline label rcIndex(const label index, const label offset = 1) const;
|
||||||
|
|
||||||
|
//- return forward and reverse circular elements
|
||||||
|
inline const T& fcElement
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label offset = 1
|
||||||
|
) const;
|
||||||
|
|
||||||
|
inline const T& rcElement
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label offset = 1
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Assignment of all entries to the given value
|
||||||
|
inline void operator=(const T&);
|
||||||
|
|
||||||
|
//- Copy of another list
|
||||||
|
inline void operator=(const DynList<T, staticSize>&);
|
||||||
|
|
||||||
|
//- Copy of another list type
|
||||||
|
template<class ListType>
|
||||||
|
inline void operator=(const ListType&);
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream operators
|
||||||
|
|
||||||
|
// Write DynList to Ostream.
|
||||||
|
friend Ostream& operator<< <T, staticSize>
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const DynList<T, staticSize>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Read from Istream, discarding contents of existing DynList.
|
||||||
|
friend Istream& operator>> <T, staticSize>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
DynList<T, staticSize>&
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "DynListI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "DynList.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,405 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::allocateSize(const label s)
|
||||||
|
{
|
||||||
|
if( s > UList<T>::size() )
|
||||||
|
{
|
||||||
|
T* newData = new T[s];
|
||||||
|
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
newData[i] = this->operator[](i);
|
||||||
|
|
||||||
|
T* data = UList<T>::begin();
|
||||||
|
if( data && (data != staticData_) )
|
||||||
|
delete [] data;
|
||||||
|
|
||||||
|
//UList<T>::reset(newData, s);
|
||||||
|
this->UList<T>::operator=(UList<T>(newData, s));
|
||||||
|
}
|
||||||
|
else if( (s > staticSize) && (s < UList<T>::size()) )
|
||||||
|
{
|
||||||
|
T* newData = new T[s];
|
||||||
|
|
||||||
|
for(label i=0;i<s;++i)
|
||||||
|
newData[i] = this->operator[](i);
|
||||||
|
|
||||||
|
T* data = UList<T>::begin();
|
||||||
|
delete [] data;
|
||||||
|
|
||||||
|
//UList<T>::reset(newData, s);
|
||||||
|
this->UList<T>::operator=(UList<T>(newData, s));
|
||||||
|
}
|
||||||
|
else if( (s <= staticSize) && (UList<T>::size() > staticSize) )
|
||||||
|
{
|
||||||
|
for(label i=0;i<s;++i)
|
||||||
|
staticData_[i] = UList<T>::operator[](i);
|
||||||
|
|
||||||
|
T* data = UList<T>::begin();
|
||||||
|
if( data && (data != staticData_) )
|
||||||
|
delete [] data;
|
||||||
|
|
||||||
|
//UList<T>::reset(staticData_, staticSize);
|
||||||
|
this->UList<T>::operator=(UList<T>(staticData_, staticSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::checkIndex(const label i) const
|
||||||
|
{
|
||||||
|
if( (i < 0) || (i >= nextFree_) )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::DynList<T, label, Offset>::"
|
||||||
|
"checkIndex(const label i) const"
|
||||||
|
) << "Index " << i << " is not in range " << 0
|
||||||
|
<< " and " << nextFree_ << abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList()
|
||||||
|
:
|
||||||
|
UList<T>(staticData_, staticSize),
|
||||||
|
nextFree_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList(const label s)
|
||||||
|
:
|
||||||
|
UList<T>(staticData_, staticSize),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
setSize(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList(const label s, const T& val)
|
||||||
|
:
|
||||||
|
UList<T>(staticData_, staticSize),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
setSize(s);
|
||||||
|
|
||||||
|
for(label i=0;i<s;++i)
|
||||||
|
this->operator[](i) = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList(const UList<T>& ul)
|
||||||
|
:
|
||||||
|
UList<T>(staticData_, staticSize),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
setSize(ul.size());
|
||||||
|
|
||||||
|
forAll(ul, i)
|
||||||
|
this->operator[](i) = ul[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
template<class ListType>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList(const ListType& l)
|
||||||
|
:
|
||||||
|
UList<T>(staticData_, staticSize),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
setSize(l.size());
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
this->operator[](i) = l[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::DynList
|
||||||
|
(
|
||||||
|
const DynList<T, staticSize>& dl
|
||||||
|
)
|
||||||
|
:
|
||||||
|
UList<T>(staticData_, staticSize),
|
||||||
|
nextFree_(0)
|
||||||
|
{
|
||||||
|
setSize(dl.size());
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
this->operator[](i) = dl[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::DynList<T, staticSize>::~DynList()
|
||||||
|
{
|
||||||
|
allocateSize(0);
|
||||||
|
//UList<T>::reset(NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::label Foam::DynList<T, staticSize>::size() const
|
||||||
|
{
|
||||||
|
return nextFree_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::label Foam::DynList<T, staticSize>::byteSize() const
|
||||||
|
{
|
||||||
|
if( !contiguous<T>() )
|
||||||
|
{
|
||||||
|
FatalErrorIn("DynList<T>::byteSize()")
|
||||||
|
<< "Cannot return the binary size of a list of "
|
||||||
|
"non-primitive elements"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextFree_*sizeof(T);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::setSize(const label s)
|
||||||
|
{
|
||||||
|
allocateSize(s);
|
||||||
|
nextFree_ = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::clear()
|
||||||
|
{
|
||||||
|
nextFree_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
void Foam::DynList<T, staticSize>::shrink()
|
||||||
|
{
|
||||||
|
allocateSize(nextFree_);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::append(const T& e)
|
||||||
|
{
|
||||||
|
if( nextFree_ >= UList<T>::size() )
|
||||||
|
{
|
||||||
|
const label newSize = 2*UList<T>::size()+2;
|
||||||
|
allocateSize(newSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
UList<T>::operator[](nextFree_++) = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::appendIfNotIn(const T& e)
|
||||||
|
{
|
||||||
|
if( !contains(e) )
|
||||||
|
append(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline bool Foam::DynList<T, staticSize>::contains(const T& e) const
|
||||||
|
{
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
{
|
||||||
|
if( UList<T>::operator[](i) == e )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::label Foam::DynList<T, staticSize>::containsAtPosition
|
||||||
|
(
|
||||||
|
const T& e
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
{
|
||||||
|
if( UList<T>::operator[](i) == e )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline const T& Foam::DynList<T, staticSize>::lastElement() const
|
||||||
|
{
|
||||||
|
return this->operator[](nextFree_-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline T Foam::DynList<T, staticSize>::removeLastElement()
|
||||||
|
{
|
||||||
|
if( nextFree_ == 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::DynList<T, staticSize>::remove()"
|
||||||
|
) << "List is empty" << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
T el = UList<T>::operator[](--nextFree_);
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline T Foam::DynList<T, staticSize>::removeElement(const label i)
|
||||||
|
{
|
||||||
|
if( nextFree_ == 0 )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::DynList<T, staticSize>::remove()"
|
||||||
|
) << "List is empty" << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
T el = this->operator[](i);
|
||||||
|
this->operator[](i) = this->operator[](nextFree_-1);
|
||||||
|
--nextFree_;
|
||||||
|
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline T& Foam::DynList<T, staticSize>::newElmt(const label i)
|
||||||
|
{
|
||||||
|
return this->operator()(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline T& Foam::DynList<T, staticSize>::operator()(const label i)
|
||||||
|
{
|
||||||
|
nextFree_ = Foam::max(nextFree_, i + 1);
|
||||||
|
|
||||||
|
if( nextFree_ >= UList<T>::size() )
|
||||||
|
{
|
||||||
|
allocateSize(2 * nextFree_+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline const T& Foam::DynList<T, staticSize>::operator[](const label i) const
|
||||||
|
{
|
||||||
|
# ifdef FULLDEBUG
|
||||||
|
checkIndex(i);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return UList<T>::operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline T& Foam::DynList<T, staticSize>::operator[](const label i)
|
||||||
|
{
|
||||||
|
# ifdef FULLDEBUG
|
||||||
|
checkIndex(i);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return UList<T>::operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::label Foam::DynList<T, staticSize>::fcIndex
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label offset
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return (index + offset) % nextFree_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline Foam::label Foam::DynList<T, staticSize>::rcIndex
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label offset
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return (index + nextFree_ - offset) % nextFree_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline const T& Foam::DynList<T, staticSize>::fcElement
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label offset
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return operator[](fcIndex(index, offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline const T& Foam::DynList<T, staticSize>::rcElement
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label offset
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return operator[](rcIndex(index, offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::operator=(const T& t)
|
||||||
|
{
|
||||||
|
UList<T>::operator=(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
inline void Foam::DynList<T, staticSize>::operator=
|
||||||
|
(
|
||||||
|
const DynList<T, staticSize>& dl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
allocateSize(dl.size());
|
||||||
|
nextFree_ = dl.size();
|
||||||
|
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
this->operator[](i) = dl[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label staticSize>
|
||||||
|
template<class ListType>
|
||||||
|
inline void Foam::DynList<T, staticSize>::operator=(const ListType& l)
|
||||||
|
{
|
||||||
|
allocateSize(l.size());
|
||||||
|
nextFree_ = l.size();
|
||||||
|
|
||||||
|
for(label i=0;i<nextFree_;++i)
|
||||||
|
this->operator[](i) = l[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "FRWGraph.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
Foam::Ostream& Foam::operator<<
|
||||||
|
(
|
||||||
|
Foam::Ostream& os,
|
||||||
|
const Foam::FRWGraph<T, width>& DL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os << DL.size() << "(" << endl;
|
||||||
|
for(register label i=0;i<DL.size();++i)
|
||||||
|
{
|
||||||
|
os << width << "(";
|
||||||
|
for(label j=0;j<width;++j)
|
||||||
|
os << DL(i, j) << " " << endl;
|
||||||
|
os << ")" << endl;
|
||||||
|
}
|
||||||
|
os << ")";
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
Foam::Istream& Foam::operator>>
|
||||||
|
(
|
||||||
|
Foam::Istream& is,
|
||||||
|
Foam::FRWGraph<T, width>& DL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label size;
|
||||||
|
T e;
|
||||||
|
is >> size;
|
||||||
|
DL.setSize(size);
|
||||||
|
for(IndexType i=0;i<size;++i)
|
||||||
|
{
|
||||||
|
is >> e;
|
||||||
|
DL[i] = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,183 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
FRWGraph
|
||||||
|
|
||||||
|
Description
|
||||||
|
This class is an implementation of a graph with the fixed row width.
|
||||||
|
The implementation is memory efficient.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
FRWGraphI.H
|
||||||
|
FRWGraph.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef FRWGraph_H
|
||||||
|
#define FRWGraph_H
|
||||||
|
|
||||||
|
#include "label.H"
|
||||||
|
#include "LongList.H"
|
||||||
|
#include "FixedList.H"
|
||||||
|
#include "bool.H"
|
||||||
|
#include "error.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * Forward declaration of template friend fuctions * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, label width>
|
||||||
|
class FRWGraph;
|
||||||
|
|
||||||
|
template<class T, label width>
|
||||||
|
Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const FRWGraph<T, width>&
|
||||||
|
);
|
||||||
|
template<class T, label width>
|
||||||
|
Istream& operator>>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
FRWGraph<T, width>&
|
||||||
|
);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class FRWGraph Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T, label width>
|
||||||
|
class FRWGraph
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- list containing the data
|
||||||
|
LongList<T> data_;
|
||||||
|
|
||||||
|
//- number of rows
|
||||||
|
label nRows_;
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
//- check index
|
||||||
|
void checkIndex(const label i, const label j) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline FRWGraph();
|
||||||
|
|
||||||
|
//- Construct given size
|
||||||
|
explicit inline FRWGraph(const label size);
|
||||||
|
|
||||||
|
//- Construct to given size and initialize
|
||||||
|
explicit inline FRWGraph(const label size, const T& t);
|
||||||
|
|
||||||
|
//- Copy contructor
|
||||||
|
inline FRWGraph(const FRWGraph<T, width>&);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
inline ~FRWGraph();
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Returns the number of rows
|
||||||
|
inline label size() const;
|
||||||
|
|
||||||
|
//- Returns the size of a given row (obsolete)
|
||||||
|
inline label sizeOfRow(const label rowI) const;
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Reset the number of rows
|
||||||
|
void setSize(const label);
|
||||||
|
|
||||||
|
//- Clear the graph
|
||||||
|
// Allocated size does not change
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Append a row at the end of the graph
|
||||||
|
inline void appendFixedList(const FixedList<T, width>& l);
|
||||||
|
|
||||||
|
//- Set row with the list
|
||||||
|
inline void setRow(const label rowI, const FixedList<T, width>& l);
|
||||||
|
|
||||||
|
//- check if the element is in the given row (takes linear time)
|
||||||
|
inline bool contains(const label rowI, const T& e) const;
|
||||||
|
inline label containsAtPosition(const label rowI, const T& e) const;
|
||||||
|
|
||||||
|
//- get and set operators
|
||||||
|
inline const T& operator()(const label i, const label j) const;
|
||||||
|
inline T& operator()(const label i, const label j);
|
||||||
|
|
||||||
|
//- Assignment operator
|
||||||
|
inline void operator=(const FRWGraph<T, width>&);
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream operators
|
||||||
|
|
||||||
|
// Write FRWGraph to Ostream.
|
||||||
|
friend Ostream& operator<< <T, width>
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const FRWGraph<T, width>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Read from Istream, discarding contents of existing FRWGraph.
|
||||||
|
/* friend Istream& operator>> <T, width>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
FRWGraph<T, width>&
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "FRWGraphI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "FRWGraph.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,223 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
void Foam::FRWGraph<T, width>::checkIndex(const label i, const label j) const
|
||||||
|
{
|
||||||
|
if( (i < 0) || (i >= nRows_) )
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::FRWGraph<T,width>::"
|
||||||
|
"checkIndex(const label i, const label j) const"
|
||||||
|
) << "Row index " << Foam::label(i)
|
||||||
|
<< " is not in range " << Foam::label(0)
|
||||||
|
<< " and " << nRows_ << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (j < 0) || (j >= width) )
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void Foam::FRWGraph<T,width>::"
|
||||||
|
"checkIndex(label const i) const"
|
||||||
|
) << "Column index " << Foam::label(j)
|
||||||
|
<< " is not in range " << Foam::label(0)
|
||||||
|
<< " and " << width << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::FRWGraph<T,width>::FRWGraph()
|
||||||
|
:
|
||||||
|
data_(),
|
||||||
|
nRows_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct given size
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::FRWGraph<T,width>::FRWGraph
|
||||||
|
(
|
||||||
|
const label s
|
||||||
|
)
|
||||||
|
:
|
||||||
|
data_(s * width),
|
||||||
|
nRows_(s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct given size
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::FRWGraph<T,width>::FRWGraph
|
||||||
|
(
|
||||||
|
const label s,
|
||||||
|
const T& t
|
||||||
|
)
|
||||||
|
:
|
||||||
|
data_(s * width, t),
|
||||||
|
nRows_(s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::FRWGraph<T,width>::FRWGraph
|
||||||
|
(
|
||||||
|
const FRWGraph<T,width>& ol
|
||||||
|
)
|
||||||
|
:
|
||||||
|
data_(ol.data_),
|
||||||
|
nRows_(ol.nRows_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::FRWGraph<T,width>::~FRWGraph()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::label Foam::FRWGraph<T,width>::size() const
|
||||||
|
{
|
||||||
|
return nRows_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::label Foam::FRWGraph<T,width>::sizeOfRow(const label rowI) const
|
||||||
|
{
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline void Foam::FRWGraph<T,width>::setSize(const label i)
|
||||||
|
{
|
||||||
|
data_.setSize(i * width);
|
||||||
|
nRows_ = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline void Foam::FRWGraph<T,width>::clear()
|
||||||
|
{
|
||||||
|
data_.clear();
|
||||||
|
nRows_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline void Foam::FRWGraph<T,width>::appendFixedList
|
||||||
|
(
|
||||||
|
const FixedList<T, width>& l
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAll(l, elI)
|
||||||
|
data_.append(l[elI]);
|
||||||
|
++nRows_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline void Foam::FRWGraph<T,width>::setRow
|
||||||
|
(
|
||||||
|
const label rowI,
|
||||||
|
const FixedList<T, width>& l
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label start = rowI * width;
|
||||||
|
forAll(l, elI)
|
||||||
|
data_[start+elI] = l[elI];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline bool Foam::FRWGraph<T,width>::contains
|
||||||
|
(
|
||||||
|
const label rowI,
|
||||||
|
const T& e
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const label start = rowI * width;
|
||||||
|
for(register label i=0;i<width;++i)
|
||||||
|
if( data_[start+i] == e )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline Foam::label Foam::FRWGraph<T,width>::containsAtPosition
|
||||||
|
(
|
||||||
|
const label rowI,
|
||||||
|
const T& e
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const label start = rowI * width;
|
||||||
|
for(register label i=0;i<width;++i)
|
||||||
|
if( data_[start+i] == e )
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline const T& Foam::FRWGraph<T,width>::operator()
|
||||||
|
(
|
||||||
|
const label i,
|
||||||
|
const label j
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
#ifdef FULLDEBUG
|
||||||
|
checkIndex(i, j);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return data_[i * width + j];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline T& Foam::FRWGraph<T,width>::operator()
|
||||||
|
(
|
||||||
|
const label i, const label j
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#ifdef FULLDEBUG
|
||||||
|
checkIndex(i, j);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return data_[i * width + j];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, Foam::label width>
|
||||||
|
inline void Foam::FRWGraph<T,width>::operator=
|
||||||
|
(
|
||||||
|
const FRWGraph<T, width>& l
|
||||||
|
)
|
||||||
|
{
|
||||||
|
data_ = l.data_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
An graph of faces which supports automated output.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cellIOGraph.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
cellIOGraph::cellIOGraph(const IOobject& io)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
VRWGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
|
cellIOGraph::cellIOGraph
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const label size
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
VRWGraph(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
cellIOGraph::cellIOGraph
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const VRWGraph& g
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
VRWGraph(g)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void cellIOGraph::operator=(const cellIOGraph& rhs)
|
||||||
|
{
|
||||||
|
VRWGraph::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cellIOGraph::operator=(const VRWGraph& rhs)
|
||||||
|
{
|
||||||
|
VRWGraph::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cellIOGraph::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
return (os << *this).good();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameWithName(cellIOGraph, "cellList");
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
cellIOGraph
|
||||||
|
|
||||||
|
Description
|
||||||
|
A graph of cells which support automated output
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cellIOGraph.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cellIOGraph_H
|
||||||
|
#define cellIOGraph_H
|
||||||
|
|
||||||
|
#include "VRWGraph.H"
|
||||||
|
#include "regIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cellIOGraph Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cellIOGraph
|
||||||
|
:
|
||||||
|
public regIOobject,
|
||||||
|
public VRWGraph
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cellIOGraph");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from IOobject
|
||||||
|
cellIOGraph(const IOobject&);
|
||||||
|
|
||||||
|
//- Construct from IOobject and size of cellIOGraph
|
||||||
|
cellIOGraph(const IOobject&, const label);
|
||||||
|
|
||||||
|
//- Construct from IOobject and a VRWGraph
|
||||||
|
cellIOGraph(const IOobject&, const VRWGraph&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
bool writeData(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member operators
|
||||||
|
|
||||||
|
void operator=(const cellIOGraph&);
|
||||||
|
void operator=(const VRWGraph&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
An graph of faces which supports automated output.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faceIOGraph.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
faceIOGraph::faceIOGraph(const IOobject& io)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
VRWGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
|
faceIOGraph::faceIOGraph
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const label size
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
VRWGraph(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
faceIOGraph::faceIOGraph
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const VRWGraph& g
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
VRWGraph(g)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void faceIOGraph::operator=(const faceIOGraph& rhs)
|
||||||
|
{
|
||||||
|
VRWGraph::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void faceIOGraph::operator=(const VRWGraph& rhs)
|
||||||
|
{
|
||||||
|
VRWGraph::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool faceIOGraph::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
return (os << *this).good();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameWithName(faceIOGraph, "faceList");
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
faceIOGraph
|
||||||
|
|
||||||
|
Description
|
||||||
|
A graph of faces which support automated output
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
faceIOGraph.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef faceIOGraph_H
|
||||||
|
#define faceIOGraph_H
|
||||||
|
|
||||||
|
#include "VRWGraph.H"
|
||||||
|
#include "regIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class faceIOGraph Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class faceIOGraph
|
||||||
|
:
|
||||||
|
public regIOobject,
|
||||||
|
public VRWGraph
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("faceIOGraph");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from IOobject
|
||||||
|
faceIOGraph(const IOobject&);
|
||||||
|
|
||||||
|
//- Construct from IOobject and size of faceIOGraph
|
||||||
|
faceIOGraph(const IOobject&, const label);
|
||||||
|
|
||||||
|
//- Construct from IOobject and a VRWGraph
|
||||||
|
faceIOGraph(const IOobject&, const VRWGraph&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
bool writeData(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member operators
|
||||||
|
|
||||||
|
void operator=(const faceIOGraph&);
|
||||||
|
void operator=(const VRWGraph&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
An IODynList of a given type is a List of that type which supports automated
|
||||||
|
input and output.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "IODynList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, class IndexType>
|
||||||
|
IODynList<T, IndexType>::IODynList(const IOobject& io)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
DynList<T, IndexType>()
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
io.readOpt() == IOobject::MUST_READ
|
||||||
|
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
readStream(typeName) >> *this;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class IndexType>
|
||||||
|
IODynList<T, IndexType>::IODynList
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const IndexType size
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
DynList<T, IndexType>(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class IndexType>
|
||||||
|
IODynList<T, IndexType>::IODynList
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const DynList<T, IndexType>& list
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
DynList<T, IndexType>()
|
||||||
|
{
|
||||||
|
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|
{
|
||||||
|
readStream(typeName) >> *this;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
DynList<T, IndexType>::operator=(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class IndexType>
|
||||||
|
void IODynList<T, IndexType>::operator=
|
||||||
|
(
|
||||||
|
const IODynList<T, IndexType>& rhs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DynList<T, IndexType>::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class IndexType>
|
||||||
|
void IODynList<T, IndexType>::operator=
|
||||||
|
(
|
||||||
|
const DynList<T, IndexType>& rhs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DynList<T, IndexType>::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class IndexType>
|
||||||
|
bool IODynList<T, IndexType>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
return (os << *this).good();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
IODynList
|
||||||
|
|
||||||
|
Description
|
||||||
|
An IODynList of a given type is a DynList of that type which supports
|
||||||
|
automated input and output.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
IODynList.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IODynList_H
|
||||||
|
#define IODynList_H
|
||||||
|
|
||||||
|
#include "DynList.H"
|
||||||
|
#include "regIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class IODynList Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T, class IndexType=label>
|
||||||
|
class IODynList
|
||||||
|
:
|
||||||
|
public regIOobject,
|
||||||
|
public DynList<T, IndexType>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("DynList");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from IOobject
|
||||||
|
IODynList(const IOobject&);
|
||||||
|
|
||||||
|
//- Construct from IOobject and size of IODynList
|
||||||
|
IODynList(const IOobject&, const IndexType);
|
||||||
|
|
||||||
|
//- Construct from IOobject and a List
|
||||||
|
IODynList(const IOobject&, const DynList<T, IndexType>&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
bool writeData(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member operators
|
||||||
|
|
||||||
|
void operator=(const IODynList<T, IndexType>&);
|
||||||
|
|
||||||
|
void operator=(const DynList<T, IndexType>&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "IODynList.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
An IOLongList of a given type is a list which supports automated
|
||||||
|
input and output.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "IOLongList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T, label Offset>
|
||||||
|
IOLongList<T, Offset>::IOLongList(const IOobject& io)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
LongList<T, Offset>()
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
io.readOpt() == IOobject::MUST_READ
|
||||||
|
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
readStream(typeName) >> *this;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, label Offset>
|
||||||
|
IOLongList<T, Offset>::IOLongList
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const label size
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
LongList<T, Offset>(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, label Offset>
|
||||||
|
IOLongList<T, Offset>::IOLongList
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const LongList<T, Offset>& list
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
LongList<T, Offset>()
|
||||||
|
{
|
||||||
|
if (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||||
|
{
|
||||||
|
readStream(typeName) >> *this;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
LongList<T, Offset>::operator=(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, label Offset>
|
||||||
|
void IOLongList<T, Offset>::operator=
|
||||||
|
(
|
||||||
|
const IOLongList<T, Offset>& rhs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LongList<T, Offset>::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, label Offset>
|
||||||
|
void IOLongList<T, Offset>::operator=
|
||||||
|
(
|
||||||
|
const LongList<T, Offset>& rhs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LongList<T, Offset>::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, label Offset>
|
||||||
|
bool IOLongList<T, Offset>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
return (os << *this).good();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
IOLongList
|
||||||
|
|
||||||
|
Description
|
||||||
|
An IOLongList of a given type is a List of that type which supports
|
||||||
|
automated input and output.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
IOLongList.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOLongList_H
|
||||||
|
#define IOLongList_H
|
||||||
|
|
||||||
|
#include "LongList.H"
|
||||||
|
#include "regIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class IOLongList Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T, label Offset = 19>
|
||||||
|
class IOLongList
|
||||||
|
:
|
||||||
|
public regIOobject,
|
||||||
|
public LongList<T, Offset>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("LongList");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from IOobject
|
||||||
|
IOLongList(const IOobject&);
|
||||||
|
|
||||||
|
//- Construct from IOobject and size of IOLongList
|
||||||
|
IOLongList(const IOobject&, const label);
|
||||||
|
|
||||||
|
//- Construct from IOobject and a List
|
||||||
|
IOLongList(const IOobject&, const LongList<T, Offset>&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
bool writeData(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member operators
|
||||||
|
|
||||||
|
void operator=(const IOLongList<T, Offset>&);
|
||||||
|
|
||||||
|
void operator=(const LongList<T, Offset>&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "IOLongList.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Declaration of IOLongList ClassNames for IOLists that do not have .C files.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "IOLongListInstances.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineCompoundTypeName(IOLongList<label>, labelIOListPMG);
|
||||||
|
defineCompoundTypeName(IOLongList<point>, pointIOFieldPMG);
|
||||||
|
//defineCompoundTypeName(IOLongList<face>, faceIOListPMG);
|
||||||
|
//defineCompoundTypeName(IOLongList<cell>, cellIOListPMG);
|
||||||
|
//addCompoundToRunTimeSelectionTable(IOLongList<label>, labelIOLongList);
|
||||||
|
|
||||||
|
defineTemplateTypeNameAndDebugWithName(labelIOListPMG, "labelList", 0);
|
||||||
|
defineTemplateTypeNameAndDebugWithName(pointIOFieldPMG, "vectorField", 0);
|
||||||
|
//defineTemplateTypeNameAndDebugWithName(faceIOListPMG, "faceList", 0);
|
||||||
|
//defineTemplateTypeNameAndDebugWithName(cellIOListPMG, "cellList", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Type
|
||||||
|
IOLongList
|
||||||
|
|
||||||
|
Description
|
||||||
|
Definitions of output classes for mesh data
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOLongListInstances_H
|
||||||
|
#define IOLongListInstances_H
|
||||||
|
|
||||||
|
#include "face.H"
|
||||||
|
#include "cell.H"
|
||||||
|
#include "point.H"
|
||||||
|
#include "IOLongList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOLongList<point> pointIOFieldPMG;
|
||||||
|
typedef IOLongList<face> faceIOListPMG;
|
||||||
|
typedef IOLongList<cell> cellIOListPMG;
|
||||||
|
typedef IOLongList<label> labelIOListPMG;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
cellListPMG
|
||||||
|
|
||||||
|
Description
|
||||||
|
This is a container with additional size to prevent re-allocation
|
||||||
|
every time it is resized
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cellListPMG_H
|
||||||
|
#define cellListPMG_H
|
||||||
|
|
||||||
|
#include "cellList.H"
|
||||||
|
#include "Istream.H"
|
||||||
|
#include "Ostream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
class cellListPMG
|
||||||
|
: public cellList
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- number of used elements
|
||||||
|
label nElmts_;
|
||||||
|
|
||||||
|
// Disallow bitwise assignment
|
||||||
|
void operator=(const cellListPMG&);
|
||||||
|
|
||||||
|
cellListPMG(const cellListPMG&);
|
||||||
|
|
||||||
|
// Disallow transfer from cellList
|
||||||
|
void transfer(cellList&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
//- null construct
|
||||||
|
inline cellListPMG();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
inline ~cellListPMG();
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
//- return the number of used elements
|
||||||
|
inline label size() const;
|
||||||
|
|
||||||
|
//- set the number of used elements
|
||||||
|
inline void setSize(const label nElmts);
|
||||||
|
|
||||||
|
//- set the size to zero
|
||||||
|
inline void clear();
|
||||||
|
|
||||||
|
//- add a cell at the end of the list
|
||||||
|
inline void append(const cell&);
|
||||||
|
|
||||||
|
//- return an element with bound checking
|
||||||
|
inline cell& newElmt(const label);
|
||||||
|
|
||||||
|
// Member operators
|
||||||
|
inline void operator=(const cellList&);
|
||||||
|
|
||||||
|
friend inline Ostream& operator<<(Ostream&, const cellListPMG&);
|
||||||
|
|
||||||
|
friend inline Istream& operator>>(Istream&, cellListPMG&);
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "cellListPMGI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "SubList.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
inline cellListPMG::cellListPMG()
|
||||||
|
:
|
||||||
|
cellList(),
|
||||||
|
nElmts_(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
inline cellListPMG::~cellListPMG()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline label cellListPMG::size() const
|
||||||
|
{
|
||||||
|
return nElmts_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void cellListPMG::setSize(const label nElmts)
|
||||||
|
{
|
||||||
|
if( nElmts >= cellList::size() )
|
||||||
|
{
|
||||||
|
if( cellList::size() != 0 )
|
||||||
|
{
|
||||||
|
Info << "Resizing cells!" << endl;
|
||||||
|
cellList copy(label(1.5*nElmts));
|
||||||
|
for(label i=0;i<nElmts_;++i)
|
||||||
|
copy[i].transfer(this->operator[](i));
|
||||||
|
|
||||||
|
cellList::transfer(copy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cellList::setSize(label(1.5*nElmts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nElmts_ = nElmts;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void cellListPMG::clear()
|
||||||
|
{
|
||||||
|
nElmts_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void cellListPMG::append(const cell& c)
|
||||||
|
{
|
||||||
|
const label i = nElmts_;
|
||||||
|
setSize(i+1);
|
||||||
|
this->operator[](i) = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline cell& cellListPMG::newElmt(const label cI)
|
||||||
|
{
|
||||||
|
setSize(cI+1);
|
||||||
|
return this->operator[](cI);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline void cellListPMG::operator=(const cellList& cls)
|
||||||
|
{
|
||||||
|
setSize(cls.size());
|
||||||
|
forAll(cls, cI)
|
||||||
|
this->operator[](cI) = cls[cI];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Ostream& operator<<(Ostream& os, const cellListPMG& cls)
|
||||||
|
{
|
||||||
|
SubList<cell> c(cls, cls.nElmts_, 0);
|
||||||
|
|
||||||
|
os << c;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Istream& operator>>(Istream& is, cellListPMG& cls)
|
||||||
|
{
|
||||||
|
cellList& cells = static_cast<cellList&>(cls);
|
||||||
|
is >> cells;
|
||||||
|
cls.nElmts_ = cells.size();
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
edgeLongList
|
||||||
|
|
||||||
|
Description
|
||||||
|
This is a typedef for LongList<edge>
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef edgeLongList_H
|
||||||
|
#define edgeLongList_H
|
||||||
|
|
||||||
|
#include "edge.H"
|
||||||
|
#include "LongList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef LongList<edge> edgeLongList;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Declaration of IODynListHP ClassNames for IOLists that do not have .C files.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faceListPMG.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameWithName(faceListPMG, "faceList");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
faceListPMG
|
||||||
|
|
||||||
|
Description
|
||||||
|
This is a container with additional size to prevent re-allocation
|
||||||
|
every time it is resized
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef faceListPMG_H
|
||||||
|
#define faceListPMG_H
|
||||||
|
|
||||||
|
#include "regIOobject.H"
|
||||||
|
#include "faceList.H"
|
||||||
|
#include "Istream.H"
|
||||||
|
#include "Ostream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
class faceListPMG
|
||||||
|
: public regIOobject,
|
||||||
|
public faceList
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
//- number of used elements
|
||||||
|
label nElmts_;
|
||||||
|
|
||||||
|
// Disallow bitwise assignment
|
||||||
|
void operator=(const faceListPMG&);
|
||||||
|
|
||||||
|
faceListPMG(const faceListPMG&);
|
||||||
|
|
||||||
|
// Disallow transfer from faceList
|
||||||
|
void transfer(faceList&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TypeName("faceList");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
//- construct from IOobject
|
||||||
|
inline faceListPMG(const IOobject&);
|
||||||
|
|
||||||
|
//- construct from IOobject and size
|
||||||
|
inline faceListPMG(const IOobject&, const label);
|
||||||
|
|
||||||
|
//- construct from IOobject and faceList
|
||||||
|
inline faceListPMG(const IOobject&, const faceList&);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
inline ~faceListPMG();
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
//- return the number of used elements
|
||||||
|
inline label size() const;
|
||||||
|
|
||||||
|
//- set the number of used elements
|
||||||
|
inline void setSize(const label nElmts);
|
||||||
|
|
||||||
|
//- set the size to zero
|
||||||
|
inline void clear();
|
||||||
|
|
||||||
|
//- add a face at the end of the list
|
||||||
|
inline void append(const face&);
|
||||||
|
|
||||||
|
//- return an element with bound checking
|
||||||
|
inline face& newElmt(const label);
|
||||||
|
|
||||||
|
//- read/write the list onto disk
|
||||||
|
inline bool writeData(Ostream&) const;
|
||||||
|
|
||||||
|
// Member operators
|
||||||
|
inline void operator=(const faceList&);
|
||||||
|
|
||||||
|
friend inline Ostream& operator<<(Ostream&, const faceListPMG&);
|
||||||
|
|
||||||
|
friend inline Istream& operator>>(Istream&, faceListPMG&);
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "faceListPMGI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,153 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | cfMesh: A library for mesh generation
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
|
||||||
|
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of cfMesh.
|
||||||
|
|
||||||
|
cfMesh 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.
|
||||||
|
|
||||||
|
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "SubList.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
inline faceListPMG::faceListPMG(const IOobject& io)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
faceList(readStream(typeName)),
|
||||||
|
nElmts_(faceList::size())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline faceListPMG::faceListPMG(const IOobject& io, const label s)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
faceList(s),
|
||||||
|
nElmts_(s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline faceListPMG::faceListPMG(const IOobject& io, const faceList& fcs)
|
||||||
|
:
|
||||||
|
regIOobject(io),
|
||||||
|
faceList(fcs),
|
||||||
|
nElmts_(fcs.size())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
inline faceListPMG::~faceListPMG()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline label faceListPMG::size() const
|
||||||
|
{
|
||||||
|
return nElmts_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void faceListPMG::setSize(const label nElmts)
|
||||||
|
{
|
||||||
|
if( nElmts >= faceList::size() )
|
||||||
|
{
|
||||||
|
if( faceList::size() != 0 )
|
||||||
|
{
|
||||||
|
Info << "Resizing faces!" << endl;
|
||||||
|
faceList copy(label(1.5*nElmts));
|
||||||
|
for(label i=0;i<nElmts_;++i)
|
||||||
|
copy[i].transfer(this->operator[](i));
|
||||||
|
|
||||||
|
faceList::transfer(copy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
faceList::setSize(label(1.5*nElmts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nElmts_ = nElmts;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void faceListPMG::clear()
|
||||||
|
{
|
||||||
|
nElmts_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void faceListPMG::append(const face& f)
|
||||||
|
{
|
||||||
|
const label i = nElmts_;
|
||||||
|
setSize(i+1);
|
||||||
|
this->operator[](i) = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline face& faceListPMG::newElmt(const label fI)
|
||||||
|
{
|
||||||
|
setSize(fI+1);
|
||||||
|
return this->operator[](fI);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline bool faceListPMG::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
return (os << *this).good();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void faceListPMG::operator=(const faceList& fcs)
|
||||||
|
{
|
||||||
|
setSize(fcs.size());
|
||||||
|
forAll(fcs, fI)
|
||||||
|
this->operator[](fI) = fcs[fI];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Ostream& operator<<(Ostream& os, const faceListPMG& fcs)
|
||||||
|
{
|
||||||
|
SubList<face> f(fcs, fcs.nElmts_, 0);
|
||||||
|
|
||||||
|
os << f;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Istream& operator>>(Istream& is, faceListPMG& fcs)
|
||||||
|
{
|
||||||
|
faceList& faces = static_cast<faceList&>(fcs);
|
||||||
|
is >> faces;
|
||||||
|
fcs.nElmts_ = faces.size();
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue