[Paraview] Unable to write out EnSight format with VTK_POLYHEDRON

kenichiro yoshimi rccm.kyoshimi at gmail.com
Thu Dec 1 21:23:26 EST 2011


Hello,

I tried to save data including VTK_POLYHEDRON meshes through "Save
Data" with "EnSight format", but the polyhedrons couldn't be written.
Probably, the reason is that vtkEnSightWriter doesn't support
VTK_POLYHEDRON. In my case, I change the following and work well:
 1. replace all "VTK_CONVEX_POINT_SET" with "VTK_POLYHEDRON".
 2. vtkEnSightWriter.cxx: l.620
  //element conenctivity information
  for (k=0;k<CellsByElement[elementType].size();k++)
    {
    int CellId=CellsByElement[elementType][k];
    vtkIdList *PointIds=input->GetCell(CellId)->GetPointIds();
    for (int m=0;m<PointIds->GetNumberOfIds();m++)
      {
      int PointId=PointIds->GetId(m);
      this->WriteIntToFile(NodeIdToOrder[PointId],fd);
      }
    }
----------------------->
  if (elementType != VTK_POLYHEDRON)
    {
    //element conenctivity information
    for (k=0;k<CellsByElement[elementType].size();k++)
      {
      int CellId=CellsByElement[elementType][k];
      vtkIdList *PointIds=input->GetCell(CellId)->GetPointIds();
      for (int m=0;m<PointIds->GetNumberOfIds();m++)
        {
        int PointId=PointIds->GetId(m);
        this->WriteIntToFile(NodeIdToOrder[PointId],fd);
        }
      }
    }
  else
    {
    //number of faces per elements
    for (k=0;k<CellsByElement[elementType].size();k++)
      {
      int CellId=CellsByElement[elementType][k];
      int numFaces=input->GetCell(CellId)->GetNumberOfFaces();
      this->WriteIntToFile(numFaces,fd);
      }
    //number of nodes per faces
    for (k=0;k<CellsByElement[elementType].size();k++)
      {
      int CellId=CellsByElement[elementType][k];
      vtkCell *cell = input->GetCell(CellId);
      for (int m=0;m<cell->GetNumberOfFaces();m++)
        {
        int numNodes=cell->GetFace(m)->GetNumberOfPoints();
        this->WriteIntToFile(numNodes,fd);
        }
      }
      //element connectivity information
      for (k=0;k<CellsByElement[elementType].size();k++)
        {
        int CellId=CellsByElement[elementType][k];
        vtkCell *cell = input->GetCell(CellId);
        for (int m=0;m<cell->GetNumberOfFaces();m++)
          {
          vtkIdList *PointIds=cell->GetFace(m)->GetPointIds();
          for (int n=0;n<PointIds->GetNumberOfIds();n++)
            {
            int PointId=PointIds->GetId(n);
            this->WriteIntToFile(NodeIdToOrder[PointId],fd);
            }
          }
        }
      }
------------------------------------------------------------------

Can anyone tell me if these modifications are correct?

Please advice
Thanks,
yoshimi


More information about the ParaView mailing list