Commit 565c8fcb authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: support regions for PV3blockMeshReader

parent 39566991
......@@ -148,6 +148,8 @@ Foam::vtkPV3blockMesh::vtkPV3blockMesh
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
meshRegion_(polyMesh::defaultRegion),
meshDir_(polyMesh::meshSubDir),
arrayRangeBlocks_("block"),
arrayRangeEdges_("edges"),
arrayRangeCorners_("corners")
......@@ -188,6 +190,28 @@ Foam::vtkPV3blockMesh::vtkPV3blockMesh
// could be stringent and insist the prefix match the directory name...
// Note: cannot use fileName::name() due to the embedded '{}'
string caseName(fileName(FileName).lessExt());
string::size_type beg = caseName.find_last_of("/{");
string::size_type end = caseName.find('}', beg);
if
(
beg != string::npos && caseName[beg] == '{'
&& end != string::npos && end == caseName.size()-1
)
{
meshRegion_ = caseName.substr(beg+1, end-beg-1);
// some safety
if (meshRegion_.empty())
{
meshRegion_ = polyMesh::defaultRegion;
}
if (meshRegion_ != polyMesh::defaultRegion)
{
meshDir_ = meshRegion_/polyMesh::meshSubDir;
}
}
if (debug)
{
......@@ -313,7 +337,7 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
(
"blockMeshDict",
dbPtr_().constant(),
polyMesh::meshSubDir,
meshDir_,
dbPtr_(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
......@@ -321,7 +345,7 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
)
);
meshPtr_ = new blockMesh(meshDict, polyMesh::defaultRegion);
meshPtr_ = new blockMesh(meshDict, meshRegion_);
}
......
......@@ -173,6 +173,12 @@ class vtkPV3blockMesh
//- OpenFOAM mesh
blockMesh* meshPtr_;
//- The mesh region
word meshRegion_;
//- The mesh directory for the region
fileName meshDir_;
//- Selected geometrical parts
boolList blockStatus_;
......
Markdown is supported
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