Commit bd11543d authored by Henry Weller's avatar Henry Weller
Browse files

paraFoam -block: Added support for vertex and block names

Patch contributed by Mattijs Janssens
parent 283e36cd
......@@ -72,12 +72,17 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
const blockMesh& blkMesh = *meshPtr_;
const int nBlocks = blkMesh.size();
for (int blockI = 0; blockI < nBlocks; ++blockI)
{
const blockDescriptor& blockDef = blkMesh[blockI];
word partName = Foam::name(blockI);
// Display either blockI as a number or with its name
// (looked up from blockMeshDict)
OStringStream os;
blockDescriptor::write(os, blockI, blkMesh.meshDict());
word partName(os.str());
// append the (optional) zone name
if (!blockDef.zoneName().empty())
......@@ -121,9 +126,10 @@ void Foam::vtkPVblockMesh::updateInfoEdges
forAll(edges, edgeI)
{
OStringStream ostr;
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
<< edges[edgeI].type();
blockVertex::write(ostr, edges[edgeI].start(), blkMesh.meshDict());
ostr<< ":";
blockVertex::write(ostr, edges[edgeI].end(), blkMesh.meshDict());
ostr << " - " << edges[edgeI].type();
// Add "beg:end - type" to GUI list
arraySelection->AddArray(ostr.str().c_str());
......@@ -352,7 +358,9 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
dictPath = dbPtr_().constant()/polyMesh::meshSubDir/dictName;
}
IOdictionary meshDict
// Store dictionary since is used as database inside blockMesh class
// for names of vertices and blocks
IOdictionary* meshDictPtr = new IOdictionary
(
IOobject
(
......@@ -360,11 +368,12 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
dbPtr_(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
true
)
);
meshDictPtr->store();
meshPtr_ = new blockMesh(meshDict, meshRegion_);
meshPtr_ = new blockMesh(*meshDictPtr, meshRegion_);
}
......@@ -429,15 +438,22 @@ void Foam::vtkPVblockMesh::renderPointNumbers
if (show && meshPtr_)
{
const pointField& cornerPts = meshPtr_->vertices();
const scalar scaleFactor = meshPtr_->scaleFactor();
const blockMesh& blkMesh = *meshPtr_;
const pointField& cornerPts = blkMesh.vertices();
const scalar scaleFactor = blkMesh.scaleFactor();
pointNumberTextActorsPtrs_.setSize(cornerPts.size());
forAll(cornerPts, pointi)
{
vtkTextActor* txt = vtkTextActor::New();
txt->SetInput(Foam::name(pointi).c_str());
// Display either pointi as a number or with its name
// (looked up from blockMeshDict)
{
OStringStream os;
blockVertex::write(os, pointi, blkMesh.meshDict());
txt->SetInput(os.str().c_str());
}
// Set text properties
vtkTextProperty* tprop = txt->GetTextProperty();
......
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