Merge branch 'master' into cvm

This commit is contained in:
graham
2009-08-19 18:40:21 +01:00
267 changed files with 4610 additions and 2504 deletions

View File

@ -7,8 +7,7 @@
scalar epsilon = turbulence->epsilon()()[cellId]; scalar epsilon = turbulence->epsilon()()[cellId];
// scalar omega = turbulence->omega()()[cellId]; // scalar omega = turbulence->omega()()[cellId];
scalar k = turbulence->k()()[cellId]; scalar k = turbulence->k()()[cellId];
scalar Up = scalar magUp = mag(U[cellId] - U.boundaryField()[patchId][faceId]);
flowDirection & (U[cellId] - U.boundaryField()[patchId][faceId]);
scalar tauw = flowDirection & R & wallNormal; scalar tauw = flowDirection & R & wallNormal;
@ -16,7 +15,7 @@
scalar yPlus = uTau*y[cellId]/(nu + ROOTVSMALL); scalar yPlus = uTau*y[cellId]/(nu + ROOTVSMALL);
scalar uPlus = Up/(uTau + ROOTVSMALL); scalar uPlus = magUp/(uTau + ROOTVSMALL);
scalar nutPlus = nut/nu; scalar nutPlus = nut/nu;
@ -26,7 +25,7 @@
// scalar omegaPlus = omega*nu/(sqr(uTau) + ROOTVSMALL); // scalar omegaPlus = omega*nu/(sqr(uTau) + ROOTVSMALL);
scalar Rey = Up*y[cellId]/nu; scalar Rey = magUp*y[cellId]/nu;
Info<< "Rey = " << Rey << ", uTau = " << uTau << ", nut+ = " << nutPlus Info<< "Rey = " << Rey << ", uTau = " << uTau << ", nut+ = " << nutPlus
<< ", y+ = " << yPlus << ", u+ = " << uPlus << ", y+ = " << yPlus << ", u+ = " << uPlus

View File

@ -14,4 +14,3 @@
).initialResidual(); ).initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);

View File

@ -56,20 +56,11 @@
); );
dimensionedScalar rhoc dimensionedScalar rhoc(transportProperties.lookup("rhoc"));
(
transportProperties.lookup("rhoc")
);
dimensionedScalar rhod dimensionedScalar rhod(transportProperties.lookup("rhod"));
(
transportProperties.lookup("rhod")
);
dimensionedScalar muc dimensionedScalar muc(transportProperties.lookup("muc"));
(
transportProperties.lookup("muc")
);
dimensionedScalar plasticViscosityCoeff dimensionedScalar plasticViscosityCoeff
( (
@ -96,10 +87,7 @@
transportProperties.lookup("yieldStressOffset") transportProperties.lookup("yieldStressOffset")
); );
Switch BinghamPlastic Switch BinghamPlastic(transportProperties.lookup("BinghamPlastic"));
(
transportProperties.lookup("BinghamPlastic")
);
volScalarField rho volScalarField rho
( (
@ -147,8 +135,8 @@
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
muc + muc
plasticViscosity + plasticViscosity
( (
plasticViscosityCoeff, plasticViscosityCoeff,
plasticViscosityExponent, plasticViscosityExponent,
@ -176,10 +164,7 @@
Info<< "Selecting Drift-Flux model " << endl; Info<< "Selecting Drift-Flux model " << endl;
word VdjModel word VdjModel(transportProperties.lookup("VdjModel"));
(
transportProperties.lookup("VdjModel")
);
Info<< tab << VdjModel << " selected\n" << endl; Info<< tab << VdjModel << " selected\n" << endl;
@ -188,26 +173,13 @@
transportProperties.subDict(VdjModel + "Coeffs") transportProperties.subDict(VdjModel + "Coeffs")
); );
dimensionedVector V0 dimensionedVector V0(VdjModelCoeffs.lookup("V0"));
(
VdjModelCoeffs.lookup("V0")
);
dimensionedScalar a dimensionedScalar a(VdjModelCoeffs.lookup("a"));
(
VdjModelCoeffs.lookup("a")
);
dimensionedScalar a1 dimensionedScalar a1(VdjModelCoeffs.lookup("a1"));
(
VdjModelCoeffs.lookup("a1")
);
dimensionedScalar alphaMin
(
VdjModelCoeffs.lookup("alphaMin")
);
dimensionedScalar alphaMin(VdjModelCoeffs.lookup("alphaMin"));
IOdictionary RASProperties IOdictionary RASProperties
@ -223,15 +195,9 @@
); );
Switch turbulence Switch turbulence(RASProperties.lookup("turbulence"));
(
RASProperties.lookup("turbulence")
);
dictionary kEpsilonDict dictionary kEpsilonDict(RASProperties.subDictPtr("kEpsilonCoeffs"));
(
RASProperties.subDictPtr("kEpsilonCoeffs")
);
dimensionedScalar Cmu dimensionedScalar Cmu
( (
@ -273,30 +239,27 @@
) )
); );
dimensionedScalar alphak dimensionedScalar sigmak
( (
dimensionedScalar::lookupOrAddToDict dimensionedScalar::lookupOrAddToDict
( (
"alphaEps", "sigmak",
kEpsilonDict, kEpsilonDict,
1.0 1.0
) )
); );
dimensionedScalar alphaEps dimensionedScalar sigmaEps
( (
dimensionedScalar::lookupOrAddToDict dimensionedScalar::lookupOrAddToDict
( (
"alphaEps", "sigmaEps",
kEpsilonDict, kEpsilonDict,
0.76923 1.3
) )
); );
dictionary wallFunctionDict dictionary wallFunctionDict(RASProperties.subDictPtr("wallFunctionCoeffs"));
(
RASProperties.subDictPtr("wallFunctionCoeffs")
);
dimensionedScalar kappa dimensionedScalar kappa
( (

View File

@ -1,4 +1,4 @@
if(turbulence) if (turbulence)
{ {
if (mesh.changing()) if (mesh.changing())
{ {
@ -15,9 +15,9 @@ if(turbulence)
tgradU.clear(); tgradU.clear();
volScalarField Gcoef = volScalarField Gcoef =
alphak*Cmu*k*(g & fvc::grad(rho))/(epsilon + epsilon0); Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilon0);
# include "wallFunctions.H" #include "wallFunctions.H"
// Dissipation equation // Dissipation equation
fvScalarMatrix epsEqn fvScalarMatrix epsEqn
@ -26,7 +26,7 @@ if(turbulence)
+ fvm::div(phi, epsilon) + fvm::div(phi, epsilon)
- fvm::laplacian - fvm::laplacian
( (
alphaEps*mut + mul, epsilon, mut/sigmaEps + mul, epsilon,
"laplacian(DepsilonEff,epsilon)" "laplacian(DepsilonEff,epsilon)"
) )
== ==
@ -35,7 +35,7 @@ if(turbulence)
- fvm::Sp(C2*rho*epsilon/k, epsilon) - fvm::Sp(C2*rho*epsilon/k, epsilon)
); );
# include "wallDissipation.H" #include "wallDissipation.H"
epsEqn.relax(); epsEqn.relax();
epsEqn.solve(); epsEqn.solve();
@ -51,7 +51,7 @@ if(turbulence)
+ fvm::div(phi, k) + fvm::div(phi, k)
- fvm::laplacian - fvm::laplacian
( (
alphak*mut + mul, k, mut/sigmak + mul, k,
"laplacian(DkEff,k)" "laplacian(DkEff,k)"
) )
== ==
@ -66,7 +66,7 @@ if(turbulence)
//- Re-calculate viscosity //- Re-calculate viscosity
mut = rho*Cmu*sqr(k)/(epsilon + epsilon0); mut = rho*Cmu*sqr(k)/(epsilon + epsilon0);
# include "wallViscosity.H" #include "wallViscosity.H"
} }
mu = mut + mul; mu = mut + mul;

View File

@ -12,6 +12,7 @@
- fvm::laplacian(muEff, U) - fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff)) - (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf())) //- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
//- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T()))
); );
if (oCorr == nOuterCorr-1) if (oCorr == nOuterCorr-1)

View File

@ -34,7 +34,7 @@ Description
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
#include "Time.H" #include "Time.H"
#include "mapDistribute.H" //#include "mapDistribute.H"
#include "OFstream.H" #include "OFstream.H"
#include "meshTools.H" #include "meshTools.H"
//#include "FECCellToFaceStencil.H" //#include "FECCellToFaceStencil.H"

View File

@ -23,19 +23,23 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application Application
icoFoam parallelTest
Description Description
Incompressible laminar CFD code. Test for various parallel routines.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "List.H"
#include "mapDistribute.H"
#include "argList.H" #include "argList.H"
#include "Time.H" #include "Time.H"
#include "IPstream.H" #include "IPstream.H"
#include "OPstream.H" #include "OPstream.H"
#include "vector.H" #include "vector.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "Random.H"
#include "Tuple2.H"
using namespace Foam; using namespace Foam;
@ -47,6 +51,99 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
// Test mapDistribute
// ~~~~~~~~~~~~~~~~~~
if (false)
{
Random rndGen(43544*Pstream::myProcNo());
// Generate random data.
List<Tuple2<label, List<scalar> > > complexData(100);
forAll(complexData, i)
{
complexData[i].first() = rndGen.integer(0, Pstream::nProcs()-1);
complexData[i].second().setSize(3);
complexData[i].second()[0] = 1;
complexData[i].second()[1] = 2;
complexData[i].second()[2] = 3;
}
// Send all ones to processor indicated by .first()
// Count how many to send
labelList nSend(Pstream::nProcs(), 0);
forAll(complexData, i)
{
label procI = complexData[i].first();
nSend[procI]++;
}
// Sync how many to send
labelListList allNTrans(Pstream::nProcs());
allNTrans[Pstream::myProcNo()] = nSend;
combineReduce(allNTrans, mapDistribute::listEq());
// Collect items to be sent
labelListList sendMap(Pstream::nProcs());
forAll(sendMap, procI)
{
sendMap[procI].setSize(nSend[procI]);
}
nSend = 0;
forAll(complexData, i)
{
label procI = complexData[i].first();
sendMap[procI][nSend[procI]++] = i;
}
// Collect items to be received
labelListList recvMap(Pstream::nProcs());
forAll(recvMap, procI)
{
recvMap[procI].setSize(allNTrans[procI][Pstream::myProcNo()]);
}
label constructSize = 0;
// Construct with my own elements first
forAll(recvMap[Pstream::myProcNo()], i)
{
recvMap[Pstream::myProcNo()][i] = constructSize++;
}
// Construct from other processors
forAll(recvMap, procI)
{
if (procI != Pstream::myProcNo())
{
forAll(recvMap[procI], i)
{
recvMap[procI][i] = constructSize++;
}
}
}
// Construct distribute map (destructively)
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
// Distribute complexData
mapDistribute::distribute
(
Pstream::nonBlocking,
List<labelPair>(),
map.constructSize(),
map.subMap(),
map.constructMap(),
complexData
);
Pout<< "complexData:" << complexData << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Perr<< "\nStarting transfers\n" << endl; Perr<< "\nStarting transfers\n" << endl;
@ -60,13 +157,13 @@ int main(int argc, char *argv[])
{ {
Perr<< "slave sending to master " Perr<< "slave sending to master "
<< Pstream::masterNo() << endl; << Pstream::masterNo() << endl;
OPstream toMaster(Pstream::masterNo()); OPstream toMaster(Pstream::blocking, Pstream::masterNo());
toMaster << data; toMaster << data;
} }
Perr<< "slave receiving from master " Perr<< "slave receiving from master "
<< Pstream::masterNo() << endl; << Pstream::masterNo() << endl;
IPstream fromMaster(Pstream::masterNo()); IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
fromMaster >> data; fromMaster >> data;
Perr<< data << endl; Perr<< data << endl;
@ -81,7 +178,7 @@ int main(int argc, char *argv[])
) )
{ {
Perr << "master receiving from slave " << slave << endl; Perr << "master receiving from slave " << slave << endl;
IPstream fromSlave(slave); IPstream fromSlave(Pstream::blocking, slave);
fromSlave >> data; fromSlave >> data;
Perr<< data << endl; Perr<< data << endl;
@ -95,7 +192,7 @@ int main(int argc, char *argv[])
) )
{ {
Perr << "master sending to slave " << slave << endl; Perr << "master sending to slave " << slave << endl;
OPstream toSlave(slave); OPstream toSlave(Pstream::blocking, slave);
toSlave << data; toSlave << data;
} }
} }

View File

@ -30,7 +30,7 @@ License
Foam::labelList Foam::blockMesh::createMergeList() Foam::labelList Foam::blockMesh::createMergeList()
{ {
Info<< nl << "Creating merge list " << flush; Info<< nl << "Creating merge list" << flush;
labelList MergeList(nPoints_, -1); labelList MergeList(nPoints_, -1);

View File

@ -53,18 +53,18 @@ patches
name sidePatches; name sidePatches;
// Type of new patch // Type of new patch
dictionary dictionary
{ {
type cyclic; type cyclic;
// Optional: explicitly set transformation tensor. // Optional: explicitly set transformation tensor.
// Used when matching and synchronising points. // Used when matching and synchronising points.
//transform translational; //transform translational;
//separationVector (-2289 0 0); //separationVector (-2289 0 0);
transform rotational; transform rotational;
rotationAxis (1 0 0); rotationAxis (1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
} }
// How to construct: either from 'patches' or 'set' // How to construct: either from 'patches' or 'set'
constructFrom patches; constructFrom patches;
@ -80,10 +80,10 @@ patches
name bottom; name bottom;
// Type of new patch // Type of new patch
dictionary dictionary
{ {
type wall; type wall;
} }
constructFrom set; constructFrom set;

View File

@ -105,6 +105,8 @@ int main(int argc, char *argv[])
Foam::argList::validOptions.insert("overwrite", ""); Foam::argList::validOptions.insert("overwrite", "");
Foam::argList::validOptions.insert("toleranceDict", "file with tolerances");
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
runTime.functionObjects().off(); runTime.functionObjects().off();
@ -168,6 +170,22 @@ int main(int argc, char *argv[])
<< "If this is not the case use the -partial option" << nl << endl; << "If this is not the case use the -partial option" << nl << endl;
} }
// set up the tolerances for the sliding mesh
dictionary slidingTolerances;
if (args.options().found("toleranceDict"))
{
IOdictionary toleranceFile(
IOobject(
args.options()["toleranceDict"],
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
slidingTolerances += toleranceFile;
}
// Check for non-empty master and slave patches // Check for non-empty master and slave patches
checkPatch(mesh.boundaryMesh(), masterPatchName); checkPatch(mesh.boundaryMesh(), masterPatchName);
checkPatch(mesh.boundaryMesh(), slavePatchName); checkPatch(mesh.boundaryMesh(), slavePatchName);
@ -320,6 +338,11 @@ int main(int argc, char *argv[])
true // couple/decouple mode true // couple/decouple mode
) )
); );
static_cast<slidingInterface&>(stitcher[0]).setTolerances
(
slidingTolerances,
true
);
} }

View File

@ -97,7 +97,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::XX) sigma.component(symmTensor::XX)
); );
sigmaxx.write(); sigmaxx.write();
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::YY) sigma.component(symmTensor::YY)
); );
sigmayy.write(); sigmayy.write();
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::ZZ) sigma.component(symmTensor::ZZ)
); );
sigmazz.write(); sigmazz.write();
@ -136,7 +136,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::XY) sigma.component(symmTensor::XY)
); );
sigmaxy.write(); sigmaxy.write();
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::XZ) sigma.component(symmTensor::XZ)
); );
sigmaxz.write(); sigmaxz.write();
@ -162,7 +162,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::YZ) sigma.component(symmTensor::YZ)
); );
sigmayz.write(); sigmayz.write();
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
0.0*sigma.component(tensor::YZ) 0.0*sigma.component(symmTensor::YZ)
); );
forAll(sigmaUn.boundaryField(), patchI) forAll(sigmaUn.boundaryField(), patchI)

View File

@ -72,10 +72,12 @@ namespace Foam
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "addRegionOption.H" argList::validOptions.insert("instance", "instance");
# include "setRootCase.H" #include "addRegionOption.H"
# include "createTime.H"
# include "createNamedMesh.H" #include "setRootCase.H"
#include "createTime.H"
#include "createNamedMesh.H"
fileName regionPrefix = ""; fileName regionPrefix = "";
if (regionName != fvMesh::defaultRegion) if (regionName != fvMesh::defaultRegion)
@ -83,6 +85,12 @@ int main(int argc, char *argv[])
regionPrefix = regionName; regionPrefix = regionName;
} }
word instance = runTime.timeName();
if (args.options().found("instance"))
{
instance = args.options()["instance"];
}
// Get the replacement rules from a dictionary // Get the replacement rules from a dictionary
IOdictionary dict IOdictionary dict
( (
@ -196,12 +204,13 @@ int main(int argc, char *argv[])
Info<< "Loading dictionary " << fieldName << endl; Info<< "Loading dictionary " << fieldName << endl;
const word oldTypeName = IOdictionary::typeName; const word oldTypeName = IOdictionary::typeName;
const_cast<word&>(IOdictionary::typeName) = word::null; const_cast<word&>(IOdictionary::typeName) = word::null;
IOdictionary fieldDict IOdictionary fieldDict
( (
IOobject IOobject
( (
fieldName, fieldName,
runTime.timeName(), instance,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,

View File

@ -158,45 +158,33 @@ int main(int argc, char *argv[])
label trianglei = 0; label trianglei = 0;
label maxRegion1 = labelMin;
// Copy triangles1 into trianglesAll // Copy triangles1 into trianglesAll
// Determine max region.
forAll(surface1, faceI) forAll(surface1, faceI)
{ {
facesAll[trianglei] = surface1[faceI]; facesAll[trianglei++] = surface1[faceI];
maxRegion1 = max(maxRegion1, facesAll[trianglei].region());
trianglei++;
} }
label nRegions1 = surface1.patches().size();
label nRegions1 = maxRegion1 + 1;
if (!mergeRegions) if (!mergeRegions)
{ {
Info<< "Surface " << inFileName1 << " has " << nRegions1 << " regions" Info<< "Surface " << inFileName1 << " has " << nRegions1
<< " regions"
<< nl << nl
<< "All region numbers in " << inFileName2 << " will be offset" << "All region numbers in " << inFileName2 << " will be offset"
<< " by this amount" << nl << endl; << " by this amount" << nl << endl;
} }
// Add (renumbered) surface2 triangles // Add (renumbered) surface2 triangles
label maxRegion2 = labelMin;
forAll(surface2, faceI) forAll(surface2, faceI)
{ {
const labelledTri& tri = surface2[faceI]; const labelledTri& tri = surface2[faceI];
labelledTri& destTri = facesAll[trianglei++]; labelledTri& destTri = facesAll[trianglei++];
destTri[0] = tri[0] + points1.size(); destTri[0] = tri[0] + points1.size();
destTri[1] = tri[1] + points1.size(); destTri[1] = tri[1] + points1.size();
destTri[2] = tri[2] + points1.size(); destTri[2] = tri[2] + points1.size();
maxRegion2 = max(maxRegion2, tri.region());
if (mergeRegions) if (mergeRegions)
{ {
destTri.region() = tri.region(); destTri.region() = tri.region();
@ -207,7 +195,7 @@ int main(int argc, char *argv[])
} }
} }
label nRegions2 = maxRegion2 + 1; label nRegions2 = surface2.patches().size();
geometricSurfacePatchList newPatches; geometricSurfacePatchList newPatches;
@ -218,11 +206,11 @@ int main(int argc, char *argv[])
forAll(surface1.patches(), patchI) forAll(surface1.patches(), patchI)
{ {
newPatches[patchI] = surface1.patches()[ patchI]; newPatches[patchI] = surface1.patches()[patchI];
} }
forAll(surface2.patches(), patchI) forAll(surface2.patches(), patchI)
{ {
newPatches[patchI] = surface2.patches()[ patchI]; newPatches[patchI] = surface2.patches()[patchI];
} }
} }
else else
@ -244,12 +232,12 @@ int main(int argc, char *argv[])
forAll(surface1.patches(), patchI) forAll(surface1.patches(), patchI)
{ {
newPatches[newPatchI++] = surface1.patches()[ patchI]; newPatches[newPatchI++] = surface1.patches()[patchI];
} }
forAll(surface2.patches(), patchI) forAll(surface2.patches(), patchI)
{ {
newPatches[newPatchI++] = surface2.patches()[ patchI]; newPatches[newPatchI++] = surface2.patches()[patchI];
} }
} }

View File

@ -16,7 +16,7 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Select triangles by label // Select triangles by label
faces (); faces #include "badFaces";
// Select triangles using given points (local point numbering) // Select triangles using given points (local point numbering)
localPoints ( ); localPoints ( );

View File

@ -58,9 +58,9 @@ cat <<LABHELP
The default is to extract for all the 'Solved for' variables the initial The default is to extract for all the 'Solved for' variables the initial
residual, the final residual and the number of iterations. Additionally, a residual, the final residual and the number of iterations. Additionally, a
(user editable) database is used to extract data for standard non-solved for (user editable) database is used to extract data for standard non-solved for
variables like Courant number, execution time. variables like Courant number, and execution time.
$PROGNAME -l lists all the possible variables without extract them. $PROGNAME -l lists all the possible variables without extracting them.
The program will generate and run an awk script which writes a set of files, The program will generate and run an awk script which writes a set of files,
logs/<var>_<subIter>, for every <var> specified, for every occurrence inside logs/<var>_<subIter>, for every <var> specified, for every occurrence inside
@ -69,7 +69,7 @@ a time step.
For variables that are 'Solved for', the initial residual name will be For variables that are 'Solved for', the initial residual name will be
<var>, the final residual receive the name <var>FinalRes, <var>, the final residual receive the name <var>FinalRes,
The files are a simple xy format with the first column Time (default) The files are output in a simple xy format with the first column Time (default)
and the second the extracted values. Option -n creates single column and the second the extracted values. Option -n creates single column
files with the extracted data only. files with the extracted data only.
@ -82,6 +82,7 @@ separated with '/' :
The value taken will be the first (non-space)word after this column. The value taken will be the first (non-space)word after this column.
The database ($PROGNAME.db) will taken from these locations: The database ($PROGNAME.db) will taken from these locations:
.
$HOME/.OpenFOAM/$WM_PROJECT_VERSION $HOME/.OpenFOAM/$WM_PROJECT_VERSION
$HOME/.OpenFOAM $HOME/.OpenFOAM
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION
@ -98,6 +99,7 @@ LABHELP
# The various places to be searched: # The various places to be searched:
for i in \ for i in \
. \
$HOME/.OpenFOAM/$WM_PROJECT_VERSION \ $HOME/.OpenFOAM/$WM_PROJECT_VERSION \
$HOME/.OpenFOAM \ $HOME/.OpenFOAM \
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \ $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \
@ -114,7 +116,6 @@ do
done done
myEcho() { myEcho() {
if [ "$VERBOSE" ] if [ "$VERBOSE" ]
then then
@ -171,6 +172,7 @@ getSolveQueryList() {
done done
} }
# getAllQueries dbFile logFile # getAllQueries dbFile logFile
# Gets all queries from database and from logfile # Gets all queries from database and from logfile
getAllQueries() { getAllQueries() {
@ -202,6 +204,7 @@ getAllQueries() {
done | sort -u done | sort -u
} }
#----------------------------- #-----------------------------
# Main # Main
#----------------------------- #-----------------------------
@ -314,8 +317,6 @@ myEcho ""
# Generate Awk program # Generate Awk program
#----------------------------- #-----------------------------
#-- header #-- header
rm -f $AWKFILE; touch $AWKFILE rm -f $AWKFILE; touch $AWKFILE
@ -355,9 +356,6 @@ function extract(inLine,columnSel,outVar,
LABEL LABEL
#-- Generate code for iteration separator (increments 'Iteration') #-- Generate code for iteration separator (increments 'Iteration')
getQueries $DBFILE 'Separator' getQueries $DBFILE 'Separator'
cat <<LABSEP >> $AWKFILE cat <<LABSEP >> $AWKFILE
@ -418,6 +416,7 @@ cat <<LABSOLVE >> $AWKFILE
LABSOLVE LABSOLVE
#-- generate code to process queries #-- generate code to process queries
for queryName in $QUERYNAMES for queryName in $QUERYNAMES
do do
@ -438,7 +437,6 @@ do
done done
#----------------------------- #-----------------------------
# Run awk program on log # Run awk program on log
#----------------------------- #-----------------------------
@ -454,5 +452,6 @@ done
#----------------------------- #-----------------------------
myEcho "Generated XY files for:" myEcho "Generated XY files for:"
getAllQueries $DBFILE $LOG getAllQueries $DBFILE $LOG
myEcho "End"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -345,6 +345,9 @@ $(globalMeshData)/globalIndex.C
$(polyMesh)/syncTools/syncTools.C $(polyMesh)/syncTools/syncTools.C
zone = $(polyMesh)/zones/zone
$(zone)/zone.C
cellZone = $(polyMesh)/zones/cellZone cellZone = $(polyMesh)/zones/cellZone
$(cellZone)/cellZone.C $(cellZone)/cellZone.C
$(cellZone)/newCellZone.C $(cellZone)/newCellZone.C

View File

@ -22,22 +22,10 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "MeshWave.H" #include "MeshWave.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "OPstream.H"
#include "IPstream.H"
#include "PstreamReduceOps.H"
#include "debug.H"
#include "typeInfo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -162,13 +162,14 @@ Foam::List<T>::List(const UList<T>& a, const unallocLabelList& map)
{ {
if (this->size_) if (this->size_)
{ {
// Note:cannot use List_ELEM since third argument has to be index.
this->v_ = new T[this->size_]; this->v_ = new T[this->size_];
List_ACCESS(T, (*this), vp); forAll(*this, i)
List_CONST_ACCESS(T, a, ap); {
List_FOR_ALL(map, i) this->v_[i] = a[map[i]];
List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i])); }
List_END_FOR_ALL
} }
} }

View File

@ -45,38 +45,44 @@ char Foam::ISstream::nextValid()
// Return if stream is bad - ie, previous get() failed // Return if stream is bad - ie, previous get() failed
if (bad() || isspace(c)) if (bad() || isspace(c))
{ {
return 0; break;
} }
// Is this the start of a C/C++ comment? // Is this the start of a C/C++ comment?
if (c == '/') if (c == '/')
{ {
// If cannot get another character, return this one
if (!get(c)) if (!get(c))
{ {
// cannot get another character - return this one
return '/'; return '/';
} }
if (c == '/') if (c == '/')
{ {
// This is the start of a C++ style one-line comment // C++ style single-line comment - skip through past end-of-line
while (get(c) && c != '\n') while (get(c) && c != '\n')
{} {}
} }
else if (c == '*') else if (c == '*')
{ {
// This is the start of a C style comment // within a C-style comment
while (true) while (true)
{ {
// search for end of C-style comment - '*/'
if (get(c) && c == '*') if (get(c) && c == '*')
{ {
if (get(c) && c == '/') if (get(c))
{ {
break; if (c == '/')
} {
else // matched '*/'
{ break;
putback(c); }
else if (c == '*')
{
// check again
putback(c);
}
} }
} }
@ -86,17 +92,21 @@ char Foam::ISstream::nextValid()
} }
} }
} }
else // A lone '/' so return it. else
{ {
// The '/' did not start a C/C++ comment - return it
putback(c); putback(c);
return '/'; return '/';
} }
} }
else // c is a valid character so return it else
{ {
// a valid character - return it
return c; return c;
} }
} }
return 0;
} }
@ -277,8 +287,8 @@ Foam::Istream& Foam::ISstream::read(token& t)
// } // }
} }
// nothing converted (bad format), or trailing junk // not everything converted: bad format or trailing junk
if (endptr == buf || *endptr != '\0') if (*endptr)
{ {
t.setBad(); t.setBad();
} }
@ -289,7 +299,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
} }
// Should be a word (which can be a single character) // Should be a word (which can also be a single character)
default: default:
{ {
putback(c); putback(c);

View File

@ -127,11 +127,10 @@ void Foam::Time::setControls()
} }
else else
{ {
WarningIn("Time::setControls()") FatalIOErrorIn("Time::setControls()", controlDict_)
<< " expected startTime, firstTime or latestTime" << "expected startTime, firstTime or latestTime"
<< " found '" << startFrom << " found '" << startFrom << "'"
<< "' in dictionary " << controlDict_.name() << nl << exit(FatalIOError);
<< " Setting time to " << startTime_ << endl;
} }
} }
@ -151,10 +150,10 @@ void Foam::Time::setControls()
> Pstream::nProcs()*deltaT_/10.0 > Pstream::nProcs()*deltaT_/10.0
) )
{ {
FatalErrorIn("Time::setControls()") FatalIOErrorIn("Time::setControls()", controlDict_)
<< "Start time is not the same for all processors" << nl << "Start time is not the same for all processors" << nl
<< "processor " << Pstream::myProcNo() << " has startTime " << "processor " << Pstream::myProcNo() << " has startTime "
<< startTime_ << exit(FatalError); << startTime_ << exit(FatalIOError);
} }
} }

View File

@ -117,6 +117,10 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
// get rootPath_ / globalCase_ from one of the following forms // get rootPath_ / globalCase_ from one of the following forms
// * [-case dir] // * [-case dir]
// * cwd // * cwd
//
// Also export FOAM_CASE and FOAM_CASENAME environment variables
// so they can be used immediately (eg, in decomposeParDict)
//
void Foam::argList::getRootCase() void Foam::argList::getRootCase()
{ {
fileName casePath; fileName casePath;
@ -151,6 +155,26 @@ void Foam::argList::getRootCase()
rootPath_ = casePath.path(); rootPath_ = casePath.path();
globalCase_ = casePath.name(); globalCase_ = casePath.name();
case_ = globalCase_; case_ = globalCase_;
// Set the case and case-name as an environment variable
if (rootPath_[0] == '/')
{
// absolute path - use as-is
setEnv("FOAM_CASE", rootPath_/globalCase_, true);
setEnv("FOAM_CASENAME", globalCase_, true);
}
else
{
// qualify relative path
fileName casePath = cwd()/rootPath_/globalCase_;
casePath.clean();
setEnv("FOAM_CASE", casePath, true);
setEnv("FOAM_CASENAME", casePath.name(), true);
}
} }
@ -531,24 +555,6 @@ Foam::argList::argList
} }
jobInfo.write(); jobInfo.write();
// Set the case and case-name as an environment variable
if (rootPath_[0] == '/')
{
// absolute path - use as-is
setEnv("FOAM_CASE", rootPath_/globalCase_, true);
setEnv("FOAM_CASENAME", globalCase_, true);
}
else
{
// qualify relative path
fileName casePath = cwd()/rootPath_/globalCase_;
casePath.clean();
setEnv("FOAM_CASE", casePath, true);
setEnv("FOAM_CASENAME", casePath.name(), true);
}
// Switch on signal trapping. We have to wait until after Pstream::init // Switch on signal trapping. We have to wait until after Pstream::init
// since this sets up its own ones. // since this sets up its own ones.
sigFpe_.set(bannerEnabled); sigFpe_.set(bannerEnabled);

View File

@ -172,8 +172,8 @@ const Foam::List<Foam::labelPair>& Foam::mapDistribute::schedule() const
Foam::mapDistribute::mapDistribute Foam::mapDistribute::mapDistribute
( (
const label constructSize, const label constructSize,
const labelListList& subMap, const Xfer<labelListList>& subMap,
const labelListList& constructMap const Xfer<labelListList>& constructMap
) )
: :
constructSize_(constructSize), constructSize_(constructSize),
@ -183,22 +183,6 @@ Foam::mapDistribute::mapDistribute
{} {}
//- (optionally destructively) construct from components
Foam::mapDistribute::mapDistribute
(
const label constructSize,
labelListList& subMap,
labelListList& constructMap,
const bool reUse // clone or reuse
)
:
constructSize_(constructSize),
subMap_(subMap, reUse),
constructMap_(constructMap, reUse),
schedulePtr_()
{}
Foam::mapDistribute::mapDistribute Foam::mapDistribute::mapDistribute
( (
const labelList& sendProcs, const labelList& sendProcs,
@ -286,7 +270,7 @@ Foam::mapDistribute::mapDistribute(const mapDistribute& map)
void Foam::mapDistribute::compact(const boolList& elemIsUsed) void Foam::mapDistribute::compact(const boolList& elemIsUsed)
{ {
// 1. send back to sender. Have him delete the corresponding element // 1. send back to sender. Have sender delete the corresponding element
// from the submap and do the same to the constructMap locally // from the submap and do the same to the constructMap locally
// (and in same order). // (and in same order).

View File

@ -83,23 +83,36 @@ class mapDistribute
public: public:
// Public classes
//- 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];
}
}
}
};
// Constructors // Constructors
//- Construct from components //- Construct from components
mapDistribute mapDistribute
( (
const label constructSize, const label constructSize,
const labelListList& subMap, const Xfer<labelListList>& subMap,
const labelListList& constructMap const Xfer<labelListList>& constructMap
);
//- (optionally destructively) construct from components
mapDistribute
(
const label constructSize,
labelListList& subMap,
labelListList& constructMap,
const bool reUse // clone or reuse
); );
//- Construct from reverse addressing: per data item the send //- Construct from reverse addressing: per data item the send
@ -205,11 +218,7 @@ public:
template<class T> template<class T>
void distribute(List<T>& fld) const void distribute(List<T>& fld) const
{ {
if if (Pstream::defaultCommsType == Pstream::nonBlocking)
(
Pstream::defaultCommsType == Pstream::nonBlocking
&& contiguous<T>()
)
{ {
distribute distribute
( (

View File

@ -68,35 +68,15 @@ public:
mapDistributeLagrangian mapDistributeLagrangian
( (
const label nNewParticles, const label nNewParticles,
const labelListList& subParticleMap, const Xfer<labelListList>& subParticleMap,
const labelListList& constructParticleMap, const Xfer<labelListList>& constructParticleMap,
const labelListList& constructCellLabels const Xfer<labelListList>& constructCellLabels
) )
: :
particleMap_(nNewParticles, subParticleMap, constructParticleMap), particleMap_(nNewParticles, subParticleMap, constructParticleMap),
constructCellLabels_(constructCellLabels) constructCellLabels_(constructCellLabels)
{} {}
//- Construct from components and steal storage
mapDistributeLagrangian
(
const label nNewParticles,
labelListList& subParticleMap,
labelListList& constructParticleMap,
labelListList& constructCellLabels,
const bool reUse
)
:
particleMap_
(
nNewParticles,
subParticleMap,
constructParticleMap,
reUse
),
constructCellLabels_(constructCellLabels, reUse)
{}
// Member Functions // Member Functions

View File

@ -66,27 +66,27 @@ Foam::mapDistributePolyMesh::mapDistributePolyMesh
const label nOldPoints, const label nOldPoints,
const label nOldFaces, const label nOldFaces,
const label nOldCells, const label nOldCells,
const labelList& oldPatchStarts, const Xfer<labelList>& oldPatchStarts,
const labelList& oldPatchNMeshPoints, const Xfer<labelList>& oldPatchNMeshPoints,
// how to subset pieces of mesh to send across // how to subset pieces of mesh to send across
const labelListList& subPointMap, const Xfer<labelListList>& subPointMap,
const labelListList& subFaceMap, const Xfer<labelListList>& subFaceMap,
const labelListList& subCellMap, const Xfer<labelListList>& subCellMap,
const labelListList& subPatchMap, const Xfer<labelListList>& subPatchMap,
// how to reconstruct received mesh // how to reconstruct received mesh
const labelListList& constructPointMap, const Xfer<labelListList>& constructPointMap,
const labelListList& constructFaceMap, const Xfer<labelListList>& constructFaceMap,
const labelListList& constructCellMap, const Xfer<labelListList>& constructCellMap,
const labelListList& constructPatchMap const Xfer<labelListList>& constructPatchMap
) )
: :
mesh_(mesh), mesh_(mesh),
nOldPoints_(nOldPoints), nOldPoints_(nOldPoints),
nOldFaces_(nOldFaces), nOldFaces_(nOldFaces),
nOldCells_(nOldCells), nOldCells_(nOldCells),
oldPatchSizes_(oldPatchStarts.size()), oldPatchSizes_(oldPatchStarts().size()),
oldPatchStarts_(oldPatchStarts), oldPatchStarts_(oldPatchStarts),
oldPatchNMeshPoints_(oldPatchNMeshPoints), oldPatchNMeshPoints_(oldPatchNMeshPoints),
pointMap_(mesh.nPoints(), subPointMap, constructPointMap), pointMap_(mesh.nPoints(), subPointMap, constructPointMap),
@ -98,44 +98,6 @@ Foam::mapDistributePolyMesh::mapDistributePolyMesh
} }
//- (optionally destructively) construct from components
Foam::mapDistributePolyMesh::mapDistributePolyMesh
(
const polyMesh& mesh,
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList& oldPatchStarts,
labelList& oldPatchNMeshPoints,
labelListList& subPointMap,
labelListList& subFaceMap,
labelListList& subCellMap,
labelListList& subPatchMap,
labelListList& constructPointMap,
labelListList& constructFaceMap,
labelListList& constructCellMap,
labelListList& constructPatchMap,
const bool reUse // clone or reuse
)
:
mesh_(mesh),
nOldPoints_(nOldPoints),
nOldFaces_(nOldFaces),
nOldCells_(nOldCells),
oldPatchSizes_(oldPatchStarts.size()),
oldPatchStarts_(oldPatchStarts, reUse),
oldPatchNMeshPoints_(oldPatchNMeshPoints, reUse),
pointMap_(mesh.nPoints(), subPointMap, constructPointMap, reUse),
faceMap_(mesh.nFaces(), subFaceMap, constructFaceMap, reUse),
cellMap_(mesh.nCells(), subCellMap, constructCellMap, reUse),
patchMap_(mesh.boundaryMesh().size(), subPatchMap, constructPatchMap, reUse)
{
calcPatchSizes();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst) const void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst) const

View File

@ -120,42 +120,20 @@ public:
const label nOldPoints, const label nOldPoints,
const label nOldFaces, const label nOldFaces,
const label nOldCells, const label nOldCells,
const labelList& oldPatchStarts, const Xfer<labelList>& oldPatchStarts,
const labelList& oldPatchNMeshPoints, const Xfer<labelList>& oldPatchNMeshPoints,
// how to subset pieces of mesh to send across // how to subset pieces of mesh to send across
const labelListList& subPointMap, const Xfer<labelListList>& subPointMap,
const labelListList& subFaceMap, const Xfer<labelListList>& subFaceMap,
const labelListList& subCellMap, const Xfer<labelListList>& subCellMap,
const labelListList& subPatchMap, const Xfer<labelListList>& subPatchMap,
// how to reconstruct received mesh // how to reconstruct received mesh
const labelListList& constructPointMap, const Xfer<labelListList>& constructPointMap,
const labelListList& constructFaceMap, const Xfer<labelListList>& constructFaceMap,
const labelListList& constructCellMap, const Xfer<labelListList>& constructCellMap,
const labelListList& constructPatchMap const Xfer<labelListList>& constructPatchMap
);
//- (optionally destructively) construct from components
// Note that mesh has to be changed already!
mapDistributePolyMesh
(
const polyMesh& mesh,
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList& oldPatchStarts,
labelList& oldPatchNMeshPoints,
labelListList& subPointMap,
labelListList& subFaceMap,
labelListList& subCellMap,
labelListList& subPatchMap,
labelListList& constructPointMap,
labelListList& constructFaceMap,
labelListList& constructCellMap,
labelListList& constructPatchMap,
const bool reUse // clone or reuse
); );

View File

@ -25,6 +25,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Pstream.H" #include "Pstream.H"
#include "PstreamCombineReduceOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -184,138 +185,269 @@ void Foam::mapDistribute::distribute
{ {
if (!contiguous<T>()) if (!contiguous<T>())
{ {
FatalErrorIn // 1. convert to contiguous buffer
( // 2. send buffer
"template<class T>\n" // 3. receive buffer
"void mapDistribute::distribute\n" // 4. read from buffer into List<T>
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Non-blocking only supported for contiguous data."
<< exit(FatalError);
}
// Set up sends to neighbours List<List<char> > sendFields(Pstream::nProcs());
labelListList allNTrans(Pstream::nProcs());
labelList& nsTransPs = allNTrans[Pstream::myProcNo()];
nsTransPs.setSize(Pstream::nProcs(), 0);
List<List<T > > sendFields(Pstream::nProcs()); // Stream data into sendField buffers
for (label domain = 0; domain < Pstream::nProcs(); domain++)
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{ {
List<T>& subField = sendFields[domain]; const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
// Put data into send buffer
OPstream toDomain(Pstream::nonBlocking, domain);
toDomain << UIndirectList<T>(field, map);
// Store the size
nsTransPs[domain] = toDomain.bufPosition();
// Transfer buffer out
sendFields[domain].transfer(toDomain.buf());
toDomain.bufPosition() = 0;
}
}
// Send sizes across
combineReduce(allNTrans, listEq());
// Start sending buffers
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
OPstream::write
(
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>
(
sendFields[domain].begin()
),
nsTransPs[domain]
);
}
}
// Set up receives from neighbours
PtrList<IPstream> fromSlave(Pstream::nProcs());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
// Start receiving
fromSlave.set
(
domain,
new IPstream
(
Pstream::nonBlocking,
domain,
allNTrans[domain][Pstream::myProcNo()]
)
);
}
}
{
// Set up 'send' to myself
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> mySubField(mySubMap.size());
forAll(mySubMap, i)
{
mySubField[i] = field[mySubMap[i]];
}
// Combine bits. Note that can reuse field storage
field.setSize(constructSize);
// Receive sub field from myself
{
const labelList& map = constructMap[Pstream::myProcNo()];
forAll(map, i)
{
field[map[i]] = mySubField[i];
}
}
}
// Wait till all finished
IPstream::waitRequests();
OPstream::waitRequests();
// Consume
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
List<T> recvField(fromSlave[domain]);
if (recvField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvField.size() << " elements."
<< abort(FatalError);
}
forAll(map, i)
{
field[map[i]] = recvField[i];
}
// Delete receive buffer
fromSlave.set(domain, NULL);
}
}
}
else
{
// Set up sends to neighbours
List<List<T > > sendFields(Pstream::nProcs());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
List<T>& subField = sendFields[domain];
subField.setSize(map.size());
forAll(map, i)
{
subField[i] = field[map[i]];
}
OPstream::write
(
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>(subField.begin()),
subField.byteSize()
);
}
}
// Set up receives from neighbours
List<List<T > > recvFields(Pstream::nProcs());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
recvFields[domain].setSize(map.size());
IPstream::read
(
Pstream::nonBlocking,
domain,
reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].byteSize()
);
}
}
// Set up 'send' to myself
{
const labelList& map = subMap[Pstream::myProcNo()];
List<T>& subField = sendFields[Pstream::myProcNo()];
subField.setSize(map.size()); subField.setSize(map.size());
forAll(map, i) forAll(map, i)
{ {
subField[i] = field[map[i]]; subField[i] = field[map[i]];
} }
OPstream::write
(
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>(subField.begin()),
subField.size()*sizeof(T)
);
} }
}
// Set up receives from neighbours
List<List<T > > recvFields(Pstream::nProcs()); // Combine bits. Note that can reuse field storage
for (label domain = 0; domain < Pstream::nProcs(); domain++) field.setSize(constructSize);
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
// Receive sub field from myself (sendFields[Pstream::myProcNo()])
{ {
recvFields[domain].setSize(map.size()); const labelList& map = constructMap[Pstream::myProcNo()];
IPstream::read const List<T>& subField = sendFields[Pstream::myProcNo()];
(
Pstream::nonBlocking,
domain,
reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()*sizeof(T)
);
}
}
// Set up 'send' to myself
{
const labelList& map = subMap[Pstream::myProcNo()];
List<T>& subField = sendFields[Pstream::myProcNo()];
subField.setSize(map.size());
forAll(map, i)
{
subField[i] = field[map[i]];
}
}
// Combine bits. Note that can reuse field storage
field.setSize(constructSize);
// Receive sub field from myself (sendFields[Pstream::myProcNo()])
{
const labelList& map = constructMap[Pstream::myProcNo()];
const List<T>& subField = sendFields[Pstream::myProcNo()];
forAll(map, i)
{
field[map[i]] = subField[i];
}
}
// Wait for all to finish
OPstream::waitRequests();
IPstream::waitRequests();
// Collect neighbour fields
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
if (recvFields[domain].size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvFields[domain].size() << " elements."
<< abort(FatalError);
}
forAll(map, i) forAll(map, i)
{ {
field[map[i]] = recvFields[domain][i]; field[map[i]] = subField[i];
}
}
// Wait for all to finish
OPstream::waitRequests();
IPstream::waitRequests();
// Collect neighbour fields
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
if (recvFields[domain].size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvFields[domain].size() << " elements."
<< abort(FatalError);
}
forAll(map, i)
{
field[map[i]] = recvFields[domain][i];
}
} }
} }
} }
@ -488,137 +620,263 @@ void Foam::mapDistribute::distribute
{ {
if (!contiguous<T>()) if (!contiguous<T>())
{ {
FatalErrorIn // 1. convert to contiguous buffer
( // 2. send buffer
"template<class T>\n" // 3. receive buffer
"void mapDistribute::distribute\n" // 4. read from buffer into List<T>
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Non-blocking only supported for contiguous data."
<< exit(FatalError);
}
// Set up sends to neighbours List<List<char> > sendFields(Pstream::nProcs());
labelListList allNTrans(Pstream::nProcs());
labelList& nsTransPs = allNTrans[Pstream::myProcNo()];
nsTransPs.setSize(Pstream::nProcs());
List<List<T > > sendFields(Pstream::nProcs()); // Stream data into sendField buffers
for (label domain = 0; domain < Pstream::nProcs(); domain++)
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{ {
List<T>& subField = sendFields[domain]; const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
// Put data into send buffer
OPstream toDomain(Pstream::nonBlocking, domain);
toDomain << UIndirectList<T>(field, map);
// Store the size
nsTransPs[domain] = toDomain.bufPosition();
// Transfer buffer out
sendFields[domain].transfer(toDomain.buf());
toDomain.bufPosition() = 0;
}
}
// Send sizes across
combineReduce(allNTrans, listEq());
// Start sending buffers
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
OPstream::write
(
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>
(
sendFields[domain].begin()
),
nsTransPs[domain]
);
}
}
// Set up receives from neighbours
PtrList<IPstream> fromSlave(Pstream::nProcs());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
// Start receiving
fromSlave.set
(
domain,
new IPstream
(
Pstream::nonBlocking,
domain,
allNTrans[domain][Pstream::myProcNo()]
)
);
}
}
{
// Set up 'send' to myself
List<T> mySubField(field, subMap[Pstream::myProcNo()]);
// Combine bits. Note that can reuse field storage
field.setSize(constructSize);
field = nullValue;
// Receive sub field from myself
{
const labelList& map = constructMap[Pstream::myProcNo()];
forAll(map, i)
{
cop(field[map[i]], mySubField[i]);
}
}
}
// Wait till all finished
IPstream::waitRequests();
OPstream::waitRequests();
// Consume
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
List<T> recvField(fromSlave[domain]);
if (recvField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvField.size() << " elements."
<< abort(FatalError);
}
forAll(map, i)
{
cop(field[map[i]], recvField[i]);
}
// Delete receive buffer
fromSlave.set(domain, NULL);
}
}
}
else
{
// Set up sends to neighbours
List<List<T > > sendFields(Pstream::nProcs());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
List<T>& subField = sendFields[domain];
subField.setSize(map.size());
forAll(map, i)
{
subField[i] = field[map[i]];
}
OPstream::write
(
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>(subField.begin()),
subField.size()*sizeof(T)
);
}
}
// Set up receives from neighbours
List<List<T > > recvFields(Pstream::nProcs());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
recvFields[domain].setSize(map.size());
IPstream::read
(
Pstream::nonBlocking,
domain,
reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()*sizeof(T)
);
}
}
// Set up 'send' to myself
{
const labelList& map = subMap[Pstream::myProcNo()];
List<T>& subField = sendFields[Pstream::myProcNo()];
subField.setSize(map.size()); subField.setSize(map.size());
forAll(map, i) forAll(map, i)
{ {
subField[i] = field[map[i]]; subField[i] = field[map[i]];
} }
OPstream::write
(
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>(subField.begin()),
subField.size()*sizeof(T)
);
} }
}
// Set up receives from neighbours
List<List<T > > recvFields(Pstream::nProcs()); // Combine bits. Note that can reuse field storage
for (label domain = 0; domain < Pstream::nProcs(); domain++) field.setSize(constructSize);
{ field = nullValue;
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size()) // Receive sub field from myself (subField)
{ {
recvFields[domain].setSize(map.size()); const labelList& map = constructMap[Pstream::myProcNo()];
IPstream::read const List<T>& subField = sendFields[Pstream::myProcNo()];
(
Pstream::nonBlocking,
domain,
reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()*sizeof(T)
);
}
}
// Set up 'send' to myself
{
const labelList& map = subMap[Pstream::myProcNo()];
List<T>& subField = sendFields[Pstream::myProcNo()];
subField.setSize(map.size());
forAll(map, i)
{
subField[i] = field[map[i]];
}
}
// Combine bits. Note that can reuse field storage
field.setSize(constructSize);
field = nullValue;
// Receive sub field from myself (subField)
{
const labelList& map = constructMap[Pstream::myProcNo()];
const List<T>& subField = sendFields[Pstream::myProcNo()];
forAll(map, i)
{
cop(field[map[i]], subField[i]);
}
}
// Wait for all to finish
OPstream::waitRequests();
IPstream::waitRequests();
// Collect neighbour fields
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
if (recvFields[domain].size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvFields[domain].size() << " elements."
<< abort(FatalError);
}
forAll(map, i) forAll(map, i)
{ {
cop(field[map[i]], recvFields[domain][i]); cop(field[map[i]], subField[i]);
}
}
// Wait for all to finish
OPstream::waitRequests();
IPstream::waitRequests();
// Collect neighbour fields
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap[domain];
if (domain != Pstream::myProcNo() && map.size())
{
if (recvFields[domain].size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvFields[domain].size() << " elements."
<< abort(FatalError);
}
forAll(map, i)
{
cop(field[map[i]], recvFields[domain][i]);
}
} }
} }
} }

View File

@ -1305,7 +1305,7 @@ bool Foam::cyclicPolyPatch::order
{ {
label baffleI = 0; label baffleI = 0;
forAll(*this, faceI) forAll(pp, faceI)
{ {
const face& f = pp.localFaces()[faceI]; const face& f = pp.localFaces()[faceI];
const labelList& pFaces = pp.pointFaces()[f[0]]; const labelList& pFaces = pp.pointFaces()[f[0]];

View File

@ -114,6 +114,7 @@ public:
return index_ > -1; return index_ > -1;
} }
// Edit // Edit
//- Update //- Update

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
A subset of mesh cells.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellZone.H" #include "cellZone.H"
@ -45,59 +42,9 @@ namespace Foam
addToRunTimeSelectionTable(cellZone, cellZone, dictionary); addToRunTimeSelectionTable(cellZone, cellZone, dictionary);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::Map<Foam::label>& Foam::cellZone::cellLookupMap() const
{
if (!cellLookupMapPtr_)
{
calcCellLookupMap();
}
return *cellLookupMapPtr_;
}
void Foam::cellZone::calcCellLookupMap() const
{
if (debug)
{
Info<< "void cellZone::calcCellLookupMap() const : "
<< "Calculating cell lookup map"
<< endl;
}
if (cellLookupMapPtr_)
{
FatalErrorIn
(
"void cellZone::calcCellLookupMap() const"
) << "cell lookup map already calculated"
<< abort(FatalError);
}
const labelList& addr = *this;
cellLookupMapPtr_ = new Map<label>(2*addr.size());
Map<label>& clm = *cellLookupMapPtr_;
forAll (addr, cellI)
{
clm.insert(addr[cellI], cellI);
}
if (debug)
{
Info<< "void cellZone::calcCellLookupMap() const : "
<< "Finished calculating cell lookup map"
<< endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::cellZone::cellZone Foam::cellZone::cellZone
( (
const word& name, const word& name,
@ -106,11 +53,8 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm const cellZoneMesh& zm
) )
: :
labelList(addr), zone(name, addr, index),
name_(name), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{} {}
@ -122,15 +66,11 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm const cellZoneMesh& zm
) )
: :
labelList(addr), zone(name, addr, index),
name_(name), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{} {}
// Construct from dictionary
Foam::cellZone::cellZone Foam::cellZone::cellZone
( (
const word& name, const word& name,
@ -139,16 +79,11 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm const cellZoneMesh& zm
) )
: :
labelList(dict.lookup("cellLabels")), zone("cell", name, dict, index),
name_(name), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{} {}
// Construct given the original zone and resetting the
// cell list and zone mesh information
Foam::cellZone::cellZone Foam::cellZone::cellZone
( (
const cellZone& cz, const cellZone& cz,
@ -157,11 +92,8 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm const cellZoneMesh& zm
) )
: :
labelList(addr), zone(cz, addr, index),
name_(cz.name()), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{} {}
Foam::cellZone::cellZone Foam::cellZone::cellZone
@ -172,38 +104,22 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm const cellZoneMesh& zm
) )
: :
labelList(addr), zone(cz, addr, index),
name_(cz.name()), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cellZone::~cellZone() Foam::cellZone::~cellZone()
{ {}
clearAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::cellZone::whichCell(const label globalCellID) const Foam::label Foam::cellZone::whichCell(const label globalCellID) const
{ {
const Map<label>& clm = cellLookupMap(); return zone::localID(globalCellID);
Map<label>::const_iterator clmIter = clm.find(globalCellID);
if (clmIter == clm.end())
{
return -1;
}
else
{
return clmIter();
}
} }
@ -213,45 +129,9 @@ const Foam::cellZoneMesh& Foam::cellZone::zoneMesh() const
} }
void Foam::cellZone::clearAddressing()
{
deleteDemandDrivenData(cellLookupMapPtr_);
}
bool Foam::cellZone::checkDefinition(const bool report) const bool Foam::cellZone::checkDefinition(const bool report) const
{ {
const labelList& addr = *this; return zone::checkDefinition(zoneMesh_.mesh().nCells(), report);
bool boundaryError = false;
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= zoneMesh_.mesh().nCells())
{
boundaryError = true;
if (report)
{
SeriousErrorIn
(
"bool cellZone::checkDefinition("
"const bool report) const"
) << "Zone " << name()
<< " contains invalid cell label " << addr[i] << nl
<< "Valid cell labels are 0.."
<< zoneMesh_.mesh().nCells()-1 << endl;
}
}
}
return boundaryError;
}
void Foam::cellZone::write(Ostream& os) const
{
os << nl << name()
<< nl << static_cast<const labelList&>(*this);
} }
@ -284,10 +164,10 @@ void Foam::cellZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& p) Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& cz)
{ {
p.write(os); cz.write(os);
os.check("Ostream& operator<<(Ostream& f, const cellZone& p"); os.check("Ostream& operator<<(Ostream& os, const cellZone& cz");
return os; return os;
} }

View File

@ -42,12 +42,8 @@ SourceFiles
#ifndef cellZone_H #ifndef cellZone_H
#define cellZone_H #define cellZone_H
#include "labelList.H" #include "zone.H"
#include "typeInfo.H"
#include "dictionary.H"
#include "cellZoneMeshFwd.H" #include "cellZoneMeshFwd.H"
#include "pointFieldFwd.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,36 +62,22 @@ Ostream& operator<<(Ostream&, const cellZone&);
class cellZone class cellZone
: :
public labelList public zone
{ {
// Private data
//- Name of zone protected:
word name_;
//- Index of zone // Protected data
label index_;
//- Reference to zone list //- Reference to zone list
const cellZoneMesh& zoneMesh_; const cellZoneMesh& zoneMesh_;
// Demand-driven private data
//- Map of cell labels in zone for fast location lookup
mutable Map<label>* cellLookupMapPtr_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
cellZone(const cellZone&); cellZone(const cellZone&);
//- Return map of local cell indices
const Map<label>& cellLookupMap() const;
//- Build map of local cell indices
void calcCellLookupMap() const;
public: public:
@ -208,45 +190,19 @@ public:
//- Destructor //- Destructor
virtual ~cellZone();
virtual ~cellZone();
// Member Functions // Member Functions
//- Return name //- Helper function to re-direct to zone::localID(...)
const word& name() const
{
return name_;
}
//- Map storing the local cell index for every global cell
// index. Used to find out the index of cell in the zone from
// the known global cell index. If the cell is not in the
// zone, returns -1
label whichCell(const label globalCellID) const; label whichCell(const label globalCellID) const;
//- Return the index of this zone in zone list
label index() const
{
return index_;
}
//- Return zoneMesh reference //- Return zoneMesh reference
const cellZoneMesh& zoneMesh() const; const cellZoneMesh& zoneMesh() const;
//- Clear addressing
void clearAddressing();
//- Check zone definition. Return true if in error. //- Check zone definition. Return true if in error.
bool checkDefinition(const bool report = false) const; virtual bool checkDefinition(const bool report = false) const;
//- Correct patch after moving points
virtual void movePoints(const pointField&)
{}
//- Write
virtual void write(Ostream&) const;
//- Write dictionary //- Write dictionary
virtual void writeDict(Ostream&) const; virtual void writeDict(Ostream&) const;
@ -261,8 +217,9 @@ public:
void operator=(const labelList&); void operator=(const labelList&);
// Ostream Operator // I-O
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const cellZone&); friend Ostream& operator<<(Ostream&, const cellZone&);
}; };

View File

@ -22,15 +22,11 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellZone.H" #include "cellZone.H"
#include "dictionary.H" #include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::cellZone> Foam::cellZone::New Foam::autoPtr<Foam::cellZone> Foam::cellZone::New
@ -61,7 +57,7 @@ Foam::autoPtr<Foam::cellZone> Foam::cellZone::New
"const label, const cellZoneMesh&)", "const label, const cellZoneMesh&)",
dict dict
) << "Unknown cellZone type " << zoneType << endl << endl ) << "Unknown cellZone type " << zoneType << endl << endl
<< "Valid cellZone types are :" << endl << "Valid cellZone types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -70,6 +66,4 @@ Foam::autoPtr<Foam::cellZone> Foam::cellZone::New
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
A subset of mesh faces.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceZone.H" #include "faceZone.H"
@ -100,54 +97,6 @@ void Foam::faceZone::calcFaceZonePatch() const
} }
const Foam::Map<Foam::label>& Foam::faceZone::faceLookupMap() const
{
if (!faceLookupMapPtr_)
{
calcFaceLookupMap();
}
return *faceLookupMapPtr_;
}
void Foam::faceZone::calcFaceLookupMap() const
{
if (debug)
{
Info<< "void faceZone::calcFaceLookupMap() const : "
<< "Calculating face lookup map"
<< endl;
}
if (faceLookupMapPtr_)
{
FatalErrorIn
(
"void faceZone::calcFaceLookupMap() const"
) << "face lookup map already calculated"
<< abort(FatalError);
}
const labelList& addr = *this;
faceLookupMapPtr_ = new Map<label>(2*addr.size());
Map<label>& flm = *faceLookupMapPtr_;
forAll (addr, faceI)
{
flm.insert(addr[faceI], faceI);
}
if (debug)
{
Info<< "void faceZone::calcFaceLookupMap() const : "
<< "Finished calculating face lookup map"
<< endl;
}
}
void Foam::faceZone::calcCellLayers() const void Foam::faceZone::calcCellLayers() const
{ {
if (debug) if (debug)
@ -228,16 +177,13 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm const faceZoneMesh& zm
) )
: :
labelList(addr), zone(name, addr, index),
name_(name),
flipMap_(fm), flipMap_(fm),
index_(index),
zoneMesh_(zm), zoneMesh_(zm),
patchPtr_(NULL), patchPtr_(NULL),
masterCellsPtr_(NULL), masterCellsPtr_(NULL),
slaveCellsPtr_(NULL), slaveCellsPtr_(NULL),
mePtr_(NULL), mePtr_(NULL)
faceLookupMapPtr_(NULL)
{ {
checkAddressing(); checkAddressing();
} }
@ -252,22 +198,18 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm const faceZoneMesh& zm
) )
: :
labelList(addr), zone(name, addr, index),
name_(name),
flipMap_(fm), flipMap_(fm),
index_(index),
zoneMesh_(zm), zoneMesh_(zm),
patchPtr_(NULL), patchPtr_(NULL),
masterCellsPtr_(NULL), masterCellsPtr_(NULL),
slaveCellsPtr_(NULL), slaveCellsPtr_(NULL),
mePtr_(NULL), mePtr_(NULL)
faceLookupMapPtr_(NULL)
{ {
checkAddressing(); checkAddressing();
} }
// Construct from dictionary
Foam::faceZone::faceZone Foam::faceZone::faceZone
( (
const word& name, const word& name,
@ -276,23 +218,18 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm const faceZoneMesh& zm
) )
: :
labelList(dict.lookup("faceLabels")), zone("face", name, dict, index),
name_(name),
flipMap_(dict.lookup("flipMap")), flipMap_(dict.lookup("flipMap")),
index_(index),
zoneMesh_(zm), zoneMesh_(zm),
patchPtr_(NULL), patchPtr_(NULL),
masterCellsPtr_(NULL), masterCellsPtr_(NULL),
slaveCellsPtr_(NULL), slaveCellsPtr_(NULL),
mePtr_(NULL), mePtr_(NULL)
faceLookupMapPtr_(NULL)
{ {
checkAddressing(); checkAddressing();
} }
// Construct given the original zone and resetting the
// face list and zone mesh information
Foam::faceZone::faceZone Foam::faceZone::faceZone
( (
const faceZone& fz, const faceZone& fz,
@ -302,16 +239,13 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm const faceZoneMesh& zm
) )
: :
labelList(addr), zone(fz, addr, index),
name_(fz.name()),
flipMap_(fm), flipMap_(fm),
index_(index),
zoneMesh_(zm), zoneMesh_(zm),
patchPtr_(NULL), patchPtr_(NULL),
masterCellsPtr_(NULL), masterCellsPtr_(NULL),
slaveCellsPtr_(NULL), slaveCellsPtr_(NULL),
mePtr_(NULL), mePtr_(NULL)
faceLookupMapPtr_(NULL)
{ {
checkAddressing(); checkAddressing();
} }
@ -326,16 +260,13 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm const faceZoneMesh& zm
) )
: :
labelList(addr), zone(fz, addr, index),
name_(fz.name()),
flipMap_(fm), flipMap_(fm),
index_(index),
zoneMesh_(zm), zoneMesh_(zm),
patchPtr_(NULL), patchPtr_(NULL),
masterCellsPtr_(NULL), masterCellsPtr_(NULL),
slaveCellsPtr_(NULL), slaveCellsPtr_(NULL),
mePtr_(NULL), mePtr_(NULL)
faceLookupMapPtr_(NULL)
{ {
checkAddressing(); checkAddressing();
} }
@ -351,29 +282,18 @@ Foam::faceZone::~faceZone()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::faceZone::whichFace(const label globalFaceID) const
{
const Map<label>& flm = faceLookupMap();
Map<label>::const_iterator flmIter = flm.find(globalFaceID);
if (flmIter == flm.end())
{
return -1;
}
else
{
return flmIter();
}
}
const Foam::faceZoneMesh& Foam::faceZone::zoneMesh() const const Foam::faceZoneMesh& Foam::faceZone::zoneMesh() const
{ {
return zoneMesh_; return zoneMesh_;
} }
Foam::label Foam::faceZone::whichFace(const label globalFaceID) const
{
return zone::localID(globalFaceID);
}
const Foam::primitiveFacePatch& Foam::faceZone::operator()() const const Foam::primitiveFacePatch& Foam::faceZone::operator()() const
{ {
if (!patchPtr_) if (!patchPtr_)
@ -450,13 +370,14 @@ const Foam::labelList& Foam::faceZone::meshEdges() const
void Foam::faceZone::clearAddressing() void Foam::faceZone::clearAddressing()
{ {
zone::clearAddressing();
deleteDemandDrivenData(patchPtr_); deleteDemandDrivenData(patchPtr_);
deleteDemandDrivenData(masterCellsPtr_); deleteDemandDrivenData(masterCellsPtr_);
deleteDemandDrivenData(slaveCellsPtr_); deleteDemandDrivenData(slaveCellsPtr_);
deleteDemandDrivenData(mePtr_); deleteDemandDrivenData(mePtr_);
deleteDemandDrivenData(faceLookupMapPtr_);
} }
@ -504,30 +425,7 @@ void Foam::faceZone::updateMesh(const mapPolyMesh& mpm)
bool Foam::faceZone::checkDefinition(const bool report) const bool Foam::faceZone::checkDefinition(const bool report) const
{ {
const labelList& addr = *this; return zone::checkDefinition(zoneMesh().mesh().faces().size(), report);
bool boundaryError = false;
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= zoneMesh().mesh().faces().size())
{
boundaryError = true;
if (report)
{
SeriousErrorIn
(
"bool faceZone::checkDefinition("
"const bool report) const"
) << "Zone " << name()
<< " contains invalid face label " << addr[i] << nl
<< "Valid face labels are 0.."
<< zoneMesh().mesh().faces().size()-1 << endl;
}
}
}
return boundaryError;
} }
@ -642,10 +540,10 @@ void Foam::faceZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& p) Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& fz)
{ {
p.write(os); fz.write(os);
os.check("Ostream& operator<<(Ostream& f, const faceZone& p"); os.check("Ostream& operator<<(Ostream& os, const faceZone& fz");
return os; return os;
} }

View File

@ -41,13 +41,10 @@ SourceFiles
#ifndef faceZone_H #ifndef faceZone_H
#define faceZone_H #define faceZone_H
#include "typeInfo.H" #include "zone.H"
#include "dictionary.H"
#include "labelList.H"
#include "faceZoneMeshFwd.H" #include "faceZoneMeshFwd.H"
#include "boolList.H" #include "boolList.H"
#include "primitiveFacePatch.H" #include "primitiveFacePatch.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,20 +65,17 @@ Ostream& operator<<(Ostream&, const faceZone&);
class faceZone class faceZone
: :
public labelList public zone
{ {
// Private data
//- Name of zone protected:
word name_;
// Protected data
//- Flip map for all faces in the zone. Set to true if the //- Flip map for all faces in the zone. Set to true if the
// face needs to be flipped to achieve the correct orientation. // face needs to be flipped to achieve the correct orientation.
boolList flipMap_; boolList flipMap_;
//- Index of zone
label index_;
//- Reference to zone list //- Reference to zone list
const faceZoneMesh& zoneMesh_; const faceZoneMesh& zoneMesh_;
@ -100,9 +94,6 @@ class faceZone
//- Global edge addressing //- Global edge addressing
mutable labelList* mePtr_; mutable labelList* mePtr_;
//- Map of face labels in zone for fast location lookup
mutable Map<label>* faceLookupMapPtr_;
// Private Member Functions // Private Member Functions
@ -118,9 +109,6 @@ class faceZone
//- Return map of local face indices //- Return map of local face indices
const Map<label>& faceLookupMap() const; const Map<label>& faceLookupMap() const;
//- Build map of local face indices
void calcFaceLookupMap() const;
//- Calculate master and slave face layer //- Calculate master and slave face layer
void calcCellLayers() const; void calcCellLayers() const;
@ -244,38 +232,23 @@ public:
//- Destructor //- Destructor
virtual ~faceZone();
virtual ~faceZone();
// Member Functions // Member Functions
//- Return name
const word& name() const
{
return name_;
}
//- Return face flip map //- Return face flip map
const boolList& flipMap() const const boolList& flipMap() const
{ {
return flipMap_; return flipMap_;
} }
//- Map storing the local face index for every global face index. //- Helper function to re-direct to zone::localID(...)
// Used to find out the index of face in the zone from the known global label whichFace(const label globalCellID) const;
// face index. If the face is not in the zone, returns -1
label whichFace(const label globalFaceID) const;
//- Return reference to primitive patch //- Return reference to primitive patch
const primitiveFacePatch& operator()() const; const primitiveFacePatch& operator()() const;
//- Return the index of this zone in zone list
label index() const
{
return index_;
}
//- Return zoneMesh reference //- Return zoneMesh reference
const faceZoneMesh& zoneMesh() const; const faceZoneMesh& zoneMesh() const;
@ -294,23 +267,23 @@ public:
//- Clear addressing //- Clear addressing
void clearAddressing(); virtual void clearAddressing();
//- Reset addressing and flip map (clearing demand-driven data) //- Reset addressing and flip map (clearing demand-driven data)
void resetAddressing(const labelList&, const boolList&); virtual void resetAddressing(const labelList&, const boolList&);
//- Check zone definition. Return true if in error. //- Check zone definition. Return true if in error.
bool checkDefinition(const bool report = false) const; virtual bool checkDefinition(const bool report = false) const;
//- Check whether all procs have faces synchronised. Return //- Check whether all procs have faces synchronised. Return
// true if in error. // true if in error.
bool checkParallelSync(const bool report = false) const; virtual bool checkParallelSync(const bool report = false) const;
//- Correct patch after moving points //- Correct patch after moving points
virtual void movePoints(const pointField&); virtual void movePoints(const pointField&);
//- Update for changes in topology //- Update for changes in topology
void updateMesh(const mapPolyMesh& mpm); virtual void updateMesh(const mapPolyMesh& mpm);
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
@ -319,8 +292,9 @@ public:
virtual void writeDict(Ostream&) const; virtual void writeDict(Ostream&) const;
// Ostream Operator // I-O
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const faceZone&); friend Ostream& operator<<(Ostream&, const faceZone&);
}; };

View File

@ -22,15 +22,11 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceZone.H" #include "faceZone.H"
#include "dictionary.H" #include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::faceZone> Foam::faceZone::New Foam::autoPtr<Foam::faceZone> Foam::faceZone::New
@ -61,7 +57,7 @@ Foam::autoPtr<Foam::faceZone> Foam::faceZone::New
"const label, const faceZoneMesh&)", "const label, const faceZoneMesh&)",
dict dict
) << "Unknown faceZone type " << zoneType << endl << endl ) << "Unknown faceZone type " << zoneType << endl << endl
<< "Valid faceZone types are :" << endl << "Valid faceZone types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -70,6 +66,4 @@ Foam::autoPtr<Foam::faceZone> Foam::faceZone::New
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -22,15 +22,11 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointZone.H" #include "pointZone.H"
#include "dictionary.H" #include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::pointZone> Foam::pointZone::New Foam::autoPtr<Foam::pointZone> Foam::pointZone::New
@ -61,7 +57,7 @@ Foam::autoPtr<Foam::pointZone> Foam::pointZone::New
"const label, const pointZoneMesh&)", "const label, const pointZoneMesh&)",
dict dict
) << "Unknown pointZone type " << zoneType << endl << endl ) << "Unknown pointZone type " << zoneType << endl << endl
<< "Valid pointZone types are :" << endl << "Valid pointZone types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -69,6 +65,5 @@ Foam::autoPtr<Foam::pointZone> Foam::pointZone::New
return autoPtr<pointZone>(cstrIter()(name, dict, index, zm)); return autoPtr<pointZone>(cstrIter()(name, dict, index, zm));
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
A subset of mesh points.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointZone.H" #include "pointZone.H"
@ -43,59 +40,9 @@ namespace Foam
addToRunTimeSelectionTable(pointZone, pointZone, dictionary); addToRunTimeSelectionTable(pointZone, pointZone, dictionary);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::Map<Foam::label>& Foam::pointZone::pointLookupMap() const
{
if (!pointLookupMapPtr_)
{
calcPointLookupMap();
}
return *pointLookupMapPtr_;
}
void Foam::pointZone::calcPointLookupMap() const
{
if (debug)
{
Info<< "void pointZone::calcPointLookupMap() const : "
<< "Calculating point lookup map"
<< endl;
}
if (pointLookupMapPtr_)
{
FatalErrorIn
(
"void pointZone::calcPointLookupMap() const"
) << "point lookup map already calculated"
<< abort(FatalError);
}
const labelList& addr = *this;
pointLookupMapPtr_ = new Map<label>(2*addr.size());
Map<label>& plm = *pointLookupMapPtr_;
forAll (addr, pointI)
{
plm.insert(addr[pointI], pointI);
}
if (debug)
{
Info<< "void pointZone::calcPointLookupMap() const : "
<< "Finished calculating point lookup map"
<< endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::pointZone::pointZone Foam::pointZone::pointZone
( (
const word& name, const word& name,
@ -104,11 +51,8 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm const pointZoneMesh& zm
) )
: :
labelList(addr), zone(name, addr, index),
name_(name), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{} {}
@ -120,15 +64,11 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm const pointZoneMesh& zm
) )
: :
labelList(addr), zone(name, addr, index),
name_(name), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{} {}
// Construct from dictionary
Foam::pointZone::pointZone Foam::pointZone::pointZone
( (
const word& name, const word& name,
@ -137,16 +77,11 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm const pointZoneMesh& zm
) )
: :
labelList(dict.lookup("pointLabels")), zone("point", name, dict, index),
name_(name), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{} {}
// Construct given the original zone and resetting the
// point list and zone mesh information
Foam::pointZone::pointZone Foam::pointZone::pointZone
( (
const pointZone& pz, const pointZone& pz,
@ -155,11 +90,8 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm const pointZoneMesh& zm
) )
: :
labelList(addr), zone(pz, addr, index),
name_(pz.name()), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{} {}
@ -171,92 +103,40 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm const pointZoneMesh& zm
) )
: :
labelList(addr), zone(pz, addr, index),
name_(pz.name()), zoneMesh_(zm)
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointZone::~pointZone() Foam::pointZone::~pointZone()
{ {}
clearAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::pointZone::whichPoint(const label globalPointID) const
{
const Map<label>& plm = pointLookupMap();
Map<label>::const_iterator plmIter = plm.find(globalPointID);
if (plmIter == plm.end())
{
return -1;
}
else
{
return plmIter();
}
}
const Foam::pointZoneMesh& Foam::pointZone::zoneMesh() const const Foam::pointZoneMesh& Foam::pointZone::zoneMesh() const
{ {
return zoneMesh_; return zoneMesh_;
} }
void Foam::pointZone::clearAddressing() Foam::label Foam::pointZone::whichPoint(const label globalPointID) const
{ {
deleteDemandDrivenData(pointLookupMapPtr_); return zone::localID(globalPointID);
} }
bool Foam::pointZone::checkDefinition(const bool report) const bool Foam::pointZone::checkDefinition(const bool report) const
{ {
const labelList& addr = *this; return zone::checkDefinition(zoneMesh_.mesh().points().size(), report);
bool boundaryError = false;
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= zoneMesh_.mesh().points().size())
{
boundaryError = true;
if (report)
{
SeriousErrorIn
(
"bool pointZone::checkDefinition("
"const bool report) const"
) << "Zone " << name()
<< " contains invalid point label " << addr[i] << nl
<< "Valid point labels are 0.."
<< zoneMesh_.mesh().points().size()-1 << endl;
}
}
}
return boundaryError;
}
void Foam::pointZone::write(Ostream& os) const
{
os << nl << name()
<< nl << static_cast<const labelList&>(*this);
} }
void Foam::pointZone::writeDict(Ostream& os) const void Foam::pointZone::writeDict(Ostream& os) const
{ {
os << nl << name() << nl << token::BEGIN_BLOCK << nl os << nl << name_ << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl; << " type " << type() << token::END_STATEMENT << nl;
writeEntry("pointLabels", os); writeEntry("pointLabels", os);
@ -267,10 +147,10 @@ void Foam::pointZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointZone::operator=(const pointZone& cz) void Foam::pointZone::operator=(const pointZone& pz)
{ {
clearAddressing(); clearAddressing();
labelList::operator=(cz); labelList::operator=(pz);
} }
@ -283,10 +163,10 @@ void Foam::pointZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& p) Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& pz)
{ {
p.write(os); pz.write(os);
os.check("Ostream& operator<<(Ostream& f, const pointZone& p"); os.check("Ostream& operator<<(Ostream& os, const pointZone& pz");
return os; return os;
} }

View File

@ -43,12 +43,8 @@ SourceFiles
#ifndef pointZone_H #ifndef pointZone_H
#define pointZone_H #define pointZone_H
#include "labelList.H" #include "zone.H"
#include "typeInfo.H"
#include "dictionary.H"
#include "pointZoneMeshFwd.H" #include "pointZoneMeshFwd.H"
#include "Map.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,37 +63,22 @@ Ostream& operator<<(Ostream&, const pointZone&);
class pointZone class pointZone
: :
public labelList public zone
{ {
protected:
// Private data // Private data
//- Name of zone
word name_;
//- Index of zone
label index_;
//- Reference to zone list //- Reference to zone list
const pointZoneMesh& zoneMesh_; const pointZoneMesh& zoneMesh_;
// Demand-driven private data
//- Map of point labels in zone for fast location lookup
mutable Map<label>* pointLookupMapPtr_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
pointZone(const pointZone&); pointZone(const pointZone&);
//- Return map of local point indices
const Map<label>& pointLookupMap() const;
//- Build map of local point indices
void calcPointLookupMap() const;
public: public:
@ -210,46 +191,24 @@ public:
//- Destructor //- Destructor
virtual ~pointZone();
virtual ~pointZone();
// Member Functions // Member Functions
//- Return name
const word& name() const
{
return name_;
}
//- Map storing the local point index for every global point
// index. Used to find out the index of point in the zone from
// the known global point index. If the point is not in the
// zone, returns -1
label whichPoint(const label globalPointID) const;
//- Return the index of this zone in zone list
label index() const
{
return index_;
}
//- Return zoneMesh reference //- Return zoneMesh reference
const pointZoneMesh& zoneMesh() const; const pointZoneMesh& zoneMesh() const;
//- Clear addressing //- Helper function to re-direct to zone::localID(...)
void clearAddressing(); label whichPoint(const label globalPointID) const;
//- Check zone definition. Return true if in error. //- Check zone definition. Return true if in error.
bool checkDefinition(const bool report = false) const; virtual bool checkDefinition(const bool report = false) const;
//- Correct patch after moving points //- Correct patch after moving points
virtual void movePoints(const pointField&) virtual void movePoints(const pointField&)
{} {}
//- Write
virtual void write(Ostream&) const;
//- Write dictionary //- Write dictionary
virtual void writeDict(Ostream&) const; virtual void writeDict(Ostream&) const;
@ -263,8 +222,9 @@ public:
void operator=(const labelList&); void operator=(const labelList&);
// Ostream Operator // I-O
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const pointZone&); friend Ostream& operator<<(Ostream&, const pointZone&);
}; };

View File

@ -0,0 +1,239 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ 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 "zone.H"
#include "IOstream.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(zone, 0);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
const Foam::Map<Foam::label>& Foam::zone::lookupMap() const
{
if (!lookupMapPtr_)
{
calcLookupMap();
}
return *lookupMapPtr_;
}
void Foam::zone::calcLookupMap() const
{
if (debug)
{
Info<< "void zone::calcLookupMap() const: "
<< "Calculating lookup map"
<< endl;
}
if (lookupMapPtr_)
{
FatalErrorIn("void zone::calcLookupMap() const")
<< "Lookup map already calculated" << nl
<< abort(FatalError);
}
const labelList& addr = *this;
lookupMapPtr_ = new Map<label>(2*addr.size());
Map<label>& lm = *lookupMapPtr_;
forAll(addr, i)
{
lm.insert(addr[i], i);
}
if (debug)
{
Info<< "void zone::calcLookupMap() const: "
<< "Finished calculating lookup map"
<< endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::zone::zone
(
const word& name,
const labelList& addr,
const label index
)
:
labelList(addr),
name_(name),
index_(index),
lookupMapPtr_(NULL)
{}
Foam::zone::zone
(
const word& name,
const Xfer<labelList>& addr,
const label index
)
:
labelList(addr),
name_(name),
index_(index),
lookupMapPtr_(NULL)
{}
Foam::zone::zone
(
const word& zoneType,
const word& name,
const dictionary& dict,
const label index
)
:
labelList(dict.lookup(zoneType + "Labels")),
name_(name),
index_(index),
lookupMapPtr_(NULL)
{}
Foam::zone::zone
(
const zone& z,
const labelList& addr,
const label index
)
:
labelList(addr),
name_(z.name()),
index_(index),
lookupMapPtr_(NULL)
{}
Foam::zone::zone
(
const zone& z,
const Xfer<labelList>& addr,
const label index
)
:
labelList(addr),
name_(z.name()),
index_(index),
lookupMapPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::zone::~zone()
{
clearAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::zone::localID(const label globalCellID) const
{
const Map<label>& lm = lookupMap();
Map<label>::const_iterator lmIter = lm.find(globalCellID);
if (lmIter == lm.end())
{
return -1;
}
else
{
return lmIter();
}
}
void Foam::zone::clearAddressing()
{
deleteDemandDrivenData(lookupMapPtr_);
}
bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
{
const labelList& addr = *this;
bool boundaryError = false;
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= maxSize)
{
boundaryError = true;
if (report)
{
SeriousErrorIn
(
"bool zone::checkDefinition("
"const label maxSize, const bool report) const"
) << "Zone " << name_
<< " contains invalid index label " << addr[i] << nl
<< "Valid index labels are 0.."
<< maxSize-1 << endl;
}
}
}
return boundaryError;
}
void Foam::zone::write(Ostream& os) const
{
os << nl << name_
<< nl << static_cast<const labelList&>(*this);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const zone& z)
{
z.write(os);
os.check("Ostream& operator<<(Ostream& f, const zone& z");
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,207 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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::cellZone
Description
Base class for zones
SourceFiles
zone.C
\*---------------------------------------------------------------------------*/
#ifndef zone_H
#define zone_H
#include "labelList.H"
#include "typeInfo.H"
#include "dictionary.H"
#include "Map.H"
#include "pointFieldFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class zone;
Ostream& operator<<(Ostream&, const zone&);
/*---------------------------------------------------------------------------*\
Class zone Declaration
\*---------------------------------------------------------------------------*/
class zone
:
public labelList
{
protected:
// Protected data
//- Name of zone
word name_;
//- Index of zone
label index_;
// Demand-driven private data
//- Map of labels in zone for fast location lookup
mutable Map<label>* lookupMapPtr_;
// Protected Member Functions
//- Return a reference to the look-up map
const Map<label>& lookupMap() const;
//- Construct the look-up map
void calcLookupMap() const;
//- Disallow default bitwise copy construct
zone(const zone&);
public:
//- Runtime type information
TypeName("zone");
// Constructors
//- Construct from components
zone
(
const word& name,
const labelList& addr,
const label index
);
//- Construct from components, transferring contents
zone
(
const word& name,
const Xfer<labelList>& addr,
const label index
);
//- Construct from dictionary
zone
(
const word& zoneType,
const word& name,
const dictionary&,
const label index
);
//- Construct given the original zone and resetting the
// cell list and zone mesh information
zone
(
const zone&,
const labelList& addr,
const label index
);
//- Construct given the original zone, resetting the
// cell list and zone mesh information
zone
(
const zone&,
const Xfer<labelList>& addr,
const label index
);
//- Destructor
virtual ~zone();
// Member Functions
//- Return name
const word& name() const
{
return name_;
}
//- Map storing the local index for every global index. Used to find
// the index of the item in the zone from the known global index. If
// the item is not in the zone, returns -1
label localID(const label globalID) const;
//- Return the index of this zone in zone list
label index() const
{
return index_;
}
//- Clear addressing
virtual void clearAddressing();
//- Check zone definition. Return true if in error.
virtual bool checkDefinition(const bool report = false) const = 0;
//- Check zone definition with max size given. Return true if in error.
virtual bool checkDefinition
(
const label maxSize,
const bool report = false
) const;
//- Correct patch after moving points
virtual void movePoints(const pointField&)
{}
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&) const = 0;
// I-O
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const zone&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -376,16 +376,29 @@ inline pointHit triangle<Point, PointRef>::ray
return ray(p, q1 - n, alg, intersection::VECTOR); return ray(p, q1 - n, alg, intersection::VECTOR);
} }
// Intersection point with triangle plane
point pInter; point pInter;
// Is intersection point inside triangle
bool hit; bool hit;
{ {
// Reuse the fast ray intersection routine below in FULL_RAY // Reuse the fast ray intersection routine below in FULL_RAY
// mode since the original intersection routine has rounding problems. // mode since the original intersection routine has rounding problems.
pointHit fastInter = intersection(p, q1, intersection::FULL_RAY); pointHit fastInter = intersection(p, q1, intersection::FULL_RAY);
pInter = fastInter.rawPoint();
hit = fastInter.hit(); hit = fastInter.hit();
if (hit)
{
pInter = fastInter.rawPoint();
}
else
{
// Calculate intersection of ray with triangle plane
vector v = a_ - p;
pInter = p + (q1&v)*q1;
}
} }
// Distance to intersection point
scalar dist = q1 & (pInter - p); scalar dist = q1 & (pInter - p);
const scalar planarPointTol = const scalar planarPointTol =

View File

@ -42,20 +42,35 @@ Foam::DynamicList<MPI_Request> OPstream_outstandingRequests_;
Foam::OPstream::~OPstream() Foam::OPstream::~OPstream()
{ {
if if (commsType_ == nonBlocking)
(
!write
(
commsType_,
toProcNo_,
buf_.begin(),
bufPosition_
)
)
{ {
FatalErrorIn("OPstream::~OPstream()") // alloc nonBlocking only if empty buffer. This denotes the buffer
<< "MPI_Bsend cannot send outgoing message" // having been transfered out.
<< Foam::abort(FatalError); if (bufPosition_ > 0)
{
FatalErrorIn("OPstream::~OPstream()")
<< "OPstream contains buffer so cannot be used with nonBlocking"
<< " since destructor would destroy buffer whilst possibly"
<< " still sending." << Foam::abort(FatalError);
}
}
else
{
if
(
!write
(
commsType_,
toProcNo_,
buf_.begin(),
bufPosition_
)
)
{
FatalErrorIn("OPstream::~OPstream()")
<< "MPI cannot send outgoing message"
<< Foam::abort(FatalError);
}
} }
} }

View File

@ -28,12 +28,9 @@ License
#include "fvMesh.H" #include "fvMesh.H"
#include "Time.H" #include "Time.H"
#include "boundBox.H" #include "boundBox.H"
#include "globalIndex.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "mapDistributePolyMesh.H"
#include "cellSet.H" #include "cellSet.H"
#include "syncTools.H" #include "syncTools.H"
#include "motionSmoother.H"
#include "refinementParameters.H" #include "refinementParameters.H"
#include "snapParameters.H" #include "snapParameters.H"
#include "layerParameters.H" #include "layerParameters.H"

View File

@ -28,14 +28,13 @@ License
#include "meshRefinement.H" #include "meshRefinement.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "Time.H" #include "Time.H"
#include "boundBox.H"
#include "mapDistributePolyMesh.H"
#include "cellSet.H" #include "cellSet.H"
#include "syncTools.H" #include "syncTools.H"
#include "refinementParameters.H" #include "refinementParameters.H"
#include "featureEdgeMesh.H" #include "featureEdgeMesh.H"
#include "refinementSurfaces.H" #include "refinementSurfaces.H"
#include "shellSurfaces.H" #include "shellSurfaces.H"
#include "mapDistributePolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -1418,18 +1418,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
nOldPoints, nOldPoints,
nOldFaces, nOldFaces,
nOldCells, nOldCells,
oldPatchStarts, oldPatchStarts.xfer(),
oldPatchNMeshPoints, oldPatchNMeshPoints.xfer(),
labelListList(1, identity(mesh_.nPoints())),//subPointMap labelListList(1, identity(mesh_.nPoints())).xfer(),//subPointMap
labelListList(1, identity(mesh_.nFaces())), //subFaceMap labelListList(1, identity(mesh_.nFaces())).xfer(), //subFaceMap
labelListList(1, identity(mesh_.nCells())), //subCellMap labelListList(1, identity(mesh_.nCells())).xfer(), //subCellMap
labelListList(1, identity(patches.size())), //subPatchMap labelListList(1, identity(patches.size())).xfer(), //subPatchMap
labelListList(1, identity(mesh_.nPoints())),//constructPointMap labelListList(1, identity(mesh_.nPoints())).xfer(),//pointMap
labelListList(1, identity(mesh_.nFaces())), //constructFaceMap labelListList(1, identity(mesh_.nFaces())).xfer(), //faceMap
labelListList(1, identity(mesh_.nCells())), //constructCellMap labelListList(1, identity(mesh_.nCells())).xfer(), //cellMap
labelListList(1, identity(patches.size())) //constructPatchMap labelListList(1, identity(patches.size())).xfer() //patchMap
) )
); );
} }
@ -2207,19 +2207,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
nOldPoints, nOldPoints,
nOldFaces, nOldFaces,
nOldCells, nOldCells,
oldPatchStarts, oldPatchStarts.xfer(),
oldPatchNMeshPoints, oldPatchNMeshPoints.xfer(),
subPointMap, subPointMap.xfer(),
subFaceMap, subFaceMap.xfer(),
subCellMap, subCellMap.xfer(),
subPatchMap, subPatchMap.xfer(),
constructPointMap, constructPointMap.xfer(),
constructFaceMap, constructFaceMap.xfer(),
constructCellMap, constructCellMap.xfer(),
constructPatchMap, constructPatchMap.xfer()
true // reuse storage
) )
); );
} }

View File

@ -43,7 +43,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::slidingInterface::edgeCoPlanarTol_ = 0.8; const Foam::scalar Foam::slidingInterface::edgeCoPlanarTolDefault_ = 0.8;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -27,10 +27,8 @@ License
#include "slidingInterface.H" #include "slidingInterface.H"
#include "polyTopoChanger.H" #include "polyTopoChanger.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "primitiveMesh.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "triPointRef.H"
#include "plane.H" #include "plane.H"
// Index of debug signs: // Index of debug signs:
@ -173,6 +171,14 @@ Foam::slidingInterface::slidingInterface
attached_(false), attached_(false),
projectionAlgo_(algo), projectionAlgo_(algo),
trigger_(false), trigger_(false),
pointMergeTol_(pointMergeTolDefault_),
edgeMergeTol_(edgeMergeTolDefault_),
nFacesPerSlaveEdge_(nFacesPerSlaveEdgeDefault_),
edgeFaceEscapeLimit_(edgeFaceEscapeLimitDefault_),
integralAdjTol_(integralAdjTolDefault_),
edgeMasterCatchFraction_(edgeMasterCatchFractionDefault_),
edgeCoPlanarTol_(edgeCoPlanarTolDefault_),
edgeEndCutoffTol_(edgeEndCutoffTolDefault_),
cutFaceMasterPtr_(NULL), cutFaceMasterPtr_(NULL),
cutFaceSlavePtr_(NULL), cutFaceSlavePtr_(NULL),
masterFaceCellsPtr_(NULL), masterFaceCellsPtr_(NULL),
@ -280,6 +286,9 @@ Foam::slidingInterface::slidingInterface
masterPointEdgeHitsPtr_(NULL), masterPointEdgeHitsPtr_(NULL),
projectedSlavePointsPtr_(NULL) projectedSlavePointsPtr_(NULL)
{ {
// Optionally default tolerances from dictionary
setTolerances(dict);
checkDefinition(); checkDefinition();
// If the interface is attached, the master and slave face zone addressing // If the interface is attached, the master and slave face zone addressing
@ -686,6 +695,63 @@ const Foam::pointField& Foam::slidingInterface::pointProjection() const
return *projectedSlavePointsPtr_; return *projectedSlavePointsPtr_;
} }
void Foam::slidingInterface::setTolerances(const dictionary&dict, bool report)
{
pointMergeTol_ = dict.lookupOrDefault<scalar>
(
"pointMergeTol",
pointMergeTol_
);
edgeMergeTol_ = dict.lookupOrDefault<scalar>
(
"edgeMergeTol",
edgeMergeTol_
);
nFacesPerSlaveEdge_ = dict.lookupOrDefault<scalar>
(
"nFacesPerSlaveEdge",
nFacesPerSlaveEdge_
);
edgeFaceEscapeLimit_ = dict.lookupOrDefault<scalar>
(
"edgeFaceEscapeLimit",
edgeFaceEscapeLimit_
);
integralAdjTol_ = dict.lookupOrDefault<scalar>
(
"integralAdjTol",
integralAdjTol_
);
edgeMasterCatchFraction_ = dict.lookupOrDefault<scalar>
(
"edgeMasterCatchFraction",
edgeMasterCatchFraction_
);
edgeCoPlanarTol_ = dict.lookupOrDefault<scalar>
(
"edgeCoPlanarTol",
edgeCoPlanarTol_
);
edgeEndCutoffTol_ = dict.lookupOrDefault<scalar>
(
"edgeEndCutoffTol",
edgeEndCutoffTol_
);
if (report)
{
Info<< "Sliding interface parameters:" << nl
<< "pointMergeTol : " << pointMergeTol_ << nl
<< "edgeMergeTol : " << edgeMergeTol_ << nl
<< "nFacesPerSlaveEdge : " << nFacesPerSlaveEdge_ << nl
<< "edgeFaceEscapeLimit : " << edgeFaceEscapeLimit_ << nl
<< "integralAdjTol : " << integralAdjTol_ << nl
<< "edgeMasterCatchFraction : " << edgeMasterCatchFraction_ << nl
<< "edgeCoPlanarTol : " << edgeCoPlanarTol_ << nl
<< "edgeEndCutoffTol : " << edgeEndCutoffTol_ << endl;
}
}
void Foam::slidingInterface::write(Ostream& os) const void Foam::slidingInterface::write(Ostream& os) const
{ {
@ -703,6 +769,14 @@ void Foam::slidingInterface::write(Ostream& os) const
} }
// To write out all those tolerances
#define WRITE_NON_DEFAULT(name) \
if( name ## _ != name ## Default_ )\
{ \
os << " " #name " " << name ## _ << token::END_STATEMENT << nl; \
}
void Foam::slidingInterface::writeDict(Ostream& os) const void Foam::slidingInterface::writeDict(Ostream& os) const
{ {
os << nl << name() << nl << token::BEGIN_BLOCK << nl os << nl << name() << nl << token::BEGIN_BLOCK << nl
@ -743,6 +817,15 @@ void Foam::slidingInterface::writeDict(Ostream& os) const
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
} }
WRITE_NON_DEFAULT(pointMergeTol)
WRITE_NON_DEFAULT(edgeMergeTol)
WRITE_NON_DEFAULT(nFacesPerSlaveEdge)
WRITE_NON_DEFAULT(edgeFaceEscapeLimit)
WRITE_NON_DEFAULT(integralAdjTol)
WRITE_NON_DEFAULT(edgeMasterCatchFraction)
WRITE_NON_DEFAULT(edgeCoPlanarTol)
WRITE_NON_DEFAULT(edgeEndCutoffTol)
os << token::END_BLOCK << endl; os << token::END_BLOCK << endl;
} }

View File

@ -129,6 +129,32 @@ private:
//- Trigger topological change //- Trigger topological change
mutable bool trigger_; mutable bool trigger_;
// Tolerances. Initialised to static ones below.
//- Point merge tolerance
scalar pointMergeTol_;
//- Edge merge tolerance
scalar edgeMergeTol_;
//- Estimated number of faces an edge goes through
label nFacesPerSlaveEdge_;
//- Edge-face interaction escape limit
label edgeFaceEscapeLimit_;
//- Integral match point adjustment tolerance
scalar integralAdjTol_;
//- Edge intersection master catch fraction
scalar edgeMasterCatchFraction_;
//- Edge intersection co-planar tolerance
scalar edgeCoPlanarTol_;
//- Edge end cut-off tolerance
scalar edgeEndCutoffTol_;
// Private addressing data. // Private addressing data.
@ -256,28 +282,28 @@ private:
// Static data members // Static data members
//- Point merge tolerance //- Point merge tolerance
static const scalar pointMergeTol_; static const scalar pointMergeTolDefault_;
//- Edge merge tolerance //- Edge merge tolerance
static const scalar edgeMergeTol_; static const scalar edgeMergeTolDefault_;
//- Estimated number of faces an edge goes through //- Estimated number of faces an edge goes through
static const label nFacesPerSlaveEdge_; static const label nFacesPerSlaveEdgeDefault_;
//- Edge-face interaction escape limit //- Edge-face interaction escape limit
static const label edgeFaceEscapeLimit_; static const label edgeFaceEscapeLimitDefault_;
//- Integral match point adjustment tolerance //- Integral match point adjustment tolerance
static const scalar integralAdjTol_; static const scalar integralAdjTolDefault_;
//- Edge intersection master catch fraction //- Edge intersection master catch fraction
static const scalar edgeMasterCatchFraction_; static const scalar edgeMasterCatchFractionDefault_;
//- Edge intersection co-planar tolerance //- Edge intersection co-planar tolerance
static const scalar edgeCoPlanarTol_; static const scalar edgeCoPlanarTolDefault_;
//- Edge end cut-off tolerance //- Edge end cut-off tolerance
static const scalar edgeEndCutoffTol_; static const scalar edgeEndCutoffTolDefault_;
public: public:
@ -350,6 +376,8 @@ public:
//- Return projected points for a slave patch //- Return projected points for a slave patch
const pointField& pointProjection() const; const pointField& pointProjection() const;
//- Set the tolerances from the values in a dictionary
void setTolerances(const dictionary&, bool report=false);
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;

View File

@ -26,22 +26,19 @@ License
#include "slidingInterface.H" #include "slidingInterface.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "primitiveMesh.H"
#include "line.H" #include "line.H"
#include "triPointRef.H"
#include "plane.H"
#include "polyTopoChanger.H" #include "polyTopoChanger.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::slidingInterface::pointMergeTol_ = 0.05; const Foam::scalar Foam::slidingInterface::pointMergeTolDefault_ = 0.05;
const Foam::scalar Foam::slidingInterface::edgeMergeTol_ = 0.01; const Foam::scalar Foam::slidingInterface::edgeMergeTolDefault_ = 0.01;
const Foam::label Foam::slidingInterface::nFacesPerSlaveEdge_ = 5; const Foam::label Foam::slidingInterface::nFacesPerSlaveEdgeDefault_ = 5;
const Foam::label Foam::slidingInterface::edgeFaceEscapeLimit_ = 10; const Foam::label Foam::slidingInterface::edgeFaceEscapeLimitDefault_ = 10;
const Foam::scalar Foam::slidingInterface::integralAdjTol_ = 0.05; const Foam::scalar Foam::slidingInterface::integralAdjTolDefault_ = 0.05;
const Foam::scalar Foam::slidingInterface::edgeMasterCatchFraction_ = 0.4; const Foam::scalar Foam::slidingInterface::edgeMasterCatchFractionDefault_ = 0.4;
const Foam::scalar Foam::slidingInterface::edgeEndCutoffTol_ = 0.0001; const Foam::scalar Foam::slidingInterface::edgeEndCutoffTolDefault_ = 0.0001;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -81,7 +81,10 @@ Foam::porousZone::porousZone
{ {
Info<< "Creating porous zone: " << name_ << endl; Info<< "Creating porous zone: " << name_ << endl;
if (cellZoneID_ == -1 && !Pstream::parRun()) bool foundZone = (cellZoneID_ != -1);
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
{ {
FatalErrorIn FatalErrorIn
( (
@ -91,6 +94,7 @@ Foam::porousZone::porousZone
<< exit(FatalError); << exit(FatalError);
} }
// porosity // porosity
if (dict_.readIfPresent("porosity", porosity_)) if (dict_.readIfPresent("porosity", porosity_))
{ {

View File

@ -70,7 +70,7 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<Type>(p, iF), fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
refValue_(ptf.refValue_, mapper), refValue_(ptf.refValue_, mapper),
amplitude_(ptf.amplitude_), amplitude_(ptf.amplitude_),
frequency_(ptf.frequency_), frequency_(ptf.frequency_),
@ -188,13 +188,12 @@ void oscillatingFixedValueFvPatchField<Type>::updateCoeffs()
template<class Type> template<class Type>
void oscillatingFixedValueFvPatchField<Type>::write(Ostream& os) const void oscillatingFixedValueFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fixedValueFvPatchField<Type>::write(os);
refValue_.writeEntry("refValue", os); refValue_.writeEntry("refValue", os);
os.writeKeyword("amplitude") os.writeKeyword("amplitude")
<< amplitude_ << token::END_STATEMENT << nl; << amplitude_ << token::END_STATEMENT << nl;
os.writeKeyword("frequency") os.writeKeyword("frequency")
<< frequency_ << token::END_STATEMENT << nl; << frequency_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
} }

View File

@ -280,9 +280,8 @@ Foam::extendedCellToFaceStencil::calcDistributeMap
new mapDistribute new mapDistribute
( (
nCompact, nCompact,
sendCompact, sendCompact.xfer(),
recvCompact, recvCompact.xfer()
true // reuse send/recv maps.
) )
); );

View File

@ -79,7 +79,6 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
<< " (Actual type " << actualTypeName_ << ")" << nl << " (Actual type " << actualTypeName_ << ")" << nl
<< "\n Please add the 'value' entry to the write function " << "\n Please add the 'value' entry to the write function "
"of the user-defined boundary-condition\n" "of the user-defined boundary-condition\n"
" or link the boundary-condition into libfoamUtil.so"
<< exit(FatalIOError); << exit(FatalIOError);
} }

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DispersionModel.H" #include "DispersionModel.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cloudAbsorptionEmission.H" #include "cloudAbsorptionEmission.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cloudScatter.H" #include "cloudScatter.H"

View File

@ -244,6 +244,7 @@ class PointEdgeWave
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const PointEdgeWave&); void operator=(const PointEdgeWave&);
public: public:
// Static Functions // Static Functions
@ -261,7 +262,6 @@ public:
} }
// Constructors // Constructors
//- Construct from mesh, list of changed points with the Type //- Construct from mesh, list of changed points with the Type

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "PointEdgeWave.H" #include "PointEdgeWave.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointEdgePoint.H" #include "pointEdgePoint.H"
@ -32,8 +30,6 @@ Description
Foam::point Foam::pointEdgePoint::greatPoint(GREAT, GREAT, GREAT); Foam::point Foam::pointEdgePoint::greatPoint(GREAT, GREAT, GREAT);
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
@ -45,9 +41,11 @@ Foam::Ostream& Foam::operator<<
return os << wDist.origin() << wDist.distSqr(); return os << wDist.origin() << wDist.distSqr();
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::pointEdgePoint& wDist) Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::pointEdgePoint& wDist)
{ {
return is >> wDist.origin_ >> wDist.distSqr_; return is >> wDist.origin_ >> wDist.distSqr_;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -45,7 +45,6 @@ SourceFiles
#include "tensor.H" #include "tensor.H"
#include "pTraits.H" #include "pTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -69,6 +68,7 @@ class pointEdgePoint
//- normal distance (squared) from point to origin //- normal distance (squared) from point to origin
scalar distSqr_; scalar distSqr_;
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point. Update distSqr, origin from whomever
@ -89,6 +89,7 @@ class pointEdgePoint
const scalar tol const scalar tol
); );
public: public:
// Static data members // Static data members
@ -96,6 +97,7 @@ public:
//- initial point far away. //- initial point far away.
static point greatPoint; static point greatPoint;
// Constructors // Constructors
//- Construct null //- Construct null

View File

@ -46,7 +46,7 @@ inline bool Foam::pointEdgePoint::update
origin_ = w2.origin(); origin_ = w2.origin();
return true; return true;
} }
scalar diff = distSqr_ - dist2; scalar diff = distSqr_ - dist2;
@ -71,7 +71,7 @@ inline bool Foam::pointEdgePoint::update
} }
} }
// Update this with w2 (information on same point) // Update this with w2 (information on same point)
inline bool Foam::pointEdgePoint::update inline bool Foam::pointEdgePoint::update
( (
@ -86,7 +86,7 @@ inline bool Foam::pointEdgePoint::update
origin_ = w2.origin(); origin_ = w2.origin();
return true; return true;
} }
scalar diff = distSqr_ - w2.distSqr(); scalar diff = distSqr_ - w2.distSqr();
@ -111,6 +111,7 @@ inline bool Foam::pointEdgePoint::update
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor // Null constructor
@ -124,7 +125,7 @@ inline Foam::pointEdgePoint::pointEdgePoint()
// Construct from origin, distance // Construct from origin, distance
inline Foam::pointEdgePoint::pointEdgePoint inline Foam::pointEdgePoint::pointEdgePoint
( (
const point& origin, const point& origin,
const scalar distSqr const scalar distSqr
) )
: :
@ -229,14 +230,14 @@ inline bool Foam::pointEdgePoint::updatePoint
const scalar tol const scalar tol
) )
{ {
return return
update update
( (
mesh.points()[pointI], mesh.points()[pointI],
edgeInfo, edgeInfo,
tol tol
); );
} }
// Update this with new information on same point // Update this with new information on same point
@ -255,7 +256,7 @@ inline bool Foam::pointEdgePoint::updatePoint
newPointInfo, newPointInfo,
tol tol
); );
} }
// Update this with new information on same point. No extra information. // Update this with new information on same point. No extra information.
@ -266,7 +267,7 @@ inline bool Foam::pointEdgePoint::updatePoint
) )
{ {
return update(newPointInfo, tol); return update(newPointInfo, tol);
} }
// Update this with information from connected point // Update this with information from connected point
@ -292,7 +293,7 @@ inline bool Foam::pointEdgePoint::updateEdge
pointInfo, pointInfo,
tol tol
); );
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellClassification.H" #include "cellClassification.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellInfo.H" #include "cellInfo.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellDistFuncs.H" #include "cellDistFuncs.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "wallPoint.H" #include "wallPoint.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "wallPointData.H" #include "wallPointData.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellFeatures.H" #include "cellFeatures.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Class calculates cell quality measures.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -111,10 +111,7 @@ Foam::coordinateSystem::coordinateSystem
} }
Foam::coordinateSystem::coordinateSystem Foam::coordinateSystem::coordinateSystem(const dictionary& dict)
(
const dictionary& dict
)
: :
name_(type()), name_(type()),
note_(), note_(),
@ -322,16 +319,17 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
os.writeKeyword("note") << note_ << token::END_STATEMENT << nl; os.writeKeyword("note") << note_ << token::END_STATEMENT << nl;
} }
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl; os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
os.writeKeyword("e1") << e1() << token::END_STATEMENT << nl; os.writeKeyword("e1") << e1() << token::END_STATEMENT << nl;
os.writeKeyword("e3") << e3() << token::END_STATEMENT << nl; os.writeKeyword("e3") << e3() << token::END_STATEMENT << nl;
if (subDict) if (subDict)
{ {
os << decrIndent << indent << token::END_BLOCK << endl; os << decrIndent << indent << token::END_BLOCK << endl;
} }
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::coordinateSystem::operator=(const dictionary& rhs) void Foam::coordinateSystem::operator=(const dictionary& rhs)

View File

@ -166,6 +166,7 @@ class coordinateSystem
//- Global-to-Local transformation tensor //- Global-to-Local transformation tensor
tensor Rtr_; tensor Rtr_;
protected: protected:
// Protected Member Functions // Protected Member Functions
@ -194,6 +195,7 @@ protected:
bool translate bool translate
) const; ) const;
public: public:
//- Runtime type information //- Runtime type information
@ -249,6 +251,7 @@ public:
return autoPtr<coordinateSystem>(new coordinateSystem(*this)); return autoPtr<coordinateSystem>(new coordinateSystem(*this));
} }
// Declare run-time constructor selection table // Declare run-time constructor selection table
declareRunTimeSelectionTable declareRunTimeSelectionTable
@ -276,6 +279,7 @@ public:
(name, origin, cr) (name, origin, cr)
); );
// Selectors // Selectors
//- Select constructed from dictionary //- Select constructed from dictionary
@ -297,160 +301,170 @@ public:
//- Select constructed from Istream //- Select constructed from Istream
static autoPtr<coordinateSystem> New(Istream& is); static autoPtr<coordinateSystem> New(Istream& is);
// Destructor
virtual ~coordinateSystem(); //- Destructor
virtual ~coordinateSystem();
// Member Functions // Member Functions
// Access // Access
//- Return name //- Return name
const word& name() const const word& name() const
{ {
return name_; return name_;
} }
//- Return non-constant access to the optional note //- Return non-constant access to the optional note
string& note() string& note()
{ {
return note_; return note_;
} }
//- Return the optional note //- Return the optional note
const string& note() const const string& note() const
{ {
return note_; return note_;
} }
//- Return origin //- Return origin
const point& origin() const const point& origin() const
{ {
return origin_; return origin_;
} }
//- Return coordinate rotation //- Return coordinate rotation
const coordinateRotation& rotation() const const coordinateRotation& rotation() const
{ {
return R_; return R_;
} }
//- Return local-to-global transformation tensor //- Return local-to-global transformation tensor
const tensor& R() const const tensor& R() const
{ {
return R_; return R_;
} }
//- Return local Cartesian x-axis //- Return local Cartesian x-axis
const vector& e1() const const vector& e1() const
{ {
return Rtr_.x(); return Rtr_.x();
} }
//- Return local Cartesian y-axis //- Return local Cartesian y-axis
const vector& e2() const const vector& e2() const
{ {
return Rtr_.y(); return Rtr_.y();
} }
//- Return local Cartesian z-axis //- Return local Cartesian z-axis
const vector& e3() const const vector& e3() const
{ {
return Rtr_.z(); return Rtr_.z();
} }
//- Return axis (e3: local Cartesian z-axis) //- Return axis (e3: local Cartesian z-axis)
// @deprecated method e3 is preferred // @deprecated method e3 is preferred
const vector& axis() const const vector& axis() const
{ {
return Rtr_.z(); return Rtr_.z();
} }
//- Return direction (e1: local Cartesian x-axis) //- Return direction (e1: local Cartesian x-axis)
// @deprecated method e1 is preferred // @deprecated method e1 is preferred
const vector& direction() const const vector& direction() const
{ {
return Rtr_.x(); return Rtr_.x();
} }
//- Return as dictionary of entries //- Return as dictionary of entries
// @param [in] ignoreType drop type (cartesian, cylindrical, etc) // @param [in] ignoreType drop type (cartesian, cylindrical, etc)
// when generating the dictionary // when generating the dictionary
virtual dictionary dict(bool ignoreType=false) const; virtual dictionary dict(bool ignoreType=false) const;
// Edit // Edit
//- Rename //- Rename
virtual void rename(const word& newName) virtual void rename(const word& newName)
{ {
name_ = newName; name_ = newName;
} }
//- Edit access to origin //- Edit access to origin
point& origin() point& origin()
{ {
return origin_; return origin_;
} }
// Write
//- Write // Write
virtual void write(Ostream&) const;
//- Write dictionary //- Write
virtual void writeDict(Ostream&, bool subDict=true) const; virtual void write(Ostream&) const;
// Transformations //- Write dictionary
virtual void writeDict(Ostream&, bool subDict=true) const;
//- Convert from position in local coordinate system to global Cartesian position
point globalPosition(const point& local) const
{
return localToGlobal(local, true);
}
//- Convert from position in local coordinate system to global Cartesian position // Transformations
tmp<pointField> globalPosition(const pointField& local) const
{
return localToGlobal(local, true);
}
//- Convert from vector components in local coordinate system to global Cartesian vector //- Convert from position in local coordinate system to global
vector globalVector(const vector& local) const // Cartesian position
{ point globalPosition(const point& local) const
return localToGlobal(local, false); {
} return localToGlobal(local, true);
}
//- Convert from vector components in local coordinate system to global Cartesian vector //- Convert from position in local coordinate system to global
tmp<vectorField> globalVector(const vectorField& local) const // Cartesian position
{ tmp<pointField> globalPosition(const pointField& local) const
return localToGlobal(local, false); {
} return localToGlobal(local, true);
}
//- Convert from global Cartesian position to position in local coordinate system //- Convert from vector components in local coordinate system to
point localPosition(const point& global) const // global Cartesian vector
{ vector globalVector(const vector& local) const
return globalToLocal(global, true); {
} return localToGlobal(local, false);
}
//- Convert from global Cartesian position to position in local coordinate system //- Convert from vector components in local coordinate system to
tmp<pointField> localPosition(const pointField& global) const // global Cartesian vector
{ tmp<vectorField> globalVector(const vectorField& local) const
return globalToLocal(global, true); {
} return localToGlobal(local, false);
}
//- Convert from global Cartesian vector to components in local coordinate system //- Convert from global Cartesian position to position in local
vector localVector(const vector& global) const // coordinate system
{ point localPosition(const point& global) const
return globalToLocal(global, false); {
} return globalToLocal(global, true);
}
//- Convert from global Cartesian vector to components in local coordinate system //- Convert from global Cartesian position to position in local
tmp<vectorField> localVector(const vectorField& global) const // coordinate system
{ tmp<pointField> localPosition(const pointField& global) const
return globalToLocal(global, false); {
} return globalToLocal(global, true);
}
//- Convert from global Cartesian vector to components in local
// coordinate system
vector localVector(const vector& global) const
{
return globalToLocal(global, false);
}
//- Convert from global Cartesian vector to components in local
// coordinate system
tmp<vectorField> localVector(const vectorField& global) const
{
return globalToLocal(global, false);
}
// Member Operators // Member Operators
@ -467,6 +481,7 @@ public:
const coordinateSystem& const coordinateSystem&
); );
// IOstream Operators // IOstream Operators
friend Ostream& operator<<(Ostream&, const coordinateSystem&); friend Ostream& operator<<(Ostream&, const coordinateSystem&);

View File

@ -121,4 +121,5 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
return New(name, dict); return New(name, dict);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -64,6 +64,7 @@ class coordinateSystems
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const coordinateSystems&); void operator=(const coordinateSystems&);
public: public:
//- Runtime type information //- Runtime type information
@ -88,11 +89,13 @@ public:
const Xfer<PtrList<coordinateSystem> >& const Xfer<PtrList<coordinateSystem> >&
); );
// Selectors // Selectors
//- Return previously registered or read construct from "constant" //- Return previously registered or read construct from "constant"
static const coordinateSystems& New(const objectRegistry&); static const coordinateSystems& New(const objectRegistry&);
// Member Functions // Member Functions
//- Find and return index for a given keyword, returns -1 if not found //- Find and return index for a given keyword, returns -1 if not found

View File

@ -86,6 +86,7 @@ protected:
bool translate bool translate
) const; ) const;
public: public:
//- Runtime type information //- Runtime type information
@ -142,7 +143,6 @@ public:
//- Non-const access to inDegrees //- Non-const access to inDegrees
bool& inDegrees(); bool& inDegrees();
}; };

View File

@ -159,6 +159,7 @@ Foam::vector Foam::parabolicCylindricalCS::globalToLocal
return vector::zero; return vector::zero;
} }
Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::globalToLocal
( (
const vectorField& global, const vectorField& global,

View File

@ -85,6 +85,7 @@ protected:
bool translate bool translate
) const; ) const;
public: public:
//- Runtime type information //- Runtime type information
@ -106,7 +107,6 @@ public:
//- Construct from dictionary //- Construct from dictionary
parabolicCylindricalCS(const word&, const dictionary&); parabolicCylindricalCS(const word&, const dictionary&);
}; };

View File

@ -85,6 +85,7 @@ protected:
bool translate bool translate
) const; ) const;
public: public:
//- Runtime type information //- Runtime type information
@ -141,7 +142,6 @@ public:
//- Non-const access to inDegrees //- Non-const access to inDegrees
bool& inDegrees(); bool& inDegrees();
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -158,8 +158,8 @@ void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
{ {
if (subDict) if (subDict)
{ {
os << indent << name() << nl os << indent << name() << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl; << indent << token::BEGIN_BLOCK << incrIndent << nl;
} }
coordinateSystem::writeDict(os, false); coordinateSystem::writeDict(os, false);
@ -167,8 +167,9 @@ void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
if (subDict) if (subDict)
{ {
os << decrIndent << indent << token::END_BLOCK << endl; os << decrIndent << indent << token::END_BLOCK << endl;
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -46,7 +46,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class toroidalCS Declaration Class toroidalCS Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -86,6 +85,7 @@ class toroidalCS
bool translate bool translate
) const; ) const;
public: public:
//- Runtime type information //- Runtime type information
@ -103,7 +103,6 @@ public:
const scalar radius const scalar radius
); );
//- Construct from dictionary //- Construct from dictionary
toroidalCS(const word& name, const dictionary&); toroidalCS(const word& name, const dictionary&);

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "indexedOctree.H" #include "indexedOctree.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "treeDataPoint.H" #include "treeDataPoint.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "octree.H" #include "octree.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "octreeDataCell.H" #include "octreeDataCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
//#include "octreeDataPointTreeLeaf.H" //#include "octreeDataPointTreeLeaf.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "octree.H" #include "octree.H"

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
IOList of pointIndexHits
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointIndexHitIOList.H" #include "pointIndexHitIOList.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "treeLeaf.H" #include "treeLeaf.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "treeLeaf.H" #include "treeLeaf.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "treeNode.H" #include "treeNode.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "treeNode.H" #include "treeNode.H"

View File

@ -340,9 +340,8 @@ Foam::distributedTriSurfaceMesh::distributeSegments
new mapDistribute new mapDistribute
( (
segmentI, // size after construction segmentI, // size after construction
sendMap, sendMap.xfer(),
constructMap, constructMap.xfer()
true // reuse storage
) )
); );
} }
@ -642,9 +641,8 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
new mapDistribute new mapDistribute
( (
segmentI, // size after construction segmentI, // size after construction
sendMap, sendMap.xfer(),
constructMap, constructMap.xfer()
true // reuse storage
) )
); );
const mapDistribute& map = mapPtr(); const mapDistribute& map = mapPtr();
@ -806,9 +804,8 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
new mapDistribute new mapDistribute
( (
segmentI, // size after construction segmentI, // size after construction
sendMap, sendMap.xfer(),
constructMap, constructMap.xfer()
true // reuse storage
) )
); );
return mapPtr; return mapPtr;
@ -2408,9 +2405,8 @@ void Foam::distributedTriSurfaceMesh::distribute
new mapDistribute new mapDistribute
( (
allTris.size(), allTris.size(),
faceSendMap, faceSendMap.xfer(),
faceConstructMap, faceConstructMap.xfer()
true
) )
); );
pointMap.reset pointMap.reset
@ -2418,9 +2414,8 @@ void Foam::distributedTriSurfaceMesh::distribute
new mapDistribute new mapDistribute
( (
allPoints.size(), allPoints.size(),
pointSendMap, pointSendMap.xfer(),
pointConstructMap, pointConstructMap.xfer()
true
) )
); );

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "boxToCell.H" #include "boxToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellToCell.H" #include "cellToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceToCell.H" #include "faceToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fieldToCell.H" #include "fieldToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "nearestToCell.H" #include "nearestToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointToCell.H" #include "pointToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rotatedBoxToCell.H" #include "rotatedBoxToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "shapeToCell.H" #include "shapeToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "surfaceToCell.H" #include "surfaceToCell.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "boundaryToFace.H" #include "boundaryToFace.H"

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