From 485970d1923bc9697780c1413a022a960c3b8e0e Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 4 Dec 2012 17:55:47 +0000 Subject: [PATCH 01/18] BUG: smoluchovskiBC: use fatalIOerror --- .../BCs/T/smoluchowskiJumpTFvPatchScalarField.C | 4 ++-- .../rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index d0183e9f7d..8f1ebe37c8 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField dict ) << "unphysical accommodationCoeff specified" << "(0 < accommodationCoeff <= 1)" << endl - << exit(FatalError); + << exit(FatalIOError); } if (dict.found("value")) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index 875e42683e..61861b33fa 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -94,7 +94,7 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField dict ) << "unphysical accommodationCoeff_ specified" << "(0 < accommodationCoeff_ <= 1)" << endl - << exit(FatalError); + << exit(FatalIOError); } if (dict.found("value")) From e3c9dddd26b54697bc9986b0b89ca07017f50e7c Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 4 Dec 2012 17:57:17 +0000 Subject: [PATCH 02/18] STYLE: mixedFixedValue: indentation --- .../BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C index 8f31a2b460..5c1459381f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,6 +98,7 @@ mixedFixedValueSlipFvPatchField::mixedFixedValueSlipFvPatchField valueFraction_(ptf.valueFraction_) {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Map from self From d2cfb24ef8f233ca35e12c72fe758cc3e1ed31bc Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 5 Dec 2012 12:06:50 +0000 Subject: [PATCH 03/18] ENH: IOobject: allow absolute instance --- src/OpenFOAM/db/IOobject/IOobject.C | 115 +++++++++++++++++----------- 1 file changed, 71 insertions(+), 44 deletions(-) diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index e9e48e9554..47e14b0577 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,7 @@ defineTypeNameAndDebug(Foam::IOobject, 0); // ----- ------ // "foo" ("", "", "foo") // "foo/bar" ("foo", "", "bar") -// "/XXX" ERROR - no absolute path +// "/XXX/bar" ("/XXX", "", "bar") // "foo/bar/" ERROR - no name // "foo/xxx/bar" ("foo", "xxx", "bar") // "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar") @@ -64,14 +64,6 @@ bool Foam::IOobject::IOobject::fileNameComponents return false; } - if (path.isAbsolute()) - { - // called with absolute path - WarningIn("IOobject::fileNameComponents(const fileName&, ...)") - << "called with absolute path: " << path << "\n"; - return false; - } - string::size_type first = path.find('/'); if (first == string::npos) @@ -81,6 +73,15 @@ bool Foam::IOobject::IOobject::fileNameComponents // check afterwards name.string::operator=(path); } + else if (first == 0) + { + // Leading '/'. Absolute fileName + string::size_type last = path.rfind('/'); + instance = path.substr(0, last); + + // check afterwards + name.string::operator=(path.substr(last+1)); + } else { instance = path.substr(0, first); @@ -246,7 +247,14 @@ const Foam::fileName& Foam::IOobject::rootPath() const Foam::fileName Foam::IOobject::path() const { - return rootPath()/caseName()/instance()/db_.dbDir()/local(); + if (instance().isAbsolute()) + { + return instance(); + } + else + { + return rootPath()/caseName()/instance()/db_.dbDir()/local(); + } } @@ -256,61 +264,80 @@ Foam::fileName Foam::IOobject::path const fileName& local ) const { + //Note: can only be called with relative instance since is word type return rootPath()/caseName()/instance/db_.dbDir()/local; } Foam::fileName Foam::IOobject::filePath() const { - fileName path = this->path(); - fileName objectPath = path/name(); - - if (isFile(objectPath)) + if (instance().isAbsolute()) { - return objectPath; + fileName objectPath = instance()/name(); + if (isFile(objectPath)) + { + return objectPath; + } + else + { + return fileName::null; + } } else { - if - ( - time().processorCase() - && ( - instance() == time().system() - || instance() == time().constant() - ) - ) - { - fileName parentObjectPath = - rootPath()/caseName() - /".."/instance()/db_.dbDir()/local()/name(); + fileName path = this->path(); + fileName objectPath = path/name(); - if (isFile(parentObjectPath)) - { - return parentObjectPath; - } + if (isFile(objectPath)) + { + return objectPath; } - - if (!isDir(path)) + else { - word newInstancePath = time().findInstancePath(instant(instance())); - - if (newInstancePath.size()) + if + ( + time().processorCase() + && ( + instance() == time().system() + || instance() == time().constant() + ) + ) { - fileName fName - ( + fileName parentObjectPath = rootPath()/caseName() - /newInstancePath/db_.dbDir()/local()/name() + /".."/instance()/db_.dbDir()/local()/name(); + + if (isFile(parentObjectPath)) + { + return parentObjectPath; + } + } + + if (!isDir(path)) + { + word newInstancePath = time().findInstancePath + ( + instant(instance()) ); - if (isFile(fName)) + if (newInstancePath.size()) { - return fName; + fileName fName + ( + rootPath()/caseName() + /newInstancePath/db_.dbDir()/local()/name() + ); + + if (isFile(fName)) + { + return fName; + } } } } - } - return fileName::null; + return fileName::null; + } } From 2e046d32d05c47f47a41cdd99624af11026926b6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 5 Dec 2012 12:42:53 +0000 Subject: [PATCH 04/18] ENH: subsetMesh: improved error checking --- .../cellSelection/outsideCellSelection.C | 15 +++++++++++++-- .../mesh/manipulation/subsetMesh/subsetMeshDict | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C index 556ae4e07e..7cb4eec518 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C @@ -156,10 +156,21 @@ Foam::boolList Foam::cellSelections::outsideCellSelection::findRegions reduce(keepRegionI, maxOp