PV3blockMeshReader - added display of curvedEdges

This commit is contained in:
Mark Olesen
2009-10-07 22:42:41 +02:00
parent 4bc523b593
commit e003b5207a
20 changed files with 493 additions and 213 deletions

View File

@ -1,5 +0,0 @@
vtkPV3FoamBlockMesh.C
vtkPV3FoamBlockMeshConvert.C
vtkPV3FoamBlockMeshUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV3FoamBlockMesh

View File

@ -7,6 +7,6 @@ vtkPV3FoamMeshSet.C
vtkPV3FoamMeshVolume.C vtkPV3FoamMeshVolume.C
vtkPV3FoamMeshZone.C vtkPV3FoamMeshZone.C
vtkPV3FoamUpdateInfo.C vtkPV3FoamUpdateInfo.C
vtkPV3FoamUtilities.C vtkPV3FoamUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam LIB = $(FOAM_LIBBIN)/libvtkPV3Foam

View File

@ -45,7 +45,7 @@ SourceFiles
vtkPV3FoamPoints.H vtkPV3FoamPoints.H
vtkPV3FoamUpdateInfo.C vtkPV3FoamUpdateInfo.C
vtkPV3FoamUpdateInfoFields.H vtkPV3FoamUpdateInfoFields.H
vtkPV3FoamUtilities.C vtkPV3FoamUtils.C
vtkPV3FoamVolFields.H vtkPV3FoamVolFields.H
vtkPV3FoamAddToSelection.H vtkPV3FoamAddToSelection.H
@ -315,7 +315,7 @@ class vtkPV3Foam
vtkDataSet* dataset, vtkDataSet* dataset,
const partInfo&, const partInfo&,
const label datasetNo, const label datasetNo,
const string& datasetName const std::string& datasetName
); );
// Convenience method use to convert the readers from VTK 5 // Convenience method use to convert the readers from VTK 5

View File

@ -77,7 +77,7 @@ void Foam::vtkPV3Foam::AddToBlock
vtkDataSet* dataset, vtkDataSet* dataset,
const partInfo& selector, const partInfo& selector,
const label datasetNo, const label datasetNo,
const string& datasetName const std::string& datasetName
) )
{ {
const int blockNo = selector.block(); const int blockNo = selector.block();

View File

@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x set -x
rm -rf PV3FoamBlockMeshReader/Make rm -rf PV3blockMeshReader/Make
wclean libso vtkPV3FoamBlockMesh wclean libso vtkPV3blockMesh
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -6,9 +6,9 @@ if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then then
case "$ParaView_VERSION" in case "$ParaView_VERSION" in
3*) 3*)
wmake libso vtkPV3FoamBlockMesh wmake libso vtkPV3blockMesh
( (
cd PV3FoamBlockMeshReader cd PV3blockMeshReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1 mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS cd Make/$WM_OPTIONS
cmake ../.. cmake ../..

View File

@ -19,7 +19,7 @@ LINK_DIRECTORIES(
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude $ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV3FoamBlockMesh ${PROJECT_SOURCE_DIR}/../vtkPV3blockMesh
) )
ADD_DEFINITIONS( ADD_DEFINITIONS(
@ -35,22 +35,22 @@ SET(
# Build the server-side plugin # Build the server-side plugin
ADD_PARAVIEW_PLUGIN( ADD_PARAVIEW_PLUGIN(
PV3FoamBlockMeshReader_SM "1.0" PV3blockMeshReader_SM "1.0"
SERVER_MANAGER_XML PV3FoamBlockMeshReader_SM.xml SERVER_MANAGER_XML PV3blockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV3FoamBlockMeshReader.cxx SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx
) )
# Build the client-side plugin # Build the client-side plugin
ADD_PARAVIEW_PLUGIN( ADD_PARAVIEW_PLUGIN(
PV3FoamBlockMeshReader PV3blockMeshReader
"1.0" "1.0"
GUI_RESOURCES PV3FoamBlockMeshReader.qrc GUI_RESOURCES PV3blockMeshReader.qrc
) )
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
PV3FoamBlockMeshReader_SM PV3blockMeshReader_SM
OpenFOAM OpenFOAM
blockMesh blockMesh
vtkPV3FoamBlockMesh vtkPV3blockMesh
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="/ParaViewResources" > <qresource prefix="/ParaViewResources" >
<file>PV3FoamBlockMeshReader.xml</file> <file>PV3blockMeshReader.xml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -1,5 +1,5 @@
<ParaViewReaders> <ParaViewReaders>
<Reader name="PV3FoamBlockMeshReader" <Reader name="PV3blockMeshReader"
extensions="blockMesh" extensions="blockMesh"
file_description="OpenFOAM blockMesh reader"> file_description="OpenFOAM blockMesh reader">
</Reader> </Reader>

View File

@ -1,8 +1,8 @@
<ServerManagerConfiguration> <ServerManagerConfiguration>
<ProxyGroup name="sources"> <ProxyGroup name="sources">
<SourceProxy <SourceProxy
name="PV3FoamBlockMeshReader" name="PV3blockMeshReader"
class="vtkPV3FoamBlockMeshReader"> class="vtkPV3blockMeshReader">
<!-- File name - compulsory --> <!-- File name - compulsory -->
<StringVectorProperty <StringVectorProperty
@ -55,7 +55,7 @@
</StringVectorProperty> </StringVectorProperty>
<StringVectorProperty <StringVectorProperty
name="PartStatus" name="PartStatus"
label="block numbers" label="Blocks"
command="SetPartArrayStatus" command="SetPartArrayStatus"
number_of_elements="0" number_of_elements="0"
repeat_command="1" repeat_command="1"
@ -70,6 +70,29 @@
</ArraySelectionDomain> </ArraySelectionDomain>
</StringVectorProperty> </StringVectorProperty>
<!-- Available Parts (blocks) array -->
<StringVectorProperty
name="CurvedEdgesArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
</StringVectorProperty>
<StringVectorProperty
name="CurvedEdgesStatus"
label="Curved Edges"
command="SetCurvedEdgesArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="CurvedEdgesArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="CurvedEdgesArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
</SourceProxy> </SourceProxy>
</ProxyGroup> </ProxyGroup>
</ServerManagerConfiguration> </ServerManagerConfiguration>

View File

@ -1,7 +1,7 @@
/*========================================================================= /*=========================================================================
Program: Visualization Toolkit Program: Visualization Toolkit
Module: $RCSfile: vtkPV3FoamBlockMeshReader.cxx,v $ Module: $RCSfile: vtkPV3blockMeshReader.cxx,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved. All rights reserved.
@ -13,7 +13,7 @@
=========================================================================*/ =========================================================================*/
#include "vtkPV3FoamBlockMeshReader.h" #include "vtkPV3blockMeshReader.h"
#include "pqApplicationCore.h" #include "pqApplicationCore.h"
#include "pqRenderView.h" #include "pqRenderView.h"
@ -31,12 +31,12 @@
#include "vtkStringArray.h" #include "vtkStringArray.h"
// Foam includes // Foam includes
#include "vtkPV3FoamBlockMesh.H" #include "vtkPV3blockMesh.H"
vtkCxxRevisionMacro(vtkPV3FoamBlockMeshReader, "$Revision: 1.5$"); vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision: 1.5$");
vtkStandardNewMacro(vtkPV3FoamBlockMeshReader); vtkStandardNewMacro(vtkPV3blockMeshReader);
vtkPV3FoamBlockMeshReader::vtkPV3FoamBlockMeshReader() vtkPV3blockMeshReader::vtkPV3blockMeshReader()
{ {
Debug = 0; Debug = 0;
vtkDebugMacro(<<"Constructor"); vtkDebugMacro(<<"Constructor");
@ -50,25 +50,33 @@ vtkPV3FoamBlockMeshReader::vtkPV3FoamBlockMeshReader()
UpdateGUI = 0; UpdateGUI = 0;
PartSelection = vtkDataArraySelection::New(); PartSelection = vtkDataArraySelection::New();
CurvedEdgesSelection = vtkDataArraySelection::New();
// Setup the selection callback to modify this object when an array // Setup the selection callback to modify this object when an array
// selection is changed. // selection is changed.
SelectionObserver = vtkCallbackCommand::New(); SelectionObserver = vtkCallbackCommand::New();
SelectionObserver->SetCallback SelectionObserver->SetCallback
( (
&vtkPV3FoamBlockMeshReader::SelectionModifiedCallback &vtkPV3blockMeshReader::SelectionModifiedCallback
); );
SelectionObserver->SetClientData(this); SelectionObserver->SetClientData(this);
PartSelection->AddObserver PartSelection->AddObserver
( (
vtkCommand::ModifiedEvent, vtkCommand::ModifiedEvent,
this->SelectionObserver this->SelectionObserver
); );
CurvedEdgesSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
} }
vtkPV3FoamBlockMeshReader::~vtkPV3FoamBlockMeshReader() vtkPV3blockMeshReader::~vtkPV3blockMeshReader()
{ {
vtkDebugMacro(<<"Deconstructor"); vtkDebugMacro(<<"Deconstructor");
@ -80,15 +88,15 @@ vtkPV3FoamBlockMeshReader::~vtkPV3FoamBlockMeshReader()
} }
PartSelection->RemoveObserver(this->SelectionObserver); PartSelection->RemoveObserver(this->SelectionObserver);
CurvedEdgesSelection->RemoveObserver(this->SelectionObserver);
SelectionObserver->Delete(); SelectionObserver->Delete();
PartSelection->Delete(); PartSelection->Delete();
} }
// Do everything except set the output info // Do everything except set the output info
int vtkPV3FoamBlockMeshReader::RequestInformation int vtkPV3blockMeshReader::RequestInformation
( (
vtkInformation* vtkNotUsed(request), vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector** vtkNotUsed(inputVector),
@ -97,7 +105,7 @@ int vtkPV3FoamBlockMeshReader::RequestInformation
{ {
vtkDebugMacro(<<"RequestInformation"); vtkDebugMacro(<<"RequestInformation");
if (Foam::vtkPV3FoamBlockMesh::debug) if (Foam::vtkPV3blockMesh::debug)
{ {
cout<<"REQUEST_INFORMATION\n"; cout<<"REQUEST_INFORMATION\n";
} }
@ -110,7 +118,7 @@ int vtkPV3FoamBlockMeshReader::RequestInformation
int nInfo = outputVector->GetNumberOfInformationObjects(); int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3FoamBlockMesh::debug) if (Foam::vtkPV3blockMesh::debug)
{ {
cout<<"RequestInformation with " << nInfo << " item(s)\n"; cout<<"RequestInformation with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI) for (int infoI = 0; infoI < nInfo; ++infoI)
@ -121,7 +129,7 @@ int vtkPV3FoamBlockMeshReader::RequestInformation
if (!foamData_) if (!foamData_)
{ {
foamData_ = new Foam::vtkPV3FoamBlockMesh(FileName, this); foamData_ = new Foam::vtkPV3blockMesh(FileName, this);
} }
else else
{ {
@ -145,7 +153,7 @@ int vtkPV3FoamBlockMeshReader::RequestInformation
// Set the output info // Set the output info
int vtkPV3FoamBlockMeshReader::RequestData int vtkPV3blockMeshReader::RequestData
( (
vtkInformation* vtkNotUsed(request), vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector** vtkNotUsed(inputVector),
@ -169,7 +177,7 @@ int vtkPV3FoamBlockMeshReader::RequestData
int nInfo = outputVector->GetNumberOfInformationObjects(); int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3FoamBlockMesh::debug) if (Foam::vtkPV3blockMesh::debug)
{ {
cout<<"RequestData with " << nInfo << " item(s)\n"; cout<<"RequestData with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI) for (int infoI = 0; infoI < nInfo; ++infoI)
@ -186,7 +194,7 @@ int vtkPV3FoamBlockMeshReader::RequestData
) )
); );
if (Foam::vtkPV3FoamBlockMesh::debug) if (Foam::vtkPV3blockMesh::debug)
{ {
cout<< "update output with " cout<< "update output with "
<< output->GetNumberOfBlocks() << " blocks\n"; << output->GetNumberOfBlocks() << " blocks\n";
@ -203,7 +211,7 @@ int vtkPV3FoamBlockMeshReader::RequestData
} }
void vtkPV3FoamBlockMeshReader::updatePointNumbersView(const bool show) void vtkPV3blockMeshReader::updatePointNumbersView(const bool show)
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
@ -224,7 +232,7 @@ void vtkPV3FoamBlockMeshReader::updatePointNumbersView(const bool show)
} }
void vtkPV3FoamBlockMeshReader::PrintSelf(ostream& os, vtkIndent indent) void vtkPV3blockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
{ {
vtkDebugMacro(<<"PrintSelf"); vtkDebugMacro(<<"PrintSelf");
@ -239,35 +247,39 @@ void vtkPV3FoamBlockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Parts selection list control // Parts selection list control
vtkDataArraySelection* vtkPV3FoamBlockMeshReader::GetPartSelection() vtkDataArraySelection* vtkPV3blockMeshReader::GetPartSelection()
{ {
vtkDebugMacro(<<"GetPartSelection"); vtkDebugMacro(<<"GetPartSelection");
return PartSelection; return PartSelection;
} }
int vtkPV3FoamBlockMeshReader::GetNumberOfPartArrays() int vtkPV3blockMeshReader::GetNumberOfPartArrays()
{ {
vtkDebugMacro(<<"GetNumberOfPartArrays"); vtkDebugMacro(<<"GetNumberOfPartArrays");
return PartSelection->GetNumberOfArrays(); return PartSelection->GetNumberOfArrays();
} }
const char* vtkPV3FoamBlockMeshReader::GetPartArrayName(int index) const char* vtkPV3blockMeshReader::GetPartArrayName(int index)
{ {
vtkDebugMacro(<<"GetPartArrayName"); vtkDebugMacro(<<"GetPartArrayName");
return PartSelection->GetArrayName(index); return PartSelection->GetArrayName(index);
} }
int vtkPV3FoamBlockMeshReader::GetPartArrayStatus(const char* name) int vtkPV3blockMeshReader::GetPartArrayStatus(const char* name)
{ {
vtkDebugMacro(<<"GetPartArrayStatus"); vtkDebugMacro(<<"GetPartArrayStatus");
return PartSelection->ArrayIsEnabled(name); return PartSelection->ArrayIsEnabled(name);
} }
void vtkPV3FoamBlockMeshReader::SetPartArrayStatus(const char* name, int status) void vtkPV3blockMeshReader::SetPartArrayStatus
(
const char* name,
int status
)
{ {
vtkDebugMacro(<<"SetPartArrayStatus"); vtkDebugMacro(<<"SetPartArrayStatus");
if (status) if (status)
@ -282,8 +294,57 @@ void vtkPV3FoamBlockMeshReader::SetPartArrayStatus(const char* name, int status)
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// CurvedEdges selection list control
void vtkPV3FoamBlockMeshReader::SelectionModifiedCallback vtkDataArraySelection* vtkPV3blockMeshReader::GetCurvedEdgesSelection()
{
vtkDebugMacro(<<"GetCurvedEdgesSelection");
return CurvedEdgesSelection;
}
int vtkPV3blockMeshReader::GetNumberOfCurvedEdgesArrays()
{
vtkDebugMacro(<<"GetNumberOfCurvedEdgesArrays");
return CurvedEdgesSelection->GetNumberOfArrays();
}
const char* vtkPV3blockMeshReader::GetCurvedEdgesArrayName(int index)
{
vtkDebugMacro(<<"GetCurvedEdgesArrayName");
return CurvedEdgesSelection->GetArrayName(index);
}
int vtkPV3blockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetCurvedEdgesArrayStatus");
return CurvedEdgesSelection->ArrayIsEnabled(name);
}
void vtkPV3blockMeshReader::SetCurvedEdgesArrayStatus
(
const char* name,
int status
)
{
vtkDebugMacro(<<"SetCurvedEdgesArrayStatus");
if (status)
{
CurvedEdgesSelection->EnableArray(name);
}
else
{
CurvedEdgesSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
void vtkPV3blockMeshReader::SelectionModifiedCallback
( (
vtkObject*, vtkObject*,
unsigned long, unsigned long,
@ -291,18 +352,18 @@ void vtkPV3FoamBlockMeshReader::SelectionModifiedCallback
void* void*
) )
{ {
static_cast<vtkPV3FoamBlockMeshReader*>(clientdata)->SelectionModified(); static_cast<vtkPV3blockMeshReader*>(clientdata)->SelectionModified();
} }
void vtkPV3FoamBlockMeshReader::SelectionModified() void vtkPV3blockMeshReader::SelectionModified()
{ {
vtkDebugMacro(<<"SelectionModified"); vtkDebugMacro(<<"SelectionModified");
Modified(); Modified();
} }
int vtkPV3FoamBlockMeshReader::FillOutputPortInformation int vtkPV3blockMeshReader::FillOutputPortInformation
( (
int port, int port,
vtkInformation* info vtkInformation* info

View File

@ -1,7 +1,7 @@
/*========================================================================= /*=========================================================================
Program: Visualization Toolkit Program: Visualization Toolkit
Module: $RCSfile: vtkPV3FoamBlockMeshReader.h,v $ Module: $RCSfile: vtkPV3blockMeshReader.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved. All rights reserved.
@ -12,18 +12,18 @@
PURPOSE. See the above copyright notice for more information. PURPOSE. See the above copyright notice for more information.
=========================================================================*/ =========================================================================*/
// .NAME vtkPV3FoamBlockMeshReader - reads a dataset in OpenFOAM bockMesh format // .NAME vtkPV3blockMeshReader - reads a dataset in OpenFOAM bockMesh format
// .SECTION Description // .SECTION Description
// vtkPV3FoamBlockMeshReader creates an multiblock dataset. // vtkPV3blockMeshReader creates an multiblock dataset.
// It uses the OpenFOAM infrastructure (blockMesh). // It uses the OpenFOAM infrastructure (blockMesh).
#ifndef __vtkPV3FoamBlockMeshReader_h #ifndef __vtkPV3blockMeshReader_h
#define __vtkPV3FoamBlockMeshReader_h #define __vtkPV3blockMeshReader_h
// Foam forward declarations // Foam forward declarations
namespace Foam namespace Foam
{ {
class vtkPV3FoamBlockMesh; class vtkPV3blockMesh;
} }
// VTK includes // VTK includes
@ -34,15 +34,15 @@ class vtkDataArraySelection;
class vtkCallbackCommand; class vtkCallbackCommand;
class VTK_IO_EXPORT vtkPV3FoamBlockMeshReader class VTK_IO_EXPORT vtkPV3blockMeshReader
: :
public vtkMultiBlockDataSetAlgorithm public vtkMultiBlockDataSetAlgorithm
{ {
public: public:
vtkTypeRevisionMacro(vtkPV3FoamBlockMeshReader,vtkMultiBlockDataSetAlgorithm); vtkTypeRevisionMacro(vtkPV3blockMeshReader,vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent); void PrintSelf(ostream&, vtkIndent);
static vtkPV3FoamBlockMeshReader* New(); static vtkPV3blockMeshReader* New();
// Description: // Description:
// Set/Get the filename. // Set/Get the filename.
@ -63,10 +63,18 @@ public:
// Parts (blocks) selection list control // Parts (blocks) selection list control
vtkDataArraySelection* GetPartSelection(); vtkDataArraySelection* GetPartSelection();
int GetNumberOfPartArrays(); int GetNumberOfPartArrays();
int GetPartArrayStatus(const char* name); int GetPartArrayStatus(const char*);
void SetPartArrayStatus(const char* name, int status); void SetPartArrayStatus(const char*, int status);
const char* GetPartArrayName(int index); const char* GetPartArrayName(int index);
// Description:
// Parts (blocks) selection list control
vtkDataArraySelection* GetCurvedEdgesSelection();
int GetNumberOfCurvedEdgesArrays();
int GetCurvedEdgesArrayStatus(const char*);
void SetCurvedEdgesArrayStatus(const char*, int status);
const char* GetCurvedEdgesArrayName(int index);
// Description: // Description:
// Callback registered with the SelectionObserver // Callback registered with the SelectionObserver
// for all the selection lists // for all the selection lists
@ -84,10 +92,10 @@ public:
protected: protected:
//- Construct null //- Construct null
vtkPV3FoamBlockMeshReader(); vtkPV3blockMeshReader();
//- Destructor //- Destructor
~vtkPV3FoamBlockMeshReader(); ~vtkPV3blockMeshReader();
//- Return information about mesh, times, etc without loading anything //- Return information about mesh, times, etc without loading anything
virtual int RequestInformation virtual int RequestInformation
@ -116,10 +124,10 @@ protected:
private: private:
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
vtkPV3FoamBlockMeshReader(const vtkPV3FoamBlockMeshReader&); vtkPV3blockMeshReader(const vtkPV3blockMeshReader&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const vtkPV3FoamBlockMeshReader&); void operator=(const vtkPV3blockMeshReader&);
//- Add/remove point numbers to/from the view //- Add/remove point numbers to/from the view
void updatePointNumbersView(const bool show); void updatePointNumbersView(const bool show);
@ -131,8 +139,10 @@ private:
vtkDataArraySelection* PartSelection; vtkDataArraySelection* PartSelection;
vtkDataArraySelection* CurvedEdgesSelection;
//BTX //BTX
Foam::vtkPV3FoamBlockMesh* foamData_; Foam::vtkPV3blockMesh* foamData_;
//ETX //ETX
}; };

View File

@ -0,0 +1,5 @@
vtkPV3blockMesh.C
vtkPV3blockMeshConvert.C
vtkPV3blockMeshUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV3blockMesh

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(ParaView_INST_DIR)/VTK/Common \ -I$(ParaView_INST_DIR)/VTK/Common \
-I$(ParaView_INST_DIR)/VTK/Filtering \ -I$(ParaView_INST_DIR)/VTK/Filtering \
-I$(ParaView_INST_DIR)/VTK/Rendering \ -I$(ParaView_INST_DIR)/VTK/Rendering \
-I../PV3FoamBlockMeshReader -I../PV3blockMeshReader
LIB_LIBS = \ LIB_LIBS = \
-lmeshTools \ -lmeshTools \

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass InClass
vtkPV3FoamBlockMesh vtkPV3blockMesh
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -24,13 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3FoamBlockMesh.H" #include "vtkPV3blockMesh.H"
#include "vtkPV3FoamBlockMeshReader.h" #include "vtkPV3blockMeshReader.h"
// Foam includes // Foam includes
#include "blockMesh.H" #include "blockMesh.H"
#include "Time.H" #include "Time.H"
#include "patchZones.H" #include "patchZones.H"
#include "OStringStream.H"
// VTK includes // VTK includes
#include "vtkDataArraySelection.h" #include "vtkDataArraySelection.h"
@ -41,82 +42,46 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::vtkPV3FoamBlockMesh, 0); defineTypeNameAndDebug(Foam::vtkPV3blockMesh, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3FoamBlockMesh::resetCounters() void Foam::vtkPV3blockMesh::resetCounters()
{ {
// Reset mesh part ids and sizes // Reset mesh part ids and sizes
partInfoBlocks_.reset(); partInfoBlocks_.reset();
partInfoEdges_.reset();
partInfoCorners_.reset(); partInfoCorners_.reset();
} }
void Foam::vtkPV3FoamBlockMesh::updateMeshPartsStatus() void Foam::vtkPV3blockMesh::updateInfoBlocks()
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3FoamBlockMesh::updateMeshPartsStatus" << endl; Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoBlocks"
}
vtkDataArraySelection* selection = reader_->GetPartSelection();
label nElem = selection->GetNumberOfArrays();
if (partStatus_.size() != nElem)
{
partStatus_.setSize(nElem);
partStatus_ = false;
}
// this needs fixing if we wish to re-use the datasets
partDataset_.setSize(nElem);
partDataset_ = -1;
// Read the selected mesh parts (blocks only) and add to list
forAll(partStatus_, partId)
{
const int setting = selection->GetArraySetting(partId);
if (partStatus_[partId] != setting)
{
partStatus_[partId] = setting;
}
if (debug)
{
Info<< " part[" << partId << "] = "
<< partStatus_[partId]
<< " : " << selection->GetArrayName(partId) << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPV3FoamBlockMesh::updateMeshPartsStatus" << endl;
}
}
void Foam::vtkPV3FoamBlockMesh::updateInfoBlocks()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3FoamBlockMesh::updateInfoBlocks"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl; << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
} }
vtkDataArraySelection* partSelection = reader_->GetPartSelection(); vtkDataArraySelection* selection = reader_->GetPartSelection();
partInfoBlocks_ = partSelection->GetNumberOfArrays(); partInfoBlocks_ = selection->GetNumberOfArrays();
int nBlocks = meshPtr_->size();
const blockMesh& blkMesh = *meshPtr_;
const int nBlocks = blkMesh.size();
for (int blockI = 0; blockI < nBlocks; ++blockI) for (int blockI = 0; blockI < nBlocks; ++blockI)
{ {
// Add blockId to GUI list const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
partSelection->AddArray
( word partName = Foam::name(blockI);
Foam::name(blockI).c_str()
); // append the (optional) zone name
if (!blockDef.zoneName().empty())
{
partName += " - " + blockDef.zoneName();
}
// Add blockId and zoneName to GUI list
selection->AddArray(partName.c_str());
} }
partInfoBlocks_ += nBlocks; partInfoBlocks_ += nBlocks;
@ -124,30 +89,69 @@ void Foam::vtkPV3FoamBlockMesh::updateInfoBlocks()
if (debug) if (debug)
{ {
// just for debug info // just for debug info
getSelectedArrayEntries(partSelection); getSelectedArrayEntries(selection);
Info<< "<end> Foam::vtkPV3FoamBlockMesh::updateInfoBlocks" << endl; Info<< "<end> Foam::vtkPV3blockMesh::updateInfoBlocks" << endl;
}
}
void Foam::vtkPV3blockMesh::updateInfoEdges()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoEdges"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
}
vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
partInfoEdges_ = selection->GetNumberOfArrays();
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
const int nEdges = edges.size();
forAll(edges, edgeI)
{
OStringStream ostr;
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
<< edges[edgeI].type();
// Add "beg:end - type" to GUI list
selection->AddArray(ostr.str().c_str());
}
partInfoEdges_ += nEdges;
if (debug)
{
// just for debug info
getSelectedArrayEntries(selection);
Info<< "<end> Foam::vtkPV3blockMesh::updateInfoEdges" << endl;
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vtkPV3FoamBlockMesh::vtkPV3FoamBlockMesh Foam::vtkPV3blockMesh::vtkPV3blockMesh
( (
const char* const FileName, const char* const FileName,
vtkPV3FoamBlockMeshReader* reader vtkPV3blockMeshReader* reader
) )
: :
reader_(reader), reader_(reader),
dbPtr_(NULL), dbPtr_(NULL),
meshPtr_(NULL), meshPtr_(NULL),
partInfoBlocks_("block"), partInfoBlocks_("block"),
partInfoEdges_("edges"),
partInfoCorners_("corners") partInfoCorners_("corners")
{ {
if (debug) if (debug)
{ {
Info<< "Foam::vtkPV3FoamBlockMesh::vtkPV3FoamBlockMesh - " Info<< "Foam::vtkPV3blockMesh::vtkPV3blockMesh - "
<< FileName << endl; << FileName << endl;
} }
@ -208,11 +212,11 @@ Foam::vtkPV3FoamBlockMesh::vtkPV3FoamBlockMesh
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtkPV3FoamBlockMesh::~vtkPV3FoamBlockMesh() Foam::vtkPV3blockMesh::~vtkPV3blockMesh()
{ {
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3FoamBlockMesh::~vtkPV3FoamBlockMesh" << endl; Info<< "<end> Foam::vtkPV3blockMesh::~vtkPV3blockMesh" << endl;
} }
delete meshPtr_; delete meshPtr_;
@ -221,21 +225,23 @@ Foam::vtkPV3FoamBlockMesh::~vtkPV3FoamBlockMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV3FoamBlockMesh::updateInfo() void Foam::vtkPV3blockMesh::updateInfo()
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3FoamBlockMesh::updateInfo" Info<< "<beg> Foam::vtkPV3blockMesh::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl; << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl;
} }
resetCounters(); resetCounters();
vtkDataArraySelection* partSelection = reader_->GetPartSelection(); vtkDataArraySelection* partSelection = reader_->GetPartSelection();
vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
// enable 'internalMesh' on the first call // enable 'internalMesh' on the first call
// or preserve the enabled selections // or preserve the enabled selections
stringList enabledEntries; stringList enabledParts;
stringList enabledEdges;
bool firstTime = false; bool firstTime = false;
if (!partSelection->GetNumberOfArrays() && !meshPtr_) if (!partSelection->GetNumberOfArrays() && !meshPtr_)
{ {
@ -243,37 +249,42 @@ void Foam::vtkPV3FoamBlockMesh::updateInfo()
} }
else else
{ {
enabledEntries = getSelectedArrayEntries(partSelection); enabledParts = getSelectedArrayEntries(partSelection);
enabledEdges = getSelectedArrayEntries(edgeSelection);
} }
// Clear current mesh parts list // Clear current mesh parts list
partSelection->RemoveAllArrays(); partSelection->RemoveAllArrays();
edgeSelection->RemoveAllArrays();
// need a blockMesh // need a blockMesh
updateFoamMesh(); updateFoamMesh();
// Update mesh parts list - add corrner points at the bottom // Update mesh parts list
updateInfoBlocks(); updateInfoBlocks();
// Update curved edges list
updateInfoEdges();
// restore the enabled selections // restore the enabled selections
if (!firstTime) if (!firstTime)
{ {
setSelectedArrayEntries(partSelection, enabledEntries); setSelectedArrayEntries(partSelection, enabledParts);
setSelectedArrayEntries(edgeSelection, enabledEdges);
} }
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3FoamBlockMesh::updateInfo" << endl; Info<< "<end> Foam::vtkPV3blockMesh::updateInfo" << endl;
} }
} }
void Foam::vtkPV3FoamBlockMesh::updateFoamMesh() void Foam::vtkPV3blockMesh::updateFoamMesh()
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3FoamBlockMesh::updateFoamMesh" << endl; Info<< "<beg> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
} }
// Check to see if the FOAM mesh has been created // Check to see if the FOAM mesh has been created
@ -305,12 +316,12 @@ void Foam::vtkPV3FoamBlockMesh::updateFoamMesh()
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3FoamBlockMesh::updateFoamMesh" << endl; Info<< "<end> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
} }
} }
void Foam::vtkPV3FoamBlockMesh::Update void Foam::vtkPV3blockMesh::Update
( (
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
) )
@ -318,7 +329,10 @@ void Foam::vtkPV3FoamBlockMesh::Update
reader_->UpdateProgress(0.1); reader_->UpdateProgress(0.1);
// Set up mesh parts selection(s) // Set up mesh parts selection(s)
updateMeshPartsStatus(); updateBoolListStatus(partStatus_, reader_->GetPartSelection());
// Set up curved edges selection(s)
updateBoolListStatus(edgeStatus_, reader_->GetCurvedEdgesSelection());
reader_->UpdateProgress(0.2); reader_->UpdateProgress(0.2);
@ -326,24 +340,25 @@ void Foam::vtkPV3FoamBlockMesh::Update
updateFoamMesh(); updateFoamMesh();
reader_->UpdateProgress(0.5); reader_->UpdateProgress(0.5);
// Convert meshes - start port0 at block=0 // Convert mesh elemente
int blockNo = 0; int blockNo = 0;
convertMeshBlocks(output, blockNo);
convertMeshCorners(output, blockNo); convertMeshCorners(output, blockNo);
convertMeshBlocks(output, blockNo);
convertMeshEdges(output, blockNo);
reader_->UpdateProgress(0.8); reader_->UpdateProgress(0.8);
} }
void Foam::vtkPV3FoamBlockMesh::CleanUp() void Foam::vtkPV3blockMesh::CleanUp()
{ {
reader_->UpdateProgress(1.0); reader_->UpdateProgress(1.0);
} }
void Foam::vtkPV3FoamBlockMesh::renderPointNumbers void Foam::vtkPV3blockMesh::renderPointNumbers
( (
vtkRenderer* renderer, vtkRenderer* renderer,
const bool show const bool show
@ -375,8 +390,8 @@ void Foam::vtkPV3FoamBlockMesh::renderPointNumbers
tprop->BoldOn(); tprop->BoldOn();
tprop->ShadowOff(); tprop->ShadowOff();
tprop->SetLineSpacing(1.0); tprop->SetLineSpacing(1.0);
tprop->SetFontSize(12); tprop->SetFontSize(14);
tprop->SetColor(1.0, 0.0, 0.0); tprop->SetColor(1.0, 0.0, 1.0);
tprop->SetJustificationToCentered(); tprop->SetJustificationToCentered();
// Set text to use 3-D world co-ordinates // Set text to use 3-D world co-ordinates
@ -401,7 +416,7 @@ void Foam::vtkPV3FoamBlockMesh::renderPointNumbers
void Foam::vtkPV3FoamBlockMesh::PrintSelf(ostream& os, vtkIndent indent) const void Foam::vtkPV3blockMesh::PrintSelf(ostream& os, vtkIndent indent) const
{ {
#if 0 #if 0
os << indent << "Number of nodes: " os << indent << "Number of nodes: "

View File

@ -23,24 +23,24 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::vtkPV3FoamBlockMesh Foam::vtkPV3blockMesh
Description Description
Provides a reader interface for OpenFOAM blockMesh to VTK interaction Provides a reader interface for OpenFOAM blockMesh to VTK interaction
SourceFiles SourceFiles
vtkPV3FoamBlockMesh.C vtkPV3blockMesh.C
vtkPV3FoamBlockMeshConvert.C vtkPV3blockMeshConvert.C
vtkPV3FoamBlockMeshUpdate.C vtkPV3blockMeshUpdate.C
vtkPV3FoamBlockMeshUtils.C vtkPV3blockMeshUtils.C
// Needed by VTK: // Needed by VTK:
vtkDataArrayTemplateImplicit.txx vtkDataArrayTemplateImplicit.txx
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamBlockMesh_H #ifndef vtkPV3blockMesh_H
#define vtkPV3FoamBlockMesh_H #define vtkPV3blockMesh_H
// do not include legacy strstream headers // do not include legacy strstream headers
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS #ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
@ -59,7 +59,7 @@ SourceFiles
class vtkDataArraySelection; class vtkDataArraySelection;
class vtkDataSet; class vtkDataSet;
class vtkPoints; class vtkPoints;
class vtkPV3FoamBlockMeshReader; class vtkPV3blockMeshReader;
class vtkRenderer; class vtkRenderer;
class vtkTextActor; class vtkTextActor;
class vtkMultiBlockDataSet; class vtkMultiBlockDataSet;
@ -80,10 +80,10 @@ class blockMesh;
template<class Type> class List; template<class Type> class List;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class vtkPV3FoamBlockMesh Declaration Class vtkPV3blockMesh Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class vtkPV3FoamBlockMesh class vtkPV3blockMesh
{ {
// Private classes // Private classes
@ -167,8 +167,8 @@ class vtkPV3FoamBlockMesh
// Private Data // Private Data
//- Access to the controlling vtkPV3FoamBlockMeshReader //- Access to the controlling vtkPV3blockMeshReader
vtkPV3FoamBlockMeshReader* reader_; vtkPV3blockMeshReader* reader_;
//- Foam time control //- Foam time control
autoPtr<Time> dbPtr_; autoPtr<Time> dbPtr_;
@ -179,14 +179,17 @@ class vtkPV3FoamBlockMesh
//- Selected geometrical parts //- Selected geometrical parts
boolList partStatus_; boolList partStatus_;
//- Datasets corresponding to selected geometrical pieces //- Selected curved edges
// a negative number indicates that no vtkmesh exists for this piece boolList edgeStatus_;
labelList partDataset_;
//- First instance and size of bleckMesh blocks //- First instance and size of bleckMesh blocks
// used to index into partStatus_ and partDataset_ // used to index into partStatus_
partInfo partInfoBlocks_; partInfo partInfoBlocks_;
//- First instance and size of CurvedEdges
// only partially used
partInfo partInfoEdges_;
//- First instance and size of block corners //- First instance and size of block corners
// only partially used // only partially used
partInfo partInfoCorners_; partInfo partInfoCorners_;
@ -204,7 +207,7 @@ class vtkPV3FoamBlockMesh
vtkDataSet* dataset, vtkDataSet* dataset,
const partInfo&, const partInfo&,
const label datasetNo, const label datasetNo,
const string& datasetName const std::string& datasetName
); );
// Convenience method use to convert the readers from VTK 5 // Convenience method use to convert the readers from VTK 5
@ -224,17 +227,24 @@ class vtkPV3FoamBlockMesh
const partInfo& const partInfo&
); );
//- Update boolList from GUI selection
static void updateBoolListStatus
(
boolList&,
vtkDataArraySelection*
);
//- Reset data counters //- Reset data counters
void resetCounters(); void resetCounters();
// Update information helper functions // Update information helper functions
//- Update the mesh parts selected in the GUI //- Internal block info
void updateMeshPartsStatus();
//- Internal mesh info
void updateInfoBlocks(); void updateInfoBlocks();
//- block curved edges info
void updateInfoEdges();
// Update helper functions // Update helper functions
//- Foam mesh //- Foam mesh
@ -245,6 +255,9 @@ class vtkPV3FoamBlockMesh
//- mesh blocks //- mesh blocks
void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo); void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
//- mesh curved edges
void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
//- mesh corners //- mesh corners
void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo); void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
@ -280,32 +293,32 @@ class vtkPV3FoamBlockMesh
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
vtkPV3FoamBlockMesh(const vtkPV3FoamBlockMesh&); vtkPV3blockMesh(const vtkPV3blockMesh&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const vtkPV3FoamBlockMesh&); void operator=(const vtkPV3blockMesh&);
public: public:
//- Static data members //- Static data members
ClassName("vtkPV3FoamBlockMesh"); ClassName("vtkPV3blockMesh");
// Constructors // Constructors
//- Construct from components //- Construct from components
vtkPV3FoamBlockMesh vtkPV3blockMesh
( (
const char* const FileName, const char* const FileName,
vtkPV3FoamBlockMeshReader* reader vtkPV3blockMeshReader* reader
); );
//- Destructor //- Destructor
~vtkPV3FoamBlockMesh(); ~vtkPV3blockMesh();
// Member Functions // Member Functions

View File

@ -26,8 +26,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3FoamBlockMesh.H" #include "vtkPV3blockMesh.H"
#include "vtkPV3FoamBlockMeshReader.h" #include "vtkPV3blockMeshReader.h"
// Foam includes // Foam includes
#include "blockMesh.H" #include "blockMesh.H"
@ -46,23 +46,23 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV3FoamBlockMesh::convertMeshBlocks void Foam::vtkPV3blockMesh::convertMeshBlocks
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
) )
{ {
vtkDataArraySelection* selection = reader_->GetPartSelection();
partInfo& selector = partInfoBlocks_; partInfo& selector = partInfoBlocks_;
selector.block(blockNo); // set output block selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.blockPointField(); const Foam::pointField& blockPoints = blkMesh.blockPointField();
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3FoamBlockMesh::convertMeshBlocks" << endl; Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl;
} }
int blockI = 0; int blockI = 0;
@ -79,10 +79,15 @@ void Foam::vtkPV3FoamBlockMesh::convertMeshBlocks
continue; continue;
} }
const word partName = Foam::name(blockI);
const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
word partName("block");
// // append the (optional) zone name
// if (!blockDef.zoneName().empty())
// {
// partName += " - " + blockDef.zoneName();
// }
//
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New(); vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
// Convert Foam mesh vertices to VTK // Convert Foam mesh vertices to VTK
@ -114,11 +119,14 @@ void Foam::vtkPV3FoamBlockMesh::convertMeshBlocks
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete(); vtkpoints->Delete();
AddToBlock
(
output, vtkmesh, selector, datasetNo,
selection->GetArrayName(partId)
);
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
vtkmesh->Delete(); vtkmesh->Delete();
datasetNo++;
partDataset_[partId] = datasetNo++;
} }
@ -130,19 +138,130 @@ void Foam::vtkPV3FoamBlockMesh::convertMeshBlocks
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3FoamBlockMesh::convertMeshBlocks" << endl; Info<< "<end> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl;
} }
} }
void Foam::vtkPV3FoamBlockMesh::convertMeshCorners void Foam::vtkPV3blockMesh::convertMeshEdges
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
partInfo& selector = partInfoEdges_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
int edgeI = 0;
for
(
int partId = selector.start();
partId < selector.end();
++partId, ++edgeI
)
{
if (!edgeStatus_[partId])
{
continue;
}
OStringStream ostr;
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
<< edges[edgeI].type();
// search each block
forAll(blkMesh, blockI)
{
const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
edgeList blkEdges = blockDef.blockShape().edges();
// find the corresponding edge within the block
label foundEdgeI = -1;
forAll(blkEdges, blkEdgeI)
{
if (edges[edgeI].compare(blkEdges[blkEdgeI]))
{
foundEdgeI = blkEdgeI;
break;
}
}
if (foundEdgeI != -1)
{
const List<point>& edgePoints =
blockDef.blockEdgePoints()[foundEdgeI];
vtkPolyData* vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( edgePoints.size() );
vtkmesh->Allocate(1);
vtkIdType pointIds[edgePoints.size()];
forAll(edgePoints, ptI)
{
vtkInsertNextOpenFOAMPoint(vtkpoints, edgePoints[ptI]);
pointIds[ptI] = ptI;
}
vtkmesh->InsertNextCell
(
VTK_POLY_LINE,
edgePoints.size(),
pointIds
);
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
AddToBlock
(
output, vtkmesh, selector, datasetNo,
selection->GetArrayName(partId)
);
vtkmesh->Delete();
datasetNo++;
break;
}
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::convertMeshEdges" << endl;
}
}
void Foam::vtkPV3blockMesh::convertMeshCorners
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
) )
{ {
partInfo& selector = partInfoCorners_; partInfo& selector = partInfoCorners_;
selector.block(blockNo); // set output block selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
@ -150,7 +269,7 @@ void Foam::vtkPV3FoamBlockMesh::convertMeshCorners
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3FoamBlockMesh::convertMeshCorners" << endl; Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshCorners" << endl;
} }
if (true) // or some flag or other condition if (true) // or some flag or other condition
@ -177,7 +296,7 @@ void Foam::vtkPV3FoamBlockMesh::convertMeshCorners
vtkmesh->SetVerts(vtkcells); vtkmesh->SetVerts(vtkcells);
vtkcells->Delete(); vtkcells->Delete();
AddToBlock(output, vtkmesh, selector, datasetNo, ""); AddToBlock(output, vtkmesh, selector, datasetNo, partInfoCorners_.name());
vtkmesh->Delete(); vtkmesh->Delete();
datasetNo++; datasetNo++;
@ -191,7 +310,7 @@ void Foam::vtkPV3FoamBlockMesh::convertMeshCorners
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3FoamBlockMesh::convertMeshCorners" << endl; Info<< "<end> Foam::vtkPV3blockMesh::convertMeshCorners" << endl;
} }
} }

View File

@ -27,8 +27,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3FoamBlockMesh.H" #include "vtkPV3blockMesh.H"
#include "vtkPV3FoamBlockMeshReader.h" #include "vtkPV3blockMeshReader.h"
// VTK includes // VTK includes
#include "vtkDataArraySelection.h" #include "vtkDataArraySelection.h"
@ -67,13 +67,13 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3FoamBlockMesh::AddToBlock void Foam::vtkPV3blockMesh::AddToBlock
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
vtkDataSet* dataset, vtkDataSet* dataset,
const partInfo& selector, const partInfo& selector,
const label datasetNo, const label datasetNo,
const string& datasetName const std::string& datasetName
) )
{ {
const int blockNo = selector.block(); const int blockNo = selector.block();
@ -85,7 +85,7 @@ void Foam::vtkPV3FoamBlockMesh::AddToBlock
{ {
if (blockDO) if (blockDO)
{ {
FatalErrorIn("Foam::vtkPV3FoamBlockMesh::AddToBlock") FatalErrorIn("Foam::vtkPV3blockMesh::AddToBlock")
<< "Block already has a vtkDataSet assigned to it" << "Block already has a vtkDataSet assigned to it"
<< endl; << endl;
return; return;
@ -127,7 +127,7 @@ void Foam::vtkPV3FoamBlockMesh::AddToBlock
} }
vtkDataSet* Foam::vtkPV3FoamBlockMesh::GetDataSetFromBlock vtkDataSet* Foam::vtkPV3blockMesh::GetDataSetFromBlock
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
const partInfo& selector, const partInfo& selector,
@ -149,7 +149,7 @@ vtkDataSet* Foam::vtkPV3FoamBlockMesh::GetDataSetFromBlock
// ununsed at the moment // ununsed at the moment
Foam::label Foam::vtkPV3FoamBlockMesh::GetNumberOfDataSets Foam::label Foam::vtkPV3blockMesh::GetNumberOfDataSets
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
const partInfo& selector const partInfo& selector
@ -168,7 +168,7 @@ Foam::label Foam::vtkPV3FoamBlockMesh::GetNumberOfDataSets
} }
Foam::wordHashSet Foam::vtkPV3FoamBlockMesh::getSelected Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected
( (
vtkDataArraySelection* select vtkDataArraySelection* select
) )
@ -188,7 +188,7 @@ Foam::wordHashSet Foam::vtkPV3FoamBlockMesh::getSelected
} }
Foam::wordHashSet Foam::vtkPV3FoamBlockMesh::getSelected Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected
( (
vtkDataArraySelection* select, vtkDataArraySelection* select,
const partInfo& selector const partInfo& selector
@ -209,7 +209,7 @@ Foam::wordHashSet Foam::vtkPV3FoamBlockMesh::getSelected
} }
Foam::stringList Foam::vtkPV3FoamBlockMesh::getSelectedArrayEntries Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries
( (
vtkDataArraySelection* select vtkDataArraySelection* select
) )
@ -248,7 +248,7 @@ Foam::stringList Foam::vtkPV3FoamBlockMesh::getSelectedArrayEntries
} }
Foam::stringList Foam::vtkPV3FoamBlockMesh::getSelectedArrayEntries Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries
( (
vtkDataArraySelection* select, vtkDataArraySelection* select,
const partInfo& selector const partInfo& selector
@ -287,7 +287,7 @@ Foam::stringList Foam::vtkPV3FoamBlockMesh::getSelectedArrayEntries
} }
void Foam::vtkPV3FoamBlockMesh::setSelectedArrayEntries void Foam::vtkPV3blockMesh::setSelectedArrayEntries
( (
vtkDataArraySelection* select, vtkDataArraySelection* select,
const stringList& selections const stringList& selections
@ -313,6 +313,45 @@ void Foam::vtkPV3FoamBlockMesh::setSelectedArrayEntries
} }
void Foam::vtkPV3blockMesh::updateBoolListStatus
(
boolList& status,
vtkDataArraySelection* selection
)
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl;
}
const label nElem = selection->GetNumberOfArrays();
if (status.size() != nElem)
{
status.setSize(nElem);
status = false;
}
forAll(status, elemI)
{
const int setting = selection->GetArraySetting(elemI);
status[elemI] = setting;
if (debug)
{
Info<< " part[" << elemI << "] = "
<< status[elemI]
<< " : " << selection->GetArrayName(elemI) << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //