paraFoam -block: Added support for vertex and block names

Patch contributed by Mattijs Janssens
This commit is contained in:
Henry Weller
2016-11-04 17:29:02 +00:00
parent 51a0663cd1
commit 2dc141d571
21 changed files with 398 additions and 199 deletions

View File

@ -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();