Commit 42c04b85 authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge commit 'OpenCFD/master' into olesenm

parents f86636ed 41c1239a
......@@ -395,7 +395,7 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const
(
"Ma",
mesh.time().timeName(),
mesh.db(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
......
......@@ -613,7 +613,7 @@ autoPtr<mapPolyMesh> createRegionMesh
"fvSchemes",
mesh.time().system(),
regionName,
mesh.db(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
......@@ -642,7 +642,7 @@ autoPtr<mapPolyMesh> createRegionMesh
"fvSolution",
mesh.time().system(),
regionName,
mesh.db(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
......
......@@ -192,9 +192,14 @@ public:
//- Assignment of all addressed entries to the given value
inline void operator=(const T&);
//- Assignment from List<T>. Also handles assignment from DynamicList.
inline void operator=(const UList<T>&);
//- Assignment from DynamicList
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Assignment from List<T>.
inline void operator=(const UList<T>&);
// IOstream operators
......
......@@ -386,13 +386,36 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
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)
{
FatalErrorIn
(
"DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator="
"(const UList<T>&)"
"(const DynamicList<T, SizeInc, SizeMult, SizeDiv>&)"
) << "attempted assignment to self" << abort(FatalError);
}
......
......@@ -75,7 +75,7 @@ void MapGeometricFields
{
HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
(
mapper.db().objectRegistry::lookupClass
mapper.thisDb().objectRegistry::lookupClass
<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)
{
......
......@@ -97,7 +97,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
{
if
(
!mesh.db().objectRegistry::foundObject<GAMGAgglomeration>
!mesh.thisDb().foundObject<GAMGAgglomeration>
(
GAMGAgglomeration::typeName
)
......@@ -134,7 +134,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
}
else
{
return mesh.db().objectRegistry::lookupObject<GAMGAgglomeration>
return mesh.thisDb().lookupObject<GAMGAgglomeration>
(
GAMGAgglomeration::typeName
);
......@@ -152,7 +152,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
if
(
!mesh.db().objectRegistry::foundObject<GAMGAgglomeration>
!mesh.thisDb().foundObject<GAMGAgglomeration>
(
GAMGAgglomeration::typeName
)
......@@ -185,7 +185,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
}
else
{
return mesh.db().objectRegistry::lookupObject<GAMGAgglomeration>
return mesh.thisDb().lookupObject<GAMGAgglomeration>
(
GAMGAgglomeration::typeName
);
......
......@@ -76,7 +76,7 @@ public:
// Member Functions
//- Return the object registry
const objectRegistry& db() const
const objectRegistry& thisDb() const
{
return mesh_;
}
......
......@@ -37,8 +37,8 @@ Foam::MeshObject<Mesh, Type>::MeshObject(const Mesh& mesh)
IOobject
(
Type::typeName,
mesh.db().instance(),
mesh.db()
mesh.thisDb().instance(),
mesh.thisDb()
)
),
mesh_(mesh)
......@@ -53,13 +53,13 @@ const Type& Foam::MeshObject<Mesh, Type>::New
const Mesh& mesh
)
{
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName))
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{
return store(new Type(mesh));
}
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
)
{
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName))
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{
return store(new Type(mesh, d));
}
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
)
{
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName))
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{
return store(new Type(mesh, d1, d2));
}
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
)
{
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName))
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{
return store(new Type(mesh, d1, d2, d3));
}
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
)
{
if (!mesh.db().objectRegistry::foundObject<Type>(Type::typeName))
if (!mesh.thisDb().objectRegistry::foundObject<Type>(Type::typeName))
{
return store(new Type(mesh, d3, d4));
}
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>
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&>
(
mesh.db().objectRegistry::lookupObject<Type>
mesh.thisDb().objectRegistry::lookupObject<Type>
(
Type::typeName
)
......
......@@ -36,9 +36,9 @@ namespace Foam
// * * * * * * * * * * * * * * * 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;
return *orPtr_;
}
......
......@@ -71,7 +71,7 @@ public:
// Access
//- Return the object registry
virtual const objectRegistry& db() const;
virtual const objectRegistry& thisDb() const;
//- Return ldu addressing
virtual const lduAddressing& lduAddr() const = 0;
......
......@@ -112,10 +112,10 @@ public:
return GeoMesh<polyMesh>::mesh_.globalData();
}
//- Return database (only needed for compilation purposes)
const objectRegistry& db() const
//- Return database. For now is its polyMesh.
const objectRegistry& thisDb() const
{
return GeoMesh<polyMesh>::mesh_.db();
return GeoMesh<polyMesh>::mesh_.thisDb();
}
......
......@@ -100,7 +100,7 @@ public:
//- Return reference to objectRegistry storing fields. Can be
// removed once fields stored on pointMesh.
const objectRegistry& db() const
const objectRegistry& thisDb() const
{
return mesh_();
}
......
......@@ -1042,17 +1042,11 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
// movePoints function.
// pointMesh
if
(
db().objectRegistry::foundObject<pointMesh>
(
pointMesh::typeName
)
)
if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
{
const_cast<pointMesh&>
(
db().objectRegistry::lookupObject<pointMesh>
thisDb().lookupObject<pointMesh>
(
pointMesh::typeName
)
......@@ -1094,7 +1088,7 @@ const Foam::globalMeshData& Foam::polyMesh::globalData() const
// Remove all files and some subdirs (eg, sets)
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/"faces");
......
......@@ -343,6 +343,11 @@ public:
//- Return parallel info
const globalMeshData& globalData() const;
//- Return the object registry
const objectRegistry& thisDb() const
{
return *this;
}
// Mesh motion
......
......@@ -71,17 +71,11 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
// Hack until proper callbacks. Below are all the polyMesh-MeshObjects.
// pointMesh
if
(
db().objectRegistry::foundObject<pointMesh>
(
pointMesh::typeName
)
)
if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
{
const_cast<pointMesh&>
(
db().objectRegistry::lookupObject<pointMesh>
thisDb().lookupObject<pointMesh>
(
pointMesh::typeName
)
......
......@@ -2889,12 +2889,12 @@ void Foam::autoLayerDriver::addLayers
//mesh.name()+"_layer",
mesh.name(),
static_cast<polyMesh&>(mesh).instance(),
mesh.db(),
mesh.time(), // register with runTime
static_cast<polyMesh&>(mesh).readOpt(),
static_cast<polyMesh&>(mesh).writeOpt()
), // io params from original mesh but new name
mesh, // original mesh
true // parallel sync
), // io params from original mesh but new name
mesh, // original mesh
true // parallel sync
);
fvMesh& newMesh = newMeshPtr();
......
......@@ -80,7 +80,7 @@ Foam::label Foam::autoRefineDriver::readFeatureEdges
featFileName, // name
mesh.time().constant(), // directory
"triSurface", // instance
mesh.db(), // registry
mesh.time(), // registry
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
......
......@@ -443,7 +443,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
{
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 nNonAnchorBoundary = 0;
......
......@@ -56,8 +56,8 @@ Foam::SRF::SRFModel::SRFModel
IOobject
(
"SRFProperties",
Urel.mesh().time().constant(),
Urel.mesh().db(),
Urel.time().constant(),
Urel.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
......
......@@ -53,8 +53,8 @@ autoPtr<SRFModel> SRFModel::New
IOobject
(
"SRFProperties",
Urel.mesh().time().constant(),
Urel.mesh().db(),
Urel.time().constant(),
Urel.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment