Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
vtkMoabReader Class Reference

#include <vtkMoabReader.h>

Public Member Functions

 vtkTypeMacro (vtkMoabReader, vtkMultiBlockDataSetAlgorithm) void PrintSelf(ostream &os
 vtkSetStringMacro (FileName)
 vtkGetStringMacro (FileName)

Static Public Member Functions

static vtkMoabReaderNew ()

Public Attributes

vtkIndent indent

Protected Member Functions

 vtkMoabReader ()
 ~vtkMoabReader ()
int RequestInformation (vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector)
int RequestData (vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector)

Private Member Functions

void CreateSubBlocks (vtkNew< vtkMultiBlockDataSet > &root, smoab::Interface *interface, smoab::Tag const *parentTag, smoab::Tag const *extractTag=NULL)
void ExtractShell (vtkNew< vtkMultiBlockDataSet > &root, smoab::Interface *interface, smoab::Tag const *parentTag)
 vtkMoabReader (const vtkMoabReader &)
void operator= (const vtkMoabReader &)

Private Attributes

char * FileName

Detailed Description

Definition at line 17 of file vtkMoabReader.h.


Constructor & Destructor Documentation

Definition at line 26 of file vtkMoabReader.cxx.

  {
  }

Member Function Documentation

void vtkMoabReader::CreateSubBlocks ( vtkNew< vtkMultiBlockDataSet > &  root,
smoab::Interface interface,
smoab::Tag const *  parentTag,
smoab::Tag const *  extractTag = NULL 
) [private]

Definition at line 97 of file vtkMoabReader.cxx.

References moab::Range::begin(), moab::Range::clear(), moab::Range::end(), smoab::DataSetConverter::fill(), smoab::Interface::findEntitiesWithTag(), smoab::Interface::findEntityRootParents(), smoab::Interface::getRoot(), moab::intersect(), smoab::Interface::name(), smoab::DataSetConverter::readMaterialIds(), and smoab::DataSetConverter::readProperties().

Referenced by RequestData().

{
  if(!extractTag)
    {
    extractTag = parentTag;
    }
  //basic premise: query the database for all tagged elements and create a new
  //multiblock elemenent for each
  smoab::DataSetConverter converter(*interface,extractTag);
  converter.readMaterialIds(true);
  converter.readProperties(true);

  smoab::EntityHandle rootHandle = interface->getRoot();
  smoab::Range parents = interface->findEntityRootParents(rootHandle);
  smoab::Range dimEnts = interface->findEntitiesWithTag(*parentTag,
                                                       rootHandle);

  smoab::Range geomParents = smoab::intersect(parents,dimEnts);

  parents.clear(); //remove this range as it is unneeded
  dimEnts.clear();

  //now each item in range can be extracted into a different grid
  typedef smoab::Range::iterator iterator;
  vtkIdType index = 0;
  for(iterator i=geomParents.begin(); i != geomParents.end(); ++i)
    {
    vtkNew<vtkUnstructuredGrid> block;
    //fill the dataset with geometry and properties
    converter.fill(*i, block.GetPointer(),index);

    //only add it if we have cells found
    if(block->GetNumberOfCells() > 0)
      {
      root->SetBlock(index,block.GetPointer());
      std::string name = interface->name(*i);
      if(name.size() > 0)
        {
        root->GetMetaData(index)->Set(vtkCompositeDataSet::NAME(), name.c_str());
        }
      ++index;
      }
    }
}
void vtkMoabReader::ExtractShell ( vtkNew< vtkMultiBlockDataSet > &  root,
smoab::Interface interface,
smoab::Tag const *  parentTag 
) [private]
static vtkMoabReader* vtkMoabReader::New ( ) [static]
void vtkMoabReader::operator= ( const vtkMoabReader ) [private]
int vtkMoabReader::RequestData ( vtkInformation *  vtkNotUsedrequest,
vtkInformationVector **  vtkNotUsedinputVector,
vtkInformationVector *  outputVector 
) [protected]

Definition at line 42 of file vtkMoabReader.cxx.

References CreateSubBlocks(), FileName, and output.

{
  //First pass is lets load in all 3d elements in a block called Volumes,
  //and load all 2d elements in a block called Surfaces

  vtkInformation* outInfo = outputVector->GetInformationObject(0);
  vtkMultiBlockDataSet *output =
    vtkMultiBlockDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));

  vtkNew<vtkMultiBlockDataSet> volumeRoot;
  vtkNew<vtkMultiBlockDataSet> boundaryRoot;
  vtkNew<vtkMultiBlockDataSet> surfaceRoot;
  vtkNew<vtkMultiBlockDataSet> materialRoot;
  vtkNew<vtkMultiBlockDataSet> neumannRoot;
  vtkNew<vtkMultiBlockDataSet> dirichletRoot;

  const int blockIndex = output->GetNumberOfBlocks();
  output->SetBlock(blockIndex,volumeRoot.GetPointer());
  output->SetBlock(blockIndex+1,boundaryRoot.GetPointer());
  output->SetBlock(blockIndex+2,surfaceRoot.GetPointer());
  output->SetBlock(blockIndex+3,materialRoot.GetPointer());
  output->SetBlock(blockIndex+4,neumannRoot.GetPointer());
  output->SetBlock(blockIndex+5,dirichletRoot.GetPointer());

  //boring work, set the names of the blocks
  output->GetMetaData(blockIndex)->Set(vtkCompositeDataSet::NAME(), "Volumes");
  output->GetMetaData(blockIndex+1)->Set(vtkCompositeDataSet::NAME(), "Boundary");
  output->GetMetaData(blockIndex+2)->Set(vtkCompositeDataSet::NAME(), "Surfaces");
  output->GetMetaData(blockIndex+3)->Set(vtkCompositeDataSet::NAME(), "Material");
  output->GetMetaData(blockIndex+4)->Set(vtkCompositeDataSet::NAME(), "Neumann Sets");
  output->GetMetaData(blockIndex+5)->Set(vtkCompositeDataSet::NAME(), "Dirichlet Sets");

  smoab::GeomTag geom3Tag(3);
  smoab::GeomTag geom2Tag(2);
  smoab::GeomTag geom1Tag(1);
  smoab::MaterialTag matTag;
  smoab::NeumannTag neTag;
  smoab::DirichletTag diTag;

  smoab::Interface interface(this->FileName);
  this->CreateSubBlocks(volumeRoot, &interface, &geom3Tag);
  this->CreateSubBlocks(boundaryRoot, &interface, &geom3Tag, &geom2Tag);

  this->CreateSubBlocks(surfaceRoot, &interface, &geom2Tag);
  this->CreateSubBlocks(materialRoot, &interface, &matTag, &geom3Tag);
  this->CreateSubBlocks(neumannRoot, &interface, &neTag);
  this->CreateSubBlocks(dirichletRoot, &interface, &diTag);

  return 1;
}
int vtkMoabReader::RequestInformation ( vtkInformation *  vtkNotUsedrequest,
vtkInformationVector **  vtkNotUsedinputVector,
vtkInformationVector *  outputVector 
) [protected]

Definition at line 31 of file vtkMoabReader.cxx.

{

  //todo. Walk the file and display all the 2d and 3d elements that the users
  //could possibly want to load
  return this->Superclass::RequestInformation(request,inputVector,outputVector);
}
vtkMoabReader::vtkTypeMacro ( vtkMoabReader  ,
vtkMultiBlockDataSetAlgorithm   
)

Member Data Documentation

char* vtkMoabReader::FileName [private]

Definition at line 50 of file vtkMoabReader.h.

Referenced by RequestData().

Definition at line 21 of file vtkMoabReader.h.

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines