conflict resolution

This commit is contained in:
andy
2009-03-23 11:58:03 +00:00
289 changed files with 13459 additions and 5377 deletions

View File

@ -28,6 +28,8 @@ Description
#include "UIndirectList.H" #include "UIndirectList.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "ListOps.H"
#include "OFstream.H"
using namespace Foam; using namespace Foam;
@ -52,29 +54,32 @@ int main(int argc, char *argv[])
UIndirectList<double> idl(completeList, addresses); UIndirectList<double> idl(completeList, addresses);
forAll(idl, i) Info<< idl << "\n";
{
Info<< idl[i] << token::SPACE;
}
Info<< endl;
idl[1] = -666; idl[1] = -666;
Info<< "idl[1] changed:" << idl() << endl; Info<< "idl[1] changed:" << idl << endl;
idl = -999; idl = -999;
Info<< "idl changed:" << idl() << endl; Info<< "idl changed:" << idl << endl;
UIndirectList<double> idl2(idl); UIndirectList<double> idl2(idl);
Info<< "idl2:" << idl2() << endl; Info<< "idl2: " << idl2 << endl;
idl = idl2();
Info<< "idl assigned from UList:" << idl() << endl; {
List<double> ident(idl.size());
forAll(ident, i)
{
ident[i] = ident.size() - i;
}
idl = ident;
}
Info<< "idl assigned from UList:" << idl << endl;
List<double> realList = UIndirectList<double>(completeList, addresses); List<double> realList = UIndirectList<double>(completeList, addresses);

View File

@ -70,6 +70,28 @@ int main(int argc, char *argv[])
string test2("~OpenFOAM/controlDict"); string test2("~OpenFOAM/controlDict");
Info<< test2 << " => " << test2.expand() << endl; Info<< test2 << " => " << test2.expand() << endl;
// replace controlDict with "newName"
{
string::size_type i = test2.rfind('/');
if (i == string::npos)
{
test2 = "newName";
}
else
{
// this uses the std::string::replace
test2.replace(i+1, string::npos, "newName");
}
Info<< "after replace: " << test2 << endl;
// do another replace
// this uses the Foam::string::replace
test2.replace("OpenFOAM", "openfoam");
Info<< "after replace: " << test2 << endl;
}
string s; string s;
Sin.getLine(s); Sin.getLine(s);
@ -78,8 +100,7 @@ int main(int argc, char *argv[])
cout<< "output string with " << s2.length() << " characters\n"; cout<< "output string with " << s2.length() << " characters\n";
cout<< "ostream<< >" << s2 << "<\n"; cout<< "ostream<< >" << s2 << "<\n";
Info<< "Ostream<< >" << s2 << "<\n"; Info<< "Ostream<< >" << s2 << "<\n";
Info<< "hash:" << unsigned(string::hash()(s2)) << endl; Info<< "hash:" << hex << string::hash()(s2) << endl;
Info << "End\n" << endl; Info << "End\n" << endl;

View File

@ -30,8 +30,7 @@ Description
#include "arcEdge.H" #include "arcEdge.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -40,8 +39,7 @@ namespace Foam
defineTypeNameAndDebug(arcEdge, 0); defineTypeNameAndDebug(arcEdge, 0);
// Add the curvedEdge constructor functions to the hash tables // Add the curvedEdge constructor functions to the hash tables
curvedEdge::addIstreamConstructorToTable<arcEdge> addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream);
addArcEdgeIstreamConstructorToTable_;
} }

View File

@ -41,26 +41,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(curvedEdge, 0); defineTypeNameAndDebug(curvedEdge, 0);
defineRunTimeSelectionTable(curvedEdge, Istream);
// Define the constructor function hash tables
HashTable<curvedEdge::IstreamConstructorPtr_>*
curvedEdge::IstreamConstructorTablePtr_;
// Hash table Constructor called from the table add functions.
void curvedEdge::constructTables()
{
static bool constructed = false;
if (!constructed)
{
curvedEdge::IstreamConstructorTablePtr_
= new HashTable<curvedEdge::IstreamConstructorPtr_>;
constructed = true;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -117,10 +98,11 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
word curvedEdgeType(is); word curvedEdgeType(is);
HashTable<IstreamConstructorPtr_>::iterator curvedEdgeConstructorIter = IstreamConstructorTable::iterator cstrIter =
IstreamConstructorTablePtr_->find(curvedEdgeType); IstreamConstructorTablePtr_
->find(curvedEdgeType);
if (curvedEdgeConstructorIter == IstreamConstructorTablePtr_->end()) if (cstrIter == IstreamConstructorTablePtr_->end())
{ {
FatalErrorIn("curvedEdge::New(const pointField&, Istream&)") FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
<< "Unknown curvedEdge type " << curvedEdgeType << endl << endl << "Unknown curvedEdge type " << curvedEdgeType << endl << endl
@ -129,7 +111,7 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
<< abort(FatalError); << abort(FatalError);
} }
return autoPtr<curvedEdge>(curvedEdgeConstructorIter()(points, is)); return autoPtr<curvedEdge>(cstrIter()(points, is));
} }
@ -177,7 +159,6 @@ Ostream& operator<<(Ostream& os, const curvedEdge& p)
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -63,51 +63,23 @@ protected:
public: public:
// Constructor Hash tables //- Runtime type information
TypeName("curvedEdge");
//- Construct from Istream function pointer type
typedef autoPtr<curvedEdge> (*IstreamConstructorPtr_)
(const pointField&, Istream&);
//- Construct from Istream function pointer table pointer
static HashTable<IstreamConstructorPtr_>*
IstreamConstructorTablePtr_;
// Hash table constructor classes and functions // Declare run-time constructor selection tables
//- Hash table Constructor. declareRunTimeSelectionTable
// Must be called from the table add functions below. (
static void constructTables(); autoPtr,
curvedEdge,
Istream,
//- Class to add constructor from Istream to Hash table
template<class curvedEdgeType>
class addIstreamConstructorToTable
{
public:
static autoPtr<curvedEdge> New
( (
const pointField& points, const pointField& points,
Istream& is Istream& is
) ),
{ (points, is)
return autoPtr<curvedEdge>(new curvedEdgeType(points, is)); );
}
addIstreamConstructorToTable()
{
curvedEdge::constructTables();
curvedEdge::IstreamConstructorTablePtr_
->insert(curvedEdgeType::typeName, New);
}
};
//- Runtime type information
TypeName("curvedEdge");
// Constructors // Constructors

View File

@ -26,6 +26,7 @@ License
#include "polySplineEdge.H" #include "polySplineEdge.H"
#include "BSpline.H" #include "BSpline.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -34,8 +35,7 @@ namespace Foam
defineTypeNameAndDebug(polySplineEdge, 0); defineTypeNameAndDebug(polySplineEdge, 0);
// Add the curvedEdge constructor functions to the hash tables // Add the curvedEdge constructor functions to the hash tables
curvedEdge::addIstreamConstructorToTable<polySplineEdge> addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream);
addPolySplineEdgeIstreamConstructorToTable_;
} }

View File

@ -92,7 +92,7 @@ public:
); );
//- Construct from Istream setting pointsList //- Construct from Istream setting pointsList
polySplineEdge(const pointField& points,Istream& is); polySplineEdge(const pointField& points, Istream& is);
// Destructor // Destructor

View File

@ -27,9 +27,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "simpleSplineEdge.H" #include "simpleSplineEdge.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,10 +38,8 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(simpleSplineEdge, 0); defineTypeNameAndDebug(simpleSplineEdge, 0);
addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream);
// Add the curvedEdge constructor functions to the hash tables
curvedEdge::addIstreamConstructorToTable<simpleSplineEdge>
addSimpleSplineEdgeIstreamConstructorToTable_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -29,6 +29,9 @@ Description
#include "argList.H" #include "argList.H"
#include "dictionary.H" #include "dictionary.H"
#include "IFstream.H"
#include "IOobject.H"
#include "HashSet.H"
using namespace Foam; using namespace Foam;
@ -38,18 +41,108 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::noParallel(); argList::noParallel();
argList::validOptions.insert("new", "");
argList::validOptions.insert("old", "");
wordList ds(debug::debugSwitches().toc()); Foam::argList args(argc, argv);
sort(ds);
Info<< "debug switches: " << ds << endl; wordList currDebug(debug::debugSwitches().toc());
wordList currInfo(debug::infoSwitches().toc());
wordList currOpt(debug::optimisationSwitches().toc());
if (args.options().found("old") || args.options().found("new"))
{
dictionary controlDict(IFstream(findEtcFile("controlDict", true))());
wordHashSet oldDebug
(
controlDict.subDict("DebugSwitches").toc()
);
wordHashSet oldInfo
(
controlDict.subDict("InfoSwitches").toc()
);
wordHashSet oldOpt
(
controlDict.subDict("OptimisationSwitches").toc()
);
wordHashSet hashset;
wordList listing;
// list old switches - but this can't work since the (old) inserted
// switches are in both sets
// Workaround:
// 1. run without any options (get complete list)
// 2. comment out DebugSwitches, run again with -new to find new ones
// and do a diff
if (args.options().found("old"))
{
IOobject::writeDivider(Info);
hashset = oldDebug;
hashset -= currDebug;
listing = hashset.toc();
sort(listing);
Info<< "old DebugSwitches: " << listing << endl;
hashset = oldInfo;
hashset -= currInfo;
listing = hashset.toc();
sort(listing);
Info<< "old InfoSwitches: " << listing << endl;
hashset = oldOpt;
hashset -= currOpt;
listing = hashset.toc();
sort(listing);
Info<< "old OptimisationSwitches: " << listing << endl;
}
// list new switches
if (args.options().found("new"))
{
IOobject::writeDivider(Info);
hashset = currDebug;
hashset -= oldDebug;
listing = hashset.toc();
sort(listing);
Info<< "new DebugSwitches: " << listing << endl;
hashset = currInfo;
hashset -= oldInfo;
listing = hashset.toc();
sort(listing);
Info<< "new InfoSwitches: " << listing << endl;
hashset = currOpt;
hashset -= oldOpt;
listing = hashset.toc();
sort(listing);
Info<< "new OptimisationSwitches: " << listing << endl;
}
}
else
{
IOobject::writeDivider(Info);
sort(currDebug);
Info<< "DebugSwitches: " << currDebug << endl;
sort(currInfo);
Info<< "InfoSwitches: " << currInfo << endl;
sort(currOpt);
Info<< "OptimisationSwitches: " << currOpt << endl;
}
wordList is(debug::infoSwitches().toc());
sort(is);
Info<< "info switches: " << is << endl;
wordList os(debug::optimisationSwitches().toc());
sort(os);
Info<< "optimisation switches: " << os << endl;
Info<< "done" << endl; Info<< "done" << endl;

View File

@ -312,7 +312,7 @@ int main(int argc, char *argv[])
fileNameList cloudDirs fileNameList cloudDirs
( (
readDir(runTime.timePath()/"lagrangian", fileName::DIRECTORY) readDir(runTime.timePath()/cloud::prefix, fileName::DIRECTORY)
); );
// Particles // Particles
@ -344,7 +344,7 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
"lagrangian"/cloudDirs[i] cloud::prefix/cloudDirs[i]
); );
IOobject* positionsPtr = sprayObjs.lookup("positions"); IOobject* positionsPtr = sprayObjs.lookup("positions");
@ -418,7 +418,7 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
"lagrangian"/cloudDirs[cloudI] cloud::prefix/cloudDirs[cloudI]
); );
lagrangianFieldDecomposer::readFields lagrangianFieldDecomposer::readFields

View File

@ -88,7 +88,7 @@ tmp<IOField<Type> > lagrangianFieldDecomposer::decomposeField
( (
field.name(), field.name(),
procMesh_.time().timeName(), procMesh_.time().timeName(),
"lagrangian"/cloudName, cloud::prefix/cloudName,
procMesh_, procMesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -36,6 +36,7 @@ SourceFiles
#ifndef reconstructLagrangian_H #ifndef reconstructLagrangian_H
#define reconstructLagrangian_H #define reconstructLagrangian_H
#include "cloud.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "fvMesh.H" #include "fvMesh.H"

View File

@ -47,7 +47,7 @@ Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
( (
fieldName, fieldName,
mesh.time().timeName(), mesh.time().timeName(),
"lagrangian"/cloudName, cloud::prefix/cloudName,
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -64,7 +64,7 @@ Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
( (
fieldName, fieldName,
meshes[i].time().timeName(), meshes[i].time().timeName(),
"lagrangian"/cloudName, cloud::prefix/cloudName,
meshes[i], meshes[i],
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -282,7 +282,7 @@ int main(int argc, char *argv[])
( (
readDir readDir
( (
databases[procI].timePath()/regionPrefix/"lagrangian", databases[procI].timePath()/regionPrefix/cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
) )
); );
@ -300,7 +300,7 @@ int main(int argc, char *argv[])
( (
procMeshes.meshes()[procI], procMeshes.meshes()[procI],
databases[procI].timeName(), databases[procI].timeName(),
"lagrangian"/cloudDirs[i] cloud::prefix/cloudDirs[i]
); );
IOobject* positionsPtr = sprayObjs.lookup("positions"); IOobject* positionsPtr = sprayObjs.lookup("positions");

View File

@ -35,6 +35,7 @@ SourceFiles
#ifndef ensightCloudField_H #ifndef ensightCloudField_H
#define ensightCloudField_H #define ensightCloudField_H
#include "Cloud.H"
#include "IOobject.H" #include "IOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -211,7 +211,7 @@ int main(int argc, char *argv[])
fileNameList cloudDirs = readDir fileNameList cloudDirs = readDir
( (
runTime.timePath()/regionPrefix/"lagrangian", runTime.timePath()/regionPrefix/cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
); );
@ -221,7 +221,7 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
"lagrangian"/cloudDirs[cloudI] cloud::prefix/cloudDirs[cloudI]
); );
IOobject* positionsPtr = cloudObjs.lookup("positions"); IOobject* positionsPtr = cloudObjs.lookup("positions");
@ -266,7 +266,7 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
"lagrangian"/cloudIter.key() cloud::prefix/cloudIter.key()
); );
forAllConstIter(IOobjectList, cloudObjs, fieldIter) forAllConstIter(IOobjectList, cloudObjs, fieldIter)
@ -426,7 +426,7 @@ int main(int argc, char *argv[])
fileNameList currentCloudDirs = readDir fileNameList currentCloudDirs = readDir
( (
runTime.timePath()/regionPrefix/"lagrangian", runTime.timePath()/regionPrefix/cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
); );
@ -449,7 +449,7 @@ int main(int argc, char *argv[])
( (
fieldName, fieldName,
mesh.time().timeName(), mesh.time().timeName(),
"lagrangian"/cloudName, cloud::prefix/cloudName,
mesh, mesh,
IOobject::MUST_READ IOobject::MUST_READ
); );

View File

@ -42,7 +42,7 @@ forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
caseFile caseFile
<< setw(16) << "measured: 2" << setw(16) << "measured: 2"
<< fileName(dataMask/"lagrangian"/cloudName/"positions").c_str() << fileName(dataMask/cloud::prefix/cloudName/"positions").c_str()
<< nl; << nl;
} }
caseFile caseFile
@ -122,7 +122,7 @@ forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
ensightType, ensightType,
fieldName, fieldName,
dataMask, dataMask,
"lagrangian"/cloudName, cloud::prefix/cloudName,
cloudNo, cloudNo,
2 2
); );

View File

@ -27,7 +27,6 @@ License
#include "ensightOutputFunctions.H" #include "ensightOutputFunctions.H"
#include "passiveParticle.H" #include "passiveParticle.H"
#include "Cloud.H"
#include "IOField.H" #include "IOField.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
@ -101,7 +100,7 @@ void ensightParticlePositions
{ {
Cloud<passiveParticle> parcels(mesh, cloudName, false); Cloud<passiveParticle> parcels(mesh, cloudName, false);
fileName cloudDir = subDir/"lagrangian"/cloudName; fileName cloudDir = subDir/cloud::prefix/cloudName;
fileName postFileName = cloudDir/"positions"; fileName postFileName = cloudDir/"positions";
// the ITER/lagrangian subdirectory must exist // the ITER/lagrangian subdirectory must exist
@ -165,7 +164,7 @@ void ensightLagrangianField
{ {
Info<< " " << fieldObject.name() << flush; Info<< " " << fieldObject.name() << flush;
fileName cloudDir = subDir/"lagrangian"/cloudName; fileName cloudDir = subDir/cloud::prefix/cloudName;
fileName postFileName = cloudDir/fieldObject.name(); fileName postFileName = cloudDir/fieldObject.name();
string title = string title =

View File

@ -23,9 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description Description
Miscellaneous collection of functions and template related to Ensight data
miscellaneous collection of functions and template related
to Ensight data
SourceFiles SourceFiles
ensightOutputFunctions.C ensightOutputFunctions.C
@ -36,6 +34,7 @@ SourceFiles
#define ensightOutputFunctions_H #define ensightOutputFunctions_H
#include "ensightFile.H" #include "ensightFile.H"
#include "Cloud.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "IOobject.H" #include "IOobject.H"

View File

@ -36,7 +36,7 @@ if (timeDirs.size() > 1)
runTime.path() runTime.path()
/ timeDirs[timeDirs.size() - 1].name() / timeDirs[timeDirs.size() - 1].name()
/ regionPrefix / regionPrefix
/ "lagrangian", / cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
); );
@ -55,7 +55,7 @@ if (timeDirs.size() > 1)
( (
mesh, mesh,
timeDirs[timeDirs.size() - 1].name(), timeDirs[timeDirs.size() - 1].name(),
"lagrangian"/cloudName cloud::prefix/cloudName
); );
bool hasPositions = false; bool hasPositions = false;

View File

@ -324,7 +324,14 @@ int main(int argc, char *argv[])
{ {
const word& cloudName = cloudIter.key(); const word& cloudName = cloudIter.key();
if (!isDir(runTime.timePath()/regionPrefix/"lagrangian"/cloudName)) if
(
!isDir
(
runTime.timePath()/regionPrefix/
cloud::prefix/cloudName
)
)
{ {
continue; continue;
} }
@ -333,7 +340,7 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
"lagrangian"/cloudName cloud::prefix/cloudName
); );
// check that the positions field is present for this time // check that the positions field is present for this time
@ -365,7 +372,8 @@ int main(int argc, char *argv[])
if (!fieldObject) if (!fieldObject)
{ {
Info<< "missing " Info<< "missing "
<< runTime.timeName()/"lagrangian"/cloudName/fieldName << runTime.timeName()/cloud::prefix/cloudName
/ fieldName
<< endl; << endl;
continue; continue;
} }

View File

@ -21,7 +21,7 @@ List<IOField<vector>* > sprayVectorFieldPtrs
( (
sprayScalarNames[fieldI], sprayScalarNames[fieldI],
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -53,7 +53,7 @@ List<IOField<vector>* > sprayVectorFieldPtrs
( (
sprayVectorNames[fieldI], sprayVectorNames[fieldI],
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -42,7 +42,7 @@ forAll(Times, timeI)
// Same for spray // Same for spray
IOobjectList sprayObjects(mesh, runTime.timeName(), "lagrangian"); IOobjectList sprayObjects(mesh, runTime.timeName(), cloud::prefix);
{ {
wordList fieldNames(sprayObjects.names(scalarIOField::typeName)); wordList fieldNames(sprayObjects.names(scalarIOField::typeName));
forAll(fieldNames, fieldI) forAll(fieldNames, fieldI)

View File

@ -49,7 +49,7 @@ int main(int argc, char *argv[])
"volScalarField", "volScalarField",
"volVectorField", "volVectorField",
"surfaceScalarField", "surfaceScalarField",
"lagrangian" cloud::prefix
}; };
# include "setRootCase.H" # include "setRootCase.H"

View File

@ -1,12 +1,12 @@
for(label i=0; i < nTypes; i++) for (label i=0; i < nTypes; i++)
{ {
wordList fieldNames = objects.names(fieldTypes[i]); wordList fieldNames = objects.names(fieldTypes[i]);
if ( fieldTypes[i] == "volScalarField" ) if (fieldTypes[i] == "volScalarField")
{ {
gmvFile << "variable" << nl; gmvFile << "variable" << nl;
} }
for(label j=0; j < fieldNames.size(); j++) for (label j=0; j < fieldNames.size(); j++)
{ {
word fieldName = fieldNames[j]; word fieldName = fieldNames[j];
@ -20,7 +20,7 @@ for(label i=0; i < nTypes; i++)
IOobject::NO_WRITE IOobject::NO_WRITE
); );
if ( fieldTypes[i] == "volScalarField" ) if (fieldTypes[i] == "volScalarField")
{ {
volScalarField gmvScalarField(fieldObject, mesh); volScalarField gmvScalarField(fieldObject, mesh);
gmvFile << fieldName << " 0" << nl; gmvFile << fieldName << " 0" << nl;
@ -31,21 +31,21 @@ for(label i=0; i < nTypes; i++)
gmvFile << nl; gmvFile << nl;
} }
if ( fieldTypes[i] == "volVectorField" ) if (fieldTypes[i] == "volVectorField")
{ {
if (fieldName == vComp) if (fieldName == vComp)
{ {
volVectorField gmvVectorField(fieldObject, mesh); volVectorField gmvVectorField(fieldObject, mesh);
gmvFile << "velocity 0" << nl; gmvFile << "velocity 0" << nl;
for(label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvVectorField[indx].x() << " "; gmvFile << gmvVectorField[indx].x() << " ";
} }
for(label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvVectorField[indx].y() << " "; gmvFile << gmvVectorField[indx].y() << " ";
} }
for(label indx=0;indx<mesh.nCells();indx++) for (label indx=0;indx<mesh.nCells();indx++)
{ {
gmvFile << gmvVectorField[indx].z() << " "; gmvFile << gmvVectorField[indx].z() << " ";
} }
@ -53,20 +53,20 @@ for(label i=0; i < nTypes; i++)
} }
} }
if ( fieldTypes[i] == "surfaceScalarField" ) if (fieldTypes[i] == "surfaceScalarField")
{ {
// ... // ...
} }
} }
if ( fieldTypes[i] == "lagrangian") if (fieldTypes[i] == cloud::prefix)
{ {
IOobject lagrangianHeader IOobject lagrangianHeader
( (
"positions", "positions",
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
); );
@ -75,7 +75,7 @@ for(label i=0; i < nTypes; i++)
{ {
Cloud<passiveParticle> particles(mesh); Cloud<passiveParticle> particles(mesh);
IOobjectList objects(mesh, runTime.timeName(), "lagrangian"); IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
wordList lagrangianScalarNames = objects.names("scalarField"); wordList lagrangianScalarNames = objects.names("scalarField");
wordList lagrangianVectorNames = objects.names("vectorField"); wordList lagrangianVectorNames = objects.names("vectorField");
@ -87,7 +87,7 @@ for(label i=0; i < nTypes; i++)
} }
} }
if ( fieldTypes[i] == "volScalarField" ) if (fieldTypes[i] == "volScalarField")
{ {
gmvFile << "endvars" << nl; gmvFile << "endvars" << nl;
} }

View File

@ -42,7 +42,7 @@ forAll(lagrangianScalarNames, i)
( (
name, name,
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -73,7 +73,7 @@ forAll(lagrangianVectorNames, i)
( (
name, name,
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -40,7 +40,7 @@ forAll(lagrangianScalarNames, i)
( (
name, name,
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -914,7 +914,7 @@ int main(int argc, char *argv[])
( (
readDir readDir
( (
runTime.timePath()/regionPrefix/"lagrangian", runTime.timePath()/regionPrefix/cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
) )
); );
@ -925,18 +925,18 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
"lagrangian"/cloudDirs[i] cloud::prefix/cloudDirs[i]
); );
IOobject* positionsPtr = sprayObjs.lookup("positions"); IOobject* positionsPtr = sprayObjs.lookup("positions");
if (positionsPtr) if (positionsPtr)
{ {
mkDir(fvPath/"lagrangian"/cloudDirs[i]); mkDir(fvPath/cloud::prefix/cloudDirs[i]);
fileName lagrFileName fileName lagrFileName
( (
fvPath/"lagrangian"/cloudDirs[i]/cloudDirs[i] fvPath/cloud::prefix/cloudDirs[i]/cloudDirs[i]
+ "_" + name(timeI) + ".vtk" + "_" + name(timeI) + ".vtk"
); );

View File

@ -39,6 +39,7 @@ SourceFiles
#include "globalPointPatch.H" #include "globalPointPatch.H"
#include "OFstream.H" #include "OFstream.H"
#include "Cloud.H"
#include "volFields.H" #include "volFields.H"
#include "pointFields.H" #include "pointFields.H"
#include "vtkMesh.H" #include "vtkMesh.H"

View File

@ -41,7 +41,7 @@ void Foam::lagrangianWriter::writeIOField(const wordList& objects)
( (
object, object,
vMesh_.mesh().time().timeName(), vMesh_.mesh().time().timeName(),
"lagrangian"/cloudName_, cloud::prefix/cloudName_,
vMesh_.mesh(), vMesh_.mesh(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,

View File

@ -58,6 +58,11 @@ SourceFiles
#ifndef vtkPV3Foam_H #ifndef vtkPV3Foam_H
#define vtkPV3Foam_H #define vtkPV3Foam_H
// do not include legacy strstream headers
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
# define VTK_EXCLUDE_STRSTREAM_HEADERS
#endif
#include "className.H" #include "className.H"
#include "fileName.H" #include "fileName.H"
#include "stringList.H" #include "stringList.H"

View File

@ -266,7 +266,7 @@ void Foam::vtkPV3Foam::convertLagrangianFields
( (
mesh, mesh,
dbPtr_().timeName(), dbPtr_().timeName(),
"lagrangian"/cloudName cloud::prefix/cloudName
); );
pruneObjectList(objects, selectedFields); pruneObjectList(objects, selectedFields);

View File

@ -30,6 +30,8 @@ InClass
#ifndef vtkPV3FoamLagrangianFields_H #ifndef vtkPV3FoamLagrangianFields_H
#define vtkPV3FoamLagrangianFields_H #define vtkPV3FoamLagrangianFields_H
#include "Cloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>

View File

@ -53,7 +53,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::lagrangianVTKMesh - timePath " Info<< "<beg> Foam::vtkPV3Foam::lagrangianVTKMesh - timePath "
<< mesh.time().timePath()/"lagrangian"/cloudName << endl; << mesh.time().timePath()/cloud::prefix/cloudName << endl;
printMemory(); printMemory();
} }
@ -63,7 +63,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
( (
mesh, mesh,
mesh.time().timeName(), mesh.time().timeName(),
"lagrangian"/cloudName cloud::prefix/cloudName
); );
IOobject* positionsPtr = sprayObjs.lookup("positions"); IOobject* positionsPtr = sprayObjs.lookup("positions");

View File

@ -34,6 +34,7 @@ License
#include "IOPtrList.H" #include "IOPtrList.H"
#include "polyBoundaryMeshEntries.H" #include "polyBoundaryMeshEntries.H"
#include "entry.H" #include "entry.H"
#include "Cloud.H"
#include "vtkPV3FoamReader.h" #include "vtkPV3FoamReader.h"
// local headers // local headers
@ -148,16 +149,16 @@ void Foam::vtkPV3Foam::updateInfoLagrangian()
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::updateInfoLagrangian" << nl Info<< "<beg> Foam::vtkPV3Foam::updateInfoLagrangian" << nl
<< " " << dbPtr_->timePath()/"lagrangian" << endl; << " " << dbPtr_->timePath()/cloud::prefix << endl;
} }
// use the db directly since this might be called without a mesh, // use the db directly since this might be called without a mesh,
// but the region must get added back in // but the region must get added back in
fileName lagrangianPrefix("lagrangian"); fileName lagrangianPrefix(cloud::prefix);
if (meshRegion_ != polyMesh::defaultRegion) if (meshRegion_ != polyMesh::defaultRegion)
{ {
lagrangianPrefix = meshRegion_/"lagrangian"; lagrangianPrefix = meshRegion_/cloud::prefix;
} }
// Search for list of lagrangian objects for this time // Search for list of lagrangian objects for this time
@ -463,10 +464,10 @@ void Foam::vtkPV3Foam::updateInfoLagrangianFields()
// use the db directly since this might be called without a mesh, // use the db directly since this might be called without a mesh,
// but the region must get added back in // but the region must get added back in
fileName lagrangianPrefix("lagrangian"); fileName lagrangianPrefix(cloud::prefix);
if (meshRegion_ != polyMesh::defaultRegion) if (meshRegion_ != polyMesh::defaultRegion)
{ {
lagrangianPrefix = meshRegion_/"lagrangian"; lagrangianPrefix = meshRegion_/cloud::prefix;
} }
IOobjectList objects IOobjectList objects

View File

@ -137,7 +137,12 @@ int USERD_get_gold_part_build_info
if (Numparts_available > nPatches+1) if (Numparts_available > nPatches+1)
{ {
strncpy(part_descriptions[nPatches+1], sprayName.c_str(), Z_BUFL); strncpy
(
part_descriptions[nPatches+1],
cloud::prefix.c_str(),
Z_BUFL
);
number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size(); number_of_elements[nPatches+1][Z_POINT] = sprayPtr->size();
number_of_nodes[nPatches+1] = sprayPtr->size(); number_of_nodes[nPatches+1] = sprayPtr->size();
} }

View File

@ -164,7 +164,7 @@ int USERD_set_filenames
( (
"positions", "positions",
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
runTime, runTime,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
@ -179,7 +179,7 @@ int USERD_set_filenames
sprayPtr = new Cloud<passiveParticle>(*meshPtr); sprayPtr = new Cloud<passiveParticle>(*meshPtr);
IOobjectList objects(*meshPtr, runTime.timeName(), "lagrangian"); IOobjectList objects(*meshPtr, runTime.timeName(), cloud::prefix);
lagrangianScalarNames = lagrangianScalarNames =
(const wordList&)objects.names(sprayScalarFieldName); (const wordList&)objects.names(sprayScalarFieldName);

View File

@ -12,7 +12,7 @@ if (nVar >= 0)
( (
name, name,
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -14,7 +14,7 @@ if (nVar >= 0)
( (
name, name,
runTime.timeName(), runTime.timeName(),
"lagrangian", cloud::prefix,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -32,7 +32,6 @@ static bool isSpray[maxNames];
static word scalarName = "volScalarField"; static word scalarName = "volScalarField";
static word vectorName = "volVectorField"; static word vectorName = "volVectorField";
static word tensorName = "volTensorField"; static word tensorName = "volTensorField";
static word sprayName = "lagrangian";
static word sprayScalarFieldName = "scalarField"; static word sprayScalarFieldName = "scalarField";
static word sprayVectorFieldName = "vectorField"; static word sprayVectorFieldName = "vectorField";
static word sprayTensorFieldName = "tensorField"; static word sprayTensorFieldName = "tensorField";

View File

@ -39,10 +39,12 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
# include "addRegionOption.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H" # include "createNamedMesh.H"
IOprobes sniff IOprobes sniff
( (

View File

@ -2,6 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude -I$(LIB_SRC)/lagrangian/basic/lnInclude
@ -9,5 +10,6 @@ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lsampling \ -lsampling \
-lsurfMesh \
-ltriSurface \ -ltriSurface \
-llagrangian -llagrangian

View File

@ -40,6 +40,7 @@ Description
- dx : DX scalar or vector format - dx : DX scalar or vector format
- vtk : VTK ascii format - vtk : VTK ascii format
- raw : x y z value format for use with e.g. gnuplot 'splot'. - raw : x y z value format for use with e.g. gnuplot 'splot'.
- obj : Wavefron stl. Does not contain values!
- stl : ascii stl. Does not contain values! - stl : ascii stl. Does not contain values!
@param interpolationScheme : interpolation scheme, choice of \n @param interpolationScheme : interpolation scheme, choice of \n

View File

@ -30,7 +30,10 @@ setFormat raw;
// dx : DX scalar or vector format // dx : DX scalar or vector format
// vtk : VTK ascii format // vtk : VTK ascii format
// raw : x y z value format for use with e.g. gnuplot 'splot'. // raw : x y z value format for use with e.g. gnuplot 'splot'.
// stl : ascii stl. Does not contain values! //
// Note:
// other formats such as obj, stl, etc can also be written (by proxy)
// but without any values!
surfaceFormat vtk; surfaceFormat vtk;
// interpolationScheme. choice of // interpolationScheme. choice of

View File

@ -34,6 +34,7 @@ Description
#ifndef MapLagrangianFields_H #ifndef MapLagrangianFields_H
#define MapLagrangianFields_H #define MapLagrangianFields_H
#include "cloud.H"
#include "GeometricField.H" #include "GeometricField.H"
#include "meshToMesh.H" #include "meshToMesh.H"
#include "IOobjectList.H" #include "IOobjectList.H"
@ -60,8 +61,7 @@ void MapLagrangianFields
forAllIter(IOobjectList, fields, fieldIter) forAllIter(IOobjectList, fields, fieldIter)
{ {
Info<< " mapping lagrangian field " Info<< " mapping lagrangian field " << fieldIter()->name() << endl;
<< fieldIter()->name() << endl;
// Read field (does not need mesh) // Read field (does not need mesh)
IOField<Type> fieldSource(*fieldIter()); IOField<Type> fieldSource(*fieldIter());
@ -73,7 +73,7 @@ void MapLagrangianFields
( (
fieldIter()->name(), fieldIter()->name(),
meshTarget.time().timeName(), meshTarget.time().timeName(),
"lagrangian"/cloudName, cloud::prefix/cloudName,
meshTarget, meshTarget,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,

View File

@ -94,7 +94,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
( (
readDir readDir
( (
meshSource.time().timePath()/"lagrangian", meshSource.time().timePath()/cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
) )
); );
@ -106,7 +106,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
( (
meshSource, meshSource,
meshSource.time().timeName(), meshSource.time().timeName(),
"lagrangian"/cloudDirs[cloudI] cloud::prefix/cloudDirs[cloudI]
); );
IOobject* positionsPtr = objects.lookup("positions"); IOobject* positionsPtr = objects.lookup("positions");

View File

@ -271,13 +271,57 @@ int main(int argc, char *argv[])
args.caseName() args.caseName()
); );
// start with "constant"
runTime.setTime(instant(0, runTime.constant()), 0);
Info<< "runTime.instance() = " << runTime.instance() << endl;
Info<< "runTime.timeName() = " << runTime.timeName() << endl;
Info<< "write MeshedSurface 'yetAnother' via proxy as surfMesh"
<< endl;
surf.write
(
runTime,
"yetAnother"
);
surfMesh surfIn
(
IOobject
(
"default",
runTime.timeName(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
MeshedSurface<face> surfIn2(runTime, "foobar");
Info<<"surfIn2 = " << surfIn2.size() << endl;
Info<< "surfIn = " << surfIn.size() << endl;
Info<< "writing surfMesh as obj = oldSurfIn.obj" << endl;
surfIn.write("oldSurfIn.obj");
Info<< "runTime.instance() = " << runTime.instance() << endl;
surfMesh surfOut surfMesh surfOut
( (
IOobject IOobject
( (
"mySurf", "mySurf",
runTime.instance(), runTime.instance(),
runTime runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
), ),
surf.xfer() surf.xfer()
); );
@ -299,6 +343,25 @@ int main(int argc, char *argv[])
dimless dimless
); );
Info<<" surf name= " << surfOut.name() <<nl;
Info<< "rename to anotherSurf" << endl;
surfOut.rename("anotherSurf");
Info<<" surf name= " << surfOut.name() <<nl;
// advance time to 1
runTime.setTime(instant(1), 1);
surfOut.setInstance(runTime.timeName());
Info<< "writing surfMesh again well: " << surfOut.objectPath() << endl;
surfOut.write();
// write directly
surfOut.write("someName.ofs");
#if 1
const surfZoneList& zones = surfOut.surfZones(); const surfZoneList& zones = surfOut.surfZones();
forAll(zones, zoneI) forAll(zones, zoneI)
{ {
@ -318,9 +381,10 @@ int main(int argc, char *argv[])
( (
IOobject IOobject
( (
"pointIds", "zoneIds.",
// "pointIds",
surfOut.instance(), surfOut.instance(),
"pointFields", // "pointFields",
surfOut, surfOut,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -337,6 +401,10 @@ int main(int argc, char *argv[])
Info<< "write pointIds (for testing only): " Info<< "write pointIds (for testing only): "
<< pointIds.objectPath() << endl; << pointIds.objectPath() << endl;
pointIds.write(); pointIds.write();
Info<<"surfMesh with these names: " << surfOut.names() << endl;
#endif
} }
} }

View File

@ -34,6 +34,7 @@ Documentation
DebugSwitches DebugSwitches
{ {
Analytical 0;
APIdiffCoefFunc 0; APIdiffCoefFunc 0;
Ar 0; Ar 0;
BICCG 0; BICCG 0;
@ -57,18 +58,25 @@ DebugSwitches
C8H18 0; C8H18 0;
C9H20 0; C9H20 0;
CH3OH 0; CH3OH 0;
CallbackRegistry 0; CH4N2O 0;
CarnahanStarling 0; CarnahanStarling 0;
CallbackRegistry 0;
CentredFitData<biLinearFitPolynomial> 0;
CentredFitData<linearFitPolynomial> 0;
CentredFitData<quadraticFitPolynomial> 0;
CentredFitData<quadraticLinearFitPolynomial> 0;
ChomiakInjector 0; ChomiakInjector 0;
Cloud<basicKinematicParcel> 0;
Cloud<basicReactingParcel> 0;
Cloud<basicThermoParcel> 0;
Cloud<indexedParticle> 0; Cloud<indexedParticle> 0;
Cloud<kinematicParcel> 0;
Cloud<parcel> 0; Cloud<parcel> 0;
Cloud<passiveParticle> 0; Cloud<passiveParticle> 0;
Cloud<reactingParcel> 0;
Cloud<thermoParcel> 0;
Cloud<trackedParticle> 0; Cloud<trackedParticle> 0;
CoEuler 0; CoEuler 0;
CompositionModel 0; CompositionModel 0;
ConeInjection 0;
Constant 0;
ConstantRateDevolatilisation 0; ConstantRateDevolatilisation 0;
CrankNicholson 0; CrankNicholson 0;
CrossPowerLaw 0; CrossPowerLaw 0;
@ -77,6 +85,7 @@ DebugSwitches
DICGaussSeidel 0; DICGaussSeidel 0;
DILU 0; DILU 0;
DILUGaussSeidel 0; DILUGaussSeidel 0;
DataEntry 0;
DeardorffDiffStress 0; DeardorffDiffStress 0;
DispersionModel 0; DispersionModel 0;
DispersionRASModel 0; DispersionRASModel 0;
@ -107,39 +116,40 @@ DebugSwitches
H2O 0; H2O 0;
HashTable 0; HashTable 0;
HeatTransferModel 0; HeatTransferModel 0;
HerschelBulkley 0;
HrenyaSinclair 0; HrenyaSinclair 0;
IC8H18 0; IC8H18 0;
ICCG 0; ICCG 0;
IDDESDelta 0;
IDEA 0; IDEA 0;
IFstream 0; IFstream 0;
IOMap<dictionary> 0;
IOPtrList<MRFZone> 0; IOPtrList<MRFZone> 0;
IOPtrList<coordinateSystem> 0; IOPtrList<coordinateSystem> 0;
IOPtrList<injector> 0; IOPtrList<injector> 0;
IOPtrList<porousZone> 0; IOPtrList<porousZone> 0;
IOobject 0; IOobject 0;
InjectionModel 0; InjectionModel 0;
IntegrationScheme 0;
JohnsonJackson 0; JohnsonJackson 0;
KRR4 0; KRR4 0;
KinematicCloud<kinematicParcel> 0; KinematicCloud<basicKinematicParcel> 0;
KinematicCloud<reactingParcel> 0; KinematicCloud<basicReactingParcel> 0;
KinematicCloud<thermoParcel> 0; KinematicCloud<basicThermoParcel> 0;
KinematicParcel<reactingParcel> 0; KinematicParcel<basicReactingParcel> 0;
KinematicParcel<thermoParcel> 0; KinematicParcel<basicThermoParcel> 0;
LESModel 0;
LESdelta 0; LESdelta 0;
LESfilter 0; LESfilter 0;
LESmodel 0;
LISA 0; LISA 0;
LRR 0; LRR 0;
LRRDiffStress 0; LRRDiffStress 0;
LamBremhorstKE 0; LamBremhorstKE 0;
LaunderGibsonRSTM 0; LaunderGibsonRSTM 0;
LaunderSharmaKE 0; LaunderSharmaKE 0;
LduMatrix 1;
LienCubicKE 0; LienCubicKE 0;
LienCubicKELowRe 0; LienCubicKELowRe 0;
LienLeschzinerLowRe 0; LienLeschzinerLowRe 0;
Lun 0;
LunSavage 0;
MB 0; MB 0;
MC 0; MC 0;
MCV 0; MCV 0;
@ -191,11 +201,12 @@ DebugSwitches
QUICK 0; QUICK 0;
QUICKV 0; QUICKV 0;
QZeta 0; QZeta 0;
RASModel 0;
RK 0; RK 0;
RNGkEpsilon 0; RNGkEpsilon 0;
RanzMarshall 0; RanzMarshall 0;
ReactingCloud<reactingParcel> 0; ReactingCloud<basicReactingParcel> 0;
ReactingParcel<reactingParcel> 0; ReactingParcel<basicReactingParcel> 0;
Rebound 0; Rebound 0;
ReitzDiwakar 0; ReitzDiwakar 0;
ReitzKHRT 0; ReitzKHRT 0;
@ -208,6 +219,8 @@ DebugSwitches
SIBS 0; SIBS 0;
SKA 0; SKA 0;
SLTS 0; SLTS 0;
SRFModel 0;
SRFVelocity 0;
STARCDRotation 0; STARCDRotation 0;
Schaeffer 0; Schaeffer 0;
SchillerNaumann 0; SchillerNaumann 0;
@ -215,8 +228,9 @@ DebugSwitches
SingleKineticRateDevolatilisation 0; SingleKineticRateDevolatilisation 0;
SingleMixtureFraction 0; SingleMixtureFraction 0;
Smagorinsky 0; Smagorinsky 0;
SmoothSolver 0;
SpalartAllmaras 0; SpalartAllmaras 0;
SpalartAllmarasDDES 0;
SpalartAllmarasIDDES 0;
SphereDrag 0; SphereDrag 0;
StandardWallInteraction 0; StandardWallInteraction 0;
StaticHashTable 0; StaticHashTable 0;
@ -228,13 +242,17 @@ DebugSwitches
SyamlalOBrien 0; SyamlalOBrien 0;
SyamlalRogersOBrien 0; SyamlalRogersOBrien 0;
TAB 0; TAB 0;
ThermoCloud<reactingParcel> 0; Table 0;
ThermoCloud<thermoParcel> 0; ThermoCloud<basicReactingParcel> 0;
ThermoParcel<reactingParcel> 0; ThermoCloud<basicThermoParcel> 0;
ThermoParcel<thermoParcel> 0; ThermoParcel<basicReactingParcel> 0;
ThermoParcel<basicThermoParcel> 0;
UMIST 0; UMIST 0;
UMISTV 0; UMISTV 0;
Unix 0; Unix 0;
UpwindFitData<cubicUpwindFitPolynomial> 0;
UpwindFitData<quadraticLinearUpwindFitPolynomial> 0;
UpwindFitData<quadraticUpwindFitPolynomial> 0;
WallInteractionModel 0; WallInteractionModel 0;
WenYu 0; WenYu 0;
aC11H10 0; aC11H10 0;
@ -245,6 +263,9 @@ DebugSwitches
addPoint 0; addPoint 0;
advective 0; advective 0;
algebraicPair 0; algebraicPair 0;
alphaContactAngle 0;
alphaFixedPressure 0;
alphatWallFunction 0;
angularOscillatingDisplacement 0; angularOscillatingDisplacement 0;
angularOscillatingVelocity 0; angularOscillatingVelocity 0;
anisotropic 0; anisotropic 0;
@ -252,14 +273,21 @@ DebugSwitches
atomizationModel 0; atomizationModel 0;
attachDetach 0; attachDetach 0;
autoHexMeshDriver 0; autoHexMeshDriver 0;
autoLayerDriver 0;
autoRefineDriver 0;
autoSnapDriver 0;
bC11H10 0; bC11H10 0;
backward 0; backward 0;
basePatch 0; basePatch 0;
basicKinematicCloud 0; basicKinematicCloud 0;
basicKinematicParcel 0;
basicMixture 0; basicMixture 0;
basicReactingCloud 0; basicReactingCloud 0;
basicReactingParcel 0;
basicThermo 0; basicThermo 0;
basicThermoCloud 0; basicThermoCloud 0;
basicThermoParcel 0;
biLinearFit 0;
binaryAbsorptionEmission 0; binaryAbsorptionEmission 0;
blended 0; blended 0;
blobsSheetAtomization 0; blobsSheetAtomization 0;
@ -274,7 +302,6 @@ DebugSwitches
boxToPoint 0; boxToPoint 0;
breakupModel 0; breakupModel 0;
calculated 0; calculated 0;
cartesian 0;
cell 0; cell 0;
cellClassification 0; cellClassification 0;
cellCuts 0; cellCuts 0;
@ -292,6 +319,8 @@ DebugSwitches
cellToFace 0; cellToFace 0;
cellToPoint 0; cellToPoint 0;
cellZone 0; cellZone 0;
centredCECStencil 0;
centredCFCStencil 0;
chemistryReader 0; chemistryReader 0;
chemistrySolver 0; chemistrySolver 0;
chemkinReader 0; chemkinReader 0;
@ -304,24 +333,25 @@ DebugSwitches
commSchedule 0; commSchedule 0;
commonRailInjector 0; commonRailInjector 0;
compound 0; compound 0;
conductivityModel 0;
constInjector 0; constInjector 0;
constant 0; constant 0;
constantAbsorptionEmission 0; constantAbsorptionEmission 0;
constantGammaContactAngle 0; constantAlphaContactAngle 0;
constantScatter 0; constantScatter 0;
coordinateRotation 0; coordinateRotation 0;
coordinateSystem 0; coordinateSystem 0;
coordinateSystems 0;
corrected 0; corrected 0;
coupled 0; coupled 0;
cubeRootVol 0; cubeRootVol 0;
cubic 0; cubic 0;
cubicUpwindFit 0;
curve 0; curve 0;
cyclic 0; cyclic 0;
cyclicLduInterface 0; cyclicLduInterface 0;
cyclicLduInterfaceField 0; cyclicLduInterfaceField 0;
cylinderToCell 0;
cylindrical 0; cylindrical 0;
dataSchedule 0;
decompositionMethod 0; decompositionMethod 0;
definedHollowConeInjector 0; definedHollowConeInjector 0;
definedInjector 0; definedInjector 0;
@ -332,6 +362,7 @@ DebugSwitches
dimensionSet 1; dimensionSet 1;
directMapped 0; directMapped 0;
directMappedPatch 0; directMappedPatch 0;
directMappedVelocityFlux 0;
directionMixed 0; directionMixed 0;
directional 0; directional 0;
disallowDefaultFvsPatchField 0; disallowDefaultFvsPatchField 0;
@ -345,6 +376,7 @@ DebugSwitches
displacementInterpolation 0; displacementInterpolation 0;
displacementLaplacian 0; displacementLaplacian 0;
displacementSBRStress 0; displacementSBRStress 0;
distanceSurface 0;
downwind 0; downwind 0;
dragModel 0; dragModel 0;
duplicatePoints 0; duplicatePoints 0;
@ -352,8 +384,8 @@ DebugSwitches
dynMixedSmagorinsky 0; dynMixedSmagorinsky 0;
dynOneEqEddy 0; dynOneEqEddy 0;
dynSmagorinsky 0; dynSmagorinsky 0;
dynamicAlphaContactAngle 0;
dynamicFvMesh 0; dynamicFvMesh 0;
dynamicGammaContactAngle 0;
dynamicInkJetFvMesh 0; dynamicInkJetFvMesh 0;
dynamicMotionSolverFvMesh 0; dynamicMotionSolverFvMesh 0;
dynamicRefineFvMesh 0; dynamicRefineFvMesh 0;
@ -363,6 +395,7 @@ DebugSwitches
empty 0; empty 0;
engineMesh 0; engineMesh 0;
enrichedPatch 0; enrichedPatch 0;
epsilonWallFunction 0;
errorDrivenRefinement 0; errorDrivenRefinement 0;
evaporationModel 0; evaporationModel 0;
exponential 0; exponential 0;
@ -387,13 +420,20 @@ DebugSwitches
filteredLinear 0; filteredLinear 0;
filteredLinear2 0; filteredLinear2 0;
filteredLinear2V 0; filteredLinear2V 0;
filteredLinear3 0;
filteredLinear3V 0;
fixedEnthalpy 0; fixedEnthalpy 0;
fixedFluxBuoyantPressure 0; fixedFluxBuoyantPressure 0;
fixedFluxBoussinesqBuoyantPressure 0;
fixedFluxPressure 0; fixedFluxPressure 0;
fixedGradient 0; fixedGradient 0;
fixedInternalEnergy 0;
fixedInternalValue 0;
fixedNormalSlip 0; fixedNormalSlip 0;
fixedPressureCompressibleDensity 0;
fixedUnburntEnthalpy 0; fixedUnburntEnthalpy 0;
fixedValue 0; fixedValue 0;
flowRateInletVelocity 0;
fluxCorrectedVelocity 0; fluxCorrectedVelocity 0;
foamChemistryReader 0; foamChemistryReader 0;
foamFile 0; foamFile 0;
@ -416,8 +456,6 @@ DebugSwitches
fvTensorMatrix 0; fvTensorMatrix 0;
fvVectorMatrix 0; fvVectorMatrix 0;
fvsPatchField 0; fvsPatchField 0;
gammaContactAngle 0;
gammaFixedPressure 0;
general 0; general 0;
generic 0; generic 0;
genericPatch 0; genericPatch 0;
@ -429,6 +467,7 @@ DebugSwitches
gnuplot 0; gnuplot 0;
gradientDispersionRAS 0; gradientDispersionRAS 0;
gradientEnthalpy 0; gradientEnthalpy 0;
gradientInternalEnergy 0;
gradientUnburntEnthalpy 0; gradientUnburntEnthalpy 0;
granularPressureModel 0; granularPressureModel 0;
hCombustionThermo 0; hCombustionThermo 0;
@ -459,25 +498,29 @@ DebugSwitches
hhuMixtureThermo<veryInhomogeneousMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>> 0; hhuMixtureThermo<veryInhomogeneousMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>> 0;
hierarchical 0; hierarchical 0;
hollowConeInjector 0; hollowConeInjector 0;
iC3H8O 0;
indexedOctree 0; indexedOctree 0;
indexedParticle 0; indexedParticle 0;
injectorModel 0; injectorModel 0;
injectorType 0; injectorType 0;
inletOutlet 0; inletOutlet 0;
inletOutletTotalTemperature 0; inletOutletTotalTemperature 0;
inputMode 0;
interfaceCompression 0; interfaceCompression 0;
intersectedSurface 0; intersectedSurface 0;
inverseDistance 0; inverseDistance 0;
inverseFaceDistance 0; inverseFaceDistance 0;
inversePointDistance 0; inversePointDistance 0;
inverseVolume 0; inverseVolume 0;
isoSurface 0;
isoSurfaceCell 0;
jplot 0; jplot 0;
jumpCyclic 0; jumpCyclic 0;
kEpsilon 0; kEpsilon 0;
kOmega 0;
kOmegaSST 0; kOmegaSST 0;
kOmegaSSTSAS 0;
kQRWallFunction 0;
kinematicCloud 0; kinematicCloud 0;
kinematicParcel 0;
labelField 0; labelField 0;
labelList 0; labelList 0;
labelListList 0; labelListList 0;
@ -496,6 +539,7 @@ DebugSwitches
leastSquares 0; leastSquares 0;
leastSquaresVectors 0; leastSquaresVectors 0;
level 2; level 2;
limitWith 0;
limited 0; limited 0;
limitedCubic 0; limitedCubic 0;
limitedCubic01 0; limitedCubic01 0;
@ -510,6 +554,7 @@ DebugSwitches
limitedSurfaceInterpolationScheme 0; limitedSurfaceInterpolationScheme 0;
limitedVanLeer 0; limitedVanLeer 0;
linear 0; linear 0;
linearFit 0;
linearUpwind 0; linearUpwind 0;
linearUpwindV 0; linearUpwindV 0;
liquid 0; liquid 0;
@ -520,7 +565,6 @@ DebugSwitches
localPointRegion 0; localPointRegion 0;
lowReOneEqEddy 0; lowReOneEqEddy 0;
manual 0; manual 0;
massFlowRateInletVelocity 0;
meshCutAndRemove 0; meshCutAndRemove 0;
meshCutter 0; meshCutter 0;
meshModifier 0; meshModifier 0;
@ -532,6 +576,7 @@ DebugSwitches
midPointAndFace 0; midPointAndFace 0;
mixed 0; mixed 0;
mixedEnthalpy 0; mixedEnthalpy 0;
mixedInternalEnergy 0;
mixedSmagorinsky 0; mixedSmagorinsky 0;
mixedUnburntEnthalpy 0; mixedUnburntEnthalpy 0;
mixerFvMesh 0; mixerFvMesh 0;
@ -544,22 +589,32 @@ DebugSwitches
motionSolver 0; motionSolver 0;
movingConeTopoFvMesh 0; movingConeTopoFvMesh 0;
movingWallVelocity 0; movingWallVelocity 0;
muSgsWallFunction 0; muSgsSpalartAllmarasWallFunction 0;
multiDirRefinement 0; multiDirRefinement 0;
multiHoleInjector 0;
multivariateSelection 0; multivariateSelection 0;
mutStandardRoughWallFunction 0; mutRoughWallFunction 0;
mutSpalartAllmarasStandardRoughWallFunction 0;
mutSpalartAllmarasStandardWallFunction 0;
mutSpalartAllmarasWallFunction 0;
mutWallFunction 0;
nC3H8O 0;
nbrToCell 0; nbrToCell 0;
nearestToCell 0; nearestToCell 0;
nearestToPoint 0;
noAbsorptionEmission 0; noAbsorptionEmission 0;
noDragModel 0; noDragModel 0;
noRadiation 0; noRadiation 0;
none 0; none 0;
normal 0; normal 0;
normalToFace 0; normalToFace 0;
nuSgsWallFunction 0; nuSgsSpalartAllmarasWallFunction 0;
nutStandardRoughWallFunction 0; nutRoughWallFunction 0;
nutStandardWallFunction 0; nutSpalartAllmarasStandardRoughWallFunction 0;
nutSpalartAllmarasStandardWallFunction 0;
nutSpalartAllmarasWallFunction 0;
nutWallFunction 0; nutWallFunction 0;
obj 0;
objectRegistry 0; objectRegistry 0;
octree 0; octree 0;
octreeDataEdges 0; octreeDataEdges 0;
@ -567,7 +622,7 @@ DebugSwitches
octreeDataFaceList 0; octreeDataFaceList 0;
octreeDataTriSurface 0; octreeDataTriSurface 0;
off 0; off 0;
offsetTriSurfaceMesh 0; omegaWallFunction 0;
oneEqEddy 0; oneEqEddy 0;
orientedSurface 0; orientedSurface 0;
oscillatingDisplacement 0; oscillatingDisplacement 0;
@ -609,11 +664,13 @@ DebugSwitches
polyMeshInfo 0; polyMeshInfo 0;
polyTopoChange 0; polyTopoChange 0;
polyTopoChanger 0; polyTopoChanger 0;
powerLaw 0;
pressureDirectedInletOutletVelocity 0; pressureDirectedInletOutletVelocity 0;
pressureDirectedInletVelocity 0; pressureDirectedInletVelocity 0;
pressureInletOutletVelocity 0; pressureInletOutletVelocity 0;
pressureInletUniformVelocity 0; pressureInletUniformVelocity 0;
pressureInletVelocity 0; pressureInletVelocity 0;
pressureNormalInletOutletVelocity 0;
pressureSwirlInjector 0; pressureSwirlInjector 0;
primitiveMesh 0; primitiveMesh 0;
primitiveMeshGeometry 0; primitiveMeshGeometry 0;
@ -625,11 +682,13 @@ DebugSwitches
pureMixture<sutherlandTransport<specieThermo<hConstThermo<perfectGas>>>> 0; pureMixture<sutherlandTransport<specieThermo<hConstThermo<perfectGas>>>> 0;
pureMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>> 0; pureMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>> 0;
quadratic 0; quadratic 0;
radialModel 0; quadraticFit 0;
quadraticLinearFit 0;
quadraticLinearUpwindFit 0;
quadraticUpwindFit 0;
radiationModel 0; radiationModel 0;
raw 0; raw 0;
reactingCloud 0; reactingCloud 0;
reactingParcel 0;
reaction 0; reaction 0;
realizableKE 0; realizableKE 0;
refinementHistory 0; refinementHistory 0;
@ -637,6 +696,7 @@ DebugSwitches
reflect 0; reflect 0;
regIOobject 0; regIOobject 0;
regionSplit 0; regionSplit 0;
regionToCell 0;
remove 0; remove 0;
removeCell 0; removeCell 0;
removeCells 0; removeCells 0;
@ -720,11 +780,12 @@ DebugSwitches
tensorAverageField 0; tensorAverageField 0;
tensorField 0; tensorField 0;
thermoCloud 0; thermoCloud 0;
thermoParcel 0;
thermophysicalFunction 0; thermophysicalFunction 0;
time 0; time 0;
timeVaryingGammaContactAngle 0; timeVaryingAlphaContactAngle 0;
timeVaryingFlowRateInletVelocity 0;
timeVaryingMappedFixedValue 0; timeVaryingMappedFixedValue 0;
timeVaryingTotalPressure 0;
timeVaryingUniformFixedValue 0; timeVaryingUniformFixedValue 0;
timer 0; timer 0;
topoAction 0; topoAction 0;
@ -745,17 +806,19 @@ DebugSwitches
treeNode 0; treeNode 0;
triSurface 0; triSurface 0;
triSurfaceMesh 0; triSurfaceMesh 0;
triSurfaceMeshes 0;
turbulenceModel 0; turbulenceModel 0;
turbulentHeatFluxTemperature 0;
turbulentInlet 0; turbulentInlet 0;
turbulentIntensityKineticEnergyInlet 0; turbulentIntensityKineticEnergyInlet 0;
turbulentMixingLengthDissipationRateInlet 0; turbulentMixingLengthDissipationRateInlet 0;
turbulentMixingLengthFrequencyInlet 0;
uncorrected 0; uncorrected 0;
undoableMeshCutter 0; undoableMeshCutter 0;
uniform 0; uniform 0;
uniformFixedValue 0; uniformFixedValue 0;
unitInjector 0; unitInjector 0;
upwind 0; upwind 0;
upwindCFCStencil 0;
value 0; value 0;
vanAlbada 0; vanAlbada 0;
vanAlbadaV 0; vanAlbadaV 0;
@ -828,7 +891,6 @@ DimensionedConstants
//- Stefan-Boltzmann constant [J/(K4 m2 s)] //- Stefan-Boltzmann constant [J/(K4 m2 s)]
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08; sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08;
/* USCS units /* USCS units
//- Universal gas constant [lbm ft2/(s2 kmol R)] //- Universal gas constant [lbm ft2/(s2 kmol R)]

View File

@ -87,8 +87,8 @@ switch ("$compilerInstall")
case OpenFOAM: case OpenFOAM:
switch ("$WM_COMPILER") switch ("$WM_COMPILER")
case Gcc: case Gcc:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
breaksw breaksw
case Gcc42: case Gcc42:

View File

@ -111,8 +111,8 @@ case "$compilerInstall" in
OpenFOAM) OpenFOAM)
case "$WM_COMPILER" in case "$WM_COMPILER" in
Gcc) Gcc)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
;; ;;
Gcc42) Gcc42)

View File

@ -152,17 +152,12 @@ inline void Foam::FixedList<T, Size>::checkSize(const label size) const
} }
// Check index i is within valid range (0 ... size-1). // Check index i is within valid range (0 ... size-1)
// The check for zero-sized list is already done in static assert
template<class T, unsigned Size> template<class T, unsigned Size>
inline void Foam::FixedList<T, Size>::checkIndex(const label i) const inline void Foam::FixedList<T, Size>::checkIndex(const label i) const
{ {
if (!Size) if (i < 0 || unsigned(i) >= Size)
{
FatalErrorIn("FixedList<T, Size>::checkIndex(const label)")
<< "attempt to access element from zero-sized list"
<< abort(FatalError);
}
else if (i < 0 || i >= label(Size))
{ {
FatalErrorIn("FixedList<T, Size>::checkIndex(const label)") FatalErrorIn("FixedList<T, Size>::checkIndex(const label)")
<< "index " << i << " out of range 0 ... " << (Size-1) << "index " << i << " out of range 0 ... " << (Size-1)

View File

@ -58,10 +58,6 @@ Foam::List<T>::List(const label s)
{ {
this->v_ = new T[this->size_]; this->v_ = new T[this->size_];
} }
else
{
this->v_ = 0;
}
} }
@ -87,10 +83,6 @@ Foam::List<T>::List(const label s, const T& a)
List_ELEM((*this), vp, i) = a; List_ELEM((*this), vp, i) = a;
List_END_FOR_ALL List_END_FOR_ALL
} }
else
{
this->v_ = 0;
}
} }
@ -119,16 +111,12 @@ Foam::List<T>::List(const List<T>& a)
List_END_FOR_ALL List_END_FOR_ALL
} }
} }
else
{
this->v_ = 0;
}
} }
// Construct by transferring the parameter contents // Construct by transferring the parameter contents
template<class T> template<class T>
Foam::List<T>::List(const Xfer<List<T> >& lst) Foam::List<T>::List(const Xfer< List<T> >& lst)
{ {
transfer(lst()); transfer(lst());
} }
@ -165,10 +153,6 @@ Foam::List<T>::List(List<T>& a, bool reUse)
List_END_FOR_ALL List_END_FOR_ALL
} }
} }
else
{
this->v_ = 0;
}
} }
@ -188,10 +172,6 @@ Foam::List<T>::List(const UList<T>& a, const unallocLabelList& map)
List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i])); List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i]));
List_END_FOR_ALL List_END_FOR_ALL
} }
else
{
this->v_ = 0;
}
} }
@ -234,7 +214,7 @@ Foam::List<T>::List(const FixedList<T, Size>& lst)
: :
UList<T>(NULL, Size) UList<T>(NULL, Size)
{ {
if (Size) if (this->size_)
{ {
this->v_ = new T[this->size_]; this->v_ = new T[this->size_];
@ -243,10 +223,6 @@ Foam::List<T>::List(const FixedList<T, Size>& lst)
this->operator[](i) = lst[i]; this->operator[](i) = lst[i];
} }
} }
else
{
this->v_ = 0;
}
} }
@ -265,10 +241,6 @@ Foam::List<T>::List(const PtrList<T>& lst)
this->operator[](i) = lst[i]; this->operator[](i) = lst[i];
} }
} }
else
{
this->v_ = 0;
}
} }
@ -293,10 +265,6 @@ Foam::List<T>::List(const SLList<T>& lst)
this->operator[](i++) = iter(); this->operator[](i++) = iter();
} }
} }
else
{
this->v_ = 0;
}
} }
@ -315,10 +283,6 @@ Foam::List<T>::List(const IndirectList<T>& lst)
this->operator[](i) = lst[i]; this->operator[](i) = lst[i];
} }
} }
else
{
this->v_ = 0;
}
} }
@ -337,10 +301,6 @@ Foam::List<T>::List(const UIndirectList<T>& lst)
this->operator[](i) = lst[i]; this->operator[](i) = lst[i];
} }
} }
else
{
this->v_ = 0;
}
} }
@ -359,10 +319,6 @@ Foam::List<T>::List(const BiIndirectList<T>& lst)
this->operator[](i) = lst[i]; this->operator[](i) = lst[i];
} }
} }
else
{
this->v_ = 0;
}
} }

View File

@ -26,8 +26,8 @@ Class
Foam::UIndirectList Foam::UIndirectList
Description Description
A List with indirect addressing. Like IndirectList but does not store A List with indirect addressing.
addressing. Like IndirectList but does not store addressing.
SourceFiles SourceFiles
UIndirectListI.H UIndirectListI.H
@ -44,6 +44,10 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators
template<class T> class UIndirectList;
template<class T> Ostream& operator<<(Ostream&, const UIndirectList<T>&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class UIndirectList Declaration Class UIndirectList Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -92,6 +96,17 @@ public:
//- Assignment of all entries to the given value //- Assignment of all entries to the given value
inline void operator=(const T&); inline void operator=(const T&);
// Ostream operator
//- Write UIndirectList to Ostream
// Binary output is currently still a bit of a problem
friend Ostream& operator<<
#ifndef __CINT__
<T>
#endif
(Ostream&, const UIndirectList<T>&);
}; };
@ -103,6 +118,10 @@ public:
#include "UIndirectListI.H" #include "UIndirectListI.H"
#ifdef NoRepository
# include "UIndirectListIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "UIndirectList.H"
#include "Ostream.H"
#include "token.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class T>
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::UIndirectList<T>& L
)
{
// Write list contents depending on data format
if (os.format() == IOstream::ASCII || !contiguous<T>())
{
bool uniform = false;
if (L.size() > 1 && contiguous<T>())
{
uniform = true;
forAll(L, i)
{
if (L[i] != L[0])
{
uniform = false;
break;
}
}
}
if (uniform)
{
// Write size and start delimiter
os << L.size() << token::BEGIN_BLOCK;
// Write contents
os << L[0];
// Write end delimiter
os << token::END_BLOCK;
}
else if (L.size() < 11 && contiguous<T>())
{
// Write size and start delimiter
os << L.size() << token::BEGIN_LIST;
// Write contents
forAll(L, i)
{
if (i) os << token::SPACE;
os << L[i];
}
// Write end delimiter
os << token::END_LIST;
}
else
{
// Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST;
// Write contents
forAll(L, i)
{
os << nl << L[i];
}
// Write end delimiter
os << nl << token::END_LIST << nl;
}
}
else
{
// this is annoying, and wasteful, but there's currently no alternative
os << nl << L.size() << nl;
if (L.size())
{
List<T> lst = L();
os.write
(
reinterpret_cast<const char*>(lst.cdata()),
lst.byteSize()
);
}
}
// Check state of IOstream
os.check("Ostream& operator<<(Ostream&, const UIndirectList&)");
return os;
}
// ************************************************************************* //

View File

@ -359,6 +359,10 @@ public:
template<class Stream> template<class Stream>
static inline Stream& writeDivider(Stream& os); static inline Stream& writeDivider(Stream& os);
//- Write the standard end file divider
template<class Stream>
static inline Stream& writeEndDivider(Stream& os);
//- Write header //- Write header
bool writeHeader(Ostream&) const; bool writeHeader(Ostream&) const;

View File

@ -82,5 +82,14 @@ inline Stream& Foam::IOobject::writeDivider(Stream& os)
return os; return os;
} }
template<class Stream>
inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
{
os << "\n\n"
"// ************************************************************************* //\n";
return os;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -45,7 +45,7 @@ namespace Foam
{ {
//- Read a hex label from an input stream //- Read a hex label from an input stream
label readHexLabel(ISstream& is); label readHexLabel(ISstream&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,16 +36,16 @@ const char* const Foam::instant::typeName = "instant";
Foam::instant::instant() Foam::instant::instant()
{} {}
Foam::instant::instant(const scalar tval, const word& tname) Foam::instant::instant(const scalar val, const word& tname)
: :
value_(tval), value_(val),
name_(tname) name_(tname)
{} {}
Foam::instant::instant(const scalar tval) Foam::instant::instant(const scalar val)
: :
value_(tval), value_(val),
name_(Time::timeName(tval)) name_(Time::timeName(val))
{} {}
Foam::instant::instant(const word& tname) Foam::instant::instant(const word& tname)
@ -57,20 +57,19 @@ Foam::instant::instant(const word& tname)
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
int Foam::operator==(const instant& I1, const instant& I2) bool Foam::operator==(const instant& a, const instant& b)
{ {
return return
( (
I1.value_ < I2.value_ + SMALL a.value_ < b.value_ + SMALL
&& I1.value_ > I2.value_ - SMALL && a.value_ > b.value_ - SMALL
); );
} }
int Foam::operator != (const instant& I1, const instant& I2) bool Foam::operator!=(const instant& a, const instant& b)
{ {
// Invert the '==' operator ('0'='false') return !operator==(a, b);
return I1 == I2 ? 0 : 1;
} }

View File

@ -50,8 +50,8 @@ class instant;
// Friend Operators // Friend Operators
int operator==(const instant&, const instant&); bool operator==(const instant&, const instant&);
int operator!=(const instant&, const instant&); bool operator!=(const instant&, const instant&);
// IOstream Operators // IOstream Operators
@ -79,9 +79,9 @@ public:
{ {
public: public:
bool operator()(const instant& one, const instant& two) const bool operator()(const instant& a, const instant& b) const
{ {
return one.value() < two.value(); return a.value() < b.value();
} }
}; };
@ -137,8 +137,8 @@ public:
// Friend Operators // Friend Operators
friend int operator==(const instant&, const instant&); friend bool operator==(const instant&, const instant&);
friend int operator!=(const instant&, const instant&); friend bool operator!=(const instant&, const instant&);
// IOstream Operators // IOstream Operators

View File

@ -117,12 +117,7 @@ Foam::dictionary::dictionary
name_(dict.name()), name_(dict.name()),
parent_(parentDict) parent_(parentDict)
{ {
for forAllIter(IDLList<entry>, *this, iter)
(
IDLList<entry>::iterator iter = begin();
iter != end();
++iter
)
{ {
hashedEntries_.insert(iter().keyword(), &iter()); hashedEntries_.insert(iter().keyword(), &iter());
@ -147,12 +142,7 @@ Foam::dictionary::dictionary
name_(dict.name()), name_(dict.name()),
parent_(dictionary::null) parent_(dictionary::null)
{ {
for forAllIter(IDLList<entry>, *this, iter)
(
IDLList<entry>::iterator iter = begin();
iter != end();
++iter
)
{ {
hashedEntries_.insert(iter().keyword(), &iter()); hashedEntries_.insert(iter().keyword(), &iter());
@ -238,12 +228,7 @@ Foam::SHA1Digest Foam::dictionary::digest() const
OSHA1stream os; OSHA1stream os;
// process entries // process entries
for forAllConstIter(IDLList<entry>, *this, iter)
(
IDLList<entry>::const_iterator iter = begin();
iter != end();
++iter
)
{ {
os << *iter; os << *iter;
} }
@ -262,7 +247,8 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
{ {
if (patternEntries_.size()) if (patternEntries_.size())
{ {
DLList<entry*>::const_iterator wcLink = patternEntries_.begin(); DLList<entry*>::const_iterator wcLink =
patternEntries_.begin();
DLList<autoPtr<regExp> >::const_iterator reLink = DLList<autoPtr<regExp> >::const_iterator reLink =
patternRegexps_.begin(); patternRegexps_.begin();
@ -475,12 +461,7 @@ Foam::wordList Foam::dictionary::toc() const
wordList keys(size()); wordList keys(size());
label nKeys = 0; label nKeys = 0;
for forAllConstIter(IDLList<entry>::const_iterator, *this, iter)
(
IDLList<entry>::const_iterator iter = begin();
iter != end();
++iter
)
{ {
keys[nKeys++] = iter().keyword(); keys[nKeys++] = iter().keyword();
} }
@ -494,12 +475,7 @@ Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
List<keyType> keys(size()); List<keyType> keys(size());
label nKeys = 0; label nKeys = 0;
for forAllConstIter(IDLList<entry>, *this, iter)
(
IDLList<entry>::const_iterator iter = begin();
iter != end();
++iter
)
{ {
if (iter().keyword().isPattern() ? patterns : !patterns) if (iter().keyword().isPattern() ? patterns : !patterns)
{ {
@ -665,8 +641,10 @@ bool Foam::dictionary::remove(const word& Keyword)
if (iter != hashedEntries_.end()) if (iter != hashedEntries_.end())
{ {
// Delete from patterns first // Delete from patterns first
DLList<entry*>::iterator wcLink = patternEntries_.begin(); DLList<entry*>::iterator wcLink =
DLList<autoPtr<regExp> >::iterator reLink = patternRegexps_.begin(); patternEntries_.begin();
DLList<autoPtr<regExp> >::iterator reLink =
patternRegexps_.begin();
// Find in pattern using exact match only // Find in pattern using exact match only
if (findInPatterns(false, Keyword, wcLink, reLink)) if (findInPatterns(false, Keyword, wcLink, reLink))
@ -792,12 +770,7 @@ bool Foam::dictionary::merge(const dictionary& dict)
bool changed = false; bool changed = false;
for forAllConstIter(IDLList<entry>, *this, iter)
(
IDLList<entry>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
HashTable<entry*>::iterator fnd = hashedEntries_.find(iter().keyword()); HashTable<entry*>::iterator fnd = hashedEntries_.find(iter().keyword());
@ -882,12 +855,7 @@ void Foam::dictionary::operator=(const dictionary& rhs)
// Create clones of the entries in the given dictionary // Create clones of the entries in the given dictionary
// resetting the parentDict to this dictionary // resetting the parentDict to this dictionary
for forAllConstIter(IDLList<entry>, rhs, iter)
(
IDLList<entry>::const_iterator iter = rhs.begin();
iter != rhs.end();
++iter
)
{ {
add(iter().clone(*this).ptr()); add(iter().clone(*this).ptr());
} }
@ -904,12 +872,7 @@ void Foam::dictionary::operator+=(const dictionary& rhs)
<< abort(FatalError); << abort(FatalError);
} }
for forAllConstIter(IDLList<entry>, rhs, iter)
(
IDLList<entry>::const_iterator iter = rhs.begin();
iter != rhs.end();
++iter
)
{ {
add(iter().clone(*this).ptr()); add(iter().clone(*this).ptr());
} }
@ -926,12 +889,7 @@ void Foam::dictionary::operator|=(const dictionary& rhs)
<< abort(FatalError); << abort(FatalError);
} }
for forAllConstIter(IDLList<entry>, rhs, iter)
(
IDLList<entry>::const_iterator iter = rhs.begin();
iter != rhs.end();
++iter
)
{ {
if (!found(iter().keyword())) if (!found(iter().keyword()))
{ {
@ -951,12 +909,7 @@ void Foam::dictionary::operator<<=(const dictionary& rhs)
<< abort(FatalError); << abort(FatalError);
} }
for forAllConstIter(IDLList<entry>, rhs, iter)
(
IDLList<entry>::const_iterator iter = rhs.begin();
iter != rhs.end();
++iter
)
{ {
set(iter().clone(*this).ptr()); set(iter().clone(*this).ptr());
} }

View File

@ -154,12 +154,8 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
// Write entry // Write entry
os << e; os << e;
// Add new line if applicable // Add extra new line between entries for "top-level" dictionaries
if if (!subDict && parent() == dictionary::null && e != *last())
(
(e.isDict() || (!e.isDict() && parent()==dictionary::null))
&& e != *last()
)
{ {
os << nl; os << nl;
} }
@ -167,7 +163,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
// Check stream before going to next entry. // Check stream before going to next entry.
if (!os.good()) if (!os.good())
{ {
WarningIn("dictionary::write(Ostream& os, bool subDict)") WarningIn("dictionary::write(Ostream&, bool subDict)")
<< "Can't write entry " << iter().keyword() << "Can't write entry " << iter().keyword()
<< " for dictionary " << name() << " for dictionary " << name()
<< endl; << endl;

View File

@ -103,14 +103,13 @@ bool Foam::functionEntry::execute
is.fatalCheck is.fatalCheck
( (
"functionEntry::execute" "functionEntry::execute"
"(const word& functionName, const dictionary& parentDict, " "(const word&, const dictionary&, primitiveEntry&, Istream&)"
"primitiveEntry&, Istream&)"
); );
if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_) if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
{ {
cerr<<"functionEntry::execute" cerr<<"functionEntry::execute"
<< "(const word&, dictionary&, primitiveEntry&, Istream&)" << "(const word&, const dictionary&, primitiveEntry&, Istream&)"
<< " not yet initialized, function = " << " not yet initialized, function = "
<< functionName.c_str() << std::endl; << functionName.c_str() << std::endl;
@ -126,8 +125,7 @@ bool Foam::functionEntry::execute
FatalErrorIn FatalErrorIn
( (
"functionEntry::execute" "functionEntry::execute"
"(const word& functionName, const dictionary& parentDict, " "(const word&, const dictionary&, primitiveEntry&, Istream&)"
"primitiveEntry&, Istream&)"
) << "Unknown functionEntry " << functionName ) << "Unknown functionEntry " << functionName
<< endl << endl << endl << endl
<< "Valid functionEntries are :" << endl << "Valid functionEntries are :" << endl

View File

@ -95,7 +95,7 @@ public:
( (
const word& functionName, const word& functionName,
dictionary& parentDict, dictionary& parentDict,
Istream& is Istream&
); );
declareMemberFunctionSelectionTable declareMemberFunctionSelectionTable
@ -117,8 +117,8 @@ public:
( (
const word& functionName, const word& functionName,
const dictionary& parentDict, const dictionary& parentDict,
primitiveEntry& entry, primitiveEntry&,
Istream& is Istream&
); );

View File

@ -62,8 +62,7 @@ namespace functionEntries
} }
} }
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::fileName Foam::functionEntries::includeEntry::includeFileName Foam::fileName Foam::functionEntries::includeEntry::includeFileName
( (
@ -73,6 +72,7 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
fileName fName(is); fileName fName(is);
fName.expand(); fName.expand();
// relative name
if (fName.size() && fName[0] != '/') if (fName.size() && fName[0] != '/')
{ {
fName = fileName(is.name()).path()/fName; fName = fileName(is.name()).path()/fName;
@ -82,17 +82,19 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionEntries::includeEntry::execute bool Foam::functionEntries::includeEntry::execute
( (
dictionary& parentDict, dictionary& parentDict,
Istream& is Istream& is
) )
{ {
IFstream fileStream(includeFileName(is)); IFstream ifs(includeFileName(is));
if (fileStream) if (ifs)
{ {
parentDict.read(fileStream); parentDict.read(ifs);
return true; return true;
} }
else else
@ -100,9 +102,9 @@ bool Foam::functionEntries::includeEntry::execute
FatalIOErrorIn FatalIOErrorIn
( (
"functionEntries::includeEntry::includeEntry" "functionEntries::includeEntry::includeEntry"
"(dictionary& parentDict,Istream& is)", "(dictionary& parentDict, Istream&)",
is is
) << "Cannot open include file " << fileStream.name() ) << "Cannot open include file " << ifs.name()
<< " while reading dictionary " << parentDict.name() << " while reading dictionary " << parentDict.name()
<< exit(FatalIOError); << exit(FatalIOError);
@ -117,11 +119,11 @@ bool Foam::functionEntries::includeEntry::execute
Istream& is Istream& is
) )
{ {
IFstream fileStream(includeFileName(is)); IFstream ifs(includeFileName(is));
if (fileStream) if (ifs)
{ {
entry.read(parentDict, fileStream); entry.read(parentDict, ifs);
return true; return true;
} }
else else
@ -129,9 +131,9 @@ bool Foam::functionEntries::includeEntry::execute
FatalIOErrorIn FatalIOErrorIn
( (
"functionEntries::includeEntry::includeEntry" "functionEntries::includeEntry::includeEntry"
"(dictionary& parentDict, primitiveEntry& entry, Istream& is)", "(dictionary& parentDict, primitiveEntry& entry, Istream&)",
is is
) << "Cannot open include file " << fileStream.name() ) << "Cannot open include file " << ifs.name()
<< " while reading dictionary " << parentDict.name() << " while reading dictionary " << parentDict.name()
<< exit(FatalIOError); << exit(FatalIOError);

View File

@ -68,7 +68,7 @@ class includeEntry
// Private Member Functions // Private Member Functions
//- Read the include fileName from Istream, expand and return //- Read the include fileName from Istream, expand and return
static fileName includeFileName(Istream& is); static fileName includeFileName(Istream&);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
includeEntry(const includeEntry&); includeEntry(const includeEntry&);
@ -86,18 +86,14 @@ public:
// Member Functions // Member Functions
//- Execute the functionEntry in a sub-dict context //- Execute the functionEntry in a sub-dict context
static bool execute static bool execute(dictionary& parentDict, Istream&);
(
dictionary& parentDict,
Istream& is
);
//- Execute the functionEntry in a primitiveEntry context //- Execute the functionEntry in a primitiveEntry context
static bool execute static bool execute
( (
const dictionary& parentDict, const dictionary& parentDict,
primitiveEntry& entry, primitiveEntry&,
Istream& is Istream&
); );
}; };

View File

@ -39,6 +39,9 @@ const Foam::word Foam::functionEntries::inputModeEntry::typeName
// might include inputModeEntries // might include inputModeEntries
int Foam::functionEntries::inputModeEntry::debug(0); int Foam::functionEntries::inputModeEntry::debug(0);
Foam::functionEntries::inputModeEntry::inputMode
Foam::functionEntries::inputModeEntry::mode_(MERGE);
namespace Foam namespace Foam
{ {
namespace functionEntries namespace functionEntries
@ -53,10 +56,6 @@ namespace functionEntries
} }
} }
// * * * * * * * * * * * * * * * * Private Data * * * * * * * * * * * * * * //
Foam::label Foam::functionEntries::inputModeEntry::mode_ = imError;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// we could combine this into execute() directly, but leave it here for now // we could combine this into execute() directly, but leave it here for now
@ -65,17 +64,17 @@ void Foam::functionEntries::inputModeEntry::setMode(Istream& is)
clear(); clear();
word mode(is); word mode(is);
if (mode == "merge") if (mode == "merge" || mode == "default")
{ {
mode_ = imMerge; mode_ = MERGE;
} }
else if (mode == "overwrite") else if (mode == "overwrite")
{ {
mode_ = imOverwrite; mode_ = OVERWRITE;
} }
else if (mode == "error" || mode == "default") else if (mode == "error")
{ {
mode_ = imError; mode_ = ERROR;
} }
else else
{ {
@ -101,33 +100,19 @@ bool Foam::functionEntries::inputModeEntry::execute
void Foam::functionEntries::inputModeEntry::clear() void Foam::functionEntries::inputModeEntry::clear()
{ {
mode_ = imError; mode_ = MERGE;
} }
bool Foam::functionEntries::inputModeEntry::merge() bool Foam::functionEntries::inputModeEntry::merge()
{ {
if (mode_ & imMerge) return mode_ == MERGE;
{
return true;
}
else
{
return false;
}
} }
bool Foam::functionEntries::inputModeEntry::overwrite() bool Foam::functionEntries::inputModeEntry::overwrite()
{ {
if (mode_ & imOverwrite) return mode_ == OVERWRITE;
{
return true;
}
else
{
return false;
}
} }

View File

@ -38,7 +38,7 @@ Description
@param merge merge sub-dictionaries when possible @param merge merge sub-dictionaries when possible
@param overwrite keep last entry and silently remove previous ones @param overwrite keep last entry and silently remove previous ones
@param error flag duplicate entry as an error @param error flag duplicate entry as an error
@param default currently the same as error @param default currently the same as merge
SourceFiles SourceFiles
inputModeEntry.C inputModeEntry.C
@ -68,13 +68,13 @@ class inputModeEntry
//- input mode options //- input mode options
enum inputMode enum inputMode
{ {
imError = 0, ERROR,
imMerge = 0x1, MERGE,
imOverwrite = 0x2 OVERWRITE
}; };
//- current input mode //- current input mode
static label mode_; static inputMode mode_;
// Private Member Functions // Private Member Functions
@ -98,19 +98,15 @@ public:
// Member Functions // Member Functions
//- Execute the functionEntry in a sub-dict context //- Execute the functionEntry in a sub-dict context
static bool execute static bool execute(dictionary& parentDict, Istream&);
(
dictionary& parentDict,
Istream&
);
//- Reset the inputMode to 'default' //- Reset the inputMode to %default
static void clear(); static void clear();
//- Return true if the inputMode is 'merge' //- Return true if the inputMode is %merge
static bool merge(); static bool merge();
//- Return true if the inputMode is 'overwrite' //- Return true if the inputMode is %overwrite
static bool overwrite(); static bool overwrite();
}; };

View File

@ -80,11 +80,7 @@ public:
// Member Functions // Member Functions
//- Execute the functionEntry in a sub-dict context //- Execute the functionEntry in a sub-dict context
static bool execute static bool execute(dictionary& parentDict, Istream&);
(
dictionary& parentDict,
Istream& is
);
}; };

View File

@ -101,7 +101,7 @@ Foam::wordList Foam::objectRegistry::names() const
wordList objectNames(size()); wordList objectNames(size());
label count=0; label count=0;
for (const_iterator iter = begin(); iter != end(); ++iter) for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{ {
objectNames[count++] = iter()->name(); objectNames[count++] = iter()->name();
} }
@ -115,7 +115,7 @@ Foam::wordList Foam::objectRegistry::names(const word& ClassName) const
wordList objectNames(size()); wordList objectNames(size());
label count=0; label count=0;
for (const_iterator iter = begin(); iter != end(); ++iter) for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{ {
if (iter()->type() == ClassName) if (iter()->type() == ClassName)
{ {
@ -234,15 +234,33 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
<< " in registry " << name() << " in registry " << name()
<< endl; << endl;
} }
}
return false; return false;
}
void Foam::objectRegistry::rename(const word& newName)
{
regIOobject::rename(newName);
// adjust dbDir_ as well
string::size_type i = dbDir_.rfind('/');
if (i == string::npos)
{
dbDir_ = newName;
}
else
{
dbDir_.replace(i+1, string::npos, newName);
} }
} }
bool Foam::objectRegistry::modified() const bool Foam::objectRegistry::modified() const
{ {
for (const_iterator iter = begin(); iter != end(); ++iter) for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{ {
if (iter()->modified()) if (iter()->modified())
{ {
@ -287,7 +305,7 @@ bool Foam::objectRegistry::writeObject
{ {
bool ok = true; bool ok = true;
for (const_iterator iter = begin(); iter != end(); ++iter) for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{ {
if (objectRegistry::debug) if (objectRegistry::debug)
{ {

View File

@ -160,6 +160,9 @@ public:
// Edit // Edit
//- Rename
virtual void rename(const word& newName);
//- Add an regIOobject to registry //- Add an regIOobject to registry
bool checkIn(regIOobject&) const; bool checkIn(regIOobject&) const;

View File

@ -147,8 +147,7 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
} }
} }
const Type* dummyPtr_ = NULL; return *reinterpret_cast< const Type* >(0);
return *dummyPtr_;
} }

View File

@ -103,9 +103,7 @@ bool Foam::regIOobject::writeObject
return false; return false;
} }
os << "\n\n" writeEndDivider(os);
"// ************************************************************************* //"
<< endl;
osGood = os.good(); osGood = os.good();
} }

View File

@ -41,7 +41,7 @@ Description
(baseType,thisType,argNames) \ (baseType,thisType,argNames) \
\ \
/* Add the thisType constructor function to the table */ \ /* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType> \ baseType::add##argNames##ConstructorToTable< thisType > \
add##thisType##argNames##ConstructorTo##baseType##Table_ add##thisType##argNames##ConstructorTo##baseType##Table_
@ -50,7 +50,7 @@ Description
(baseType,thisType,argNames,lookup) \ (baseType,thisType,argNames,lookup) \
\ \
/* Add the thisType constructor function to the table, find by lookup */ \ /* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType> \ baseType::add##argNames##ConstructorToTable< thisType > \
add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_(#lookup) add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,7 +62,7 @@ Description
(baseType,thisType,Targ,argNames) \ (baseType,thisType,Targ,argNames) \
\ \
/* Add the thisType constructor function to the table */ \ /* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ> > \ baseType::add##argNames##ConstructorToTable< thisType< Targ > > \
add##thisType##Targ##argNames##ConstructorTo##baseType##Table_ add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
@ -72,7 +72,7 @@ Description
(baseType,thisType,Targ,argNames,lookup) \ (baseType,thisType,Targ,argNames,lookup) \
\ \
/* Add the thisType constructor function to the table, find by lookup */ \ /* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ> > \ baseType::add##argNames##ConstructorToTable< thisType< Targ > > \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Table_(#lookup) add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Table_(#lookup)
@ -85,7 +85,7 @@ Description
(baseType,thisType,Targ,argNames) \ (baseType,thisType,Targ,argNames) \
\ \
/* Add the thisType constructor function to the table */ \ /* Add the thisType constructor function to the table */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ> > \ baseType< Targ >::add##argNames##ConstructorToTable< thisType< Targ > > \
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_ add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
@ -95,7 +95,7 @@ Description
(baseType,thisType,Targ,argNames,lookup) \ (baseType,thisType,Targ,argNames,lookup) \
\ \
/* Add the thisType constructor function to the table, find by lookup */ \ /* Add the thisType constructor function to the table, find by lookup */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ> > \ baseType< Targ >::add##argNames##ConstructorToTable< thisType< Targ > > \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_(#lookup) add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_(#lookup)

View File

@ -54,24 +54,24 @@ Description
(autoPtr,baseType,argNames,argList,parList) \ (autoPtr,baseType,argNames,argList,parList) \
\ \
/* Construct from argList function pointer type */ \ /* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \ typedef autoPtr< baseType > (*argNames##ConstructorPtr)argList; \
\ \
/* Construct from argList function table type */ \ /* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \ typedef HashTable< argNames##ConstructorPtr, word, string::hash > \
argNames##ConstructorTable; \ argNames##ConstructorTable; \
\ \
/* Construct from argList function pointer table pointer */ \ /* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \ static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\ \
/* Class to add constructor from argList to table */ \ /* Class to add constructor from argList to table */ \
template<class baseType##Type> \ template< class baseType##Type > \
class add##argNames##ConstructorToTable \ class add##argNames##ConstructorToTable \
{ \ { \
public: \ public: \
\ \
static autoPtr<baseType> New argList \ static autoPtr< baseType > New argList \
{ \ { \
return autoPtr<baseType>(new baseType##Type parList); \ return autoPtr< baseType >(new baseType##Type parList); \
} \ } \
\ \
add##argNames##ConstructorToTable \ add##argNames##ConstructorToTable \
@ -103,24 +103,24 @@ Description
(autoPtr,baseType,argNames,argList,parList) \ (autoPtr,baseType,argNames,argList,parList) \
\ \
/* Construct from argList function pointer type */ \ /* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \ typedef autoPtr< baseType > (*argNames##ConstructorPtr)argList; \
\ \
/* Construct from argList function table type */ \ /* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \ typedef HashTable< argNames##ConstructorPtr, word, string::hash > \
argNames##ConstructorTable; \ argNames##ConstructorTable; \
\ \
/* Construct from argList function pointer table pointer */ \ /* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \ static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\ \
/* Class to add constructor from argList to table */ \ /* Class to add constructor from argList to table */ \
template<class baseType##Type> \ template< class baseType##Type > \
class add##argNames##ConstructorToTable \ class add##argNames##ConstructorToTable \
{ \ { \
public: \ public: \
\ \
static autoPtr<baseType> New##baseType argList \ static autoPtr< baseType > New##baseType argList \
{ \ { \
return autoPtr<baseType>(baseType##Type::New parList.ptr()); \ return autoPtr< baseType >(baseType##Type::New parList.ptr()); \
} \ } \
\ \
add##argNames##ConstructorToTable \ add##argNames##ConstructorToTable \
@ -213,7 +213,7 @@ Description
(baseType,argNames) \ (baseType,argNames) \
\ \
defineRunTimeSelectionTablePtr(baseType,argNames); \ defineRunTimeSelectionTablePtr(baseType,argNames); \
defineRunTimeSelectionTableConstructor(baseType,argNames) \ defineRunTimeSelectionTableConstructor(baseType,argNames); \
defineRunTimeSelectionTableDestructor(baseType,argNames) defineRunTimeSelectionTableDestructor(baseType,argNames)
@ -227,7 +227,7 @@ Description
template<> \ template<> \
defineRunTimeSelectionTablePtr(baseType,argNames); \ defineRunTimeSelectionTablePtr(baseType,argNames); \
template<> \ template<> \
defineRunTimeSelectionTableConstructor(baseType,argNames) \ defineRunTimeSelectionTableConstructor(baseType,argNames); \
template<> \ template<> \
defineRunTimeSelectionTableDestructor(baseType,argNames) defineRunTimeSelectionTableDestructor(baseType,argNames)
@ -242,14 +242,14 @@ Description
(baseType,argNames,Targ) \ (baseType,argNames,Targ) \
\ \
/* Table constructor called from the table add function */ \ /* Table constructor called from the table add function */ \
void baseType<Targ>::construct##argNames##ConstructorTables() \ void baseType< Targ >::construct##argNames##ConstructorTables() \
{ \ { \
static bool constructed = false; \ static bool constructed = false; \
\ \
if (!constructed) \ if (!constructed) \
{ \ { \
baseType<Targ>::argNames##ConstructorTablePtr_ \ baseType< Targ >::argNames##ConstructorTablePtr_ \
= new baseType<Targ>::argNames##ConstructorTable; \ = new baseType< Targ >::argNames##ConstructorTable; \
\ \
constructed = true; \ constructed = true; \
} \ } \
@ -263,12 +263,12 @@ Description
(baseType,argNames,Targ) \ (baseType,argNames,Targ) \
\ \
/* Table destructor called from the table add function destructor */ \ /* Table destructor called from the table add function destructor */ \
void baseType<Targ>::destroy##argNames##ConstructorTables() \ void baseType< Targ >::destroy##argNames##ConstructorTables() \
{ \ { \
if (baseType<Targ>::argNames##ConstructorTablePtr_) \ if (baseType< Targ >::argNames##ConstructorTablePtr_) \
{ \ { \
delete baseType<Targ>::argNames##ConstructorTablePtr_; \ delete baseType< Targ >::argNames##ConstructorTablePtr_; \
baseType<Targ>::argNames##ConstructorTablePtr_ = NULL; \ baseType< Targ >::argNames##ConstructorTablePtr_ = NULL; \
} \ } \
} }
@ -280,8 +280,8 @@ Description
(baseType,argNames,Targ) \ (baseType,argNames,Targ) \
\ \
/* Define the constructor function table */ \ /* Define the constructor function table */ \
baseType<Targ>::argNames##ConstructorTable* \ baseType< Targ >::argNames##ConstructorTable* \
baseType<Targ>::argNames##ConstructorTablePtr_ = NULL baseType< Targ >::argNames##ConstructorTablePtr_ = NULL
// external use: // external use:
@ -294,7 +294,7 @@ Description
template<> \ template<> \
defineTemplatedRunTimeSelectionTablePtr(baseType,argNames,Targ); \ defineTemplatedRunTimeSelectionTablePtr(baseType,argNames,Targ); \
template<> \ template<> \
defineTemplatedRunTimeSelectionTableConstructor(baseType,argNames,Targ) \ defineTemplatedRunTimeSelectionTableConstructor(baseType,argNames,Targ); \
template<> \ template<> \
defineTemplatedRunTimeSelectionTableDestructor(baseType,argNames,Targ) defineTemplatedRunTimeSelectionTableDestructor(baseType,argNames,Targ)

View File

@ -44,13 +44,13 @@ Description
// Without debug information // Without debug information
#define ClassNameNoDebug(TypeNameString) \ #define ClassNameNoDebug(TypeNameString) \
static const char* typeName_() { return TypeNameString; } \ static const char* typeName_() { return TypeNameString; } \
static const ::Foam::word typeName; static const ::Foam::word typeName
//- Add typeName information from argument @a TypeNameString to a namespace. //- Add typeName information from argument @a TypeNameString to a namespace.
// Without debug information. // Without debug information.
#define NamespaceNameNoDebug(TypeNameString) \ #define NamespaceNameNoDebug(TypeNameString) \
inline const char* typeName_() { return TypeNameString; } \ inline const char* typeName_() { return TypeNameString; } \
extern const ::Foam::word typeName; extern const ::Foam::word typeName
//- Add typeName information from argument @a TemplateNameString to a template class. //- Add typeName information from argument @a TemplateNameString to a template class.
// Without debug information. // Without debug information.
@ -60,7 +60,7 @@ class TemplateNameString##Name \
public: \ public: \
TemplateNameString##Name() {} \ TemplateNameString##Name() {} \
ClassNameNoDebug(#TemplateNameString); \ ClassNameNoDebug(#TemplateNameString); \
}; }
@ -89,7 +89,7 @@ class TemplateNameString##Name \
public: \ public: \
TemplateNameString##Name() {} \ TemplateNameString##Name() {} \
ClassName(#TemplateNameString); \ ClassName(#TemplateNameString); \
}; }
@ -100,30 +100,30 @@ public: \
//- Define the typeName, with alternative lookup as @a Name //- Define the typeName, with alternative lookup as @a Name
#define defineTypeNameWithName(Type, Name) \ #define defineTypeNameWithName(Type, Name) \
const ::Foam::word Type::typeName(Name); const ::Foam::word Type::typeName(Name)
//- Define the typeName //- Define the typeName
#define defineTypeName(Type) \ #define defineTypeName(Type) \
defineTypeNameWithName(Type, Type::typeName_()); defineTypeNameWithName(Type, Type::typeName_())
#ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER
//- Define the typeName as @a Name for template classes //- Define the typeName as @a Name for template classes
# define defineTemplateTypeNameWithName(Type, Name) \ # define defineTemplateTypeNameWithName(Type, Name) \
defineTypeNameWithName(Type, Name); defineTypeNameWithName(Type, Name)
#else #else
//- Define the typeName as @a Name for template classes //- Define the typeName as @a Name for template classes
# define defineTemplateTypeNameWithName(Type, Name) \ # define defineTemplateTypeNameWithName(Type, Name) \
template<> \ template<> \
defineTypeNameWithName(Type, Name); defineTypeNameWithName(Type, Name)
#endif #endif
//- Define the typeName for template classes, useful with typedefs //- Define the typeName for template classes, useful with typedefs
#define defineTemplateTypeName(Type) \ #define defineTemplateTypeName(Type) \
defineTemplateTypeNameWithName(Type, #Type); defineTemplateTypeNameWithName(Type, #Type)
//- Define the typeName directly for template classes //- Define the typeName directly for template classes
#define defineNamedTemplateTypeName(Type) \ #define defineNamedTemplateTypeName(Type) \
defineTemplateTypeNameWithName(Type, Type::typeName_()); defineTemplateTypeNameWithName(Type, Type::typeName_())
@ -134,31 +134,31 @@ public: \
//- Define the debug information, lookup as @a Name //- Define the debug information, lookup as @a Name
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \ #define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch)); int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
//- Define the debug information //- Define the debug information
#define defineDebugSwitch(Type, DebugSwitch) \ #define defineDebugSwitch(Type, DebugSwitch) \
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
#ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER
//- Define the debug information for templates, lookup as @a Name //- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ # define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(Type, Name, DebugSwitch); defineDebugSwitchWithName(Type, Name, DebugSwitch)
#else #else
//- Define the debug information for templates, lookup as @a Name //- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ # define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
template<> \ template<> \
defineDebugSwitchWithName(Type, Name, DebugSwitch); defineDebugSwitchWithName(Type, Name, DebugSwitch)
#endif #endif
//- Define the debug information for templates //- Define the debug information for templates
// Useful with typedefs // Useful with typedefs
#define defineTemplateDebugSwitch(Type, DebugSwitch) \ #define defineTemplateDebugSwitch(Type, DebugSwitch) \
defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch); defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch)
//- Define the debug information directly for templates //- Define the debug information directly for templates
#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \ #define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
@ -170,21 +170,21 @@ public: \
//- Define the typeName and debug information //- Define the typeName and debug information
#define defineTypeNameAndDebug(Type, DebugSwitch) \ #define defineTypeNameAndDebug(Type, DebugSwitch) \
defineTypeName(Type); \ defineTypeName(Type); \
defineDebugSwitch(Type, DebugSwitch); defineDebugSwitch(Type, DebugSwitch)
//- Define the typeName and debug information, lookup as @a Name //- Define the typeName and debug information, lookup as @a Name
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \ #define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \
defineTemplateTypeNameWithName(Type, Name); \ defineTemplateTypeNameWithName(Type, Name); \
defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch); defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the typeName and debug information for templates, useful with typedefs //- Define the typeName and debug information for templates, useful with typedefs
#define defineTemplateTypeNameAndDebug(Type, DebugSwitch) \ #define defineTemplateTypeNameAndDebug(Type, DebugSwitch) \
defineTemplateTypeNameAndDebugWithName(Type, #Type, DebugSwitch); defineTemplateTypeNameAndDebugWithName(Type, #Type, DebugSwitch)
//- Define the typeName and debug information for templates //- Define the typeName and debug information for templates
#define defineNamedTemplateTypeNameAndDebug(Type, DebugSwitch) \ #define defineNamedTemplateTypeNameAndDebug(Type, DebugSwitch) \
defineNamedTemplateTypeName(Type); \ defineNamedTemplateTypeName(Type); \
defineNamedTemplateDebugSwitch(Type, DebugSwitch); defineNamedTemplateDebugSwitch(Type, DebugSwitch)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,10 +29,10 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam defineTypeNameAndDebug(Foam::cloud, 0);
{
defineTypeNameAndDebug(cloud, 0); const Foam::word Foam::cloud::prefix("lagrangian");
} Foam::word Foam::cloud::defaultName("defaultCloud");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -42,9 +42,9 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
( (
IOobject IOobject
( (
cloudName, ( cloudName.size() ? cloudName : defaultName ),
obr.time().timeName(), obr.time().timeName(),
"lagrangian", prefix,
obr, obr,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE

View File

@ -69,15 +69,16 @@ public:
//- Runtime type information //- Runtime type information
TypeName("cloud"); TypeName("cloud");
//- The prefix to local: %lagrangian
static const word prefix;
//- The default cloud name: %defaultCloud
static word defaultName;
// Constructors // Constructors
//- Construct for the given objectRegistry and named cloud instance //- Construct for the given objectRegistry and named cloud instance
cloud cloud(const objectRegistry&, const word& cloudName = "");
(
const objectRegistry& obr,
const word& cloudName = "defaultCloud"
);
// Destructor // Destructor

View File

@ -162,10 +162,7 @@ bool Foam::solution::read()
relaxationFactors_ = dict.subDict("relaxationFactors"); relaxationFactors_ = dict.subDict("relaxationFactors");
} }
if (relaxationFactors_.found("default")) relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
{
relaxationFactors_.lookup("default") >> defaultRelaxationFactor_;
}
if (dict.found("solvers")) if (dict.found("solvers"))
{ {
@ -227,7 +224,7 @@ Foam::scalar Foam::solution::relaxationFactor(const word& name) const
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"Foam::solution::relaxationFactor(const word& name)", "Foam::solution::relaxationFactor(const word&)",
relaxationFactors_ relaxationFactors_
) << "Cannot find relaxationFactor for '" << name ) << "Cannot find relaxationFactor for '" << name
<< "' or a suitable default value." << "' or a suitable default value."
@ -242,7 +239,7 @@ const Foam::dictionary& Foam::solution::solverDict(const word& name) const
{ {
if (debug) if (debug)
{ {
InfoIn("solution::solverDict(const word& name)") InfoIn("solution::solverDict(const word&)")
<< "Lookup solver for " << name << endl; << "Lookup solver for " << name << endl;
} }
@ -254,7 +251,7 @@ const Foam::dictionary& Foam::solution::solver(const word& name) const
{ {
if (debug) if (debug)
{ {
InfoIn("solution::solver(const word& name)") InfoIn("solution::solver(const word&)")
<< "Lookup solver for " << name << endl; << "Lookup solver for " << name << endl;
} }

View File

@ -143,7 +143,7 @@ void Foam::processorPolyPatch::initGeometry()
( (
Pstream::blocking, Pstream::blocking,
neighbProcNo(), neighbProcNo(),
3*(sizeof(label) + size()*sizeof(vector) + sizeof(float)) 3*(sizeof(label) + size()*sizeof(vector) + sizeof(scalar))
); );
toNeighbProc toNeighbProc
@ -163,7 +163,7 @@ void Foam::processorPolyPatch::calcGeometry()
( (
Pstream::blocking, Pstream::blocking,
neighbProcNo(), neighbProcNo(),
3*(sizeof(label) + size()*sizeof(vector) + sizeof(float)) 3*(sizeof(label) + size()*sizeof(vector) + sizeof(scalar))
); );
fromNeighbProc fromNeighbProc
>> neighbFaceCentres_ >> neighbFaceCentres_

View File

@ -176,9 +176,10 @@ public:
} }
//- Assignment from bool //- Assignment from bool
void operator=(const bool b) const Switch& operator=(const bool b)
{ {
switch_ = (b ? Switch::TRUE : Switch::FALSE); switch_ = (b ? Switch::TRUE : Switch::FALSE);
return *this;
} }

View File

@ -51,13 +51,13 @@ namespace Foam
class complex; class complex;
inline scalar magSqr(const complex& c); inline scalar magSqr(const complex&);
inline complex sqr(const complex& c); inline complex sqr(const complex&);
inline scalar mag(const complex& c); inline scalar mag(const complex&);
inline const complex& max(const complex& c1, const complex& c2); inline const complex& max(const complex&, const complex&);
inline const complex& min(const complex& c1, const complex& c2); inline const complex& min(const complex&, const complex&);
inline complex limit(const complex& c1, const complex& c2); inline complex limit(const complex&, const complex&);
inline const complex& sum(const complex& c); inline const complex& sum(const complex&);
inline complex operator+(const complex&, const complex&); inline complex operator+(const complex&, const complex&);
inline complex operator-(const complex&); inline complex operator-(const complex&);
inline complex operator-(const complex&, const complex&); inline complex operator-(const complex&, const complex&);
@ -67,8 +67,8 @@ inline complex operator*(const scalar, const complex&);
inline complex operator*(const complex&, const scalar); inline complex operator*(const complex&, const scalar);
inline complex operator/(const complex&, const scalar); inline complex operator/(const complex&, const scalar);
inline complex operator/(const scalar, const complex&); inline complex operator/(const scalar, const complex&);
Istream& operator>>(Istream& is, complex&); Istream& operator>>(Istream&, complex&);
Ostream& operator<<(Ostream& os, const complex& C); Ostream& operator<<(Ostream&, const complex&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -127,13 +127,13 @@ public:
// Member operators // Member operators
inline void operator=(const complex&); inline const complex& operator=(const complex&);
inline void operator+=(const complex&); inline void operator+=(const complex&);
inline void operator-=(const complex&); inline void operator-=(const complex&);
inline void operator*=(const complex&); inline void operator*=(const complex&);
inline void operator/=(const complex&); inline void operator/=(const complex&);
inline void operator=(const scalar); inline const complex& operator=(const scalar);
inline void operator+=(const scalar); inline void operator+=(const scalar);
inline void operator-=(const scalar); inline void operator-=(const scalar);
inline void operator*=(const scalar); inline void operator*=(const scalar);
@ -150,12 +150,12 @@ public:
friend scalar magSqr(const complex& c); friend scalar magSqr(const complex& c);
friend complex sqr(const complex& c); friend complex sqr(const complex& c);
friend scalar mag(const complex& c); friend scalar mag(const complex& c);
friend const complex& max(const complex& c1, const complex& c2); friend const complex& max(const complex&, const complex&);
friend const complex& min(const complex& c1, const complex& c2); friend const complex& min(const complex&, const complex&);
friend complex limit(const complex& c1, const complex& c2); friend complex limit(const complex&, const complex&);
friend const complex& sum(const complex& c); friend const complex& sum(const complex&);
// Friend operators // Friend operators

View File

@ -76,10 +76,11 @@ inline complex complex::conjugate() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void complex::operator=(const complex& c) inline const complex& complex::operator=(const complex& c)
{ {
re = c.re; re = c.re;
im = c.im; im = c.im;
return *this;
} }
@ -109,10 +110,11 @@ inline void complex::operator/=(const complex& c)
} }
inline void complex::operator=(const scalar s) inline const complex& complex::operator=(const scalar s)
{ {
re = s; re = s;
im = 0.0; im = 0.0;
return *this;
} }
@ -234,8 +236,8 @@ inline complex operator+(const complex& c1, const complex& c2)
{ {
return complex return complex
( (
c1.re+c2.re, c1.re + c2.re,
c1.im+c2.im c1.im + c2.im
); );
} }
@ -254,8 +256,8 @@ inline complex operator-(const complex& c1, const complex& c2)
{ {
return complex return complex
( (
c1.re-c2.re, c1.re - c2.re,
c1.im-c2.im c1.im - c2.im
); );
} }

View File

@ -196,36 +196,41 @@ Foam::word Foam::fileName::component
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::fileName::operator=(const fileName& str) const Foam::fileName& Foam::fileName::operator=(const fileName& str)
{ {
string::operator=(str); string::operator=(str);
return *this;
} }
void Foam::fileName::operator=(const word& str) const Foam::fileName& Foam::fileName::operator=(const word& str)
{ {
string::operator=(str); string::operator=(str);
return *this;
} }
void Foam::fileName::operator=(const string& str) const Foam::fileName& Foam::fileName::operator=(const string& str)
{ {
string::operator=(str); string::operator=(str);
stripInvalid(); stripInvalid();
return *this;
} }
void Foam::fileName::operator=(const std::string& str) const Foam::fileName& Foam::fileName::operator=(const std::string& str)
{ {
string::operator=(str); string::operator=(str);
stripInvalid(); stripInvalid();
return *this;
} }
void Foam::fileName::operator=(const char* str) const Foam::fileName& Foam::fileName::operator=(const char* str)
{ {
string::operator=(str); string::operator=(str);
stripInvalid(); stripInvalid();
return *this;
} }

View File

@ -158,11 +158,11 @@ public:
// Assignment // Assignment
void operator=(const fileName&); const fileName& operator=(const fileName&);
void operator=(const word&); const fileName& operator=(const word&);
void operator=(const string&); const fileName& operator=(const string&);
void operator=(const std::string&); const fileName& operator=(const std::string&);
void operator=(const char*); const fileName& operator=(const char*);
// IOstream operators // IOstream operators

View File

@ -106,12 +106,12 @@ public:
// Assignment // Assignment
inline void operator=(const keyType&); inline const keyType& operator=(const keyType&);
inline void operator=(const word&); inline const keyType& operator=(const word&);
//- Assign from regular expression. //- Assign from regular expression.
inline void operator=(const string&); inline const keyType& operator=(const string&);
inline void operator=(const char*); inline const keyType& operator=(const char*);
// IOstream operators // IOstream operators

View File

@ -89,34 +89,38 @@ inline bool Foam::keyType::isPattern() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::keyType::operator=(const keyType& s) inline const Foam::keyType& Foam::keyType::operator=(const keyType& s)
{ {
// Bypass checking // Bypass checking
string::operator=(s); string::operator=(s);
isPattern_ = s.isPattern_; isPattern_ = s.isPattern_;
return *this;
} }
inline void Foam::keyType::operator=(const word& s) inline const Foam::keyType& Foam::keyType::operator=(const word& s)
{ {
word::operator=(s); word::operator=(s);
isPattern_ = false; isPattern_ = false;
return *this;
} }
inline void Foam::keyType::operator=(const string& s) inline const Foam::keyType& Foam::keyType::operator=(const string& s)
{ {
// Bypass checking // Bypass checking
string::operator=(s); string::operator=(s);
isPattern_ = true; isPattern_ = true;
return *this;
} }
inline void Foam::keyType::operator=(const char* s) inline const Foam::keyType& Foam::keyType::operator=(const char* s)
{ {
// Bypass checking // Bypass checking
string::operator=(s); string::operator=(s);
isPattern_ = false; isPattern_ = false;
return *this;
} }

View File

@ -144,6 +144,9 @@ public:
template<class String> template<class String>
static inline string quotemeta(const string&, const char quote='\\'); static inline string quotemeta(const string&, const char quote='\\');
//- Avoid masking the normal std::string replace
using std::string::replace;
//- Replace first occurence of sub-string oldStr with newStr //- Replace first occurence of sub-string oldStr with newStr
// starting at start // starting at start
string& replace string& replace

View File

@ -117,10 +117,10 @@ public:
// Assignment // Assignment
inline void operator=(const word&); inline const word& operator=(const word&);
inline void operator=(const string&); inline const word& operator=(const string&);
inline void operator=(const std::string&); inline const word& operator=(const std::string&);
inline void operator=(const char*); inline const word& operator=(const char*);
// Friend Operators // Friend Operators

View File

@ -132,30 +132,34 @@ inline bool Foam::word::valid(char c)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::word::operator=(const word& q) inline const Foam::word& Foam::word::operator=(const word& q)
{ {
string::operator=(q); string::operator=(q);
return *this;
} }
inline void Foam::word::operator=(const string& q) inline const Foam::word& Foam::word::operator=(const string& q)
{ {
string::operator=(q); string::operator=(q);
stripInvalid(); stripInvalid();
return *this;
} }
inline void Foam::word::operator=(const std::string& q) inline const Foam::word& Foam::word::operator=(const std::string& q)
{ {
string::operator=(q); string::operator=(q);
stripInvalid(); stripInvalid();
return *this;
} }
inline void Foam::word::operator=(const char* q) inline const Foam::word& Foam::word::operator=(const char* q)
{ {
string::operator=(q); string::operator=(q);
stripInvalid(); stripInvalid();
return *this;
} }

View File

@ -41,7 +41,7 @@ Description
Note Note
If the string contents are changed - eg, by the operator+=() or by If the string contents are changed - eg, by the operator+=() or by
string::replace(), etc - it will be necessary to use compile() or string::replace(), etc - it will be necessary to use compile() or
recompile() to sychronize the regular expression. recompile() to synchronize the regular expression.
SourceFiles SourceFiles
wordRe.C wordRe.C
@ -187,22 +187,22 @@ public:
//- Assign copy //- Assign copy
// Always case sensitive // Always case sensitive
inline void operator=(const wordRe&); inline const wordRe& operator=(const wordRe&);
//- Copy word, never a regular expression //- Copy word, never a regular expression
inline void operator=(const word&); inline const wordRe& operator=(const word&);
//- Copy string, auto-test for regular expression //- Copy string, auto-test for regular expression
// Always case sensitive // Always case sensitive
inline void operator=(const string&); inline const wordRe& operator=(const string&);
//- Copy string, auto-test for regular expression //- Copy string, auto-test for regular expression
// Always case sensitive // Always case sensitive
inline void operator=(const std::string&); inline const wordRe& operator=(const std::string&);
//- Copy string, auto-test for regular expression //- Copy string, auto-test for regular expression
// Always case sensitive // Always case sensitive
inline void operator=(const char*); inline const wordRe& operator=(const char*);
// IOstream operators // IOstream operators

View File

@ -213,7 +213,7 @@ inline void Foam::wordRe::set(const char* str, const compOption opt)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::wordRe::operator=(const wordRe& str) inline const Foam::wordRe& Foam::wordRe::operator=(const wordRe& str)
{ {
string::operator=(str); string::operator=(str);
@ -225,34 +225,39 @@ inline void Foam::wordRe::operator=(const wordRe& str)
{ {
re_.clear(); re_.clear();
} }
return *this;
} }
inline void Foam::wordRe::operator=(const word& str) inline const Foam::wordRe& Foam::wordRe::operator=(const word& str)
{ {
word::operator=(str); word::operator=(str);
re_.clear(); re_.clear();
return *this;
} }
inline void Foam::wordRe::operator=(const string& str) inline const Foam::wordRe& Foam::wordRe::operator=(const string& str)
{ {
string::operator=(str); string::operator=(str);
compile(DETECT); // auto-detect regex compile(DETECT); // auto-detect regex
return *this;
} }
inline void Foam::wordRe::operator=(const std::string& str) inline const Foam::wordRe& Foam::wordRe::operator=(const std::string& str)
{ {
string::operator=(str); string::operator=(str);
compile(DETECT); // auto-detect regex compile(DETECT); // auto-detect regex
return *this;
} }
inline void Foam::wordRe::operator=(const char* str) inline const Foam::wordRe& Foam::wordRe::operator=(const char* str)
{ {
string::operator=(str); string::operator=(str);
compile(DETECT); // auto-detect regex compile(DETECT); // auto-detect regex
return *this;
} }

View File

@ -97,10 +97,8 @@ void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const
OFstream os(ioObj.objectPath()); OFstream os(ioObj.objectPath());
ioObj.writeHeader(os); ioObj.writeHeader(os);
os << interfaces_ os << interfaces_;
<< "// *************************************" ioObj.writeEndDivider(os);
<< "************************************ //"
<< endl;
} }

View File

@ -1,5 +1,6 @@
fvMotionSolvers/fvMotionSolver/fvMotionSolver.C fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C
fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C

View File

@ -55,25 +55,10 @@ namespace Foam
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& Istream& is
) )
: :
fvMotionSolver(mesh), displacementFvMotionSolver(mesh, is),
points0_
(
pointIOField
(
IOobject
(
"points",
time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
),
pointDisplacement_ pointDisplacement_
( (
IOobject IOobject
@ -132,7 +117,7 @@ Foam::displacementSBRStressFvMotionSolver::curPoints() const
tmp<pointField> tcurPoints tmp<pointField> tcurPoints
( (
points0_ + pointDisplacement_.internalField() points0() + pointDisplacement_.internalField()
); );
twoDCorrectPoints(tcurPoints()); twoDCorrectPoints(tcurPoints());
@ -208,63 +193,7 @@ void Foam::displacementSBRStressFvMotionSolver::updateMesh
const mapPolyMesh& mpm const mapPolyMesh& mpm
) )
{ {
fvMotionSolver::updateMesh(mpm); displacementFvMotionSolver::updateMesh(mpm);
// Map points0_
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
// Find out scaling between points0 and current points
// Get the new points either from the map or the mesh
const pointField& points =
(
mpm.hasMotionPoints()
? mpm.preMotionPoints()
: fvMesh_.points()
);
// Note: boundBox does reduce
const vector span0 = boundBox(points0_).span();
const vector span = boundBox(points).span();
vector scaleFactors(cmptDivide(span0, span));
pointField newPoints0(mpm.pointMap().size());
forAll(newPoints0, pointI)
{
label oldPointI = mpm.pointMap()[pointI];
if (oldPointI >= 0)
{
label masterPointI = mpm.reversePointMap()[oldPointI];
if (masterPointI == pointI)
{
newPoints0[pointI] = points0_[oldPointI];
}
else
{
// New point. Assume motion is scaling.
newPoints0[pointI] = points0_[oldPointI] + cmptMultiply
(
scaleFactors,
points[pointI]-points[masterPointI]
);
}
}
else
{
FatalErrorIn
(
"displacementSBRStressFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);
}
}
points0_.transfer(newPoints0);
// Update diffusivity. Note two stage to make sure old one is de-registered // Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one. // before creating/registering new one.

View File

@ -37,7 +37,7 @@ SourceFiles
#ifndef displacementSBRStressFvMotionSolver_H #ifndef displacementSBRStressFvMotionSolver_H
#define displacementSBRStressFvMotionSolver_H #define displacementSBRStressFvMotionSolver_H
#include "fvMotionSolver.H" #include "displacementFvMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,13 +53,10 @@ class motionDiffusivity;
class displacementSBRStressFvMotionSolver class displacementSBRStressFvMotionSolver
: :
public fvMotionSolver public displacementFvMotionSolver
{ {
// Private data // Private data
//- Reference point field
pointField points0_;
//- Point motion field //- Point motion field
mutable pointVectorField pointDisplacement_; mutable pointVectorField pointDisplacement_;
@ -105,12 +102,6 @@ public:
// Member Functions // Member Functions
//- Return reference to the reference field
const pointField& points0() const
{
return points0_;
}
//- Return reference to the point motion displacement field //- Return reference to the point motion displacement field
pointVectorField& pointDisplacement() pointVectorField& pointDisplacement()
{ {

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "displacementFvMotionSolver.H"
#include "addToRunTimeSelectionTable.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// defineTypeNameAndDebug(displacementFvMotionSolver, 0);
//
// addToRunTimeSelectionTable
// (
// fvMotionSolver,
// displacementFvMotionSolver,
// dictionary
// );
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::displacementFvMotionSolver::
displacementFvMotionSolver
(
const polyMesh& mesh,
Istream&
)
:
fvMotionSolver(mesh),
points0_
(
pointIOField
(
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
)
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::displacementFvMotionSolver::~displacementFvMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
fvMotionSolver::updateMesh(mpm);
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
// Find out scaling between points0 and current points
// Get the new points either from the map or the mesh
const pointField& points =
(
mpm.hasMotionPoints()
? mpm.preMotionPoints()
: fvMesh_.points()
);
// Note: boundBox does reduce
const vector span0 = boundBox(points0_).span();
const vector span = boundBox(points).span();
vector scaleFactors(cmptDivide(span0, span));
pointField newPoints0(mpm.pointMap().size());
forAll(newPoints0, pointI)
{
label oldPointI = mpm.pointMap()[pointI];
if (oldPointI >= 0)
{
label masterPointI = mpm.reversePointMap()[oldPointI];
if (masterPointI == pointI)
{
newPoints0[pointI] = points0_[oldPointI];
}
else
{
// New point. Assume motion is scaling.
newPoints0[pointI] = points0_[oldPointI] + cmptMultiply
(
scaleFactors,
points[pointI]-points[masterPointI]
);
}
}
else
{
FatalErrorIn
(
"displacementLaplacianFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);
}
}
points0_.transfer(newPoints0);
}
// ************************************************************************* //

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::displacementFvMotionSolver.H
Description
Base class for fvMotionSolvers which calculate displacement.
SourceFiles
displacementFvMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef displacementFvMotionSolver_H
#define displacementFvMotionSolver_H
#include "fvMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class displacementFvMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class displacementFvMotionSolver
:
public fvMotionSolver
{
// Private data
//- Reference point field
pointField points0_;
// Private Member Functions
//- Disallow default bitwise copy construct
displacementFvMotionSolver
(
const displacementFvMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const displacementFvMotionSolver&);
public:
//- Runtime type information
TypeName("displacementInterpolation");
// Constructors
//- Construct from polyMesh and data stream
displacementFvMotionSolver
(
const polyMesh&,
Istream& msDataUnused
);
// Destructor
~displacementFvMotionSolver();
// Member Functions
//- Return reference to the reference field
const pointField& points0() const
{
return points0_;
}
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -58,26 +58,10 @@ Foam::displacementInterpolationFvMotionSolver::
displacementInterpolationFvMotionSolver displacementInterpolationFvMotionSolver
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& Istream& is
) )
: :
fvMotionSolver(mesh), displacementFvMotionSolver(mesh, is),
points0_
(
pointIOField
(
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
)
),
dynamicMeshCoeffs_ dynamicMeshCoeffs_
( (
IOdictionary IOdictionary
@ -174,7 +158,7 @@ displacementInterpolationFvMotionSolver
forAll(fz().meshPoints(), localI) forAll(fz().meshPoints(), localI)
{ {
label pointI = fz().meshPoints()[localI]; label pointI = fz().meshPoints()[localI];
const scalar coord = points0_[pointI][dir]; const scalar coord = points0()[pointI][dir];
minCoord = min(minCoord, coord); minCoord = min(minCoord, coord);
maxCoord = max(maxCoord, coord); maxCoord = max(maxCoord, coord);
} }
@ -198,7 +182,7 @@ displacementInterpolationFvMotionSolver
zoneCoordinates[zoneCoordinates.size()-1] += SMALL; zoneCoordinates[zoneCoordinates.size()-1] += SMALL;
// Check if we have static min and max mesh bounds // Check if we have static min and max mesh bounds
const scalarField meshCoords = points0_.component(dir); const scalarField meshCoords = points0().component(dir);
scalar minCoord = gMin(meshCoords); scalar minCoord = gMin(meshCoords);
scalar maxCoord = gMax(meshCoords); scalar maxCoord = gMax(meshCoords);
@ -288,7 +272,7 @@ displacementInterpolationFvMotionSolver
"displacementInterpolationFvMotionSolver::" "displacementInterpolationFvMotionSolver::"
"displacementInterpolationFvMotionSolver" "displacementInterpolationFvMotionSolver"
"(const polyMesh&, Istream&)" "(const polyMesh&, Istream&)"
) << "Did not find point " << points0_[pointI] ) << "Did not find point " << points0()[pointI]
<< " coordinate " << meshCoords[pointI] << " coordinate " << meshCoords[pointI]
<< " in ranges " << rangeToCoord << " in ranges " << rangeToCoord
<< abort(FatalError); << abort(FatalError);
@ -344,18 +328,18 @@ Foam::displacementInterpolationFvMotionSolver::
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::displacementInterpolationFvMotionSolver::curPoints() const Foam::displacementInterpolationFvMotionSolver::curPoints() const
{ {
if (mesh().nPoints() != points0_.size()) if (mesh().nPoints() != points0().size())
{ {
FatalErrorIn FatalErrorIn
( (
"displacementInterpolationFvMotionSolver::curPoints() const" "displacementInterpolationFvMotionSolver::curPoints() const"
) << "The number of points in the mesh seems to have changed." << endl ) << "The number of points in the mesh seems to have changed." << endl
<< "In constant/polyMesh there are " << points0_.size() << "In constant/polyMesh there are " << points0().size()
<< " points; in the current mesh there are " << mesh().nPoints() << " points; in the current mesh there are " << mesh().nPoints()
<< " points." << exit(FatalError); << " points." << exit(FatalError);
} }
tmp<pointField> tcurPoints(new pointField(points0_)); tmp<pointField> tcurPoints(new pointField(points0()));
pointField& curPoints = tcurPoints(); pointField& curPoints = tcurPoints();
// Interpolate the diplacement of the face zones. // Interpolate the diplacement of the face zones.
@ -413,68 +397,4 @@ Foam::displacementInterpolationFvMotionSolver::curPoints() const
} }
void Foam::displacementInterpolationFvMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
fvMotionSolver::updateMesh(mpm);
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
// Find out scaling between points0 and current points
// Get the new points either from the map or the mesh
const pointField& points =
(
mpm.hasMotionPoints()
? mpm.preMotionPoints()
: fvMesh_.points()
);
// Note: boundBox does reduce
const vector span0 = boundBox(points0_).span();
const vector span = boundBox(points).span();
vector scaleFactors(cmptDivide(span0, span));
pointField newPoints0(mpm.pointMap().size());
forAll(newPoints0, pointI)
{
label oldPointI = mpm.pointMap()[pointI];
if (oldPointI >= 0)
{
label masterPointI = mpm.reversePointMap()[oldPointI];
if (masterPointI == pointI)
{
newPoints0[pointI] = points0_[oldPointI];
}
else
{
// New point. Assume motion is scaling.
newPoints0[pointI] = points0_[oldPointI] + cmptMultiply
(
scaleFactors,
points[pointI]-points[masterPointI]
);
}
}
else
{
FatalErrorIn
(
"displacementLaplacianFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);
}
}
points0_.transfer(newPoints0);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -48,7 +48,7 @@ SourceFiles
#ifndef displacementInterpolationFvMotionSolver_H #ifndef displacementInterpolationFvMotionSolver_H
#define displacementInterpolationFvMotionSolver_H #define displacementInterpolationFvMotionSolver_H
#include "fvMotionSolver.H" #include "displacementFvMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,13 +61,10 @@ namespace Foam
class displacementInterpolationFvMotionSolver class displacementInterpolationFvMotionSolver
: :
public fvMotionSolver public displacementFvMotionSolver
{ {
// Private data // Private data
//- Reference point field
pointField points0_;
//- Additional settings for motion solver //- Additional settings for motion solver
dictionary dynamicMeshCoeffs_; dictionary dynamicMeshCoeffs_;
@ -130,21 +127,12 @@ public:
// Member Functions // Member Functions
//- Return reference to the reference field
const pointField& points0() const
{
return points0_;
}
//- Return point location obtained from the current motion field //- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const; virtual tmp<pointField> curPoints() const;
//- Solve for motion //- Solve for motion
virtual void solve() virtual void solve()
{} {}
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
}; };

View File

@ -53,26 +53,10 @@ namespace Foam
Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& Istream& is
) )
: :
fvMotionSolver(mesh), displacementFvMotionSolver(mesh, is),
points0_
(
pointIOField
(
IOobject
(
"points",
time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
)
),
pointDisplacement_ pointDisplacement_
( (
IOobject IOobject
@ -186,7 +170,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
} }
pointLocation_().internalField() = pointLocation_().internalField() =
points0_ points0()
+ pointDisplacement_.internalField(); + pointDisplacement_.internalField();
pointLocation_().correctBoundaryConditions(); pointLocation_().correctBoundaryConditions();
@ -198,7 +182,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
forAll(pz, i) forAll(pz, i)
{ {
pointLocation_()[pz[i]] = points0_[pz[i]]; pointLocation_()[pz[i]] = points0()[pz[i]];
} }
} }
@ -210,7 +194,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
{ {
tmp<pointField> tcurPoints tmp<pointField> tcurPoints
( (
points0_ + pointDisplacement_.internalField() points0() + pointDisplacement_.internalField()
); );
// Implement frozen points // Implement frozen points
@ -220,7 +204,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
forAll(pz, i) forAll(pz, i)
{ {
tcurPoints()[pz[i]] = points0_[pz[i]]; tcurPoints()[pz[i]] = points0()[pz[i]];
} }
} }
@ -257,74 +241,7 @@ void Foam::displacementLaplacianFvMotionSolver::updateMesh
const mapPolyMesh& mpm const mapPolyMesh& mpm
) )
{ {
fvMotionSolver::updateMesh(mpm); displacementFvMotionSolver::updateMesh(mpm);
// Map points0_. Bit special since we somehow have to come up with
// a sensible points0 position for introduced points.
// Find out scaling between points0 and current points
// Get the new points either from the map or the mesh
const pointField& points =
(
mpm.hasMotionPoints()
? mpm.preMotionPoints()
: fvMesh_.points()
);
// Note: boundBox does reduce
const vector span0 = boundBox(points0_).span();
const vector span = boundBox(points).span();
vector scaleFactors(cmptDivide(span0, span));
pointField newPoints0(mpm.pointMap().size());
forAll(newPoints0, pointI)
{
label oldPointI = mpm.pointMap()[pointI];
if (oldPointI >= 0)
{
label masterPointI = mpm.reversePointMap()[oldPointI];
if (masterPointI == pointI)
{
newPoints0[pointI] = points0_[oldPointI];
}
else
{
// New point. Assume motion is scaling.
newPoints0[pointI] = points0_[oldPointI] + cmptMultiply
(
scaleFactors,
points[pointI]-points[masterPointI]
);
}
}
else
{
FatalErrorIn
(
"displacementLaplacianFvMotionSolver::updateMesh"
"(const mapPolyMesh& mpm)"
) << "Cannot work out coordinates of introduced vertices."
<< " New vertex " << pointI << " at coordinate "
<< points[pointI] << exit(FatalError);
}
}
points0_.transfer(newPoints0);
if (debug & 2)
{
OFstream str(time().timePath()/"points0.obj");
Pout<< "displacementLaplacianFvMotionSolver :"
<< " Writing points0_ to " << str.name() << endl;
forAll(points0_, pointI)
{
meshTools::writeOBJ(str, points0_[pointI]);
}
}
// Update diffusivity. Note two stage to make sure old one is de-registered // Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one. // before creating/registering new one.

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