Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2017-05-26 08:29:09 -07:00
267 changed files with 3888 additions and 1841 deletions

View File

@ -120,11 +120,14 @@ int main(int argc, char *argv[])
"cSf_pos",
interpolate(c, pos, T.name())*mesh.magSf()
);
cSf_pos.setOriented();
surfaceScalarField cSf_neg
(
"cSf_neg",
interpolate(c, neg, T.name())*mesh.magSf()
);
cSf_neg.setOriented();
surfaceScalarField ap
(
@ -269,4 +272,5 @@ int main(int argc, char *argv[])
return 0;
}
// ************************************************************************* //

View File

@ -101,11 +101,14 @@ int main(int argc, char *argv[])
"cSf_pos",
interpolate(c, pos, T.name())*mesh.magSf()
);
cSf_pos.setOriented();
surfaceScalarField cSf_neg
(
"cSf_neg",
interpolate(c, neg, T.name())*mesh.magSf()
);
cSf_neg.setOriented();
surfaceScalarField ap
(

View File

@ -138,9 +138,7 @@ public:
>> m.orientation_;
is.readEnd("magnet");
// Check state of Istream
is.check("operator>>(Istream&, magnet&)");
is.check(FUNCTION_NAME);
return is;
}

View File

@ -38,7 +38,6 @@ Description
#include "basicReactingMultiphaseCloud.H"
#include "rhoCombustionModel.H"
#include "radiationModel.H"
#include "IOporosityModelList.H"
#include "fvOptions.H"
#include "SLGThermo.H"
#include "simpleControl.H"

View File

@ -113,6 +113,7 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
1e-8/pow(average(mesh_.V()), 1.0/3.0)
)
{
rhoPhi_.setOriented();
calcAlphas();
alphas_.write();
correct();
@ -698,6 +699,7 @@ Foam::multiphaseMixtureThermo::surfaceTensionForce() const
);
surfaceScalarField& stf = tstf.ref();
stf.setOriented();
forAllConstIter(PtrDictionary<phaseModel>, phases_, phase1)
{

View File

@ -801,6 +801,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::surfaceTension
)
)
);
tSurfaceTension.ref().setOriented();
forAllConstIter(PtrDictionary<phaseModel>, phases_, iter)
{

View File

@ -113,6 +113,8 @@ Foam::phaseModel::phaseModel
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
)
{
alphaPhi_.setOriented();
const word phiName = IOobject::groupName("phi", name_);
IOobject phiHeader

View File

@ -128,6 +128,8 @@ Foam::multiphaseMixture::multiphaseMixture
1e-8/pow(average(mesh_.V()), 1.0/3.0)
)
{
rhoPhi_.setOriented();
calcAlphas();
alphas_.write();
}
@ -273,6 +275,7 @@ Foam::multiphaseMixture::surfaceTensionForce() const
);
surfaceScalarField& stf = tstf.ref();
stf.setOriented();
forAllConstIter(PtrDictionary<phase>, phases_, iter1)
{

View File

@ -455,6 +455,7 @@ Foam::BlendedInterfacialModel<ModelType>::Ff() const
dimensionedScalar("zero", ModelType::dimF*dimArea, 0)
)
);
x.ref().setOriented();
if (model_.valid())
{

View File

@ -347,7 +347,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Ff
}
else
{
return tmp<surfaceScalarField>
tmp<surfaceScalarField> tFf
(
new surfaceScalarField
(
@ -364,6 +364,10 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Ff
dimensionedScalar("zero", liftModel::dimF*dimArea, 0)
)
);
tFf.ref().setOriented();
return tFf;
}
}
@ -621,6 +625,8 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::setPhiD
)
)
);
phiDs[phasei].setOriented();
}
return phiDs[phasei];

View File

@ -200,6 +200,9 @@ Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
dimensionedScalar("0", dimDensity/dimTime, 0)
)
{
alphaPhi_.setOriented();
alphaRhoPhi_.setOriented();
phi_.writeOpt() = IOobject::AUTO_WRITE;
correctKinematics();
}

View File

@ -548,6 +548,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::surfaceTension
)
);
tSurfaceTension.ref().setOriented();
forAll(phases(), phasej)
{
const phaseModel& phase2 = phases()[phasej];

View File

@ -109,6 +109,9 @@ Foam::phaseModel::phaseModel
dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0)
)
{
alphaPhi_.setOriented();
alphaRhoPhi_.setOriented();
thermo_->validate("phaseModel " + name_, "h", "e");
const word phiName = IOobject::groupName("phi", name_);

View File

@ -66,6 +66,9 @@ int main(int argc, char *argv[])
const List<namedEnumTest::option> options
= namedEnumTest::namedEnum.enums();
dictionary testDict;
testDict.add("lookup1", "c");
Info<< "enums: " << options << nl;
Info<< "loop over enums (as list):" << nl;
@ -88,6 +91,30 @@ int main(int argc, char *argv[])
<< namedEnumTest::namedEnum["a"] << nl
<< namedEnumTest::namedEnum[namedEnumTest::a] << nl;
Info<< "--- test dictionary lookup ---" << endl;
{
Info<< "dict: " << testDict << endl;
namedEnumTest::option gotOpt =
namedEnumTest::namedEnum.lookupOrDefault
(
"test",
testDict,
namedEnumTest::option::a
);
Info<< "got: " << gotOpt << endl;
gotOpt = namedEnumTest::namedEnum.lookupOrDefault
(
"lookup1",
testDict,
namedEnumTest::option::a
);
Info<< "got: " << gotOpt << endl;
}
Info<< "--- test read construction ---" << endl;
namedEnumTest::option dummy(namedEnumTest::namedEnum.read(Sin));

View File

@ -0,0 +1,3 @@
Test-mapDistributePolyMesh.C
EXE = $(FOAM_USER_APPBIN)/Test-mapDistributePolyMesh

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
mapDistributePolyMesh
Description
Test for procAddressing
\*---------------------------------------------------------------------------*/
#include "IOmapDistributePolyMesh.H"
#include "argList.H"
#include "Time.H"
#include "surfaceFields.H"
#include "flipOp.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
Info<< "Reading distribute map\n" << endl;
const word instance("0.005");
const scalar instanceValue(0.005);
IOobject io
(
"procAddressing",
instance,
fvMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
IOmapDistributePolyMesh map(io);
{
// Load the instance mesh
runTime.setTime(instanceValue, 0);
polyMesh distributedMesh
(
IOobject
(
polyMesh::defaultRegion,
instance,
runTime,
IOobject::MUST_READ
)
);
// Faces, no flip
{
const mapDistribute& faceMap = map.faceMap();
pointField fc(mesh.faceCentres());
faceMap.distribute(fc, noOp());
Pout<< "Construct size:" << faceMap.constructSize() << endl;
forAll(distributedMesh.faceCentres(), facei)
{
Pout<< "face:" << facei
<< "\tmappedFc:" << fc[facei]
<< "\tactual:" << distributedMesh.faceCentres()[facei]
<< endl;
}
}
// Faces, flipped field
{
const mapDistribute& faceMap = map.faceMap();
scalarField flux(mesh.faceAreas() & vector(1, 1, 1));
faceMap.distribute(flux, flipOp());
Pout<< "Construct size:" << faceMap.constructSize() << endl;
const scalarField newFlux
(
distributedMesh.faceAreas()
& vector(1, 1, 1)
);
forAll(newFlux, facei)
{
Pout<< "face:" << facei
<< "\tmappedFlux:" << flux[facei]
<< "\tactual:" << newFlux[facei]
<< endl;
}
}
{
const mapDistribute& cellMap = map.cellMap();
pointField cc(mesh.cellCentres());
cellMap.distribute(cc, noOp());
Pout<< "Construct size:" << cellMap.constructSize() << endl;
forAll(distributedMesh.cellCentres(), celli)
{
Pout<< "cell:" << celli
<< "\tmappedCc:" << cc[celli]
<< "\tactual:" << distributedMesh.cellCentres()[celli]
<< endl;
}
}
{
const mapDistribute& pointMap = map.pointMap();
pointField pc(mesh.points());
pointMap.distribute(pc, noOp());
Pout<< "Construct size:" << pointMap.constructSize() << endl;
forAll(distributedMesh.points(), pointi)
{
Pout<< "point:" << pointi
<< "\tmappedPoint:" << pc[pointi]
<< "\tactual:" << distributedMesh.points()[pointi]
<< endl;
}
}
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (1 1 0);
boundaryField
{
movingWall
{
type fixedValue;
value uniform (1 0 0);
}
fixedWalls
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
movingWall
{
type zeroGradient;
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,228 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus.feature-oriented-fields |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0";
object fluxU;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
oriented 1;
internalField nonuniform List<scalar>
180
(
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
0.0001
)
;
boundaryField
{
movingWall
{
type calculated;
value uniform 0;
}
fixedWalls
{
type calculated;
value uniform 0;
}
frontAndBack
{
type empty;
value nonuniform 0();
}
}
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
# Restore default dictionaries
cp system/decomposeParDict-2 system/decomposeParDict
cp system/controlDict-startTime system/controlDict
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication decomposePar -decomposeParDict system/decomposeParDict-2
runParallel -s scotch -np 5 redistributePar \
-decomposeParDict system/decomposeParDict-5
runParallel -np 5 Test-mapDistributePolyMesh \
-decomposeParDict system/decomposeParDict-5
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu nu [ 0 2 -1 0 0 0 0 ] 0.01;
// ************************************************************************* //

View File

@ -0,0 +1,75 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
movingWall
{
type wall;
faces
(
(3 7 6 2)
);
}
fixedWalls
{
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 1.0;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
//preservePatches (cyclic_half0 cyclic_half1);
//- Keep all of faceSet on a single processor. This puts all cells
// connected with a point, edge or face on the same processor.
// (just having face connected cells might not guarantee a balanced
// decomposition)
// The processor can be -1 (the decompositionMethod chooses the processor
// for a good load balance) or explicitly provided (upsets balance).
//singleProcessorFaceSets ((f0 -1));
//- Keep owner and neighbour of baffles on same processor (i.e. keep it
// detectable as a baffle). Baffles are two boundary face sharing the
// same points.
//preserveBaffles true;
//- Use the volScalarField named here as a weight for each cell in the
// decomposition. For example, use a particle population field to decompose
// for a balanced number of particles in a lagrangian simulation.
// weightField dsmcRhoNMean;
method scotch;
//method hierarchical;
// method simple;
// method metis;
// method manual;
// method multiLevel;
// method structured; // does 2D decomposition of structured mesh
multiLevelCoeffs
{
// Decomposition methods to apply in turn. This is like hierarchical but
// fully general - every method can be used at every level.
level0
{
numberOfSubdomains 64;
//method simple;
//simpleCoeffs
//{
// n (2 1 1);
// delta 0.001;
//}
method scotch;
}
level1
{
numberOfSubdomains 4;
method scotch;
}
}
// Desired output
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 2 1);
delta 0.001;
order xyz;
}
metisCoeffs
{
/*
processorWeights
(
1
1
1
1
);
*/
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
structuredCoeffs
{
// Patches to do 2D decomposition on. Structured mesh only; cells have
// to be in 'columns' on top of patches.
patches (movingWall);
// Method to use on the 2D subset
method scotch;
}
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
//preservePatches (cyclic_half0 cyclic_half1);
//- Keep all of faceSet on a single processor. This puts all cells
// connected with a point, edge or face on the same processor.
// (just having face connected cells might not guarantee a balanced
// decomposition)
// The processor can be -1 (the decompositionMethod chooses the processor
// for a good load balance) or explicitly provided (upsets balance).
//singleProcessorFaceSets ((f0 -1));
//- Keep owner and neighbour of baffles on same processor (i.e. keep it
// detectable as a baffle). Baffles are two boundary face sharing the
// same points.
//preserveBaffles true;
//- Use the volScalarField named here as a weight for each cell in the
// decomposition. For example, use a particle population field to decompose
// for a balanced number of particles in a lagrangian simulation.
// weightField dsmcRhoNMean;
method scotch;
//method hierarchical;
// method simple;
// method metis;
// method manual;
// method multiLevel;
// method structured; // does 2D decomposition of structured mesh
multiLevelCoeffs
{
// Decomposition methods to apply in turn. This is like hierarchical but
// fully general - every method can be used at every level.
level0
{
numberOfSubdomains 64;
//method simple;
//simpleCoeffs
//{
// n (2 1 1);
// delta 0.001;
//}
method scotch;
}
level1
{
numberOfSubdomains 4;
method scotch;
}
}
// Desired output
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 2 1);
delta 0.001;
order xyz;
}
metisCoeffs
{
/*
processorWeights
(
1
1
1
1
);
*/
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
structuredCoeffs
{
// Patches to do 2D decomposition on. Structured mesh only; cells have
// to be in 'columns' on top of patches.
patches (movingWall);
// Method to use on the 2D subset
method scotch;
}
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 5;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
//preservePatches (cyclic_half0 cyclic_half1);
//- Keep all of faceSet on a single processor. This puts all cells
// connected with a point, edge or face on the same processor.
// (just having face connected cells might not guarantee a balanced
// decomposition)
// The processor can be -1 (the decompositionMethod chooses the processor
// for a good load balance) or explicitly provided (upsets balance).
//singleProcessorFaceSets ((f0 -1));
//- Keep owner and neighbour of baffles on same processor (i.e. keep it
// detectable as a baffle). Baffles are two boundary face sharing the
// same points.
//preserveBaffles true;
//- Use the volScalarField named here as a weight for each cell in the
// decomposition. For example, use a particle population field to decompose
// for a balanced number of particles in a lagrangian simulation.
// weightField dsmcRhoNMean;
method scotch;
//method hierarchical;
// method simple;
// method metis;
// method manual;
// method multiLevel;
// method structured; // does 2D decomposition of structured mesh
multiLevelCoeffs
{
// Decomposition methods to apply in turn. This is like hierarchical but
// fully general - every method can be used at every level.
level0
{
numberOfSubdomains 64;
//method simple;
//simpleCoeffs
//{
// n (2 1 1);
// delta 0.001;
//}
method scotch;
}
level1
{
numberOfSubdomains 4;
method scotch;
}
}
// Desired output
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 2 1);
delta 0.001;
order xyz;
}
metisCoeffs
{
/*
processorWeights
(
1
1
1
1
);
*/
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
structuredCoeffs
{
// Patches to do 2D decomposition on. Structured mesh only; cells have
// to be in 'columns' on top of patches.
patches (movingWall);
// Method to use on the 2D subset
method scotch;
}
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method hierarchical;
hierarchicalCoeffs
{
n (1 2 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh decomposition control dictionary";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
//method scotch;
method hierarchical;
hierarchicalCoeffs
{
n (2 1 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"(p|pFinal)"
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object postProcessingDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
functions
{
processorField
{
// Type of functionObject
type processorField;
// Where to load it from (if not already in solver)
libs ("libfieldFunctionObjects.so");
// Function object enabled flag
enabled true;
// When to output the average fields
writeControl writeTime;
}
cellID
{
// Load the library containing the 'coded' functionObject
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
// Name of on-the-fly generated functionObject
redirectType cellID;
codeExecute
#{
volScalarField cellID
(
IOobject
(
"cellID",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ
),
mesh(),
dimensionedScalar("cellID", dimless, 0)
);
forAll(cellID, celli)
{
cellID[celli] = celli;
}
cellID.correctBoundaryConditions();
cellID.write();
#};
}
}
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
note "mesh renumbering dictionary";
object renumberMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Write maps from renumbered back to original mesh
writeMaps true;
// Optional entry: sort cells on coupled boundaries to last for use with
// e.g. nonBlockingGaussSeidel.
sortCoupledFaceCells false;
// Optional entry: renumber on a block-by-block basis. It uses a
// blockCoeffs dictionary to construct a decompositionMethod to do
// a block subdivision) and then applies the renumberMethod to each
// block in turn. This can be used in large cases to keep the blocks
// fitting in cache with all the the cache misses bunched at the end.
// This number is the approximate size of the blocks - this gets converted
// to a number of blocks that is the input to the decomposition method.
//blockSize 1000;
// Optional entry: sort points into internal and boundary points
//orderPoints false;
// Optional: suppress renumbering cellSets,faceSets,pointSets
//renumberSets false;
//method CuthillMcKee;
//method Sloan;
//method manual;
method random;
//method structured;
//method spring;
//method zoltan; // only if compiled with zoltan support
//CuthillMcKeeCoeffs
//{
// // Reverse CuthillMcKee (RCM) or plain
// reverse true;
//}
manualCoeffs
{
// In system directory: new-to-original (i.e. order) labelIOList
dataFile "cellMap";
}
// For extruded (i.e. structured in one direction) meshes
structuredCoeffs
{
// Patches that mesh was extruded from. These determine the starting
// layer of cells
patches (movingWall);
// Method to renumber the starting layer of cells
method random;
// Renumber in columns (depthFirst) or in layers
depthFirst true;
// Reverse ordering
reverse false;
}
springCoeffs
{
// Maximum jump of cell indices. Is fraction of number of cells
maxCo 0.01;
// Limit the amount of movement; the fraction maxCo gets decreased
// with every iteration
freezeFraction 0.999;
// Maximum number of iterations
maxIter 1000;
}
blockCoeffs
{
method scotch;
//method hierarchical;
//hierarchicalCoeffs
//{
// n (1 2 1);
// delta 0.001;
// order xyz;
//}
}
zoltanCoeffs
{
ORDER_METHOD LOCAL_HSFC;
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
IOobject::NO_WRITE
);
return tmp<DimensionedField<Type, volMesh>>
tmp<DimensionedField<Type, volMesh>> tfield
(
new DimensionedField<Type, volMesh>
(
@ -76,6 +76,10 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
internalField
)
);
tfield.ref().oriented() = fld.oriented();
return tfield;
}
@ -209,7 +213,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
IOobject::NO_WRITE
);
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tfield
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -220,6 +224,10 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
basePatchFields
)
);
tfield.ref().oriented()= fld.oriented();
return tfield;
}
@ -269,7 +277,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
}
// Map all faces
Field<Type> internalField(flatFld, mapper);
Field<Type> internalField(flatFld, mapper, fld.oriented()());
// Trim to internal faces (note: could also have special mapper)
internalField.setSize
@ -372,7 +380,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
IOobject::NO_WRITE
);
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfield
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
@ -383,6 +391,10 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
basePatchFields
)
);
tfield.ref().oriented() = fld.oriented();
return tfield;
}

View File

@ -341,6 +341,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
const bool decomposePoly = !args.optionFound("poly");
const bool doWriteInternal = !args.optionFound("noInternal");
const bool doFaceZones = !args.optionFound("noFaceZones");
const bool doLinks = !args.optionFound("noLinks");
@ -349,7 +350,7 @@ int main(int argc, char *argv[])
const bool noLagrangian = args.optionFound("noLagrangian");
// Decomposition of polyhedral cells into tets/pyramids cells
vtkTopo::decomposePoly = !args.optionFound("poly");
vtkTopo::decomposePoly = decomposePoly;
if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
{
@ -410,8 +411,6 @@ int main(int argc, char *argv[])
args.optionReadIfPresent("pointSet", pointSetName);
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H"
// VTK/ directory in the case
@ -449,6 +448,9 @@ int main(int argc, char *argv[])
mkDir(fvPath);
instantList timeDirs = timeSelector::select0(runTime, args);
// Mesh wrapper: does subsetting and decomposition
vtkMesh vMesh(mesh, cellSetName);
@ -492,7 +494,7 @@ int main(int argc, char *argv[])
// Filename as if patch with same name.
mkDir(fvPath/set.name());
fileName patchFileName
fileName outputName
(
fvPath/set.name()/set.name()
+ "_"
@ -500,12 +502,12 @@ int main(int argc, char *argv[])
+ ".vtk"
);
Info<< " FaceSet : " << patchFileName << endl;
writeFaceSet(binary, vMesh.mesh(), set, patchFileName);
Info<< " faceSet : " << outputName << endl;
writeFaceSet(binary, vMesh.mesh(), set, outputName);
continue;
}
// If pointSet: write pointSet only (as polydata)
if (pointSetName.size())
{
@ -515,7 +517,7 @@ int main(int argc, char *argv[])
// Filename as if patch with same name.
mkDir(fvPath/set.name());
fileName patchFileName
fileName outputName
(
fvPath/set.name()/set.name()
+ "_"
@ -523,10 +525,9 @@ int main(int argc, char *argv[])
+ ".vtk"
);
Info<< " pointSet : " << patchFileName << endl;
writePointSet(binary, vMesh.mesh(), set, patchFileName);
Info<< " pointSet : " << outputName << endl;
writePointSet(binary, vMesh.mesh(), set, outputName);
continue;
}
@ -868,11 +869,11 @@ int main(int argc, char *argv[])
{
mkDir(fvPath/"allPatches");
fileName patchFileName;
fileName outputName;
if (vMesh.useSubMesh())
{
patchFileName =
outputName =
fvPath/"allPatches"/cellSetName
+ "_"
+ timeDesc
@ -880,21 +881,21 @@ int main(int argc, char *argv[])
}
else
{
patchFileName =
outputName =
fvPath/"allPatches"/"allPatches"
+ "_"
+ timeDesc
+ ".vtk";
}
Info<< " Combined patches : " << patchFileName << endl;
Info<< " Combined patches : " << outputName << endl;
patchWriter writer
(
vMesh.mesh(),
binary,
nearCellValue,
patchFileName,
outputName,
getSelectedPatches(patches, excludePatches)
);
@ -946,11 +947,11 @@ int main(int argc, char *argv[])
{
mkDir(fvPath/pp.name());
fileName patchFileName;
fileName outputName;
if (vMesh.useSubMesh())
{
patchFileName =
outputName =
fvPath/pp.name()/cellSetName
+ "_"
+ timeDesc
@ -958,22 +959,22 @@ int main(int argc, char *argv[])
}
else
{
patchFileName =
outputName =
fvPath/pp.name()/pp.name()
+ "_"
+ timeDesc
+ ".vtk";
}
Info<< " Patch : " << patchFileName << endl;
Info<< " Patch : " << outputName << endl;
patchWriter writer
(
vMesh.mesh(),
binary,
nearCellValue,
patchFileName,
labelList(1, patchi)
outputName,
labelList{patchi}
);
if (!isA<emptyPolyPatch>(pp))
@ -1068,11 +1069,11 @@ int main(int argc, char *argv[])
mkDir(fvPath/fz.name());
fileName patchFileName;
fileName outputName;
if (vMesh.useSubMesh())
{
patchFileName =
outputName =
fvPath/fz.name()/cellSetName
+ "_"
+ timeDesc
@ -1080,14 +1081,14 @@ int main(int argc, char *argv[])
}
else
{
patchFileName =
outputName =
fvPath/fz.name()/fz.name()
+ "_"
+ timeDesc
+ ".vtk";
}
Info<< " FaceZone : " << patchFileName << endl;
Info<< " FaceZone : " << outputName << endl;
indirectPrimitivePatch pp
(
@ -1100,7 +1101,7 @@ int main(int argc, char *argv[])
binary,
pp,
fz.name(),
patchFileName
outputName
);
// Number of fields
@ -1131,14 +1132,13 @@ int main(int argc, char *argv[])
// Always create the cloud directory.
mkDir(fvPath/cloud::prefix/cloudName);
fileName lagrFileName
fileName outputName
(
fvPath/cloud::prefix/cloudName/cloudName
+ "_" + timeDesc + ".vtk"
);
Info<< " Lagrangian: " << lagrFileName << endl;
Info<< " Lagrangian: " << outputName << endl;
IOobjectList sprayObjs
(
@ -1189,7 +1189,7 @@ int main(int argc, char *argv[])
(
vMesh.mesh(),
binary,
lagrFileName,
outputName,
cloudName,
false
);
@ -1219,7 +1219,7 @@ int main(int argc, char *argv[])
(
vMesh.mesh(),
binary,
lagrFileName,
outputName,
cloudName,
true
);

View File

@ -104,6 +104,7 @@ public:
//- Append elements to DynamicList
static void insert(const labelList&, DynamicList<label>&);
template<class Type>
static void insert(const List<Type>&, DynamicList<floatScalar>&);
@ -140,36 +141,6 @@ public:
const vtkMesh&
);
//- Write generic GeometricFields
template<class Type, template<class> class PatchField, class GeoMesh>
static void write
(
std::ostream&,
const bool binary,
const PtrList<GeometricField<Type, PatchField, GeoMesh>>&,
const vtkMesh&
);
//- Write generic dimensioned internal fields
template<class Type>
static void write
(
std::ostream&,
const bool binary,
const PtrList<DimensionedField<Type, volMesh>>&,
const vtkMesh&
);
//- Interpolate and write volFields
template<class Type>
static void write
(
std::ostream&,
const bool binary,
const volPointInterpolation&,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&,
const vtkMesh&
);
};

View File

@ -43,22 +43,6 @@ void Foam::writeFuns::insert
}
//// Store List (indexed through map) in dest
//template<class Type>
//void Foam::writeFuns::insert
//(
// const labelList& map,
// const List<Type>& source,
// DynamicList<floatScalar>& dest
//)
//{
// forAll(map, i)
// {
// insert(source[map[i]], dest);
// }
//}
template<class Type>
void Foam::writeFuns::write
(
@ -159,53 +143,4 @@ void Foam::writeFuns::write
}
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::writeFuns::write
(
std::ostream& os,
const bool binary,
const PtrList<GeometricField<Type, PatchField, GeoMesh>>& flds,
const vtkMesh& vMesh
)
{
forAll(flds, i)
{
write(os, binary, flds[i].dimensionedInternalField(), vMesh);
}
}
template<class Type>
void Foam::writeFuns::write
(
std::ostream& os,
const bool binary,
const PtrList<DimensionedField<Type, volMesh>>& flds,
const vtkMesh& vMesh
)
{
forAll(flds, i)
{
write(os, binary, flds[i], vMesh);
}
}
template<class Type>
void Foam::writeFuns::write
(
std::ostream& os,
const bool binary,
const volPointInterpolation& pInterp,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& flds,
const vtkMesh& vMesh
)
{
forAll(flds, i)
{
write(os, binary, flds[i], pInterp.interpolate(flds[i])(), vMesh);
}
}
// ************************************************************************* //

View File

@ -35,8 +35,7 @@ Foam::CLASSNAME::CLASSNAME(Istream& is)
member1(is),
member2(is)
{
// Check state of Istream
is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)");
is.check(FUNCTION_NAME);
}
@ -44,25 +43,14 @@ Foam::CLASSNAME::CLASSNAME(Istream& is)
Foam::Istream& Foam::operator>>(Istream& is, CLASSNAME&)
{
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CLASSNAME&)"
);
is.check(FUNCTION_NAME);
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const CLASSNAME&)
{
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
"const Foam::CLASSNAME&)"
);
os.check(FUNCTION_NAME);
return os;
}

View File

@ -36,8 +36,7 @@ Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Istream& is)
member1(is),
member2(is)
{
// Check state of Istream
is.check("Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Foam::Istream&)");
is.check(FUNCTION_NAME);
}
@ -50,13 +49,7 @@ Foam::Istream& Foam::operator>>
CLASSNAME<TemplateArgument>&
)
{
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::CLASSNAME<TemplateArgument>&)"
);
is.check(FUNCTION_NAME);
return is;
}
@ -68,13 +61,7 @@ Foam::Ostream& Foam::operator<<
const CLASSNAME<TemplateArgument>&
)
{
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<"
"(Ostream&, const CLASSNAME<TemplateArgument>&)"
);
os.check(FUNCTION_NAME);
return os;
}

View File

@ -43,7 +43,7 @@ setenv WM_PROJECT_VERSION plus
# values to an appropriate path.
#
setenv FOAM_INST_DIR `lsof +p $$ |& \
sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc@@p'`
sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc.*@@p'`
# setenv FOAM_INST_DIR $HOME/$WM_PROJECT
# setenv FOAM_INST_DIR /opt/$WM_PROJECT
# setenv FOAM_INST_DIR /usr/local/$WM_PROJECT

View File

@ -770,7 +770,7 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
// If dest is a directory, create the destination file name.
if (destFile.type() == fileName::DIRECTORY)
{
destFile = destFile/src.component(src.components().size() -1);
destFile = destFile/src.components().last();
}
// Make sure the destination directory exists.

View File

@ -123,9 +123,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat)
fStat.status_.st_mtime = stat[11];
fStat.status_.st_ctime = stat[12];
// Check state of Istream
is.check("Istream& operator>>(Istream&, fileStat&)");
is.check(FUNCTION_NAME);
return is;
}

View File

@ -118,12 +118,7 @@ Foam::Istream& Foam::operator>>(Istream& is, memInfo& m)
is.readEnd("memInfo");
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::memInfo&)"
);
is.check(FUNCTION_NAME);
return is;
}
@ -136,12 +131,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const memInfo& m)
<< m.rss_
<< token::END_LIST;
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::memInfo&)"
);
os.check(FUNCTION_NAME);
return os;
}

View File

@ -275,6 +275,8 @@ dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C
dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C
dimensionedTypes/dimensionedTensor/dimensionedTensor.C
orientedType/orientedType.C
matrices/solution/solution.C
scalarMatrices = matrices/scalarMatrices

View File

@ -61,9 +61,7 @@ Foam::Istream& Foam::operator>>(Istream& is, volumeType& vt)
// Read end of volumeType
is.readEnd("volumeType");
// Check state of Istream
is.check("operator>>(Istream&, volumeType&)");
is.check(FUNCTION_NAME);
return is;
}

View File

@ -74,7 +74,7 @@ Foam::HashTable<T, Key, Hash>::HashTable(const label size)
{
table_ = new hashedEntry*[tableSize_];
for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++)
for (label hashIdx = 0; hashIdx < tableSize_; ++hashIdx)
{
table_[hashIdx] = nullptr;
}
@ -203,6 +203,17 @@ Foam::HashTable<T, Key, Hash>::find
(
const Key& key
) const
{
return this->cfind(key);
}
template<class T, class Key, class Hash>
typename Foam::HashTable<T, Key, Hash>::const_iterator
Foam::HashTable<T, Key, Hash>::cfind
(
const Key& key
) const
{
if (nElmts_)
{
@ -912,7 +923,7 @@ bool Foam::HashTable<T, Key, Hash>::operator==
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
{
const_iterator other = find(iter.key());
const_iterator other = this->cfind(iter.key());
if (!other.found() || other.object() != iter.object())
{

View File

@ -327,6 +327,10 @@ public:
// If not found iterator = end()
const_iterator find(const Key& key) const;
//- Find and return an const_iterator set at the hashed entry
// If not found iterator = end()
const_iterator cfind(const Key& key) const;
//- Return hashed entry if it exists, or return the given default
inline const T& lookup(const Key& key, const T& deflt) const;

View File

@ -129,9 +129,7 @@ Foam::Ostream& Foam::HashTable<T, Key, Hash>::writeKeys
os << token::END_LIST << nl; // End delimiter
}
// Check state of IOstream
os.check(FUNCTION_NAME);
return os;
}
@ -145,12 +143,12 @@ Foam::Istream& Foam::operator>>
HashTable<T, Key, Hash>& L
)
{
is.fatalCheck("operator>>(Istream&, HashTable<T, Key, Hash>&)");
is.fatalCheck(FUNCTION_NAME);
// Anull list
L.clear();
is.fatalCheck("operator>>(Istream&, HashTable<T, Key, Hash>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
@ -251,7 +249,7 @@ Foam::Istream& Foam::operator>>
<< exit(FatalIOError);
}
is.fatalCheck("operator>>(Istream&, HashTable<T, Key, Hash>&)");
is.fatalCheck(FUNCTION_NAME);
return is;
}
@ -278,9 +276,7 @@ Foam::Ostream& Foam::operator<<
// Write end delimiter
os << token::END_LIST;
// Check state of IOstream
os.check(FUNCTION_NAME);
return os;
}

View File

@ -158,6 +158,17 @@ Foam::StaticHashTable<T, Key, Hash>::find
(
const Key& key
) const
{
return this->cfind(key);
}
template<class T, class Key, class Hash>
typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
Foam::StaticHashTable<T, Key, Hash>::cfind
(
const Key& key
) const
{
if (nElmts_)
{

View File

@ -203,6 +203,10 @@ public:
// If not found iterator = end()
const_iterator find(const Key& key) const;
//- Find and return an const_iterator set at the hashed entry
// If not found iterator = end()
const_iterator cfind(const Key& key) const;
//- Return the table of contents
List<Key> toc() const;

View File

@ -94,12 +94,12 @@ Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const
template<class T, class Key, class Hash>
Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
{
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
is.fatalCheck(FUNCTION_NAME);
// Anull list
L.clear();
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
@ -200,7 +200,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
<< exit(FatalIOError);
}
is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
is.fatalCheck(FUNCTION_NAME);
return is;
}
@ -229,9 +229,7 @@ Foam::Ostream& Foam::operator<<
// Write end delimiter
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const StaticHashTable&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -125,9 +125,7 @@ inline Foam::Istream& Foam::operator>>(Istream& is, Keyed<T>& item)
// Read end of Keyed item/key pair
is.readEnd("Keyed<T>");
// Check state of Ostream
is.check("Istream& operator>>(Istream&, Keyed&)");
is.check(FUNCTION_NAME);
return is;
}

View File

@ -33,7 +33,7 @@ template<class LListBase, class T>
template<class INew>
void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
{
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
@ -97,7 +97,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
}
token lastToken(is);
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
while
(
@ -111,7 +111,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
this->append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
}
}
else
@ -122,7 +122,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
<< exit(FatalIOError);
}
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
}

View File

@ -44,7 +44,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
// Anull list
L.clear();
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
@ -98,7 +98,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
}
token lastToken(is);
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
while
(
@ -114,7 +114,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
L.append(element);
is >> lastToken;
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
is.fatalCheck(FUNCTION_NAME);
}
}
else
@ -126,7 +126,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
}
// Check state of IOstream
is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
is.fatalCheck(FUNCTION_NAME);
return is;
}
@ -152,9 +152,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const LList<LListBase, T>& lst)
// Write end of contents
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -34,10 +34,7 @@ template<class LListBase, class T>
template<class INew>
void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
{
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&)"
);
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
@ -102,7 +99,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
}
token lastToken(is);
is.fatalCheck("LPtrList<LListBase, T>::read(Istream&, const INew&)");
is.fatalCheck(FUNCTION_NAME);
while
(
@ -116,10 +113,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
this->append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&)"
);
is.fatalCheck(FUNCTION_NAME);
}
}
else
@ -132,7 +126,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
<< exit(FatalIOError);
}
is.fatalCheck("LPtrList<LListBase, T>::read(Istream&, const INew&)");
is.fatalCheck(FUNCTION_NAME);
}
@ -190,9 +184,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const LPtrList<LListBase, T>& lst)
// Write end of contents
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -52,9 +52,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const UILList<LListBase, T>& lst)
// Write end of contents
os << token::END_LIST;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -591,9 +591,7 @@ Foam::Istream& Foam::operator>>
>> d.binWidth_
>> d.listStarts_;
// Check state of Istream
is.check("Istream& operator>>(Istream&, Distribution<Type>&)");
is.check(FUNCTION_NAME);
return is;
}
@ -609,9 +607,7 @@ Foam::Ostream& Foam::operator<<
<< d.binWidth_ << token::SPACE
<< d.listStarts_;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, " "const Distribution&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -139,9 +139,7 @@ Foam::Ostream& Foam::FixedList<T, Size>::writeList
os.write(reinterpret_cast<const char*>(L.cdata()), Size*sizeof(T));
}
// Check state of IOstream
os.check("const FixedList::writeList(Ostream&)");
os.check(FUNCTION_NAME);
return os;
}
@ -158,7 +156,7 @@ Foam::FixedList<T, Size>::FixedList(Istream& is)
template<class T, unsigned Size>
Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
{
is.fatalCheck("operator>>(Istream&, FixedList<T, Size>&)");
is.fatalCheck(FUNCTION_NAME);
if (is.format() == IOstream::ASCII || !contiguous<T>())
{

View File

@ -46,11 +46,11 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
// Anull list
L.setSize(0);
is.fatalCheck("operator>>(Istream&, List<T>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
is.fatalCheck("operator>>(Istream&, List<T>&) : reading first token");
is.fatalCheck(FUNCTION_NAME);
if (firstToken.isCompound())
{

View File

@ -171,17 +171,26 @@ labelList invert(const label len, const labelUList& map);
labelListList invertOneToMany(const label len, const labelUList& map);
//- Invert many-to-many.
// Input and output types need to be inherited from List.
// eg, faces to pointFaces.
template<class InList, class OutList>
void invertManyToMany(const label len, const UList<InList>&, List<OutList>&);
// Input and output types must be inherited from List and also
// contain ints/labels. Used, for example, for faces to pointFaces.
template<class InputIntListType, class OutputIntListType>
void invertManyToMany
(
const label len,
const UList<InputIntListType>& input,
List<OutputIntListType>& output
);
template<class InList, class OutList>
List<OutList> invertManyToMany(const label len, const UList<InList>& in)
template<class InputIntListType, class OutputIntListType>
List<OutputIntListType> invertManyToMany
(
const label len,
const UList<InputIntListType>& input
)
{
List<OutList> out;
invertManyToMany<InList,OutList>(len, in, out);
return out;
List<OutputIntListType> output;
invertManyToMany<InputIntListType,OutputIntListType>(len, input, output);
return output;
}
//- Create identity map of the given length with (map[i] == i)

View File

@ -124,16 +124,11 @@ void Foam::inplaceMapValue
Container& lst
)
{
for
(
typename Container::iterator iter = lst.begin();
iter != lst.end();
++iter
)
for (auto iter = lst.begin(); iter != lst.end(); ++iter)
{
if (iter() >= 0)
if (iter.object() >= 0)
{
iter() = oldToNew[iter()];
iter.object() = oldToNew[iter.object()];
}
}
}
@ -148,16 +143,11 @@ void Foam::inplaceMapKey
{
Container newLst(lst.size());
for
(
typename Container::iterator iter = lst.begin();
iter != lst.end();
++iter
)
for (auto iter = lst.begin(); iter != lst.end(); ++iter)
{
if (iter.key() >= 0)
{
newLst.insert(oldToNew[iter.key()], iter());
newLst.insert(oldToNew[iter.key()], iter.object());
}
}
@ -477,46 +467,45 @@ void Foam::inplaceSubsetList
}
template<class InList, class OutList>
template<class InputIntListType, class OutputIntListType>
void Foam::invertManyToMany
(
const label nEdges,
const UList<InList>& pointEdges,
List<OutList>& edges
const label len,
const UList<InputIntListType>& input,
List<OutputIntListType>& output
)
{
// Number of points per edge
labelList nPointsPerEdge(nEdges, 0);
// The output list sizes
labelList sizes(len, 0);
forAll(pointEdges, pointi)
forAll(input, listi)
{
const InList& pEdges = pointEdges[pointi];
const InputIntListType& sublist = input[listi];
forAll(pEdges, j)
forAll(sublist, idx)
{
nPointsPerEdge[pEdges[j]]++;
sizes[sublist[idx]]++;
}
}
// Size edges
edges.setSize(nEdges);
forAll(nPointsPerEdge, edgeI)
// Size output
output.setSize(len);
forAll(sizes, outi)
{
edges[edgeI].setSize(nPointsPerEdge[edgeI]);
output[outi].setSize(sizes[outi]);
}
nPointsPerEdge = 0;
// Fill edges
forAll(pointEdges, pointi)
// Fill output
sizes = 0;
forAll(input, listi)
{
const InList& pEdges = pointEdges[pointi];
const InputIntListType& sublist = input[listi];
forAll(pEdges, j)
forAll(sublist, idx)
{
label edgeI = pEdges[j];
const label outi = sublist[idx];
edges[edgeI][nPointsPerEdge[edgeI]++] = pointi;
output[outi][sizes[outi]++] = listi;
}
}
}

View File

@ -266,7 +266,7 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
PackedList<nBits>& lst = *this;
lst.clear();
is.fatalCheck("PackedList<nBits>::read(Istream&)");
is.fatalCheck(FUNCTION_NAME);
token firstTok(is);
is.fatalCheck
@ -349,7 +349,7 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
if (firstTok.pToken() == token::BEGIN_LIST)
{
token nextTok(is);
is.fatalCheck("PackedList<nBits>::read(Istream&)");
is.fatalCheck(FUNCTION_NAME);
while
(
@ -362,13 +362,13 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
lst.append(lst.readValue(is));
is >> nextTok;
is.fatalCheck("PackedList<nBits>::read(Istream&)");
is.fatalCheck(FUNCTION_NAME);
}
}
else if (firstTok.pToken() == token::BEGIN_BLOCK)
{
token nextTok(is);
is.fatalCheck("PackedList<nBits>::read(Istream&)");
is.fatalCheck(FUNCTION_NAME);
while
(
@ -381,7 +381,7 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
lst.setPair(is);
is >> nextTok;
is.fatalCheck("PackedList<nBits>::read(Istream&)");
is.fatalCheck(FUNCTION_NAME);
}
}
else

View File

@ -137,8 +137,7 @@ inline void Foam::PackedList<nBits>::setPair(Istream& is)
set(ind, val);
// Check state of Istream
is.check("PackedList<nBits>::setPair(Istream&)");
is.check(FUNCTION_NAME);
}

View File

@ -35,7 +35,7 @@ template<class T>
template<class INew>
void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
{
is.fatalCheck("PtrList<T>::read(Istream&, const INew&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);

View File

@ -120,9 +120,7 @@ Foam::Ostream& Foam::UIndirectList<T>::writeList
}
}
// Check state of IOstream
os.check("UIndirectList::writeList(Ostream&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -150,9 +150,7 @@ Foam::Ostream& Foam::UList<T>::writeList
}
}
// Check state of IOstream
os.check("UList<T>::writeList(Ostream&)");
os.check(FUNCTION_NAME);
return os;
}
@ -169,7 +167,7 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
template<class T>
Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
{
is.fatalCheck("operator>>(Istream&, UList<T>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);

View File

@ -44,9 +44,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const UPtrList<T>& L)
// Write end delimiter
os << nl << decrIndent << indent << token::END_LIST << nl;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const UPtrList&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,33 +24,60 @@ License
\*---------------------------------------------------------------------------*/
#include "NamedEnum.H"
#include "dictionary.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Enum, int nEnum>
template<class StringType>
Foam::List<StringType> Foam::NamedEnum<Enum, nEnum>::getNamesList()
{
List<StringType> lst(nEnum);
label count = 0;
for (int enumi=0; enumi < nEnum; ++enumi)
{
if (names[enumi] && names[enumi][0])
{
lst[count++] = names[enumi];
}
}
lst.setSize(count);
return lst;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Enum, int nEnum>
Foam::NamedEnum<Enum, nEnum>::NamedEnum()
:
HashTable<int>(2*nEnum)
table_type(2*nEnum)
{
for (int enumI = 0; enumI < nEnum; ++enumI)
for (int enumi=0; enumi < nEnum; ++enumi)
{
if (!names[enumI] || names[enumI][0] == '\0')
if (names[enumi] && names[enumi][0])
{
stringList goodNames(enumI);
insert(names[enumi], enumi);
}
else
{
// Bad name - generate error message
stringList goodNames(enumi);
for (int i = 0; i < enumI; ++i)
for (int i = 0; i < enumi; ++i)
{
goodNames[i] = names[i];
}
FatalErrorInFunction
<< "Illegal enumeration name at position " << enumI << endl
<< "after entries " << goodNames << ".\n"
<< "Illegal enumeration name at position " << enumi << nl
<< "after entries " << goodNames << nl
<< "Possibly your NamedEnum<Enum, nEnum>::names array"
<< " is not of size " << nEnum << endl
<< abort(FatalError);
}
insert(names[enumI], enumI);
}
}
@ -60,14 +87,13 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
template<class Enum, int nEnum>
Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
{
const word name(is);
HashTable<int>::const_iterator iter = find(name);
const word enumName(is);
table_type::const_iterator iter = find(enumName);
if (!iter.found())
{
FatalIOErrorInFunction(is)
<< name << " is not in enumeration: "
<< enumName << " is not in enumeration: "
<< sortedToc() << exit(FatalIOError);
}
@ -78,45 +104,47 @@ Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
template<class Enum, int nEnum>
void Foam::NamedEnum<Enum, nEnum>::write(const Enum e, Ostream& os) const
{
os << operator[](e);
os << names[int(e)];
}
template<class Enum, int nEnum>
Foam::stringList Foam::NamedEnum<Enum, nEnum>::strings()
Enum Foam::NamedEnum<Enum, nEnum>::lookup
(
const word& key,
const dictionary& dict
) const
{
stringList lst(nEnum);
const word enumName(dict.lookup(key));
table_type::const_iterator iter = find(enumName);
label nElem = 0;
for (int enumI = 0; enumI < nEnum; ++enumI)
if (!iter.found())
{
if (names[enumI] && names[enumI][0])
{
lst[nElem++] = names[enumI];
}
FatalIOErrorInFunction(dict)
<< enumName << " is not in enumeration: "
<< sortedToc() << exit(FatalIOError);
}
lst.setSize(nElem);
return lst;
return Enum(iter.object());
}
template<class Enum, int nEnum>
Foam::wordList Foam::NamedEnum<Enum, nEnum>::words()
Enum Foam::NamedEnum<Enum, nEnum>::lookupOrDefault
(
const word& key,
const dictionary& dict,
const enum_type deflt
) const
{
wordList lst(nEnum);
label nElem = 0;
for (int enumI = 0; enumI < nEnum; ++enumI)
if (dict.found(key))
{
if (names[enumI] && names[enumI][0])
{
lst[nElem++] = names[enumI];
}
return lookup(key, dict);
}
else
{
return deflt;
}
lst.setSize(nElem);
return lst;
}
@ -125,18 +153,32 @@ Foam::List<Enum> Foam::NamedEnum<Enum, nEnum>::enums()
{
List<Enum> lst(nEnum);
label nElem = 0;
for (int enumI = 0; enumI < nEnum; ++enumI)
label count = 0;
for (int enumi = 0; enumi < nEnum; ++enumi)
{
if (names[enumI] && names[enumI][0])
if (names[enumi] && names[enumi][0])
{
lst[nElem++] = Enum(enumI);
lst[count++] = Enum(enumi);
}
}
lst.setSize(nElem);
lst.setSize(count);
return lst;
}
template<class Enum, int nEnum>
Foam::stringList Foam::NamedEnum<Enum, nEnum>::strings()
{
return getNamesList<string>();
}
template<class Enum, int nEnum>
Foam::wordList Foam::NamedEnum<Enum, nEnum>::words()
{
return getNamesList<word>();
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,7 +25,9 @@ Class
Foam::NamedEnum
Description
Initialise the NamedEnum HashTable from the static list of names.
A NamedEnum is a wrapper around a static list of names that represent
a particular enumeration. Internally it uses a HashTable for quicker
lookups.
SourceFiles
NamedEnum.C
@ -44,6 +46,7 @@ SourceFiles
namespace Foam
{
class dictionary;
// Forward declaration
template<class Enum, int> class NamedEnum;
@ -57,11 +60,19 @@ class NamedEnum
:
public HashTable<int>
{
//- nEnum must be positive (non-zero)
//- The nEnum must be positive (non-zero)
static_assert(nEnum > 0, "nEnum must be positive (non-zero)");
//- The type of HashTable used for the lookup.
typedef HashTable<int> table_type;
// Private Member Functions
//- The names as a list of strings
template<class StringType>
static List<StringType> getNamesList();
//- Disallow default bitwise copy construct
NamedEnum(const NamedEnum&) = delete;
@ -71,6 +82,10 @@ class NamedEnum
public:
//- The type of enumeration wrapped by NamedEnum
typedef Enum enum_type;
// Static data members
//- The set of names corresponding to the enumeration Enum
@ -87,10 +102,33 @@ public:
//- Read a word from Istream and return the corresponding
// enumeration element
Enum read(Istream&) const;
enum_type read(Istream& is) const;
//- Write the name representation of the enumeration to an Ostream
void write(const Enum e, Ostream&) const;
void write(const enum_type e, Ostream& os) const;
//- Lookup the key in the dictionary and return the corresponding
// enumeration element based on its name.
// Fatal if anything is incorrect.
enum_type lookup
(
const word& key,
const dictionary& dict
) const;
//- Find the key in the dictionary and return the corresponding
// enumeration element based on its name.
// Return the default value if the key was not found in the dictionary.
// Fatal if enumerated name was incorrect.
enum_type lookupOrDefault
(
const word& key,
const dictionary& dict,
const enum_type deflt
) const;
//- List of enumerations
static List<enum_type> enums();
//- The set of names as a list of strings
static stringList strings();
@ -98,26 +136,23 @@ public:
//- The set of names as a list of words
static wordList words();
//- List of enumerations
static List<Enum> enums();
// Member Operators
//- Return the enumeration element corresponding to the given name
const Enum operator[](const char* name) const
inline const enum_type operator[](const char* name) const
{
return Enum(HashTable<int>::operator[](name));
return enum_type(table_type::operator[](name));
}
//- Return the enumeration element corresponding to the given name
const Enum operator[](const word& name) const
inline const enum_type operator[](const word& name) const
{
return Enum(HashTable<int>::operator[](name));
return enum_type(table_type::operator[](name));
}
//- Return the name of the given enumeration element
const char* operator[](const Enum e) const
inline const char* operator[](const enum_type e) const
{
return names[int(e)];
}

View File

@ -117,11 +117,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const UPstream::commsStruct& comm)
<< comm.allBelow_ << token::SPACE
<< comm.allNotBelow_;
os.check
(
"Ostream& operator<<(Ostream&, const commsStruct&)"
);
os.check(FUNCTION_NAME);
return os;
}

View File

@ -105,9 +105,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t)
<< endl;
}
// Check state of stream
os.check("Ostream& operator<<(Ostream&, const token&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -38,11 +38,7 @@ Foam::dictionaryEntry::dictionaryEntry
entry(keyType(is)),
dictionary(parentDict, is)
{
is.fatalCheck
(
"dictionaryEntry::dictionaryEntry"
"(const dictionary& parentDict, Istream&)"
);
is.fatalCheck(FUNCTION_NAME);
}
@ -56,11 +52,7 @@ Foam::dictionaryEntry::dictionaryEntry
entry(key),
dictionary(key, parentDict, is)
{
is.fatalCheck
(
"dictionaryEntry::dictionaryEntry"
"(const keyType&, const dictionary& parentDict, Istream&)"
);
is.fatalCheck(FUNCTION_NAME);
}

View File

@ -115,8 +115,7 @@ void Foam::dictionaryListEntry::write(Ostream& os) const
// Write end delimiter
os << decrIndent << indent << token::END_LIST << nl;
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const dictionaryListEntry&)");
os.check(FUNCTION_NAME);
}

View File

@ -84,11 +84,7 @@ bool Foam::functionEntry::execute
Istream& is
)
{
is.fatalCheck
(
"functionEntry::execute"
"(const word& functionName, dictionary& parentDict, Istream&)"
);
is.fatalCheck(FUNCTION_NAME);
if (!executedictionaryIstreamMemberFunctionTablePtr_)
{
@ -127,11 +123,7 @@ bool Foam::functionEntry::execute
Istream& is
)
{
is.fatalCheck
(
"functionEntry::execute"
"(const word&, const dictionary&, primitiveEntry&, Istream&)"
);
is.fatalCheck(FUNCTION_NAME);
if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
{

View File

@ -91,10 +91,7 @@ bool Foam::primitiveEntry::expandFunction
bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
{
is.fatalCheck
(
"primitiveEntry::readData(const dictionary&, Istream&)"
);
is.fatalCheck(FUNCTION_NAME);
label blockCount = 0;
token currToken;
@ -145,10 +142,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
}
}
is.fatalCheck
(
"primitiveEntry::readData(const dictionary&, Istream&)"
);
is.fatalCheck(FUNCTION_NAME);
if (currToken.good())
{

View File

@ -477,9 +477,8 @@ Foam::Istream& Foam::dimensionSet::read
<< exit(FatalIOError);
}
}
// Check state of Istream
is.check("Istream& operator>>(Istream&, dimensionSet&)");
is.check(FUNCTION_NAME);
return is;
}
@ -617,9 +616,7 @@ Foam::Istream& Foam::dimensionSet::read
}
}
// Check state of Istream
is.check("Istream& operator>>(Istream&, dimensionSet&)");
is.check(FUNCTION_NAME);
return is;
}
@ -691,9 +688,7 @@ Foam::Ostream& Foam::dimensionSet::write
os << token::END_SQR;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
os.check(FUNCTION_NAME);
return os;
}
@ -722,9 +717,7 @@ Foam::Istream& Foam::operator>>(Istream& is, dimensionSet& dset)
<< exit(FatalIOError);
}
// Check state of Istream
is.check("Istream& operator>>(Istream&, dimensionSet&)");
is.check(FUNCTION_NAME);
return is;
}
@ -734,9 +727,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const dimensionSet& dset)
scalar multiplier;
dset.write(os, multiplier);
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -339,12 +339,7 @@ Foam::dimensioned<Type>::read(Istream& is, const dictionary& readSet)
is >> value_;
value_ *= mult;
// Check state of Istream
is.check
(
"Istream& dimensioned<Type>::read(Istream& is, const dictionary&)"
);
is.check(FUNCTION_NAME);
return is;
}
@ -367,13 +362,7 @@ Foam::Istream& Foam::dimensioned<Type>::read
is >> value_;
value_ *= mult;
// Check state of Istream
is.check
(
"Istream& dimensioned<Type>::read"
"(Istream& is, const HashTable<dimensionedScalar>&)"
);
is.check(FUNCTION_NAME);
return is;
}
@ -392,12 +381,7 @@ Foam::Istream& Foam::dimensioned<Type>::read(Istream& is)
is >> value_;
value_ *= mult;
// Check state of Istream
is.check
(
"Istream& dimensioned<Type>::read(Istream& is)"
);
is.check(FUNCTION_NAME);
return is;
}
@ -612,9 +596,7 @@ Foam::Istream& Foam::operator>>(Istream& is, dimensioned<Type>& dt)
is >> dt.value_;
dt.value_ *= multiplier;
// Check state of Istream
is.check("Istream& operator>>(Istream&, dimensioned<Type>&)");
is.check(FUNCTION_NAME);
return is;
}
@ -634,9 +616,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
// Write the value
os << dt.value()/mult;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -80,7 +80,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io),
Field<Type>(field),
mesh_(mesh),
dimensions_(dims)
dimensions_(dims),
oriented_()
{
checkFieldSize();
}
@ -134,7 +135,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io),
Field<Type>(GeoMesh::size(mesh)),
mesh_(mesh),
dimensions_(dims)
dimensions_(dims),
oriented_()
{
if (checkIOFlags)
{
@ -155,7 +157,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io),
Field<Type>(GeoMesh::size(mesh), dt.value()),
mesh_(mesh),
dimensions_(dt.dimensions())
dimensions_(dt.dimensions()),
oriented_()
{
if (checkIOFlags)
{
@ -173,7 +176,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(df),
Field<Type>(df),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
dimensions_(df.dimensions_),
oriented_(df.oriented_)
{}
@ -187,7 +191,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(df, reuse),
Field<Type>(df, reuse),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
dimensions_(df.dimensions_),
oriented_(df.oriented_)
{}
@ -200,7 +205,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(df(), true),
Field<Type>(df),
mesh_(df->mesh_),
dimensions_(df->dimensions_)
dimensions_(df->dimensions_),
oriented_(df->oriented_)
{}
@ -218,7 +224,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
tdf.isTmp()
),
mesh_(tdf().mesh_),
dimensions_(tdf().dimensions_)
dimensions_(tdf().dimensions_),
oriented_(tdf().oriented_)
{
tdf.clear();
}
@ -235,7 +242,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io),
Field<Type>(df),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
dimensions_(df.dimensions_),
oriented_(df.oriented_)
{}
@ -250,7 +258,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io, df),
Field<Type>(df, reuse),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
dimensions_(df.dimensions_),
oriented_(df.oriented_)
{}
@ -264,7 +273,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(newName, df, newName == df.name()),
Field<Type>(df),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
dimensions_(df.dimensions_),
oriented_(df.oriented_)
{}
@ -279,7 +289,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(newName, df, true),
Field<Type>(df, reuse),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
dimensions_(df.dimensions_),
oriented_(df.oriented_)
{}
@ -293,7 +304,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(newName, df, true),
Field<Type>(df),
mesh_(df->mesh_),
dimensions_(df->dimensions_)
dimensions_(df->dimensions_),
oriented_(df->oriented_)
{}
@ -312,7 +324,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
tdf.isTmp()
),
mesh_(tdf().mesh_),
dimensions_(tdf().dimensions_)
dimensions_(tdf().dimensions_),
oriented_(tdf().oriented_)
{
tdf.clear();
}
@ -487,6 +500,7 @@ void DimensionedField<Type, GeoMesh>::operator=
checkField(*this, df, "=");
dimensions_ = df.dimensions();
oriented_ = df.oriented();
Field<Type>::operator=(df);
}
@ -510,6 +524,7 @@ void DimensionedField<Type, GeoMesh>::operator=
checkField(*this, df, "=");
dimensions_ = df.dimensions();
oriented_ = df.oriented();
this->transfer(const_cast<DimensionedField<Type, GeoMesh>&>(df));
tdf.clear();
}
@ -537,6 +552,7 @@ void DimensionedField<Type, GeoMesh>::operator op \
checkField(*this, df, #op); \
\
dimensions_ op df.dimensions(); \
oriented_ op df.oriented(); \
Field<Type>::operator op(df); \
} \
\

View File

@ -41,6 +41,7 @@ SourceFiles
#include "regIOobject.H"
#include "Field.H"
#include "dimensionedType.H"
#include "orientedType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +66,7 @@ template<class Type, class GeoMesh> Ostream& operator<<
/*---------------------------------------------------------------------------*\
Class DimensionedField Declaration
Class DimensionedField Declaration
\*---------------------------------------------------------------------------*/
template<class Type, class GeoMesh>
@ -99,6 +100,9 @@ private:
//- Dimension set for this field
dimensionSet dimensions_;
//- Oriented flag
orientedType oriented_;
// Private Member Functions
@ -283,6 +287,15 @@ public:
//- Return non-const access to dimensions
inline dimensionSet& dimensions();
//- Return oriented type
inline const orientedType& oriented() const;
//- Return non-const access to the oriented type
inline orientedType& oriented();
//- Set the oriented flag
inline void setOriented(const bool oriented = true);
//- Return field
inline const Field<Type>& field() const;

View File

@ -52,6 +52,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field()); \
\
tRes.ref().oriented() = Dfunc(df1.oriented()); \
\
return tRes; \
} \
\
@ -75,6 +77,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field()); \
\
tRes.ref().oriented() = Dfunc(df1.oriented()); \
\
tdf1.clear(); \
\
return tRes; \
@ -108,6 +112,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field()); \
\
tRes.ref().oriented() = Dfunc(df1.oriented()); \
\
return tRes; \
} \
\
@ -131,6 +137,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field()); \
\
tRes.ref().oriented() = Dfunc(df1.oriented()); \
\
tdf1.clear(); \
\
return tRes; \
@ -165,6 +173,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \
\
return tRes; \
} \
\
@ -189,6 +199,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \
\
tdf2.clear(); \
\
return tRes; \
@ -215,6 +227,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \
\
tdf1.clear(); \
\
return tRes; \
@ -244,6 +258,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \
\
tdf1.clear(); \
tdf2.clear(); \
\
@ -279,6 +295,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), dt1.value(), df2.field()); \
\
tRes.ref().oriented() = df2.oriented(); \
\
return tRes; \
} \
\
@ -314,6 +332,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), dt1.value(), df2.field()); \
\
tRes.ref().oriented() = df2.oriented(); \
\
tdf2.clear(); \
\
return tRes; \
@ -356,6 +376,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field(), dt2.value()); \
\
tRes.ref().oriented() = df1.oriented(); \
\
return tRes; \
} \
\
@ -391,6 +413,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
\
Func(tRes.ref().field(), df1.field(), dt2.value()); \
\
tRes.ref().oriented() = df1.oriented(); \
\
tdf1.clear(); \
\
return tRes; \
@ -440,6 +464,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \
\
return tRes; \
} \
\
@ -464,6 +490,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \
\
tdf2.clear(); \
\
return tRes; \
@ -490,6 +518,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \
\
tdf1.clear(); \
\
return tRes; \
@ -519,6 +549,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \
\
tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \
\
tdf1.clear(); \
tdf2.clear(); \
\
@ -528,7 +560,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
\
TEMPLATE \
tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
@ -552,6 +584,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \
); \
\
tRes.ref().oriented() = df2.oriented(); \
\
Foam::OpFunc(tRes.ref().field(), dt1.value(), df2.field()); \
\
return tRes; \
@ -589,6 +623,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), dt1.value(), tdf2().field()); \
\
tRes.ref().oriented() = df2.oriented(); \
\
tdf2.clear(); \
\
return tRes; \
@ -605,7 +641,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
}
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
\
TEMPLATE \
tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
@ -631,6 +667,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), df1.field(), dt2.value()); \
\
tRes.ref().oriented() = df1.oriented(); \
\
return tRes; \
} \
\
@ -666,6 +704,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
\
Foam::OpFunc(tRes.ref().field(), tdf1().field(), dt2.value()); \
\
tRes.ref().oriented() = df1.oriented(); \
\
tdf1.clear(); \
\
return tRes; \

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,14 +48,39 @@ Foam::DimensionedField<Type, GeoMesh>::dimensions() const
return dimensions_;
}
template<class Type, class GeoMesh>
inline Foam::dimensionSet&
Foam::DimensionedField<Type, GeoMesh>::dimensions()
inline Foam::dimensionSet& Foam::DimensionedField<Type, GeoMesh>::dimensions()
{
return dimensions_;
}
template<class Type, class GeoMesh>
inline const Foam::orientedType&
Foam::DimensionedField<Type, GeoMesh>::oriented() const
{
return oriented_;
}
template<class Type, class GeoMesh>
inline Foam::orientedType& Foam::DimensionedField<Type, GeoMesh>::oriented()
{
return oriented_;
}
template<class Type, class GeoMesh>
inline void Foam::DimensionedField<Type, GeoMesh>::setOriented
(
const bool oriented
)
{
oriented_.setOriented(oriented);
}
template<class Type, class GeoMesh>
inline const Foam::Field<Type>&
Foam::DimensionedField<Type, GeoMesh>::field() const
@ -63,6 +88,7 @@ Foam::DimensionedField<Type, GeoMesh>::field() const
return *this;
}
template<class Type, class GeoMesh>
inline Foam::Field<Type>&
Foam::DimensionedField<Type, GeoMesh>::field()

View File

@ -37,6 +37,7 @@ void Foam::DimensionedField<Type, GeoMesh>::readField
)
{
dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions")));
oriented_.read(fieldDict);
Field<Type> f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_));
this->transfer(f);
@ -74,7 +75,8 @@ Foam::DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io),
Field<Type>(0),
mesh_(mesh),
dimensions_(dimless)
dimensions_(dimless),
oriented_()
{
readField(dictionary(readStream(typeName)), fieldDictEntry);
}
@ -92,7 +94,8 @@ Foam::DimensionedField<Type, GeoMesh>::DimensionedField
regIOobject(io),
Field<Type>(0),
mesh_(mesh),
dimensions_(dimless)
dimensions_(dimless),
oriented_()
{
readField(fieldDict, fieldDictEntry);
}
@ -107,19 +110,15 @@ bool Foam::DimensionedField<Type, GeoMesh>::writeData
const word& fieldDictEntry
) const
{
os.writeKeyword("dimensions") << dimensions() << token::END_STATEMENT
<< nl << nl;
os.writeEntry("dimensions", dimensions());
oriented_.writeEntry(os);
os<< nl << nl;
Field<Type>::writeEntry(fieldDictEntry, os);
// Check state of Ostream
os.check
(
"bool DimensionedField<Type, GeoMesh>::writeData"
"(Ostream& os, const word& fieldDictEntry) const"
);
return (os.good());
os.check(FUNCTION_NAME);
return os.good();
}

View File

@ -28,7 +28,6 @@ License
#include "dictionary.H"
#include "contiguous.H"
#include "mapDistributeBase.H"
#include "flipOp.H"
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //

View File

@ -573,12 +573,7 @@ writeEntry(const word& keyword, Ostream& os) const
this->writeEntries(os);
os.endBlock() << flush;
// Check state of IOstream
os.check
(
"GeometricField<Type, PatchField, GeoMesh>::Boundary::"
"writeEntry(const word& keyword, Ostream& os) const"
);
os.check(FUNCTION_NAME);
}

View File

@ -1175,6 +1175,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
// Only assign field contents not ID
this->dimensions() = gf.dimensions();
this->oriented() = gf.oriented();
if (tgf.isTmp())
{
@ -1246,7 +1247,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
{ \
checkField(*this, gf, #op); \
\
ref() op gf(); \
ref() op gf(); \
boundaryFieldRef() op gf.boundaryField(); \
} \
\
@ -1266,7 +1267,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
const dimensioned<TYPE>& dt \
) \
{ \
ref() op dt; \
ref() op dt; \
boundaryFieldRef() op dt.value(); \
}
@ -1291,14 +1292,8 @@ Foam::Ostream& Foam::operator<<
os << nl;
gf.boundaryField().writeEntry("boundaryField", os);
// Check state of IOstream
os.check
(
"Ostream& operator<<(Ostream&, "
"const GeometricField<Type, PatchField, GeoMesh>&)"
);
return (os);
os.check(FUNCTION_NAME);
return os;
}

View File

@ -51,6 +51,7 @@ void component
{
component(gcf.primitiveFieldRef(), gf.primitiveField(), d);
component(gcf.boundaryFieldRef(), gf.boundaryField(), d);
gcf.oriented() = gf.oriented();
}
@ -63,6 +64,7 @@ void T
{
T(gf.primitiveFieldRef(), gf1.primitiveField());
T(gf.boundaryFieldRef(), gf1.boundaryField());
gf.oriented() = gf1.oriented();
}
@ -81,6 +83,7 @@ void pow
{
pow(gf.primitiveFieldRef(), gf1.primitiveField(), r);
pow(gf.boundaryFieldRef(), gf1.boundaryField(), r);
gf.oriented() = pow(gf1.oriented(), r);
}
template
@ -175,6 +178,7 @@ void sqr
{
sqr(gf.primitiveFieldRef(), gf1.primitiveField());
sqr(gf.boundaryFieldRef(), gf1.boundaryField());
gf.oriented() = sqr(gf1.oriented());
}
template<class Type, template<class> class PatchField, class GeoMesh>
@ -263,6 +267,7 @@ void magSqr
{
magSqr(gsf.primitiveFieldRef(), gf.primitiveField());
magSqr(gsf.boundaryFieldRef(), gf.boundaryField());
gsf.oriented() = magSqr(gf.oriented());
}
template<class Type, template<class> class PatchField, class GeoMesh>
@ -335,6 +340,7 @@ void mag
{
mag(gsf.primitiveFieldRef(), gf.primitiveField());
mag(gsf.boundaryFieldRef(), gf.boundaryField());
gsf.oriented() = mag(gf.oriented());
}
template<class Type, template<class> class PatchField, class GeoMesh>
@ -412,6 +418,7 @@ void cmptAv
{
cmptAv(gcf.primitiveFieldRef(), gf.primitiveField());
cmptAv(gcf.boundaryFieldRef(), gf.boundaryField());
gcf.oriented() = cmptAv(gf.oriented());
}
template<class Type, template<class> class PatchField, class GeoMesh>
@ -611,6 +618,8 @@ void opFunc \
gf1.boundaryField(), \
gf2.boundaryField() \
); \
\
gf.oriented() = gf1.oriented() op gf2.oriented(); \
} \
\
template \
@ -757,6 +766,7 @@ void opFunc \
{ \
Foam::opFunc(gf.primitiveFieldRef(), gf1.primitiveField(), dvs.value()); \
Foam::opFunc(gf.boundaryFieldRef(), gf1.boundaryField(), dvs.value()); \
gf.oriented() = gf1.oriented(); \
} \
\
template \
@ -870,6 +880,7 @@ void opFunc \
{ \
Foam::opFunc(gf.primitiveFieldRef(), dvs.value(), gf1.primitiveField()); \
Foam::opFunc(gf.boundaryFieldRef(), dvs.value(), gf1.boundaryField()); \
gf.oriented() = gf1.oriented(); \
} \
\
template \

View File

@ -43,6 +43,7 @@ void Func \
{ \
Foam::Func(res.primitiveFieldRef(), gf1.primitiveField()); \
Foam::Func(res.boundaryFieldRef(), gf1.boundaryField()); \
res.oriented() = gf1.oriented(); \
} \
\
TEMPLATE \
@ -112,6 +113,7 @@ void OpFunc \
{ \
Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField()); \
Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField()); \
res.oriented() = gf1.oriented(); \
} \
\
TEMPLATE \
@ -192,6 +194,7 @@ void Func \
gf1.boundaryField(), \
gf2.boundaryField() \
); \
res.oriented() = Func(gf1.oriented(), gf2.oriented()); \
} \
\
TEMPLATE \
@ -320,6 +323,7 @@ void Func \
{ \
Foam::Func(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \
Foam::Func(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \
res.oriented() = gf2.oriented(); \
} \
\
TEMPLATE \
@ -411,6 +415,7 @@ void Func \
{ \
Foam::Func(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \
Foam::Func(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \
res.oriented() = gf1.oriented(); \
} \
\
TEMPLATE \
@ -511,6 +516,7 @@ void OpFunc \
(res.primitiveFieldRef(), gf1.primitiveField(), gf2.primitiveField()); \
Foam::OpFunc \
(res.boundaryFieldRef(), gf1.boundaryField(), gf2.boundaryField()); \
res.oriented() = gf1.oriented() Op gf2.oriented(); \
} \
\
TEMPLATE \
@ -639,6 +645,8 @@ void OpFunc \
{ \
Foam::OpFunc(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \
Foam::OpFunc(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \
res.oriented() = gf2.oriented(); \
\
} \
\
TEMPLATE \
@ -730,6 +738,7 @@ void OpFunc \
{ \
Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \
Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \
res.oriented() = gf1.oriented(); \
} \
\
TEMPLATE \

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,7 +51,7 @@ public:
void operator()
(
Field<Type>& field,
DimensionedField<Type, GeoMesh>& field,
const MeshMapper& mapper
) const;
};
@ -72,10 +72,12 @@ void MapGeometricFields
const MeshMapper& mapper
)
{
HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
HashTable<const FieldType*> fields
(
mapper.thisDb().objectRegistry::template
lookupClass<GeometricField<Type, PatchField, GeoMesh>>()
lookupClass<FieldType>()
);
// It is necessary to enforce that all old-time fields are stored
@ -83,17 +85,9 @@ void MapGeometricFields
// old-time-level field is mapped before the field itself, sizes
// will not match.
for
(
typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(typename HashTable<const FieldType*>, fields, fieldIter)
{
GeometricField<Type, PatchField, GeoMesh>& field =
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
(*fieldIter());
FieldType& field = const_cast<FieldType&>(*fieldIter());
//Note: check can be removed once pointFields are actually stored on
// the pointMesh instead of now on the polyMesh!
@ -103,17 +97,9 @@ void MapGeometricFields
}
}
for
(
typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(typename HashTable<const FieldType*>, fields, fieldIter)
{
GeometricField<Type, PatchField, GeoMesh>& field =
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
(*fieldIter());
FieldType& field = const_cast<FieldType&>(*fieldIter());
if (&field.mesh() == &mapper.mesh())
{
@ -124,15 +110,11 @@ void MapGeometricFields
}
// Map the internal field
MapInternalField<Type, MeshMapper, GeoMesh>()
(
field.primitiveFieldRef(),
mapper
);
MapInternalField<Type, MeshMapper, GeoMesh>()(field.ref(), mapper);
// Map the patch fields
typename GeometricField<Type, PatchField, GeoMesh>
::Boundary& bfield = field.boundaryFieldRef();
typename FieldType::Boundary& bfield = field.boundaryFieldRef();
forAll(bfield, patchi)
{
// Cannot check sizes for patch fields because of

View File

@ -329,7 +329,7 @@ Foam::Ostream& Foam::operator<<
{
ptf.write(os);
os.check("Ostream& operator<<(Ostream&, const pointPatchField<Type>&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -673,6 +673,17 @@ void Foam::argList::parse
adjustOpt = true;
source = source/"decomposeParDict";
}
if
(
!source.isAbsolute()
&& !(source.size() && source[0] == '.')
)
{
source = rootPath_/globalCase_/source;
adjustOpt = true;
}
// Could also check for absolute path, but shouldn't be needed
if (adjustOpt)
{

View File

@ -63,7 +63,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const curve& c)
<< c.style_ << nl
<< static_cast<const scalarField&>(c);
os.check("Ostream& operator>>(Ostream&, const curve&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -298,7 +298,7 @@ void Foam::graph::write
Foam::Ostream& Foam::operator<<(Ostream& os, const graph& g)
{
g.writeTable(os);
os.check("Ostream& operator<<(Ostream&, const graph&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -363,7 +363,7 @@ Foam::Ostream& Foam::operator<<
<< endl << endl;
}
os.check("Ostream& operator<<(Ostream&, const LduMatrix&");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -48,7 +48,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
// Anull matrix
M.clear();
is.fatalCheck("operator>>(Istream&, Matrix<Form, Type>&)");
is.fatalCheck(FUNCTION_NAME);
token firstToken(is);
@ -250,9 +250,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
}
}
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const Matrix&)");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -338,7 +338,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const lduMatrix& ldum)
os << ldum.upper();
}
os.check("Ostream& operator<<(Ostream&, const lduMatrix&");
os.check(FUNCTION_NAME);
return os;
}
@ -398,7 +398,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<lduMatrix>& ip)
// os << endl;
//}
os.check("Ostream& operator<<(Ostream&, const lduMatrix&");
os.check(FUNCTION_NAME);
return os;
}

View File

@ -142,9 +142,7 @@ Ostream& operator<<(Ostream& os, const DynamicID<ObjectType>& dynId)
<< dynId.name() << token::SPACE << dynId.index()
<< token::END_LIST;
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const DynamicID<ObjectType>&)");
os.check(FUNCTION_NAME);
return os;
}

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