mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: correct the internal reference types for surfMesh
- had a PrimitivePatch with SubField, but now use const pointField&. There is no derivation path from a pointIOField to SubField<point>, so a const reference makes more sense.
This commit is contained in:
@ -146,14 +146,14 @@ public:
|
||||
void clear();
|
||||
|
||||
|
||||
// Writing
|
||||
// Writing
|
||||
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -59,18 +59,24 @@ Foam::word Foam::surfMesh::meshSubDir = "surfMesh";
|
||||
// zoneName = "zone0";
|
||||
// }
|
||||
//
|
||||
// // Set single default zone
|
||||
// // Set single default zone with nFaces
|
||||
// surfZones_.resize(1);
|
||||
// surfZones_[0] = surfZone
|
||||
// (
|
||||
// zoneName,
|
||||
// nFaces(), // zone size
|
||||
// 0, // zone start
|
||||
// 0 // zone index
|
||||
// );
|
||||
// surfZones_[0] = surfZone(zoneName, nFaces());
|
||||
// }
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::surfMesh::updateRefs()
|
||||
{
|
||||
// Synchronize UList reference to the faces
|
||||
static_cast<MeshReference&>(*this).shallowCopy
|
||||
(
|
||||
this->storedFaces()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfMesh::surfMesh(const IOobject& io)
|
||||
@ -288,37 +294,6 @@ Foam::surfMesh::~surfMesh()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::surfMesh::updatePointsRef()
|
||||
{
|
||||
// Assign the reference to the points (quite ugly)
|
||||
// points() are returned as Field but are actually stored as SubField
|
||||
reinterpret_cast<typename MeshReference::PointFieldType&>
|
||||
(
|
||||
const_cast<Field<point>&>(MeshReference::points())
|
||||
).shallowCopy
|
||||
(
|
||||
this->storedPoints()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfMesh::updateFacesRef()
|
||||
{
|
||||
// Assign the reference to the faces (UList)
|
||||
static_cast<MeshReference&>(*this).shallowCopy
|
||||
(
|
||||
this->storedFaces()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfMesh::updateRefs()
|
||||
{
|
||||
this->updatePointsRef();
|
||||
this->updateFacesRef();
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfMesh::copySurface
|
||||
(
|
||||
const pointField& points,
|
||||
@ -431,6 +406,9 @@ void Foam::surfMesh::transfer
|
||||
Foam::autoPtr<Foam::MeshedSurface<Foam::face>>
|
||||
Foam::surfMesh::releaseGeom()
|
||||
{
|
||||
clearOut(); // Clear addressing
|
||||
clearFields();
|
||||
|
||||
// Start with an empty geometry
|
||||
auto aptr = autoPtr<MeshedSurface<face>>::New();
|
||||
|
||||
@ -440,8 +418,6 @@ Foam::surfMesh::releaseGeom()
|
||||
aptr->storedZones().transfer(this->storedZones());
|
||||
|
||||
this->updateRefs(); // This may not be needed...
|
||||
clearOut(); // Clear addressing.
|
||||
clearFields();
|
||||
|
||||
return aptr;
|
||||
}
|
||||
@ -577,7 +553,7 @@ void Foam::surfMesh::write
|
||||
void Foam::surfMesh::write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const word& fileType,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
) const
|
||||
@ -587,7 +563,7 @@ void Foam::surfMesh::write
|
||||
this->points(),
|
||||
this->faces(),
|
||||
this->surfZones()
|
||||
).write(name, ext, streamOpt, options);
|
||||
).write(name, fileType, streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ Class
|
||||
Foam::surfMesh
|
||||
|
||||
Description
|
||||
A surface mesh consisting of general polygon faces.
|
||||
A surface mesh consisting of general polygon faces that has
|
||||
IO capabilities and a registry for storing fields.
|
||||
|
||||
SourceFiles
|
||||
surfMesh.C
|
||||
@ -43,9 +44,7 @@ SourceFiles
|
||||
#include "surfaceRegistry.H"
|
||||
#include "MeshedSurfaceIOAllocator.H"
|
||||
#include "PrimitivePatch.H"
|
||||
#include "SubField.H"
|
||||
#include "surfZoneIOList.H"
|
||||
|
||||
#include "surfFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -66,7 +65,7 @@ class surfMesh
|
||||
:
|
||||
public surfaceRegistry,
|
||||
private Detail::MeshedSurfaceIOAllocator,
|
||||
public PrimitivePatch<face, ::Foam::UList, ::Foam::SubField<point>, point>
|
||||
public PrimitivePatch<face, UList, const pointField&, point>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -88,16 +87,12 @@ private:
|
||||
|
||||
// Private Typedefs
|
||||
|
||||
//- Memory and IO management
|
||||
typedef Detail::MeshedSurfaceIOAllocator Allocator;
|
||||
|
||||
typedef PrimitivePatch
|
||||
<
|
||||
face,
|
||||
::Foam::UList,
|
||||
::Foam::SubField<point>,
|
||||
point
|
||||
>
|
||||
MeshReference;
|
||||
//- Internal mesh storage type
|
||||
typedef PrimitivePatch<face, UList, const pointField&, point>
|
||||
MeshReference;
|
||||
|
||||
|
||||
// Private Data
|
||||
@ -137,14 +132,8 @@ protected:
|
||||
return surfZones_;
|
||||
}
|
||||
|
||||
//- Update references to storedFaces
|
||||
virtual void updateFacesRef();
|
||||
|
||||
//- Update references to storedPoints
|
||||
virtual void updatePointsRef();
|
||||
|
||||
//- Update references to storedPoints/storedFaces
|
||||
virtual void updateRefs();
|
||||
//- Update point/face references
|
||||
void updateRefs();
|
||||
|
||||
|
||||
public:
|
||||
@ -365,12 +354,12 @@ public:
|
||||
const dictionary& options = dictionary::null
|
||||
) const;
|
||||
|
||||
//- Write to file, choosing writer given extension.
|
||||
//- Write to file, choosing writer for given fileType.
|
||||
// Uses MeshedSurfaceProxy for writing.
|
||||
void write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const word& fileType,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const;
|
||||
|
||||
Reference in New Issue
Block a user