Commit ff720118 authored by Mark Olesen's avatar Mark Olesen

Merge branch 'integration-update-methods' into 'port-v1712'

Integration update methods

See merge request !1
parents 9c8e4c5b d7a80eba
ifeq (OpenFOAM,$(findstring OpenFOAM,$(WM_PROJECT)))
ifeq (Int,$(findstring Int,$(WM_LABEL_OPTION)))
CFMESH_MACROS = -DNoSizeType
else
CFMESH_MACROS =
endif
ifeq (OpenFOAM-dev,$(findstring OpenFOAM-dev,$(WM_PROJECT_DIR)))
CFMESH_LIBS = -lmeshTools -ltriSurface -lfiniteVolume
else
CFMESH_LIBS = -lmeshTools -lfiniteVolume
endif
endif
EXE_INC = \
$(CFMESH_MACROS) \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
$(CFMESH_LIBS) \
-lfiniteVolume -lmeshTools \
-L$(FOAM_USER_LIBBIN) \
-lmeshLibrary
ifeq (OpenFOAM,$(findstring OpenFOAM,$(WM_PROJECT)))
ifeq (Int,$(findstring Int,$(WM_LABEL_OPTION)))
CFMESH_MACROS = -DNoSizeType
else
CFMESH_MACROS =
endif
ifeq (OpenFOAM-dev,$(findstring OpenFOAM-dev,$(WM_PROJECT_DIR)))
CFMESH_LIBS = -lmeshTools -ltriSurface -lfiniteVolume
else
CFMESH_LIBS = -lmeshTools -lfiniteVolume
endif
endif
EXE_INC = \
$(CFMESH_MACROS) \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
$(CFMESH_LIBS) \
-lfiniteVolume -lmeshTools \
-L$(FOAM_USER_LIBBIN) \
-lmeshLibrary
File mode changed from 100755 to 100644
ifeq (OpenFOAM,$(findstring OpenFOAM,$(WM_PROJECT)))
ifeq (Int,$(findstring Int,$(WM_LABEL_OPTION)))
CFMESH_MACROS = -DNoSizeType
else
CFMESH_MACROS =
endif
ifeq (OpenFOAM-dev,$(findstring OpenFOAM-dev,$(WM_PROJECT_DIR)))
CFMESH_LIBS = -lmeshTools -ltriSurface -lfiniteVolume
else
CFMESH_LIBS = -lmeshTools -lfiniteVolume
endif
endif
EXE_INC = \
$(CFMESH_MACROS) \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
$(CFMESH_LIBS) \
-lfiniteVolume -lmeshTools \
-L$(FOAM_USER_LIBBIN) \
-lmeshLibrary
ifeq (OpenFOAM,$(findstring OpenFOAM,$(WM_PROJECT)))
ifeq (Int,$(findstring Int,$(WM_LABEL_OPTION)))
CFMESH_MACROS = -DNoSizeType
else
CFMESH_MACROS =
endif
ifeq (OpenFOAM-dev,$(findstring OpenFOAM-dev,$(WM_PROJECT_DIR)))
CFMESH_LIBS = -lmeshTools -ltriSurface -lfiniteVolume
else
CFMESH_LIBS = -lmeshTools -lfiniteVolume
endif
endif
EXE_INC = \
$(CFMESH_MACROS) \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
$(CFMESH_LIBS) \
-lfiniteVolume -lmeshTools \
-L$(FOAM_USER_LIBBIN) \
-lmeshLibrary
......@@ -240,8 +240,6 @@ $(tetCreatorOctree)/tetCreatorOctreeTetsFromSplitFaces.C
$(faceDecomposition)/faceDecomposition.C
$(faceDecomposition)/decomposeFaces.C
$(helperFunctions)/helperFunctionsStringConversion.C
$(sortEdgesIntoChains)/sortEdgesIntoChains.C
$(surfaceMorpherCells)/surfaceMorpherCells.C
......
ifeq (Gcc,$(findstring Gcc,$(WM_COMPILER)))
OMP_FLAGS = -DUSE_OMP -fopenmp
else
OMP_FLAGS =
endif
ifeq (OpenFOAM,$(findstring OpenFOAM,$(WM_PROJECT)))
ifeq (Int,$(findstring Int,$(WM_LABEL_OPTION)))
CFMESH_MACROS = -DNoSizeType
LIBS =
else
CFMESH_MACROS =
LIBS =
endif
endif
EXE_INC = \
$(OMP_FLAGS) $(CFMESH_MACROS) \
-I$(LIB_SRC)/triSurface/lnInclude \
$(COMP_OPENMP) \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = $(LIBS)
LIB_LIBS = -lmeshTools
......@@ -62,10 +62,16 @@ void cartesian2DMeshGenerator::createCartesianMesh()
// create polyMesh from octree boxes
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
if (meshDict_.found("decomposePolyhedraIntoTetsAndPyrs"))
if
(
meshDict_.lookupOrDefault<bool>
(
"decomposePolyhedraIntoTetsAndPyrs",
false
)
)
{
if (readBool(meshDict_.lookup("decomposePolyhedraIntoTetsAndPyrs")))
cme.decomposeSplitHexes();
cme.decomposeSplitHexes();
}
cme.createMesh();
......
......@@ -154,8 +154,7 @@ void cartesianMeshExtractor::createPolyMesh()
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)
forAllConstIters(procFaces, iter)
{
const label procI = iter->first;
......@@ -182,7 +181,7 @@ void cartesianMeshExtractor::createPolyMesh()
// create processor faces
// they need to be created here because of the correct ordering
patchI = 0;
for (iter = procFaces.begin(); iter!=procFaces.end(); ++iter)
forAllConstIters(procFaces, iter)
{
procBoundaries[patchI].patchStart() = nProcBoundaries;
......
......@@ -61,10 +61,16 @@ void cartesianMeshGenerator::createCartesianMesh()
// create polyMesh from octree boxes
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
if (meshDict_.found("decomposePolyhedraIntoTetsAndPyrs"))
if
(
meshDict_.lookupOrDefault<bool>
(
"decomposePolyhedraIntoTetsAndPyrs",
false
)
)
{
if (readBool(meshDict_.lookup("decomposePolyhedraIntoTetsAndPyrs")))
cme.decomposeSplitHexes();
cme.decomposeSplitHexes();
}
cme.createMesh();
......@@ -169,12 +175,12 @@ void cartesianMeshGenerator::refBoundaryLayers()
void cartesianMeshGenerator::optimiseFinalMesh()
{
// untangle the surface if needed
bool enforceConstraints(false);
if (meshDict_.found("enforceGeometryConstraints"))
{
enforceConstraints =
readBool(meshDict_.lookup("enforceGeometryConstraints"));
}
const bool enforceConstraints =
meshDict_.lookupOrDefault<bool>
(
"enforceGeometryConstraints",
false
);
if (true)
{
......@@ -182,7 +188,9 @@ void cartesianMeshGenerator::optimiseFinalMesh()
meshSurfaceOptimizer surfOpt(mse, *octreePtr_);
if (enforceConstraints)
{
surfOpt.enforceConstraints();
}
surfOpt.optimizeSurface();
}
......@@ -192,7 +200,9 @@ void cartesianMeshGenerator::optimiseFinalMesh()
// final optimisation
meshOptimizer optimizer(mesh_);
if (enforceConstraints)
{
optimizer.enforceConstraints();
}
optimizer.optimizeMeshFV();
optimizer.optimizeLowQualityFaces();
......
......@@ -125,21 +125,23 @@ void tetMeshGenerator::generateBoundaryLayers()
const dictionary& bndLayers = meshDict_.subDict("boundaryLayers");
if (bndLayers.found("nLayers"))
label nLayers;
if (bndLayers.readIfPresent("nLayers", 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]);
for (const word& patchName : patchLayers.toc())
{
bl.addLayerForPatch(patchName);
}
}
}
}
......@@ -148,16 +150,18 @@ void tetMeshGenerator::generateBoundaryLayers()
void tetMeshGenerator::optimiseFinalMesh()
{
// final optimisation
bool enforceConstraints(false);
if (meshDict_.found("enforceGeometryConstraints"))
{
enforceConstraints =
readBool(meshDict_.lookup("enforceGeometryConstraints"));
}
const bool enforceConstraints =
meshDict_.lookupOrDefault<bool>
(
"enforceGeometryConstraints",
false
);
meshOptimizer optimizer(mesh_);
if (enforceConstraints)
{
optimizer.enforceConstraints();
}
optimizer.optimizeSurface(*octreePtr_);
......
......@@ -260,83 +260,37 @@ void boxScaling::operator=(const dictionary& d)
: d
);
// unspecified centre is (0 0 0)
if (dict.found("centre"))
{
dict.lookup("centre") >> centre_;
}
else
if (!dict.readIfPresent("centre", centre_))
{
FatalErrorInFunction
<< "Entry centre is not specified!" << exit(FatalError);
centre_ = vector::zero;
}
// specify lengthX
if (dict.found("lengthX"))
{
lengthVec_.x() = readScalar(dict.lookup("lengthX"));
}
else
if (!dict.readIfPresent("lengthX", lengthVec_.x()))
{
FatalErrorInFunction
<< "Entry lengthX is not specified!" << exit(FatalError);
lengthVec_.x() = 0.0;
}
// specify lengthY
if (dict.found("lengthY"))
{
lengthVec_.y() = readScalar(dict.lookup("lengthY"));
}
else
if (!dict.readIfPresent("lengthY", lengthVec_.y()))
{
FatalErrorInFunction
<< "Entry lengthY is not specified!" << exit(FatalError);
lengthVec_.y() = 0.0;
}
// specify lengthZ
if (dict.found("lengthZ"))
{
lengthVec_.z() = readScalar(dict.lookup("lengthZ"));
}
else
if (!dict.readIfPresent("lengthZ", lengthVec_.z()))
{
FatalErrorInFunction
<< "Entry lengthZ is not specified!" << exit(FatalError);
lengthVec_.z() = 0.0;
}
// specify scaleX
if (dict.found("scaleX"))
{
scaleVec_.x() = readScalar(dict.lookup("scaleX"));
}
else
{
scaleVec_.x() = 1.0;
}
// specify scaleY
if (dict.found("scaleY"))
{
scaleVec_.y() = readScalar(dict.lookup("scaleY"));
}
else
{
scaleVec_.y() = 1.0;
}
// specify scaleX
if (dict.found("scaleZ"))
{
scaleVec_.z() = readScalar(dict.lookup("scaleZ"));
}
else
{
scaleVec_.z() = 1.0;
}
scaleVec_.x() = dict.lookupOrDefault<scalar>("scaleX", 1.0);
scaleVec_.y() = dict.lookupOrDefault<scalar>("scaleY", 1.0);
scaleVec_.z() = dict.lookupOrDefault<scalar>("scaleZ", 1.0);
calculateBndBox();
}
......
......@@ -27,14 +27,9 @@ License
#include "dictionary.H"
#include "error.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
Foam::autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
(
const word& name,
const dictionary& dict
......@@ -46,10 +41,7 @@ autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
// default type is self
word cmType(typeName_());
if (dict.found("type"))
{
dict.lookup("type") >> cmType;
}
dict.readIfPresent("type", cmType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(cmType);
......@@ -57,7 +49,7 @@ autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
{
FatalIOErrorInFunction(dict)
<< "Unknown coordinateModification type " << cmType << nl << nl
<< "Valid coordinateModification types are :" << nl
<< "Valid coordinateModification types :" << nl
<< "[default: " << typeName_() << "]"
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
......@@ -67,8 +59,4 @@ autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -222,12 +222,7 @@ void planeScaling::operator=(const dictionary& d)
: d
);
// unspecified centre is (0 0 0)
if (dict.found("origin"))
{
dict.lookup("origin") >> origin_;
}
else
if (!dict.readIfPresent("origin", origin_))
{
FatalErrorInFunction
<< "Entry origin is not specified!" << exit(FatalError);
......@@ -235,25 +230,14 @@ void planeScaling::operator=(const dictionary& d)
origin_ = vector::zero;
}
// specify normal
if (dict.found("normal"))
{
dict.lookup("normal") >> normal_;
}
else
if (!dict.readIfPresent("normal", normal_))
{
FatalErrorInFunction
<< "Entry lengthX is not specified!" << exit(FatalError);
<< "Entry normal is not specified!" << exit(FatalError);
normal_ = vector(1, 1, 1);
}
// specify translation distance
if (dict.found("scalingDistance"))
{
scalingDistance_ = readScalar(dict.lookup("scalingDistance"));
}
else
if (!dict.readIfPresent("scalingDistance", scalingDistance_))
{
FatalErrorInFunction
<< "Entry scalingDistance is not specified!" << exit(FatalError);
......@@ -261,12 +245,7 @@ void planeScaling::operator=(const dictionary& d)
scalingDistance_ = 0.0;
}
// specify scaling factor
if (dict.found("scalingFactor"))
{
scalingFactor_ = readScalar(dict.lookup("scalingFactor"));
}
else
if (!dict.readIfPresent("scalingFactor", scalingFactor_))
{
WarningInFunction
<< "Entry scalingFactor is not specified!" << endl;
......
......@@ -203,12 +203,7 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
const labelList& bPoints = mse.boundaryPoints();
for
(
Map<label>::const_iterator iter = globalToLocal.begin();
iter!=globalToLocal.end();
++iter
)
forAllConstIters(globalToLocal, iter)
{
const label bpI = iter();
procPoint[bPoints[bpI]] = true;
......@@ -376,8 +371,6 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
}
// 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;
......@@ -397,7 +390,7 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
ppfType parPointFaces;
ppType parPointPatches;
forAllConstIter(mPointsType, otherVrts_, iter)
forAllConstIters(otherVrts_, iter)
{
// skip points on feature edges
if (iter->second.size() == 2)
......@@ -504,7 +497,7 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
}
// sort faces sharing corners at the parallel boundaries
forAllIter(ppfType, parPointFaces, iter)
forAllIters(parPointFaces, iter)
{
DynList<DynList<label, 8>, 8>& pFaces = iter->second;
DynList<label, 3>& fPatches = parPointPatches[iter->first];
......@@ -513,13 +506,13 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
for (label i = 0; i < pFaces.size(); ++i)
{
const DynList<label, 8>& bf = pFaces[i];
const label pos = bf.containsAtPosition(gpI);
const label pos = bf.find(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()))
const auto& obf = pFaces[j];
if (obf.found(e.start()) && obf.found(e.end()))
{
DynList<label, 8> add;
add = pFaces[i + 1];
......@@ -545,7 +538,7 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
}
// sort out point which are not at inter-processor boundaries
forAllConstIter(mPointsType, otherVrts_, iter)
forAllConstIters(otherVrts_, iter)
{
if (iter->second.size() == 2)
{
......@@ -598,7 +591,7 @@ void boundaryLayers::createLayerCells(const labelList& patchLabels)
}
// create layer cells for corner nodes
forAllIter(ppType, nodePatches, iter)
forAllIters(nodePatches, iter)
{
const DynList<label, 3>& patchIDs = iter->second;
DynList<label, 3> pKeys;
......@@ -812,13 +805,7 @@ void boundaryLayers::createNewFacesFromPointsParallel
help::exchangeMap(exchangeData, receivedMap);
exchangeData.clear();
for
(
std::map<label, List<labelledPair>>::const_iterator
iter = receivedMap.begin();
iter!=receivedMap.end();
++iter
)
forAllConstIters(receivedMap, iter)
{
const List<labelledPair>& receivedData = iter->second;
......
......@@ -97,10 +97,8 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
// 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)
for (const label bpI : corners)
{
const label bpI = it.key();
if (mPart.numberOfFeatureEdgesAtPoint(bpI) > 3)
{
labelHashSet commonPatches;
......@@ -227,7 +225,7 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
}
// store faces for sending
forAllConstIter(Map<label>, otherFaceProc, it)
forAllConstIters(otherFaceProc, it)
{