Compilation fixes
This commit is contained in:
parent
3ed10cf177
commit
bea25f5960
299 changed files with 4017 additions and 108360 deletions
8
applications/solvers/compressible/sonicFoam/UEqn.H
Normal file
8
applications/solvers/compressible/sonicFoam/UEqn.H
Normal file
|
@ -0,0 +1,8 @@
|
|||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
solve(UEqn == -fvc::grad(p));
|
|
@ -15,7 +15,7 @@ IOdictionary gravitationalProperties
|
|||
const dimensionedVector g(gravitationalProperties.lookup("g"));
|
||||
const Switch rotating(gravitationalProperties.lookup("rotating"));
|
||||
const dimensionedVector Omega =
|
||||
rotating ? gravitationalProperties.lookup("Omega")
|
||||
rotating ? dimensionedVector(gravitationalProperties.lookup("Omega"))
|
||||
: dimensionedVector("Omega", -dimTime, vector(0,0,0));
|
||||
const dimensionedScalar magg = mag(g);
|
||||
const dimensionedVector gHat = g/magg;
|
||||
|
|
|
@ -39,24 +39,17 @@ Description
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
Info<< "\nEstimating error in scalar transport equation\n" << endl;
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
Info<< "\nEstimating error in scalar transport equation\n"
|
||||
<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
|
@ -79,9 +72,9 @@ int main(int argc, char *argv[])
|
|||
);
|
||||
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
|
@ -134,7 +127,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,25 +38,17 @@ Description
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
Info<< "\nEstimating error in the incompressible momentum equation\n"
|
||||
<< endl;
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
Info<< "\nEstimating error in the incompressible momentum equation\n"
|
||||
<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
|
@ -75,9 +67,9 @@ int main(int argc, char *argv[])
|
|||
transportProperties.lookup("nu")
|
||||
);
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
|
@ -131,7 +123,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,25 +39,17 @@ Description
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
Info<< "\nEstimating error in the incompressible momentum equation\n"
|
||||
<< endl;
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
Info<< "\nEstimating error in the incompressible momentum equation\n"
|
||||
<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
|
@ -76,9 +68,9 @@ int main(int argc, char *argv[])
|
|||
transportProperties.lookup("nu")
|
||||
);
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
|
@ -190,7 +182,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,24 +40,17 @@ Description
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
Info<< "\nEstimating error in scalar transport equation\n" << endl;
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
Info<< "\nEstimating error in scalar transport equation\n"
|
||||
<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
|
@ -80,9 +73,9 @@ int main(int argc, char *argv[])
|
|||
);
|
||||
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
|
@ -186,7 +179,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/RAS \
|
||||
-I$(LIB_SRC)/transportModels
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
|
|
|
@ -34,32 +34,26 @@ Description
|
|||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/RASModel/RASModel.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
timeSelector::addOptions();
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
// set startTime and endTime depending on -time and -latestTime options
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
|
@ -94,9 +88,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
Info<< " Calculating uResidual" << endl;
|
||||
|
|
|
@ -1640,28 +1640,28 @@ int main(int argc, char *argv[])
|
|||
boundaryZones[pI].append(bPatches[pI].name());
|
||||
}
|
||||
|
||||
label cnt = 0;
|
||||
SLList<label>::iterator cg = cellGroupZoneID.begin();
|
||||
SLList<label>::iterator start = cellGroupStartIndex.begin();
|
||||
SLList<label>::iterator end = cellGroupEndIndex.begin();
|
||||
label cnt = 0;
|
||||
SLList<label>::iterator cg = cellGroupZoneID.begin();
|
||||
SLList<label>::iterator start = cellGroupStartIndex.begin();
|
||||
SLList<label>::iterator end = cellGroupEndIndex.begin();
|
||||
|
||||
for (; cg != cellGroupZoneID.end(); ++cg, ++start, ++end)
|
||||
{
|
||||
const word& name = patchNameIDs[cg()];
|
||||
const word& type = patchTypeIDs[cg()];
|
||||
for (; cg != cellGroupZoneID.end(); ++cg, ++start, ++end)
|
||||
{
|
||||
const word& name = patchNameIDs[cg()];
|
||||
const word& type = patchTypeIDs[cg()];
|
||||
|
||||
Info<< "Writing cell zone: " << name
|
||||
Info<< "Writing cell zone: " << name
|
||||
<< " of type " << type << " starting at " << start() - 1
|
||||
<< " ending at " << end() - 1 << " to cellSet." << endl;
|
||||
|
||||
labelList cls(end() - start() + 1);
|
||||
labelList cls(end() - start() + 1);
|
||||
|
||||
// Mark zone cells, used for finding faces
|
||||
boolList zoneCell(pShapeMesh.nCells(), false);
|
||||
|
||||
// Shift cell indices by 1
|
||||
label nr = 0;
|
||||
for (label celli = (start() - 1); celli < end(); celli++)
|
||||
// Shift cell indices by 1
|
||||
label nr = 0;
|
||||
for (label celli = (start() - 1); celli < end(); celli++)
|
||||
{
|
||||
cls[nr] = celli;
|
||||
zoneCell[celli] = true;
|
||||
|
|
|
@ -225,7 +225,7 @@ int main(int argc, char *argv[])
|
|||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
blocks.points(),
|
||||
xferCopy(blocks.points()),
|
||||
blocks.cells(),
|
||||
blocks.patches(),
|
||||
patchNames,
|
||||
|
|
|
@ -425,7 +425,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
|||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
tmpBlockPoints,
|
||||
xferMove(tmpBlockPoints),
|
||||
tmpBlockCells,
|
||||
tmpBlocksPatches,
|
||||
patchNames,
|
||||
|
|
|
@ -327,11 +327,10 @@ autoPtr<mapPolyMesh> reorderMesh
|
|||
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
mesh.nFaces(),
|
||||
mesh.points(),
|
||||
newFaces,
|
||||
newOwner,
|
||||
newNeighbour,
|
||||
Xfer<pointField>::null(),
|
||||
xferMove(newFaces),
|
||||
xferMove(newOwner),
|
||||
xferMove(newNeighbour),
|
||||
patchSizes,
|
||||
patchStarts
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
EXE_INC = \
|
||||
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
|
@ -7,9 +8,9 @@ EXE_INC = \
|
|||
$(WM_DECOMP_INC)
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldecompositionMethods \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-lfiniteArea \
|
||||
-ldecompositionMethods \
|
||||
-llagrangian \
|
||||
-lmeshTools \
|
||||
$(WM_DECOMP_LIBS)
|
||||
|
|
|
@ -35,36 +35,8 @@ License
|
|||
#include "globalMeshData.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void domainDecomposition::mark
|
||||
(
|
||||
const labelList& zoneElems,
|
||||
const label zoneI,
|
||||
labelList& elementToZone
|
||||
)
|
||||
{
|
||||
forAll(zoneElems, i)
|
||||
{
|
||||
label pointi = zoneElems[i];
|
||||
|
||||
if (elementToZone[pointi] == -1)
|
||||
{
|
||||
// First occurrence
|
||||
elementToZone[pointi] = zoneI;
|
||||
}
|
||||
else if (elementToZone[pointi] >= 0)
|
||||
{
|
||||
// Multiple zones
|
||||
elementToZone[pointi] = -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// from components
|
||||
domainDecomposition::domainDecomposition(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
|
@ -295,16 +267,16 @@ bool domainDecomposition::writeDecomposition()
|
|||
(
|
||||
IOobject
|
||||
(
|
||||
name(),
|
||||
"constant",
|
||||
this->polyMesh::name(), // region name of undecomposed mesh
|
||||
pointsInstance(),
|
||||
processorDb
|
||||
),
|
||||
procPoints,
|
||||
procFaces,
|
||||
procOwner,
|
||||
procNeighbour,
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procOwner),
|
||||
xferMove(procNeighbour),
|
||||
false // Do not sync par
|
||||
// procCells // Old-fashioned mesh creation using cells.
|
||||
// xferMove(procCells) // Old-fashioned mesh creation using cells.
|
||||
// Deprecated: using face owner/neighbour
|
||||
// HJ, 30/Mar/2009
|
||||
);
|
||||
|
|
|
@ -26,43 +26,33 @@
|
|||
# paraview3/bashrc
|
||||
#
|
||||
# Description
|
||||
# Setup file for ParaView3.
|
||||
# Sourced from OpenFOAM-?.?/etc/bashrc
|
||||
# Setup file for paraview-3.x
|
||||
# Sourced from OpenFOAM-*/etc/bashrc
|
||||
#
|
||||
# Note
|
||||
# The env. variable 'ParaView_DIR' is required for building plugins
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
|
||||
|
||||
if [ -r $CMAKE_HOME ]; then
|
||||
# determine the cmake to be used
|
||||
unset CMAKE_HOME
|
||||
for cmake in cmake-2.8.2 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
|
||||
for cmake in cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
|
||||
do
|
||||
cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
|
||||
if [ -r $cmake ]
|
||||
then
|
||||
export CMAKE_HOME=$cmake
|
||||
export PATH=$CMAKE_HOME/bin:$PATH
|
||||
else
|
||||
unset CMAKE_HOME
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
export ParaView_VERSION="3.3-cvs"
|
||||
# export ParaView_VERSION="3.4.0"
|
||||
# set MAJOR and VERSION variables if not already set
|
||||
[ -z "$ParaView_MAJOR" ] && export ParaView_MAJOR=paraview-3.6
|
||||
[ -z "$ParaView_VERSION" ] && export ParaView_VERSION=3.6.1
|
||||
[ -z "$ParaView_MAJOR" ] && export ParaView_MAJOR=paraview-3.8
|
||||
[ -z "$ParaView_VERSION" ] && export ParaView_VERSION=3.8.0
|
||||
|
||||
export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
|
||||
export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
|
||||
export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
|
||||
|
||||
if [ "$PYTHONPATH" ]; then
|
||||
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
# add in python libraries if required
|
||||
paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
if [ -r $paraviewPython ]
|
||||
|
@ -70,33 +60,25 @@ then
|
|||
if [ "$PYTHONPATH" ]
|
||||
then
|
||||
export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_DIR/lib/$ParaView_MAJOR
|
||||
else
|
||||
export PYTHONPATH=$paraviewPython:$ParaView_DIR/lib/$ParaView_MAJOR
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$PYTHONPATH" ]; then
|
||||
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
else
|
||||
export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
export PYTHONPATH=$paraviewPython:$ParaView_DIR/lib/$ParaView_MAJOR
|
||||
fi
|
||||
if [ $WM_ARCH == "darwinPpc" -o $WM_ARCH == "darwinIntel" ]
|
||||
if [ $WM_ARCH = "darwinPpc" -o $WM_ARCH = "darwinIntel" ]
|
||||
then
|
||||
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/bin
|
||||
fi
|
||||
|
||||
if [ -r $ParaView_DIR ]; then
|
||||
if [ -r $ParaView_DIR ]
|
||||
then
|
||||
export PATH=$ParaView_DIR/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$ParaView_DIR/bin:$LD_LIBRARY_PATH
|
||||
if [ $WM_ARCH == "darwinPpc" -o $WM_ARCH == "darwinIntel" ]
|
||||
then
|
||||
export DYLD_LIBRARY_PATH=$ParaView_DIR/bin:$DYLD_LIBRARY_PATH
|
||||
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview
|
||||
if [ ! -e $PV_PLUGIN_PATH ]
|
||||
then
|
||||
echo "Creating $PV_PLUGIN_PATH"
|
||||
mkdir $PV_PLUGIN_PATH
|
||||
fi
|
||||
ln -sf $FOAM_LIBBIN/libPV* $PV_PLUGIN_PATH
|
||||
else
|
||||
export PV_PLUGIN_PATH=$FOAM_LIBBIN
|
||||
fi
|
||||
export PV_PLUGIN_PATH=$FOAM_LIBBIN
|
||||
fi
|
||||
|
||||
unset cmake paraviewPython
|
||||
|
|
|
@ -34,6 +34,11 @@ Documentation
|
|||
|
||||
DebugSwitches
|
||||
{
|
||||
BlockLduMatrix 2;
|
||||
|
||||
CircumferentialAveragingInterpolation 0;
|
||||
mixingPlanePolyPatch 1;
|
||||
|
||||
overlapGgi 0;
|
||||
cyclicGgi 0;
|
||||
coupledLduMatrix 1;
|
||||
|
@ -465,6 +470,7 @@ DebugSwitches
|
|||
genericPatch 0;
|
||||
geomCellLooper 0;
|
||||
geometricSurfacePatch 0;
|
||||
ggi 0;
|
||||
global 0;
|
||||
globalMeshData 0;
|
||||
globalPoints 0;
|
||||
|
@ -874,10 +880,59 @@ InfoSwitches
|
|||
OptimisationSwitches
|
||||
{
|
||||
fileModificationSkew 10;
|
||||
commsType nonBlocking; //scheduled; //blocking;
|
||||
// commsType blocking; //scheduled; //blocking;
|
||||
// commsType nonBlocking; //scheduled; //blocking;
|
||||
commsType blocking; //scheduled;
|
||||
floatTransfer 0;// Floating transfer not realiable
|
||||
nProcsSimpleSum 0;
|
||||
|
||||
nSquaredProjection 0;
|
||||
// nSquaredProjection 1;
|
||||
}
|
||||
|
||||
Tolerances
|
||||
{
|
||||
// Primitive mesh checking limits
|
||||
primitiveMeshClosedThreshold 1e-6;
|
||||
primitiveMeshAspectThreshold 1000;
|
||||
primitiveMeshNonOrthThreshold 70;
|
||||
primitiveMeshSkewThreshold 4;
|
||||
primitiveMeshFaceAngleThreshold 10;
|
||||
primitiveMeshFaceFlatnessThreshold 0.8;
|
||||
|
||||
// Geometric matching tolerances
|
||||
cyclicMatchTol 1e-4;
|
||||
processorMatchTol 1e-4;
|
||||
|
||||
// Volumetric closed domain
|
||||
closedDomainTol 1e-10;
|
||||
|
||||
// Patch-to-patch interpolation tolerances
|
||||
patchToPatchDirectHit 1e-5;
|
||||
patchToPatchProjectionTol 0.05;
|
||||
|
||||
// Thermophysical models
|
||||
specieThermoTol 1e-4;
|
||||
|
||||
// Intersection tolerance
|
||||
intersectionPlanarTol 0.2;
|
||||
intersectionMissTol 1e-10;
|
||||
|
||||
// Sliding interface
|
||||
// slidingPointMergeTol 0.2;
|
||||
// slidingEdgeMergeTol 0.05;
|
||||
// slidingIntegralAdjTol 0.15;
|
||||
// slidingEdgeMasterCatchFraction 0.4;
|
||||
// slidingEdgeEndCutoffTol 0.0001;
|
||||
// slidingEdgeCoPlanarTol 0.8;
|
||||
|
||||
slidingPointMergeTol 0.2;
|
||||
slidingEdgeMergeTol 0.01;
|
||||
slidingIntegralAdjTol 0.05;
|
||||
slidingEdgeMasterCatchFraction 0.4;
|
||||
slidingEdgeEndCutoffTol 0.0001;
|
||||
slidingEdgeCoPlanarTol 0.8;
|
||||
|
||||
// GGIAreaErrorTol 1e-8;
|
||||
}
|
||||
|
||||
DimensionedConstants
|
||||
|
|
|
@ -11,12 +11,16 @@ Pstream/Allwmake
|
|||
wmake libo OSspecific/$WM_OSTYPE
|
||||
wmake libso OpenFOAM
|
||||
|
||||
( cd decompositionAgglomeration && ./Allwmake )
|
||||
# Decomposition methods needed by meshTools
|
||||
decompositionMethods/AllwmakeLnInclude
|
||||
decompositionMethods/Allwmake
|
||||
|
||||
wmake libso lagrangian/basic
|
||||
|
||||
wmake libso triSurface
|
||||
wmake libso edgeMesh
|
||||
wmake libso surfMesh
|
||||
|
||||
wmake libso meshTools
|
||||
wmake libso finiteVolume
|
||||
wmake libso finiteArea
|
||||
|
|
|
@ -25,6 +25,7 @@ License
|
|||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SIBS.H"
|
||||
#include "simpleMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -43,7 +44,7 @@ void Foam::SIBS::SIMPR
|
|||
scalar h = deltaX/nSteps;
|
||||
const label nEqns = ode_.nEqns();
|
||||
|
||||
Matrix<scalar> a(nEqns, nEqns);
|
||||
scalarSquareMatrix a(nEqns);
|
||||
for (register label i=0; i<nEqns; i++)
|
||||
{
|
||||
for (register label j=0; j<nEqns; j++)
|
||||
|
@ -54,14 +55,14 @@ void Foam::SIBS::SIMPR
|
|||
}
|
||||
|
||||
labelList pivotIndices(nEqns);
|
||||
simpleMatrix<scalar>::LUDecompose(a, pivotIndices);
|
||||
scalarSquareMatrix::LUDecompose(a, pivotIndices);
|
||||
|
||||
for (register label i=0; i<nEqns; i++)
|
||||
{
|
||||
yEnd[i] = h*(dydx[i] + h*dfdx[i]);
|
||||
}
|
||||
|
||||
simpleMatrix<scalar>::LUBacksubstitute(a, pivotIndices, yEnd);
|
||||
scalarSquareMatrix::LUBacksubstitute(a, pivotIndices, yEnd);
|
||||
|
||||
scalarField del(yEnd);
|
||||
scalarField ytemp(nEqns);
|
||||
|
|
|
@ -37,7 +37,7 @@ Description
|
|||
#ifndef HamiltonRodriguezRot_H
|
||||
#define HamiltonRodriguezRot_H
|
||||
|
||||
#include "Matrix.H"
|
||||
#include "scalarMatrices.H"
|
||||
#include "coordinateRotation.H"
|
||||
#include "scalarField.H"
|
||||
#include "dimensionedTypes.H"
|
||||
|
@ -64,7 +64,7 @@ class HamiltonRodriguezRot
|
|||
scalar e3_;
|
||||
|
||||
//- Body to quaternions transformation
|
||||
Matrix<scalar> Gt_;
|
||||
scalarRectangularMatrix Gt_;
|
||||
|
||||
//- Inertial to rotated coordinate system transformation
|
||||
mutable tensor R_;
|
||||
|
|
|
@ -195,7 +195,7 @@ void Foam::sixDOFqODE::derivatives
|
|||
dimensionedVector curOmega
|
||||
(
|
||||
"curOmega",
|
||||
dimless/dimTime,
|
||||
dimless/dimTime,
|
||||
vector(y[6], y[7], y[8])
|
||||
);
|
||||
|
||||
|
@ -217,7 +217,7 @@ void Foam::sixDOFqODE::jacobian
|
|||
const scalar x,
|
||||
const scalarField& y,
|
||||
scalarField& dfdx,
|
||||
Matrix<scalar>& dfdy
|
||||
scalarSquareMatrix& dfdy
|
||||
) const
|
||||
{
|
||||
Info << "jacobian(...)" << endl;
|
||||
|
|
|
@ -340,7 +340,7 @@ public:
|
|||
const scalar x,
|
||||
const scalarField& y,
|
||||
scalarField& dfdx,
|
||||
Matrix<scalar>& dfdy
|
||||
scalarSquareMatrix& dfdy
|
||||
) const;
|
||||
|
||||
//- Update ODE after the solution, advancing by delta
|
||||
|
|
|
@ -33,7 +33,7 @@ Author
|
|||
Hrvoje Jasak
|
||||
Dubravko Matijasevic
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "translationODE.H"
|
||||
#include "Time.H"
|
||||
|
@ -143,7 +143,7 @@ void Foam::translationODE::jacobian
|
|||
const scalar x,
|
||||
const scalarField& y,
|
||||
scalarField& dfdx,
|
||||
Matrix<scalar>& dfdy
|
||||
scalarSquareMatrix& dfdy
|
||||
) const
|
||||
{
|
||||
notImplemented("translationODE::jacobian(...) const");
|
||||
|
|
|
@ -220,7 +220,7 @@ public:
|
|||
const scalar x,
|
||||
const scalarField& y,
|
||||
scalarField& dfdx,
|
||||
Matrix<scalar>& dfdy
|
||||
scalarSquareMatrix& dfdy
|
||||
) const;
|
||||
|
||||
//- Update ODE after the solution, advancing by delta
|
||||
|
|
|
@ -204,6 +204,11 @@ dimensionedTypes/dimensionedTensor/dimensionedTensor.C
|
|||
matrices/solution/solution.C
|
||||
matrices/constraint/scalarConstraint.C
|
||||
|
||||
scalarMatrices = matrices/scalarMatrices
|
||||
$(scalarMatrices)/scalarMatrices.C
|
||||
$(scalarMatrices)/scalarSquareMatrix.C
|
||||
$(scalarMatrices)/SVD/SVD.C
|
||||
|
||||
LUscalarMatrix = matrices/LUscalarMatrix
|
||||
$(LUscalarMatrix)/LUscalarMatrix.C
|
||||
$(LUscalarMatrix)/procLduMatrix.C
|
||||
|
@ -441,6 +446,7 @@ $(cellMatcher)/degenerateMatcher.C
|
|||
|
||||
mapPolyMesh = $(polyMesh)/mapPolyMesh
|
||||
$(mapPolyMesh)/mapPolyMesh.C
|
||||
$(mapPolyMesh)/pointMapper/pointMapper.C
|
||||
$(mapPolyMesh)/faceMapper/faceMapper.C
|
||||
$(mapPolyMesh)/cellMapper/cellMapper.C
|
||||
$(mapPolyMesh)/mapDistribute/mapDistribute.C
|
||||
|
|
|
@ -559,7 +559,11 @@ void Foam::Time::setTime(const instant& inst, const label newIndex)
|
|||
}
|
||||
|
||||
|
||||
void Foam::Time::setTime(const dimensionedScalar& newTime, const label newIndex)
|
||||
void Foam::Time::setTime
|
||||
(
|
||||
const dimensionedScalar& newTime,
|
||||
const label newIndex
|
||||
)
|
||||
{
|
||||
setTime(newTime.value(), newIndex);
|
||||
}
|
||||
|
|
|
@ -305,7 +305,11 @@ public:
|
|||
instant findClosestTime(const scalar) const;
|
||||
|
||||
//- Search instantList for the time index closest to the given time
|
||||
static label findClosestTimeIndex(const instantList&, const scalar);
|
||||
static label findClosestTimeIndex
|
||||
(
|
||||
const instantList&,
|
||||
const scalar
|
||||
);
|
||||
|
||||
//- Write using given format, version and compression
|
||||
virtual bool writeObject
|
||||
|
|
|
@ -46,7 +46,7 @@ template<class Type, class MeshMapper, class GeoMesh>
|
|||
class MapInternalField
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
MapInternalField()
|
||||
{}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void MapGeometricFields
|
|||
// It is necessary to enforce that all old-time fields are stored
|
||||
// before the mapping is performed. Otherwise, if the
|
||||
// old-time-level field is mapped before the field itself, sizes
|
||||
// will not match.
|
||||
// will not match.
|
||||
|
||||
for
|
||||
(
|
||||
|
@ -92,7 +92,7 @@ void MapGeometricFields
|
|||
++fieldIter
|
||||
)
|
||||
{
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
|
||||
(*fieldIter());
|
||||
|
||||
|
@ -112,7 +112,7 @@ void MapGeometricFields
|
|||
++fieldIter
|
||||
)
|
||||
{
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
|
||||
(*fieldIter());
|
||||
|
||||
|
@ -137,7 +137,6 @@ void MapGeometricFields
|
|||
// Cannot check sizes for patch fields because of
|
||||
// empty fields in FV and because point fields get their size
|
||||
// from the patch which has already been resized
|
||||
//
|
||||
|
||||
field.boundaryField()[patchi].autoMap
|
||||
(
|
||||
|
|
|
@ -162,6 +162,12 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
|||
}
|
||||
|
||||
|
||||
Foam::dictionary& Foam::debug::tolerances()
|
||||
{
|
||||
return switchSet("Tolerances", tolerancesPtr_);
|
||||
}
|
||||
|
||||
|
||||
double Foam::debug::tolerances
|
||||
(
|
||||
const char* name,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
argList::validOptions.insert("constant", "");
|
8
src/OpenFOAM/include/addTimeOptions.H
Normal file
8
src/OpenFOAM/include/addTimeOptions.H
Normal file
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
// addTimeOptions.H
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
|
||||
Foam::argList::validOptions.insert("constant", "");
|
||||
Foam::argList::validOptions.insert("latestTime", "");
|
||||
Foam::argList::validOptions.insert("noZero", "");
|
||||
Foam::argList::validOptions.insert("time", "time");
|
|
@ -112,7 +112,7 @@ static void Foam::DenseMatrixTools::qrDecompose
|
|||
(
|
||||
const label nCols,
|
||||
FieldField<Field, Type>& A,
|
||||
Matrix<Form, T>& R
|
||||
Matrix<Form, Type>& R
|
||||
)
|
||||
{
|
||||
// Note: consider Arnoldi algorithm for speed-up. HJ, 14/Sep/2006
|
||||
|
|
|
@ -51,12 +51,12 @@ namespace DenseMatrixTools
|
|||
static void solve(SquareMatrix<Type>& A, List<Type>& x, List<Type>& b);
|
||||
|
||||
//- Q-R decomposition
|
||||
template<class Form, class T>
|
||||
template<class Form, class Type>
|
||||
static void qrDecompose
|
||||
(
|
||||
const label nCols,
|
||||
FieldField<Field, T>& A,
|
||||
Matrix<class Form, class Type>& R
|
||||
FieldField<Field, Type>& A,
|
||||
Matrix<Form, Type>& R
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -125,36 +125,15 @@ Foam::lduSolverPerformance Foam::PBiCG::solve
|
|||
// Select and construct the preconditioner
|
||||
autoPtr<lduPreconditioner> preconPtr;
|
||||
|
||||
if (dict().isDict("preconditioner"))
|
||||
{
|
||||
// New format: preconditioner is dictionary
|
||||
preconPtr =
|
||||
lduPreconditioner::New
|
||||
(
|
||||
matrix_,
|
||||
coupleBouCoeffs_,
|
||||
coupleIntCoeffs_,
|
||||
interfaces_,
|
||||
dict().subDict("preconditioner")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Old format: manufacture a dictionary
|
||||
dictionary preconDict;
|
||||
preconDict.add("type", word(dict().lookup("preconditioner")));
|
||||
|
||||
preconPtr =
|
||||
lduPreconditioner::New
|
||||
(
|
||||
matrix_,
|
||||
coupleBouCoeffs_,
|
||||
coupleIntCoeffs_,
|
||||
interfaces_,
|
||||
preconDict
|
||||
);
|
||||
}
|
||||
|
||||
preconPtr =
|
||||
lduPreconditioner::New
|
||||
(
|
||||
matrix_,
|
||||
coupleBouCoeffs_,
|
||||
coupleIntCoeffs_,
|
||||
interfaces_,
|
||||
dict().subDict("preconditioner")
|
||||
);
|
||||
|
||||
// Solver iteration
|
||||
do
|
||||
|
|
|
@ -115,38 +115,15 @@ Foam::lduSolverPerformance Foam::PCG::solve
|
|||
// Select and construct the preconditioner
|
||||
autoPtr<lduPreconditioner> preconPtr;
|
||||
|
||||
// For backward compatibility, check type of preconditioner entry
|
||||
// HJ, 2/Oct/2007
|
||||
|
||||
if (dict().isDict("preconditioner"))
|
||||
{
|
||||
// New format: preconditioner is dictionary
|
||||
preconPtr =
|
||||
lduPreconditioner::New
|
||||
(
|
||||
matrix_,
|
||||
coupleBouCoeffs_,
|
||||
coupleIntCoeffs_,
|
||||
interfaces_,
|
||||
dict().subDict("preconditioner")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Old format: manufacture a dictionary
|
||||
dictionary preconDict;
|
||||
preconDict.add("type", word(dict().lookup("preconditioner")));
|
||||
|
||||
preconPtr =
|
||||
lduPreconditioner::New
|
||||
(
|
||||
matrix_,
|
||||
coupleBouCoeffs_,
|
||||
coupleIntCoeffs_,
|
||||
interfaces_,
|
||||
preconDict
|
||||
);
|
||||
}
|
||||
preconPtr =
|
||||
lduPreconditioner::New
|
||||
(
|
||||
matrix_,
|
||||
coupleBouCoeffs_,
|
||||
coupleIntCoeffs_,
|
||||
interfaces_,
|
||||
dict()
|
||||
);
|
||||
|
||||
// Solver iteration
|
||||
do
|
||||
|
|
203
src/OpenFOAM/matrices/scalarMatrices/scalarSquareMatrix.C
Normal file
203
src/OpenFOAM/matrices/scalarMatrices/scalarSquareMatrix.C
Normal file
|
@ -0,0 +1,203 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "scalarSquareMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalarSquareMatrix::scalarSquareMatrix()
|
||||
{}
|
||||
|
||||
|
||||
Foam::scalarSquareMatrix::scalarSquareMatrix(const label mSize)
|
||||
:
|
||||
SquareMatrix<scalar>(mSize, 0.0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::scalarSquareMatrix::scalarSquareMatrix
|
||||
(
|
||||
const label mSize,
|
||||
const scalar v
|
||||
)
|
||||
:
|
||||
SquareMatrix<scalar>(mSize, v)
|
||||
{}
|
||||
|
||||
|
||||
Foam::scalarSquareMatrix::scalarSquareMatrix(const scalarSquareMatrix& matrix)
|
||||
:
|
||||
SquareMatrix<scalar>(matrix)
|
||||
{}
|
||||
|
||||
|
||||
Foam::scalarSquareMatrix::scalarSquareMatrix(Istream& is)
|
||||
:
|
||||
SquareMatrix<scalar>(is)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::scalarSquareMatrix::LUDecompose
|
||||
(
|
||||
scalarSquareMatrix& matrix,
|
||||
labelList& pivotIndices
|
||||
)
|
||||
{
|
||||
label n = matrix.n();
|
||||
scalar vv[n];
|
||||
|
||||
for (register label i=0; i<n; i++)
|
||||
{
|
||||
scalar largestCoeff = 0.0;
|
||||
scalar temp;
|
||||
const scalar* __restrict__ matrixi = matrix[i];
|
||||
|
||||
for (register label j=0; j<n; j++)
|
||||
{
|
||||
if ((temp = mag(matrixi[j])) > largestCoeff)
|
||||
{
|
||||
largestCoeff = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (largestCoeff == 0.0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"scalarSquareMatrix::LUdecompose"
|
||||
"(scalarSquareMatrix& matrix, labelList& rowIndices)"
|
||||
) << "Singular matrix" << exit(FatalError);
|
||||
}
|
||||
|
||||
vv[i] = 1.0/largestCoeff;
|
||||
}
|
||||
|
||||
for (register label j=0; j<n; j++)
|
||||
{
|
||||
scalar* __restrict__ matrixj = matrix[j];
|
||||
|
||||
for (register label i=0; i<j; i++)
|
||||
{
|
||||
scalar* __restrict__ matrixi = matrix[i];
|
||||
|
||||
scalar sum = matrixi[j];
|
||||
for (register label k=0; k<i; k++)
|
||||
{
|
||||
sum -= matrixi[k]*matrix[k][j];
|
||||
}
|
||||
matrixi[j] = sum;
|
||||
}
|
||||
|
||||
label iMax = 0;
|
||||
|
||||
scalar largestCoeff = 0.0;
|
||||
for (register label i=j; i<n; i++)
|
||||
{
|
||||
scalar* __restrict__ matrixi = matrix[i];
|
||||
scalar sum = matrixi[j];
|
||||
|
||||
for (register label k=0; k<j; k++)
|
||||
{
|
||||
sum -= matrixi[k]*matrix[k][j];
|
||||
}
|
||||
|
||||
matrixi[j] = sum;
|
||||
|
||||
scalar temp;
|
||||
if ((temp = vv[i]*mag(sum)) >= largestCoeff)
|
||||
{
|
||||
largestCoeff = temp;
|
||||
iMax = i;
|
||||
}
|
||||
}
|
||||
|
||||
pivotIndices[j] = iMax;
|
||||
|
||||
if (j != iMax)
|
||||
{
|
||||
scalar* __restrict__ matrixiMax = matrix[iMax];
|
||||
|
||||
for (register label k=0; k<n; k++)
|
||||
{
|
||||
Swap(matrixj[k], matrixiMax[k]);
|
||||
}
|
||||
|
||||
vv[iMax] = vv[j];
|
||||
}
|
||||
|
||||
if (matrixj[j] == 0.0)
|
||||
{
|
||||
matrixj[j] = SMALL;
|
||||
}
|
||||
|
||||
if (j != n-1)
|
||||
{
|
||||
scalar rDiag = 1.0/matrixj[j];
|
||||
|
||||
for (register label i=j+1; i<n; i++)
|
||||
{
|
||||
matrix[i][j] *= rDiag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::scalarSquareMatrix Foam::scalarSquareMatrix::LUinvert() const
|
||||
{
|
||||
scalarSquareMatrix luMatrix = *this;
|
||||
|
||||
scalarSquareMatrix luInvert(luMatrix.n());
|
||||
scalarField column(luMatrix.n());
|
||||
|
||||
labelList pivotIndices(luMatrix.n());
|
||||
|
||||
LUDecompose(luMatrix, pivotIndices);
|
||||
|
||||
for (label j = 0; j < luMatrix.n(); j++)
|
||||
{
|
||||
for (label i = 0; i < luMatrix.n(); i++)
|
||||
{
|
||||
column[i] = 0.0;
|
||||
}
|
||||
|
||||
column[j] = 1.0;
|
||||
|
||||
LUBacksubstitute(luMatrix, pivotIndices, column);
|
||||
|
||||
for (label i = 0; i < luMatrix.n(); i++)
|
||||
{
|
||||
luInvert[i][j] = column[i];
|
||||
}
|
||||
}
|
||||
|
||||
return luInvert;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -23,20 +23,21 @@ License
|
|||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::receivingReferralList
|
||||
Foam::scalarSquareMatrix
|
||||
|
||||
Description
|
||||
Foam::scalarSquareMatrix
|
||||
|
||||
SourceFiles
|
||||
receivingReferralListI.H
|
||||
receivingReferralList.C
|
||||
receivingReferralListIO.C
|
||||
scalarSquareMatrix.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef receivingReferralList_H
|
||||
#define receivingReferralList_H
|
||||
#ifndef scalarSquareMatrix_H
|
||||
#define scalarSquareMatrix_H
|
||||
|
||||
#include "SquareMatrix.H"
|
||||
#include "scalarField.H"
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -45,81 +46,72 @@ namespace Foam
|
|||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class receivingReferralList Declaration
|
||||
Class scalarSquareMatrix Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class receivingReferralList
|
||||
class scalarSquareMatrix
|
||||
:
|
||||
public labelListList
|
||||
public SquareMatrix<scalar>
|
||||
{
|
||||
// Private data
|
||||
|
||||
label sourceProc_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
receivingReferralList();
|
||||
scalarSquareMatrix();
|
||||
|
||||
//- Construct from components
|
||||
receivingReferralList
|
||||
(
|
||||
const label sourceProc,
|
||||
const labelListList& refCellsToSendTo
|
||||
);
|
||||
//- Construct given size
|
||||
scalarSquareMatrix(const label);
|
||||
|
||||
//- Construct given size and coefficient value
|
||||
scalarSquareMatrix(const label, const scalar v);
|
||||
|
||||
//- Construct as copy
|
||||
receivingReferralList(const receivingReferralList&);
|
||||
scalarSquareMatrix(const scalarSquareMatrix&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~receivingReferralList();
|
||||
//- Construct from Istream
|
||||
scalarSquareMatrix(Istream&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
//- Solve the matrix using Gaussian elimination with pivoting,
|
||||
// returning the solution in the source.
|
||||
// Matrix given as a reference is destroyed during solution
|
||||
template<class T>
|
||||
static void solve(scalarSquareMatrix& matrix, Field<T>& source);
|
||||
|
||||
inline label sourceProc() const;
|
||||
//- Solve the matrix using Gaussian elimination with pivoting
|
||||
// and return the solution
|
||||
template<class Type>
|
||||
void solve(Field<Type>& psi, const Field<Type>& source) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const receivingReferralList&);
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
friend bool operator==
|
||||
//- LU decompose the matrix with pivoting
|
||||
static void LUDecompose
|
||||
(
|
||||
const receivingReferralList& a,
|
||||
const receivingReferralList& b
|
||||
scalarSquareMatrix& matrix,
|
||||
labelList& pivotIndices
|
||||
);
|
||||
|
||||
inline friend bool operator!=
|
||||
//- LU back-substitution with given source, returning the solution
|
||||
// in the source
|
||||
template<class Type>
|
||||
static void LUBacksubstitute
|
||||
(
|
||||
const receivingReferralList& a,
|
||||
const receivingReferralList& b
|
||||
const scalarSquareMatrix& luMmatrix,
|
||||
const labelList& pivotIndices,
|
||||
Field<Type>& source
|
||||
);
|
||||
|
||||
//- Invert the matrix using LU decomposition with pivoting
|
||||
scalarSquareMatrix LUinvert() const;
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>>
|
||||
(
|
||||
Istream&,
|
||||
receivingReferralList&
|
||||
);
|
||||
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const receivingReferralList&
|
||||
);
|
||||
//- Solve the matrix using LU decomposition with pivoting
|
||||
// returning the LU form of the matrix and the solution in the source
|
||||
template<class Type>
|
||||
static void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
|
||||
};
|
||||
|
||||
|
||||
|
@ -129,7 +121,9 @@ public:
|
|||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "receivingReferralListI.H"
|
||||
#ifdef NoRepository
|
||||
# include "scalarSquareMatrixTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "scalarSquareMatrix.H"
|
||||
#include "Swap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::scalarSquareMatrix::solve
|
||||
(
|
||||
scalarSquareMatrix& tmpMatrix,
|
||||
Field<Type>& sourceSol
|
||||
)
|
||||
{
|
||||
label n = tmpMatrix.n();
|
||||
|
||||
// Elimination
|
||||
for (register label i=0; i<n; i++)
|
||||
{
|
||||
label iMax = i;
|
||||
scalar largestCoeff = mag(tmpMatrix[iMax][i]);
|
||||
|
||||
// Swap entries around to find a good pivot
|
||||
for (register label j=i+1; j<n; j++)
|
||||
{
|
||||
if (mag(tmpMatrix[j][i]) > largestCoeff)
|
||||
{
|
||||
iMax = j;
|
||||
largestCoeff = mag(tmpMatrix[iMax][i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (i != iMax)
|
||||
{
|
||||
//Info<< "Pivoted on " << i << " " << iMax << endl;
|
||||
|
||||
for (register label k=i; k<n; k++)
|
||||
{
|
||||
Swap(tmpMatrix[i][k], tmpMatrix[iMax][k]);
|
||||
}
|
||||
Swap(sourceSol[i], sourceSol[iMax]);
|
||||
}
|
||||
|
||||
// Check that the system of equations isn't singular
|
||||
if (mag(tmpMatrix[i][i]) < 1e-20)
|
||||
{
|
||||
FatalErrorIn("solve(scalarSquareMatrix&, Field<Type>& sourceSol)")
|
||||
<< "Singular Matrix"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Reduce to upper triangular form
|
||||
for (register label j=i+1; j<n; j++)
|
||||
{
|
||||
sourceSol[j] -= sourceSol[i]*(tmpMatrix[j][i]/tmpMatrix[i][i]);
|
||||
|
||||
for (register label k=n-1; k>=i; k--)
|
||||
{
|
||||
tmpMatrix[j][k] -=
|
||||
tmpMatrix[i][k]*tmpMatrix[j][i]/tmpMatrix[i][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Back-substitution
|
||||
for (register label j=n-1; j>=0; j--)
|
||||
{
|
||||
Type ntempvec = pTraits<Type>::zero;
|
||||
|
||||
for (register label k=j+1; k<n; k++)
|
||||
{
|
||||
ntempvec += tmpMatrix[j][k]*sourceSol[k];
|
||||
}
|
||||
|
||||
sourceSol[j] = (sourceSol[j] - ntempvec)/tmpMatrix[j][j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::scalarSquareMatrix::solve
|
||||
(
|
||||
Field<Type>& psi,
|
||||
const Field<Type>& source
|
||||
) const
|
||||
{
|
||||
scalarSquareMatrix tmpMatrix = *this;
|
||||
psi = source;
|
||||
solve(tmpMatrix, psi);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::scalarSquareMatrix::LUBacksubstitute
|
||||
(
|
||||
const scalarSquareMatrix& luMatrix,
|
||||
const labelList& pivotIndices,
|
||||
Field<Type>& sourceSol
|
||||
)
|
||||
{
|
||||
label n = luMatrix.n();
|
||||
|
||||
label ii = 0;
|
||||
|
||||
for (register label i=0; i<n; i++)
|
||||
{
|
||||
label ip = pivotIndices[i];
|
||||
Type sum = sourceSol[ip];
|
||||
sourceSol[ip] = sourceSol[i];
|
||||
const scalar* __restrict__ luMatrixi = luMatrix[i];
|
||||
|
||||
if (ii != 0)
|
||||
{
|
||||
for (label j=ii-1; j<i; j++)
|
||||
{
|
||||
sum -= luMatrixi[j]*sourceSol[j];
|
||||
}
|
||||
}
|
||||
else if (sum != pTraits<Type>::zero)
|
||||
{
|
||||
ii = i+1;
|
||||
}
|
||||
|
||||
sourceSol[i] = sum;
|
||||
}
|
||||
|
||||
for (register label i=n-1; i>=0; i--)
|
||||
{
|
||||
Type sum = sourceSol[i];
|
||||
const scalar* __restrict__ luMatrixi = luMatrix[i];
|
||||
|
||||
for (register label j=i+1; j<n; j++)
|
||||
{
|
||||
sum -= luMatrixi[j]*sourceSol[j];
|
||||
}
|
||||
|
||||
sourceSol[i] = sum/luMatrixi[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::scalarSquareMatrix::LUsolve
|
||||
(
|
||||
scalarSquareMatrix& matrix,
|
||||
Field<Type>& sourceSol
|
||||
)
|
||||
{
|
||||
labelList pivotIndices(matrix.n());
|
||||
LUDecompose(matrix, pivotIndices);
|
||||
LUBacksubstitute(matrix, pivotIndices, sourceSol);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -81,10 +81,12 @@ protected:
|
|||
virtual void calcGeometry();
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(const pointField&);
|
||||
virtual void initMovePoints(const pointField&)
|
||||
{}
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints();
|
||||
virtual void movePoints()
|
||||
{}
|
||||
|
||||
//- Initialise the update of the patch topology
|
||||
virtual void initUpdateMesh();
|
||||
|
|
112
src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointEdges.C
Normal file
112
src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointEdges.C
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "primitiveMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void primitiveMesh::calcPointEdges() const
|
||||
{
|
||||
// Loop through edges and mark up points
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "primitiveMesh::calcPointEdges() : "
|
||||
<< "calculating pointEdges"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// It is an error to attempt to recalculate pointEdges
|
||||
// if the pointer is already set
|
||||
if (pePtr_)
|
||||
{
|
||||
FatalErrorIn("primitiveMesh::calcPointEdges() const")
|
||||
<< "pointEdges already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
const edgeList& e = edges();
|
||||
|
||||
// Count edges per point
|
||||
|
||||
labelList npe(nPoints(), 0);
|
||||
|
||||
forAll (e, edgeI)
|
||||
{
|
||||
npe[e[edgeI].start()]++;
|
||||
npe[e[edgeI].end()]++;
|
||||
}
|
||||
|
||||
|
||||
// Size and fill edges per point
|
||||
|
||||
pePtr_ = new labelListList(npe.size());
|
||||
labelListList& pointEdgeAddr = *pePtr_;
|
||||
|
||||
forAll (pointEdgeAddr, pointI)
|
||||
{
|
||||
pointEdgeAddr[pointI].setSize(npe[pointI]);
|
||||
}
|
||||
npe = 0;
|
||||
|
||||
forAll (e, edgeI)
|
||||
{
|
||||
label v0 = e[edgeI].start();
|
||||
|
||||
pointEdgeAddr[v0][npe[v0]++] = edgeI;
|
||||
|
||||
label v1 = e[edgeI].end();
|
||||
|
||||
pointEdgeAddr[v1][npe[v1]++] = edgeI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const labelListList& primitiveMesh::pointEdges() const
|
||||
{
|
||||
if (!pePtr_)
|
||||
{
|
||||
calcPointEdges();
|
||||
}
|
||||
|
||||
return *pePtr_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
|
@ -33,6 +33,8 @@ SourceFiles
|
|||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// template specialisation for pTraits<Scalar>
|
||||
|
|
|
@ -28,6 +28,7 @@ License
|
|||
#include "products.H"
|
||||
#include "VectorSpaceM.H"
|
||||
#include "ops.H"
|
||||
#include "pTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -2851,13 +2851,18 @@ void Foam::autoLayerDriver::addLayers
|
|||
// Saved old points
|
||||
pointField oldPoints(mesh.points());
|
||||
|
||||
// Last set of topology changes. (changing mesh clears out polyTopoChange)
|
||||
polyTopoChange savedMeshMod(mesh.boundaryMesh().size());
|
||||
// Last set of topology changes. Changing mesh clears out directTopoChange
|
||||
directTopoChange savedMeshMod(mesh.boundaryMesh().size());
|
||||
|
||||
boolList flaggedCells;
|
||||
boolList flaggedFaces;
|
||||
|
||||
for (label iteration = 0; iteration < layerParams.nLayerIter(); iteration++)
|
||||
for
|
||||
(
|
||||
label iteration = 0;
|
||||
iteration < layerParams.nLayerIter();
|
||||
iteration++
|
||||
)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Layer addition iteration " << iteration << nl
|
||||
|
|
|
@ -36,6 +36,7 @@ SourceFiles
|
|||
#ifndef autoLayerDriver_H
|
||||
#define autoLayerDriver_H
|
||||
|
||||
#include "PackedBoolList.H"
|
||||
#include "meshRefinement.H"
|
||||
#include "wallPoint.H"
|
||||
|
||||
|
@ -379,7 +380,8 @@ class autoLayerDriver
|
|||
Field<Type>& average
|
||||
);
|
||||
|
||||
//- Calculate inverse sum of edge weights (currently always 1.0)
|
||||
//- Calculate inverse sum of edge weights
|
||||
// (currently always 1.0)
|
||||
void sumWeights
|
||||
(
|
||||
const PackedBoolList& isMasterEdge,
|
||||
|
|
|
@ -25,7 +25,7 @@ License
|
|||
Description
|
||||
Shrinking mesh (part of adding cell layers)
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "autoLayerDriver.H"
|
||||
#include "fvMesh.H"
|
||||
|
@ -1132,7 +1132,8 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
|
|||
Info<< "Iteration " << iter << endl;
|
||||
if (iter == nSnap)
|
||||
{
|
||||
Info<< "Displacement scaling for error reduction set to 0." << endl;
|
||||
Info<< "Displacement scaling for error reduction set to 0."
|
||||
<< endl;
|
||||
oldErrorReduction = meshMover.setErrorReduction(0.0);
|
||||
}
|
||||
|
||||
|
@ -1149,7 +1150,8 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
|
|||
)
|
||||
)
|
||||
{
|
||||
Info<< "shrinkMeshMedialDistance : Successfully moved mesh" << endl;
|
||||
Info<< "shrinkMeshMedialDistance : Successfully moved mesh"
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ SourceFiles
|
|||
#ifndef autoSnapDriver_H
|
||||
#define autoSnapDriver_H
|
||||
|
||||
#include "PackedBoolList.H"
|
||||
#include "meshRefinement.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Foam
|
|||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class decompositionMethod Declaration
|
||||
Class decompositionMethod Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class decompositionMethod
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
EXE_INC = \
|
||||
-I$(WM_THIRD_PARTY_DIR)/scotch_5.1/src/libscotch \
|
||||
-I$(WM_THIRD_PARTY_DIR)/scotch_5.1/src/libscotch/lnInclude \
|
||||
-I/usr/include/scotch \
|
||||
-I../decompositionMethods/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lscotch
|
||||
-lscotch \
|
||||
-lscotcherrexit
|
||||
|
|
|
@ -44,10 +44,10 @@ Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
|
|||
Foam::dynamicFvMesh::dynamicFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& points,
|
||||
const faceList& faces,
|
||||
const labelList& owner,
|
||||
const labelList& neighbour,
|
||||
const Xfer<pointField>& points,
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<labelList>& allOwner,
|
||||
const Xfer<labelList>& allNeighbour,
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
|
@ -56,8 +56,8 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
|||
io,
|
||||
points,
|
||||
faces,
|
||||
owner,
|
||||
neighbour,
|
||||
allOwner,
|
||||
allNeighbour,
|
||||
syncPar
|
||||
)
|
||||
{}
|
||||
|
@ -66,9 +66,9 @@ Foam::dynamicFvMesh::dynamicFvMesh
|
|||
Foam::dynamicFvMesh::dynamicFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& points,
|
||||
const faceList& faces,
|
||||
const cellList& cells,
|
||||
const Xfer<pointField>& points,
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<cellList>& cells,
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
|
|
|
@ -92,10 +92,10 @@ public:
|
|||
dynamicFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& points,
|
||||
const faceList& faces,
|
||||
const labelList& owner,
|
||||
const labelList& neighbour,
|
||||
const Xfer<pointField>& points,
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<labelList>& allOwner,
|
||||
const Xfer<labelList>& allNeighbour,
|
||||
const bool syncPar = true
|
||||
);
|
||||
|
||||
|
@ -106,9 +106,9 @@ public:
|
|||
dynamicFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& points,
|
||||
const faceList& faces,
|
||||
const cellList& cells,
|
||||
const Xfer<pointField>& points,
|
||||
const Xfer<faceList>& faces,
|
||||
const Xfer<cellList>& cells,
|
||||
const bool syncPar = true
|
||||
);
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ class tetMetric
|
|||
//- Disallow default bitwise assignment
|
||||
void operator=(const tetMetric&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Typedef for tetrahedral metrics
|
||||
|
@ -73,6 +74,7 @@ public:
|
|||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Selector
|
||||
|
||||
static tetMetricReturnType New
|
||||
|
@ -81,6 +83,7 @@ public:
|
|||
const word& metricName
|
||||
);
|
||||
|
||||
|
||||
// Member Function Selectors
|
||||
|
||||
declareMemberFunctionSelectionTable
|
||||
|
@ -105,6 +108,11 @@ public:
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~tetMetric()
|
||||
{}
|
||||
};
|
||||
|
||||
} // End namespace Foam
|
||||
|
|
|
@ -64,7 +64,8 @@ class Knupp
|
|||
//- Disallow default bitwise assignment
|
||||
void operator=(const Knupp&);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Knupp");
|
||||
|
@ -76,6 +77,12 @@ class Knupp
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~Knupp()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
@ -94,7 +101,8 @@ class Dihedral
|
|||
// Enumeration for tets
|
||||
static label tetEnum[6][4];
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Dihedral");
|
||||
|
@ -106,6 +114,12 @@ class Dihedral
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~Dihedral()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
@ -133,6 +147,12 @@ class cubicMeanRatio
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~cubicMeanRatio()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
@ -148,7 +168,8 @@ class Frobenius
|
|||
//- Disallow default bitwise assignment
|
||||
void operator=(const Frobenius&);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Frobenius");
|
||||
|
@ -160,6 +181,12 @@ class Frobenius
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~Frobenius()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
@ -175,7 +202,8 @@ class PGH
|
|||
//- Disallow default bitwise assignment
|
||||
void operator=(const PGH&);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("PGH");
|
||||
|
@ -187,6 +215,12 @@ class PGH
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~PGH()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
@ -202,7 +236,8 @@ class CSG
|
|||
//- Disallow default bitwise assignment
|
||||
void operator=(const CSG&);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("CSG");
|
||||
|
@ -214,6 +249,12 @@ class CSG
|
|||
const point& p2,
|
||||
const point& p3
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~CSG()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -99,6 +99,6 @@ directTopoChange/boundaryMesh/boundaryMesh.C
|
|||
directTopoChange/fvMeshDistribute/fvMeshDistribute.C
|
||||
|
||||
|
||||
directTopoChange/repatch/repatch.C
|
||||
directTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libdynamicMesh
|
||||
|
|
|
@ -27,7 +27,7 @@ License
|
|||
#include "boundaryMesh.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "repatch.H"
|
||||
#include "repatchPolyTopoChanger.H"
|
||||
#include "faceList.H"
|
||||
#include "octree.H"
|
||||
#include "octreeDataFaceList.H"
|
||||
|
@ -1232,8 +1232,8 @@ void Foam::boundaryMesh::patchify
|
|||
}
|
||||
|
||||
// Actually add new list of patches
|
||||
repatch polyMeshRepatcher(newMesh);
|
||||
polyMeshRepatcher.changePatches(newPatchPtrList);
|
||||
repatchPolyTopoChanger rep(newMesh);
|
||||
rep.changePatches(newPatchPtrList);
|
||||
|
||||
|
||||
// Pass2:
|
||||
|
@ -1289,11 +1289,11 @@ void Foam::boundaryMesh::patchify
|
|||
|
||||
forAll(pFaces, pFaceI)
|
||||
{
|
||||
polyMeshRepatcher.changePatchID(pFaces[pFaceI], newPatchI);
|
||||
rep.changePatchID(pFaces[pFaceI], newPatchI);
|
||||
}
|
||||
}
|
||||
|
||||
polyMeshRepatcher.execute();
|
||||
rep.repatch();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ bool Foam::octreeDataFaceList::overlaps
|
|||
const treeBoundBox& sampleBb
|
||||
) const
|
||||
{
|
||||
return sampleBb.intersects(allBb_[index]);
|
||||
return sampleBb.overlaps(allBb_[index]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -434,7 +434,7 @@ bool Foam::octreeDataFaceList::intersects
|
|||
// Disable picking up intersections behind us.
|
||||
scalar oldTol = intersection::setPlanarTol(0.0);
|
||||
|
||||
pointHit inter =
|
||||
pointHit inter =
|
||||
f.ray
|
||||
(
|
||||
start,
|
||||
|
|
|
@ -57,7 +57,7 @@ SourceFiles
|
|||
#include "DynamicList.H"
|
||||
#include "point.H"
|
||||
#include "Map.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "typeInfo.H"
|
||||
#include "edgeList.H"
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ SourceFiles
|
|||
|
||||
#include "labelIOList.H"
|
||||
#include "face.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "DynamicList.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "removeFaces.H"
|
||||
|
|
|
@ -46,7 +46,7 @@ SourceFiles
|
|||
#include "typeInfo.H"
|
||||
#include "Map.H"
|
||||
#include "labelList.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "faceList.H"
|
||||
#include "boolList.H"
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ SourceFiles
|
|||
#define removeFaces_H
|
||||
|
||||
#include "Pstream.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "Map.H"
|
||||
#include "boolList.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
|
|
|
@ -3036,11 +3036,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::changeMesh
|
|||
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
nActiveFaces_,
|
||||
renumberedMeshPoints,
|
||||
faces_,
|
||||
faceOwner_,
|
||||
faceNeighbour_,
|
||||
xferMove(renumberedMeshPoints),
|
||||
faces_.xfer(),
|
||||
faceOwner_.xfer(),
|
||||
faceNeighbour_.xfer(),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
syncParallel
|
||||
|
@ -3053,11 +3052,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::changeMesh
|
|||
// Set new points.
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
nActiveFaces_,
|
||||
newPoints,
|
||||
faces_,
|
||||
faceOwner_,
|
||||
faceNeighbour_,
|
||||
xferMove(newPoints),
|
||||
faces_.xfer(),
|
||||
faceOwner_.xfer(),
|
||||
faceNeighbour_.xfer(),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
syncParallel
|
||||
|
@ -3299,10 +3297,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::makeMesh
|
|||
new fvMesh
|
||||
(
|
||||
io,
|
||||
newPoints,
|
||||
faces_,
|
||||
faceOwner_,
|
||||
faceNeighbour_
|
||||
xferMove(newPoints),
|
||||
faces_.xfer(),
|
||||
faceOwner_.xfer(),
|
||||
faceNeighbour_.xfer()
|
||||
)
|
||||
);
|
||||
fvMesh& newMesh = newMeshPtr();
|
||||
|
|
|
@ -73,7 +73,7 @@ SourceFiles
|
|||
#include "PtrList.H"
|
||||
#include "cellList.H"
|
||||
#include "Map.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "CompactListList.H"
|
||||
#include "PackedList.H"
|
||||
|
|
|
@ -0,0 +1,257 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CompactListList_dev.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev(const List<Container>& ll)
|
||||
:
|
||||
size_(ll.size()),
|
||||
offsets_(ll.size()+1)
|
||||
{
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(ll, i)
|
||||
{
|
||||
sumSize += ll[i].size();
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize);
|
||||
|
||||
label k = 0;
|
||||
forAll(ll, i)
|
||||
{
|
||||
const Container& lli = ll[i];
|
||||
|
||||
forAll(lli, j)
|
||||
{
|
||||
m_[k++] = lli[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const UList<label>& rowSizes
|
||||
)
|
||||
:
|
||||
size_(rowSizes.size()),
|
||||
offsets_(rowSizes.size()+1)
|
||||
{
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
sumSize += rowSizes[i];
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const UList<label>& rowSizes,
|
||||
const T& t
|
||||
)
|
||||
:
|
||||
size_(rowSizes.size()),
|
||||
offsets_(rowSizes.size()+1)
|
||||
{
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
sumSize += rowSizes[i];
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const Xfer<CompactListList_dev<T, Container> >& lst
|
||||
)
|
||||
{
|
||||
transfer(lst());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
CompactListList_dev<T, Container>& lst,
|
||||
bool reUse
|
||||
)
|
||||
:
|
||||
size_(lst.size()),
|
||||
offsets_(lst.offsets_, reUse),
|
||||
m_(lst.m_, reUse)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize(const label nRows)
|
||||
{
|
||||
if (nRows == 0)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
if (nRows < size())
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(offsets_[nRows]);
|
||||
}
|
||||
else if (nRows > size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"CompactListList_dev<T, Container>::setSize(const label nRows)"
|
||||
) << "Cannot be used to extend the list from " << offsets_.size()
|
||||
<< " to " << nRows << nl
|
||||
<< " Please use one of the other setSize member functions"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(nData, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize(const UList<label>& rowSizes)
|
||||
{
|
||||
size_ = rowSizes.size();
|
||||
offsets_.setSize(rowSizes.size()+1);
|
||||
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
sumSize += rowSizes[i];
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::labelList Foam::CompactListList_dev<T, Container>::sizes() const
|
||||
{
|
||||
labelList rowSizes(size());
|
||||
|
||||
if (rowSizes.size() > 0)
|
||||
{
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
rowSizes[i] = offsets_[i+1] - offsets_[i];
|
||||
}
|
||||
}
|
||||
return rowSizes;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::clear()
|
||||
{
|
||||
size_ = 0;
|
||||
offsets_.clear();
|
||||
m_.clear();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::transfer
|
||||
(
|
||||
CompactListList_dev<T, Container>& a
|
||||
)
|
||||
{
|
||||
size_ = a.size_;
|
||||
offsets_.transfer(a.offsets_);
|
||||
m_.transfer(a.m_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::List<Container> Foam::CompactListList_dev<T, Container>::operator()()
|
||||
const
|
||||
{
|
||||
List<Container> ll(size());
|
||||
|
||||
forAll(ll, i)
|
||||
{
|
||||
ll[i] = Container(operator[](i));
|
||||
}
|
||||
|
||||
return ll;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
||||
|
||||
#include "CompactListList_devIO.C"
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,270 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::CompactListList_dev
|
||||
|
||||
Description
|
||||
A packed storage unstructured matrix of objects of type \<T\>
|
||||
using an offset table for access.
|
||||
|
||||
The offset table is the size of the number of rows+1
|
||||
whose elements are the
|
||||
accumulated sizes of the rows, i.e.
|
||||
- offset[i] gives the index of first element of row i
|
||||
- offset[i+1] - offset[i] is the number of elements in row i
|
||||
|
||||
Storage is allocated on free-store during construction.
|
||||
|
||||
As a special case a null-contructed CompactListList_dev has an empty
|
||||
offsets_ (instead of size 1).
|
||||
|
||||
SourceFiles
|
||||
CompactListList_dev.C
|
||||
CompactListList_devI.H
|
||||
CompactListList_devIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CompactListListDev_H
|
||||
#define CompactListListDev_H
|
||||
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class T, class Container> class CompactListList_dev;
|
||||
|
||||
template<class T, class Container> Istream& operator>>
|
||||
(
|
||||
Istream&,
|
||||
CompactListList_dev<T, Container>&
|
||||
);
|
||||
template<class T, class Container> Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const CompactListList_dev<T, Container>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CompactListList_dev Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T, class Container = List<T> >
|
||||
class CompactListList_dev
|
||||
{
|
||||
// Private data
|
||||
|
||||
label size_;
|
||||
|
||||
//- Offset table
|
||||
List<label> offsets_;
|
||||
|
||||
//- Packed matrix of data
|
||||
List<T> m_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null CompactListList_dev
|
||||
inline static const CompactListList_dev<T, Container>& null();
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor.
|
||||
inline CompactListList_dev();
|
||||
|
||||
//- Construct by converting given List<List<T> >
|
||||
explicit CompactListList_dev(const List<Container>&);
|
||||
|
||||
//- Construct given size of offset table (number of rows)
|
||||
// and number of data.
|
||||
inline CompactListList_dev(const label nRows, const label nData);
|
||||
|
||||
//- Construct given size of offset table (number of rows),
|
||||
// the number of data and a value for all elements.
|
||||
inline CompactListList_dev(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Construct given list of row-sizes.
|
||||
explicit CompactListList_dev(const UList<label>& rowSizes);
|
||||
|
||||
//- Construct given list of row-sizes
|
||||
CompactListList_dev(const UList<label>& rowSizes, const T&);
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
explicit CompactListList_dev(const Xfer<CompactListList_dev<T, Container> >&);
|
||||
|
||||
//- Construct as copy or re-use as specified.
|
||||
CompactListList_dev(CompactListList_dev<T, Container>&, bool reUse);
|
||||
|
||||
//- Construct from Istream.
|
||||
CompactListList_dev(Istream&);
|
||||
|
||||
//- Clone
|
||||
inline autoPtr<CompactListList_dev<T, Container> > clone() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the primary size, i.e. the number of rows
|
||||
inline label size() const;
|
||||
|
||||
//- Return true if the number of rows is zero
|
||||
inline bool empty() const;
|
||||
|
||||
//- Return the offset table (= size()+1)
|
||||
inline const List<label>& offsets() const;
|
||||
|
||||
//- Return non-const access to the offset table
|
||||
inline List<label>& offsets();
|
||||
|
||||
//- Return the packed matrix of data
|
||||
inline const List<T>& m() const;
|
||||
|
||||
//- Return non-const access to the packed matrix of data
|
||||
inline List<T>& m();
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
// This form only allows contraction of the CompactListList_dev.
|
||||
void setSize(const label nRows);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
void setSize(const label nRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList_dev and value for new elements.
|
||||
void setSize(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
void setSize(const UList<label>& rowSizes);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
// This form only allows contraction of the CompactListList_dev.
|
||||
inline void resize(const label nRows);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
inline void resize(const label nRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList_dev and value for new elements.
|
||||
inline void resize(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
inline void resize(const UList<label>& rowSizes);
|
||||
|
||||
//- Clear the CompactListList_dev, i.e. set sizes to zero.
|
||||
void clear();
|
||||
|
||||
//- Return sizes (to be used e.g. for construction)
|
||||
labelList sizes() const;
|
||||
|
||||
//- Transfer the contents of the argument CompactListList_dev
|
||||
// into this CompactListList_dev and annul the argument list.
|
||||
void transfer(CompactListList_dev<T, Container>&);
|
||||
|
||||
//- Transfer the contents to the Xfer container
|
||||
inline Xfer<CompactListList_dev<T, Container> > xfer();
|
||||
|
||||
// Other
|
||||
|
||||
//- Return index into m
|
||||
inline label index(const label row, const label col) const;
|
||||
|
||||
//- Get row for index into m.
|
||||
inline label whichRow(const label index) const;
|
||||
|
||||
//- Get column index (j) given above row
|
||||
inline label whichColumn(const label row, const label index) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Return subscript-checked row as UList.
|
||||
inline UList<T> operator[](const label i);
|
||||
|
||||
//- Return const subscript-checked row as UList.
|
||||
inline const UList<T> operator[](const label i) const;
|
||||
|
||||
//- Return subscript-checked element.
|
||||
inline T& operator()(const label i, const label j);
|
||||
|
||||
//- Return const subscript-checked element.
|
||||
inline const T& operator()(const label i, const label j) const;
|
||||
|
||||
//- Return as List<Container>
|
||||
List<Container> operator()() const;
|
||||
|
||||
//- Assignment of all entries to the given value
|
||||
inline void operator=(const T&);
|
||||
|
||||
|
||||
// Istream operator
|
||||
|
||||
//- Read CompactListList_dev from Istream, discarding contents
|
||||
// of existing CompactListList_dev.
|
||||
friend Istream& operator>> <T, Container>
|
||||
(
|
||||
Istream&,
|
||||
CompactListList_dev<T, Container>&
|
||||
);
|
||||
|
||||
// Write CompactListList_dev to Ostream.
|
||||
friend Ostream& operator<< <T, Container>
|
||||
(
|
||||
Ostream&,
|
||||
const CompactListList_dev<T, Container>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
# include "CompactListList_devI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CompactListList_dev.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -0,0 +1,276 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ListOps.H"
|
||||
#include "SubList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList_dev<T, Container>::CompactListList_dev()
|
||||
:
|
||||
size_(0)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
:
|
||||
size_(nRows),
|
||||
offsets_(nRows+1, 0),
|
||||
m_(nData)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
:
|
||||
size_(nRows),
|
||||
offsets_(nRows+1, 0),
|
||||
m_(nData, t)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::autoPtr<Foam::CompactListList_dev<T, Container> >
|
||||
Foam::CompactListList_dev<T, Container>::clone() const
|
||||
{
|
||||
return autoPtr<CompactListList_dev<T, Container> >
|
||||
(
|
||||
new CompactListList_dev<T, Container>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::CompactListList_dev<T, Container>&
|
||||
Foam::CompactListList_dev<T, Container>::null()
|
||||
{
|
||||
return *reinterpret_cast< CompactListList_dev<T, Container>* >(0);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline bool Foam::CompactListList_dev<T, Container>::empty() const
|
||||
{
|
||||
return !size_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::List<Foam::label>&
|
||||
Foam::CompactListList_dev<T, Container>::offsets() const
|
||||
{
|
||||
return offsets_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::List<Foam::label>& Foam::CompactListList_dev<T, Container>::offsets()
|
||||
{
|
||||
return offsets_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
|
||||
const
|
||||
{
|
||||
return m_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
|
||||
{
|
||||
return m_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::index
|
||||
(
|
||||
const label i,
|
||||
const label j
|
||||
) const
|
||||
{
|
||||
return offsets_[i] + j;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::whichRow(const label i)
|
||||
const
|
||||
{
|
||||
if (i < 0 || i >= m_.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"CompactListList_dev<T, Container>::whichRow(const label) const"
|
||||
) << "Index " << i << " outside 0.." << m_.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return findLower(offsets_, i+1);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::whichColumn
|
||||
(
|
||||
const label row,
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
return i - index(row, 0);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::Xfer<Foam::CompactListList_dev<T, Container> >
|
||||
Foam::CompactListList_dev<T, Container>::xfer()
|
||||
{
|
||||
return xferMove(*this);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize(const label nRows)
|
||||
{
|
||||
this->setSize(nRows);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize
|
||||
(
|
||||
const UList<label>& rowSizes
|
||||
)
|
||||
{
|
||||
this->setSize(rowSizes);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::UList<T> Foam::CompactListList_dev<T, Container>::operator[]
|
||||
(
|
||||
const label i
|
||||
)
|
||||
{
|
||||
label start = offsets_[i];
|
||||
return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::UList<T>
|
||||
Foam::CompactListList_dev<T, Container>::operator[]
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
label start = offsets_[i];
|
||||
return UList<T>
|
||||
(
|
||||
(m_.size() ? const_cast<T*>(&m_[start]) : NULL),
|
||||
offsets_[i+1] - start
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline T& Foam::CompactListList_dev<T, Container>::operator()
|
||||
(
|
||||
const label i,
|
||||
const label j
|
||||
)
|
||||
{
|
||||
return m_[index(i, j)];
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const T& Foam::CompactListList_dev<T, Container>::operator()
|
||||
(
|
||||
const label i,
|
||||
const label j
|
||||
) const
|
||||
{
|
||||
return m_[index(i, j)];
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::operator=(const T& t)
|
||||
{
|
||||
m_ = t;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -24,27 +24,41 @@ License
|
|||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "bufferedAccumulator.H"
|
||||
#include "IOstreams.H"
|
||||
#include "CompactListList_dev.H"
|
||||
#include "Istream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev(Istream& is)
|
||||
{
|
||||
operator>>(is, *this);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream&
|
||||
Foam::operator<<(Ostream& os, const bufferedAccumulator<Type>& bA)
|
||||
template<class T, class Container>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, CompactListList_dev<T, Container>& lst)
|
||||
{
|
||||
is >> lst.offsets_ >> lst.m_;
|
||||
// Note: empty list gets output as two empty lists
|
||||
if (lst.offsets_.size() == 0)
|
||||
{
|
||||
lst.size_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lst.size_ = lst.offsets_.size()-1;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
os<< bA.averagesTaken_
|
||||
<< static_cast<const List< Field<Type> >&>(bA)
|
||||
<< bA.bufferOffsets();
|
||||
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
|
||||
"const Foam::bufferedAccumulator&)"
|
||||
);
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const CompactListList_dev<T, Container>& lst)
|
||||
{
|
||||
os << lst.offsets_ << lst.m_;
|
||||
return os;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -54,6 +54,7 @@ SourceFiles
|
|||
#define fvMeshDistribute_H
|
||||
|
||||
#include "Field.H"
|
||||
//#include "uLabel.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -81,58 +82,8 @@ class fvMeshDistribute
|
|||
const scalar mergeTol_;
|
||||
|
||||
|
||||
// Private classes
|
||||
|
||||
//- Check words are the same. Used in patch type checking of similarly
|
||||
// named patches.
|
||||
class checkEqualType
|
||||
{
|
||||
public:
|
||||
|
||||
void operator()(word& x, const word& y) const
|
||||
{
|
||||
if (x != y)
|
||||
{
|
||||
FatalErrorIn("checkEqualType()(word&, const word&) const")
|
||||
<< "Patch type " << x << " possibly on processor "
|
||||
<< Pstream::myProcNo()
|
||||
<< " does not equal patch type " << y
|
||||
<< " on some other processor." << nl
|
||||
<< "Please check similarly named patches for"
|
||||
<< " having exactly the same type."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Hash labelPair. Note non-commutative since p[0] is face, p[1] is
|
||||
// processor.
|
||||
class labelPairHash
|
||||
{
|
||||
public:
|
||||
|
||||
labelPairHash()
|
||||
{}
|
||||
|
||||
label operator()(const labelPair& p) const
|
||||
{
|
||||
return label(p[0]*p[0]+p[0]+p[1]);
|
||||
}
|
||||
|
||||
label operator()(const labelPair& p, const label tableSize) const
|
||||
{
|
||||
return mag(operator()(p)) % tableSize;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Given distribution work out a communication schedule. Is list
|
||||
// of pairs. First element of pair is send processor, second is
|
||||
// receive processor.
|
||||
//static List<labelPair> getSchedule(const labelList&);
|
||||
|
||||
//- Find indices with value
|
||||
static labelList select
|
||||
(
|
||||
|
@ -142,7 +93,7 @@ class fvMeshDistribute
|
|||
);
|
||||
|
||||
//- Check all procs have same names and in exactly same order.
|
||||
static void checkEqualWordList(const wordList&);
|
||||
static void checkEqualWordList(const string&, const wordList&);
|
||||
|
||||
//- Merge wordlists over all processors
|
||||
static wordList mergeWordList(const wordList&);
|
||||
|
@ -183,10 +134,9 @@ class fvMeshDistribute
|
|||
);
|
||||
|
||||
//- Init patch fields of certain type
|
||||
template<class GeoField>
|
||||
template<class GeoField, class PatchFieldType>
|
||||
void initPatchFields
|
||||
(
|
||||
const word& patchFieldType,
|
||||
const typename GeoField::value_type& initVal
|
||||
);
|
||||
|
||||
|
@ -308,7 +258,8 @@ class fvMeshDistribute
|
|||
const wordList& cellZoneNames,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc
|
||||
const labelList& sourceNewProc,
|
||||
OSstream& toDomain
|
||||
);
|
||||
//- Send subset of fields
|
||||
template<class GeoField>
|
||||
|
@ -316,7 +267,8 @@ class fvMeshDistribute
|
|||
(
|
||||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
const fvMeshSubset&
|
||||
const fvMeshSubset&,
|
||||
OSstream& toNbr
|
||||
);
|
||||
|
||||
//- Receive mesh. Opposite of sendMesh
|
||||
|
@ -329,7 +281,8 @@ class fvMeshDistribute
|
|||
const Time& runTime,
|
||||
labelList& domainSourceFace,
|
||||
labelList& domainSourceProc,
|
||||
labelList& domainSourceNewProc
|
||||
labelList& domainSourceNewProc,
|
||||
ISstream& fromNbr
|
||||
);
|
||||
|
||||
//- Receive fields. Opposite of sendFields
|
||||
|
@ -339,7 +292,17 @@ class fvMeshDistribute
|
|||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
fvMesh&,
|
||||
PtrList<GeoField>&
|
||||
PtrList<GeoField>&,
|
||||
const dictionary& fieldDicts
|
||||
);
|
||||
|
||||
//- Do parallel exchange
|
||||
template <class Container, class T>
|
||||
static void exchange
|
||||
(
|
||||
const List<Container >& sendBufs,
|
||||
List<Container >& recvBufs,
|
||||
labelListList& sizes
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
|
|
@ -25,9 +25,133 @@ License
|
|||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mapPolyMesh.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
//- combineReduce operator for lists. Used for counting.
|
||||
class listEq
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
template<class T>
|
||||
void operator()(T& x, const T& y) const
|
||||
{
|
||||
forAll(y, i)
|
||||
{
|
||||
if (y[i].size())
|
||||
{
|
||||
x[i] = y[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class Container, class T>
|
||||
void Foam::fvMeshDistribute::exchange
|
||||
(
|
||||
const List<Container >& sendBufs,
|
||||
List<Container >& recvBufs,
|
||||
labelListList& sizes
|
||||
)
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (!contiguous<T>())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Pstream::exchange(..)"
|
||||
) << "Continuous data only." << Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
if (sendBufs.size() != Pstream::nProcs())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Pstream::exchange(..)"
|
||||
) << "Size of list:" << sendBufs.size()
|
||||
<< " does not equal the number of processors:"
|
||||
<< Pstream::nProcs()
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
sizes.setSize(Pstream::nProcs());
|
||||
labelList& nsTransPs = sizes[Pstream::myProcNo()];
|
||||
nsTransPs.setSize(Pstream::nProcs());
|
||||
|
||||
forAll(sendBufs, procI)
|
||||
{
|
||||
nsTransPs[procI] = sendBufs[procI].size();
|
||||
}
|
||||
|
||||
Foam::combineReduce(sizes, listEq());
|
||||
|
||||
|
||||
// Set up receives
|
||||
// ~~~~~~~~~~~~~~~
|
||||
|
||||
recvBufs.setSize(sendBufs.size());
|
||||
forAll(sizes, procI)
|
||||
{
|
||||
label nRecv = sizes[procI][Pstream::myProcNo()];
|
||||
|
||||
if (procI != Pstream::myProcNo() && nRecv > 0)
|
||||
{
|
||||
recvBufs[procI].setSize(nRecv);
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procI,
|
||||
reinterpret_cast<char*>(recvBufs[procI].begin()),
|
||||
nRecv*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up sends
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
forAll(sendBufs, procI)
|
||||
{
|
||||
if (procI != Pstream::myProcNo() && sendBufs[procI].size() > 0)
|
||||
{
|
||||
if
|
||||
(
|
||||
!OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procI,
|
||||
reinterpret_cast<const char*>(sendBufs[procI].begin()),
|
||||
sendBufs[procI].size()*sizeof(T)
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorIn("Pstream::exchange(..)")
|
||||
<< "Cannot send outgoing message. "
|
||||
<< "to:" << procI << " nBytes:"
|
||||
<< label(sendBufs[procI].size()*sizeof(T))
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
}
|
||||
|
||||
// Do myself
|
||||
recvBufs[Pstream::myProcNo()] = sendBufs[Pstream::myProcNo()];
|
||||
}
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
|
||||
{
|
||||
|
@ -184,7 +308,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields
|
|||
|
||||
if (flds.size() != oldBflds.size())
|
||||
{
|
||||
FatalErrorIn("fvMeshDistribute::mapBoundaryFields") << "problem"
|
||||
FatalErrorIn("fvMeshDistribute::mapBoundaryFields(..)") << "problem"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
@ -235,10 +359,9 @@ void Foam::fvMeshDistribute::mapBoundaryFields
|
|||
|
||||
|
||||
// Init patch fields of certain type
|
||||
template<class GeoField>
|
||||
template<class GeoField, class PatchFieldType>
|
||||
void Foam::fvMeshDistribute::initPatchFields
|
||||
(
|
||||
const word& patchFieldType,
|
||||
const typename GeoField::value_type& initVal
|
||||
)
|
||||
{
|
||||
|
@ -264,7 +387,7 @@ void Foam::fvMeshDistribute::initPatchFields
|
|||
|
||||
forAll(bfld, patchI)
|
||||
{
|
||||
if (bfld[patchI].type() == patchFieldType)
|
||||
if (isA<PatchFieldType>(bfld[patchI]))
|
||||
{
|
||||
bfld[patchI] == initVal;
|
||||
}
|
||||
|
@ -274,19 +397,40 @@ void Foam::fvMeshDistribute::initPatchFields
|
|||
|
||||
|
||||
// Send fields. Note order supplied so we can receive in exactly the same order.
|
||||
// Note that field gets written as entry in dictionary so we
|
||||
// can construct from subdictionary.
|
||||
// (since otherwise the reading as-a-dictionary mixes up entries from
|
||||
// consecutive fields)
|
||||
// The dictionary constructed is:
|
||||
// volScalarField
|
||||
// {
|
||||
// p {internalField ..; boundaryField ..;}
|
||||
// k {internalField ..; boundaryField ..;}
|
||||
// }
|
||||
// volVectorField
|
||||
// {
|
||||
// U {internalField ... }
|
||||
// }
|
||||
|
||||
// volVectorField {U {internalField ..; boundaryField ..;}}
|
||||
//
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::sendFields
|
||||
(
|
||||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
const fvMeshSubset& subsetter
|
||||
const fvMeshSubset& subsetter,
|
||||
OSstream& toNbr
|
||||
)
|
||||
{
|
||||
toNbr << GeoField::typeName << token::NL << token::BEGIN_BLOCK << token::NL;
|
||||
forAll(fieldNames, i)
|
||||
{
|
||||
//Pout<< "Subsetting field " << fieldNames[i]
|
||||
// << " for domain:" << domain
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Subsetting field " << fieldNames[i]
|
||||
<< " for domain:" << domain << endl;
|
||||
}
|
||||
|
||||
// Send all fieldNames. This has to be exactly the same set as is
|
||||
// being received!
|
||||
|
@ -295,10 +439,12 @@ void Foam::fvMeshDistribute::sendFields
|
|||
|
||||
tmp<GeoField> tsubfld = subsetter.interpolate(fld);
|
||||
|
||||
// Send
|
||||
OPstream toNbr(Pstream::blocking, domain);
|
||||
toNbr << tsubfld();
|
||||
toNbr
|
||||
<< fieldNames[i] << token::NL << token::BEGIN_BLOCK
|
||||
<< tsubfld
|
||||
<< token::NL << token::END_BLOCK << token::NL;
|
||||
}
|
||||
toNbr << token::END_BLOCK << token::NL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,18 +455,25 @@ void Foam::fvMeshDistribute::receiveFields
|
|||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
fvMesh& mesh,
|
||||
PtrList<GeoField>& fields
|
||||
PtrList<GeoField>& fields,
|
||||
const dictionary& fieldDicts
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Receiving fields " << fieldNames
|
||||
<< " from domain:" << domain << endl;
|
||||
}
|
||||
|
||||
fields.setSize(fieldNames.size());
|
||||
|
||||
forAll(fieldNames, i)
|
||||
{
|
||||
//Pout<< "Receiving field " << fieldNames[i]
|
||||
// << " from domain:" << domain
|
||||
// << endl;
|
||||
|
||||
IPstream fromNbr(Pstream::blocking, domain);
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Constructing field " << fieldNames[i]
|
||||
<< " from domain:" << domain << endl;
|
||||
}
|
||||
|
||||
fields.set
|
||||
(
|
||||
|
@ -336,7 +489,7 @@ void Foam::fvMeshDistribute::receiveFields
|
|||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
fromNbr
|
||||
fieldDicts.subDict(fieldNames[i])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1396,10 +1396,10 @@ Foam::autoPtr<Foam::polyMesh> Foam::polyMeshAdder::add
|
|||
new polyMesh
|
||||
(
|
||||
io,
|
||||
allPoints,
|
||||
allFaces,
|
||||
faceOwner,
|
||||
faceNeighbour
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(faceOwner),
|
||||
xferMove(faceNeighbour)
|
||||
)
|
||||
);
|
||||
polyMesh& mesh = tmesh();
|
||||
|
@ -1700,11 +1700,10 @@ Foam::autoPtr<Foam::mapAddedPolyMesh> Foam::polyMeshAdder::add
|
|||
mesh0.resetMotion(); // delete any oldPoints.
|
||||
mesh0.resetPrimitives
|
||||
(
|
||||
allFaces.size(),
|
||||
allPoints,
|
||||
allFaces,
|
||||
faceOwner,
|
||||
faceNeighbour,
|
||||
xferMove(allPoints),
|
||||
xferMove(allFaces),
|
||||
xferMove(faceOwner),
|
||||
xferMove(faceNeighbour),
|
||||
patchSizes, // size
|
||||
patchStarts, // patchstarts
|
||||
validBoundary // boundary valid?
|
||||
|
|
|
@ -31,7 +31,7 @@ License
|
|||
#include "meshTools.H"
|
||||
#include "SortableList.H"
|
||||
#include "triSurfaceTools.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "ListOps.H"
|
||||
#include "transform.H"
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ Description
|
|||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "repatchPolyTopoChanger.H"
|
||||
#include "directTopoChanger.H"
|
||||
#include "directTopoChange.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "polyModifyFace.H"
|
||||
|
||||
|
|
|
@ -130,10 +130,10 @@ void Foam::motionSmoother::makePatchPatchAddressing()
|
|||
{
|
||||
if (patchPatchPointConstraints[i].first() != 0)
|
||||
{
|
||||
patchPatchPointConstraintPoints_[nConstraints] =
|
||||
patchPatchPointConstraintPoints_[nConstraints] =
|
||||
patchPatchPoints[i];
|
||||
|
||||
patchPatchPointConstraintTensors_[nConstraints] =
|
||||
patchPatchPointConstraintTensors_[nConstraints] =
|
||||
patchPatchPointConstraints[i].constraintTransformation();
|
||||
|
||||
nConstraints++;
|
||||
|
@ -206,7 +206,7 @@ Foam::labelHashSet Foam::motionSmoother::getPoints
|
|||
// Smooth on selected points (usually patch points)
|
||||
void Foam::motionSmoother::minSmooth
|
||||
(
|
||||
const PackedList<1>& isAffectedPoint,
|
||||
const PackedBoolList& isAffectedPoint,
|
||||
const labelList& meshPoints,
|
||||
const pointScalarField& fld,
|
||||
pointScalarField& newFld
|
||||
|
@ -241,7 +241,7 @@ void Foam::motionSmoother::minSmooth
|
|||
// Smooth on all internal points
|
||||
void Foam::motionSmoother::minSmooth
|
||||
(
|
||||
const PackedList<1>& isAffectedPoint,
|
||||
const PackedBoolList& isAffectedPoint,
|
||||
const pointScalarField& fld,
|
||||
pointScalarField& newFld
|
||||
) const
|
||||
|
@ -324,7 +324,7 @@ void Foam::motionSmoother::getAffectedFacesAndPoints
|
|||
const faceSet& wrongFaces,
|
||||
|
||||
labelList& affectedFaces,
|
||||
PackedList<1>& isAffectedPoint
|
||||
PackedBoolList& isAffectedPoint
|
||||
) const
|
||||
{
|
||||
isAffectedPoint.setSize(mesh_.nPoints());
|
||||
|
@ -348,7 +348,7 @@ void Foam::motionSmoother::getAffectedFacesAndPoints
|
|||
|
||||
forAllConstIter(pointSet, nbrPoints, iter)
|
||||
{
|
||||
const labelList& pCells = mesh_.pointCells()[iter.key()];
|
||||
const labelList& pCells = mesh_.pointCells(iter.key());
|
||||
|
||||
forAll(pCells, pCellI)
|
||||
{
|
||||
|
@ -507,6 +507,12 @@ const Foam::labelList& Foam::motionSmoother::adaptPatchIDs() const
|
|||
}
|
||||
|
||||
|
||||
const Foam::dictionary& Foam::motionSmoother::paramDict() const
|
||||
{
|
||||
return paramDict_;
|
||||
}
|
||||
|
||||
|
||||
Foam::pointVectorField& Foam::motionSmoother::displacement()
|
||||
{
|
||||
return displacement_;
|
||||
|
@ -768,7 +774,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
|
|||
// Correct tangentially
|
||||
twoDCorrector_.correctPoints(newPoints);
|
||||
Info<< " ...done" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
@ -779,15 +785,13 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
|
|||
newPoints,
|
||||
minEqOp<point>(), // combine op
|
||||
vector(GREAT,GREAT,GREAT), // null
|
||||
true // separation
|
||||
true, // separation
|
||||
1e-6*mesh_.bounds().mag()
|
||||
);
|
||||
}
|
||||
|
||||
tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints);
|
||||
|
||||
//!!! Workaround for movePoints bug
|
||||
const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh()).movePoints(newPoints);
|
||||
|
||||
pp_.movePoints(mesh_.points());
|
||||
|
||||
return tsweptVol;
|
||||
|
@ -834,7 +838,29 @@ bool Foam::motionSmoother::scaleMesh
|
|||
const label nAllowableErrors
|
||||
)
|
||||
{
|
||||
if (!smoothMesh && adaptPatchIDs_.size() == 0)
|
||||
return scaleMesh
|
||||
(
|
||||
checkFaces,
|
||||
baffles,
|
||||
paramDict_,
|
||||
paramDict_,
|
||||
smoothMesh,
|
||||
nAllowableErrors
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::motionSmoother::scaleMesh
|
||||
(
|
||||
labelList& checkFaces,
|
||||
const List<labelPair>& baffles,
|
||||
const dictionary& paramDict,
|
||||
const dictionary& meshQualityDict,
|
||||
const bool smoothMesh,
|
||||
const label nAllowableErrors
|
||||
)
|
||||
{
|
||||
if (!smoothMesh && adaptPatchIDs_.empty())
|
||||
{
|
||||
FatalErrorIn("motionSmoother::scaleMesh(const bool")
|
||||
<< "You specified both no movement on the internal mesh points"
|
||||
|
@ -854,7 +880,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||
{
|
||||
if (patches[patchI].coupled())
|
||||
{
|
||||
const coupledPolyPatch& pp =
|
||||
const coupledPolyPatch& pp =
|
||||
refCast<const coupledPolyPatch>(patches[patchI]);
|
||||
|
||||
Pout<< '\t' << patchI << '\t' << pp.name()
|
||||
|
@ -867,9 +893,9 @@ bool Foam::motionSmoother::scaleMesh
|
|||
}
|
||||
|
||||
const scalar errorReduction =
|
||||
readScalar(paramDict_.lookup("errorReduction"));
|
||||
readScalar(paramDict.lookup("errorReduction"));
|
||||
const label nSmoothScale =
|
||||
readLabel(paramDict_.lookup("nSmoothScale"));
|
||||
readLabel(paramDict.lookup("nSmoothScale"));
|
||||
|
||||
|
||||
// Note: displacement_ should already be synced already from setDisplacement
|
||||
|
@ -911,7 +937,8 @@ bool Foam::motionSmoother::scaleMesh
|
|||
totalDisplacement,
|
||||
maxMagEqOp(),
|
||||
vector::zero, // null value
|
||||
false // separation
|
||||
false, // separation
|
||||
1e-6*mesh_.bounds().mag()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -929,7 +956,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||
|
||||
// Check. Returns parallel number of incorrect faces.
|
||||
faceSet wrongFaces(mesh_, "wrongFaces", mesh_.nFaces()/100+100);
|
||||
checkMesh(false, mesh_, paramDict_, checkFaces, baffles, wrongFaces);
|
||||
checkMesh(false, mesh_, meshQualityDict, checkFaces, baffles, wrongFaces);
|
||||
|
||||
if (returnReduce(wrongFaces.size(), sumOp<label>()) <= nAllowableErrors)
|
||||
{
|
||||
|
@ -989,7 +1016,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||
// Grow a few layers to determine
|
||||
// - points to be smoothed
|
||||
// - faces to be checked in next iteration
|
||||
PackedList<1> isAffectedPoint(mesh_.nPoints(), 0);
|
||||
PackedBoolList isAffectedPoint(mesh_.nPoints());
|
||||
getAffectedFacesAndPoints
|
||||
(
|
||||
nSmoothScale, // smoothing iterations
|
||||
|
@ -1005,7 +1032,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||
<< endl;
|
||||
}
|
||||
|
||||
if (adaptPatchIDs_.size() != 0)
|
||||
if (adaptPatchIDs_.size())
|
||||
{
|
||||
// Scale conflicting patch points
|
||||
scaleField(pp_.meshPoints(), usedPoints, errorReduction, scale_);
|
||||
|
@ -1018,7 +1045,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||
|
||||
for (label i = 0; i < nSmoothScale; i++)
|
||||
{
|
||||
if (adaptPatchIDs_.size() != 0)
|
||||
if (adaptPatchIDs_.size())
|
||||
{
|
||||
// Smooth patch values
|
||||
pointScalarField oldScale(scale_);
|
||||
|
@ -1048,7 +1075,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||
-GREAT, // null value
|
||||
false // no separation
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
|
|
@ -27,18 +27,18 @@ Class
|
|||
|
||||
Description
|
||||
Given a displacement moves the mesh by scaling the displacement back
|
||||
until there are no more mesh errors. Holds displacement field
|
||||
(read upon construction since need boundary conditions) and scaling factor
|
||||
and optional patch number on which to scale back displacement.
|
||||
until there are no more mesh errors.
|
||||
|
||||
E.g.
|
||||
Holds displacement field (read upon construction since need boundary
|
||||
conditions) and scaling factor and optional patch number on which to
|
||||
scale back displacement.
|
||||
|
||||
E.g.
|
||||
@verbatim
|
||||
// Construct iterative mesh mover.
|
||||
motionSmoother meshMover(mesh, labelList(1, patchI));
|
||||
|
||||
// Set wanted displacement:
|
||||
// Set desired displacement:
|
||||
meshMover.displacement() = ..
|
||||
|
||||
for (label iter = 0; iter < maxIter; iter++)
|
||||
|
@ -49,21 +49,25 @@ Description
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@envverbatim
|
||||
@endverbatim
|
||||
|
||||
Note
|
||||
- Shared points (parallel): a processor can have points which are part of
|
||||
pp on another processor but have no pp itself (i.e. it has points
|
||||
and/or edges but no faces of pp). Hence we have to be careful when e.g.
|
||||
synchronising displacements that the value from the processor which has
|
||||
faces of pp get priority. This is currently handled in setDisplacement
|
||||
by resetting the internal displacement to zero before doing anything
|
||||
else. The combine operator used will give preference to non-zero
|
||||
values.
|
||||
|
||||
Note: shared points (parallel). A processor can have points which are
|
||||
part of pp on another processor but have no pp itself (i.e. it has points
|
||||
and/or edges but no faces of pp). Hence we have to be careful when
|
||||
e.g. synchronising displacements that the value from the processor which
|
||||
has faces of pp get priority. This is currently handled in setDisplacement
|
||||
by resetting the internal displacement to zero before doing anything else.
|
||||
The combine operator used will give preference to non-zero values.
|
||||
|
||||
Note: various routines take baffles. These are sets of boundary faces
|
||||
that are treated as a single internal face. This is a hack used to apply
|
||||
- Various routines take baffles. These are sets of boundary faces that
|
||||
are treated as a single internal face. This is a hack used to apply
|
||||
movement to internal faces.
|
||||
|
||||
- Mesh constraints are looked up from the supplied dictionary. (uses
|
||||
recursive lookup)
|
||||
|
||||
SourceFiles
|
||||
motionSmoother.C
|
||||
motionSmootherTemplates.C
|
||||
|
@ -74,8 +78,8 @@ SourceFiles
|
|||
#define motionSmoother_H
|
||||
|
||||
#include "pointFields.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "PackedList.H"
|
||||
#include "HashSet.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "className.H"
|
||||
#include "twoDPointCorrector.H"
|
||||
|
@ -89,7 +93,7 @@ class polyMeshGeometry;
|
|||
class faceSet;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class motionSmoother Declaration
|
||||
Class motionSmoother Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class motionSmoother
|
||||
|
@ -158,11 +162,11 @@ class motionSmoother
|
|||
pointField oldPoints_;
|
||||
|
||||
//- Is mesh point on boundary or not
|
||||
PackedList<1> isInternalPoint_;
|
||||
PackedBoolList isInternalPoint_;
|
||||
|
||||
//- Is edge master (always except if on coupled boundary and on
|
||||
// lower processor)
|
||||
PackedList<1> isMasterEdge_;
|
||||
PackedBoolList isMasterEdge_;
|
||||
|
||||
//- 2-D motion corrector
|
||||
twoDPointCorrector twoDCorrector_;
|
||||
|
@ -205,7 +209,8 @@ class motionSmoother
|
|||
const Field<Type>&,
|
||||
const CombineOp& cop,
|
||||
const Type& zero,
|
||||
const bool separation
|
||||
const bool separation,
|
||||
const scalar maxMag
|
||||
) const;
|
||||
|
||||
//- Assemble tensors for multi-patch constraints
|
||||
|
@ -219,7 +224,7 @@ class motionSmoother
|
|||
//- explicit smoothing and min on all affected internal points
|
||||
void minSmooth
|
||||
(
|
||||
const PackedList<1>& isAffectedPoint,
|
||||
const PackedBoolList& isAffectedPoint,
|
||||
const pointScalarField& fld,
|
||||
pointScalarField& newFld
|
||||
) const;
|
||||
|
@ -227,7 +232,7 @@ class motionSmoother
|
|||
//- same but only on selected points (usually patch points)
|
||||
void minSmooth
|
||||
(
|
||||
const PackedList<1>& isAffectedPoint,
|
||||
const PackedBoolList& isAffectedPoint,
|
||||
const labelList& meshPoints,
|
||||
const pointScalarField& fld,
|
||||
pointScalarField& newFld
|
||||
|
@ -263,7 +268,7 @@ class motionSmoother
|
|||
const faceSet& wrongFaces,
|
||||
|
||||
labelList& affectedFaces,
|
||||
PackedList<1>& isAffectedPoint
|
||||
PackedBoolList& isAffectedPoint
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
@ -290,8 +295,8 @@ public:
|
|||
const dictionary& paramDict
|
||||
);
|
||||
|
||||
//- Construct from mesh, patches to work on and smoothing parameters and
|
||||
// displacementfield (only boundary conditions used)
|
||||
//- Construct from mesh, patches to work on and smoothing parameters
|
||||
// and displacement field (only boundary conditions used)
|
||||
motionSmoother
|
||||
(
|
||||
polyMesh&,
|
||||
|
@ -323,6 +328,8 @@ public:
|
|||
//- Patch labels that are being adapted
|
||||
const labelList& adaptPatchIDs() const;
|
||||
|
||||
const dictionary& paramDict() const;
|
||||
|
||||
//- Reference to displacement field
|
||||
pointVectorField& displacement();
|
||||
|
||||
|
@ -394,6 +401,17 @@ public:
|
|||
const label nAllow = 0
|
||||
);
|
||||
|
||||
//- Move mesh with externally provided mesh constraints
|
||||
bool scaleMesh
|
||||
(
|
||||
labelList& checkFaces,
|
||||
const List<labelPair>& baffles,
|
||||
const dictionary& paramDict,
|
||||
const dictionary& meshQualityDict,
|
||||
const bool smoothMesh = true,
|
||||
const label nAllow = 0
|
||||
);
|
||||
|
||||
//- Update topology
|
||||
void updateMesh();
|
||||
|
||||
|
@ -420,7 +438,7 @@ public:
|
|||
labelHashSet& wrongFaces
|
||||
);
|
||||
|
||||
//- Check (subset of mesh including baffles) with mesh settings
|
||||
//- Check (subset of mesh including baffles) with mesh settings
|
||||
// in dict. Collects incorrect faces in set. Returns true if one
|
||||
// or more faces in error. Parallel ok.
|
||||
static bool checkMesh
|
||||
|
|
|
@ -28,19 +28,6 @@ License
|
|||
#include "polyMeshGeometry.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::motionSmoother::checkMesh
|
||||
|
@ -74,17 +61,50 @@ bool Foam::motionSmoother::checkMesh
|
|||
labelHashSet& wrongFaces
|
||||
)
|
||||
{
|
||||
const scalar maxNonOrtho(readScalar(dict.lookup("maxNonOrtho")));
|
||||
const scalar minVol(readScalar(dict.lookup("minVol")));
|
||||
const scalar maxConcave(readScalar(dict.lookup("maxConcave")));
|
||||
const scalar minArea(readScalar(dict.lookup("minArea")));
|
||||
const scalar maxIntSkew(readScalar(dict.lookup("maxInternalSkewness")));
|
||||
const scalar maxBounSkew(readScalar(dict.lookup("maxBoundarySkewness")));
|
||||
const scalar minWeight(readScalar(dict.lookup("minFaceWeight")));
|
||||
const scalar minVolRatio(readScalar(dict.lookup("minVolRatio")));
|
||||
const scalar minTwist(readScalar(dict.lookup("minTwist")));
|
||||
const scalar minTriangleTwist(readScalar(dict.lookup("minTriangleTwist")));
|
||||
const scalar minDet(readScalar(dict.lookup("minDeterminant")));
|
||||
const scalar maxNonOrtho
|
||||
(
|
||||
readScalar(dict.lookup("maxNonOrtho", true))
|
||||
);
|
||||
const scalar minVol
|
||||
(
|
||||
readScalar(dict.lookup("minVol", true))
|
||||
);
|
||||
const scalar maxConcave
|
||||
(
|
||||
readScalar(dict.lookup("maxConcave", true))
|
||||
);
|
||||
const scalar minArea
|
||||
(
|
||||
readScalar(dict.lookup("minArea", true))
|
||||
);
|
||||
const scalar maxIntSkew
|
||||
(
|
||||
readScalar(dict.lookup("maxInternalSkewness", true))
|
||||
);
|
||||
const scalar maxBounSkew
|
||||
(
|
||||
readScalar(dict.lookup("maxBoundarySkewness", true))
|
||||
);
|
||||
const scalar minWeight
|
||||
(
|
||||
readScalar(dict.lookup("minFaceWeight", true))
|
||||
);
|
||||
const scalar minVolRatio
|
||||
(
|
||||
readScalar(dict.lookup("minVolRatio", true))
|
||||
);
|
||||
const scalar minTwist
|
||||
(
|
||||
readScalar(dict.lookup("minTwist", true))
|
||||
);
|
||||
const scalar minTriangleTwist
|
||||
(
|
||||
readScalar(dict.lookup("minTriangleTwist", true))
|
||||
);
|
||||
const scalar minDet
|
||||
(
|
||||
readScalar(dict.lookup("minDeterminant", true))
|
||||
);
|
||||
|
||||
label nWrongFaces = 0;
|
||||
|
||||
|
@ -389,17 +409,50 @@ bool Foam::motionSmoother::checkMesh
|
|||
labelHashSet& wrongFaces
|
||||
)
|
||||
{
|
||||
const scalar maxNonOrtho(readScalar(dict.lookup("maxNonOrtho")));
|
||||
const scalar minVol(readScalar(dict.lookup("minVol")));
|
||||
const scalar maxConcave(readScalar(dict.lookup("maxConcave")));
|
||||
const scalar minArea(readScalar(dict.lookup("minArea")));
|
||||
const scalar maxIntSkew(readScalar(dict.lookup("maxInternalSkewness")));
|
||||
const scalar maxBounSkew(readScalar(dict.lookup("maxBoundarySkewness")));
|
||||
const scalar minWeight(readScalar(dict.lookup("minFaceWeight")));
|
||||
const scalar minVolRatio(readScalar(dict.lookup("minVolRatio")));
|
||||
const scalar minTwist(readScalar(dict.lookup("minTwist")));
|
||||
const scalar minTriangleTwist(readScalar(dict.lookup("minTriangleTwist")));
|
||||
const scalar minDet(readScalar(dict.lookup("minDeterminant")));
|
||||
const scalar maxNonOrtho
|
||||
(
|
||||
readScalar(dict.lookup("maxNonOrtho", true))
|
||||
);
|
||||
const scalar minVol
|
||||
(
|
||||
readScalar(dict.lookup("minVol", true))
|
||||
);
|
||||
const scalar maxConcave
|
||||
(
|
||||
readScalar(dict.lookup("maxConcave", true))
|
||||
);
|
||||
const scalar minArea
|
||||
(
|
||||
readScalar(dict.lookup("minArea", true))
|
||||
);
|
||||
const scalar maxIntSkew
|
||||
(
|
||||
readScalar(dict.lookup("maxInternalSkewness", true))
|
||||
);
|
||||
const scalar maxBounSkew
|
||||
(
|
||||
readScalar(dict.lookup("maxBoundarySkewness", true))
|
||||
);
|
||||
const scalar minWeight
|
||||
(
|
||||
readScalar(dict.lookup("minFaceWeight", true))
|
||||
);
|
||||
const scalar minVolRatio
|
||||
(
|
||||
readScalar(dict.lookup("minVolRatio", true))
|
||||
);
|
||||
const scalar minTwist
|
||||
(
|
||||
readScalar(dict.lookup("minTwist", true))
|
||||
);
|
||||
const scalar minTriangleTwist
|
||||
(
|
||||
readScalar(dict.lookup("minTriangleTwist", true))
|
||||
);
|
||||
const scalar minDet
|
||||
(
|
||||
readScalar(dict.lookup("minDeterminant", true))
|
||||
);
|
||||
|
||||
label nWrongFaces = 0;
|
||||
|
||||
|
|
|
@ -294,7 +294,8 @@ void Foam::motionSmoother::testSyncField
|
|||
const Field<Type>& fld,
|
||||
const CombineOp& cop,
|
||||
const Type& zero,
|
||||
const bool separation
|
||||
const bool separation,
|
||||
const scalar maxMag
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
|
@ -316,7 +317,7 @@ void Foam::motionSmoother::testSyncField
|
|||
|
||||
forAll(syncedFld, i)
|
||||
{
|
||||
if (syncedFld[i] != fld[i])
|
||||
if (mag(syncedFld[i] - fld[i]) > maxMag)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
|
|
@ -40,7 +40,7 @@ SourceFiles
|
|||
#define polyMeshGeometry_H
|
||||
|
||||
#include "pointFields.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ SourceFiles
|
|||
#define polyTopoChange_H
|
||||
|
||||
#include "DynamicList.H"
|
||||
#include "labelHashSet.H"
|
||||
#include "HashSet.H"
|
||||
#include "polyAddPoint.H"
|
||||
#include "polyModifyPoint.H"
|
||||
#include "polyRemovePoint.H"
|
||||
|
|
|
@ -2228,11 +2228,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChanger::changeMesh
|
|||
|
||||
mesh.resetPrimitives
|
||||
(
|
||||
nUsedFaces,
|
||||
newPointsZeroVol,
|
||||
newFaces,
|
||||
allOwn,
|
||||
allNei,
|
||||
xferMove(newPointsZeroVol),
|
||||
xferMove(newFaces),
|
||||
xferMove(allOwn),
|
||||
xferMove(allNei),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
false // The mesh is not complete: no parallel comms
|
||||
|
|
|
@ -39,8 +39,6 @@ Foam::engineTopoChangerMesh::engineTopoChangerMesh(const IOobject& io)
|
|||
:
|
||||
fvMesh(io),
|
||||
topoChanger_(*this),
|
||||
pMesh_(*this),
|
||||
vpi_(*this, pMesh_),
|
||||
engineTime_(refCast<const engineTime>(time()))
|
||||
{}
|
||||
|
||||
|
|
|
@ -70,17 +70,10 @@ protected:
|
|||
|
||||
polyTopoChanger topoChanger_;
|
||||
|
||||
// Used when spray calculations are performed
|
||||
pointMesh pMesh_;
|
||||
|
||||
// Used when spray calculations are performed
|
||||
volPointInterpolation vpi_;
|
||||
|
||||
//- Engine database
|
||||
const engineTime& engineTime_;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
@ -127,16 +120,6 @@ public:
|
|||
return engineTime_;
|
||||
}
|
||||
|
||||
const volPointInterpolation& vpi() const
|
||||
{
|
||||
return vpi_;
|
||||
}
|
||||
|
||||
volPointInterpolation& vpi()
|
||||
{
|
||||
return vpi_;
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
|
|
@ -45,13 +45,17 @@ Class
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::engineValveSliding, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
Foam::engineTopoChangerMesh,
|
||||
Foam::engineValveSliding,
|
||||
IOobject
|
||||
);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Foam::engineValveSliding, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
engineTopoChangerMesh,
|
||||
engineValveSliding,
|
||||
IOobject
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
|
|
@ -40,14 +40,17 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::layerAR, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(layerAR, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
Foam::engineTopoChangerMesh,
|
||||
Foam::layerAR,
|
||||
IOobject
|
||||
);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
engineTopoChangerMesh,
|
||||
layerAR,
|
||||
IOobject
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
|
|
@ -50,7 +50,7 @@ void Foam::pistonLayer::addZonesAndModifiers()
|
|||
Info<< "void pistonLayer::addZonesAndModifiers() : "
|
||||
<< "Zones and modifiers already present. Skipping."
|
||||
<< endl;
|
||||
|
||||
|
||||
if (topoChanger_.size() == 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
|
@ -59,14 +59,12 @@ void Foam::pistonLayer::addZonesAndModifiers()
|
|||
) << "Mesh modifiers not read properly"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
Info << "topoChanger.size() = " << topoChanger_.size() << endl;
|
||||
|
||||
|
||||
checkAndCalculate();
|
||||
|
||||
setVirtualPistonPosition();
|
||||
vpi_.movePoints();
|
||||
vpi_.updateMesh();
|
||||
topoChanger_.writeOpt() = IOobject::AUTO_WRITE;
|
||||
topoChanger_.write();
|
||||
|
||||
|
@ -74,7 +72,7 @@ void Foam::pistonLayer::addZonesAndModifiers()
|
|||
}
|
||||
|
||||
checkAndCalculate();
|
||||
|
||||
|
||||
Info<< "Time = " << engTime().theta() << endl
|
||||
<< "Adding zones to the engine mesh" << endl;
|
||||
|
||||
|
|
|
@ -199,13 +199,11 @@ Foam::pistonLayer::pistonLayer
|
|||
virtualPistonPosition_(-GREAT),
|
||||
deckHeight_(GREAT),
|
||||
scalePoints_(engTime().engineDict().lookup("scalePoints")),
|
||||
movePointsBelowPiston_(false)
|
||||
movePointsBelowPiston_
|
||||
(
|
||||
engTime().engineDict().lookupOrDefault("movePointsBelowPiston", false)
|
||||
)
|
||||
{
|
||||
if(engTime().engineDict().found("movePointsBelowPiston"))
|
||||
{
|
||||
movePointsBelowPiston_ =
|
||||
engTime().engineDict().lookup("movePointsBelowPiston");
|
||||
}
|
||||
// Add zones and modifiers if not already there.
|
||||
addZonesAndModifiers();
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ Foam::faMesh::faMesh(const polyMesh& pMesh)
|
|||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
boundary_.calcGeometry();
|
||||
|
||||
if (file(pMesh.time().timePath()/"S0"))
|
||||
if (isFile(pMesh.time().timePath()/"S0"))
|
||||
{
|
||||
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
||||
(
|
||||
|
@ -609,7 +609,7 @@ Foam::faMesh::faMesh
|
|||
|
||||
addFaPatches(List<faPatch*>(faPatchLst));
|
||||
|
||||
setPrimitiveMeshData();
|
||||
setPrimitiveMeshData();
|
||||
|
||||
// Calculate topology for the patches (processor-processor comms etc.)
|
||||
boundary_.updateMesh();
|
||||
|
@ -617,7 +617,7 @@ Foam::faMesh::faMesh
|
|||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
boundary_.calcGeometry();
|
||||
|
||||
if (file(mesh_.time().timePath()/"S0"))
|
||||
if (isFile(mesh_.time().timePath()/"S0"))
|
||||
{
|
||||
S0Ptr_ = new DimensionedField<scalar, areaMesh>
|
||||
(
|
||||
|
@ -701,7 +701,7 @@ Foam::faMesh::faMesh
|
|||
// Set faceLabels
|
||||
forAll(faceLabels_, faceI)
|
||||
{
|
||||
faceLabels_[faceI] =
|
||||
faceLabels_[faceI] =
|
||||
mesh_.boundaryMesh()[polyPatchID].start() + faceI;
|
||||
}
|
||||
|
||||
|
@ -724,15 +724,15 @@ Foam::faMesh::faMesh
|
|||
patchDict.add("type", "patch");
|
||||
patchDict.add("edgeLabels", edgeLabels);
|
||||
patchDict.add("ngbPolyPatchIndex", -1);
|
||||
|
||||
|
||||
List<faPatch*> faPatchLst(1);
|
||||
|
||||
faPatchLst[0] =
|
||||
faPatchLst[0] =
|
||||
faPatch::New("default", patchDict, 0, boundary()).ptr();
|
||||
|
||||
addFaPatches(faPatchLst);
|
||||
|
||||
setPrimitiveMeshData();
|
||||
setPrimitiveMeshData();
|
||||
|
||||
// Calculate topology for the patches (processor-processor comms etc.)
|
||||
boundary_.updateMesh();
|
||||
|
@ -862,9 +862,9 @@ void Foam::faMesh::addFaPatches(const List<faPatch*>& p)
|
|||
}
|
||||
|
||||
|
||||
const Foam::objectRegistry& Foam::faMesh::db() const
|
||||
const Foam::objectRegistry& Foam::faMesh::thisDb() const
|
||||
{
|
||||
return mesh_.db();
|
||||
return mesh_.thisDb();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ public:
|
|||
// Access
|
||||
|
||||
//- Return reference to the mesh database
|
||||
virtual const objectRegistry& db() const;
|
||||
virtual const objectRegistry& thisDb() const;
|
||||
|
||||
//- Return constant reference to boundary mesh
|
||||
const faBoundaryMesh& boundary() const;
|
||||
|
|
|
@ -36,8 +36,8 @@ Description
|
|||
#include "processorFaPatch.H"
|
||||
#include "wedgeFaPatch.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
#include "cartesianCS.H"
|
||||
#include "scalarMatrix.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "scalarMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -1395,21 +1395,21 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
vector dir = (allPoints[0] - points[curPoint]);
|
||||
dir -= axis*(axis&dir);
|
||||
dir /= mag(dir);
|
||||
cartesianCS cs("cs", origin, axis, dir);
|
||||
coordinateSystem cs("cs", origin, axis, dir);
|
||||
|
||||
forAll(allPoints, pI)
|
||||
{
|
||||
allPoints[pI] = cs.localPosition(allPoints[pI]);
|
||||
}
|
||||
|
||||
Matrix<scalar> M
|
||||
scalarRectangularMatrix M
|
||||
(
|
||||
allPoints.size(),
|
||||
allPoints.size(),
|
||||
5,
|
||||
0.0
|
||||
);
|
||||
|
||||
for(label i=0; i<allPoints.size(); i++)
|
||||
for(label i = 0; i < allPoints.size(); i++)
|
||||
{
|
||||
M[i][0] = sqr(allPoints[i].x());
|
||||
M[i][1] = sqr(allPoints[i].y());
|
||||
|
@ -1418,12 +1418,13 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
M[i][4] = allPoints[i].y();
|
||||
}
|
||||
|
||||
Matrix<scalar> MtM(5, 5, 0.0);
|
||||
for (label i=0; i<MtM.n(); i++)
|
||||
scalarSquareMatrix MtM(5, 0.0);
|
||||
|
||||
for (label i = 0; i < MtM.n(); i++)
|
||||
{
|
||||
for (label j=0; j<MtM.m(); j++)
|
||||
for (label j = 0; j < MtM.m(); j++)
|
||||
{
|
||||
for (label k=0; k<M.n(); k++)
|
||||
for (label k = 0; k < M.n(); k++)
|
||||
{
|
||||
MtM[i][j] += M[k][i]*M[k][j]*W[k];
|
||||
}
|
||||
|
@ -1431,6 +1432,7 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
}
|
||||
|
||||
scalarField MtR(5, 0);
|
||||
|
||||
for (label i=0; i<MtR.size(); i++)
|
||||
{
|
||||
for (label j=0; j<M.n(); j++)
|
||||
|
@ -1439,14 +1441,14 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
}
|
||||
}
|
||||
|
||||
scalarMatrix::LUsolve(MtM, MtR);
|
||||
scalarSquareMatrix::LUsolve(MtM, MtR);
|
||||
|
||||
vector curNormal = vector(MtR[3], MtR[4], -1);
|
||||
|
||||
|
||||
curNormal = cs.globalVector(curNormal);
|
||||
|
||||
|
||||
curNormal *= sign(curNormal&result[curPoint]);
|
||||
|
||||
|
||||
result[curPoint] = curNormal;
|
||||
}
|
||||
|
||||
|
@ -1658,7 +1660,7 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
|
||||
if (!duplicate)
|
||||
{
|
||||
allPoints[nAllPoints++] =
|
||||
allPoints[nAllPoints++] =
|
||||
allPointsExt[pI];
|
||||
}
|
||||
}
|
||||
|
@ -1674,14 +1676,14 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
<< "fitting for a point at processor patch"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// Transforme points
|
||||
vector origin = points[curPoint];
|
||||
vector axis = result[curPoint]/mag(result[curPoint]);
|
||||
vector dir = (allPoints[0] - points[curPoint]);
|
||||
dir -= axis*(axis&dir);
|
||||
dir /= mag(dir);
|
||||
cartesianCS cs("cs", origin, axis, dir);
|
||||
coordinateSystem cs("cs", origin, axis, dir);
|
||||
|
||||
scalarField W(allPoints.size(), 1.0);
|
||||
|
||||
|
@ -1689,13 +1691,13 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
{
|
||||
W[pI] = 1.0/magSqr(allPoints[pI] - points[curPoint]);
|
||||
|
||||
allPoints[pI] =
|
||||
allPoints[pI] =
|
||||
cs.localPosition(allPoints[pI]);
|
||||
}
|
||||
|
||||
Matrix<scalar> M
|
||||
scalarRectangularMatrix M
|
||||
(
|
||||
allPoints.size(),
|
||||
allPoints.size(),
|
||||
5,
|
||||
0.0
|
||||
);
|
||||
|
@ -1709,12 +1711,13 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
M[i][4] = allPoints[i].y();
|
||||
}
|
||||
|
||||
Matrix<scalar> MtM(5, 5, 0.0);
|
||||
for (label i=0; i<MtM.n(); i++)
|
||||
scalarSquareMatrix MtM(5, 0.0);
|
||||
|
||||
for (label i = 0; i < MtM.n(); i++)
|
||||
{
|
||||
for (label j=0; j<MtM.m(); j++)
|
||||
for (label j = 0; j < MtM.m(); j++)
|
||||
{
|
||||
for (label k=0; k<M.n(); k++)
|
||||
for (label k = 0; k < M.n(); k++)
|
||||
{
|
||||
MtM[i][j] += M[k][i]*M[k][j]*W[k];
|
||||
}
|
||||
|
@ -1722,24 +1725,25 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
}
|
||||
|
||||
scalarField MtR(5, 0);
|
||||
for (label i=0; i<MtR.size(); i++)
|
||||
|
||||
for (label i = 0; i < MtR.size(); i++)
|
||||
{
|
||||
for (label j=0; j<M.n(); j++)
|
||||
for (label j = 0; j < M.n(); j++)
|
||||
{
|
||||
MtR[i] += M[j][i]*allPoints[j].z()*W[j];
|
||||
}
|
||||
}
|
||||
|
||||
scalarMatrix::LUsolve(MtM, MtR);
|
||||
|
||||
scalarSquareMatrix::LUsolve(MtM, MtR);
|
||||
|
||||
vector curNormal = vector(MtR[3], MtR[4], -1);
|
||||
|
||||
curNormal = cs.globalVector(curNormal);
|
||||
|
||||
curNormal *= sign(curNormal&result[curPoint]);
|
||||
|
||||
|
||||
result[curPoint] = curNormal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1834,7 +1838,7 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
|
||||
if (!duplicate)
|
||||
{
|
||||
allPoints[nAllPoints++] =
|
||||
allPoints[nAllPoints++] =
|
||||
procLsPoints[procI][pointI];
|
||||
}
|
||||
}
|
||||
|
@ -1858,7 +1862,7 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
vector dir = (allPoints[0] - points[curPoint]);
|
||||
dir -= axis*(axis&dir);
|
||||
dir /= mag(dir);
|
||||
cartesianCS cs("cs", origin, axis, dir);
|
||||
coordinateSystem cs("cs", origin, axis, dir);
|
||||
|
||||
scalarField W(allPoints.size(), 1.0);
|
||||
|
||||
|
@ -1867,13 +1871,13 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
W[pointI]=
|
||||
1.0/magSqr(allPoints[pointI] - points[curPoint]);
|
||||
|
||||
allPoints[pointI] =
|
||||
allPoints[pointI] =
|
||||
cs.localPosition(allPoints[pointI]);
|
||||
}
|
||||
|
||||
Matrix<scalar> M
|
||||
scalarRectangularMatrix M
|
||||
(
|
||||
allPoints.size(),
|
||||
allPoints.size(),
|
||||
5,
|
||||
0.0
|
||||
);
|
||||
|
@ -1887,35 +1891,35 @@ void faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||
M[i][4] = allPoints[i].y();
|
||||
}
|
||||
|
||||
Matrix<scalar> MtM(5, 5, 0.0);
|
||||
for (label i=0; i<MtM.n(); i++)
|
||||
scalarSquareMatrix MtM(5, 0.0);
|
||||
for (label i = 0; i < MtM.n(); i++)
|
||||
{
|
||||
for (label j=0; j<MtM.m(); j++)
|
||||
for (label j = 0; j < MtM.m(); j++)
|
||||
{
|
||||
for (label k=0; k<M.n(); k++)
|
||||
for (label k = 0; k < M.n(); k++)
|
||||
{
|
||||
MtM[i][j] += M[k][i]*M[k][j]*W[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalarField MtR(5, 0);
|
||||
for (label i=0; i<MtR.size(); i++)
|
||||
for (label i = 0; i < MtR.size(); i++)
|
||||
{
|
||||
for (label j=0; j<M.n(); j++)
|
||||
for (label j = 0; j < M.n(); j++)
|
||||
{
|
||||
MtR[i] += M[j][i]*allPoints[j].z()*W[j];
|
||||
}
|
||||
}
|
||||
|
||||
scalarMatrix::LUsolve(MtM, MtR);
|
||||
|
||||
scalarSquareMatrix::LUsolve(MtM, MtR);
|
||||
|
||||
vector curNormal = vector(MtR[3], MtR[4], -1);
|
||||
|
||||
curNormal = cs.globalVector(curNormal);
|
||||
|
||||
|
||||
curNormal *= sign(curNormal&result[curPoint]);
|
||||
|
||||
|
||||
result[curPoint] = curNormal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ faPatchField<Type>::faPatchField
|
|||
template<class Type>
|
||||
const objectRegistry& faPatchField<Type>::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh().db();
|
||||
return patch_.boundaryMesh().mesh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ faePatchField<Type>::faePatchField
|
|||
template<class Type>
|
||||
const objectRegistry& faePatchField<Type>::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh().db();
|
||||
return patch_.boundaryMesh().mesh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,15 +31,7 @@ Description
|
|||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Foam::fa, 0);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(fa, 0)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -73,7 +73,7 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
|
|||
(
|
||||
"LeastSquaresP",
|
||||
mesh_.pointsInstance(),
|
||||
mesh_.db(),
|
||||
mesh_.thisDb(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
|
@ -89,7 +89,7 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
|
|||
(
|
||||
"LeastSquaresN",
|
||||
mesh_.pointsInstance(),
|
||||
mesh_.db(),
|
||||
mesh_.thisDb(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
|
@ -134,18 +134,7 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
|
|||
const unallocLabelList& edgeFaces = p.edgeFaces();
|
||||
|
||||
// Build the d-vectors
|
||||
vectorField pd =
|
||||
mesh_.Le().boundaryField()[patchi]
|
||||
/(
|
||||
mesh_.magLe().boundaryField()[patchi]
|
||||
*mesh_.deltaCoeffs().boundaryField()[patchi]
|
||||
);
|
||||
|
||||
if (!mesh_.orthogonal())
|
||||
{
|
||||
pd -= mesh_.correctionVectors().boundaryField()[patchi]
|
||||
/mesh_.deltaCoeffs().boundaryField()[patchi];
|
||||
}
|
||||
vectorField pd = p.delta();
|
||||
|
||||
if (p.coupled())
|
||||
{
|
||||
|
@ -200,19 +189,7 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
|
|||
const unallocLabelList& edgeFaces = p.edgeFaces();
|
||||
|
||||
// Build the d-vectors
|
||||
vectorField pd =
|
||||
mesh_.Le().boundaryField()[patchi]
|
||||
/(
|
||||
mesh_.magLe().boundaryField()[patchi]
|
||||
*mesh_.deltaCoeffs().boundaryField()[patchi]
|
||||
);
|
||||
|
||||
if (!mesh_.orthogonal())
|
||||
{
|
||||
pd -= mesh_.correctionVectors().boundaryField()[patchi]
|
||||
/mesh_.deltaCoeffs().boundaryField()[patchi];
|
||||
}
|
||||
|
||||
vectorField pd = p.delta();
|
||||
|
||||
if (p.coupled())
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Foam
|
|||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class blended Declaration
|
||||
Class blendedEdgeInterpolation Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
blendingFactor_(blendingFactor)
|
||||
{}
|
||||
|
||||
//- Construct from mesh and Istream.
|
||||
//- Construct from mesh and Istream.
|
||||
// The name of the flux field is read from the Istream and looked-up
|
||||
// from the database
|
||||
blendedEdgeInterpolation
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
upwindEdgeInterpolation<Type>
|
||||
(
|
||||
mesh,
|
||||
mesh.db().objectRegistry::lookupObject<edgeScalarField>
|
||||
mesh().objectRegistry::lookupObject<edgeScalarField>
|
||||
(
|
||||
word(is)
|
||||
)
|
||||
|
@ -137,8 +137,10 @@ public:
|
|||
) const
|
||||
{
|
||||
return
|
||||
blendingFactor_*linearEdgeInterpolation<Type>::weights(vf)
|
||||
+ (1 - blendingFactor_)*upwindEdgeInterpolation<Type>::weights(vf);
|
||||
blendingFactor_*
|
||||
linearEdgeInterpolation<Type>::weights(vf)
|
||||
+ (1 - blendingFactor_)*
|
||||
upwindEdgeInterpolation<Type>::weights(vf);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -32,4 +32,5 @@ Description
|
|||
|
||||
defineTypeNameAndDebug(Foam::fv, 0);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -58,7 +58,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
|
|||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "fvMatrix<Type>::solve(const dictionary& solverControls) : "
|
||||
Info<< "fvMatrix<Type>::solve(const dictionary&) : "
|
||||
"solving fvMatrix<Type>"
|
||||
<< endl;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void Foam::fvMatrix<Foam::scalar>::setComponentReference
|
|||
internalCoeffs_[patchi][facei] +=
|
||||
diag()[psi_.mesh().boundary()[patchi].faceCells()[facei]];
|
||||
|
||||
boundaryCoeffs_[patchi][facei] +=
|
||||
boundaryCoeffs_[patchi][facei] +=
|
||||
diag()[psi_.mesh().boundary()[patchi].faceCells()[facei]]
|
||||
*value;
|
||||
}
|
||||
|
@ -98,7 +98,8 @@ Foam::fvMatrix<Foam::scalar>::solver
|
|||
|
||||
|
||||
template<>
|
||||
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
Foam::lduMatrix::solverPerformance
|
||||
Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
||||
(
|
||||
const dictionary& solverControls
|
||||
)
|
||||
|
@ -111,7 +112,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
|
|||
|
||||
// assign new solver controls
|
||||
solver_->read(solverControls);
|
||||
lduSolverPerformance solverPerf =
|
||||
lduSolverPerformance solverPerf =
|
||||
solver_->solve(fvMat_.psi().internalField(), totalSource);
|
||||
|
||||
solverPerf.print();
|
||||
|
|
|
@ -310,7 +310,7 @@ void Foam::extendedUpwindCellToFaceStencil::transportStencils
|
|||
|
||||
// Swap coupled boundary stencil
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
labelListList neiBndStencil(nBnd);
|
||||
for (label faceI = mesh_.nInternalFaces(); faceI < mesh_.nFaces(); faceI++)
|
||||
{
|
||||
|
|
|
@ -170,7 +170,7 @@ Foam::fvMesh::fvMesh(const IOobject& io)
|
|||
V00();
|
||||
}
|
||||
|
||||
// Check the existance of the mesh fluxes, read if present and set the
|
||||
// Check the existance of the mesh fluxes, read if present and set the
|
||||
// mesh to be moving
|
||||
if (isFile(time().timePath()/"meshPhi"))
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
blendingFactor_(blendingFactor)
|
||||
{}
|
||||
|
||||
//- Construct from mesh and Istream.
|
||||
//- Construct from mesh and Istream.
|
||||
// The name of the flux field is read from the Istream and looked-up
|
||||
// from the mesh objectRegistry
|
||||
blended
|
||||
|
|
|
@ -32,4 +32,4 @@ pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDispla
|
|||
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
||||
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
||||
LIB = $(FOAM_LIBBIN)/libfvMotionSolver
|
||||
|
|
|
@ -44,7 +44,19 @@ Foam::wordList Foam::fvMotionSolver::cellMotionBoundaryTypes
|
|||
|
||||
forAll(cmUbf, patchi)
|
||||
{
|
||||
if (isA<fixedValuePointPatchField<Type> >(pmUbf[patchi]))
|
||||
if
|
||||
(
|
||||
isA
|
||||
<
|
||||
FixedValuePointPatchField
|
||||
<
|
||||
pointPatchField,
|
||||
pointMesh,
|
||||
pointPatch,
|
||||
DummyMatrix,
|
||||
Type
|
||||
>
|
||||
>(pmUbf[patchi]))
|
||||
{
|
||||
cmUbf[patchi] = cellMotionFvPatchField<Type>::typeName;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ angularOscillatingDisplacementPointPatchVectorField
|
|||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF),
|
||||
fixedValuePointPatchVectorField(p, iF),
|
||||
axis_(vector::zero),
|
||||
origin_(vector::zero),
|
||||
angle0_(0.0),
|
||||
|
@ -62,7 +62,7 @@ angularOscillatingDisplacementPointPatchVectorField
|
|||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||
fixedValuePointPatchVectorField(p, iF, dict),
|
||||
axis_(dict.lookup("axis")),
|
||||
origin_(dict.lookup("origin")),
|
||||
angle0_(readScalar(dict.lookup("angle0"))),
|
||||
|
@ -91,16 +91,16 @@ angularOscillatingDisplacementPointPatchVectorField
|
|||
const angularOscillatingDisplacementPointPatchVectorField& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<vector, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
const PointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||
fixedValuePointPatchVectorField(ptf, p, iF, mapper),
|
||||
axis_(ptf.axis_),
|
||||
origin_(ptf.origin_),
|
||||
angle0_(ptf.angle0_),
|
||||
amplitude_(ptf.amplitude_),
|
||||
omega_(ptf.omega_),
|
||||
p0_(ptf.p0_, mapper)
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ angularOscillatingDisplacementPointPatchVectorField
|
|||
const DimensionedField<vector, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, iF),
|
||||
fixedValuePointPatchVectorField(ptf, iF),
|
||||
axis_(ptf.axis_),
|
||||
origin_(ptf.origin_),
|
||||
angle0_(ptf.angle0_),
|
||||
|
@ -123,32 +123,6 @@ angularOscillatingDisplacementPointPatchVectorField
|
|||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void angularOscillatingDisplacementPointPatchVectorField::autoMap
|
||||
(
|
||||
const pointPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValuePointPatchField<vector>::autoMap(m);
|
||||
|
||||
p0_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void angularOscillatingDisplacementPointPatchVectorField::rmap
|
||||
(
|
||||
const pointPatchField<vector>& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
const angularOscillatingDisplacementPointPatchVectorField& aODptf =
|
||||
refCast<const angularOscillatingDisplacementPointPatchVectorField>(ptf);
|
||||
|
||||
fixedValuePointPatchField<vector>::rmap(aODptf, addr);
|
||||
|
||||
p0_.rmap(aODptf.p0_, addr);
|
||||
}
|
||||
|
||||
|
||||
void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
|
@ -170,7 +144,7 @@ void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs()
|
|||
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
|
||||
);
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
fixedValuePointPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +153,8 @@ void angularOscillatingDisplacementPointPatchVectorField::write
|
|||
Ostream& os
|
||||
) const
|
||||
{
|
||||
pointPatchField<vector>::write(os);
|
||||
pointPatchVectorField::write(os);
|
||||
|
||||
os.writeKeyword("axis")
|
||||
<< axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("origin")
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue