mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into cvm
Conflicts: applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C src/Allwmake src/edgeMesh/Make/files src/edgeMesh/edgeMesh.C src/edgeMesh/edgeMesh.H src/edgeMesh/edgeMeshI.H src/edgeMesh/edgeMeshIO.C src/edgeMesh/featureEdgeMesh.C src/edgeMesh/featureEdgeMesh.H src/edgeMesh/featureEdgeMesh/featureEdgeMesh.C src/edgeMesh/featureEdgeMesh/featureEdgeMesh.H src/meshTools/searchableSurface/closedTriSurfaceMesh.C src/meshTools/searchableSurface/closedTriSurfaceMesh.H Merged Mark's work on edgeMesh with my featureEdgeMesh.
This commit is contained in:
@ -22,8 +22,9 @@ wmake libso OpenFOAM
|
||||
|
||||
wmake libso lagrangian/basic
|
||||
|
||||
wmake libso triSurface
|
||||
wmake libso edgeMesh
|
||||
wmake libso surfMesh
|
||||
wmake libso triSurface
|
||||
|
||||
# Decomposition methods needed by meshTools
|
||||
wmake libso parallel/decompositionMethods
|
||||
@ -32,8 +33,6 @@ wmake libso meshTools
|
||||
wmake libso finiteVolume
|
||||
wmake libso genericPatchFields
|
||||
|
||||
wmake libso edgeMesh
|
||||
|
||||
wmake libso sampling
|
||||
|
||||
wmake libso dynamicMesh
|
||||
|
||||
@ -29,10 +29,9 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::RK, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Foam::RK, 0);
|
||||
addToRunTimeSelectionTable(ODESolver, RK, ODE);
|
||||
|
||||
const scalar
|
||||
@ -85,28 +84,28 @@ void Foam::RK::solve
|
||||
{
|
||||
forAll(yTemp_, i)
|
||||
{
|
||||
yTemp_[i] = y[i] + b21*h*dydx[i];
|
||||
yTemp_[i] = y[i] + b21*h*dydx[i];
|
||||
}
|
||||
|
||||
ode.derivatives(x + a2*h, yTemp_, ak2_);
|
||||
|
||||
forAll(yTemp_, i)
|
||||
{
|
||||
yTemp_[i] = y[i] + h*(b31*dydx[i] + b32*ak2_[i]);
|
||||
yTemp_[i] = y[i] + h*(b31*dydx[i] + b32*ak2_[i]);
|
||||
}
|
||||
|
||||
ode.derivatives(x + a3*h, yTemp_, ak3_);
|
||||
|
||||
forAll(yTemp_, i)
|
||||
{
|
||||
yTemp_[i] = y[i] + h*(b41*dydx[i] + b42*ak2_[i] + b43*ak3_[i]);
|
||||
yTemp_[i] = y[i] + h*(b41*dydx[i] + b42*ak2_[i] + b43*ak3_[i]);
|
||||
}
|
||||
|
||||
ode.derivatives(x + a4*h, yTemp_, ak4_);
|
||||
|
||||
forAll(yTemp_, i)
|
||||
{
|
||||
yTemp_[i] = y[i]
|
||||
yTemp_[i] = y[i]
|
||||
+ h*(b51*dydx[i] + b52*ak2_[i] + b53*ak3_[i] + b54*ak4_[i]);
|
||||
}
|
||||
|
||||
@ -114,7 +113,7 @@ void Foam::RK::solve
|
||||
|
||||
forAll(yTemp_, i)
|
||||
{
|
||||
yTemp_[i] = y[i]
|
||||
yTemp_[i] = y[i]
|
||||
+ h*
|
||||
(
|
||||
b61*dydx[i] + b62*ak2_[i] + b63*ak3_[i]
|
||||
@ -126,13 +125,13 @@ void Foam::RK::solve
|
||||
|
||||
forAll(yout, i)
|
||||
{
|
||||
yout[i] = y[i]
|
||||
yout[i] = y[i]
|
||||
+ h*(c1*dydx[i] + c3*ak3_[i] + c4*ak4_[i] + c6*ak6_[i]);
|
||||
}
|
||||
|
||||
forAll(yerr, i)
|
||||
{
|
||||
yerr[i] =
|
||||
yerr[i] =
|
||||
h*
|
||||
(
|
||||
dc1*dydx[i] + dc3*ak3_[i] + dc4*ak4_[i]
|
||||
@ -160,16 +159,16 @@ void Foam::RK::solve
|
||||
|
||||
for (;;)
|
||||
{
|
||||
solve(ode, x, y, dydx, h, yTemp2_, yErr_);
|
||||
solve(ode, x, y, dydx, h, yTemp2_, yErr_);
|
||||
|
||||
maxErr = 0.0;
|
||||
for (register label i=0; i<n_; i++)
|
||||
maxErr = 0.0;
|
||||
for (register label i=0; i<n_; i++)
|
||||
{
|
||||
maxErr = max(maxErr, mag(yErr_[i]/yScale[i]));
|
||||
}
|
||||
maxErr /= eps;
|
||||
maxErr /= eps;
|
||||
|
||||
if (maxErr <= 1.0)
|
||||
if (maxErr <= 1.0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -179,7 +178,7 @@ void Foam::RK::solve
|
||||
h = (h >= 0.0 ? max(hTemp, 0.1*h) : min(hTemp, 0.1*h));
|
||||
}
|
||||
|
||||
if (h < VSMALL)
|
||||
if (h < VSMALL)
|
||||
{
|
||||
FatalErrorIn("RK::solve")
|
||||
<< "stepsize underflow"
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::RK
|
||||
|
||||
Description
|
||||
Foam::RK
|
||||
Runge-Kutta ODE solver
|
||||
|
||||
SourceFiles
|
||||
RKCK.C
|
||||
@ -53,6 +53,15 @@ class RK
|
||||
public ODESolver
|
||||
{
|
||||
// Private data
|
||||
static const scalar safety, pGrow, pShrink, errCon;
|
||||
|
||||
static const scalar
|
||||
a2, a3, a4, a5, a6,
|
||||
b21, b31, b32, b41, b42, b43,
|
||||
b51, b52, b53, b54, b61, b62, b63, b64, b65,
|
||||
c1, c3, c4, c6,
|
||||
dc1, dc3, dc4, dc5, dc6;
|
||||
|
||||
|
||||
mutable scalarField yTemp_;
|
||||
mutable scalarField ak2_;
|
||||
@ -64,16 +73,6 @@ class RK
|
||||
mutable scalarField yErr_;
|
||||
mutable scalarField yTemp2_;
|
||||
|
||||
static const scalar safety, pGrow, pShrink, errCon;
|
||||
|
||||
static const scalar
|
||||
a2, a3, a4, a5, a6,
|
||||
b21, b31, b32, b41, b42, b43,
|
||||
b51, b52, b53, b54, b61, b62, b63, b64, b65,
|
||||
c1, c3, c4, c6,
|
||||
dc1, dc3, dc4, dc5, dc6;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -44,7 +44,7 @@ void Foam::sigInt::sigIntHandler(int)
|
||||
(
|
||||
"Foam::sigInt::sigIntHandler()"
|
||||
) << "Cannot reset SIGINT trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Update jobInfo file
|
||||
@ -74,7 +74,7 @@ Foam::sigInt::~sigInt()
|
||||
(
|
||||
"Foam::sigInt::~sigInt()"
|
||||
) << "Cannot reset SIGINT trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ void Foam::sigInt::set(const bool verbose)
|
||||
(
|
||||
"Foam::sigInt::set()"
|
||||
) << "Cannot set SIGINT trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ void Foam::sigQuit::sigQuitHandler(int)
|
||||
(
|
||||
"Foam::sigQuit::sigQuitHandler()"
|
||||
) << "Cannot reset SIGQUIT trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Update jobInfo file
|
||||
@ -76,7 +76,7 @@ Foam::sigQuit::~sigQuit()
|
||||
(
|
||||
"Foam::sigQuit::~sigQuit()"
|
||||
) << "Cannot reset SIGQUIT trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ void Foam::sigQuit::set(const bool verbose)
|
||||
(
|
||||
"Foam::sigQuit::set()"
|
||||
) << "Cannot set SIGQUIT trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ void Foam::sigSegv::sigSegvHandler(int)
|
||||
(
|
||||
"Foam::sigSegv::sigSegvHandler()"
|
||||
) << "Cannot reset SIGSEGV trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Update jobInfo file
|
||||
@ -76,7 +76,7 @@ Foam::sigSegv::~sigSegv()
|
||||
(
|
||||
"Foam::sigSegv::~sigSegv()"
|
||||
) << "Cannot reset SIGSEGV trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ void Foam::sigSegv::set(const bool verbose)
|
||||
(
|
||||
"Foam::sigSegv::set()"
|
||||
) << "Cannot set SIGSEGV trapping"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <unistd.h>
|
||||
@ -44,7 +42,7 @@ unsigned int Foam::timer::oldTimeOut_ = 0;
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::timer::signalHandler(int)
|
||||
{
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Foam::timer::signalHandler(int sig) : "
|
||||
@ -56,8 +54,6 @@ void Foam::timer::signalHandler(int)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// Construct from components
|
||||
Foam::timer::timer(const unsigned int newTimeOut)
|
||||
:
|
||||
newTimeOut_(newTimeOut)
|
||||
@ -72,7 +68,7 @@ Foam::timer::timer(const unsigned int newTimeOut)
|
||||
(
|
||||
"Foam::timer::timer(const unsigned int)"
|
||||
) << "timer already used."
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Install alarm signal handler:
|
||||
@ -80,7 +76,7 @@ Foam::timer::timer(const unsigned int newTimeOut)
|
||||
// - clear list of signals to mask
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = timer::signalHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
sigemptyset(&newAction.sa_mask);
|
||||
|
||||
if (sigaction(SIGALRM, &newAction, &oldAction_) < 0)
|
||||
@ -89,7 +85,7 @@ Foam::timer::timer(const unsigned int newTimeOut)
|
||||
(
|
||||
"Foam::timer::timer(const unsigned int)"
|
||||
) << "sigaction(SIGALRM) error"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
oldTimeOut_ = ::alarm(newTimeOut);
|
||||
@ -131,7 +127,7 @@ Foam::timer::~timer()
|
||||
"Foam::timer::~timer(const struct sigaction&"
|
||||
"const struct sigaction&)"
|
||||
) << "sigaction(SIGALRM) error"
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,9 @@ $(bools)/bool/boolIO.C
|
||||
$(bools)/Switch/Switch.C
|
||||
$(bools)/Switch/SwitchIO.C
|
||||
|
||||
primitives/char/charIO.C
|
||||
chars = primitives/chars
|
||||
$(chars)/char/charIO.C
|
||||
$(chars)/wchar/wcharIO.C
|
||||
|
||||
ints = primitives/ints
|
||||
$(ints)/int/intIO.C
|
||||
|
||||
@ -405,7 +405,7 @@ void Foam::FaceCellWave<Type>::leaveDomain
|
||||
) const
|
||||
{
|
||||
const vectorField& fc = mesh_.faceCentres();
|
||||
|
||||
|
||||
for (label i = 0; i < nFaces; i++)
|
||||
{
|
||||
label patchFaceI = faceLabels[i];
|
||||
@ -427,7 +427,7 @@ void Foam::FaceCellWave<Type>::enterDomain
|
||||
) const
|
||||
{
|
||||
const vectorField& fc = mesh_.faceCentres();
|
||||
|
||||
|
||||
for (label i = 0; i < nFaces; i++)
|
||||
{
|
||||
label patchFaceI = faceLabels[i];
|
||||
@ -739,7 +739,7 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " Cyclic patch " << patchI << ' ' << patch.name()
|
||||
Pout<< " Cyclic patch " << patchI << ' ' << patch.name()
|
||||
<< " Changed on first half : " << nSendFaces
|
||||
<< " Changed on second half : " << nReceiveFaces
|
||||
<< endl;
|
||||
@ -819,7 +819,7 @@ Foam::FaceCellWave<Type>::FaceCellWave
|
||||
{}
|
||||
|
||||
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// maxIter reached). Initial cell values specified.
|
||||
template <class Type>
|
||||
Foam::FaceCellWave<Type>::FaceCellWave
|
||||
|
||||
@ -331,7 +331,7 @@ public:
|
||||
|
||||
//- Access mesh
|
||||
const polyMesh& mesh() const
|
||||
{
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// maxIter reached).
|
||||
template <class Type>
|
||||
Foam::MeshWave<Type>::MeshWave
|
||||
@ -54,7 +54,7 @@ Foam::MeshWave<Type>::MeshWave
|
||||
{}
|
||||
|
||||
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// maxIter reached). Initial cell values specified.
|
||||
template <class Type>
|
||||
Foam::MeshWave<Type>::MeshWave
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Dictionary.H"
|
||||
|
||||
@ -136,6 +136,12 @@ public:
|
||||
return insert(lst);
|
||||
}
|
||||
|
||||
//- Unset the specified key - same as erase
|
||||
bool unset(const Key& key)
|
||||
{
|
||||
return HashTable<nil, Key, Hash>::erase(key);
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ILList.H"
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "LList.H"
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "UILList.H"
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "UILList.H"
|
||||
|
||||
@ -267,8 +267,8 @@ Foam::Ostream& Foam::PackedList<nBits>::print(Ostream& os) const
|
||||
template<unsigned nBits>
|
||||
void Foam::PackedList<nBits>::operator=(const PackedList<nBits>& lst)
|
||||
{
|
||||
setCapacity(lst.size());
|
||||
StorageList::operator=(lst);
|
||||
size_ = lst.size();
|
||||
}
|
||||
|
||||
|
||||
@ -276,6 +276,7 @@ template<unsigned nBits>
|
||||
void Foam::PackedList<nBits>::operator=(const UList<label>& lst)
|
||||
{
|
||||
setCapacity(lst.size());
|
||||
size_ = lst.size();
|
||||
|
||||
forAll(lst, i)
|
||||
{
|
||||
|
||||
@ -201,6 +201,10 @@ public:
|
||||
// Default value set is the max_value.
|
||||
inline bool set(const label, const unsigned int val = ~0u);
|
||||
|
||||
//- Unset the entry at index I. Return true if value changed.
|
||||
// Never auto-vivify entries.
|
||||
inline bool unset(const label);
|
||||
|
||||
//- Return the underlying packed storage
|
||||
inline List<unsigned int>& storage();
|
||||
|
||||
@ -240,6 +244,8 @@ public:
|
||||
|
||||
//- Reserve allocation space for at least this size.
|
||||
// Never shrinks the allocated size.
|
||||
// The list size is adjusted as per DynamicList with
|
||||
// SizeInc=0, SizeMult=2, SizeDiv=1
|
||||
inline void reserve(const label);
|
||||
|
||||
//- Clear the list, i.e. set addressable size to zero.
|
||||
@ -249,7 +255,7 @@ public:
|
||||
//- Clear the list and delete storage.
|
||||
inline void clearStorage();
|
||||
|
||||
//- Shrink the allocated space to what is used.
|
||||
//- Shrink the allocated space to what is actually used.
|
||||
inline void shrink();
|
||||
|
||||
//- Transfer the contents of the argument list into this list
|
||||
|
||||
@ -670,7 +670,16 @@ inline void Foam::PackedList<nBits>::reserve
|
||||
// need more capacity?
|
||||
if (len > StorageList::size())
|
||||
{
|
||||
StorageList::setSize(len, 0u);
|
||||
// Like DynamicList with SizeInc=0, SizeMult=2, SizeDiv=1
|
||||
StorageList::setSize
|
||||
(
|
||||
max
|
||||
(
|
||||
len,
|
||||
StorageList::size()*2
|
||||
),
|
||||
0u
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,6 +810,19 @@ inline bool Foam::PackedList<nBits>::set
|
||||
}
|
||||
|
||||
|
||||
template<unsigned nBits>
|
||||
inline bool Foam::PackedList<nBits>::unset(const label i)
|
||||
{
|
||||
// lazy - ignore out-of-bounds
|
||||
if (i < 0 || i >= size_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return iteratorBase(this, i).set(0u);
|
||||
}
|
||||
|
||||
|
||||
template<unsigned nBits>
|
||||
inline void Foam::PackedList<nBits>::append(const unsigned int val)
|
||||
{
|
||||
@ -839,7 +861,24 @@ Foam::PackedList<nBits>::operator[](const label i)
|
||||
}
|
||||
|
||||
|
||||
// specialization for nBits=1 isn't worth the bother
|
||||
namespace Foam
|
||||
{
|
||||
// specialization for nBits=1
|
||||
template<>
|
||||
inline void Foam::PackedList<1>::operator=(const unsigned int val)
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
StorageList::operator=(~0u);
|
||||
}
|
||||
else
|
||||
{
|
||||
StorageList::operator=(0u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<unsigned nBits>
|
||||
inline void Foam::PackedList<nBits>::operator=(const unsigned int val)
|
||||
{
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOMap.H"
|
||||
|
||||
@ -22,12 +22,11 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstream.H"
|
||||
#include "error.H"
|
||||
#include "Switch.H"
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -62,7 +61,14 @@ Foam::IOstream::formatEnum(const word& format)
|
||||
Foam::IOstream::compressionType
|
||||
Foam::IOstream::compressionEnum(const word& compression)
|
||||
{
|
||||
if (compression == "uncompressed")
|
||||
// get Switch (bool) value, but allow it to fail
|
||||
Switch::switchType sw = Switch::asEnum(compression, true);
|
||||
|
||||
if (sw != Switch::INVALID)
|
||||
{
|
||||
return sw ? IOstream::COMPRESSED : IOstream::UNCOMPRESSED;
|
||||
}
|
||||
else if (compression == "uncompressed")
|
||||
{
|
||||
return IOstream::UNCOMPRESSED;
|
||||
}
|
||||
@ -117,7 +123,7 @@ Foam::string Foam::IOstream::versionNumber::str() const
|
||||
std::ostringstream os;
|
||||
os.precision(1);
|
||||
os.setf(ios_base::fixed, ios_base::floatfield);
|
||||
os << versionNumber_;
|
||||
os << versionNumber_;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -204,11 +210,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::streamFormat& sf)
|
||||
{
|
||||
if (sf == IOstream::ASCII)
|
||||
{
|
||||
os << "ascii";
|
||||
os << "ascii";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "binary";
|
||||
os << "binary";
|
||||
}
|
||||
|
||||
return os;
|
||||
@ -217,7 +223,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::streamFormat& sf)
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::versionNumber& vn)
|
||||
{
|
||||
os << vn.str().c_str();
|
||||
os << vn.str().c_str();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -25,35 +25,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Istream.H"
|
||||
#include "bool.H"
|
||||
#include "token.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Set t to the put back token if there is one and return true,
|
||||
// otherwise return false
|
||||
bool Foam::Istream::getBack(token& t)
|
||||
{
|
||||
if (bad())
|
||||
{
|
||||
FatalIOErrorIn("void Istream::getBack(token&)", *this)
|
||||
<< "Attempt to get back from bad stream"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (putBack_)
|
||||
{
|
||||
t = putBackToken_;
|
||||
putBack_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Keep the put back token
|
||||
void Foam::Istream::putBack(const token& t)
|
||||
{
|
||||
if (bad())
|
||||
@ -76,6 +50,40 @@ void Foam::Istream::putBack(const token& t)
|
||||
}
|
||||
|
||||
|
||||
bool Foam::Istream::getBack(token& t)
|
||||
{
|
||||
if (bad())
|
||||
{
|
||||
FatalIOErrorIn("void Istream::getBack(token&)", *this)
|
||||
<< "Attempt to get back from bad stream"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else if (putBack_)
|
||||
{
|
||||
t = putBackToken_;
|
||||
putBack_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::Istream::peekBack(token& t)
|
||||
{
|
||||
if (putBack_)
|
||||
{
|
||||
t = putBackToken_;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = token::undefinedToken;
|
||||
}
|
||||
|
||||
return putBack_;
|
||||
}
|
||||
|
||||
|
||||
// Functions for reading object delimiters ( ... )
|
||||
|
||||
Foam::Istream& Foam::Istream::readBegin(const char* funcName)
|
||||
|
||||
@ -62,7 +62,7 @@ class Istream
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Has a token been put back on the stream
|
||||
//- Has a token been put back on the stream?
|
||||
bool putBack_;
|
||||
|
||||
//- The last token put back on the stream
|
||||
@ -97,12 +97,19 @@ public:
|
||||
// Read functions
|
||||
|
||||
//- Put back token
|
||||
// Only a single put back is permitted
|
||||
void putBack(const token&);
|
||||
|
||||
//- Get the put back token
|
||||
//- Get the put back token if there is one and return true.
|
||||
// Return false if no put back token is available.
|
||||
bool getBack(token&);
|
||||
|
||||
//- Return next token from stream
|
||||
//- Peek at the put back token without removing it.
|
||||
// Returns false if no put back token is available and set the
|
||||
// token to undefined.
|
||||
bool peekBack(token&);
|
||||
|
||||
//- Return next token from stream
|
||||
virtual Istream& read(token&) = 0;
|
||||
|
||||
//- Read a character
|
||||
|
||||
@ -48,7 +48,7 @@ void reduce
|
||||
{
|
||||
Pstream::gather(comms, Value, bop);
|
||||
Pstream::scatter(comms, Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Reduce using either linear or tree communication schedule
|
||||
@ -67,7 +67,7 @@ void reduce
|
||||
{
|
||||
reduce(UPstream::treeCommunication(), Value, bop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Reduce using either linear or tree communication schedule
|
||||
@ -90,7 +90,7 @@ T returnReduce
|
||||
}
|
||||
|
||||
return WorkValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Insist there is a specialisation for the reduction of a scalar
|
||||
|
||||
@ -137,6 +137,12 @@ public:
|
||||
//- Raw, low-level get character function.
|
||||
inline ISstream& get(char&);
|
||||
|
||||
//- Raw, low-level peek function.
|
||||
// Does not remove the character from the stream.
|
||||
// Returns the next character in the stream or EOF if the
|
||||
// end of file is read.
|
||||
inline int peek();
|
||||
|
||||
//- Raw, low-level getline into a string function.
|
||||
inline ISstream& getLine(string&);
|
||||
|
||||
|
||||
@ -69,6 +69,12 @@ inline Foam::ISstream& Foam::ISstream::get(char& c)
|
||||
}
|
||||
|
||||
|
||||
inline int Foam::ISstream::peek()
|
||||
{
|
||||
return is_.peek();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::ISstream& Foam::ISstream::getLine(string& s)
|
||||
{
|
||||
getline(is_, s);
|
||||
|
||||
@ -79,7 +79,7 @@ Foam::Istream& Foam::ITstream::read(token& t)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"ITstream::read(token& t)",
|
||||
"ITstream::read(token&)",
|
||||
*this
|
||||
) << "attempt to read beyond EOF"
|
||||
<< exit(FatalIOError);
|
||||
@ -91,17 +91,16 @@ Foam::Istream& Foam::ITstream::read(token& t)
|
||||
setEof();
|
||||
}
|
||||
|
||||
t = token::undefinedToken;
|
||||
|
||||
if (size())
|
||||
{
|
||||
token::undefinedToken.lineNumber()
|
||||
= operator[](size() - 1).lineNumber();
|
||||
t.lineNumber() = tokenList::last().lineNumber();
|
||||
}
|
||||
else
|
||||
{
|
||||
token::undefinedToken.lineNumber() = lineNumber();
|
||||
t.lineNumber() = lineNumber();
|
||||
}
|
||||
|
||||
t = token::undefinedToken;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -110,7 +109,7 @@ Foam::Istream& Foam::ITstream::read(token& t)
|
||||
|
||||
Foam::Istream& Foam::ITstream::read(char&)
|
||||
{
|
||||
notImplemented("Istream& ITstream::read(char& c)");
|
||||
notImplemented("Istream& ITstream::read(char&)");
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -157,14 +156,13 @@ Foam::Istream& Foam::ITstream::read(char*, std::streamsize)
|
||||
}
|
||||
|
||||
|
||||
// Rewind the token stream so that it may be read again
|
||||
Foam::Istream& Foam::ITstream::rewind()
|
||||
{
|
||||
tokenIndex_ = 0;
|
||||
|
||||
if (size())
|
||||
{
|
||||
lineNumber_ = operator[](0).lineNumber();
|
||||
lineNumber_ = tokenList::first().lineNumber();
|
||||
}
|
||||
|
||||
setGood();
|
||||
|
||||
@ -70,7 +70,26 @@ public:
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const tokenList& tokens,
|
||||
const UList<token>& tokens,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
tokenList(tokens),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
{
|
||||
setOpened();
|
||||
setGood();
|
||||
}
|
||||
|
||||
|
||||
//- Construct from components, transferring the tokens
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const Xfer< List<token> >& tokens,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
)
|
||||
@ -98,8 +117,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
//- Destructor
|
||||
virtual ~ITstream()
|
||||
{}
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
// Revision : $Revision: 1.8 $
|
||||
// Revision_date : $Date: 2005/12/07 18:03:25 $
|
||||
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
|
||||
//
|
||||
// Standard streambuf implementation following Nicolai Josuttis, "The
|
||||
// Standard C++ Library".
|
||||
//
|
||||
// Standard streambuf implementation following Nicolai Josuttis,
|
||||
// "The Standard C++ Library".
|
||||
// ============================================================================
|
||||
|
||||
#include "gzstream.h"
|
||||
@ -97,7 +97,7 @@ int gzstreambuf::underflow() { // used for input buffer only
|
||||
buffer + 4 + num); // end of buffer
|
||||
|
||||
// return next character
|
||||
return * reinterpret_cast<unsigned char *>( gptr());
|
||||
return * reinterpret_cast<unsigned char *>( gptr());
|
||||
}
|
||||
|
||||
int gzstreambuf::flush_buffer() {
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
// Revision : $Revision: 1.8 $
|
||||
// Revision_date : $Date: 2005/11/09 13:53:50 $
|
||||
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
|
||||
//
|
||||
// Standard streambuf implementation following Nicolai Josuttis, "The
|
||||
// Standard C++ Library".
|
||||
//
|
||||
// Standard streambuf implementation following Nicolai Josuttis,
|
||||
// "The Standard C++ Library".
|
||||
// ============================================================================
|
||||
|
||||
#ifndef GZSTREAM_H
|
||||
@ -48,21 +48,21 @@ namespace GZSTREAM_NAMESPACE {
|
||||
// class gzstreambuf
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class gzstreambuf
|
||||
: public std::streambuf
|
||||
class gzstreambuf
|
||||
: public std::streambuf
|
||||
{
|
||||
private:
|
||||
|
||||
//------------------------------------
|
||||
|
||||
static const int bufferSize = 47+256;
|
||||
static const int bufferSize = 47+256;
|
||||
// totals 512 bytes under g++ for igzstream at the end.
|
||||
|
||||
//------------------------------------
|
||||
gzFile file;
|
||||
char buffer[bufferSize];
|
||||
char opened;
|
||||
int mode;
|
||||
gzFile file;
|
||||
char buffer[bufferSize];
|
||||
char opened;
|
||||
int mode;
|
||||
|
||||
|
||||
//------------------------------------
|
||||
@ -73,25 +73,25 @@ public:
|
||||
|
||||
//------------------------------------
|
||||
|
||||
gzstreambuf()
|
||||
: opened(0)
|
||||
gzstreambuf()
|
||||
: opened(0)
|
||||
{
|
||||
setp( buffer, buffer + (bufferSize-1));
|
||||
setg( buffer + 4, // beginning of putback area
|
||||
buffer + 4, // read position
|
||||
buffer + 4); // end position
|
||||
buffer + 4); // end position
|
||||
// ASSERT: both input & output capabilities will not be used together
|
||||
}
|
||||
~gzstreambuf()
|
||||
{
|
||||
close();
|
||||
~gzstreambuf()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
|
||||
int is_open()
|
||||
{
|
||||
return opened;
|
||||
int is_open()
|
||||
{
|
||||
return opened;
|
||||
}
|
||||
gzstreambuf* open( const char* name, int open_mode );
|
||||
gzstreambuf* close();
|
||||
@ -104,8 +104,8 @@ public:
|
||||
// class gzstreambase
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class gzstreambase
|
||||
: virtual public std::ios
|
||||
class gzstreambase
|
||||
: virtual public std::ios
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -117,9 +117,9 @@ public:
|
||||
|
||||
//------------------------------------
|
||||
|
||||
gzstreambase()
|
||||
{
|
||||
init(&buf);
|
||||
gzstreambase()
|
||||
{
|
||||
init(&buf);
|
||||
}
|
||||
gzstreambase( const char* _name, int _open_mode );
|
||||
~gzstreambase();
|
||||
@ -128,15 +128,15 @@ public:
|
||||
|
||||
void open( const char* _name, int _open_mode );
|
||||
void close();
|
||||
gzstreambuf* rdbuf()
|
||||
{
|
||||
return &buf;
|
||||
gzstreambuf* rdbuf()
|
||||
{
|
||||
return &buf;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// User classes. Use igzstream and ogzstream analogously to ifstream and
|
||||
// ofstream respectively. They read and write files based on the gz*
|
||||
// ofstream respectively. They read and write files based on the gz*
|
||||
// function interface of the zlib. Files are compatible with gzip compression.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -144,30 +144,30 @@ public:
|
||||
// class igzstream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class igzstream
|
||||
class igzstream
|
||||
: public std::istream
|
||||
, public gzstreambase
|
||||
, public gzstreambase
|
||||
{
|
||||
public:
|
||||
|
||||
//------------------------------------
|
||||
|
||||
igzstream()
|
||||
: std::istream( &buf)
|
||||
{}
|
||||
igzstream( const char* _name,
|
||||
igzstream()
|
||||
: std::istream( &buf)
|
||||
{}
|
||||
igzstream( const char* _name,
|
||||
int _open_mode = std::ios::in )
|
||||
: std::istream( &buf )
|
||||
, gzstreambase( _name, _open_mode )
|
||||
{}
|
||||
{}
|
||||
|
||||
//------------------------------------
|
||||
|
||||
gzstreambuf* rdbuf()
|
||||
{
|
||||
return gzstreambase::rdbuf();
|
||||
gzstreambuf* rdbuf()
|
||||
{
|
||||
return gzstreambase::rdbuf();
|
||||
}
|
||||
void open( const char* _name,
|
||||
void open( const char* _name,
|
||||
int _open_mode = std::ios::in )
|
||||
{
|
||||
gzstreambase::open( _name, _open_mode );
|
||||
@ -178,32 +178,32 @@ public:
|
||||
// class ogzstream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ogzstream
|
||||
class ogzstream
|
||||
: public gzstreambase
|
||||
, public std::ostream
|
||||
, public std::ostream
|
||||
{
|
||||
public:
|
||||
|
||||
//------------------------------------
|
||||
|
||||
ogzstream()
|
||||
: std::ostream( &buf)
|
||||
ogzstream()
|
||||
: std::ostream( &buf)
|
||||
{}
|
||||
explicit
|
||||
ogzstream( const char* _name,
|
||||
ogzstream( const char* _name,
|
||||
int _open_mode = std::ios::out )
|
||||
: gzstreambase( _name, _open_mode )
|
||||
, std::ostream( &buf)
|
||||
{}
|
||||
, std::ostream( &buf)
|
||||
{}
|
||||
|
||||
//------------------------------------
|
||||
|
||||
gzstreambuf* rdbuf()
|
||||
{
|
||||
return gzstreambase::rdbuf();
|
||||
gzstreambuf* rdbuf()
|
||||
{
|
||||
return gzstreambase::rdbuf();
|
||||
}
|
||||
void open( const char* _name,
|
||||
int _open_mode = std::ios::out )
|
||||
void open( const char* _name,
|
||||
int _open_mode = std::ios::out )
|
||||
{
|
||||
gzstreambase::open( _name, _open_mode );
|
||||
}
|
||||
|
||||
@ -124,15 +124,37 @@ void Foam::timeSelector::addOptions
|
||||
{
|
||||
if (constant)
|
||||
{
|
||||
argList::validOptions.insert("constant", "");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"constant",
|
||||
"include the 'constant/' dir in the times list"
|
||||
);
|
||||
}
|
||||
if (zeroTime)
|
||||
{
|
||||
argList::validOptions.insert("zeroTime", "");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"zeroTime",
|
||||
"include the '0/' dir in the times list"
|
||||
);
|
||||
}
|
||||
argList::validOptions.insert("noZero", "");
|
||||
argList::validOptions.insert("time", "ranges");
|
||||
argList::validOptions.insert("latestTime", "");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noZero",
|
||||
"exclude the '0/' dir from the times list, "
|
||||
"has precedence over the -zeroTime option"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"latestTime",
|
||||
"select the latest time"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"time",
|
||||
"ranges",
|
||||
"comma-separated time ranges - eg, ':10,20,40-70,1000:'"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ Foam::dictionary::dictionary
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
dictionaryName(parentDict.name() + "::" + dict.name()),
|
||||
dictionaryName(dict.name()),
|
||||
IDLList<entry>(dict, *this),
|
||||
parent_(parentDict)
|
||||
{
|
||||
@ -489,7 +489,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
return dictionary(*this, dictionary(keyword));
|
||||
return dictionary(*this, dictionary(name() + "::" + keyword));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct as copy for the given parentDict
|
||||
//- Construct as copy for the given parent dictionary
|
||||
dictionaryEntry
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
|
||||
@ -79,7 +79,7 @@ void Foam::dictionaryEntry::write(Ostream& os) const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Ostream operator * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Ostream operator * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const dictionaryEntry& de)
|
||||
{
|
||||
|
||||
@ -26,33 +26,92 @@ License
|
||||
|
||||
#include "primitiveEntry.H"
|
||||
#include "dictionary.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::primitiveEntry::append(const UList<token>& varTokens)
|
||||
{
|
||||
forAll(varTokens, i)
|
||||
{
|
||||
newElmt(tokenIndex()++) = varTokens[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::primitiveEntry::expandVariable
|
||||
(
|
||||
const word& w,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word varName = w(1, w.size()-1);
|
||||
|
||||
// lookup the variable name in the given dictionary....
|
||||
// Note: allow wildcards to match? For now disabled since following
|
||||
// would expand internalField to wildcard match and not expected
|
||||
// internalField:
|
||||
// internalField XXX;
|
||||
// boundaryField { ".*" {YYY;} movingWall {value $internalField;}
|
||||
const entry* ePtr = dict.lookupEntryPtr(varName, true, false);
|
||||
|
||||
// ...if defined append its tokens into this
|
||||
if (ePtr)
|
||||
{
|
||||
append(ePtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
// not in the dictionary - try an environment variable
|
||||
string envStr = getEnv(varName);
|
||||
|
||||
if (envStr.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
append(tokenList(IStringStream('(' + envStr + ')')()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::primitiveEntry::primitiveEntry(const keyType& key, const ITstream& tokens)
|
||||
Foam::primitiveEntry::primitiveEntry(const keyType& key, const ITstream& is)
|
||||
:
|
||||
entry(key),
|
||||
ITstream(tokens)
|
||||
ITstream(is)
|
||||
{
|
||||
name() += "::" + keyword();
|
||||
}
|
||||
|
||||
|
||||
Foam::primitiveEntry::primitiveEntry(const keyType& keyword, const token& t)
|
||||
Foam::primitiveEntry::primitiveEntry(const keyType& key, const token& t)
|
||||
:
|
||||
entry(keyword),
|
||||
ITstream(keyword, tokenList(1, t))
|
||||
entry(key),
|
||||
ITstream(key, tokenList(1, t))
|
||||
{}
|
||||
|
||||
|
||||
Foam::primitiveEntry::primitiveEntry
|
||||
(
|
||||
const keyType& keyword,
|
||||
const tokenList& tokens
|
||||
const keyType& key,
|
||||
const UList<token>& tokens
|
||||
)
|
||||
:
|
||||
entry(keyword),
|
||||
ITstream(keyword, tokens)
|
||||
entry(key),
|
||||
ITstream(key, tokens)
|
||||
{}
|
||||
|
||||
|
||||
Foam::primitiveEntry::primitiveEntry
|
||||
(
|
||||
const keyType& key,
|
||||
const Xfer< List<token> >& tokens
|
||||
)
|
||||
:
|
||||
entry(key),
|
||||
ITstream(key, tokens)
|
||||
{}
|
||||
|
||||
|
||||
@ -60,34 +119,39 @@ Foam::primitiveEntry::primitiveEntry
|
||||
|
||||
Foam::label Foam::primitiveEntry::startLineNumber() const
|
||||
{
|
||||
if (size())
|
||||
const tokenList& tokens = *this;
|
||||
|
||||
if (tokens.empty())
|
||||
{
|
||||
return operator[](0).lineNumber();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
return tokens.first().lineNumber();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::primitiveEntry::endLineNumber() const
|
||||
{
|
||||
if (size())
|
||||
const tokenList& tokens = *this;
|
||||
|
||||
if (tokens.empty())
|
||||
{
|
||||
return operator[](size()-1).lineNumber();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
return tokens.last().lineNumber();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::ITstream& Foam::primitiveEntry::stream() const
|
||||
{
|
||||
ITstream& dataStream = const_cast<primitiveEntry&>(*this);
|
||||
dataStream.rewind();
|
||||
return dataStream;
|
||||
ITstream& is = const_cast<primitiveEntry&>(*this);
|
||||
is.rewind();
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
@ -113,43 +177,4 @@ Foam::dictionary& Foam::primitiveEntry::dict()
|
||||
}
|
||||
|
||||
|
||||
void Foam::primitiveEntry::insert
|
||||
(
|
||||
const tokenList& varTokens,
|
||||
const label posI
|
||||
)
|
||||
{
|
||||
tokenList& tokens = *this;
|
||||
|
||||
if (varTokens.empty())
|
||||
{
|
||||
label end = tokens.size() - 1;
|
||||
|
||||
for (label j=posI; j<end; j++)
|
||||
{
|
||||
tokens[j] = tokens[j+1];
|
||||
}
|
||||
|
||||
tokens.setSize(tokens.size() - 1);
|
||||
}
|
||||
else if (varTokens.size() > 1)
|
||||
{
|
||||
tokens.setSize(tokens.size() + varTokens.size() - 1);
|
||||
|
||||
label end = tokens.size() - 1;
|
||||
label offset = varTokens.size() - 1;
|
||||
|
||||
for (label j=end; j>posI; j--)
|
||||
{
|
||||
tokens[j] = tokens[j-offset];
|
||||
}
|
||||
}
|
||||
|
||||
forAll(varTokens, j)
|
||||
{
|
||||
tokens[posI + j] = varTokens[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -68,6 +68,9 @@ class primitiveEntry
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
//- Append the given tokens starting at the current tokenIndex
|
||||
void append(const UList<token>&);
|
||||
|
||||
//- Append the given token to this entry
|
||||
void append
|
||||
(
|
||||
@ -76,9 +79,6 @@ class primitiveEntry
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Append the given tokens starting at the current tokenIndex
|
||||
void append(const tokenList&);
|
||||
|
||||
//- Expand the given variable (keyword starts with $)
|
||||
bool expandVariable(const word&, const dictionary&);
|
||||
|
||||
@ -93,9 +93,6 @@ class primitiveEntry
|
||||
//- Read the complete entry from the given stream
|
||||
void readEntry(const dictionary&, Istream&);
|
||||
|
||||
//- Insert the given tokens at token posI
|
||||
void insert(const tokenList&, const label posI);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -110,11 +107,14 @@ public:
|
||||
//- Construct from keyword and a ITstream
|
||||
primitiveEntry(const keyType&, const ITstream&);
|
||||
|
||||
//- Construct from keyword and a token
|
||||
//- Construct from keyword and a single token
|
||||
primitiveEntry(const keyType&, const token&);
|
||||
|
||||
//- Construct from keyword and a tokenList
|
||||
primitiveEntry(const keyType&, const tokenList&);
|
||||
//- Construct from keyword and a list of tokens
|
||||
primitiveEntry(const keyType&, const UList<token>&);
|
||||
|
||||
//- Construct from keyword and by transferring a list of tokens
|
||||
primitiveEntry(const keyType&, const Xfer< List<token> >&);
|
||||
|
||||
//- Construct from keyword and a T
|
||||
template<class T>
|
||||
@ -166,7 +166,7 @@ public:
|
||||
//- Read tokens from the given stream
|
||||
bool read(const dictionary&, Istream&);
|
||||
|
||||
// Write
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
|
||||
//- Return info proxy.
|
||||
|
||||
@ -28,10 +28,9 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "primitiveEntry.H"
|
||||
#include "OSspecific.H"
|
||||
#include "functionEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::primitiveEntry::append
|
||||
(
|
||||
@ -63,55 +62,6 @@ void Foam::primitiveEntry::append
|
||||
}
|
||||
|
||||
|
||||
void Foam::primitiveEntry::append(const tokenList& varTokens)
|
||||
{
|
||||
forAll(varTokens, i)
|
||||
{
|
||||
newElmt(tokenIndex()++) = varTokens[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::primitiveEntry::expandVariable
|
||||
(
|
||||
const word& w,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word varName = w(1, w.size()-1);
|
||||
|
||||
// lookup the variable name in the given dictionary....
|
||||
// Note: allow wildcards to match? For now disabled since following
|
||||
// would expand internalField to wildcard match and not expected
|
||||
// internalField:
|
||||
// internalField XXX;
|
||||
// boundaryField { ".*" {YYY;} movingWall {value $internalField;}
|
||||
const entry* ePtr = dict.lookupEntryPtr(varName, true, false);
|
||||
|
||||
// ...if defined insert its tokens into this
|
||||
if (ePtr != NULL)
|
||||
{
|
||||
append(ePtr->stream());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if not in the dictionary see if it is an environment
|
||||
// variable
|
||||
|
||||
string enVarString = getEnv(varName);
|
||||
|
||||
if (enVarString.size())
|
||||
{
|
||||
append(tokenList(IStringStream('(' + enVarString + ')')()));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::primitiveEntry::expandFunction
|
||||
(
|
||||
const word& keyword,
|
||||
@ -221,6 +171,8 @@ void Foam::primitiveEntry::readEntry(const dictionary& dict, Istream& is)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::primitiveEntry::primitiveEntry
|
||||
(
|
||||
const keyType& key,
|
||||
|
||||
@ -30,13 +30,13 @@ License
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::primitiveEntry::primitiveEntry(const keyType& keyword, const T& t)
|
||||
Foam::primitiveEntry::primitiveEntry(const keyType& key, const T& t)
|
||||
:
|
||||
entry(keyword),
|
||||
ITstream(keyword, tokenList(10))
|
||||
entry(key),
|
||||
ITstream(key, tokenList(10))
|
||||
{
|
||||
OStringStream os;
|
||||
os << t << token::END_STATEMENT;
|
||||
os << t << token::END_STATEMENT;
|
||||
readEntry(dictionary::null, IStringStream(os.str())());
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ bool Foam::dlLibraryTable::open(const fileName& functionLibName)
|
||||
{
|
||||
if (functionLibName.size())
|
||||
{
|
||||
void* functionLibPtr =
|
||||
void* functionLibPtr =
|
||||
dlopen(functionLibName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
||||
|
||||
if (!functionLibPtr)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,7 +57,9 @@ class StaticAssertionFailed<true>
|
||||
template<unsigned Test>
|
||||
class StaticAssertionTest {};
|
||||
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ Ostream& operator<<(Ostream&, const error&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class error Declaration
|
||||
Class error Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class error
|
||||
@ -92,10 +92,10 @@ public:
|
||||
error(const string& title);
|
||||
|
||||
//- Construct from dictionary
|
||||
error(const dictionary& errDict);
|
||||
error(const dictionary&);
|
||||
|
||||
//- Construct as copy
|
||||
error(const error& err);
|
||||
error(const error&);
|
||||
|
||||
|
||||
// Destructor
|
||||
@ -132,8 +132,8 @@ public:
|
||||
throwExceptions_ = false;
|
||||
}
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -141,6 +141,8 @@ public:
|
||||
const int sourceFileLineNumber = 0
|
||||
);
|
||||
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const string& functionName,
|
||||
@ -148,11 +150,11 @@ public:
|
||||
const int sourceFileLineNumber = 0
|
||||
);
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
operator OSstream&();
|
||||
|
||||
//- Explicitly convert to Ostream for << operations
|
||||
//- Explicitly convert to OSstream for << operations
|
||||
OSstream& operator()()
|
||||
{
|
||||
return operator OSstream&();
|
||||
@ -163,14 +165,14 @@ public:
|
||||
|
||||
|
||||
//- Helper function to print a stack
|
||||
static void printStack(Ostream& os);
|
||||
static void printStack(Ostream&);
|
||||
|
||||
//- Exit : can be called for any error to exit program. Prints stack
|
||||
// before exiting.
|
||||
//- Exit : can be called for any error to exit program.
|
||||
// Prints stack before exiting.
|
||||
void exit(const int errNo = 1);
|
||||
|
||||
//- Abort : used to stop code for fatal errors. Prints stack before
|
||||
// exiting.
|
||||
//- Abort : used to stop code for fatal errors.
|
||||
// Prints stack before exiting.
|
||||
void abort();
|
||||
|
||||
|
||||
@ -181,9 +183,7 @@ public:
|
||||
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class IOerror;
|
||||
|
||||
Ostream& operator<<(Ostream&, const IOerror&);
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ public:
|
||||
IOerror(const string& title);
|
||||
|
||||
//- Construct from dictionary
|
||||
IOerror(const dictionary& errDict);
|
||||
IOerror(const dictionary&);
|
||||
|
||||
|
||||
// Destructor
|
||||
@ -236,8 +236,8 @@ public:
|
||||
return ioEndLineNumber_;
|
||||
}
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -248,8 +248,8 @@ public:
|
||||
const label ioEndLineNumber = -1
|
||||
);
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -258,8 +258,8 @@ public:
|
||||
const IOstream&
|
||||
);
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -288,24 +288,47 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Global error declarations: defined in error.C
|
||||
|
||||
extern error FatalError;
|
||||
extern error FatalError;
|
||||
extern IOerror FatalIOError;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Convienient macros to add the file name and line number to the function name
|
||||
|
||||
#define FatalErrorIn(fn) FatalError(fn, __FILE__, __LINE__)
|
||||
#define FatalIOErrorIn(fn, ios) FatalIOError(fn, __FILE__, __LINE__, ios)
|
||||
|
||||
// Call for functions which are not currently implemented.
|
||||
// The functionName is printed and then abort is called.
|
||||
#define notImplemented(fn) \
|
||||
FatalErrorIn(fn) << "Not implemented" << Foam::abort(FatalError);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Convenience macros to add the file name and line number to the function name
|
||||
|
||||
/**
|
||||
* @def FatalErrorIn(functionName)
|
||||
* Report an error message using Foam::FatalError for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
*/
|
||||
#define FatalErrorIn(fn) \
|
||||
::Foam::FatalError((fn), __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @def FatalIOErrorIn(functionName, ios)
|
||||
* Report an error message using Foam::FatalIOError for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
* for a particular IOstream
|
||||
*/
|
||||
#define FatalIOErrorIn(fn, ios) \
|
||||
::Foam::FatalIOError((fn), __FILE__, __LINE__, (ios))
|
||||
|
||||
/**
|
||||
* @def notImplemented(functionName)
|
||||
* Issue a FatalErrorIn for the functionName.
|
||||
* This is used for functions that are not currently implemented.
|
||||
* The functionName is printed and then abort is called.
|
||||
*
|
||||
* @note
|
||||
* This macro can be particularly useful when methods must be defined to
|
||||
* complete the interface of a derived class even if they should never be
|
||||
* called for this derived class.
|
||||
*/
|
||||
#define notImplemented(fn) \
|
||||
FatalErrorIn(fn) << "Not implemented" << ::Foam::abort(FatalError);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "errorManip.H"
|
||||
|
||||
@ -49,7 +49,6 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class Err> class errorManip;
|
||||
template<class Err> Ostream& operator<<(Ostream&, errorManip<Err>);
|
||||
|
||||
@ -59,7 +58,7 @@ Ostream& operator<<(Ostream&, errorManipArg<Err, T>);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class errorManip Declaration
|
||||
Class errorManip Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Err>
|
||||
@ -89,7 +88,7 @@ inline Ostream& operator<<(Ostream& os, errorManip<Err> m)
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class errorManipArg Declaration
|
||||
Class errorManipArg Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- errorManipArg
|
||||
@ -123,23 +122,29 @@ inline Ostream& operator<<(Ostream& os, errorManipArg<Err, T> m)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline errorManipArg<error, int> exit(error& err, const int errNo = 1)
|
||||
inline errorManipArg<error, int>
|
||||
exit(error& err, const int errNo = 1)
|
||||
{
|
||||
return errorManipArg<error, int>(&error::exit, err, errNo);
|
||||
}
|
||||
|
||||
inline errorManip<error> abort(error& err)
|
||||
|
||||
inline errorManip<error>
|
||||
abort(error& err)
|
||||
{
|
||||
return errorManip<error>(&error::abort, err);
|
||||
}
|
||||
|
||||
|
||||
inline errorManipArg<IOerror, int> exit(IOerror& err, const int errNo = 1)
|
||||
inline errorManipArg<IOerror, int>
|
||||
exit(IOerror& err, const int errNo = 1)
|
||||
{
|
||||
return errorManipArg<IOerror, int>(&IOerror::exit, err, errNo);
|
||||
}
|
||||
|
||||
inline errorManip<IOerror> abort(IOerror& err)
|
||||
|
||||
inline errorManip<IOerror>
|
||||
abort(IOerror& err)
|
||||
{
|
||||
return errorManip<IOerror>(&IOerror::abort, err);
|
||||
}
|
||||
|
||||
@ -36,7 +36,8 @@ Description
|
||||
|
||||
Usage
|
||||
@code
|
||||
messageStream << "message1" << "message2" << FoamDataType << endl;
|
||||
messageStream
|
||||
<< "message1" << "message2" << FoamDataType << endl;
|
||||
@endcode
|
||||
|
||||
SourceFiles
|
||||
@ -55,6 +56,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class IOstream;
|
||||
class Ostream;
|
||||
class OSstream;
|
||||
@ -103,13 +105,13 @@ public:
|
||||
messageStream
|
||||
(
|
||||
const string& title,
|
||||
errorSeverity sev,
|
||||
errorSeverity,
|
||||
const int maxErrors = 0
|
||||
);
|
||||
|
||||
|
||||
//- Construct from dictionary
|
||||
messageStream(const dictionary& dict);
|
||||
messageStream(const dictionary&);
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -133,8 +135,8 @@ public:
|
||||
return maxErrors_;
|
||||
}
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -142,6 +144,8 @@ public:
|
||||
const int sourceFileLineNumber = 0
|
||||
);
|
||||
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const string& functionName,
|
||||
@ -149,8 +153,8 @@ public:
|
||||
const int sourceFileLineNumber = 0
|
||||
);
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -161,8 +165,8 @@ public:
|
||||
const label ioEndLineNumber = -1
|
||||
);
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -171,8 +175,8 @@ public:
|
||||
const IOstream&
|
||||
);
|
||||
|
||||
//- Convert to Ostream
|
||||
// Prints basic message and then returns Ostream for further info.
|
||||
//- Convert to OSstream
|
||||
// Prints basic message and returns OSstream for further info.
|
||||
OSstream& operator()
|
||||
(
|
||||
const char* functionName,
|
||||
@ -181,10 +185,10 @@ public:
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Convert to Ostream for << operations
|
||||
//- Convert to OSstream for << operations
|
||||
operator OSstream&();
|
||||
|
||||
//- Explicitly convert to Ostream for << operations
|
||||
//- Explicitly convert to OSstream for << operations
|
||||
OSstream& operator()()
|
||||
{
|
||||
return operator OSstream&();
|
||||
@ -199,18 +203,6 @@ extern messageStream SeriousError;
|
||||
extern messageStream Warning;
|
||||
extern messageStream Info;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Convienient macros to add the file name and line number to the function name
|
||||
|
||||
#define SeriousErrorIn(fn) SeriousError(fn, __FILE__, __LINE__)
|
||||
#define SeriousIOErrorIn(fn, ios) SeriousError(fn, __FILE__, __LINE__, ios)
|
||||
|
||||
#define WarningIn(fn) Warning(fn, __FILE__, __LINE__)
|
||||
#define IOWarningIn(fn, ios) Warning(fn, __FILE__, __LINE__, ios)
|
||||
|
||||
#define InfoIn(fn) Info(fn, __FILE__, __LINE__)
|
||||
#define IOInfoIn(fn, ios) Info(fn, __FILE__, __LINE__, ios)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
@ -219,6 +211,60 @@ extern messageStream Info;
|
||||
|
||||
#include "OSstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Convenience macros to add the file name and line number to the function name
|
||||
|
||||
/**
|
||||
* @def SeriousErrorIn(functionName)
|
||||
* Report an error message using Foam::SeriousError for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
*/
|
||||
#define SeriousErrorIn(fn) \
|
||||
::Foam::SeriousError((fn), __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @def SeriousIOErrorIn(functionName, ios)
|
||||
* Report an IO error message using Foam::SeriousError for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
* for a particular IOstream
|
||||
*/
|
||||
#define SeriousIOErrorIn(fn, ios) \
|
||||
::Foam::SeriousError((fn), __FILE__, __LINE__, ios)
|
||||
|
||||
/**
|
||||
* @def WarningIn(functionName)
|
||||
* Report a warning using Foam::Warning for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
*/
|
||||
#define WarningIn(fn) \
|
||||
::Foam::Warning((fn), __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @def IOWarningIn(functionName, ios)
|
||||
* Report an IO warning using Foam::Warning for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
* for a particular IOstream
|
||||
*/
|
||||
#define IOWarningIn(fn, ios) \
|
||||
::Foam::Warning((fn), __FILE__, __LINE__, (ios))
|
||||
|
||||
/**
|
||||
* @def InfoIn(functionName)
|
||||
* Report a information message using Foam::Info for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
*/
|
||||
#define InfoIn(fn) \
|
||||
::Foam::Info((fn), __FILE__, __LINE__)
|
||||
|
||||
/**
|
||||
* @def IOInfoIn(functionName, ios)
|
||||
* Report an IO information message using Foam::Info for functionName in
|
||||
* file __FILE__ at line __LINE__
|
||||
* for a particular IOstream
|
||||
*/
|
||||
#define IOInfoIn(fn, ios) \
|
||||
::Foam::Info((fn), __FILE__, __LINE__, (ios))
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
@ -93,7 +93,7 @@ class OutputFilterFunctionObject
|
||||
|
||||
//- Read relevant dictionary entries
|
||||
void readDict();
|
||||
|
||||
|
||||
//- Creates most of the data associated with this object.
|
||||
void allocateFilter();
|
||||
|
||||
|
||||
@ -282,7 +282,7 @@ tmp
|
||||
>
|
||||
cmptAv(const tmp<DimensionedField<Type, GeoMesh> >& tdf)
|
||||
{
|
||||
typedef typename DimensionedField<Type, GeoMesh>::cmptType
|
||||
typedef typename DimensionedField<Type, GeoMesh>::cmptType
|
||||
cmptType;
|
||||
|
||||
const DimensionedField<Type, GeoMesh>& df = tdf();
|
||||
|
||||
@ -212,7 +212,7 @@ tmp<FieldField<Field, Type> > FieldField<Field, Type>::NewCalculatedType
|
||||
);
|
||||
|
||||
forAll(*nffPtr, i)
|
||||
{
|
||||
{
|
||||
nffPtr->set(i, Field<Type>::NewCalculatedType(ff[i]).ptr());
|
||||
}
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ public:
|
||||
//- Return a list of the patch types
|
||||
wordList types() const;
|
||||
|
||||
//- Return BoundaryField of the cell values neighbouring
|
||||
//- Return BoundaryField of the cell values neighbouring
|
||||
// the boundary
|
||||
GeometricBoundaryField boundaryInternalField() const;
|
||||
|
||||
@ -194,7 +194,7 @@ public:
|
||||
|
||||
//- Write boundary field as dictionary entry
|
||||
void writeEntry(const word& keyword, Ostream& os) const;
|
||||
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
@ -208,7 +208,7 @@ public:
|
||||
void operator=(const Type&);
|
||||
|
||||
|
||||
//- Forced assignment to
|
||||
//- Forced assignment to
|
||||
// BoundaryField<Type, PatchField, BoundaryMesh>
|
||||
void operator==(const GeometricBoundaryField&);
|
||||
|
||||
@ -224,7 +224,7 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Current time index.
|
||||
//- Current time index.
|
||||
// Used to trigger the storing of the old-time value
|
||||
mutable label timeIndex_;
|
||||
|
||||
|
||||
@ -446,7 +446,7 @@ tmp
|
||||
>
|
||||
cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf)
|
||||
{
|
||||
typedef typename GeometricField<Type, PatchField, GeoMesh>::cmptType
|
||||
typedef typename GeometricField<Type, PatchField, GeoMesh>::cmptType
|
||||
cmptType;
|
||||
|
||||
const GeometricField<Type, PatchField, GeoMesh>& gf = tgf();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
|
||||
@ -46,7 +46,7 @@ template<class Type, class MeshMapper, class GeoMesh>
|
||||
class MapInternalField
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
MapInternalField()
|
||||
{}
|
||||
|
||||
@ -82,7 +82,7 @@ void MapGeometricFields
|
||||
// It is necessary to enforce that all old-time fields are stored
|
||||
// before the mapping is performed. Otherwise, if the
|
||||
// old-time-level field is mapped before the field itself, sizes
|
||||
// will not match.
|
||||
// will not match.
|
||||
|
||||
for
|
||||
(
|
||||
@ -92,7 +92,7 @@ void MapGeometricFields
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
|
||||
(*fieldIter());
|
||||
|
||||
@ -112,7 +112,7 @@ void MapGeometricFields
|
||||
++fieldIter
|
||||
)
|
||||
{
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
GeometricField<Type, PatchField, GeoMesh>& field =
|
||||
const_cast<GeometricField<Type, PatchField, GeoMesh>&>
|
||||
(*fieldIter());
|
||||
|
||||
@ -137,7 +137,7 @@ void MapGeometricFields
|
||||
// Cannot check sizes for patch fields because of
|
||||
// empty fields in FV and because point fields get their size
|
||||
// from the patch which has already been resized
|
||||
//
|
||||
//
|
||||
|
||||
field.boundaryField()[patchi].autoMap
|
||||
(
|
||||
|
||||
@ -88,7 +88,7 @@ tmp<GeometricField<Type, PatchField, GeoMesh> > transform
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
transform(trf, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
@ -102,7 +102,7 @@ tmp<GeometricField<Type, PatchField, GeoMesh> > transform
|
||||
const GeometricField<Type, PatchField, GeoMesh>& tf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
transform(ttrf(), tf);
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
@ -116,7 +116,7 @@ tmp<GeometricField<Type, PatchField, GeoMesh> > transform
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
transform(ttrf(), ttf());
|
||||
ttf.clear();
|
||||
ttrf.clear();
|
||||
@ -174,7 +174,7 @@ tmp<GeometricField<Type, PatchField, GeoMesh> > transform
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
|
||||
transform(t, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
|
||||
@ -124,7 +124,7 @@ Foam::wordList Foam::ReadFields
|
||||
)
|
||||
);
|
||||
}
|
||||
return masterNames;
|
||||
return masterNames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Class
|
||||
Description
|
||||
Accumulates point constraints through successive applications of the
|
||||
applyConstraint function.
|
||||
|
||||
|
||||
After all the constraints have been entered the resulting
|
||||
transformation tensor is returned by the constraintTransformation
|
||||
function.
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Apply and accumulate the effect of the given constraint direction
|
||||
//- Apply and accumulate the effect of the given constraint direction
|
||||
inline void applyConstraint(const vector& cd);
|
||||
|
||||
//- Return the accumulated constraint transformation tensor
|
||||
|
||||
@ -34,19 +34,28 @@ License
|
||||
#include "JobInfo.H"
|
||||
#include "labelList.H"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::argList::bannerEnabled = true;
|
||||
Foam::SLList<Foam::string> Foam::argList::validArgs;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
||||
bool Foam::argList::bannerEnabled(true);
|
||||
Foam::HashTable<Foam::string> Foam::argList::optionUsage;
|
||||
Foam::SLList<Foam::string> Foam::argList::notes;
|
||||
Foam::string::size_type Foam::argList::usageMin = 20;
|
||||
Foam::string::size_type Foam::argList::usageMax = 80;
|
||||
|
||||
|
||||
Foam::argList::initValidTables::initValidTables()
|
||||
{
|
||||
validOptions.set("case", "dir");
|
||||
validOptions.set("parallel", "");
|
||||
argList::addOption
|
||||
(
|
||||
"case", "dir",
|
||||
"specify alternate case directory, default is the cwd"
|
||||
);
|
||||
argList::addBoolOption("parallel", "run in parallel");
|
||||
validParOptions.set("parallel", "");
|
||||
|
||||
Pstream::addValidParOptions(validParOptions);
|
||||
@ -56,6 +65,182 @@ Foam::argList::initValidTables::initValidTables()
|
||||
Foam::argList::initValidTables dummyInitValidTables;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::argList::addBoolOption
|
||||
(
|
||||
const word& opt,
|
||||
const string& usage
|
||||
)
|
||||
{
|
||||
addOption(opt, "", usage);
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::addOption
|
||||
(
|
||||
const word& opt,
|
||||
const string& param,
|
||||
const string& usage
|
||||
)
|
||||
{
|
||||
validOptions.set(opt, param);
|
||||
if (!usage.empty())
|
||||
{
|
||||
optionUsage.set(opt, usage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::addUsage
|
||||
(
|
||||
const word& opt,
|
||||
const string& usage
|
||||
)
|
||||
{
|
||||
if (usage.empty())
|
||||
{
|
||||
optionUsage.erase(opt);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionUsage.set(opt, usage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::addNote(const string& note)
|
||||
{
|
||||
if (!note.empty())
|
||||
{
|
||||
notes.append(note);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::removeOption(const word& opt)
|
||||
{
|
||||
validOptions.erase(opt);
|
||||
optionUsage.erase(opt);
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::noBanner()
|
||||
{
|
||||
bannerEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::noParallel()
|
||||
{
|
||||
optionUsage.erase("parallel");
|
||||
validOptions.erase("parallel");
|
||||
validParOptions.clear();
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::printOptionUsage
|
||||
(
|
||||
const label location,
|
||||
const string& str
|
||||
)
|
||||
{
|
||||
const string::size_type textWidth = usageMax - usageMin;
|
||||
const string::size_type strLen = str.size();
|
||||
|
||||
if (strLen)
|
||||
{
|
||||
// minimum of 2 spaces between option and usage:
|
||||
if (string::size_type(location) + 2 <= usageMin)
|
||||
{
|
||||
for (string::size_type i = location; i < usageMin; ++i)
|
||||
{
|
||||
Info<<' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// or start a new line
|
||||
Info<< nl;
|
||||
for (string::size_type i = 0; i < usageMin; ++i)
|
||||
{
|
||||
Info<<' ';
|
||||
}
|
||||
}
|
||||
|
||||
// text wrap
|
||||
string::size_type pos = 0;
|
||||
while (pos != string::npos && pos + textWidth < strLen)
|
||||
{
|
||||
// potential end point and next point
|
||||
string::size_type curr = pos + textWidth - 1;
|
||||
string::size_type next = string::npos;
|
||||
|
||||
if (isspace(str[curr]))
|
||||
{
|
||||
// we were lucky: ended on a space
|
||||
next = str.find_first_not_of(" \t\n", curr);
|
||||
}
|
||||
else if (isspace(str[curr+1]))
|
||||
{
|
||||
// the next one is a space - so we are okay
|
||||
curr++; // otherwise the length is wrong
|
||||
next = str.find_first_not_of(" \t\n", curr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// search for end of a previous word break
|
||||
string::size_type prev = str.find_last_of(" \t\n", curr);
|
||||
|
||||
// reposition to the end of previous word if possible
|
||||
if (prev != string::npos && prev > pos)
|
||||
{
|
||||
curr = prev;
|
||||
}
|
||||
}
|
||||
|
||||
if (next == string::npos)
|
||||
{
|
||||
next = curr + 1;
|
||||
}
|
||||
|
||||
// indent following lines (not the first one)
|
||||
if (pos)
|
||||
{
|
||||
for (string::size_type i = 0; i < usageMin; ++i)
|
||||
{
|
||||
Info<<' ';
|
||||
}
|
||||
}
|
||||
|
||||
Info<< str.substr(pos, (curr - pos)).c_str() << nl;
|
||||
pos = next;
|
||||
}
|
||||
|
||||
// output the remainder of the string
|
||||
if (pos != string::npos)
|
||||
{
|
||||
// indent following lines (not the first one)
|
||||
if (pos)
|
||||
{
|
||||
for (string::size_type i = 0; i < usageMin; ++i)
|
||||
{
|
||||
Info<<' ';
|
||||
}
|
||||
}
|
||||
|
||||
Info<< str.substr(pos).c_str() << nl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// convert argv -> args_
|
||||
// transform sequences with "(" ... ")" into string lists in the process
|
||||
bool Foam::argList::regroupArgv(int& argc, char**& argv)
|
||||
@ -70,14 +255,14 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
|
||||
{
|
||||
if (strcmp(argv[argI], "(") == 0)
|
||||
{
|
||||
listDepth++;
|
||||
++listDepth;
|
||||
tmpString += "(";
|
||||
}
|
||||
else if (strcmp(argv[argI], ")") == 0)
|
||||
{
|
||||
if (listDepth)
|
||||
{
|
||||
listDepth--;
|
||||
--listDepth;
|
||||
tmpString += ")";
|
||||
if (listDepth == 0)
|
||||
{
|
||||
@ -114,19 +299,12 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
|
||||
}
|
||||
|
||||
|
||||
// get rootPath_ / globalCase_ from one of the following forms
|
||||
// * [-case dir]
|
||||
// * cwd
|
||||
//
|
||||
// Also export FOAM_CASE and FOAM_CASENAME environment variables
|
||||
// so they can be used immediately (eg, in decomposeParDict)
|
||||
//
|
||||
void Foam::argList::getRootCase()
|
||||
{
|
||||
fileName casePath;
|
||||
|
||||
// [-case dir] specified
|
||||
HashTable<string>::iterator iter = options_.find("case");
|
||||
HashTable<string>::const_iterator iter = options_.find("case");
|
||||
|
||||
if (iter != options_.end())
|
||||
{
|
||||
@ -173,14 +351,6 @@ void Foam::argList::getRootCase()
|
||||
setEnv("FOAM_CASE", casePath, true);
|
||||
setEnv("FOAM_CASENAME", casePath.name(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::stringList::subList Foam::argList::additionalArgs() const
|
||||
{
|
||||
return stringList::subList(args_, args_.size() - 1, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +368,7 @@ Foam::argList::argList
|
||||
options_(argc)
|
||||
{
|
||||
// Check if this run is a parallel run by searching for any parallel option
|
||||
// If found call runPar (might filter argv)
|
||||
// If found call runPar which might filter argv
|
||||
for (int argI = 0; argI < argc; argI++)
|
||||
{
|
||||
if (argv[argI][0] == '-')
|
||||
@ -246,13 +416,14 @@ Foam::argList::argList
|
||||
)
|
||||
)
|
||||
{
|
||||
argI++;
|
||||
++argI;
|
||||
if (argI >= args_.size())
|
||||
{
|
||||
FatalError
|
||||
<< "option " << "'-" << optionName << '\''
|
||||
<< " requires an argument"
|
||||
<< exit(FatalError);
|
||||
<<"Option '-" << optionName
|
||||
<< "' requires an argument" << endl;
|
||||
printUsage();
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
argListString += ' ';
|
||||
@ -270,7 +441,7 @@ Foam::argList::argList
|
||||
{
|
||||
args_[nArgs] = args_[argI];
|
||||
}
|
||||
nArgs++;
|
||||
++nArgs;
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,8 +583,8 @@ Foam::argList::argList
|
||||
bool hadCaseOpt = options_.found("case");
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
{
|
||||
@ -465,8 +636,8 @@ Foam::argList::argList
|
||||
// Distribute the master's argument list (unaltered)
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
{
|
||||
@ -510,8 +681,8 @@ Foam::argList::argList
|
||||
label procI = 0;
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
int slave = Pstream::firstSlave();
|
||||
slave <= Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
{
|
||||
@ -580,53 +751,100 @@ Foam::argList::~argList()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::argList::noBanner()
|
||||
Foam::stringList::subList Foam::argList::additionalArgs() const
|
||||
{
|
||||
bannerEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::noParallel()
|
||||
{
|
||||
validOptions.erase("parallel");
|
||||
return stringList::subList(args_, args_.size() - 1, 1);
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::printUsage() const
|
||||
{
|
||||
Info<< nl
|
||||
<< "Usage: " << executable_;
|
||||
Info<< "\nUsage: " << executable_ << " [OPTIONS]";
|
||||
|
||||
for
|
||||
(
|
||||
SLList<string>::iterator iter = validArgs.begin();
|
||||
iter != validArgs.end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIter(SLList<string>, validArgs, iter)
|
||||
{
|
||||
Info<< " <" << iter().c_str() << '>';
|
||||
}
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<string>::iterator iter = validOptions.begin();
|
||||
iter != validOptions.end();
|
||||
++iter
|
||||
)
|
||||
Info<< "\noptions:\n";
|
||||
|
||||
wordList opts = validOptions.sortedToc();
|
||||
forAll(opts, optI)
|
||||
{
|
||||
Info<< " [-" << iter.key();
|
||||
const word& optionName = opts[optI];
|
||||
|
||||
HashTable<string>::const_iterator iter = validOptions.find(optionName);
|
||||
Info<< " -" << optionName;
|
||||
label len = optionName.size() + 3; // length includes leading ' -'
|
||||
|
||||
if (iter().size())
|
||||
{
|
||||
Info<< ' ' << iter().c_str();
|
||||
// length includes space and between option/param and '<>'
|
||||
len += iter().size() + 3;
|
||||
Info<< " <" << iter().c_str() << '>';
|
||||
}
|
||||
|
||||
Info<< ']';
|
||||
HashTable<string>::const_iterator usageIter =
|
||||
optionUsage.find(optionName);
|
||||
|
||||
if (usageIter != optionUsage.end())
|
||||
{
|
||||
printOptionUsage
|
||||
(
|
||||
len,
|
||||
usageIter()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
// place help/doc/srcDoc options of the way at the end,
|
||||
// but with an extra space to separate it a little
|
||||
Info<< " [-help] [-doc] [-srcDoc]\n" << endl;
|
||||
//
|
||||
// place srcDoc/doc/help options at the end
|
||||
//
|
||||
Info<< " -srcDoc";
|
||||
printOptionUsage
|
||||
(
|
||||
9,
|
||||
"display source code in browser"
|
||||
);
|
||||
|
||||
Info<< " -doc";
|
||||
printOptionUsage
|
||||
(
|
||||
6,
|
||||
"display application documentation in browser"
|
||||
);
|
||||
|
||||
Info<< " -help";
|
||||
printOptionUsage
|
||||
(
|
||||
7,
|
||||
"print the usage"
|
||||
);
|
||||
|
||||
|
||||
// output notes directly - no automatic text wrapping
|
||||
if (!notes.empty())
|
||||
{
|
||||
Info<< nl;
|
||||
for
|
||||
(
|
||||
SLList<string>::const_iterator iter = notes.begin();
|
||||
iter != notes.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
Info<< iter().c_str() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<<"Using OpenFOAM-" << Foam::FOAMversion
|
||||
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.org"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -636,12 +854,12 @@ void Foam::argList::displayDoc(bool source) const
|
||||
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
|
||||
List<fileName> docExts(docDict.lookup("doxySourceFileExts"));
|
||||
|
||||
// for source code: change foo_8C.html to foo_8C-source.html
|
||||
// for source code: change foo_8C.html to foo_8C_source.html
|
||||
if (source)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
{
|
||||
docExts[extI].replace(".", "-source.");
|
||||
docExts[extI].replace(".", "_source.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,9 +59,10 @@ Description
|
||||
|
||||
Note
|
||||
- Adjustment of the valid (mandatory) arguments
|
||||
by directly manipulating the static member argList::validArgs.
|
||||
by directly manipulating the argList::validArgs static member.
|
||||
- Adjustment of the valid options
|
||||
by directly manipulating the static member argList::validOptions.
|
||||
via the addOption/removeOption static methods or by directly
|
||||
manipulating the argList::validOptions static member.
|
||||
|
||||
SourceFiles
|
||||
argList.C
|
||||
@ -114,8 +115,21 @@ class argList
|
||||
sigSegv sigSegv_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
// Private Member Functions
|
||||
|
||||
//- Helper function for printUsage
|
||||
static void printOptionUsage
|
||||
(
|
||||
const label location,
|
||||
const string& str
|
||||
);
|
||||
|
||||
//- get rootPath_ / globalCase_ from one of the following forms
|
||||
// * [-case dir]
|
||||
// * cwd
|
||||
//
|
||||
// Also export FOAM_CASE and FOAM_CASENAME environment variables
|
||||
// so they can be used immediately (eg, in decomposeParDict)
|
||||
void getRootCase();
|
||||
|
||||
//- Transcribe argv into internal args_
|
||||
@ -136,6 +150,18 @@ public:
|
||||
//- A list of valid parallel options
|
||||
static HashTable<string> validParOptions;
|
||||
|
||||
//- Short usage information for validOptions
|
||||
static HashTable<string> optionUsage;
|
||||
|
||||
//- Additional notes for usage
|
||||
static SLList<string> notes;
|
||||
|
||||
//- Min offset for displaying usage (default: 20)
|
||||
static string::size_type usageMin;
|
||||
|
||||
//- Max screen width for displaying usage (default: 80)
|
||||
static string::size_type usageMax;
|
||||
|
||||
//! @cond ignoreDocumentation
|
||||
class initValidTables
|
||||
{
|
||||
@ -159,8 +185,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
//- Destructor
|
||||
virtual ~argList();
|
||||
|
||||
|
||||
@ -169,85 +194,109 @@ public:
|
||||
// Access
|
||||
|
||||
//- Name of executable
|
||||
const word& executable() const
|
||||
{
|
||||
return executable_;
|
||||
}
|
||||
inline const word& executable() const;
|
||||
|
||||
//- Return root path
|
||||
const fileName& rootPath() const
|
||||
{
|
||||
return rootPath_;
|
||||
}
|
||||
|
||||
//- Return case name
|
||||
const fileName& globalCaseName() const
|
||||
{
|
||||
return globalCase_;
|
||||
}
|
||||
inline const fileName& rootPath() const;
|
||||
|
||||
//- Return case name (parallel run) or global case (serial run)
|
||||
const fileName& caseName() const
|
||||
{
|
||||
return case_;
|
||||
}
|
||||
inline const fileName& caseName() const;
|
||||
|
||||
//- Return the path
|
||||
fileName path() const
|
||||
{
|
||||
return rootPath()/caseName();
|
||||
}
|
||||
//- Return case name
|
||||
inline const fileName& globalCaseName() const;
|
||||
|
||||
//- Return the path to the caseName
|
||||
inline fileName path() const;
|
||||
|
||||
//- Return arguments
|
||||
const stringList& args() const
|
||||
{
|
||||
return args_;
|
||||
}
|
||||
inline const stringList& args() const;
|
||||
|
||||
//- Return additionl arguments,
|
||||
//- Return additional arguments,
|
||||
// i.e. those additional to the executable itself
|
||||
stringList::subList additionalArgs() const;
|
||||
|
||||
//- Return options
|
||||
const Foam::HashTable<string>& options() const
|
||||
{
|
||||
return options_;
|
||||
}
|
||||
inline const Foam::HashTable<string>& options() const;
|
||||
|
||||
//- Return the argument string associated with the named option
|
||||
const string& option(const word& opt) const
|
||||
{
|
||||
return options_.operator[](opt);
|
||||
}
|
||||
inline const string& option(const word& opt) const;
|
||||
|
||||
//- Return true if the named option is found
|
||||
bool optionFound(const word& opt) const
|
||||
{
|
||||
return options_.found(opt);
|
||||
}
|
||||
inline bool optionFound(const word& opt) const;
|
||||
|
||||
//- Return an IStringStream to the named option
|
||||
IStringStream optionLookup(const word& opt) const
|
||||
{
|
||||
return IStringStream(option(opt));
|
||||
}
|
||||
//- Return an IStringStream from the named option
|
||||
inline IStringStream optionLookup(const word& opt) const;
|
||||
|
||||
//- Read a value from the named option
|
||||
template<class T>
|
||||
T optionRead(const word& opt) const;
|
||||
inline T optionRead(const word& opt) const;
|
||||
|
||||
//- Read a value from the named option if present.
|
||||
// Return true if the named option was found.
|
||||
template<class T>
|
||||
bool optionReadIfPresent(const word& opt, T& val) const;
|
||||
inline bool optionReadIfPresent(const word& opt, T&) const;
|
||||
|
||||
//- Read a value from the named option if present.
|
||||
// Return true if the named option was found, otherwise
|
||||
// use the supplied default and return false.
|
||||
template<class T>
|
||||
inline bool optionReadIfPresent
|
||||
(
|
||||
const word& opt,
|
||||
T&,
|
||||
const T& deflt
|
||||
) const;
|
||||
|
||||
//- Read a value from the named option if present.
|
||||
// Return true if the named option was found.
|
||||
template<class T>
|
||||
inline T optionLookupOrDefault
|
||||
(
|
||||
const word& opt,
|
||||
const T& deflt
|
||||
) const;
|
||||
|
||||
//- Read a List of values from the named option
|
||||
template<class T>
|
||||
List<T> optionReadList(const word& opt) const;
|
||||
List<T> optionReadList(const word& opt) const
|
||||
{
|
||||
return readList<T>(optionLookup(opt)());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Add to a bool option to validOptions with usage information
|
||||
static void addBoolOption
|
||||
(
|
||||
const word& opt,
|
||||
const string& usage = ""
|
||||
);
|
||||
|
||||
//- Add to an option to validOptions with usage information
|
||||
// An option with an empty param is a bool option
|
||||
static void addOption
|
||||
(
|
||||
const word& opt,
|
||||
const string& param = "",
|
||||
const string& usage = ""
|
||||
);
|
||||
|
||||
//- Add option usage information to optionUsage
|
||||
static void addUsage
|
||||
(
|
||||
const word& opt,
|
||||
const string& usage
|
||||
);
|
||||
|
||||
//- Add extra notes for the usage information
|
||||
// This string is used "as-is" without additional formatting
|
||||
static void addNote(const string&);
|
||||
|
||||
//- Remove option from validOptions and from optionUsage
|
||||
static void removeOption(const word& opt);
|
||||
|
||||
//- Disable emitting the banner information
|
||||
static void noBanner();
|
||||
|
||||
@ -281,9 +330,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "argListTemplates.C"
|
||||
#endif
|
||||
#include "argListI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
190
src/OpenFOAM/global/argList/argListI.H
Normal file
190
src/OpenFOAM/global/argList/argListI.H
Normal file
@ -0,0 +1,190 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::word& Foam::argList::executable() const
|
||||
{
|
||||
return executable_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::argList::rootPath() const
|
||||
{
|
||||
return rootPath_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::argList::caseName() const
|
||||
{
|
||||
return case_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::argList::globalCaseName() const
|
||||
{
|
||||
return globalCase_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::argList::path() const
|
||||
{
|
||||
return rootPath()/caseName();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::stringList& Foam::argList::args() const
|
||||
{
|
||||
return args_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::HashTable<Foam::string>& Foam::argList::options() const
|
||||
{
|
||||
return options_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::string& Foam::argList::option(const word& opt) const
|
||||
{
|
||||
return options_.operator[](opt);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::argList::optionFound(const word& opt) const
|
||||
{
|
||||
return options_.found(opt);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const
|
||||
{
|
||||
return IStringStream(option(opt));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Template Specializations * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Template specialization for string
|
||||
template<>
|
||||
inline Foam::string
|
||||
Foam::argList::optionRead<Foam::string>(const word& opt) const
|
||||
{
|
||||
return option(opt);
|
||||
}
|
||||
|
||||
// Template specialization for word
|
||||
template<>
|
||||
inline Foam::word
|
||||
Foam::argList::optionRead<Foam::word>(const word& opt) const
|
||||
{
|
||||
return option(opt);
|
||||
}
|
||||
|
||||
// Template specialization for fileName
|
||||
template<>
|
||||
inline Foam::fileName
|
||||
Foam::argList::optionRead<Foam::fileName>(const word& opt) const
|
||||
{
|
||||
return option(opt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline T Foam::argList::optionRead(const word& opt) const
|
||||
{
|
||||
T val;
|
||||
|
||||
optionLookup(opt)() >> val;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::argList::optionReadIfPresent
|
||||
(
|
||||
const word& opt,
|
||||
T& val
|
||||
) const
|
||||
{
|
||||
if (optionFound(opt))
|
||||
{
|
||||
val = optionRead<T>(opt);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::argList::optionReadIfPresent
|
||||
(
|
||||
const word& opt,
|
||||
T& val,
|
||||
const T& deflt
|
||||
) const
|
||||
{
|
||||
if (optionReadIfPresent<T>(opt, val))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = deflt;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T Foam::argList::optionLookupOrDefault
|
||||
(
|
||||
const word& opt,
|
||||
const T& deflt
|
||||
) const
|
||||
{
|
||||
if (optionFound(opt))
|
||||
{
|
||||
return optionRead<T>(opt);
|
||||
}
|
||||
else
|
||||
{
|
||||
return deflt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "curve.H"
|
||||
|
||||
@ -77,7 +77,7 @@ public:
|
||||
SYMBOL_WITH_ERROR_BARS,
|
||||
SYMBOL_WITH_VARIABLE_SIZE
|
||||
};
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "graph.H"
|
||||
|
||||
@ -209,16 +209,16 @@ public:
|
||||
(),
|
||||
()
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
|
||||
//- Return a reference to the selected writer
|
||||
static autoPtr<writer> New
|
||||
(
|
||||
const word& writeFormat
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "gnuplotGraph.H"
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "jplotGraph.H"
|
||||
|
||||
@ -27,7 +27,7 @@ Class
|
||||
|
||||
Description
|
||||
jplot graph output
|
||||
|
||||
|
||||
SourceFiles
|
||||
jplotGraph.C
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rawGraph.H"
|
||||
|
||||
@ -2,4 +2,10 @@
|
||||
// addRegionOption.H
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
Foam::argList::validOptions.insert("region", "name");
|
||||
Foam::argList::addOption
|
||||
(
|
||||
"region",
|
||||
"name",
|
||||
"specify alternative mesh region"
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,28 @@
|
||||
// addTimeOptions.H
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
|
||||
Foam::argList::validOptions.insert("constant", "");
|
||||
Foam::argList::validOptions.insert("latestTime", "");
|
||||
Foam::argList::validOptions.insert("noZero", "");
|
||||
Foam::argList::validOptions.insert("time", "time");
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
"constant",
|
||||
"include the 'constant/' dir in the times list"
|
||||
);
|
||||
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
"latestTime",
|
||||
"select the latest time"
|
||||
);
|
||||
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
"noZero",
|
||||
"exclude the '0/' dir from the times list"
|
||||
);
|
||||
|
||||
Foam::argList::addOption
|
||||
(
|
||||
"time",
|
||||
"time",
|
||||
"specify a single time value to select"
|
||||
);
|
||||
|
||||
|
||||
@ -7,6 +7,6 @@
|
||||
|
||||
// unless -constant is present, skip startTime if it is "constant"
|
||||
# include "checkConstantOption.H"
|
||||
|
||||
|
||||
// check -time and -latestTime options
|
||||
# include "checkTimeOption.H"
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PatchToPatchInterpolation.H"
|
||||
|
||||
@ -80,7 +80,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
|
||||
|
||||
forAll(curFaces, facei)
|
||||
{
|
||||
pw[facei] =
|
||||
pw[facei] =
|
||||
1.0/mag(faces[curFaces[facei]].centre(points) - points[pointi]);
|
||||
sumw += pw[facei];
|
||||
}
|
||||
@ -133,7 +133,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
|
||||
vector S = points[edges[edgei].start()];
|
||||
vector e = edges[edgei].vec(points);
|
||||
|
||||
scalar alpha =
|
||||
scalar alpha =
|
||||
-(((N - P)^(S - P))&((N - P)^e))/(((N - P)^e )&((N - P)^e));
|
||||
|
||||
vector E = S + alpha*e;
|
||||
@ -318,7 +318,7 @@ tmp<Field<Type> > PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
|
||||
);
|
||||
|
||||
Field<Type>& result = tresult();
|
||||
|
||||
|
||||
const pointField& points = patch_.localPoints();
|
||||
const faceList& faces = patch_.localFaces();
|
||||
const edgeList& edges = patch_.edges();
|
||||
@ -328,7 +328,7 @@ tmp<Field<Type> > PrimitivePatchInterpolation<Patch>::faceToEdgeInterpolate
|
||||
|
||||
for (label edgei = 0; edgei < patch_.nInternalEdges(); edgei++)
|
||||
{
|
||||
result[edgei] =
|
||||
result[edgei] =
|
||||
weights[edgei]*pf[edgeFaces[edgei][0]]
|
||||
+ (1.0 - weights[edgei])*pf[edgeFaces[edgei][1]];
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
{
|
||||
return autoPtr<procLduInterface>(new procLduInterface(is));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ostream operator
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const procLduMatrix& cldum)
|
||||
<< cldum.upper_
|
||||
<< cldum.lower_
|
||||
<< cldum.interfaces_;
|
||||
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Class
|
||||
Description
|
||||
An abstract base class for implicitly-coupled interfaces
|
||||
e.g. processor and cyclic patches.
|
||||
|
||||
|
||||
SourceFiles
|
||||
lduInterface.C
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ namespace Foam
|
||||
|
||||
void Foam::processorLduInterface::resizeBuf
|
||||
(
|
||||
List<char>& buf,
|
||||
List<char>& buf,
|
||||
const label size
|
||||
) const
|
||||
{
|
||||
|
||||
@ -53,7 +53,7 @@ void Foam::cyclicLduInterfaceField::transformCoupleField
|
||||
{
|
||||
label sizeby2 = pnf.size()/2;
|
||||
|
||||
scalar forwardScale =
|
||||
scalar forwardScale =
|
||||
pow(diag(forwardT()[0]).component(cmpt), rank());
|
||||
|
||||
scalar reverseScale =
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
//- Construct from matrix components and preconditioner solver controls
|
||||
noPreconditioner
|
||||
(
|
||||
const lduMatrix::solver&,
|
||||
const lduMatrix::solver&,
|
||||
const dictionary& solverControlsUnused
|
||||
);
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
|
||||
)
|
||||
).ptr()
|
||||
);
|
||||
|
||||
|
||||
coarseInterfaceAddr[inti] = coarseInterfaces[inti].faceCells();
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ class GAMGSolver
|
||||
//- Calculate and return the scaling factor from Acf, coarseSource
|
||||
// and coarseField.
|
||||
// At the same time do a Jacobi iteration on the coarseField using
|
||||
// the Acf provided after the coarseField values are used for the
|
||||
// the Acf provided after the coarseField values are used for the
|
||||
// scaling factor.
|
||||
scalar scalingFactor
|
||||
(
|
||||
|
||||
@ -96,7 +96,7 @@ void Foam::GAMGSolver::agglomerateMatrix(const label fineLevelIndex)
|
||||
{
|
||||
if (fineInterfaces.set(inti))
|
||||
{
|
||||
const GAMGInterface& coarseInterface =
|
||||
const GAMGInterface& coarseInterface =
|
||||
refCast<const GAMGInterface>
|
||||
(
|
||||
agglomeration_.interfaceLevel(fineLevelIndex + 1)[inti]
|
||||
@ -182,7 +182,7 @@ void Foam::GAMGSolver::agglomerateMatrix(const label fineLevelIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
else // ... Otherwise it is symmetric so agglomerate just the upper
|
||||
else // ... Otherwise it is symmetric so agglomerate just the upper
|
||||
{
|
||||
// Get off-diagonal matrix coefficients
|
||||
const scalarField& fineUpper = fineMatrix.upper();
|
||||
|
||||
@ -73,7 +73,7 @@ class cyclicGAMGInterfaceField
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const cyclicGAMGInterfaceField&);
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
|
||||
|
||||
if (isA<ProcPatch>(patch))
|
||||
{
|
||||
const ProcPatch& procPatch =
|
||||
const ProcPatch& procPatch =
|
||||
refCast<const ProcPatch>(patch);
|
||||
|
||||
nNeighbours++;
|
||||
@ -71,7 +71,7 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
|
||||
|
||||
if (isA<ProcPatch>(patch))
|
||||
{
|
||||
const ProcPatch& procPatch =
|
||||
const ProcPatch& procPatch =
|
||||
refCast<const ProcPatch>(patch);
|
||||
|
||||
neighbours[nNeighbours++] = procPatch.neighbProcNo();
|
||||
|
||||
@ -28,11 +28,11 @@ Class
|
||||
Description
|
||||
Determines the order in which a set of processors should communicate
|
||||
with one another.
|
||||
|
||||
The communication order should
|
||||
|
||||
The communication order should
|
||||
- have maximum overlap
|
||||
- allow blocking communication without deadlock
|
||||
|
||||
|
||||
Does a very simple scheduling which assumes same time for all operations.
|
||||
|
||||
After construction:
|
||||
|
||||
@ -110,6 +110,26 @@ Foam::boundBox::boundBox(Istream& is)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::boundBox::corners() const
|
||||
{
|
||||
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
||||
pointField& pt = tPts();
|
||||
|
||||
pt[0] = min_; // min-x, min-y, min-z
|
||||
pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z
|
||||
pt[2] = point(max_.x(), max_.y(), min_.z()); // max-x, max-y, min-z
|
||||
pt[3] = point(min_.x(), max_.y(), min_.z()); // min-x, max-y, min-z
|
||||
pt[4] = point(min_.x(), min_.y(), max_.z()); // min-x, min-y, max-z
|
||||
pt[5] = point(max_.x(), min_.y(), max_.z()); // max-x, min-y, max-z
|
||||
pt[6] = max_; // max-x, max-y, max-z
|
||||
pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z
|
||||
|
||||
return tPts;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
|
||||
|
||||
@ -171,6 +171,8 @@ public:
|
||||
return cmptAv(span());
|
||||
}
|
||||
|
||||
//- Return corner points in an order corresponding to a 'hex' cell
|
||||
tmp<pointField> corners() const;
|
||||
|
||||
// Query
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ Foam::label Foam::cell::opposingFaceLabel
|
||||
{
|
||||
// There has already been an opposite face.
|
||||
// Non-prismatic cell
|
||||
Info<< "Multiple faces not sharing vertex: "
|
||||
Info<< "Multiple faces not sharing vertex: "
|
||||
<< oppositeFaceLabel << " and "
|
||||
<< curFaceLabels[faceI] << endl;
|
||||
return -1;
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellMatcher.H"
|
||||
@ -32,24 +30,11 @@ Description
|
||||
#include "Map.H"
|
||||
#include "faceList.H"
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::cellMatcher::makeIdentity(const label nElems)
|
||||
{
|
||||
labelList result(nElems);
|
||||
|
||||
forAll(result, elemI)
|
||||
{
|
||||
result[elemI] = elemI;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#include "ListOps.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::cellMatcher::cellMatcher
|
||||
(
|
||||
const label vertPerCell,
|
||||
@ -177,7 +162,7 @@ void Foam::cellMatcher::calcEdgeAddressing(const label numVert)
|
||||
{
|
||||
label start = f[prevVertI];
|
||||
label end = f[fp];
|
||||
|
||||
|
||||
label key1 = edgeKey(numVert, start, end);
|
||||
label key2 = edgeKey(numVert, end, start);
|
||||
|
||||
|
||||
@ -185,12 +185,6 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
// Static functions
|
||||
|
||||
//- Create list with incrementing labels
|
||||
static labelList makeIdentity(const label nElems);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given mesh and shape factors
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "degenerateMatcher.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -83,11 +84,10 @@ Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
|
||||
|
||||
return match
|
||||
(
|
||||
faces,
|
||||
labelList(faces.size(), 0), // Cell 0 is owner of all faces
|
||||
0, // cell 0
|
||||
labelList(cellMatcher::makeIdentity(faces.size())) // cell 0 consists
|
||||
// of all faces
|
||||
faces,
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell 0
|
||||
identity(faces.size()) // cell 0 consists of all faces
|
||||
);
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ Foam::cellShape Foam::degenerateMatcher::match
|
||||
{
|
||||
return match
|
||||
(
|
||||
mesh.faces(),
|
||||
mesh.faces(),
|
||||
mesh.faceOwner(),
|
||||
cellI,
|
||||
mesh.cells()[cellI]
|
||||
|
||||
@ -26,6 +26,7 @@ License
|
||||
|
||||
#include "hexMatcher.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,7 +37,6 @@ const Foam::label Foam::hexMatcher::maxVertPerFace = 4;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct null
|
||||
Foam::hexMatcher::hexMatcher()
|
||||
:
|
||||
cellMatcher
|
||||
@ -97,7 +97,7 @@ bool Foam::hexMatcher::matchShape
|
||||
faceLabels_.setSize(facePerCell);
|
||||
|
||||
//
|
||||
// Try bottom face (face 4).
|
||||
// Try bottom face (face 4).
|
||||
// Only need to try one orientation of this face since hex is
|
||||
// rotation symmetric
|
||||
//
|
||||
@ -298,7 +298,7 @@ bool Foam::hexMatcher::isA(const faceList& faces)
|
||||
faces, // all faces in mesh
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell label
|
||||
makeIdentity(faces.size()) // faces of cell 0
|
||||
identity(faces.size()) // faces of cell 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ License
|
||||
|
||||
#include "prismMatcher.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,7 +37,6 @@ const Foam::label Foam::prismMatcher::maxVertPerFace = 4;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::prismMatcher::prismMatcher()
|
||||
:
|
||||
cellMatcher
|
||||
@ -88,7 +88,7 @@ bool Foam::prismMatcher::matchShape
|
||||
faceLabels_.setSize(facePerCell);
|
||||
|
||||
//
|
||||
// Try first triangular face.
|
||||
// Try first triangular face.
|
||||
// Only need to try one orientation of this face since prism is
|
||||
// rotation symmetric
|
||||
//
|
||||
@ -222,7 +222,7 @@ bool Foam::prismMatcher::matchShape
|
||||
|
||||
|
||||
// Walk face 0 from vertex 1 to 2
|
||||
label face0vert2 =
|
||||
label face0vert2 =
|
||||
nextVert
|
||||
(
|
||||
face0vert1,
|
||||
@ -256,7 +256,7 @@ bool Foam::prismMatcher::matchShape
|
||||
// << " at position " << face3vert2 << " in face " << face3
|
||||
// << endl;
|
||||
|
||||
label face3vert5 =
|
||||
label face3vert5 =
|
||||
nextVert
|
||||
(
|
||||
face3vert2,
|
||||
@ -312,7 +312,7 @@ bool Foam::prismMatcher::faceSizeMatch
|
||||
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
|
||||
forAll(myFaces, myFaceI)
|
||||
{
|
||||
label size = faces[myFaces[myFaceI]].size();
|
||||
@ -363,7 +363,7 @@ bool Foam::prismMatcher::isA(const faceList& faces)
|
||||
faces, // all faces in mesh
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell label
|
||||
makeIdentity(faces.size()) // faces of cell 0
|
||||
identity(faces.size()) // faces of cell 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -286,7 +287,7 @@ bool Foam::pyrMatcher::isA(const faceList& faces)
|
||||
faces, // all faces in mesh
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell label
|
||||
makeIdentity(faces.size()) // faces of cell 0
|
||||
identity(faces.size()) // faces of cell 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -39,7 +40,6 @@ const Foam::label Foam::tetMatcher::maxVertPerFace = 3;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct null
|
||||
Foam::tetMatcher::tetMatcher()
|
||||
:
|
||||
cellMatcher
|
||||
@ -238,7 +238,7 @@ bool Foam::tetMatcher::isA(const faceList& faces)
|
||||
faces, // all faces in mesh
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell label
|
||||
makeIdentity(faces.size()) // faces of cell 0
|
||||
identity(faces.size()) // faces of cell 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -39,7 +40,6 @@ const Foam::label Foam::tetWedgeMatcher::maxVertPerFace = 4;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct null
|
||||
Foam::tetWedgeMatcher::tetWedgeMatcher()
|
||||
:
|
||||
cellMatcher
|
||||
@ -240,7 +240,7 @@ bool Foam::tetWedgeMatcher::faceSizeMatch
|
||||
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
|
||||
forAll(myFaces, myFaceI)
|
||||
{
|
||||
label size = faces[myFaces[myFaceI]].size();
|
||||
@ -291,7 +291,7 @@ bool Foam::tetWedgeMatcher::isA(const faceList& faces)
|
||||
faces, // all faces in mesh
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell label
|
||||
makeIdentity(faces.size()) // faces of cell 0
|
||||
identity(faces.size()) // faces of cell 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ License
|
||||
|
||||
#include "wedgeMatcher.H"
|
||||
#include "primitiveMesh.H"
|
||||
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,7 +37,6 @@ const Foam::label Foam::wedgeMatcher::maxVertPerFace = 4;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct null
|
||||
Foam::wedgeMatcher::wedgeMatcher()
|
||||
:
|
||||
cellMatcher
|
||||
@ -340,7 +339,7 @@ bool Foam::wedgeMatcher::faceSizeMatch
|
||||
|
||||
label nTris = 0;
|
||||
label nQuads = 0;
|
||||
|
||||
|
||||
forAll(myFaces, myFaceI)
|
||||
{
|
||||
label size = faces[myFaces[myFaceI]].size();
|
||||
@ -391,7 +390,7 @@ bool Foam::wedgeMatcher::isA(const faceList& faces)
|
||||
faces, // all faces in mesh
|
||||
labelList(faces.size(), 0), // cell 0 is owner of all faces
|
||||
0, // cell label
|
||||
makeIdentity(faces.size()) // faces of cell 0
|
||||
identity(faces.size()) // faces of cell 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellShape.H"
|
||||
|
||||
@ -211,7 +211,7 @@ inline Foam::faceList Foam::cellShape::collapsedFaces() const
|
||||
}
|
||||
newFaces.setSize(newFaceI);
|
||||
|
||||
return newFaces;
|
||||
return newFaces;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
face(f),
|
||||
masterIndex_(masterIndex),
|
||||
oppositeIndex_(oppositeIndex)
|
||||
|
||||
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user