Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-01-23 12:51:45 +01:00
36 changed files with 103 additions and 89 deletions

View File

@ -395,7 +395,7 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const
( (
"Ma", "Ma",
mesh.time().timeName(), mesh.time().timeName(),
mesh.db(), mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),

View File

@ -613,7 +613,7 @@ autoPtr<mapPolyMesh> createRegionMesh
"fvSchemes", "fvSchemes",
mesh.time().system(), mesh.time().system(),
regionName, regionName,
mesh.db(), mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
@ -642,7 +642,7 @@ autoPtr<mapPolyMesh> createRegionMesh
"fvSolution", "fvSolution",
mesh.time().system(), mesh.time().system(),
regionName, regionName,
mesh.db(), mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false

View File

@ -192,9 +192,14 @@ public:
//- Assignment of all addressed entries to the given value //- Assignment of all addressed entries to the given value
inline void operator=(const T&); inline void operator=(const T&);
//- Assignment from List<T>. Also handles assignment from DynamicList. //- Assignment from DynamicList
inline void operator=(const UList<T>&); inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Assignment from List<T>.
inline void operator=(const UList<T>&);
// IOstream operators // IOstream operators

View File

@ -386,13 +386,36 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
( (
const UList<T>& lst const UList<T>& lst
) )
{
if (capacity_ >= lst.size())
{
// can copy w/o reallocating, match initial size to avoid reallocation
List<T>::size(lst.size());
List<T>::operator=(lst);
}
else
{
// make everything available for the copy operation
List<T>::size(capacity_);
List<T>::operator=(lst);
capacity_ = List<T>::size();
}
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>& lst
)
{ {
if (this == &lst) if (this == &lst)
{ {
FatalErrorIn FatalErrorIn
( (
"DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=" "DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator="
"(const UList<T>&)" "(const DynamicList<T, SizeInc, SizeMult, SizeDiv>&)"
) << "attempted assignment to self" << abort(FatalError); ) << "attempted assignment to self" << abort(FatalError);
} }

View File

@ -75,7 +75,7 @@ void MapGeometricFields
{ {
HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
( (
mapper.db().objectRegistry::lookupClass mapper.thisDb().objectRegistry::lookupClass
<GeometricField<Type, PatchField, GeoMesh> >() <GeometricField<Type, PatchField, GeoMesh> >()
); );
@ -145,7 +145,7 @@ void MapGeometricFields
); );
} }
field.instance() = field.mesh().db().time().timeName(); field.instance() = field.time().timeName();
} }
else if (polyMesh::debug) else if (polyMesh::debug)
{ {

View File

@ -97,7 +97,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
{ {
if if
( (
!mesh.db().objectRegistry::foundObject<GAMGAgglomeration> !mesh.thisDb().foundObject<GAMGAgglomeration>
( (
GAMGAgglomeration::typeName GAMGAgglomeration::typeName
) )
@ -134,7 +134,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<GAMGAgglomeration> return mesh.thisDb().lookupObject<GAMGAgglomeration>
( (
GAMGAgglomeration::typeName GAMGAgglomeration::typeName
); );
@ -152,7 +152,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
if if
( (
!mesh.db().objectRegistry::foundObject<GAMGAgglomeration> !mesh.thisDb().foundObject<GAMGAgglomeration>
( (
GAMGAgglomeration::typeName GAMGAgglomeration::typeName
) )
@ -185,7 +185,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<GAMGAgglomeration> return mesh.thisDb().lookupObject<GAMGAgglomeration>
( (
GAMGAgglomeration::typeName GAMGAgglomeration::typeName
); );

View File

@ -76,7 +76,7 @@ public:
// Member Functions // Member Functions
//- Return the object registry //- Return the object registry
const objectRegistry& db() const const objectRegistry& thisDb() const
{ {
return mesh_; return mesh_;
} }

View File

@ -37,8 +37,8 @@ Foam::MeshObject<Mesh, Type>::MeshObject(const Mesh& mesh)
IOobject IOobject
( (
Type::typeName, Type::typeName,
mesh.db().instance(), mesh.thisDb().instance(),
mesh.db() mesh.thisDb()
) )
), ),
mesh_(mesh) mesh_(mesh)
@ -53,13 +53,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Mesh& mesh const Mesh& mesh
) )
{ {
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName)) if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{ {
return store(new Type(mesh)); return store(new Type(mesh));
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<Type>(Type::typeName); return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
} }
} }
@ -72,13 +72,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data1& d const Data1& d
) )
{ {
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName)) if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{ {
return store(new Type(mesh, d)); return store(new Type(mesh, d));
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<Type>(Type::typeName); return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
} }
} }
@ -92,13 +92,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data2& d2 const Data2& d2
) )
{ {
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName)) if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{ {
return store(new Type(mesh, d1, d2)); return store(new Type(mesh, d1, d2));
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<Type>(Type::typeName); return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
} }
} }
@ -113,13 +113,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data3& d3 const Data3& d3
) )
{ {
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName)) if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{ {
return store(new Type(mesh, d1, d2, d3)); return store(new Type(mesh, d1, d2, d3));
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<Type>(Type::typeName); return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
} }
} }
@ -135,13 +135,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Data4& d4 const Data4& d4
) )
{ {
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName)) if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{ {
return store(new Type(mesh, d3, d4)); return store(new Type(mesh, d3, d4));
} }
else else
{ {
return mesh.db().objectRegistry::lookupObject<Type>(Type::typeName); return mesh.thisDb().objectRegistry::lookupObject<Type>(Type::typeName);
} }
} }
@ -151,13 +151,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
template<class Mesh, class Type> template<class Mesh, class Type>
bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh) bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
{ {
if (mesh.db().objectRegistry::foundObject<Type>(Type::typeName)) if (mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{ {
return mesh.db().objectRegistry::checkOut return mesh.thisDb().checkOut
( (
const_cast<Type&> const_cast<Type&>
( (
mesh.db().objectRegistry::lookupObject<Type> mesh.thisDb().objectRegistry::lookupObject<Type>
( (
Type::typeName Type::typeName
) )

View File

@ -36,9 +36,9 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::objectRegistry& Foam::lduMesh::db() const const Foam::objectRegistry& Foam::lduMesh::thisDb() const
{ {
notImplemented("lduMesh::db() const"); notImplemented("lduMesh::thisDb() const");
const objectRegistry* orPtr_ = NULL; const objectRegistry* orPtr_ = NULL;
return *orPtr_; return *orPtr_;
} }

View File

@ -71,7 +71,7 @@ public:
// Access // Access
//- Return the object registry //- Return the object registry
virtual const objectRegistry& db() const; virtual const objectRegistry& thisDb() const;
//- Return ldu addressing //- Return ldu addressing
virtual const lduAddressing& lduAddr() const = 0; virtual const lduAddressing& lduAddr() const = 0;

View File

@ -112,10 +112,10 @@ public:
return GeoMesh<polyMesh>::mesh_.globalData(); return GeoMesh<polyMesh>::mesh_.globalData();
} }
//- Return database (only needed for compilation purposes) //- Return database. For now is its polyMesh.
const objectRegistry& db() const const objectRegistry& thisDb() const
{ {
return GeoMesh<polyMesh>::mesh_.db(); return GeoMesh<polyMesh>::mesh_.thisDb();
} }

View File

@ -100,7 +100,7 @@ public:
//- Return reference to objectRegistry storing fields. Can be //- Return reference to objectRegistry storing fields. Can be
// removed once fields stored on pointMesh. // removed once fields stored on pointMesh.
const objectRegistry& db() const const objectRegistry& thisDb() const
{ {
return mesh_(); return mesh_();
} }

View File

@ -1042,17 +1042,11 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
// movePoints function. // movePoints function.
// pointMesh // pointMesh
if if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
(
db().objectRegistry::foundObject<pointMesh>
(
pointMesh::typeName
)
)
{ {
const_cast<pointMesh&> const_cast<pointMesh&>
( (
db().objectRegistry::lookupObject<pointMesh> thisDb().lookupObject<pointMesh>
( (
pointMesh::typeName pointMesh::typeName
) )
@ -1094,7 +1088,7 @@ const Foam::globalMeshData& Foam::polyMesh::globalData() const
// Remove all files and some subdirs (eg, sets) // Remove all files and some subdirs (eg, sets)
void Foam::polyMesh::removeFiles(const fileName& instanceDir) const void Foam::polyMesh::removeFiles(const fileName& instanceDir) const
{ {
fileName meshFilesPath = db().path()/instanceDir/meshDir(); fileName meshFilesPath = thisDb().path()/instanceDir/meshDir();
rm(meshFilesPath/"points"); rm(meshFilesPath/"points");
rm(meshFilesPath/"faces"); rm(meshFilesPath/"faces");

View File

@ -343,6 +343,11 @@ public:
//- Return parallel info //- Return parallel info
const globalMeshData& globalData() const; const globalMeshData& globalData() const;
//- Return the object registry
const objectRegistry& thisDb() const
{
return *this;
}
// Mesh motion // Mesh motion

View File

@ -71,17 +71,11 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
// Hack until proper callbacks. Below are all the polyMesh-MeshObjects. // Hack until proper callbacks. Below are all the polyMesh-MeshObjects.
// pointMesh // pointMesh
if if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
(
db().objectRegistry::foundObject<pointMesh>
(
pointMesh::typeName
)
)
{ {
const_cast<pointMesh&> const_cast<pointMesh&>
( (
db().objectRegistry::lookupObject<pointMesh> thisDb().lookupObject<pointMesh>
( (
pointMesh::typeName pointMesh::typeName
) )

View File

@ -2889,12 +2889,12 @@ void Foam::autoLayerDriver::addLayers
//mesh.name()+"_layer", //mesh.name()+"_layer",
mesh.name(), mesh.name(),
static_cast<polyMesh&>(mesh).instance(), static_cast<polyMesh&>(mesh).instance(),
mesh.db(), mesh.time(), // register with runTime
static_cast<polyMesh&>(mesh).readOpt(), static_cast<polyMesh&>(mesh).readOpt(),
static_cast<polyMesh&>(mesh).writeOpt() static_cast<polyMesh&>(mesh).writeOpt()
), // io params from original mesh but new name ), // io params from original mesh but new name
mesh, // original mesh mesh, // original mesh
true // parallel sync true // parallel sync
); );
fvMesh& newMesh = newMeshPtr(); fvMesh& newMesh = newMeshPtr();

View File

@ -80,7 +80,7 @@ Foam::label Foam::autoRefineDriver::readFeatureEdges
featFileName, // name featFileName, // name
mesh.time().constant(), // directory mesh.time().constant(), // directory
"triSurface", // instance "triSurface", // instance
mesh.db(), // registry mesh.time(), // registry
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false

View File

@ -443,7 +443,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
{ {
const labelList& cPoints = mesh_.cellPoints(cellI, dynCPoints); const labelList& cPoints = mesh_.cellPoints(cellI, dynCPoints);
// Get number of anchor points (pointLevel == cellLevel) // Get number of anchor points (pointLevel <= cellLevel)
label nBoundaryAnchors = 0; label nBoundaryAnchors = 0;
label nNonAnchorBoundary = 0; label nNonAnchorBoundary = 0;

View File

@ -56,8 +56,8 @@ Foam::SRF::SRFModel::SRFModel
IOobject IOobject
( (
"SRFProperties", "SRFProperties",
Urel.mesh().time().constant(), Urel.time().constant(),
Urel.mesh().db(), Urel.db(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )

View File

@ -53,8 +53,8 @@ autoPtr<SRFModel> SRFModel::New
IOobject IOobject
( (
"SRFProperties", "SRFProperties",
Urel.mesh().time().constant(), Urel.time().constant(),
Urel.mesh().db(), Urel.db(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )

View File

@ -485,17 +485,11 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
template<class Type> template<class Type>
void MeshObjectMovePoints(const Foam::fvMesh& mesh) void MeshObjectMovePoints(const Foam::fvMesh& mesh)
{ {
if if (mesh.thisDb().foundObject<Type>(Type::typeName))
(
mesh.db().objectRegistry::foundObject<Type>
(
Type::typeName
)
)
{ {
const_cast<Type&> const_cast<Type&>
( (
mesh.db().objectRegistry::lookupObject<Type> mesh.thisDb().lookupObject<Type>
( (
Type::typeName Type::typeName
) )

View File

@ -221,10 +221,10 @@ public:
return polyMesh::time(); return polyMesh::time();
} }
//- Return the object registry //- Return the object registry - resolve conflict polyMesh/lduMesh
virtual const objectRegistry& db() const virtual const objectRegistry& thisDb() const
{ {
return *this; return polyMesh::thisDb();
} }
//- Return reference to name //- Return reference to name

View File

@ -108,7 +108,7 @@ public:
//- Return reference to objectRegistry storing fields. Can be //- Return reference to objectRegistry storing fields. Can be
// removed once fields stored on pointMesh. // removed once fields stored on pointMesh.
const objectRegistry& db() const const objectRegistry& thisDb() const
{ {
return mesh_; return mesh_;
} }

View File

@ -335,7 +335,6 @@ public:
( (
const GeometricField<Type, pointPatchField, pointMesh>&, const GeometricField<Type, pointPatchField, pointMesh>&,
const pointMesh& sMesh, const pointMesh& sMesh,
const objectRegistry& reg,
const labelList& patchMap, const labelList& patchMap,
const labelList& pointMap const labelList& pointMap
); );

View File

@ -299,7 +299,6 @@ fvMeshSubset::interpolate
( (
const GeometricField<Type, pointPatchField, pointMesh>& vf, const GeometricField<Type, pointPatchField, pointMesh>& vf,
const pointMesh& sMesh, const pointMesh& sMesh,
const objectRegistry& reg,
const labelList& patchMap, const labelList& patchMap,
const labelList& pointMap const labelList& pointMap
) )
@ -385,7 +384,7 @@ fvMeshSubset::interpolate
( (
"subset"+vf.name(), "subset"+vf.name(),
vf.time().timeName(), vf.time().timeName(),
reg, sMesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
@ -410,7 +409,6 @@ tmp<GeometricField<Type, pointPatchField, pointMesh> > fvMeshSubset::interpolate
( (
sf, sf,
pointMesh::New(subMesh()), // subsetted point mesh pointMesh::New(subMesh()), // subsetted point mesh
subMesh(), // registry (pointfields are stored on the polyMesh)
patchMap(), patchMap(),
pointMap() pointMap()
); );

View File

@ -128,7 +128,7 @@ volPointInterpolation::interpolate
( (
"volPointInterpolate(" + vf.name() + ')', "volPointInterpolate(" + vf.name() + ')',
vf.instance(), vf.instance(),
vf.db() pMesh.thisDb()
), ),
pMesh, pMesh,
vf.dimensions(), vf.dimensions(),
@ -168,6 +168,8 @@ volPointInterpolation::interpolate
const GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) const ) const
{ {
const pointMesh& pm = pointMesh::New(vf.mesh());
tmp<GeometricField<Type, pointPatchField, pointMesh> > tpf tmp<GeometricField<Type, pointPatchField, pointMesh> > tpf
( (
new GeometricField<Type, pointPatchField, pointMesh> new GeometricField<Type, pointPatchField, pointMesh>
@ -176,9 +178,9 @@ volPointInterpolation::interpolate
( (
"volPointInterpolate(" + vf.name() + ')', "volPointInterpolate(" + vf.name() + ')',
vf.instance(), vf.instance(),
vf.db() pm.thisDb()
), ),
pointMesh::New(vf.mesh()), pm,
vf.dimensions() vf.dimensions()
) )
); );

View File

@ -22,8 +22,8 @@ $(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
cuttingPlane/cuttingPlane.C cuttingPlane/cuttingPlane.C
sampledSurface/patch/sampledPatch.C sampledSurface/sampledPatch/sampledPatch.C
sampledSurface/plane/sampledPlane.C sampledSurface/sampledPlane/sampledPlane.C
sampledSurface/isoSurface/isoSurface.C sampledSurface/isoSurface/isoSurface.C
sampledSurface/isoSurface/sampledIsoSurface.C sampledSurface/isoSurface/sampledIsoSurface.C
sampledSurface/isoSurface/isoSurfaceCell.C sampledSurface/isoSurface/isoSurfaceCell.C

View File

@ -52,8 +52,8 @@ autoPtr<radiationModel> radiationModel::New
IOobject IOobject
( (
"radiationProperties", "radiationProperties",
T.mesh().time().constant(), T.time().constant(),
T.mesh().db(), T.db(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )

View File

@ -54,8 +54,8 @@ Foam::radiation::radiationModel::radiationModel
IOobject IOobject
( (
"radiationProperties", "radiationProperties",
T.mesh().time().constant(), T.time().constant(),
T.mesh().db(), T.db(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )

View File

@ -343,7 +343,7 @@ bool Foam::movingConeTopoFvMesh::update()
// << endl; // << endl;
{ {
OFstream str(db().path()/"meshPoints.obj"); OFstream str(thisDb().path()/"meshPoints.obj");
Pout<< "Writing mesh with meshPoints to " << str.name() Pout<< "Writing mesh with meshPoints to " << str.name()
<< endl; << endl;
@ -361,7 +361,7 @@ bool Foam::movingConeTopoFvMesh::update()
} }
} }
{ {
OFstream str(db().path()/"preMotionPoints.obj"); OFstream str(thisDb().path()/"preMotionPoints.obj");
Pout<< "Writing mesh with preMotionPoints to " << str.name() Pout<< "Writing mesh with preMotionPoints to " << str.name()
<< endl; << endl;