diff --git a/applications/solvers/dsmc/dsmcFoam/Make/files b/applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/files similarity index 100% rename from applications/solvers/dsmc/dsmcFoam/Make/files rename to applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/files diff --git a/applications/solvers/dsmc/dsmcFoam/Make/options b/applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/options similarity index 100% rename from applications/solvers/dsmc/dsmcFoam/Make/options rename to applications/solvers/discreteMethods/dsmc/dsmcFoam/Make/options diff --git a/applications/solvers/dsmc/dsmcFoam/createFields.H b/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H similarity index 100% rename from applications/solvers/dsmc/dsmcFoam/createFields.H rename to applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H diff --git a/applications/solvers/dsmc/dsmcFoam/dsmcFoam.C b/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C similarity index 100% rename from applications/solvers/dsmc/dsmcFoam/dsmcFoam.C rename to applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files b/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/Make/files similarity index 100% rename from applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files rename to applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/Make/files diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options b/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/Make/options similarity index 100% rename from applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options rename to applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/Make/options diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C b/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C similarity index 100% rename from applications/solvers/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C rename to applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C diff --git a/applications/solvers/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H b/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H similarity index 100% rename from applications/solvers/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H rename to applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/readmdEquilibrationDict.H diff --git a/applications/solvers/molecularDynamics/mdFoam/Make/files b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/Make/files similarity index 100% rename from applications/solvers/molecularDynamics/mdFoam/Make/files rename to applications/solvers/discreteMethods/molecularDynamics/mdFoam/Make/files diff --git a/applications/solvers/molecularDynamics/mdFoam/Make/options b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/Make/options similarity index 100% rename from applications/solvers/molecularDynamics/mdFoam/Make/options rename to applications/solvers/discreteMethods/molecularDynamics/mdFoam/Make/options diff --git a/applications/solvers/molecularDynamics/mdFoam/mdFoam.C b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C similarity index 100% rename from applications/solvers/molecularDynamics/mdFoam/mdFoam.C rename to applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C diff --git a/applications/solvers/incompressible/pimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleDyMFoam/createFields.H index ff3f9c5169..bc798ba988 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/createFields.H @@ -1,4 +1,3 @@ - Info<< "Reading field p\n" << endl; volScalarField p ( @@ -33,7 +32,7 @@ label pRefCell = 0; scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue); singlePhaseTransportModel laminarTransport(U, phi); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C index b705d2bbb7..66692cc4a8 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Application - turbDyMFoam + pimpleDyMFoam.C Description Transient solver for incompressible, flow of Newtonian fluids @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createDynamicFvMesh.H" -# include "readPISOControls.H" +# include "readPIMPLEControls.H" # include "initContinuityErrs.H" # include "createFields.H" # include "readTimeControls.H" diff --git a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleDyMFoam/readControls.H index 9336616a1b..3bd20c5c5c 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/readControls.H @@ -1,14 +1,14 @@ # include "readTimeControls.H" -# include "readPISOControls.H" +# include "readPIMPLEControls.H" bool correctPhi = false; - if (piso.found("correctPhi")) + if (pimple.found("correctPhi")) { - correctPhi = Switch(piso.lookup("correctPhi")); + correctPhi = Switch(pimple.lookup("correctPhi")); } bool checkMeshCourantNo = false; - if (piso.found("checkMeshCourantNo")) + if (pimple.found("checkMeshCourantNo")) { - checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); + checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); } diff --git a/applications/test/UIndirectListTest/UIndirectListTest.C b/applications/test/UIndirectListTest/UIndirectListTest.C index 575173c51e..9c619a4b99 100644 --- a/applications/test/UIndirectListTest/UIndirectListTest.C +++ b/applications/test/UIndirectListTest/UIndirectListTest.C @@ -28,6 +28,8 @@ Description #include "UIndirectList.H" #include "IOstreams.H" +#include "ListOps.H" +#include "OFstream.H" using namespace Foam; @@ -52,29 +54,32 @@ int main(int argc, char *argv[]) UIndirectList idl(completeList, addresses); - forAll(idl, i) - { - Info<< idl[i] << token::SPACE; - } - - Info<< endl; + Info<< idl << "\n"; idl[1] = -666; - Info<< "idl[1] changed:" << idl() << endl; + Info<< "idl[1] changed:" << idl << endl; idl = -999; - Info<< "idl changed:" << idl() << endl; + Info<< "idl changed:" << idl << endl; UIndirectList idl2(idl); - Info<< "idl2:" << idl2() << endl; + Info<< "idl2: " << idl2 << endl; - idl = idl2(); - Info<< "idl assigned from UList:" << idl() << endl; + { + List ident(idl.size()); + forAll(ident, i) + { + ident[i] = ident.size() - i; + } + idl = ident; + } + + Info<< "idl assigned from UList:" << idl << endl; List realList = UIndirectList(completeList, addresses); diff --git a/applications/test/string/stringTest.C b/applications/test/string/stringTest.C index b8442102f3..2ed59bf88f 100644 --- a/applications/test/string/stringTest.C +++ b/applications/test/string/stringTest.C @@ -70,6 +70,28 @@ int main(int argc, char *argv[]) string test2("~OpenFOAM/controlDict"); 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; Sin.getLine(s); @@ -78,8 +100,7 @@ int main(int argc, char *argv[]) cout<< "output string with " << s2.length() << " characters\n"; cout<< "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; diff --git a/applications/test/volPointInterpolation/volPointInterpolationTest.C b/applications/test/volPointInterpolation/volPointInterpolationTest.C index 07329ac349..d44dcf9fa4 100644 --- a/applications/test/volPointInterpolation/volPointInterpolationTest.C +++ b/applications/test/volPointInterpolation/volPointInterpolationTest.C @@ -68,8 +68,7 @@ int main(int argc, char *argv[]) mesh ); - pointMesh pMesh(mesh); - volPointInterpolation pInterp(mesh, pMesh); + const volPointInterpolation& pInterp = volPointInterpolation::New(mesh); pointScalarField pp(pInterp.interpolate(p)); pp.write(); diff --git a/applications/utilities/errorEstimation/estimateScalarError/estimateScalarError.C b/applications/utilities/errorEstimation/estimateScalarError/estimateScalarError.C index c90594ff24..9fb3a646d6 100644 --- a/applications/utilities/errorEstimation/estimateScalarError/estimateScalarError.C +++ b/applications/utilities/errorEstimation/estimateScalarError/estimateScalarError.C @@ -39,24 +39,17 @@ Description int main(int argc, char *argv[]) { + timeSelector::addOptions(); -# include "addTimeOptions.H" # include "setRootCase.H" - - Info<< "\nEstimating error in scalar transport equation\n" << endl; - # include "createTime.H" - // Get times list - instantList Times = runTime.times(); - -# include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); + instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" - Info<< "Reading transportProperties\n" << endl; + Info<< "\nEstimating error in scalar transport equation\n" + << "Reading transportProperties\n" << endl; IOdictionary transportProperties ( @@ -79,9 +72,9 @@ int main(int argc, char *argv[]) ); - for (label i=startTime; i - addArcEdgeIstreamConstructorToTable_; + addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream); } diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C b/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C index c9d31ef6a1..6a2d41a83e 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C +++ b/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C @@ -41,26 +41,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(curvedEdge, 0); - -// Define the constructor function hash tables -HashTable* - curvedEdge::IstreamConstructorTablePtr_; - - -// Hash table Constructor called from the table add functions. - -void curvedEdge::constructTables() -{ - static bool constructed = false; - - if (!constructed) - { - curvedEdge::IstreamConstructorTablePtr_ - = new HashTable; - - constructed = true; - } -} +defineRunTimeSelectionTable(curvedEdge, Istream); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -117,10 +98,11 @@ autoPtr curvedEdge::New(const pointField& points, Istream& is) word curvedEdgeType(is); - HashTable::iterator curvedEdgeConstructorIter = - IstreamConstructorTablePtr_->find(curvedEdgeType); + IstreamConstructorTable::iterator cstrIter = + IstreamConstructorTablePtr_ + ->find(curvedEdgeType); - if (curvedEdgeConstructorIter == IstreamConstructorTablePtr_->end()) + if (cstrIter == IstreamConstructorTablePtr_->end()) { FatalErrorIn("curvedEdge::New(const pointField&, Istream&)") << "Unknown curvedEdge type " << curvedEdgeType << endl << endl @@ -129,7 +111,7 @@ autoPtr curvedEdge::New(const pointField& points, Istream& is) << abort(FatalError); } - return autoPtr(curvedEdgeConstructorIter()(points, is)); + return autoPtr(cstrIter()(points, is)); } @@ -177,7 +159,6 @@ Ostream& operator<<(Ostream& os, const curvedEdge& p) } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H b/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H index c568180d73..5ecf489d38 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H +++ b/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H @@ -63,51 +63,23 @@ protected: public: - // Constructor Hash tables - - //- Construct from Istream function pointer type - typedef autoPtr (*IstreamConstructorPtr_) - (const pointField&, Istream&); - - //- Construct from Istream function pointer table pointer - static HashTable* - IstreamConstructorTablePtr_; + //- Runtime type information + TypeName("curvedEdge"); - // Hash table constructor classes and functions + // Declare run-time constructor selection tables - //- Hash table Constructor. - // Must be called from the table add functions below. - static void constructTables(); - - - //- Class to add constructor from Istream to Hash table - template - class addIstreamConstructorToTable - { - public: - - static autoPtr New + declareRunTimeSelectionTable + ( + autoPtr, + curvedEdge, + Istream, ( const pointField& points, Istream& is - ) - { - return autoPtr(new curvedEdgeType(points, is)); - } - - addIstreamConstructorToTable() - { - curvedEdge::constructTables(); - - curvedEdge::IstreamConstructorTablePtr_ - ->insert(curvedEdgeType::typeName, New); - } - }; - - - //- Runtime type information - TypeName("curvedEdge"); + ), + (points, is) + ); // Constructors diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C b/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C index f4581ed338..7263f71843 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C +++ b/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C @@ -26,6 +26,7 @@ License #include "polySplineEdge.H" #include "BSpline.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -34,8 +35,7 @@ namespace Foam defineTypeNameAndDebug(polySplineEdge, 0); // Add the curvedEdge constructor functions to the hash tables - curvedEdge::addIstreamConstructorToTable - addPolySplineEdgeIstreamConstructorToTable_; + addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream); } diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H b/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H index d71685782d..1f59d5bf8e 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H +++ b/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H @@ -92,7 +92,7 @@ public: ); //- Construct from Istream setting pointsList - polySplineEdge(const pointField& points,Istream& is); + polySplineEdge(const pointField& points, Istream& is); // Destructor diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C b/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C index 8fe13aefe0..b45f0ea3c2 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C +++ b/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C @@ -27,9 +27,8 @@ Description \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "simpleSplineEdge.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,10 +38,8 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(simpleSplineEdge, 0); +addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream); -// Add the curvedEdge constructor functions to the hash tables -curvedEdge::addIstreamConstructorToTable - addSimpleSplineEdgeIstreamConstructorToTable_; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C index 74ab53432a..d226008f5c 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C @@ -31,7 +31,9 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" +#include "timeSelector.H" #include "Time.H" + #include "polyMesh.H" #include "globalMeshData.H" @@ -45,48 +47,34 @@ using namespace Foam; int main(int argc, char *argv[]) { + timeSelector::addOptions(false); // no constant # include "addRegionOption.H" - -# include "addTimeOptionsNoConstant.H" - argList::validOptions.insert("noTopology", ""); argList::validOptions.insert("allGeometry", ""); argList::validOptions.insert("allTopology", ""); # include "setRootCase.H" +# include "createTime.H" + instantList timeDirs = timeSelector::select0(runTime, args); +# include "createNamedPolyMesh.H" - const bool noTopology = args.options().found("noTopology"); + const bool noTopology = args.options().found("noTopology"); const bool allGeometry = args.options().found("allGeometry"); const bool allTopology = args.options().found("allTopology"); -# include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - -# include "checkTimeOptionsNoConstant.H" - - runTime.setTime(Times[startTime], startTime); - -# include "createNamedPolyMesh.H" - - bool firstCheck = true; - - for (label i=startTime; i pointLabels(set.toc()); label zoneID = mesh.pointZones().findZoneID(set.name()); if (zoneID == -1) @@ -120,7 +122,7 @@ int main(int argc, char *argv[]) new pointZone ( set.name(), //name - set.toc(), //addressing + pointLabels, //addressing sz, //index mesh.pointZones() //pointZoneMesh ) @@ -131,7 +133,7 @@ int main(int argc, char *argv[]) { Info<< "Overwriting contents of existing pointZone " << zoneID << " with that of set " << set.name() << "." << endl; - mesh.pointZones()[zoneID] = set.toc(); + mesh.pointZones()[zoneID] = pointLabels; mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE; } } @@ -150,6 +152,7 @@ int main(int argc, char *argv[]) { // Not in memory. Load it. cellSet set(*iter()); + SortableList