Incorporating Swig interface: library changes. Origin: VulaSHAKA project

This commit is contained in:
Hrvoje Jasak 2010-10-15 19:55:32 +01:00
parent 5a13234f1c
commit 0a263adf4b
19 changed files with 318 additions and 118 deletions

View file

@ -65,10 +65,10 @@ template<class T, class Key, class Hash> Ostream& operator<<
/*---------------------------------------------------------------------------*\
Class HashPtrTable Declaration
Class HashPtrTable Declaration
\*---------------------------------------------------------------------------*/
template<class T, class Key=word, class Hash=string::hash>
template<class T, class Key = word, class Hash = string::hash>
class HashPtrTable
:
public HashTable<T*, Key, Hash>
@ -89,7 +89,7 @@ public:
// Constructors
//- Construct given initial table size
HashPtrTable(label size = 100);
HashPtrTable(const label size = 128);
//- Construct from Istream using given Istream constructor class
template<class INew>
@ -128,23 +128,19 @@ public:
// IOstream Operators
friend Istream& operator>>
#ifndef __CINT__
<T, Key, Hash>
#endif
#ifndef SWIG
friend Istream& operator>> <T, Key, Hash>
(
Istream&,
HashPtrTable<T, Key, Hash>&
);
friend Ostream& operator<<
#ifndef __CINT__
<T, Key, Hash>
#endif
friend Ostream& operator<< <T, Key, Hash>
(
Ostream&,
const HashPtrTable<T, Key, Hash>&
);
#endif
};

View file

@ -228,6 +228,7 @@ public:
// Declare run-time constructor selection tables
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -256,6 +257,7 @@ public:
),
(name, dict, index, bm)
);
#endif
// Constructors

View file

@ -48,11 +48,12 @@ namespace Foam
typedef SphericalTensor<scalar> sphericalTensor;
// Identity tensor
static const sphericalTensor I(1);
static const sphericalTensor oneThirdI(1.0/3.0);
static const sphericalTensor twoThirdsI(2.0/3.0);
// Identity tensor
static const sphericalTensor I;
static const sphericalTensor oneThirdI;
static const sphericalTensor twoThirdsI;
//- Specify data associated with sphericalTensor type are contiguous

View file

@ -136,6 +136,7 @@ public:
// IOstream Operators
#ifndef SWIG
friend Istream& operator>> <Form, Cmpt, nCmpt>
(
Istream&,
@ -147,6 +148,7 @@ public:
Ostream&,
const VectorSpace<Form, Cmpt, nCmpt>&
);
#endif
};

View file

@ -32,6 +32,11 @@ Description
combined using the given combination function and the result is
broadcast to all nodes
Note:
Format of this file has considerably changed to remove cpp pre-processor
definition in order to help Swig with parsing in. Implemented by
Alexey Petrov; merged by HJ, 14/Oct/2010
\*---------------------------------------------------------------------------*/
#ifndef ops_H
@ -42,103 +47,272 @@ Description
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class T1, class T2>
class eqOp2
{ public: void operator()(T1& x, const T2& y) const { x = y; } };
#define EqOp(opName, op) \
\
template<class T1, class T2> \
class opName##Op2 \
{ \
public: \
\
void operator()(T1& x, const T2& y) const \
{ \
op; \
} \
}; \
\
template<class T> \
class opName##Op \
{ \
public: \
\
void operator()(T& x, const T& y) const \
{ \
op; \
} \
};
template<class T>
class eqOp
{ public: void operator()(T& x, const T& y) const { x = y; } };
EqOp(eq, x = y)
EqOp(plusEq, x += y)
EqOp(minusEq, x -= y)
EqOp(multiplyEq, x *= y)
EqOp(divideEq, x /= y)
EqOp(eqMag, x = mag(y))
EqOp(plusEqMagSqr, x += magSqr(y))
EqOp(maxEq, x = max(x, y))
EqOp(minEq, x = min(x, y))
EqOp(andEq, x = (x && y))
EqOp(orEq, x = (x || y))
template<class T1, class T2>
class plusEqOp2
{ public: void operator()(T1& x, const T2& y) const { x += y; } };
EqOp(eqMinus, x = -y)
template<class T>
class plusEqOp
{ public: void operator()(T& x, const T& y) const { x += y; } };
#undef EqOp
template<class T1, class T2>
class minusEqOp2
{ public: void operator()(T1& x, const T2& y) const { x -= y; } };
template<class T>
class minusEqOp
{ public: void operator()(T& x, const T& y) const { x -= y; } };
template<class T1, class T2>
class multiplyEqOp2
{ public: void operator()(T1& x, const T2& y) const { x *= y; } };
template<class T>
class multiplyEqOp
{ public: void operator()(T& x, const T& y) const { x *= y; } };
template<class T1, class T2>
class divideEqOp2
{ public: void operator()(T1& x, const T2& y) const { x /= y; } };
template<class T>
class divideEqOp
{ public: void operator()(T& x, const T& y) const { x /= y; } };
template<class T1, class T2>
class eqMagOp2
{ public: void operator()(T1& x, const T2& y) const { x = mag(y); } };
template<class T>
class eqMagOp
{ public: void operator()(T& x, const T& y) const { x = mag(y); } };
template<class T1, class T2>
class plusEqMagSqrOp2
{ public: void operator()(T1& x, const T2& y) const { x += magSqr(y); } };
template<class T>
class plusEqMagSqrOp
{ public: void operator()(T& x, const T& y) const { x += magSqr(y); } };
template<class T1, class T2>
class maxEqOp2
{ public: void operator()(T1& x, const T2& y) const { x = max(x, y); } };
template<class T>
class maxEqOp
{ public: void operator()(T& x, const T& y) const { x = max(x, y); } };
template<class T1, class T2>
class minEqOp2
{ public: void operator()(T1& x, const T2& y) const { x = min(x, y); } };
template<class T>
class minEqOp
{ public: void operator()(T& x, const T& y) const { x = min(x, y); } };
template<class T1, class T2>
class andEqOp2
{ public: void operator()(T1& x, const T2& y) const { x = (x && y); } };
template<class T>
class andEqOp
{ public: void operator()(T& x, const T& y) const { x = (x && y); } };
template<class T1, class T2>
class orEqOp2
{ public: void operator()(T1& x, const T2& y) const { x = (x || y); } };
template<class T>
class orEqOp
{ public: void operator()(T& x, const T& y) const { x = (x || y); } };
template<class T1, class T2>
class eqMinusOp2
{ public: void operator()(T1& x, const T2& y) const { x = -y; } };
template<class T>
class eqMinusOp
{ public: void operator()(T& x, const T& y) const { x = -y; } };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define Op(opName, op) \
\
template<class T, class T1, class T2> \
class opName##Op3 \
{ \
public: \
\
T operator()(const T1& x, const T2& y) const \
{ \
return op; \
} \
}; \
\
template<class T1, class T2> \
class opName##Op2 \
{ \
public: \
\
T1 operator()(const T1& x, const T2& y) const \
{ \
return op; \
} \
}; \
\
template<class T> \
class opName##Op \
{ \
public: \
\
T operator()(const T& x, const T& y) const \
{ \
return op; \
} \
};
template<class T, class T1, class T2>
class sumOp3
{ public: T operator()(const T1& x, const T2& y) const { return x + y; } };
Op(sum, x + y)
template<class T1, class T2>
class sumOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x + y; } };
Op(plus, x + y)
Op(minus, x - y)
Op(multiply, x * y)
Op(divide, x / y)
Op(cmptMultiply, cmptMultiply(x, y))
Op(cmptDivide, cmptDivide(x, y))
Op(stabilise, stabilise(x, y))
Op(max, max(x, y))
Op(min, min(x, y))
Op(minMod, minMod(x, y))
Op(and, x && y)
Op(or, x || y)
Op(eqEq, x == y)
template<class T>
class sumOp
{ public: T operator()(const T& x, const T& y) const { return x + y; } };
#undef Op
template<class T, class T1, class T2>
class plusOp3
{ public: T operator()(const T1& x, const T2& y) const { return x + y; } };
template<class T1, class T2>
class plusOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x + y; } };
template<class T>
class plusOp
{ public: T operator()(const T& x, const T& y) const { return x + y; } };
template<class T, class T1, class T2>
class minusOp3
{ public: T operator()(const T1& x, const T2& y) const { return x - y; } };
template<class T1, class T2>
class minusOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x - y; } };
template<class T>
class minusOp
{ public: T operator()(const T& x, const T& y) const { return x - y; } };
template<class T, class T1, class T2>
class multiplyOp3
{ public: T operator()(const T1& x, const T2& y) const { return x * y; } };
template<class T1, class T2>
class multiplyOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x * y; } };
template<class T>
class multiplyOp
{ public: T operator()(const T& x, const T& y) const { return x * y; } };
template<class T, class T1, class T2>
class divideOp3
{ public: T operator()(const T1& x, const T2& y) const { return x / y; } };
template<class T1, class T2>
class divideOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x / y; } };
template<class T>
class divideOp
{ public: T operator()(const T& x, const T& y) const { return x / y; } };
template<class T, class T1, class T2>
class cmptMultiplyOp3
{ public: T operator()(const T1& x, const T2& y) const { return cmptMultiply(x, y); } };
template<class T1, class T2>
class cmptMultiplyOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return cmptMultiply(x, y); } };
template<class T>
class cmptMultiplyOp
{ public: T operator()(const T& x, const T& y) const { return cmptMultiply(x, y); } };
template<class T, class T1, class T2>
class cmptDivideOp3
{ public: T operator()(const T1& x, const T2& y) const { return cmptDivide(x, y); } };
template<class T1, class T2>
class cmptDivideOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return cmptDivide(x, y); } };
template<class T>
class cmptDivideOp
{ public: T operator()(const T& x, const T& y) const { return cmptDivide(x, y); } };
template<class T, class T1, class T2>
class stabiliseOp3
{ public: T operator()(const T1& x, const T2& y) const { return stabilise(x, y); } };
template<class T1, class T2>
class stabiliseOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return stabilise(x, y); } };
template<class T>
class stabiliseOp
{ public: T operator()(const T& x, const T& y) const { return stabilise(x, y); } };
template<class T, class T1, class T2>
class maxOp3
{ public: T operator()(const T1& x, const T2& y) const { return max(x, y); } };
template<class T1, class T2>
class maxOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return max(x, y); } };
template<class T>
class maxOp
{ public: T operator()(const T& x, const T& y) const { return max(x, y); } };
template<class T, class T1, class T2>
class minOp3
{ public: T operator()(const T1& x, const T2& y) const { return min(x, y); } };
template<class T1, class T2>
class minOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return min(x, y); } };
template<class T>
class minOp
{ public: T operator()(const T& x, const T& y) const { return min(x, y); } };
template<class T, class T1, class T2>
class minModOp3
{ public: T operator()(const T1& x, const T2& y) const { return minMod(x, y); } };
template<class T1, class T2>
class minModOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return minMod(x, y); } };
template<class T>
class minModOp
{ public: T operator()(const T& x, const T& y) const { return minMod(x, y); } };
template<class T, class T1, class T2>
class andOp3
{ public: T operator()(const T1& x, const T2& y) const { return x && y; } };
template<class T1, class T2>
class andOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x && y; } };
template<class T>
class andOp
{ public: T operator()(const T& x, const T& y) const { return x && y; } };
template<class T, class T1, class T2>
class orOp3
{ public: T operator()(const T1& x, const T2& y) const { return x || y; } };
template<class T1, class T2>
class orOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x || y; } };
template<class T>
class orOp
{ public: T operator()(const T& x, const T& y) const { return x || y; } };
template<class T, class T1, class T2>
class eqEqOp3
{ public: T operator()(const T1& x, const T2& y) const { return x == y; } };
template<class T1, class T2>
class eqEqOp2
{ public: T1 operator()(const T1& x, const T2& y) const { return x == y; } };
template<class T>
class eqEqOp
{ public: T operator()(const T& x, const T& y) const { return x == y; } };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -71,6 +71,7 @@ public:
// Declare run-time constructor selection table
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -79,6 +80,7 @@ public:
(const IOobject& io),
(io)
);
#endif
// Constructors

View file

@ -114,6 +114,7 @@ public:
// Declare run-time constructor selection tables
#ifndef SWIG
declareRunTimeSelectionTable
(
tmp,
@ -152,7 +153,7 @@ public:
),
(p, iF, dict)
);
#endif
// Constructors
@ -469,7 +470,9 @@ public:
// Ostream operator
#ifndef SWIG
friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&);
#endif
};

View file

@ -102,6 +102,7 @@ public:
// Declare run-time constructor selection tables
#ifndef SWIG
declareRunTimeSelectionTable
(
tmp,
@ -140,7 +141,7 @@ public:
),
(p, iF, dict)
);
#endif
// Constructors
@ -354,7 +355,13 @@ public:
// Ostream operator
friend Ostream& operator<< <Type>(Ostream&, const fvsPatchField<Type>&);
#ifndef SWIG
friend Ostream& operator<< <Type>
(
Ostream&,
const fvsPatchField<Type>&
);
#endif
};

View file

@ -447,6 +447,7 @@ public:
// Friend operators
#ifndef SWIG
friend tmp<GeometricField<Type, fvPatchField, volMesh> >
operator& <Type>
(
@ -483,6 +484,7 @@ public:
Ostream&,
const fvMatrix<Type>&
);
#endif
};

View file

@ -113,6 +113,7 @@ public:
// Declare run-time constructor selection tables
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -121,6 +122,7 @@ public:
(const polyPatch& patch, const fvBoundaryMesh& bm),
(patch, bm)
);
#endif
// Constructors

View file

@ -69,6 +69,8 @@ public:
//- Declare run-time constructor selection table
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -77,6 +79,8 @@ public:
(const fvMesh& mesh),
(mesh)
);
#endif
// Constructors

View file

@ -121,6 +121,7 @@ public:
// Declare runtime constructor selection table
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -131,7 +132,7 @@ public:
),
(T)
);
#endif
// Constructors

View file

@ -131,11 +131,11 @@ tmp<volScalarField> twoPhaseMixture::rho() const
{
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
return tmp<volScalarField>
return tmp<volScalarField>
(
new volScalarField
(
"rho",
"rho_twoPhaseMixture",
limitedAlpha1*rho1_
+ (scalar(1) - limitedAlpha1)*rho2_
)
@ -151,7 +151,7 @@ tmp<volScalarField> twoPhaseMixture::mu() const
(
new volScalarField
(
"mu",
"mu_twoPhaseMixture",
limitedAlpha1*rho1_*nuModel1_->nu()
+ (scalar(1) - limitedAlpha1)*rho2_*nuModel2_->nu()
)
@ -168,7 +168,7 @@ tmp<surfaceScalarField> twoPhaseMixture::muf() const
(
new surfaceScalarField
(
"muf",
"muf_twoPhaseMixture",
alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
+ (scalar(1) - alpha1f)*rho2_*fvc::interpolate(nuModel2_->nu())
)
@ -185,7 +185,7 @@ tmp<surfaceScalarField> twoPhaseMixture::nuf() const
(
new surfaceScalarField
(
"nuf",
"nuf_twoPhaseMixture",
(
alpha1f*rho1_*fvc::interpolate(nuModel1_->nu())
+ (scalar(1) - alpha1f)*rho2_*fvc::interpolate(nuModel2_->nu())

View file

@ -92,6 +92,7 @@ public:
// Declare run-time constructor selection table
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -105,6 +106,7 @@ public:
),
(name, viscosityProperties, U, phi)
);
#endif
// Selectors

View file

@ -144,7 +144,7 @@ public:
// Selectors
//- Return a reference to the selected LES model
static autoPtr<LESModel> New
static autoPtr<compressible::LESModel> New
(
const volScalarField& rho,
const volVectorField& U,

View file

@ -136,6 +136,7 @@ public:
// Declare run-time constructor selection table
#ifndef SWIG
declareRunTimeSelectionTable
(
autoPtr,
@ -149,7 +150,7 @@ public:
),
(rho, U, phi, thermoPhysicalModel)
);
#endif
// Constructors
@ -167,7 +168,7 @@ public:
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<RASModel> New
static autoPtr<compressible::RASModel> New
(
const volScalarField& rho,
const volVectorField& U,
@ -176,8 +177,7 @@ public:
);
// Destructor
//- Destructor
virtual ~RASModel()
{}

View file

@ -104,6 +104,7 @@ public:
// Declare run-time constructor selection table
#ifndef SWIG
declareRunTimeNewSelectionTable
(
autoPtr,
@ -117,6 +118,7 @@ public:
),
(rho, U, phi, thermoPhysicalModel)
);
#endif
// Constructors
@ -134,7 +136,7 @@ public:
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<turbulenceModel> New
static autoPtr<compressible::turbulenceModel> New
(
const volScalarField& rho,
const volVectorField& U,

View file

@ -142,7 +142,7 @@ public:
// Selectors
//- Return a reference to the selected LES model
static autoPtr<LESModel> New
static autoPtr<incompressible::LESModel> New
(
const volVectorField& U,
const surfaceScalarField& phi,

View file

@ -159,7 +159,7 @@ public:
// Selectors
//- Return a reference to the selected RAS model
static autoPtr<RASModel> New
static autoPtr<incompressible::RASModel> New
(
const volVectorField& U,
const surfaceScalarField& phi,