EXPORT_HEADERS = \
VISU_TypeList.hxx \
VISU_IDMapper.hxx \
- VISU_Convertor.hxx \
- VISU_ConvertorDef.hxx \
- VISU_Convertor_impl.hxx \
- VISU_ConvertorUtils.hxx \
+ VISU_ConvertorDef.hxx \
+ VISU_Structures.hxx \
+ VISU_Convertor.hxx \
+ VISU_ConvertorDef_impl.hxx \
+ VISU_Structures_impl.hxx \
+ VISU_MeshValue.hxx \
+ VISU_PointCoords.hxx \
+ VISU_Convertor_impl.hxx \
+ VISU_ConvertorUtils.hxx \
VISU_MergeFilter.hxx \
+ VISU_AppendPolyData.hxx \
VISU_ExtractUnstructuredGrid.hxx
# Libraries targets
LIB = libVisuConvertor.la
LIB_SRC = \
VISU_IDMapper.cxx \
+ VISU_Structures.cxx \
VISU_Convertor.cxx \
+ VISU_Structures_impl.cxx \
+ VISU_MeshValue.cxx \
+ VISU_PointCoords.cxx \
VISU_Convertor_impl.cxx \
+ VISU_MedConvertor.cxx \
VISU_ConvertorUtils.cxx \
VISU_ExtractUnstructuredGrid.cxx \
- VISU_MergeFilter.cxx \
- VISU_MedConvertor.cxx
+ VISU_AppendPolyData.cxx \
+ VISU_MergeFilter.cxx
# Executables targets
BIN = VISUConvertor
--- /dev/null
+// SALOME OBJECT : kernel of SALOME component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : VTKViewer_GeometryFilter.cxx
+// Author :
+// Module : SALOME
+// $Header$
+
+#include "VISU_AppendPolyData.hxx"
+
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkDataSetCollection.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+
+#include <vtkPoints.h>
+
+vtkCxxRevisionMacro(VISU_AppendPolyData, "$Revision$");
+vtkStandardNewMacro(VISU_AppendPolyData);
+
+VISU_AppendPolyData
+::VISU_AppendPolyData()
+{
+ myDoMappingFlag = false;
+}
+
+VISU_AppendPolyData
+::~VISU_AppendPolyData()
+{}
+
+void
+VISU_AppendPolyData
+::SetDoMappingFlag(const bool theFlag)
+{
+ if(myDoMappingFlag == theFlag)
+ return;
+
+ myDoMappingFlag = theFlag;
+
+ this->Modified();
+}
+
+bool
+VISU_AppendPolyData
+::DoMappingFlag() const
+{
+ return myDoMappingFlag;
+}
+
+void
+VISU_AppendPolyData
+::SetPoints(vtkPoints* thePoints)
+{
+ if(GetPoints() == thePoints)
+ return;
+
+ myPoints = thePoints;
+
+ this->Modified();
+}
+
+vtkPoints*
+VISU_AppendPolyData
+::GetPoints()
+{
+ return myPoints.GetPointer();
+}
+
+void
+VISU_AppendPolyData
+::Execute()
+{
+ if(myPoints.GetPointer())
+ MakeOutput();
+ else
+ Superclass::Execute();
+
+ if(myDoMappingFlag)
+ DoMapping();
+}
+
+
+void
+VISU_AppendPolyData
+::DoMapping()
+{
+ myNodeRanges.clear();
+ myCellRanges.clear();
+
+ vtkIdType aPntStartId = 0;
+ vtkIdType aCellStartId = 0;
+
+ for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){
+ vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]);
+ // Do mapping of the nodes
+ if(!myPoints.GetPointer()){
+ vtkIdType aNbPnts = aDataSet->GetNumberOfPoints();
+ myNodeRanges.push_back(aPntStartId + aNbPnts);
+ aPntStartId += aNbPnts;
+ }
+ // Do mapping of the cells
+ vtkIdType aNbCells = aDataSet->GetNumberOfCells();
+ myCellRanges.push_back(aCellStartId + aNbCells);
+ aCellStartId += aNbCells;
+ }
+}
+
+namespace
+{
+ inline
+ vtkIdType
+ GetOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID,
+ const VISU_AppendPolyData::TVectorIds& theRanges)
+ {
+ theInputID = theInputDataSetID = -1;
+
+ vtkIdType aNbInputs = theRanges.size();
+ if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs)
+ return -1;
+
+ vtkIdType aStartId = theRanges[theInputDataSetID];
+ return aStartId + theInputID;
+ }
+}
+
+vtkIdType
+VISU_AppendPolyData
+::GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
+{
+ if(myPoints.GetPointer())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myNodeRanges);
+}
+
+
+vtkIdType
+VISU_AppendPolyData
+::GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
+{
+ if(myPoints.GetPointer())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myCellRanges);
+}
+
+
+namespace
+{
+ void
+ GetInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID,
+ const VISU_AppendPolyData::TVectorIds& theRanges)
+ {
+ theInputID = theStartID = theInputDataSetID = -1;
+
+ if(theRanges.empty())
+ return;
+
+ const vtkIdType& aRangeEnd = theRanges.back();
+ if(theOutputID < 0 || theOutputID >= aRangeEnd)
+ return;
+
+ vtkIdType aStartId = 0;
+ vtkIdType aNbInputs = theRanges.size();
+ for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
+ vtkIdType aRange = theRanges[aDataSetId];
+ if(aRange > theOutputID){
+ theInputID = theOutputID - aStartId;
+ theInputDataSetID = aDataSetId;
+ theStartID = aStartId;
+ break;
+ }
+ aStartId = aRange;
+ }
+ }
+}
+
+void
+VISU_AppendPolyData
+::GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID)
+{
+ if(myPoints.GetPointer()) {
+ theStartID = theInputDataSetID = 0;
+ theInputID = theOutputID;
+ return;
+ }
+
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myNodeRanges);
+}
+
+
+void
+VISU_AppendPolyData
+::GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID)
+{
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myCellRanges);
+}
+
+
+void
+VISU_AppendPolyData
+::MakeOutput()
+{
+ // loop over all data sets, checking to see what point data is available.
+ vtkIdType numPts = 0;
+
+ // These Field lists are very picky. Count the number of non empty inputs
+ // so we can initialize them properly.
+ int idx;
+ int countCD = 0;
+ for (idx = 0; idx < this->NumberOfInputs; ++idx)
+ {
+ vtkPolyData *ds = (vtkPolyData *)(this->Inputs[idx]);
+ if (ds != NULL)
+ {
+ if (ds->GetNumberOfCells() > 0 )
+ {
+ ++countCD;
+ } // for a data set that has cells
+ } // for a non NULL input
+ } // for each input
+
+ // These are used to determine which fields are available for appending
+ vtkDataSetAttributes::FieldList cellList(countCD);
+
+ countCD = 0;
+ vtkIdType numCells = 0;
+ vtkIdType numPolys = 0;
+ vtkIdType sizePolys = 0;
+ for (idx = 0; idx < this->NumberOfInputs; ++idx)
+ {
+ vtkPolyData *ds = (vtkPolyData *)(this->Inputs[idx]);
+ if (ds != NULL)
+ {
+ // Although we cannot have cells without points ... let's not nest.
+ if (ds->GetNumberOfCells() > 0 )
+ {
+ // keep track of the size of the poly cell array
+ if (ds->GetPolys())
+ {
+ numPolys += ds->GetPolys()->GetNumberOfCells();
+ sizePolys += ds->GetPolys()->GetNumberOfConnectivityEntries();
+ }
+ numCells += ds->GetNumberOfCells();
+
+ vtkCellData *inCD = ds->GetCellData();
+ if ( countCD == 0 )
+ {
+ cellList.InitializeFieldList(inCD);
+ }
+ else
+ {
+ cellList.IntersectFieldList(inCD);
+ }
+ ++countCD;
+ } // for a data set that has cells
+ } // for a non NULL input
+ } // for each input
+
+ if ( numPts < 1 || numCells < 1 )
+ {
+ return;
+ }
+ this->UpdateProgress(0.10);
+
+ // Allocate geometry/topology
+ vtkCellArray* newVerts = vtkCellArray::New();
+ newVerts->Allocate(numCells*4);
+
+ vtkCellArray* newLines = vtkCellArray::New();
+ newLines->Allocate(numCells*4);
+
+ vtkCellArray* newStrips = vtkCellArray::New();
+ newStrips->Allocate(numCells*4);
+
+ vtkCellArray* newPolys = vtkCellArray::New();
+ vtkIdType *pPolys = newPolys->WritePointer(numPolys, sizePolys);
+
+ // Allocate the point and cell data
+ vtkPolyData *output = this->GetOutput();
+ vtkCellData *outputCD = output->GetCellData();
+ outputCD->CopyAllocate(cellList,numCells);
+
+ // loop over all input sets
+ vtkIdType ptOffset = 0;
+ vtkIdType cellOffset = 0;
+ countCD = 0;
+ for (idx = 0; idx < this->NumberOfInputs; ++idx)
+ {
+ this->UpdateProgress(0.2 + 0.8*idx/this->NumberOfInputs);
+ vtkPolyData *ds = (vtkPolyData *)(this->Inputs[idx]);
+ // this check is not necessary, but I'll put it in anyway
+ if (ds != NULL)
+ {
+ vtkIdType numPts = ds->GetNumberOfPoints();
+ vtkIdType numCells = ds->GetNumberOfCells();
+ if ( numPts <= 0 && numCells <= 0 )
+ {
+ continue; //no input, just skip
+ }
+
+ vtkCellData *inCD = ds->GetCellData();
+
+ vtkCellArray *inVerts = ds->GetVerts();
+ vtkCellArray *inLines = ds->GetLines();
+ vtkCellArray *inPolys = ds->GetPolys();
+ vtkCellArray *inStrips = ds->GetStrips();
+
+ if (ds->GetNumberOfCells() > 0)
+ {
+ // cell data could be made efficient like the point data,
+ // but I will wait on that.
+ // copy cell data
+ vtkIdType cellId;
+ for (cellId=0; cellId < numCells; cellId++)
+ {
+ outputCD->CopyData(cellList,inCD,countCD,cellId,cellId+cellOffset);
+ }
+ ++countCD;
+
+ // copy the cells
+ pPolys = this->AppendCells(pPolys, inPolys, ptOffset);
+
+ // These other cell arrays could be made efficient like polys ...
+ int i;
+ vtkIdType *pts = 0;
+ vtkIdType npts = 0;
+ for (inVerts->InitTraversal(); inVerts->GetNextCell(npts,pts); )
+ {
+ newVerts->InsertNextCell(npts);
+ for (i=0; i < npts; i++)
+ {
+ newVerts->InsertCellPoint(pts[i]+ptOffset);
+ }
+ }
+
+ for (inLines->InitTraversal(); inLines->GetNextCell(npts,pts); )
+ {
+ newLines->InsertNextCell(npts);
+ for (i=0; i < npts; i++)
+ {
+ newLines->InsertCellPoint(pts[i]+ptOffset);
+ }
+ }
+
+ for (inStrips->InitTraversal(); inStrips->GetNextCell(npts,pts); )
+ {
+ newStrips->InsertNextCell(npts);
+ for (i=0; i < npts; i++)
+ {
+ newStrips->InsertCellPoint(pts[i]+ptOffset);
+ }
+ }
+ }
+ cellOffset += numCells;
+ }
+ }
+
+ if ( newVerts->GetNumberOfCells() > 0 )
+ {
+ output->SetVerts(newVerts);
+ }
+ newVerts->Delete();
+
+ if ( newLines->GetNumberOfCells() > 0 )
+ {
+ output->SetLines(newLines);
+ }
+ newLines->Delete();
+
+ if ( newPolys->GetNumberOfCells() > 0 )
+ {
+ output->SetPolys(newPolys);
+ }
+ newPolys->Delete();
+
+ if ( newStrips->GetNumberOfCells() > 0 )
+ {
+ output->SetStrips(newStrips);
+ }
+ newStrips->Delete();
+
+ // When all optimizations are complete, this squeeze will be unecessary.
+ // (But it does not seem to cost much.)
+ output->Squeeze();
+
+ /*
+ int idx;
+ vtkIdType numPts, numCells, newCellId, cellId;
+ vtkCellData *cd;
+ vtkIdList *ptIds;
+ vtkDataSet *ds;
+ vtkPolyData *output = this->GetOutput();
+ //
+ numPts = myPoints->GetNumberOfPoints();
+ if (numPts < 1) {
+ return;
+ }
+ //
+ numCells = 0;
+ for (idx = 0; idx < this->NumberOfInputs; ++idx) {
+ ds = (vtkDataSet *)(this->Inputs[idx]);
+ if (ds != NULL) {
+ if ( ds->GetNumberOfPoints() <= 0 && ds->GetNumberOfCells() <= 0 ) {
+ continue; //no input, just skip
+ }
+ numCells += ds->GetNumberOfCells();
+ }//if non-empty dataset
+ }//for all inputs
+ if (numCells < 1) {
+ return;
+ }
+ //
+ // Now can allocate memory
+ output->Allocate(numCells);
+ ptIds = vtkIdList::New();
+ ptIds->Allocate(VTK_CELL_SIZE);
+ //
+ // Append each input dataset together
+ //
+ // 1.points
+ output->SetPoints(myPoints.GetPointer());
+ // 2.cells
+ for (idx = 0; idx < this->NumberOfInputs; ++idx) {
+ ds = (vtkDataSet *)(this->Inputs[idx]);
+ if (ds != NULL) {
+ numCells = ds->GetNumberOfCells();
+ cd = ds->GetCellData();
+ // copy cell and cell data
+ for (cellId=0; cellId<numCells; cellId++) {
+ ds->GetCellPoints(cellId, ptIds);
+ newCellId = output->InsertNextCell(ds->GetCellType(cellId), ptIds);
+ }
+ }
+ }
+ //
+ ptIds->Delete();
+ */
+}
+
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef VISU_APPENDPOLYDATA_H
+#define VISU_APPENDPOLYDATA_H
+
+#include <vtkAppendPolyData.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+#include <map>
+
+class vtkPoints;
+
+/*! \brief This class used same as vtkAppendFilter. See documentation on VTK for more information.
+ */
+class VISU_AppendPolyData : public vtkAppendPolyData
+{
+public:
+ /*! \fn static VTKViewer_AppendFilter *New()
+ */
+ static VISU_AppendPolyData *New();
+
+ /*! \fn vtkTypeRevisionMacro(VTKViewer_AppendFilter, vtkAppendFilter)
+ * \brief VTK type revision macros.
+ */
+ vtkTypeRevisionMacro(VISU_AppendPolyData, vtkAppendPolyData);
+
+ void SetDoMappingFlag(const bool theFlag);
+
+ bool DoMappingFlag() const;
+
+ void
+ SetPoints(vtkPoints* thePoints);
+
+ vtkPoints*
+ GetPoints();
+
+ vtkIdType
+ GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
+
+ vtkIdType
+ GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
+
+ void
+ GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
+
+ void
+ GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
+
+ typedef std::vector<vtkIdType> TVectorIds;
+
+protected:
+ /*! \fn VTKViewer_AppendFilter();
+ * \brief Constructor
+ */
+ VISU_AppendPolyData();
+ /*! \fn ~VTKViewer_AppendFilter();
+ * \brief Destructor.
+ */
+ ~VISU_AppendPolyData();
+ /*! \fn void Execute();
+ * \brief Filter culculation method.
+ */
+ virtual void Execute();
+ //
+ void DoMapping();
+
+ void Reset();
+
+ void MakeOutput();
+
+ bool myDoMappingFlag;
+ TVectorIds myNodeRanges;
+ TVectorIds myCellRanges;
+ vtkSmartPointer<vtkPoints> myPoints;
+};
+
+#endif
#include <qstring.h>
-using namespace std;
-
-namespace VISU{
-
- inline
- int
- GetNbOfPoints(int theVTKCellType)
- {
- switch(theVTKCellType){
- case VTK_VERTEX : return 1;
- case VTK_LINE : return 2;
- case VTK_TRIANGLE : return 3;
- case VTK_QUAD : return 4;
- case VTK_TETRA : return 4;
- case VTK_HEXAHEDRON : return 8;
- case VTK_WEDGE : return 6;
- case VTK_PYRAMID : return 5;
- default: return -1;
- }
- }
-}
+#include <utility>
+//---------------------------------------------------------------
const VISU::TMeshMap&
VISU_Convertor
::GetMeshMap()
}
-string
+//---------------------------------------------------------------
+std::string
VISU_Convertor
::GenerateName(const VISU::TTime& aTime)
{
static QString aName;
- const string aUnits = aTime.second, tmp(aUnits.size(),' ');
+ const std::string aUnits = aTime.second, tmp(aUnits.size(), ' ');
if(aUnits == "" || aUnits == tmp)
- aName.sprintf("%g, -",aTime.first);
+ aName.sprintf("%g, -", aTime.first);
else
- aName.sprintf("%g, %s",aTime.first,aTime.second.c_str());
+ aName.sprintf("%g, %s", aTime.first, aTime.second.c_str());
aName = aName.simplifyWhiteSpace();
return aName.latin1();
}
-string
+
+//---------------------------------------------------------------
+std::string
VISU_Convertor
-::GenerateName(const string& theName,
+::GenerateName(const std::string& theName,
unsigned int theTimeId)
{
static QString aName;
if(iEnd > VtkHighLevelLength) iEnd = VtkHighLevelLength;
char aNewName[iEnd+1];
aNewName[iEnd] = '\0';
- strncpy(aNewName,aName,iEnd);
- replace(aNewName,aNewName+iEnd,' ','_');
+ strncpy(aNewName, aName, iEnd);
+ std::replace(aNewName, aNewName + iEnd, ' ', '_');
if(true || theTimeId == 0)
aName = aNewName;
else
- aName.sprintf("%s_%d",aNewName,theTimeId);
+ aName.sprintf("%s_%d", aNewName, theTimeId);
return aName.latin1();
}
+
+
+//---------------------------------------------------------------
/*!
\file VISU_Convertor.hxx
- \brief The file contains definitions for basic classes of the VISU CONVERTER package
+ \brief The file represents definition of basic interface of the VISU CONVERTER package
*/
-#include "VISU_IDMapper.hxx"
-#include "VISU_ConvertorDef.hxx"
-
-#include "MED_Vector.hxx"
-
-#include <map>
-#include <set>
-#include <utility>
-#include <string>
-#include <stdexcept>
-
-namespace VISU
-{
- using MED::TVector;
-
- //---------------------------------------------------------------
- typedef std::string TName;
-
- typedef TVector<TName> TNames;
-
- //---------------------------------------------------------------
- //! Define a basic class for all MED entites which can be identified by its number
- struct TIntId: virtual TBaseStructure
- {
- vtkIdType myId;
-
- TIntId(): myId(0)
- {}
- };
-
-
- //---------------------------------------------------------------
- typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
- typedef std::map<TName,PGroup> TGroupMap;
-
- //! Define a basic class which corresponds to MED MESH entity
- /*!
- This class in its turn contains map of TMeshOnEntity and TGroup substructures,
- also it keeps name and dimention of corresponding MED MESH entity.
- */
- struct TMesh: virtual TBaseStructure
- {
- TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
- TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
- TName myName; //! Name of the corresponding MED MESH
- vtkIdType myDim; //! Dimension of the corresponding MED MESH
-
- std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree
- std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree
-
- TMesh(): myDim(0)
- {}
- };
- typedef std::map<std::string,PMesh> TMeshMap;
-
-
- //---------------------------------------------------------------
- //! Define a basic class which corresponds to MED PROFILE entity
- struct TSubProfile: virtual TBaseStructure
- {};
-
-
- //---------------------------------------------------------------
- //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
- struct TProfile: virtual TNamedIDMapper
- {};
-
-
- //---------------------------------------------------------------
- bool
- operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
-
- typedef std::set<PSubProfile> TProfileKey;
- typedef std::map<TProfileKey,PProfile> TProfileMap;
-
-
- //---------------------------------------------------------------
- //! Define a basic class for MED GAUSS entity
- struct TGauss: virtual TBaseStructure
- {};
-
-
- //---------------------------------------------------------------
- //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
- struct TGaussSubMesh: virtual TBaseStructure
- {
- PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
- };
-
-
- //---------------------------------------------------------------
- //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
- struct TGaussMesh: virtual TGaussPtsIDMapper
- {};
-
-
- //---------------------------------------------------------------
- bool
- operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
-
- typedef std::set<PGaussSubMesh> TGaussKey;
- typedef std::map<TGaussKey,PGaussMesh> TGaussMeshMap;
-
-
- //---------------------------------------------------------------
-
- typedef std::map<TName,PFamily> TFamilyMap;
- typedef std::map<TName,PField> TFieldMap;
-
- //! Define a basic class which corresponds to MED ENTITY
- /*!
- This class in its turn contains map of TGaussMesh and TProfile substructures,
- also it keeps corresponding map of MED FAMILIES and FIELDS.
- */
- struct TMeshOnEntity: virtual TNamedIDMapper
- {
- TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
- TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
-
- TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
- TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
-
- TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
- TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
- };
-
-
- //---------------------------------------------------------------
- //! Define a basic class for MED FAMILY entity
- struct TFamily: virtual TIntId,
- virtual TIDMapper
- {
- TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
- TName myName; //!< Contains name of the corresponding MED FAMILY
- };
-
-
- //---------------------------------------------------------------
- typedef std::set<PFamily> TFamilySet;
-
- //! Define a basic class for MED GROUP entity
- struct TGroup: virtual TIDMapper
- {
- TFamilySet myFamilySet;
- };
-
-
- //---------------------------------------------------------------
- typedef std::map<vtkIdType,PValForTime> TValField;
- typedef std::pair<vtkFloatingPointType,vtkFloatingPointType> TMinMax;
-
- //! Define a basic class for MED FIELD entity
- struct TField: virtual TIntId
- {
- TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
- TName myName; //!< Contains name of the corresponding MED FIELD
- TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
- TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
- TNames myCompNames; //!< Contains names of components of the MED FIELD
- TNames myUnitNames; //!< Contains names of units of the MED FIELD
- vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
-
- //! Calculate min/max values for each of the MED FIELD components among all its timestamps
- /*!
- Numeration of the components starts from 1.
- Zero component contains min/max value for modulus of corresponding vector
- */
- virtual
- TMinMax
- GetMinMax(vtkIdType theCompID) = 0;
-
- bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
-
- TField():
- myNbComp(0),
- myIsMinMaxInitilized(false)
- {}
- };
-
-
- //---------------------------------------------------------------
- typedef std::pair<double,std::string> TTime;
-
- //! Define a basic class for MED TIMESTAMP entity
- struct TValForTime: virtual TIntId
- {
- TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
- TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
- TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
- TTime myTime;
-
- PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
- PGaussMesh myGaussMesh;
- };
-
-
- //---------------------------------------------------------------
- //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
- void
- WriteToFile(vtkUnstructuredGrid* theDataSet,
- const std::string& theFileName);
-};
+#include "VISU_Structures.hxx"
//---------------------------------------------------------------
1. Perfrom parsing of MED file to get known what MED entities are pressent in it
2. Get VTK representation for any existing MED entity
Also, it can perform some additional work to calculate expected amount of memory to build defined VTK representation
-
*/
class VISU_Convertor
{
-protected:
- std::string myName;
- VISU::TMeshMap myMeshMap;
- int myIsDone;
-
public:
virtual
~VISU_Convertor()
int
IsDone() const { return myIsDone; }
- //! Defines what subtype of vtkDataSet is used for MED to VTK mapping
- typedef VISU::TVTKOutput TOutput;
-
//! This method perform first parsing of MED file to get known what MED entities are pressent in it
virtual
VISU_Convertor*
//! Get mesh for corresponding MED FAMILY
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName) = 0;
//! Get mesh for corresponding MED GROUP
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName) = 0;
//! Get mesh with attached values for corresponding MED TIMESTAMP
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetTimeStampOnMesh(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFieldName,
static
std::string
GenerateName(const std::string& theName, unsigned int theTimeId);
+
+protected:
+ std::string myName;
+ VISU::TMeshMap myMeshMap;
+ int myIsDone;
};
extern "C"
namespace VISU
{
- using MED::SharedPtr;
-
//---------------------------------------------------------------
enum TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
+
+ //---------------------------------------------------------------
+ //! Defines VISU enumeration of geometrical types
+ enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
+ eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
+ ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310,
+ ePYRA13=313, ePENTA15=315, eHEXA20=320,
+ ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
+
+
+ //---------------------------------------------------------------
struct TMesh;
- typedef SharedPtr<TMesh> PMesh;
+ typedef MED::SharedPtr<TMesh> PMesh;
+
+ //---------------------------------------------------------------
struct TGaussSubMesh;
- typedef SharedPtr<TGaussSubMesh> PGaussSubMesh;
+ typedef MED::SharedPtr<TGaussSubMesh> PGaussSubMesh;
+
+ //---------------------------------------------------------------
struct TGaussMesh;
- typedef SharedPtr<TGaussMesh> PGaussMesh;
+ typedef MED::SharedPtr<TGaussMesh> PGaussMesh;
+
+ //---------------------------------------------------------------
struct TSubProfile;
- typedef SharedPtr<TSubProfile> PSubProfile;
+ typedef MED::SharedPtr<TSubProfile> PSubProfile;
+
+ //---------------------------------------------------------------
struct TProfile;
- typedef SharedPtr<TProfile> PProfile;
+ typedef MED::SharedPtr<TProfile> PProfile;
+
+ //---------------------------------------------------------------
struct TMeshOnEntity;
- typedef SharedPtr<TMeshOnEntity> PMeshOnEntity;
+ typedef MED::SharedPtr<TMeshOnEntity> PMeshOnEntity;
+
+ //---------------------------------------------------------------
struct TFamily;
- typedef SharedPtr<TFamily> PFamily;
+ typedef MED::SharedPtr<TFamily> PFamily;
+
+ //---------------------------------------------------------------
struct TGroup;
- typedef SharedPtr<TGroup> PGroup;
+ typedef MED::SharedPtr<TGroup> PGroup;
+
+ //---------------------------------------------------------------
struct TField;
- typedef SharedPtr<TField> PField;
+ typedef MED::SharedPtr<TField> PField;
+
+ //---------------------------------------------------------------
struct TGauss;
- typedef SharedPtr<TGauss> PGauss;
+ typedef MED::SharedPtr<TGauss> PGauss;
+
+ //---------------------------------------------------------------
struct TValForTime;
- typedef SharedPtr<TValForTime> PValForTime;
+ typedef MED::SharedPtr<TValForTime> PValForTime;
+
+ //---------------------------------------------------------------
struct TGrille;
- typedef SharedPtr<TGrille> PGrille;
+ typedef MED::SharedPtr<TGrille> PGrille;
+
+
+ //---------------------------------------------------------------
}
#endif
--- /dev/null
+// VISU CONVERTOR :
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File :
+// Author :
+// Module :
+
+#ifndef VISU_ConvertorDef_impl_HeaderFile
+#define VISU_ConvertorDef_impl_HeaderFile
+
+/*!
+ \file VISU_ConvertorDef_impl.hxx
+ \brief The file contains predeclarations for basic classes of the VISU CONVERTOR package
+*/
+
+#include "VISU_ConvertorDef.hxx"
+
+#include <vtkSmartPointer.h>
+
+class vtkCell;
+class vtkPoints;
+
+class vtkPolyData;
+class VISU_AppendPolyData;
+
+class vtkUnstructuredGrid;
+class VTKViewer_AppendFilter;
+
+class VISU_MergeFilter;
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ typedef vtkSmartPointer<VISU_MergeFilter> PMergeFilter;
+
+
+ //---------------------------------------------------------------
+ typedef vtkSmartPointer<vtkPolyData> PPolyData;
+ typedef vtkSmartPointer<VISU_AppendPolyData> PAppendPolyData;
+
+ struct TAppendPolyDataHolder;
+ typedef MED::SharedPtr<TAppendPolyDataHolder> PAppendPolyDataHolder;
+
+ struct TPolyDataIDMapperImpl;
+ typedef MED::SharedPtr<TPolyDataIDMapperImpl> PPolyDataIDMapperImpl;
+
+
+ //---------------------------------------------------------------
+ typedef vtkSmartPointer<vtkUnstructuredGrid> PUnstructuredGrid;
+ typedef vtkSmartPointer<VTKViewer_AppendFilter> PAppendFilter;
+
+ struct TAppendFilterHolder;
+ typedef MED::SharedPtr<TAppendFilterHolder> PAppendFilterHolder;
+
+ struct TUnstructuredGridIDMapperImpl;
+ typedef MED::SharedPtr<TUnstructuredGridIDMapperImpl> PUnstructuredGridIDMapperImpl;
+
+
+ //---------------------------------------------------------------
+ struct TPointCoords;
+ typedef MED::SharedPtr<TPointCoords> PPointCoords;
+
+
+ //---------------------------------------------------------------
+ struct TNamedPointCoords;
+ typedef MED::SharedPtr<TNamedPointCoords> PNamedPointCoords;
+
+
+ //---------------------------------------------------------------
+ struct TMeshValueBase;
+ typedef MED::SharedPtr<TMeshValueBase> PMeshValue;
+
+
+ //---------------------------------------------------------------
+ struct TMeshImpl;
+ typedef MED::SharedPtr<TMeshImpl> PMeshImpl;
+
+
+ //---------------------------------------------------------------
+ struct TSubProfileImpl;
+ typedef MED::SharedPtr<TSubProfileImpl> PSubProfileImpl;
+
+
+ //---------------------------------------------------------------
+ struct TProfileImpl;
+ typedef MED::SharedPtr<TProfileImpl> PProfileImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGaussImpl;
+ typedef MED::SharedPtr<TGaussImpl> PGaussImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGaussSubMeshImpl;
+ typedef MED::SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGaussMeshImpl;
+ typedef MED::SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGaussPtsIDFilter;
+ typedef MED::SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
+
+
+ //---------------------------------------------------------------
+ struct TSubMeshImpl;
+ typedef MED::SharedPtr<TSubMeshImpl> PSubMeshImpl;
+
+
+ //---------------------------------------------------------------
+ struct TMeshOnEntityImpl;
+ typedef MED::SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+
+
+ //---------------------------------------------------------------
+ struct TFamilyImpl;
+ typedef MED::SharedPtr<TFamilyImpl> PFamilyImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGroupImpl;
+ typedef MED::SharedPtr<TGroupImpl> PGroupImpl;
+
+
+ //---------------------------------------------------------------
+ struct TFieldImpl;
+ typedef MED::SharedPtr<TFieldImpl> PFieldImpl;
+
+
+ //---------------------------------------------------------------
+ struct TValForTimeImpl;
+ typedef MED::SharedPtr<TValForTimeImpl> PValForTimeImpl;
+}
+
+#endif
#include "VISU_ConvertorUtils.hxx"
+#include <vtkCellType.h>
#include <vtkUnstructuredGridWriter.h>
+#include <vtkPolyDataWriter.h>
#include <vtkTimerLog.h>
#ifdef _DEBUG_
namespace VISU
{
+ //---------------------------------------------------------------
+ vtkIdType
+ VISUGeom2NbNodes(EGeometry theGeom)
+ {
+ switch(theGeom){
+#ifndef VISU_ENABLE_QUADRATIC
+ case VISU::eSEG3:
+ return 2;
+ case VISU::eTRIA6:
+ return 3;
+ case VISU::eQUAD8:
+ return 4;
+ case VISU::eTETRA10:
+ return 4;
+ case VISU::eHEXA20:
+ return 8;
+ case VISU::ePENTA15:
+ return 6;
+ case VISU::ePYRA13:
+ return 5;
+#endif
+ case VISU::ePOLYGONE:
+ case VISU::ePOLYEDRE:
+ return -1;
+ default:
+ return theGeom % 100;
+ }
+ }
+
+
+ //---------------------------------------------------------------
+ vtkIdType
+ VISUGeom2VTK(EGeometry theGeom)
+ {
+ switch(theGeom){
+ case VISU::ePOINT1:
+ return VTK_VERTEX;
+ case VISU::eSEG2:
+ return VTK_LINE;
+ case VISU::eTRIA3:
+ return VTK_TRIANGLE;
+ case VISU::eQUAD4:
+ return VTK_QUAD;
+ case VISU::eTETRA4:
+ return VTK_TETRA;
+ case VISU::eHEXA8:
+ return VTK_HEXAHEDRON;
+ case VISU::ePENTA6:
+ return VTK_WEDGE;
+ case VISU::ePYRA5:
+ return VTK_PYRAMID;
+
+ case VISU::ePOLYGONE:
+ return VTK_POLYGON;
+ case VISU::ePOLYEDRE:
+ return VTK_CONVEX_POINT_SET;
+
+#ifndef VISU_ENABLE_QUADRATIC
+ case VISU::eSEG3:
+ return VTK_LINE;
+ case VISU::eTRIA6:
+ return VTK_TRIANGLE;
+ case VISU::eQUAD8:
+ return VTK_QUAD;
+ case VISU::eTETRA10:
+ return VTK_TETRA;
+ case VISU::eHEXA20:
+ return VTK_HEXAHEDRON;
+ case VISU::ePENTA15:
+ return VTK_WEDGE;
+ case VISU::ePYRA13:
+ return VTK_PYRAMID;
+
+#else
+
+ case VISU::eSEG3:
+#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_EDGE;
+#else
+ return VTK_POLY_LINE;
+#endif
+
+ case VISU::eTRIA6:
+#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_TRIANGLE;
+#else
+ return VTK_POLYGON;
+#endif
+
+ case VISU::eQUAD8:
+#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_QUAD;
+#else
+ return VTK_POLYGON;
+#endif
+
+ case VISU::eTETRA10:
+#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_TETRA;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+ case VISU::eHEXA20:
+#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_HEXAHEDRON;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+ case VISU::ePENTA15:
+#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_WEDGE;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+ case VISU::ePYRA13:
+#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
+ return VTK_QUADRATIC_PYRAMID;
+#else
+ return VTK_CONVEX_POINT_SET;
+#endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+ default:
+ return -1;
+ }
+ }
+
+ //---------------------------------------------------------------
void
- WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
+ WriteToFile(vtkUnstructuredGrid* theDataSet,
+ const std::string& theFileName)
{
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
//aWriter->SetFileType(VTK_BINARY);
}
+ //---------------------------------------------------------------
+ void
+ WriteToFile(vtkPolyData* theDataSet,
+ const std::string& theFileName)
+ {
+ vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
+ //aWriter->SetFileType(VTK_BINARY);
+ aWriter->SetFileName(theFileName.c_str());
+ aWriter->SetInput(theDataSet);
+ aWriter->Write();
+ aWriter->Delete();
+ }
+
+
+ //---------------------------------------------------------------
TTimerLog
::TTimerLog(int theIsDebug,
const std::string& theName):
BEGMSG(myIsDebug > 1,"{\n");
}
+ //---------------------------------------------------------------
TTimerLog
::~TTimerLog()
{
myTimerLog = NULL;
}
+
+ //---------------------------------------------------------------
}
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
-// File : VISU_Convertor_impl.hxx
+// File : VISU_ConvertorUtils.hxx
// Author : Alexey PETROV
// Module : VISU
#ifndef VISU_ConvertorUtils_HeaderFile
#define VISU_ConvertorUtils_HeaderFile
-#include <string>
+#include "VISU_ConvertorDef.hxx"
+#include "MED_Utilities.hxx"
-#include <vtkCellType.h>
+#include <vtkSystemIncludes.h>
-#include "MED_Utilities.hxx"
+#include <string>
class vtkUnstructuredGrid;
+class vtkPolyData;
class vtkTimerLog;
+#ifndef VISU_ENABLE_QUADRATIC
+ #define VISU_ENABLE_QUADRATIC
+ #define VISU_USE_VTK_QUADRATIC
+#endif
+
namespace MED
{
class PrefixPrinter;
}
-namespace VISU{
+namespace VISU
+{
+ //---------------------------------------------------------------
+ //! Get number of nodes for defined geometrical type
+ vtkIdType
+ VISUGeom2NbNodes(EGeometry theGeom);
+
+ //! Maps VISU geometrical type to VTK one
+ vtkIdType
+ VISUGeom2VTK(EGeometry theGeom);
+ //---------------------------------------------------------------
+ //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
void
- WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
+ WriteToFile(vtkUnstructuredGrid* theDataSet,
+ const std::string& theFileName);
+ //---------------------------------------------------------------
+ //! The utility function allows to write vtkPolyData to a file with defined name
+ void
+ WriteToFile(vtkPolyData* theDataSet,
+ const std::string& theFileName);
+
+ //---------------------------------------------------------------
+ //! The utility class that allows to perform perfomance mesurement
class TTimerLog
{
int myIsDebug;
vtkTimerLog* myTimerLog;
MED::PrefixPrinter myPrefixPrinter;
public:
+
TTimerLog(int theIsDebug,
const std::string& theName);
~TTimerLog();
// Module : VISU
#include "VISU_Convertor_impl.hxx"
-#include "VISU_ConvertorUtils.hxx"
-#include "VTKViewer_AppendFilter.h"
-#include "VISU_MergeFilter.hxx"
-#include "VTKViewer_CellLocationsArray.h"
-
-#include <vtkPoints.h>
-#include <vtkUnstructuredGrid.h>
-
-#include <vtkIdList.h>
-#include <vtkCellType.h>
-#include <vtkCellArray.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkCellLinks.h>
-
-#include <VISU_TypeList.hxx>
-#include <vtkVoidArray.h>
-#include <vtkBitArray.h>
-#include <vtkCharArray.h>
-#include <vtkUnsignedCharArray.h>
-#include <vtkShortArray.h>
-#include <vtkUnsignedShortArray.h>
-#include <vtkIntArray.h>
-#include <vtkUnsignedIntArray.h>
-#include <vtkLongArray.h>
-#include <vtkUnsignedLongArray.h>
-#include <vtkFloatArray.h>
-#include <vtkDoubleArray.h>
-#include <vtkIdTypeArray.h>
-
-#include <qstring.h>
-#include <qfileinfo.h>
-
-#include <valarray>
-#include <memory>
-
-using namespace std;
-using namespace VISU;
-
-static vtkFloatingPointType ERR_SIZE_CALC = 1.00;
-
-static int MYVTKDEBUG = 0;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-//#define _DEXCEPT_
-#else
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#endif
-
-namespace VISU
-{
- //---------------------------------------------------------------
- std::string
- GenerateFieldName(const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime)
- {
- const VISU::TTime& aTime = theValForTime->myTime;
- string aFieldName = theField->myMeshName + ", " + theField->myName + ": " +
- VISU_Convertor::GenerateName(aTime);
- return aFieldName;
- }
-
-
- //---------------------------------------------------------------
- /*! Computes number of points by the given number of cells
- * in assumption of regular hexahedral mesh structure
- */
- size_t
- GetNumberofPoints(size_t theNbCells)
- {
- return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
- }
-
- //---------------------------------------------------------------
- /*! Computes size dataset the given number of mesh macro metrics
- * in assumption of regular hexahedral mesh structure
- */
- size_t
- GetDataSetSize(size_t theNbOfPoints,
- size_t theNbOfCells,
- size_t theCellsSize,
- bool theComputeLinks)
- {
- size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
- size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
- size_t aLocationsSize = theNbOfCells*sizeof(int);
- vtkFloatingPointType aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
- size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
- if(!theComputeLinks)
- aLinksSize = 0;
- size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
- return aResult;
- }
-
- //---------------------------------------------------------------
- TIsVTKDone::TIsVTKDone():
- myIsVTKDone(false),
- myIsDone(false)
- {}
-
-
- //---------------------------------------------------------------
- TSizeCounter::TSizeCounter():
- myNbCells(0),
- myCellsSize(0)
- {}
-
-
- //---------------------------------------------------------------
- TSource::TSource()
- {}
-
- const TVTKSource&
- TSource
- ::GetSource() const
- {
- if(!mySource.GetPointer()){
- mySource = vtkUnstructuredGrid::New();
- mySource->Delete();
- }
- return mySource;
- }
-
- TVTKOutput*
- TSource
- ::GetVTKOutput()
- {
- return GetSource().GetPointer();
- }
-
- unsigned long int
- TSource
- ::GetMemorySize()
- {
- if(TVTKOutput* anOutput = GetVTKOutput()){
- anOutput->Update();
- return GetVTKOutput()->GetActualMemorySize() * 1024;
- }
- if(myIsDone){
- size_t aNbPoints = GetNumberofPoints(myNbCells);
- return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
- }
- throw std::runtime_error("TSource::GetMemorySize - myIsDone == false !!!");
- return 0;
- }
-
- //---------------------------------------------------------------
- unsigned long int
- TMemoryCheckIDMapper
- ::GetMemorySize()
- {
- if(myIsVTKDone){
- GetVTKOutput()->Update();
- return GetVTKOutput()->GetActualMemorySize() * 1024;
- }else
- throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
- return 0;
- }
-
-
- //---------------------------------------------------------------
- TAppendFilter::TAppendFilter()
- {}
-
- const TVTKAppendFilter&
- TAppendFilter
- ::GetFilter() const
- {
- if(!myFilter.GetPointer()){
- myFilter = VTKViewer_AppendFilter::New();
- myFilter->Delete();
- myFilter->SetDoMappingFlag(true);
- }
- return myFilter;
- }
-
- TVTKOutput*
- TAppendFilter
- ::GetVTKOutput()
- {
- GetFilter()->Update();
- return GetFilter()->GetOutput();
- }
-
- //---------------------------------------------------------------
- TMergeFilter::TMergeFilter()
- {}
-
- const TVTKMergeFilter&
- TMergeFilter
- ::GetFilter() const
- {
- if(!myFilter.GetPointer()){
- myFilter = VISU_MergeFilter::New();
- myFilter->Delete();
- }
- return myFilter;
- }
-
- TVTKOutput*
- TMergeFilter
- ::GetVTKOutput()
- {
- GetFilter()->Update();
- return GetFilter()->GetUnstructuredGridOutput();
- }
-
-
- //---------------------------------------------------------------
- void
- TCoordHolderBase
- ::Init(vtkIdType theNbPoints,
- vtkIdType theDim)
- {
- myDim = theDim;
- myNbPoints = theNbPoints;
- }
-
- vtkIdType
- TCoordHolderBase
- ::GetNbPoints() const
- {
- return myNbPoints;
- }
-
- vtkIdType
- TCoordHolderBase
- ::GetDim() const
- {
- return myDim;
- }
-
- size_t
- TCoordHolderBase
- ::size() const
- {
- return GetNbPoints() * GetDim();
- }
-
- unsigned long int
- TCoordHolderBase
- ::GetMemorySize()
- {
- return sizeof(TCoord) * size();
- }
-
-
- //---------------------------------------------------------------
- TPointCoords
- ::TPointCoords():
- myPoints(vtkPoints::New())
- {
- myPoints->SetDataType(VTK_DOUBLE);
- myPoints->Delete();
- }
-
- void
- TPointCoords
- ::Init(const PCoordHolder& theCoord)
- {
- myPoints->SetNumberOfPoints(theCoord->GetNbPoints());
- myCoord = theCoord;
- }
-
- vtkIdType
- TPointCoords
- ::GetNbPoints() const
- {
- return myCoord->GetNbPoints();
- }
-
- vtkIdType
- TPointCoords
- ::GetDim() const
- {
- return myCoord->GetDim();
- }
-
- TCCoordSlice
- TPointCoords
- ::GetCoordSlice(vtkIdType theNodeId) const
- {
- return myCoord->GetCoordSlice(theNodeId);
- }
-
- TCoordSlice
- TPointCoords
- ::GetCoordSlice(vtkIdType theNodeId)
- {
- return myCoord->GetCoordSlice(theNodeId);
- }
-
- void
- TPointCoords
- ::SetVoidArray() const
- {
- vtkDataArray* aDataArray = myPoints->GetData();
- aDataArray->SetVoidArray(myCoord->GetValuePtr(), myCoord->size(), true);
- }
-
- vtkPoints*
- TPointCoords
- ::GetPoints() const
- {
- if(!myIsVTKDone){
- TTimerLog aTimerLog(MYDEBUG,"TPointCoords::GetPoints()");
- vtkIdType aNbPoints = GetNbPoints();
- vtkIdType aDim = GetDim();
-
- INITMSG(MYDEBUG,"TPointCoords::GetPoints - aNbPoints = "<<aNbPoints<<
- "; aDim = "<<aDim<<
- endl);
-
- if(GetDim() == 3){
- INITMSG(MYDEBUG,"TPointCoords::GetPoints - SetVoidArray()"<<endl);
- SetVoidArray();
- }else{
- for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
- TCCoordSlice aSlice = GetCoordSlice(aPointId);
-
- vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
- for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
- aCoords[aDimId] = aSlice[aDimId];
-
- myPoints->SetPoint(aPointId, aCoords);
- }
- }
-
- myIsVTKDone = true;
- }
-
- return myPoints.GetPointer();
- }
-
- unsigned long int
- TPointCoords
- ::GetMemorySize()
- {
- size_t aSize = myCoord->GetMemorySize();
- aSize += myPoints->GetActualMemorySize() * 1024;
- return aSize;
- }
-
-
- //---------------------------------------------------------------
- void
- TNamedPointCoords
- ::Init(const PCoordHolder& theCoord)
- {
- TPointCoords::Init(theCoord);
- myPointsDim.resize(theCoord->GetDim());
- }
-
- std::string&
- TNamedPointCoords
- ::GetName(vtkIdType theDim)
- {
- return myPointsDim[theDim];
- }
-
- const std::string&
- TNamedPointCoords
- ::GetName(vtkIdType theDim) const
- {
- return myPointsDim[theDim];
- }
-
- vtkIdType
- TNamedPointCoords
- ::GetObjID(vtkIdType theID) const
- {
- return theID;
- }
-
- vtkIdType
- TNamedPointCoords
- ::GetVTKID(vtkIdType theID) const
- {
- return theID;
- }
-
- std::string
- TNamedPointCoords
- ::GetNodeName(vtkIdType theObjID) const
- {
- return "";
- }
-
-
- //---------------------------------------------------------------
- enum ECoordName{eX, eY, eZ, eNoneCoord};
- typedef VISU::TCoord (*TGetCoord)(const VISU::TCCoordSlice& theCoordSlice);
-
- template<ECoordName TCoordId>
- VISU::TCoord
- GetCoord(const VISU::TCCoordSlice& theCoordSlice)
- {
- return theCoordSlice[TCoordId];
- }
-
- template<>
- VISU::TCoord
- GetCoord<eNoneCoord>(const VISU::TCCoordSlice& theCoordSlice)
- {
- return 0.0;
- }
-
-
- TGetCoord aXYZGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eY>,
- &GetCoord<eZ>
- };
-
-
- TGetCoord aXYGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eY>,
- &GetCoord<eNoneCoord>
- };
-
- TGetCoord aYZGetCoord[3] = {
- &GetCoord<eNoneCoord>,
- &GetCoord<eX>,
- &GetCoord<eY>
- };
-
- TGetCoord aXZGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eNoneCoord>,
- &GetCoord<eY>
- };
-
-
- TGetCoord aXGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eNoneCoord>,
- &GetCoord<eNoneCoord>
- };
-
- TGetCoord aYGetCoord[3] = {
- &GetCoord<eNoneCoord>,
- &GetCoord<eX>,
- &GetCoord<eNoneCoord>
- };
-
- TGetCoord aZGetCoord[3] = {
- &GetCoord<eNoneCoord>,
- &GetCoord<eNoneCoord>,
- &GetCoord<eX>
- };
-
-
- class TCoordHelper{
- TGetCoord* myGetCoord;
- public:
- TCoordHelper(TGetCoord* theGetCoord):
- myGetCoord(theGetCoord)
- {}
-
- virtual
- ~TCoordHelper()
- {}
-
- VISU::TCoord
- GetCoord(VISU::TCCoordSlice& theCoordSlice,
- int theCoordId)
- {
- return (*myGetCoord[theCoordId])(theCoordSlice);
- }
- };
- typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
-
-
- //---------------------------------------------------------------
- vtkPoints*
- TNamedPointCoords
- ::GetPoints() const
- {
- if(!myIsVTKDone){
- TTimerLog aTimerLog(MYDEBUG,"TNamedPointCoords::GetPoints()");
- TCoordHelperPtr aCoordHelperPtr;
- bool anIsDimPresent[3] = {false, false, false};
- for(int iDim = 0; iDim < GetDim(); iDim++){
- std::string aName = GetName(iDim);
- if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16
- aName = aName.substr(0,1);
- if(aName == "x" || aName == "X")
- anIsDimPresent[eX] = true;
- else if(aName == "y" || aName == "Y")
- anIsDimPresent[eY] = true;
- else if(aName == "z" || aName == "Z")
- anIsDimPresent[eZ] = true;
- }
-
- switch(GetDim()){
- case 3:
- aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
- break;
- case 2:
- if(anIsDimPresent[eY] && anIsDimPresent[eZ])
- aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
- else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
- aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
- else
- aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
- break;
- case 1:
- if(anIsDimPresent[eY])
- aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
- else if(anIsDimPresent[eZ])
- aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
- else
- aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
- break;
- }
-
- INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - aNbPoints = "<<GetNbPoints()<<
- "; aDim = "<<GetDim()<<
- endl);
-
- if(anIsDimPresent[eX] && anIsDimPresent[eY] && anIsDimPresent[eZ]){
- INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - SetVoidArray()"<<endl);
- SetVoidArray();
- }else{
- for(vtkIdType aNodeId = 0; aNodeId < GetNbPoints(); aNodeId++){
- TCCoordSlice aCoordSlice = GetCoordSlice(aNodeId);
- myPoints->SetPoint(aNodeId,
- aCoordHelperPtr->GetCoord(aCoordSlice,eX),
- aCoordHelperPtr->GetCoord(aCoordSlice,eY),
- aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
- }
- }
-
- myIsVTKDone = true;
- }
-
- return myPoints.GetPointer();
- }
-
- unsigned long int
- TNamedPointCoords
- ::GetMemorySize()
- {
- return TPointCoords::GetMemorySize();
- }
-
-
- //---------------------------------------------------------------
- vtkIdType
- TMeshImpl::
- GetNbPoints() const
- {
- return myNbPoints;
- }
-
- vtkIdType
- TMeshImpl::
- GetDim() const
- {
- return myDim;
- }
-
- vtkPoints*
- TMeshImpl::
- GetPoints()
- {
- return myNamedPointCoords->GetPoints();
- }
-
-
- //---------------------------------------------------------------
- TSubProfileImpl::TSubProfileImpl():
- myStatus(eNone),
- myGeom(eNONE)
- {}
-
-
- vtkIdType
- TSubProfileImpl
- ::GetElemObjID(vtkIdType theID) const
- {
- return theID;
- }
-
- unsigned long int
- TSubProfileImpl
- ::GetMemorySize()
- {
- size_t aSize = TSource::GetMemorySize();
- aSize += sizeof(vtkIdType) * mySubMeshID.size();
- return aSize;
- }
-
-
- //---------------------------------------------------------------
- bool
- operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
- {
- PSubProfileImpl aLeft(theLeft), aRight(theRight);
-
- if(aLeft->myGeom != aRight->myGeom)
- return aLeft->myGeom < aRight->myGeom;
-
- if(aLeft->myStatus != aRight->myStatus)
- return aLeft->myStatus < aRight->myStatus;
-
- return aLeft->myName < aRight->myName;
- }
-
-
- //---------------------------------------------------------------
- TProfileImpl::TProfileImpl():
- myIsAll(true),
- myMeshOnEntity(NULL)
- {}
-
- vtkIdType
- TProfileImpl
- ::GetNodeObjID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetObjID(theID);
- }
-
- vtkIdType
- TProfileImpl
- ::GetNodeVTKID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetVTKID(theID);
- }
-
- vtkFloatingPointType*
- TProfileImpl
- ::GetNodeCoord(vtkIdType theObjID)
- {
- if(myIsAll)
- return myMeshOnEntity->GetNodeCoord(theObjID);
-
- vtkIdType aVtkID = GetNodeVTKID(theObjID);
- return GetFilter()->GetOutput()->GetPoint(aVtkID);
- }
-
- vtkIdType
- TProfileImpl
- ::GetElemObjID(vtkIdType theID) const
- {
- if(myIsAll)
- return myMeshOnEntity->GetElemObjID(theID);
-
- vtkIdType anInputID, aStartID, anInputDataSetID;
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- anAppendFilter->GetCellInputID(theID,anInputID,aStartID,anInputDataSetID);
- PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
- return aSubProfileImpl->GetElemObjID(anInputID);
- }
-
- vtkIdType
- TProfileImpl
- ::GetElemVTKID(vtkIdType theID) const
- {
- if(myIsAll)
- return myMeshOnEntity->GetElemVTKID(theID);
-
- if(myElemObj2VTKID.empty())
- return theID;
- else{
- TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
- if(anIter != myElemObj2VTKID.end())
- return anIter->second;
- }
- return -1;
- }
-
- vtkCell*
- TProfileImpl
- ::GetElemCell(vtkIdType theObjID)
- {
- if(myIsAll)
- return myMeshOnEntity->GetElemCell(theObjID);
-
- vtkIdType aVtkID = GetElemVTKID(theObjID);
- return GetFilter()->GetOutput()->GetCell(aVtkID);
- }
-
- TVTKOutput*
- TProfileImpl
- ::GetVTKOutput()
- {
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- return anAppendFilter->GetOutput();
- }
-
- unsigned long int
- TProfileImpl
- ::GetMemorySize()
- {
- size_t aSize = TAppendFilter::GetMemorySize();
- aSize += myNamedPointCoords->GetMemorySize();
- aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
- TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
- TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
- for(; anIter != anIterEnd; anIter++){
- const PSubProfileImpl& aSubProfile = anIter->second;
- aSize += aSubProfile->GetMemorySize();
- aSize += sizeof(EGeometry);
- }
- return aSize;
- }
-
- std::string
- TProfileImpl
- ::GetNodeName(vtkIdType theObjID) const
- {
- return myNamedPointCoords->GetNodeName(theObjID);
- }
-
- std::string
- TProfileImpl
- ::GetElemName(vtkIdType theObjID) const
- {
- if(myIsAll)
- return myMeshOnEntity->GetElemName(theObjID);
-
- vtkIdType aVTKId = GetElemVTKID(theObjID);
- vtkIdType anInputID, aStartID, anInputDataSetID;
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartID,anInputDataSetID);
- PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
- vtkIdType anEntityObjId = aSubProfileImpl->GetElemObjID(anInputID);
- return myMeshOnEntity->GetElemName(anEntityObjId);
- }
-
-
- //---------------------------------------------------------------
- TVTKOutput*
- TIDMapperFilter
- ::GetVTKOutput()
- {
- if(!myFilter.GetPointer()){
- const TVTKAppendFilter& anAppendFilter = myIDMapper->GetFilter();
- TVTKOutput* aGeometry = anAppendFilter->GetOutput();
-
- const TVTKSource& aSource = mySource.GetSource();
- TDataSet* aDataSet = aSource.GetPointer();
- aDataSet->ShallowCopy(aGeometry);
-
- const TVTKMergeFilter& aFilter = GetFilter();
- aFilter->SetGeometry(aGeometry);
- aFilter->SetScalars(aDataSet);
- aFilter->SetVectors(aDataSet);
- aFilter->AddField("VISU_FIELD",aDataSet);
- }
- return myFilter->GetUnstructuredGridOutput();
- }
-
- unsigned long int
- TIDMapperFilter
- ::GetMemorySize()
- {
- size_t aSize = myIDMapper->GetMemorySize();
- aSize += mySource.GetMemorySize();
- return aSize;
- }
-
- vtkIdType
- TIDMapperFilter
- ::GetNodeObjID(vtkIdType theID) const
- {
- return myIDMapper->GetNodeObjID(theID);
- }
-
- vtkIdType
- TIDMapperFilter
- ::GetNodeVTKID(vtkIdType theID) const
- {
- return myIDMapper->GetNodeVTKID(theID);
- }
-
- vtkFloatingPointType*
- TIDMapperFilter
- ::GetNodeCoord(vtkIdType theObjID)
- {
- return myIDMapper->GetNodeCoord(theObjID);
- }
-
- vtkIdType
- TIDMapperFilter
- ::GetElemObjID(vtkIdType theID) const
- {
- return myIDMapper->GetElemObjID(theID);
- }
-
- vtkIdType
- TIDMapperFilter
- ::GetElemVTKID(vtkIdType theID) const
- {
- return myIDMapper->GetElemVTKID(theID);
- }
-
- vtkCell*
- TIDMapperFilter
- ::GetElemCell(vtkIdType theObjID)
- {
- return myIDMapper->GetElemCell(theObjID);
- }
-
-
- //---------------------------------------------------------------
- void
- TGaussImpl
- ::LessThan(const PGaussImpl& theGauss,
- bool& theResult) const
- {
- theResult = false;
- }
-
-
- //---------------------------------------------------------------
- TGaussSubMeshImpl::TGaussSubMeshImpl():
- myStatus(eNone)
- {}
-
- TGaussPointID
- TGaussSubMeshImpl
- ::GetObjID(vtkIdType theID,
- vtkIdType theStartID) const
- {
- TCellID aCellID = theStartID + theID / myGauss->myNbPoints;
- TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
-
- return TGaussPointID(aCellID,aLocalPntID);
- }
-
- unsigned long int
- TGaussSubMeshImpl
- ::GetMemorySize()
- {
- size_t aSize = TSource::GetMemorySize();
- aSize += myPointCoords.GetMemorySize();
- return aSize;
- }
-
- //---------------------------------------------------------------
- bool
- operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
- {
- PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
- const PGaussImpl& aGaussLeft = aLeft->myGauss;
- const PGaussImpl& aGaussRight = aRight->myGauss;
-
- if(aGaussLeft->myGeom != aGaussRight->myGeom)
- return aGaussLeft->myGeom < aGaussRight->myGeom;
-
- if(aLeft->mySubProfile != aRight->mySubProfile)
- return aLeft->mySubProfile < aRight->mySubProfile;
-
- bool aResult;
- aGaussLeft->LessThan(aGaussRight,aResult);
-
- return aResult;
- }
-
-
- //---------------------------------------------------------------
- TGaussMeshImpl
- ::TGaussMeshImpl():
- myParent(NULL)
- {}
-
- TGaussPointID
- TGaussMeshImpl
- ::GetObjID(vtkIdType theID) const
- {
- vtkIdType anInputID, aStartId, anInputDataSetID;
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
- const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anInputDataSetID];
-
- return aSubMeshImpl.GetObjID(anInputID,aStartId);
- }
-
- TVTKOutput*
- TGaussMeshImpl
- ::GetVTKOutput()
- {
- return mySource.GetVTKOutput();
- }
-
- unsigned long int
- TGaussMeshImpl
- ::GetMemorySize()
- {
- size_t aSize = TAppendFilter::GetMemorySize();
- aSize += mySource.GetMemorySize();
- TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
- TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
- for(; anIter != anIterEnd; anIter++){
- const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
- aSize += aGaussSubMesh->GetMemorySize();
- aSize += sizeof(EGeometry);
- }
- return aSize;
- }
-
- TNamedIDMapper*
- TGaussMeshImpl::
- GetParent()
- {
- return myParent;
- }
-
-
- //---------------------------------------------------------------
- TGaussPointID
- TGaussPtsIDFilter
- ::GetObjID(vtkIdType theID) const
- {
- return myGaussPtsIDMapper->GetObjID(theID);
- }
-
- TNamedIDMapper*
- TGaussPtsIDFilter::
- GetParent()
- {
- return myGaussPtsIDMapper->GetParent();
- }
-
-
- //---------------------------------------------------------------
- vtkIdType
- TSubMeshImpl
- ::GetElemObjID(vtkIdType theID) const
- {
- return myStartID + theID;
- }
-
- std::string
- TSubMeshImpl
- ::GetElemName(vtkIdType theObjID) const
- {
- return "";
- }
-
- unsigned long int
- TSubMeshImpl
- ::GetMemorySize()
- {
- size_t aSize = TSource::GetMemorySize();
- for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
- const TConnect& aConnect = myCell2Connect[anId];
- aSize += aConnect.size() * sizeof(vtkIdType);
- }
- return aSize;
- }
-
- //---------------------------------------------------------------
- vtkIdType
- TMeshOnEntityImpl
- ::GetNodeVTKID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetVTKID(theID);
- }
-
- vtkIdType
- TMeshOnEntityImpl
- ::GetNodeObjID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetObjID(theID);
- }
-
- vtkIdType
- TMeshOnEntityImpl
- ::GetElemVTKID(vtkIdType theID) const
- {
- if(myElemObj2VTKID.empty())
- return theID;
- else{
- TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
- if(anIter != myElemObj2VTKID.end())
- return anIter->second;
- }
- return -1;
- }
-
- vtkIdType
- TMeshOnEntityImpl
- ::GetElemObjID(vtkIdType theID) const
- {
- vtkIdType anInputID, aStartId, anInputDataSetID;
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
- const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
- return aSubMesh->GetElemObjID(anInputID);
- }
-
- std::string
- TMeshOnEntityImpl
- ::GetNodeName(vtkIdType theObjID) const
- {
- return myNamedPointCoords->GetNodeName(theObjID);
- }
-
- std::string
- TMeshOnEntityImpl
- ::GetElemName(vtkIdType theObjID) const
- {
- vtkIdType aVTKId = GetElemVTKID(theObjID);
- vtkIdType anInputID, aStartId, anInputDataSetID;
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartId,anInputDataSetID);
- const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
- return aSubMesh->GetElemName(anInputID);
- }
-
- unsigned long int
- TMeshOnEntityImpl
- ::GetMemorySize()
- {
- size_t aSize = TAppendFilter::GetMemorySize();
- aSize += myNamedPointCoords->GetMemorySize();
- aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
- TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
- TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
- for(; anIter != anIterEnd; anIter++){
- const PSubMeshImpl& aSubMesh = anIter->second;
- aSize += aSubMesh->GetMemorySize();
- aSize += sizeof(EGeometry);
- }
- return aSize;
- }
-
- //---------------------------------------------------------------
- vtkIdType
- TFamilyImpl
- ::GetElemVTKID(vtkIdType theID) const
- {
- if(myElemObj2VTKID.empty())
- return theID;
- else{
- TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
- if(anIter != myElemObj2VTKID.end())
- return anIter->second;
- }
- return -1;
- }
-
- vtkIdType
- TFamilyImpl
- ::GetElemObjID(vtkIdType theID) const
- {
- return myMeshID[theID];
- }
-
- vtkIdType
- TFamilyImpl
- ::GetNodeObjID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetObjID(theID);
- }
-
- vtkIdType
- TFamilyImpl
- ::GetNodeVTKID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetVTKID(theID);
- }
-
- TVTKOutput*
- TFamilyImpl
- ::GetVTKOutput()
- {
- return TSource::GetVTKOutput();
- }
-
- unsigned long int
- TFamilyImpl
- ::GetMemorySize()
- {
- size_t aSize = TSource::GetMemorySize();
- aSize += myNamedPointCoords->GetMemorySize();
- aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
- aSize += myMeshID.size() * sizeof(vtkIdType);
- TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
- TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
- for(; anIter != anIterEnd; anIter++){
- const TSubMeshID& aSubMeshID = anIter->second;
- aSize += aSubMeshID.size() * sizeof(vtkIdType);
- aSize += sizeof(EGeometry);
- }
- return aSize;
- }
-
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
- //---------------------------------------------------------------
- TNbASizeCells
- TGroupImpl
- ::GetNbASizeCells() const
- {
- vtkIdType aNbCells = 0, aCellsSize = 0;
- TFamilySet::const_iterator anIter = myFamilySet.begin();
- for(; anIter != myFamilySet.end(); anIter++){
- PFamilyImpl aFamily = *anIter;
- aNbCells += aFamily->myNbCells;
- aCellsSize += aFamily->myCellsSize;
- }
- return make_pair(aNbCells,aCellsSize);
- }
-
- vtkIdType
- TGroupImpl
- ::GetElemVTKID(vtkIdType theID) const
- {
- if(myElemObj2VTKID.empty())
- return theID;
- else{
- TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
- if(anIter != myElemObj2VTKID.end())
- return anIter->second;
- }
- return -1;
- }
-
- vtkIdType
- TGroupImpl
- ::GetElemObjID(vtkIdType theID) const
- {
- vtkIdType anInputID, aStartId, anInputDataSetID;
- const TVTKAppendFilter& anAppendFilter = GetFilter();
- anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
- const PFamilyImpl& aFamily = myFamilyArr[anInputDataSetID];
- return aFamily->GetElemObjID(anInputID);
- }
-
- vtkIdType
- TGroupImpl
- ::GetNodeObjID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetObjID(theID);
- }
-
- vtkIdType
- TGroupImpl
- ::GetNodeVTKID(vtkIdType theID) const
- {
- return myNamedPointCoords->GetVTKID(theID);
- }
-
- unsigned long int
- TGroupImpl
- ::GetMemorySize()
- {
- size_t aSize = TAppendFilter::GetMemorySize();
- aSize += myNamedPointCoords->GetMemorySize();
- aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
- for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
- const PFamilyImpl& aFamily = myFamilyArr[anId];
- aSize += aFamily->GetMemorySize();
- }
- return aSize;
- }
-
-
-
- //---------------------------------------------------------------
- TFieldImpl
- ::TFieldImpl():
- myDataSize(0),
- myDataType(0)
- {}
-
- void
- TFieldImpl
- ::Init(vtkIdType theNbComp,
- vtkIdType theDataType)
- {
- myNbComp = theNbComp;
- myDataType = theDataType;
- myCompNames.resize(theNbComp);
- myUnitNames.resize(theNbComp);
- myMinMaxArr.resize(theNbComp + 1);
- for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
- TMinMax& aMinMax = myMinMaxArr[iComp];
- aMinMax.first = VTK_LARGE_FLOAT;
- aMinMax.second = -VTK_LARGE_FLOAT;
- }
- }
-
- vtkIdType
- TFieldImpl
- ::GetDataType() const
- {
- return myDataType;
- }
-
- TMinMax
- TFieldImpl
- ::GetMinMax(vtkIdType theCompID)
- {
- return myMinMaxArr[theCompID];
- }
-
-
- //---------------------------------------------------------------
- void
- TMeshValueBase
- ::Init(vtkIdType theNbElem,
- vtkIdType theNbGauss,
- vtkIdType theNbComp)
- {
- myNbElem = theNbElem;
- myNbGauss = theNbGauss;
- myNbComp = theNbComp;
- myStep = theNbComp*theNbGauss;
- }
-
- vtkIdType
- TMeshValueBase
- ::GetNbElem() const
- {
- return myNbElem;
- }
-
- vtkIdType
- TMeshValueBase
- ::GetNbComp() const
- {
- return myNbComp;
- }
-
- vtkIdType
- TMeshValueBase
- ::GetNbGauss() const
- {
- return myNbGauss;
- }
-
- size_t
- TMeshValueBase
- ::size() const
- {
- return myNbElem * myStep;
- }
-
-
- //----------------------------------------------------------------------------
- const PMeshValue&
- TGeom2Value
- ::GetMeshValue(EGeometry theGeom) const
- {
- TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
- if(anIter == myGeom2MeshValue.end())
- EXCEPTION(runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
- return anIter->second;
- }
-
- PMeshValue&
- TGeom2Value
- ::GetMeshValue(EGeometry theGeom)
- {
- return myGeom2MeshValue[theGeom];
- }
-
-
- //----------------------------------------------------------------------------
- TGeom2MeshValue&
- TGeom2Value
- ::GetGeom2MeshValue()
- {
- return myGeom2MeshValue;
- }
-
- const TGeom2MeshValue&
- TGeom2Value
- ::GetGeom2MeshValue() const
- {
- return myGeom2MeshValue;
- }
-
- PMeshValue
- TGeom2Value
- ::GetFirstMeshValue() const
- {
- if(myGeom2MeshValue.size() == 1)
- return myGeom2MeshValue.begin()->second;
- return PMeshValue();
- }
-
- namespace TL
- {
- //----------------------------------------------------------------------------
- typedef TList<void,
- TList<bool,
- TList<char,
- TList<unsigned char,
- TList<short,
- TList<unsigned short,
- TList<int,
- TList<unsigned int,
- TList<long,
- TList<unsigned long,
- TList<float,
- TList<double,
- TList<vtkIdType,
- TNullType> > > > > > > > > > > > >
- TVTKBasicTypeList;
-
-
- //----------------------------------------------------------------------------
- typedef TList<vtkVoidArray,
- TList<vtkBitArray,
- TList<vtkCharArray,
- TList<vtkUnsignedCharArray,
- TList<vtkShortArray,
- TList<vtkUnsignedShortArray,
- TList<vtkIntArray,
- TList<vtkUnsignedIntArray,
- TList<vtkLongArray,
- TList<vtkUnsignedLongArray,
- TList<vtkFloatArray,
- TList<vtkDoubleArray,
- TList<vtkIdTypeArray,
- TNullType> > > > > > > > > > > > >
- TVTKArrayTypeList;
-
-
- typedef TList<TInt2Type<VTK_VOID>,
- TList<TInt2Type<VTK_BIT>,
- TList<TInt2Type<VTK_CHAR>,
- TList<TInt2Type<VTK_UNSIGNED_CHAR>,
- TList<TInt2Type<VTK_SHORT>,
- TList<TInt2Type<VTK_UNSIGNED_SHORT>,
- TList<TInt2Type<VTK_INT>,
- TList<TInt2Type<VTK_UNSIGNED_INT>,
- TList<TInt2Type<VTK_LONG>,
- TList<TInt2Type<VTK_UNSIGNED_LONG>,
- TList<TInt2Type<VTK_FLOAT>,
- TList<TInt2Type<VTK_DOUBLE>,
- TList<TInt2Type<VTK_ID_TYPE>,
- TNullType> > > > > > > > > > > > >
- TVTKBasicEnumList;
-
-
- //----------------------------------------------------------------------------
- template <unsigned int type_enum>
- struct TEnum2VTKBasicType
- {
- typedef typename TTypeAt<TVTKBasicTypeList, TIndexOf<TVTKBasicEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
- };
-
- //----------------------------------------------------------------------------
- template <unsigned int type_enum>
- struct TEnum2VTKArrayType
- {
- typedef typename TTypeAt<TVTKArrayTypeList, TIndexOf<TVTKBasicEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
- };
-
- //----------------------------------------------------------------------------
- template <class T>
- struct TVTKBasicType2Enum
- {
- typedef typename TTypeAt<TVTKBasicEnumList, TIndexOf<TVTKBasicTypeList, T>::value >::TResult TResult;
- };
-
- }
-
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- void
- InitTimeStampOnProfile(const TVTKSource& theSource,
- const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime,
- const VISU::TEntity& theEntity);
-
-
- //----------------------------------------------------------------------------
- void
- GetTimeStampOnProfile(const TVTKSource& theSource,
- const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime,
- const VISU::TEntity& theEntity)
- {
- vtkIdType aDataType = theField->GetDataType();
- switch(aDataType){
- case VTK_DOUBLE:
- InitTimeStampOnProfile<VTK_DOUBLE>(theSource, theField, theValForTime, theEntity);
- break;
- case VTK_FLOAT:
- InitTimeStampOnProfile<VTK_FLOAT>(theSource, theField, theValForTime, theEntity);
- break;
- case VTK_INT:
- InitTimeStampOnProfile<VTK_INT>(theSource, theField, theValForTime, theEntity);
- break;
- case VTK_LONG:
- InitTimeStampOnProfile<VTK_LONG>(theSource, theField, theValForTime, theEntity);
- break;
- default:
- EXCEPTION(runtime_error,
- "GetTimeStampOnProfile - handling unsupported data type - "<<aDataType);
- }
- }
-
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- struct TDataArrayHolder
- {
- typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
- typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
- TVTKDataArray* myDataArray;
-
- TDataArrayHolder(TVTKDataArray* theDataArray):
- myDataArray(theDataArray)
- {}
-
- void
- WritePointer(TVTKDataArray* theDataArray,
- vtkIdType theTupleId,
- TVTKBasicType* thePointer)
- {
- vtkIdType aNumberOfComponents = theDataArray->GetNumberOfComponents();
- vtkIdType aPosition = theTupleId * aNumberOfComponents;
- TVTKBasicType *aPtr = theDataArray->WritePointer(aPosition, aNumberOfComponents);
- for(vtkIdType anId = 0; anId < aNumberOfComponents; anId++)
- *aPtr++ = *thePointer++;
- }
-
- virtual
- void
- SetTuple(vtkIdType theTupleId,
- TVTKBasicType* thePointer)
- {
- this->WritePointer(myDataArray, theTupleId, thePointer);
- }
- };
-
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- struct TDataArrayHolder2: TDataArrayHolder<EDataType>
- {
- typedef TDataArrayHolder<EDataType> TSuperClass;
- typedef typename TSuperClass::TVTKDataArray TVTKDataArray;
- typedef typename TSuperClass::TVTKBasicType TVTKBasicType;
- TVTKDataArray* myDataArray2;
-
- TDataArrayHolder2(TVTKDataArray* theDataArray,
- TVTKDataArray* theDataArray2):
- TSuperClass(theDataArray),
- myDataArray2(theDataArray2)
- {}
-
- virtual
- void
- SetTuple(vtkIdType theTupleId,
- TVTKBasicType* thePointer)
- {
- this->WritePointer(this->myDataArray, theTupleId, thePointer);
- this->WritePointer(this->myDataArray2, theTupleId, thePointer);
- }
- };
-
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- struct TTimeStampOnProfileInitArray
- {
- typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
- typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
- typedef TTMeshValue<TVTKBasicType> TMeshValue;
- typedef SharedPtr<TMeshValue> TMeshValuePtr;
-
- typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
- typedef SharedPtr<TTDataArrayHolder> PDataArrayHolder;
- PDataArrayHolder myDataArrayHolder;
-
- TTimeStampOnProfileInitArray(const PDataArrayHolder& theDataArrayHolder):
- myDataArrayHolder(theDataArrayHolder)
- {}
-
- void
- Execute(const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime)
- {
- vtkIdType aNbComp = theField->myNbComp;
- vtkIdType aSize = max(3, aNbComp);
- TVector<TVTKBasicType> aDataValues(aSize);
-
- const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
- TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
- for(int aTupleId = 0; anIter != aGeom2MeshValue.end(); anIter++){
- EGeometry aEGeom = anIter->first;
- const TMeshValuePtr aMeshValue = anIter->second;
-
- vtkIdType aNbElem = aMeshValue->GetNbElem();
- vtkIdType aNbGauss = aMeshValue->GetNbGauss();
-
- INITMSG(MYDEBUG,
- "- aEGeom = "<<aEGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbGauss = "<<aNbGauss<<
- endl);
-
- for(vtkIdType iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
- typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetCompValueSliceArr(iElem);
- for(vtkIdType iComp = 0; iComp < aNbComp; iComp++){
- const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
- aDataValues[iComp] = TVTKBasicType();
- for(vtkIdType iGauss = 0; iGauss < aNbGauss; iGauss++){
- aDataValues[iComp] += aValueSlice[iGauss];
- }
- aDataValues[iComp] /= aNbGauss;
- }
- this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
- }
- }
- }
- };
-
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- void
- InitTimeStampOnProfile(const TVTKSource& theSource,
- const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime,
- const VISU::TEntity& theEntity)
- {
- vtkIdType aNbTuples = theField->myDataSize / theField->myNbComp;
- std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
-
- vtkDataSetAttributes* aDataSetAttributes;
- switch(theEntity){
- case VISU::NODE_ENTITY :
- aDataSetAttributes = theSource->GetPointData();
- break;
- default:
- aDataSetAttributes = theSource->GetCellData();
- }
-
- typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
- TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
- vtkIdType aNbComp = theField->myNbComp;
- switch(aNbComp) {
- case 1:
- aSelectedDataArray->SetNumberOfComponents(1);
- aDataSetAttributes->SetScalars(aSelectedDataArray);
- break;
- default:
- aSelectedDataArray->SetNumberOfComponents(3);
- aDataSetAttributes->SetVectors(aSelectedDataArray);
- }
- aSelectedDataArray->SetNumberOfTuples(aNbTuples);
- aSelectedDataArray->SetName(aFieldName.c_str());
-
- TVTKDataArray *aFullDataArray = TVTKDataArray::New();
- aFullDataArray->SetNumberOfComponents(aNbComp);
- aFullDataArray->SetNumberOfTuples(aNbTuples);
- aFullDataArray->SetName("VISU_FIELD");
- aDataSetAttributes->AddArray(aFullDataArray);
-
- INITMSG(MYDEBUG,"InitTimeStampOnProfile "<<
- "- theEntity = "<<theEntity<<
- "; aNbTuples = "<<aNbTuples<<
- "; aNbComp = "<<aNbComp<<
- endl);
- TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnProfile");
-
- const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
- typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
- typedef TTMeshValue<TVTKBasicType> TMeshValue;
- typedef SharedPtr<TMeshValue> TMeshValuePtr;
-
- typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
- typedef SharedPtr<TTDataArrayHolder> PDataArrayHolder;
-
- TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
- if(aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1){
- aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
- aMeshValue->size(),
- true);
- INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<<endl);
- if(aNbComp == 1){
- aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
- aMeshValue->size(),
- true);
- INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<<endl);
- }else{
- PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
- TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
- }
- }else{
- typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
- PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
- TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
- }
-
- aSelectedDataArray->Delete();
- aFullDataArray->Delete();
- }
-
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- void
- InitTimeStampOnGaussMesh(const TVTKSource& theSource,
- const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime);
-
- void
- GetTimeStampOnGaussMesh(const TVTKSource& theSource,
- const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime)
- {
- vtkIdType aDataType = theField->GetDataType();
- switch(aDataType){
- case VTK_DOUBLE:
- InitTimeStampOnGaussMesh<VTK_DOUBLE>(theSource, theField, theValForTime);
- break;
- case VTK_FLOAT:
- InitTimeStampOnGaussMesh<VTK_FLOAT>(theSource, theField, theValForTime);
- break;
- case VTK_INT:
- InitTimeStampOnGaussMesh<VTK_INT>(theSource, theField, theValForTime);
- break;
- case VTK_LONG:
- InitTimeStampOnGaussMesh<VTK_LONG>(theSource, theField, theValForTime);
- break;
- default:
- EXCEPTION(runtime_error,
- "GetTimeStampOnGaussMesh - handling unsupported data type - "<<aDataType);
- }
- }
-
- //----------------------------------------------------------------------------
- template<int EDataType>
- struct TTimeStampOnGaussMeshInitArray
- {
- typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
- typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
- typedef TTMeshValue<TVTKBasicType> TMeshValue;
- typedef SharedPtr<TMeshValue> TMeshValuePtr;
-
- typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
- typedef SharedPtr<TTDataArrayHolder> PDataArrayHolder;
- PDataArrayHolder myDataArrayHolder;
-
- TTimeStampOnGaussMeshInitArray(const PDataArrayHolder& theDataArrayHolder):
- myDataArrayHolder(theDataArrayHolder)
- {}
-
- void
- Execute(const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime)
- {
- vtkIdType aNbComp = theField->myNbComp;
- vtkIdType aSize = max(3, aNbComp);
- TVector<TVTKBasicType> aDataValues(aSize);
-
- const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
-
- PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh;
- const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
- TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
- for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
- EGeometry aEGeom = anIter->first;
-
- PGaussSubMeshImpl aGaussSubMesh = anIter->second;
- if(!aGaussSubMesh->myIsDone)
- continue;
-
- TGeom2MeshValue::const_iterator anIter2 = aGeom2MeshValue.find(aEGeom);
- if(anIter2 == aGeom2MeshValue.end()){
- EXCEPTION(runtime_error,
- "TTimeStampOnGaussMeshInitArray >> Can't find values for corresponding Gauss Points SubMesh");
- }
- TMeshValuePtr aMeshValue = anIter2->second;
- vtkIdType aNbGauss = aMeshValue->GetNbGauss();
- vtkIdType aNbElem = aMeshValue->GetNbElem();
-
- if(aNbGauss < 1)
- continue;
-
- const TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
-
- INITMSG(MYDEBUG,
- "- aEGeom = "<<aEGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbGauss = "<<aNbGauss<<
- "; aCoords.GetNbPoints() = "<<aCoords.GetNbPoints()<<
- endl);
-
- if(aCoords.GetNbPoints() == aNbElem*aNbGauss){
- for(int iElem = 0; iElem < aNbElem; iElem++){
- typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetGaussValueSliceArr(iElem);
- for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
- const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
- for(int iComp = 0; iComp < aNbComp; iComp++){
- aDataValues[iComp] = aValueSlice[iComp];
- }
- this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
- }
- }
- }else{
- for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
- typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetCompValueSliceArr(iElem);
- for(int iComp = 0; iComp < aNbComp; iComp++){
- const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
- aDataValues[iComp] = TVTKBasicType();
- for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
- aDataValues[iComp] += aValueSlice[iGauss];
- }
- aDataValues[iComp] /= aNbGauss;
- }
- this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
- }
- }
- }
- }
- };
-
-
- template<int EDataType>
- void
- InitTimeStampOnGaussMesh(const TVTKSource& theSource,
- const PFieldImpl& theField,
- const PValForTimeImpl& theValForTime)
- {
- vtkIdType aNbTuples = theSource->GetNumberOfPoints();
- std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
-
- vtkDataSetAttributes* aDataSetAttributes = theSource->GetPointData();
-
- typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
- TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
- vtkIdType aNbComp = theField->myNbComp;
- switch(aNbComp){
- case 1:
- aSelectedDataArray->SetNumberOfComponents(1);
- aDataSetAttributes->SetScalars(aSelectedDataArray);
- break;
- default:
- aSelectedDataArray->SetNumberOfComponents(3);
- aDataSetAttributes->SetVectors(aSelectedDataArray);
- }
- aSelectedDataArray->SetNumberOfTuples(aNbTuples);
- aSelectedDataArray->SetName(aFieldName.c_str());
-
- TVTKDataArray *aFullDataArray = TVTKDataArray::New();
- aFullDataArray->SetNumberOfComponents(aNbComp);
- aFullDataArray->SetNumberOfTuples(aNbTuples);
- aFullDataArray->SetName("VISU_FIELD");
- aDataSetAttributes->AddArray(aFullDataArray);
-
- INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh "<<
- "- aNbTuples = "<<aNbTuples<<
- "; aNbComp = "<<aNbComp<<
- endl);
- TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnGaussMesh");
-
- const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
- typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
- typedef TTMeshValue<TVTKBasicType> TMeshValue;
- typedef SharedPtr<TMeshValue> TMeshValuePtr;
-
- typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
- typedef SharedPtr<TTDataArrayHolder> PDataArrayHolder;
-
- TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
- if(aGeom2MeshValue.size() == 1){
- aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
- aMeshValue->size(),
- true);
- INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aFullDataArray->SetVoidArray()"<<endl);
- if(aNbComp == 1){
- aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
- aMeshValue->size(),
- true);
- INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aSelectedDataArray->SetVoidArray()"<<endl);
- }else{
- PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
- TTimeStampOnGaussMeshInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
- }
- }else{
- typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
- PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
- TTimeStampOnGaussMeshInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
- }
-
- aSelectedDataArray->Delete();
- aFullDataArray->Delete();
- }
-
- //---------------------------------------------------------------
- TValForTimeImpl
- ::TValForTimeImpl():
- myGaussPtsIDFilter(new TGaussPtsIDFilter()),
- myIDMapperFilter(new TIDMapperFilter())
- {}
-
- const PMeshValue&
- TValForTimeImpl
- ::GetMeshValue(EGeometry theGeom) const
- {
- return myGeom2Value.GetMeshValue(theGeom);
- }
-
- PMeshValue&
- TValForTimeImpl
- ::GetMeshValue(EGeometry theGeom)
- {
- return myGeom2Value.GetMeshValue(theGeom);
- }
-
- TGeom2MeshValue&
- TValForTimeImpl
- ::GetGeom2MeshValue()
- {
- return myGeom2Value.GetGeom2MeshValue();
- }
-
- const TGeom2MeshValue&
- TValForTimeImpl
- ::GetGeom2MeshValue() const
- {
- return myGeom2Value.GetGeom2MeshValue();
- }
-
- PMeshValue
- TValForTimeImpl
- ::GetFirstMeshValue() const
- {
- return myGeom2Value.GetFirstMeshValue();
- }
-
- int
- TValForTimeImpl
- ::GetNbGauss(EGeometry theGeom) const
- {
- TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
- if(anIter == myGeom2NbGauss.end()){
- return 1;
- }
- return anIter->second;
- }
-
- unsigned long int
- TValForTimeImpl
- ::GetMemorySize()
- {
- size_t aSize = sizeof(TValForTimeImpl);
- const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
- TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
- TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
- for(; anIter != anIterEnd; anIter++){
- const PMeshValue& aMeshValue = anIter->second;
- aSize += aMeshValue->GetMemorySize();
- aSize += sizeof(EGeometry);
- }
- return aSize;
- }
-
-
-
- //---------------------------------------------------------------
- vtkIdType
- VISUGeom2NbNodes(EGeometry theGeom)
- {
- switch(theGeom){
-#ifndef VISU_ENABLE_QUADRATIC
- case VISU::eSEG3:
- return 2;
- case VISU::eTRIA6:
- return 3;
- case VISU::eQUAD8:
- return 4;
- case VISU::eTETRA10:
- return 4;
- case VISU::eHEXA20:
- return 8;
- case VISU::ePENTA15:
- return 6;
- case VISU::ePYRA13:
- return 5;
-#endif
- case VISU::ePOLYGONE:
- case VISU::ePOLYEDRE:
- return -1;
- default:
- return theGeom % 100;
- }
- }
+#include "VISU_AppendPolyData.hxx"
+#include "VTKViewer_AppendFilter.h"
+#include "VTKViewer_CellLocationsArray.h"
- vtkIdType
- VISUGeom2VTK(EGeometry theGeom)
- {
- switch(theGeom){
- case VISU::ePOINT1:
- return VTK_VERTEX;
- case VISU::eSEG2:
- return VTK_LINE;
- case VISU::eTRIA3:
- return VTK_TRIANGLE;
- case VISU::eQUAD4:
- return VTK_QUAD;
- case VISU::eTETRA4:
- return VTK_TETRA;
- case VISU::eHEXA8:
- return VTK_HEXAHEDRON;
- case VISU::ePENTA6:
- return VTK_WEDGE;
- case VISU::ePYRA5:
- return VTK_PYRAMID;
-
- case VISU::ePOLYGONE:
- return VTK_POLYGON;
- case VISU::ePOLYEDRE:
- return VTK_CONVEX_POINT_SET;
-
-#ifndef VISU_ENABLE_QUADRATIC
- case VISU::eSEG3:
- return VTK_LINE;
- case VISU::eTRIA6:
- return VTK_TRIANGLE;
- case VISU::eQUAD8:
- return VTK_QUAD;
- case VISU::eTETRA10:
- return VTK_TETRA;
- case VISU::eHEXA20:
- return VTK_HEXAHEDRON;
- case VISU::ePENTA15:
- return VTK_WEDGE;
- case VISU::ePYRA13:
- return VTK_PYRAMID;
+#include "VISU_ConvertorUtils.hxx"
-#else
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
- case VISU::eSEG3:
-#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_EDGE;
-#else
- return VTK_POLY_LINE;
-#endif
+#include <vtkPoints.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
- case VISU::eTRIA6:
-#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_TRIANGLE;
-#else
- return VTK_POLYGON;
-#endif
+#include <vtkIdList.h>
+#include <vtkCellType.h>
+#include <vtkCellArray.h>
+#include <vtkCellLinks.h>
+#include <vtkUnsignedCharArray.h>
- case VISU::eQUAD8:
-#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_QUAD;
-#else
- return VTK_POLYGON;
-#endif
+#include <qstring.h>
+#include <qfileinfo.h>
- case VISU::eTETRA10:
-#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_TETRA;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
+#include <memory>
- case VISU::eHEXA20:
-#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_HEXAHEDRON;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
+static vtkFloatingPointType ERR_SIZE_CALC = 1.00;
- case VISU::ePENTA15:
-#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_WEDGE;
-#else
- return VTK_CONVEX_POINT_SET;
-#endif
+static int MYVTKDEBUG = 0;
- case VISU::ePYRA13:
-#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
- return VTK_QUADRATIC_PYRAMID;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
+//#define _DEXCEPT_
#else
- return VTK_CONVEX_POINT_SET;
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
#endif
-#endif //VISU_ENABLE_QUADRATIC
-
- default:
- return -1;
- }
- }
-}
-
namespace
{
//---------------------------------------------------------------
void
- GetCellsOnSubMesh(const TVTKSource& theSource,
- const PMeshOnEntityImpl& theMeshOnEntity,
- const PSubMeshImpl& theSubMesh,
+ GetCellsOnSubMesh(const VISU::PUnstructuredGrid& theSource,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PSubMeshImpl& theSubMesh,
const vtkIdType theGeom)
{
- TTimerLog aTimerLog(MYDEBUG,"GetCellsOnSubMesh");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetCellsOnSubMesh");
const VISU::TCell2Connect& anArray = theSubMesh->myCell2Connect;
vtkIdType aCellsSize = theSubMesh->myCellsSize;
vtkIdType aNbCells = theSubMesh->myNbCells;
//---------------------------------------------------------------
void
- GetCellsOnFamily(const TVTKSource& theSource,
- const PMeshOnEntityImpl& theMeshOnEntity,
- const PFamilyImpl& theFamily)
+ GetCellsOnFamily(const VISU::PUnstructuredGrid& theSource,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PFamilyImpl& theFamily)
{
INITMSG(MYDEBUG,"GetCellsOnFamily"<<endl);
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->SetNumberOfTuples(aNbCells);
- TSubMeshID& aMeshID = theFamily->myMeshID;
+ VISU::TSubMeshID& aMeshID = theFamily->myMeshID;
aMeshID.resize(aNbCells);
VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID;
const VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
if(aGeom2SubMeshID.empty())
- EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
+ EXCEPTION(std::runtime_error,"GetCells >> There is no elements on the family !!!");
VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aEGeom);
if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end())
//---------------------------------------------------------------
void
- GetCells(const TVTKSource& theSource,
- const PSubProfileImpl& theSubProfile,
- const PProfileImpl& theProfile,
- const PMeshOnEntityImpl& theMeshOnEntity)
+ GetCells(const VISU::PUnstructuredGrid& theSource,
+ const VISU::PSubProfileImpl& theSubProfile,
+ const VISU::PProfileImpl& theProfile,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity)
{
vtkIdType aNbCells = theSubProfile->myNbCells;
vtkIdType aCellsSize = theSubProfile->myCellsSize;
INITMSG(MYDEBUG,"GetCells - aVGeom = "<<aVGeom<<endl);
- const TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
+ const VISU::TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.find(aEGeom);
if(anIter == aGeom2SubMesh.end())
- EXCEPTION(runtime_error,"GetCells >> There is no elements for the GEOM("<<aEGeom<<")");
+ EXCEPTION(std::runtime_error,"GetCells >> There is no elements for the GEOM("<<aEGeom<<")");
const VISU::TSubMeshImpl& aSubMesh = anIter->second;
- const TCell2Connect& aCell2Connect = aSubMesh.myCell2Connect;
+ const VISU::TCell2Connect& aCell2Connect = aSubMesh.myCell2Connect;
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate(aCellsSize,0);
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->SetNumberOfTuples(aNbCells);
- if(theSubProfile->myStatus == eAddAll){
+ if(theSubProfile->myStatus == VISU::eAddAll){
VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin();
for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){
- const TConnect& anArray = aCell2Connect[anId];
+ const VISU::TConnect& anArray = aCell2Connect[anId];
PrintCells(aConnId,aConnectivity,anArray);
aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
aConnId += aNbNodes;
VISU::TSubMeshID::const_iterator anIter = aSubMeshID.begin();
for(vtkIdType anId = 0, aConnId = 0; anIter != aSubMeshID.end(); anIter++){
vtkIdType aSubId = *anIter;
- const TConnect& anArray = aCell2Connect[aSubId];
+ const VISU::TConnect& anArray = aCell2Connect[aSubId];
PrintCells(aConnId,aConnectivity,anArray);
aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
aConnId += aNbNodes;
//---------------------------------------------------------------
void
- GetMeshOnSubProfile(const PMeshImpl& theMesh,
- const PMeshOnEntityImpl& theMeshOnEntity,
- const PProfileImpl& theProfile,
- const PSubProfileImpl& theSubProfile)
+ GetMeshOnSubProfile(const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PProfileImpl& theProfile,
+ const VISU::PSubProfileImpl& theSubProfile)
{
INITMSG(MYDEBUG,"GetMeshOnSubProfile - aEGeom = "<<theSubProfile->myGeom<<endl);
- const TVTKSource& aSource = theSubProfile->GetSource();
+ const VISU::PUnstructuredGrid& aSource = theSubProfile->GetSource();
if(theSubProfile->myIsVTKDone)
return;
//---------------------------------------------------------------
void
- GetMeshOnProfile(const PMeshImpl& theMesh,
- const PMeshOnEntityImpl& theMeshOnEntity,
- const PProfileImpl& theProfile)
+ GetMeshOnProfile(const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PProfileImpl& theProfile)
{
if(theProfile->myIsVTKDone)
return;
- TTimerLog aTimerLog(MYDEBUG,"GetMeshOnProfile");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetMeshOnProfile");
INITMSG(MYDEBUG,"GetMeshOnProfile - anEntity = "<<theMeshOnEntity->myEntity<<endl);
theProfile->myMeshOnEntity = theMeshOnEntity.get();
- const TVTKAppendFilter& anAppendFilter = theProfile->GetFilter();
+ const VISU::PAppendFilter& anAppendFilter = theProfile->GetFilter();
anAppendFilter->SetPoints(theMesh->GetPoints());
if(theProfile->myIsAll){
- TVTKOutput* aDataSet = theMeshOnEntity->GetVTKOutput();
+ vtkUnstructuredGrid* aDataSet = theMeshOnEntity->GetUnstructuredGridOutput();
anAppendFilter->AddInput(aDataSet);
}else{
- const TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
+ const VISU::TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
- TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID;
+ VISU::TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID;
- TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr;
+ VISU::TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr;
aSubProfileArr.resize(aGeom2SubProfile.size());
- TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+ VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
for(vtkIdType anInputID = 0, aCellID = 0; anIter != aGeom2SubProfile.end(); anIter++){
- PSubProfileImpl aSubProfile = anIter->second;
- if(aSubProfile->myStatus == eRemoveAll)
+ VISU::PSubProfileImpl aSubProfile = anIter->second;
+ if(aSubProfile->myStatus == VISU::eRemoveAll)
continue;
GetMeshOnSubProfile(theMesh,
theProfile,
aSubProfile);
- const TVTKSource& aSource = aSubProfile->GetSource();
+ const VISU::PUnstructuredGrid& aSource = aSubProfile->GetSource();
anAppendFilter->AddInput(aSource.GetPointer());
vtkIdType aNbCells = aSource->GetNumberOfCells();
//---------------------------------------------------------------
void
- GetSource(const TVTKSource& theSource,
- const PGaussSubMeshImpl& theGaussSubMesh,
- const PMeshOnEntityImpl& theMeshOnEntity)
+ GetSource(const VISU::PPolyData& theSource,
+ const VISU::PGaussSubMeshImpl& theGaussSubMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity)
{
- const TPointCoords& aCoords = theGaussSubMesh->myPointCoords;
- vtkIdType aNbPoints = aCoords.GetNbPoints();
-
- vtkIdType aNbCells = theGaussSubMesh->myNbCells;
- vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
-
vtkCellArray* aConnectivity = vtkCellArray::New();
- aConnectivity->Allocate(aCellsSize,0);
- vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
- aCellTypesArray->SetNumberOfComponents(1);
- aCellTypesArray->SetNumberOfTuples(aNbCells);
+ vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
+ aConnectivity->Allocate(aCellsSize, 0);
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(1);
+
+ const VISU::TPointCoords& aCoords = theGaussSubMesh->myPointCoords;
+ vtkIdType aNbPoints = aCoords.GetNbPoints();
for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
anIdList->SetId(0, aPointId);
aConnectivity->InsertNextCell(anIdList);
- aCellTypesArray->SetValue(aPointId, (unsigned char)VTK_VERTEX);
}
anIdList->Delete();
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
- aCellLocationsArray->SetNumberOfComponents(1);
- aCellLocationsArray->SetNumberOfTuples(aNbCells);
-
- vtkIdType *pts = 0, npts = 0;
- aConnectivity->InitTraversal();
- for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
- aCellLocationsArray->SetValue(i, aConnectivity->GetTraversalLocation(npts));
-
- const TVTKSource& aSource = theGaussSubMesh->GetSource();
- aSource->SetCells(aCellTypesArray, aCellLocationsArray, aConnectivity);
+ const VISU::PPolyData& aSource = theGaussSubMesh->GetSource();
+ aSource->SetVerts(aConnectivity);
aSource->SetPoints(aCoords.GetPoints());
- aCellLocationsArray->Delete();
- aCellTypesArray->Delete();
aConnectivity->Delete();
}
//---------------------------------------------------------------
void
- GetGaussSubMesh(const PMeshImpl& theMesh,
- const PMeshOnEntityImpl& theMeshOnEntity,
- const PGaussMeshImpl& theGaussMesh,
- const PGaussSubMeshImpl& theGaussSubMesh)
+ GetGaussSubMesh(const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PGaussMeshImpl& theGaussMesh,
+ const VISU::PGaussSubMeshImpl& theGaussSubMesh)
{
- PGaussImpl aGauss = theGaussSubMesh->myGauss;
+ VISU::PGaussImpl aGauss = theGaussSubMesh->myGauss;
if(!theGaussSubMesh->myIsDone)
return;
if(theGaussSubMesh->myIsVTKDone)
return;
- TTimerLog aTimerLog(MYDEBUG,"GetGaussSubMesh");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussSubMesh");
INITMSG(MYDEBUG,"GetGaussSubMesh - aVGeom = "<<aGauss->myGeom<<endl);
- const TVTKSource& aSource = theGaussSubMesh->GetSource();
- GetSource(aSource,theGaussSubMesh,theMeshOnEntity);
+ const VISU::PPolyData& aSource = theGaussSubMesh->GetSource();
+ GetSource(aSource, theGaussSubMesh, theMeshOnEntity);
INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
//---------------------------------------------------------------
void
- BuildGaussMesh(const PMeshImpl& theMesh,
- const PMeshOnEntityImpl& theMeshOnEntity,
- const PGaussMeshImpl& theGaussMesh)
+ BuildGaussMesh(const VISU::PMeshImpl& theMesh,
+ const VISU::PMeshOnEntityImpl& theMeshOnEntity,
+ const VISU::PGaussMeshImpl& theGaussMesh)
{
if(theGaussMesh->myIsVTKDone)
return;
- TTimerLog aTimerLog(MYDEBUG,"BuildGaussMesh");
- const TVTKAppendFilter& anAppendFilter = theGaussMesh->GetFilter();
- const TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
- TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGaussMesh");
+ const VISU::PAppendPolyData& anAppendFilter = theGaussMesh->GetFilter();
+ const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
+ VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
for(; anIter != aGeom2GaussSubMesh.end(); anIter++){
- PGaussSubMeshImpl aGaussSubMesh = anIter->second;
- if(aGaussSubMesh->myStatus == eRemoveAll)
+ VISU::PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+ if(aGaussSubMesh->myStatus == VISU::eRemoveAll)
continue;
GetGaussSubMesh(theMesh,
theGaussMesh,
aGaussSubMesh);
- const TVTKSource& aSource = aGaussSubMesh->GetSource();
+ const VISU::PPolyData& aSource = aGaussSubMesh->GetSource();
anAppendFilter->AddInput(aSource.GetPointer());
}
anAppendFilter->Update(); // Fix on VTK
- theMeshOnEntity->GetVTKOutput()->Update();
+ theMeshOnEntity->GetOutput()->Update();
vtkDataSet* aSource = anAppendFilter->GetOutput();
INITMSGA(MYDEBUG,0,"aNbPoints - "<<aSource->GetNumberOfPoints()<<endl);
//---------------------------------------------------------------
VISU::PNamedIDMapper
VISU_Convertor_impl
-::GetMeshOnEntity(const string& theMeshName,
+::GetMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity)
{
INITMSG(MYDEBUG,"GetMeshOnEntity"<<
TFindMeshOnEntity aFindMeshOnEntity =
FindMeshOnEntity(theMeshName,theEntity);
- PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
//Main part of code
#ifndef _DEXCEPT_
try{
#endif
if(!aMeshOnEntity->myIsVTKDone){
- TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetMeshOnEntity");
- const TVTKAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter();
+ VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetMeshOnEntity");
+ const VISU::PAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter();
if(MYVTKDEBUG) anAppendFilter->DebugOn();
LoadMeshOnEntity(aMesh,aMeshOnEntity);
anAppendFilter->SetPoints(aMesh->GetPoints());
- const TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
- TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
+ const VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+ VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
- TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
- TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
+ VISU::TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
+ VISU::TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
aSubMeshArr.resize(aGeom2SubMesh.size());
for(vtkIdType anID = 0, aCellID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){
- EGeometry aEGeom = anIter->first;
+ VISU::EGeometry aEGeom = anIter->first;
vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
- PSubMeshImpl aSubMesh = anIter->second;
- const TVTKSource& aSource = aSubMesh->GetSource();
+ VISU::PSubMeshImpl aSubMesh = anIter->second;
+ const VISU::PUnstructuredGrid& aSource = aSubMesh->GetSource();
aSource->SetPoints(aMesh->GetPoints());
GetCellsOnSubMesh(aSource,aMeshOnEntity,aSubMesh,aVGeom);
anAppendFilter->AddInput(aSource.GetPointer());
if(MYDEBUGWITHFILES){
std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
- std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+ std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk";
VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
}
//---------------------------------------------------------------
-VISU::PIDMapper
+VISU::PUnstructuredGridIDMapper
VISU_Convertor_impl
::GetFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
TFindFamilyOnEntity aFindFamilyOnEntity =
FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
- PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
- PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+ VISU::PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
//Main part of code
#ifndef _DEXCEPT_
try{
#endif
if(!aFamily->myIsVTKDone){
- const TVTKSource& aSource = aFamily->GetSource();
+ const VISU::PUnstructuredGrid& aSource = aFamily->GetSource();
if(MYVTKDEBUG) aSource->DebugOn();
GetMeshOnEntity(theMeshName,theEntity);
if(MYDEBUGWITHFILES){
std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
std::string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
- std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+ std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
VISU::WriteToFile(aSource.GetPointer(),aFileName);
}
//---------------------------------------------------------------
-VISU::PIDMapper
+VISU::PUnstructuredGridIDMapper
VISU_Convertor_impl
-::GetMeshOnGroup(const string& theMeshName,
- const string& theGroupName)
+::GetMeshOnGroup(const std::string& theMeshName,
+ const std::string& theGroupName)
{
INITMSG(MYDEBUG,"GetMeshOnGroup\n");
INITMSGA(MYDEBUG,0,
//Cheching possibility do the query
TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
- PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
- PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
+ VISU::PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
//Main part of code
#ifndef _DEXCEPT_
try{
#endif
if(!aGroup->myIsVTKDone){
- const TVTKAppendFilter& anAppendFilter = aGroup->GetFilter();
+ const VISU::PAppendFilter& anAppendFilter = aGroup->GetFilter();
const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
LoadMeshOnGroup(aMesh,aFamilySet);
anAppendFilter->SetPoints(aMesh->GetPoints());
- TFamilySet::const_iterator anIter = aFamilySet.begin();
+ VISU::TFamilySet::const_iterator anIter = aFamilySet.begin();
- TID2ID& anElemObj2VTKID = aGroup->myElemObj2VTKID;
- TFamilyArr& aFamilyArr = aGroup->myFamilyArr;
+ VISU::TID2ID& anElemObj2VTKID = aGroup->myElemObj2VTKID;
+ VISU::TFamilyArr& aFamilyArr = aGroup->myFamilyArr;
aFamilyArr.resize(aFamilySet.size());
for(vtkIdType anID = 0; anIter != aFamilySet.end(); anIter++, anID++){
- PFamilyImpl aFamily = *anIter;
+ VISU::PFamilyImpl aFamily = *anIter;
const std::string& aFamilyName = aFamily->myName;
const VISU::TEntity& anEntity = aFamily->myEntity;
VISU::PIDMapper anIDMapper = GetFamilyOnEntity(theMeshName,anEntity,aFamilyName);
- VISU::TVTKOutput* anOutput = anIDMapper->GetVTKOutput();
+ vtkDataSet* anOutput = anIDMapper->GetOutput();
anAppendFilter->AddInput(anOutput);
vtkIdType aStartID = anElemObj2VTKID.size();
if(MYDEBUGWITHFILES){
std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
std::string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
- std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+ std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
}
//---------------------------------------------------------------
-VISU::TVTKOutput*
+vtkUnstructuredGrid*
VISU_Convertor_impl
::GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
const VISU::PMeshOnEntityImpl& theMeshOnEntity,
const VISU::PFieldImpl& theField,
const VISU::PValForTimeImpl& theValForTime,
- const VISU::PIDMapperFilter& theIDMapperFilter,
+ const VISU::PUnstructuredGridIDMapperImpl& theUnstructuredGridIDMapper,
const VISU::PProfileImpl& theProfile,
const VISU::TEntity& theEntity)
{
GetMeshOnEntity(theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity);
GetMeshOnProfile(theMesh, theMeshOnEntity, theProfile);
- theIDMapperFilter->myIDMapper = theProfile;
- TVTKOutput* anOutput = theIDMapperFilter->GetVTKOutput();
- const TVTKSource& aSource = theIDMapperFilter->mySource.GetSource();
- ::GetTimeStampOnProfile(aSource, theField, theValForTime, theEntity);
+ theUnstructuredGridIDMapper->myIDMapper = theProfile;
+ vtkUnstructuredGrid* anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+ const VISU::PUnstructuredGrid& aSource = theUnstructuredGridIDMapper->mySource.GetSource();
+ VISU::GetTimeStampOnProfile(aSource, theField, theValForTime, theEntity);
return anOutput;
}
//---------------------------------------------------------------
-VISU::PIDMapper
+VISU::PUnstructuredGridIDMapper
VISU_Convertor_impl
-::GetTimeStampOnMesh(const string& theMeshName,
+::GetTimeStampOnMesh(const std::string& theMeshName,
const VISU::TEntity& theEntity,
- const string& theFieldName,
+ const std::string& theFieldName,
int theStampsNum)
{
INITMSG(MYDEBUG,"GetTimeStampOnMesh"<<
theFieldName,
theStampsNum);
- PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
- PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
- PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
- PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
+ VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
+ VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+ VISU::PFieldImpl aField = boost::get<3>(aFindTimeStamp);
//Main part of code
- PIDMapperFilter anIDMapperFilter = aValForTime->myIDMapperFilter;
+ VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = aValForTime->myUnstructuredGridIDMapper;
#ifndef _DEXCEPT_
try{
#endif
- if(!anIDMapperFilter->myIsVTKDone){
- TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetTimeStampOnMesh");
- LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
+ if(!anUnstructuredGridIDMapper->myIsVTKDone){
+ VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetTimeStampOnMesh");
+ LoadValForTimeOnMesh(aMesh, aMeshOnEntity, aField, aValForTime);
- TVTKOutput* anOutput;
+ vtkUnstructuredGrid* anOutput = NULL;
try{
anOutput = GetTimeStampOnProfile(aMesh,
aVTKMeshOnEntity,
aField,
aValForTime,
- anIDMapperFilter,
+ anUnstructuredGridIDMapper,
aValForTime->myProfile,
aMeshOnEntity->myEntity);
}catch(std::exception& exc){
aMeshOnEntity,
aField,
aValForTime,
- anIDMapperFilter,
+ anUnstructuredGridIDMapper,
aValForTime->myProfile,
aVTKMeshOnEntity->myEntity);
}
- anIDMapperFilter->myIsVTKDone = true;
+ anUnstructuredGridIDMapper->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
- string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
- string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
- string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
- string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) +
- aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
+ std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+ std::string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+ std::string aPrefix = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
+ std::string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) +
+ aFieldName + dtos("-%d", theStampsNum) + "-Conv.vtk";
VISU::WriteToFile(anOutput,aFileName);
}
if(MYVTKDEBUG){
- GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
+ GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
anOutput->Update();
if(theEntity == VISU::NODE_ENTITY)
BEGMSG(MYVTKDEBUG,"GetPointData() = "<<vtkFloatingPointType(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
}
#endif
- return anIDMapperFilter;
+ return anUnstructuredGridIDMapper;
}
//---------------------------------------------------------------
VISU::PGaussPtsIDMapper
VISU_Convertor_impl
-::GetTimeStampOnGaussPts(const string& theMeshName,
+::GetTimeStampOnGaussPts(const std::string& theMeshName,
const VISU::TEntity& theEntity,
- const string& theFieldName,
+ const std::string& theFieldName,
int theStampsNum)
{
INITMSG(MYDEBUG,"GetTimeStampOnGaussPts"<<
"; theStampsNum = "<<theStampsNum<<
endl);
+ if(theEntity == VISU::NODE_ENTITY)
+ EXCEPTION(std::runtime_error, "It is impossible to reate Gauss Points on NODE_ENTITY !!!");
+
//Cheching possibility do the query
TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
theEntity,
theFieldName,
theStampsNum);
- PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
- PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
- PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
- PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
+ VISU::PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
+ VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+ VISU::PFieldImpl aField = boost::get<3>(aFindTimeStamp);
//Main part of code
- PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
+ VISU::PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
#ifndef _DEXCEPT_
try{
#endif
if(!aGaussPtsIDFilter->myIsVTKDone){
- TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetTimeStampOnGaussPts");
- LoadValForTimeOnGaussPts(aMesh,aMeshOnEntity,aField,aValForTime);
+ VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_Convertor_impl::GetTimeStampOnGaussPts");
+ LoadValForTimeOnGaussPts(aMesh, aMeshOnEntity, aField, aValForTime);
- GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
+ GetMeshOnEntity(aVTKMeshOnEntity->myMeshName, aVTKMeshOnEntity->myEntity);
- PProfileImpl aProfile = aValForTime->myProfile;
- GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
+ VISU::PProfileImpl aProfile = aValForTime->myProfile;
+ GetMeshOnProfile(aMesh, aVTKMeshOnEntity, aProfile);
- PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh;
- TSource& aGaussPtsSource = aGaussMesh->mySource;
+ VISU::PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh;
+ VISU::TPolyDataHolder& aGaussPtsSource = aGaussMesh->mySource;
if(!aGaussPtsSource.myIsVTKDone){
- BuildGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh);
+ BuildGaussMesh(aMesh, aVTKMeshOnEntity, aGaussMesh);
aGaussMesh->myParent = aProfile.get();
aGaussPtsSource.myIsVTKDone = true;
}
aGaussPtsIDFilter->myIDMapper = aGaussMesh;
aGaussPtsIDFilter->myGaussPtsIDMapper = aGaussMesh;
- TVTKOutput* anOutput = aGaussPtsIDFilter->GetVTKOutput();
- const TVTKSource& aSource = aGaussPtsIDFilter->mySource.GetSource();
- GetTimeStampOnGaussMesh(aSource,aField,aValForTime);
+ vtkPolyData* anOutput = aGaussPtsIDFilter->GetPolyDataOutput();
+ const VISU::PPolyData& aSource = aGaussPtsIDFilter->mySource.GetSource();
+ VISU::GetTimeStampOnGaussMesh(aSource, aField, aValForTime);
aGaussPtsIDFilter->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
- string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
- string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
- string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
- string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) +
+ std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+ std::string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+ std::string aPrefix = std::string(getenv("HOME"))+"/"+getenv("USER")+"-";
+ std::string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) +
aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
- VISU::WriteToFile(anOutput,aFileName);
+ VISU::WriteToFile(anOutput, aFileName);
}
if(MYVTKDEBUG){
- GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
+ GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
anOutput->Update();
if(theEntity == VISU::NODE_ENTITY)
BEGMSG(MYVTKDEBUG,"GetPointData() = "<<vtkFloatingPointType(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
//---------------------------------------------------------------
VISU::PMeshImpl
VISU_Convertor_impl
-::FindMesh(const string& theMeshName)
+::FindMesh(const std::string& theMeshName)
{
GetMeshMap();
- TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
+ VISU::TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
if(aMeshMapIter == myMeshMap.end())
- EXCEPTION(runtime_error,"FindMesh >> There is no mesh with the name - '"<<theMeshName<<"'!!!");
+ EXCEPTION(std::runtime_error,"FindMesh >> There is no mesh with the name - '"<<theMeshName<<"'!!!");
- PMeshImpl aMesh = aMeshMapIter->second;
+ VISU::PMeshImpl aMesh = aMeshMapIter->second;
return aMesh;
}
//---------------------------------------------------------------
VISU_Convertor_impl::TFindMeshOnEntity
VISU_Convertor_impl
-::FindMeshOnEntity(const string& theMeshName,
+::FindMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity)
{
- PMeshImpl aMesh = FindMesh(theMeshName);
+ VISU::PMeshImpl aMesh = FindMesh(theMeshName);
VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
- EXCEPTION(runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
+ EXCEPTION(std::runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
- PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+ VISU::PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
return TFindMeshOnEntity(aMesh,
aMeshOnEntity);
//---------------------------------------------------------------
VISU_Convertor_impl::TFindFamilyOnEntity
VISU_Convertor_impl
-::FindFamilyOnEntity(const string& theMeshName,
+::FindFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
- const string& theFamilyName)
+ const std::string& theFamilyName)
{
if(theFamilyName != ""){
- PMeshImpl aMesh = FindMesh(theMeshName);
+ VISU::PMeshImpl aMesh = FindMesh(theMeshName);
VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
- EXCEPTION(runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
+ EXCEPTION(std::runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
- PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+ VISU::PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
- TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
+ VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ VISU::TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
if(aFamilyMapIter != aFamilyMap.end()){
- const PFamily& aFamily = aFamilyMapIter->second;
+ const VISU::PFamily& aFamily = aFamilyMapIter->second;
return TFindFamilyOnEntity(aMesh,
aMeshOnEntity,
aFamily);
const VISU::TMeshMap& aMeshMap = GetMeshMap();
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
- const string& aMeshName = aMeshMapIter->first;
+ const std::string& aMeshName = aMeshMapIter->first;
const VISU::PMesh aMesh = aMeshMapIter->second;
const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
- const string& aFieldName = aFieldMapIter->first;
+ const std::string& aFieldName = aFieldMapIter->first;
const VISU::PField aField = aFieldMapIter->second;
const VISU::TValField& aValField = aField->myValField;
VISU::TValField::const_iterator aValFieldIter = aValField.begin();
const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
- const string& aGroupName = aGroupMapIter->first;
+ const std::string& aGroupName = aGroupMapIter->first;
aResult += GetMeshOnGroupSize(aMeshName,aGroupName);
}
//Import families
const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const string& aFamilyName = aFamilyMapIter->first;
+ const std::string& aFamilyName = aFamilyMapIter->first;
aResult += GetFamilyOnEntitySize(aMeshName,anEntity,aFamilyName);
}
//Import mesh on entity
TFindMeshOnEntity aFindMeshOnEntity =
FindMeshOnEntity(theMeshName, theEntity);
- PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
size_t aPointsSize = 3*aMesh->GetNbPoints()*sizeof(VISU::TCoord);
size_t aNbCells = aMeshOnEntity->myNbCells;
{
TFindFamilyOnEntity aFindFamilyOnEntity =
FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
- PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);
- PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);
+ VISU::PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
size_t aPointsSize = 3*aMesh->GetNbPoints()*sizeof(VISU::TCoord);
size_t aNbCells = aFamily->myNbCells;
::FindMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName)
{
- PMeshImpl aMesh = FindMesh(theMeshName);
+ VISU::PMeshImpl aMesh = FindMesh(theMeshName);
VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
if(aGroupMapIter == aGroupMap.end())
- EXCEPTION(runtime_error,"FindMesh >> There is no the group in the mesh!!! - '"<<theGroupName<<"'");
+ EXCEPTION(std::runtime_error,"FindMesh >> There is no the group in the mesh!!! - '"<<theGroupName<<"'");
VISU::PGroupImpl aGroup = aGroupMapIter->second;
return TFindMeshOnGroup(aMesh,aGroup);
const std::string& theGroupName)
{
TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
- PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
- PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
+ VISU::PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
size_t aPointsSize = 3*aMesh->GetNbPoints()*sizeof(VISU::TCoord);
- TNbASizeCells aNbASizeCells = aGroup->GetNbASizeCells();
+ VISU::TNbASizeCells aNbASizeCells = aGroup->GetNbASizeCells();
size_t aNbCells = aNbASizeCells.first;
size_t aCellsSize = aNbASizeCells.second;
size_t aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
VISU_Convertor_impl::TFindField
VISU_Convertor_impl
-::FindField(const string& theMeshName,
+::FindField(const std::string& theMeshName,
const VISU::TEntity& theEntity,
- const string& theFieldName)
+ const std::string& theFieldName)
{
TFindMeshOnEntity aFindMeshOnEntity =
FindMeshOnEntity(theMeshName,theEntity);
- PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
+ VISU::PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
if(theEntity == VISU::NODE_ENTITY){
if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end())
aVTKMeshOnEntity = aMeshOnEntityMap[VISU::CELL_ENTITY];
VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find(theFieldName);
if(aFieldIter == aFieldMap.end())
- EXCEPTION(runtime_error,"FindField >> There is no field on the mesh!!!");
+ EXCEPTION(std::runtime_error,"FindField >> There is no field on the mesh!!!");
- PFieldImpl aField = aFieldIter->second;
+ VISU::PFieldImpl aField = aFieldIter->second;
return TFindField(aMesh,
aMeshOnEntity,
const std::string& theFieldName)
{
TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
- PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
- PFieldImpl aField = boost::get<3>(aFindField);
+ VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
+ VISU::PFieldImpl aField = boost::get<3>(aFindField);
size_t aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
size_t aFieldOnMeshSize = size_t(aField->myDataSize*sizeof(vtkFloatingPointType)*aField->myValField.size()*ERR_SIZE_CALC);
int theStampsNum)
{
TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
- PField aField = boost::get<3>(aFindField);
+ VISU::PField aField = boost::get<3>(aFindField);
VISU::TValField& aValField = aField->myValField;
VISU::TValField::const_iterator aValFieldIter= aValField.find(theStampsNum);
if(aValFieldIter == aValField.end())
- EXCEPTION(runtime_error,"FindTimeStamp >> There is no field with the timestamp!!!");
+ EXCEPTION(std::runtime_error,"FindTimeStamp >> There is no field with the timestamp!!!");
- PMeshImpl aMesh = boost::get<0>(aFindField);
- PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindField);
- PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
- PValForTimeImpl aValForTime = aValFieldIter->second;
+ VISU::PMeshImpl aMesh = boost::get<0>(aFindField);
+ VISU::PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindField);
+ VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
+ VISU::PValForTimeImpl aValForTime = aValFieldIter->second;
return TFindTimeStamp(aMesh,
aMeshOnEntity,
{
TFindTimeStamp aFindTimeStamp =
FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
- PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
- PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+ VISU::PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
+ VISU::PFieldImpl aField = boost::get<3>(aFindTimeStamp);
size_t aMeshSize = GetMeshOnEntitySize(theMeshName, aVTKMeshOnEntity->myEntity);
size_t aTimeStampSize = size_t(aField->myDataSize*sizeof(vtkFloatingPointType) * ERR_SIZE_CALC);
theFieldName,
theStampsNum);
- PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
- PIDMapperFilter anIDMapperFilter = aValForTime->myIDMapperFilter;
- if(anIDMapperFilter->myIsVTKDone){
+ VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+ VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = aValForTime->myUnstructuredGridIDMapper;
+ if(anUnstructuredGridIDMapper->myIsVTKDone){
VISU::PIDMapper anIDMapper = GetTimeStampOnMesh(theMeshName,
theEntity,
theFieldName,
theStampsNum);
- anIDMapper->GetVTKOutput();
+ anIDMapper->GetOutput();
aSize += anIDMapper->GetMemorySize();
}else
aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
theFieldName,
theStampsNum);
- PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
- PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
+ VISU::PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+ VISU::PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
if(aGaussPtsIDFilter->myIsVTKDone){
VISU::PGaussPtsIDMapper aGaussPtsIDMapper = GetTimeStampOnGaussPts(theMeshName,
theEntity,
theFieldName,
theStampsNum);
- aGaussPtsIDMapper->GetVTKOutput();
+ aGaussPtsIDMapper->GetOutput();
aSize += aGaussPtsIDMapper->GetMemorySize();
}else
aSize += GetTimeStampSize(theMeshName, theEntity, theFieldName, theStampsNum);
const VISU::PField
VISU_Convertor_impl
-::GetField(const string& theMeshName,
+::GetField(const std::string& theMeshName,
VISU::TEntity theEntity,
- const string& theFieldName)
+ const std::string& theFieldName)
{
TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
- PField aField = boost::get<3>(aFindField);
+ VISU::PField aField = boost::get<3>(aFindField);
return aField;
}
{
TFindTimeStamp aFindTimeStamp =
FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
- PValForTime aValForTime = boost::get<4>(aFindTimeStamp);
+ VISU::PValForTime aValForTime = boost::get<4>(aFindTimeStamp);
return aValForTime;
}
#ifndef VISU_Convertor_impl_HeaderFile
#define VISU_Convertor_impl_HeaderFile
-#include <vtkSmartPointer.h>
-
-#include <boost/tuple/tuple.hpp>
-
-class vtkCell;
-class vtkPoints;
-class vtkUnstructuredGrid;
-class VTKViewer_AppendFilter;
-class VISU_MergeFilter;
-
#include "VISU_Convertor.hxx"
-#include "MED_SliceArray.hxx"
-#include "MED_Structures.hxx"
-
-#ifndef VISU_ENABLE_QUADRATIC
-#define VISU_ENABLE_QUADRATIC
-#define VISU_USE_VTK_QUADRATIC
-#endif
-
-namespace VISU
-{
- //! Defines VISU enumeration of geometrical types
- enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
- eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
- ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310,
- ePYRA13=313, ePENTA15=315, eHEXA20=320,
- ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
-
- //! Get number of nodes for defined geometrical type
- vtkIdType
- VISUGeom2NbNodes(EGeometry theGeom);
-
- //! Maps VISU geometrical type to VTK one
- vtkIdType
- VISUGeom2VTK(EGeometry theGeom);
-
- //---------------------------------------------------------------
- using MED::TCSlice;
- using MED::TSlice;
-
- typedef vtkUnstructuredGrid TDataSet;
-
- typedef vtkSmartPointer<TDataSet> TVTKSource;
- typedef vtkSmartPointer<vtkPoints> TVTKPoints;
- typedef vtkSmartPointer<VISU_MergeFilter> TVTKMergeFilter;
-
- typedef vtkSmartPointer<VTKViewer_AppendFilter> TVTKAppendFilter;
-
- //---------------------------------------------------------------
- //! Define an utility base class which is repsonsible for preventing repetion
- struct TIsVTKDone: virtual TBaseStructure
- {
- TIsVTKDone();
- mutable bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure
- mutable bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation
- };
-
-
- //---------------------------------------------------------------
- //! Define an utility base class which allow to keep calculated number of cells and their size
- struct TSizeCounter: virtual TIsVTKDone
- {
- TSizeCounter();
- vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
- vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
- };
-
-
- //---------------------------------------------------------------
- //! Define a container for VTK representation
- class TSource: public virtual TSizeCounter
- {
- protected:
- mutable TVTKSource mySource;
- public:
- TSource();
-
- //! This method allow to create corresponding VTK data set by demand (not at once)
- const TVTKSource&
- GetSource() const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
- };
-
-
- //---------------------------------------------------------------
- //! Define an intermediate class which unifies memory size calculation
- struct TMemoryCheckIDMapper: public virtual TIsVTKDone,
- public virtual TIDMapper
- {
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
- };
-
-
- //---------------------------------------------------------------
- //! Define a container for VTK representation
- /*!
- This container allow to combine other VTK representation into single one.
- */
- class TAppendFilter: public virtual TMemoryCheckIDMapper
- {
- protected:
- mutable TVTKAppendFilter myFilter;
- public:
- TAppendFilter();
-
- //! This method allow to create corresponding VTK filter by demand (not at once)
- const TVTKAppendFilter&
- GetFilter() const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
- };
-
-
- //---------------------------------------------------------------
- //! Define a container for VTK representation
- /*!
- This container allow to assign data to mesh and represent them into single VTK representation
- */
- class TMergeFilter: public virtual TMemoryCheckIDMapper
- {
- protected:
- mutable TVTKMergeFilter myFilter;
- public:
- TMergeFilter();
-
- //! This method allow to create corresponding VTK filter by demand (not at once)
- const TVTKMergeFilter&
- GetFilter() const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
- };
- typedef SharedPtr<TAppendFilter> PAppendFilter;
-
-
- //---------------------------------------------------------------
- typedef MED::TFloat TCoord;
- using MED::TCoordSlice;
- using MED::TCCoordSlice;
-
- //! This class is responsible for keeping the mesh node coordinates
- class TCoordHolderBase: public virtual TBaseStructure
- {
- vtkIdType myDim; //!< Dimension of the nodal coordinates
- vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
-
- public:
- //! To initilize the instance
- void
- Init(vtkIdType theNbPoints,
- vtkIdType theDim);
-
- vtkIdType
- GetNbPoints() const;
-
- vtkIdType
- GetDim() const;
-
- size_t
- size() const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- //! Get slice of coordinates for defined node (const version)
- virtual
- TCCoordSlice
- GetCoordSlice(vtkIdType theNodeId) const = 0;
-
- //! Get slice of coordinates for defined node
- virtual
- TCoordSlice
- GetCoordSlice(vtkIdType theNodeId) = 0;
-
- virtual
- unsigned char*
- GetValuePtr() = 0;
- };
- typedef SharedPtr<TCoordHolderBase> PCoordHolder;
-
-
- //---------------------------------------------------------------
- template<class TContainerType>
- class TCoordHolder: public virtual TCoordHolderBase
- {
- protected:
- mutable TContainerType myCoord; //!< Keeps the node coordinates container itself
-
- public:
- //! To initilize the class instance
- void
- Init(vtkIdType theNbPoints,
- vtkIdType theDim,
- const TContainerType& theCoord)
- {
- TCoordHolderBase::Init(theNbPoints, theDim);
- myCoord = theCoord;
- }
-
- //! Gets pointer to the first element in the node coordinates array
- virtual
- TCoord*
- GetPointer() = 0;
-
- //! Gets pointer to the first element in the node coordinates array (const version)
- virtual
- const TCoord*
- GetPointer() const = 0;
-
- //! Get slice of coordinates for defined node (const version)
- virtual
- TCCoordSlice
- GetCoordSlice(vtkIdType theNodeId) const
- {
- return TCCoordSlice(this->GetPointer(),
- this->size(),
- std::slice(theNodeId * this->GetDim(), this->GetDim(), 1));
- }
-
- //! Get slice of coordinates for defined node
- virtual
- TCoordSlice
- GetCoordSlice(vtkIdType theNodeId)
- {
- return TCoordSlice(this->GetPointer(),
- this->size(),
- std::slice(theNodeId * this->GetDim(), this->GetDim(), 1));
- }
-
- virtual
- unsigned char*
- GetValuePtr()
- {
- return (unsigned char*)this->GetPointer();
- }
- };
-
-
- //---------------------------------------------------------------
- //! This class is responsible for representation of mesh nodes
- class TPointCoords: public virtual TIsVTKDone
- {
- protected:
- //! An container for coordinates of the nodes
- /*!
- Usage of slices allow to minimize amount of memory to store the nodal coordinates and
- provide unifirm way of conversation with this coordinates (independant from mesh dimension)
- */
- PCoordHolder myCoord; //!< A pointer to the coordinates container holder
- TVTKPoints myPoints; //!< VTK representation for the mesh nodes
-
- void
- SetVoidArray() const; //!< Passes the MED node coordinates data directly to VTK
-
- public:
- TPointCoords();
-
- //! To initilize the class
- void
- Init(const PCoordHolder& theCoord);
-
- vtkIdType
- GetNbPoints() const;
-
- vtkIdType
- GetDim() const;
-
- //! Get slice of coordinates for defined node (const version)
- TCCoordSlice
- GetCoordSlice(vtkIdType theNodeId) const;
-
- //! Get slice of coordinates for defined node
- TCoordSlice
- GetCoordSlice(vtkIdType theNodeId);
-
- virtual
- vtkPoints*
- GetPoints() const; //!< Gets corresponding VTK structure
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
- };
- typedef SharedPtr<TPointCoords> PPointCoords;
-
-
- //---------------------------------------------------------------
- //! This class is responsible for representation of mesh nodes
- /*!
- In additition to its base functionlity it support mapping of VTK to object numeration and
- keeps names for each of nodes.
- */
- class TNamedPointCoords: public virtual TPointCoords
- {
- protected:
- typedef TVector<std::string> TPointsDim;
- TPointsDim myPointsDim; //!< Keeps name of each dimension
-
- public:
-
- //! To initilize the class (numeration of the nodes can be missed)
- void
- Init(const PCoordHolder& theCoord);
-
- //! Get name for defined dimension
- std::string&
- GetName(vtkIdType theDim);
-
- //! Get name for defined dimension (const version)
- const std::string&
- GetName(vtkIdType theDim) const;
-
- //! Get object number for node by its VTK one
- virtual
- vtkIdType
- GetObjID(vtkIdType theID) const;
-
- //! Get VTK number for node by its object one
- virtual
- vtkIdType
- GetVTKID(vtkIdType theID) const;
-
- //! Get name of node by its object number
- virtual
- std::string
- GetNodeName(vtkIdType theObjID) const;
-
- virtual
- vtkPoints*
- GetPoints() const; //!< Gets initialized corresponding VTK structure
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
- };
- typedef SharedPtr<TNamedPointCoords> PNamedPointCoords;
-
-
- //---------------------------------------------------------------
- //! Specialize TMesh to provide VTK mapping for nodes
- struct TMeshImpl: virtual TMesh,
- virtual TIsVTKDone
- {
- PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
- vtkIdType myNbPoints; //!< Keeps number of the nodes
-
- TMeshImpl(): myNbPoints(0)
- {}
-
- vtkIdType
- GetNbPoints() const;
-
- vtkIdType
- GetDim() const;
-
- vtkPoints*
- GetPoints(); //!< Gets initialized corresponding VTK structure
- };
- typedef SharedPtr<TMeshImpl> PMeshImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<vtkIdType> TSubMeshID;
- typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus;
-
- //! Specialize TSubProfile to provide VTK mapping
- struct TSubProfileImpl: virtual TSubProfile,
- virtual TSource
- {
- TSubProfileImpl();
-
- EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
- std::string myName; //!< Keeps its name
-
- //! Get object number of mesh cell by its VTK one
- virtual
- vtkIdType
- GetElemObjID(int theVtkI) const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- //! Keeps status of the structure
- /*!
- In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
- in order to construct mesh for MED TIEMSTAMPS in uniform way.
- */
- ESubMeshStatus myStatus;
- TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE
- };
- typedef SharedPtr<TSubProfileImpl> PSubProfileImpl;
-
-
- //---------------------------------------------------------------
- struct TMeshOnEntityImpl;
-
- typedef std::map<vtkIdType,vtkIdType> TID2ID;
- typedef TVector<PSubProfileImpl> TSubProfileArr;
- typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
-
- //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
- struct TProfileImpl: virtual TProfile,
- virtual TAppendFilter
- {
- TProfileImpl();
- bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
-
- //! Reimplement the TIDMapper::GetNodeObjID
- virtual
- vtkIdType
- GetNodeObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeVTKID
- virtual
- vtkIdType
- GetNodeVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeCoord
- virtual
- vtkFloatingPointType*
- GetNodeCoord(vtkIdType theObjID);
-
- //! Reimplement the TIDMapper::GetElemObjID
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemVTKID
- virtual
- vtkIdType
- GetElemVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemCell
- virtual
- vtkCell*
- GetElemCell(vtkIdType theObjID);
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- //! Reimplement the TNamedIDMapper::GetNodeName
- virtual
- std::string
- GetNodeName(vtkIdType theObjID) const;
-
- //! Reimplement the TNamedIDMapper::GetElemName
- virtual
- std::string
- GetElemName(vtkIdType theObjID) const;
-
- TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
- TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilter
- PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
- TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
-
- TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
- };
- typedef SharedPtr<TProfileImpl> PProfileImpl;
-
-
- //---------------------------------------------------------------
- //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
- struct TIDMapperFilter: virtual TMergeFilter
- {
- PAppendFilter myIDMapper; //!< Responsible for numbering
- TSource mySource; //!< Keeps assigned data
-
- //! Reimplement the TIDMapper::GetNodeObjID
- virtual
- vtkIdType
- GetNodeObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeVTKID
- virtual
- vtkIdType
- GetNodeVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeCoord
- virtual
- vtkFloatingPointType*
- GetNodeCoord(vtkIdType theObjID);
-
- //! Reimplement the TIDMapper::GetElemObjID
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemVTKID
- virtual
- vtkIdType
- GetElemVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemCell
- virtual
- vtkCell*
- GetElemCell(vtkIdType theObjID);
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
+#include "VISU_ConvertorDef_impl.hxx"
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
- };
- typedef SharedPtr<TIDMapperFilter> PIDMapperFilter;
-
-
- //---------------------------------------------------------------
- struct TGaussImpl;
- typedef SharedPtr<TGaussImpl> PGaussImpl;
-
- //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
- struct TGaussImpl: virtual TGauss
- {
- EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
- std::string myName; //!< Keeps name of the MED GAUSS entity
- vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
-
- //! To define a way to implement more detail comparision of the TGaussSubMesh instances
- virtual
- void
- LessThan(const PGaussImpl& theGauss,
- bool& theResult) const;
- };
-
-
- //---------------------------------------------------------------
- //! Specialize TGaussSubMesh to provide VTK mapping for the entity
- struct TGaussSubMeshImpl: virtual TGaussSubMesh,
- virtual TSource
- {
- TGaussSubMeshImpl();
-
- //! To implement the TGaussPtsIDMapper::GetObjID
- virtual
- TGaussPointID
- GetObjID(vtkIdType theID,
- vtkIdType theStartID) const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
-
- //! Keeps status of the structure
- /*!
- In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
- in order to construct mesh for MED TIEMSTAMPS in uniform way.
- */
- ESubMeshStatus myStatus;
-
- TPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
- };
- typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
- typedef std::map<EGeometry,PGaussSubMeshImpl> TGeom2GaussSubMesh;
-
- //! Specialize TGaussMesh to provide VTK mapping for the entity
- struct TGaussMeshImpl: virtual TGaussMesh,
- virtual TAppendFilter
- {
- TGaussMeshImpl();
-
- //! Reimplement the TGaussPtsIDMapper::GetObjID
- virtual
- TGaussPointID
- GetObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- //! Reimplement the TGaussPtsIDMapper::GetParent
- virtual
- TNamedIDMapper*
- GetParent();
-
- TSource mySource; //!< Keeps VTK representation of the Gauss Points
- TNamedIDMapper* myParent; //!< Refer to parent mesh
- TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilter
- TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
- };
- typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
-
-
- //---------------------------------------------------------------
- //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
- struct TGaussPtsIDFilter: virtual TIDMapperFilter,
- virtual TGaussPtsIDMapper
- {
- PGaussPtsIDMapper myGaussPtsIDMapper;
-
- //! Reimplement the TGaussPtsIDMapper::GetObjID
- virtual
- TGaussPointID
- GetObjID(vtkIdType theID) const;
-
- //! Reimplement the TGaussPtsIDMapper::GetParent
- virtual
- TNamedIDMapper*
- GetParent();
- };
- typedef SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
-
-
- //---------------------------------------------------------------
- typedef TVector<vtkIdType> TConnect;
- typedef TVector<TConnect> TCell2Connect;
-
- //! The class is responsible for mapping of cells of defined geometrical type
- struct TSubMeshImpl: virtual TSource
- {
-
- //! To implement the TIDMapper::GetElemObjID
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID) const;
-
- //! To implement the TNamedIDMapper::GetElemName
- virtual
- std::string
- GetElemName(vtkIdType theObjID) const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- vtkIdType myStartID;
- TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
- };
- typedef SharedPtr<TSubMeshImpl> PSubMeshImpl;
-
-
- //---------------------------------------------------------------
- typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
- typedef TVector<PSubMeshImpl> TSubMeshArr;
-
- //! Specialize TMeshOnEntity to provide VTK mapping for the entity
- struct TMeshOnEntityImpl: virtual TMeshOnEntity,
- virtual TAppendFilter,
- virtual TSizeCounter
- {
- //! Reimplement the TIDMapper::GetNodeVTKID
- virtual
- vtkIdType
- GetNodeVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeObjID
- virtual
- vtkIdType
- GetNodeObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemVTKID
- virtual
- vtkIdType
- GetElemVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemObjID
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID) const;
-
- //! Reimplement the TNamedIDMapper::GetNodeName
- virtual
- std::string
- GetNodeName(vtkIdType theObjID) const;
-
- //! Reimplement the TNamedIDMapper::GetElemName
- virtual
- std::string
- GetElemName(vtkIdType theObjID) const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
- TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilter
- PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
-
- TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
- };
- typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
-
-
- //---------------------------------------------------------------
- typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
-
- //! Specialize TFamily to provide VTK mapping for the entity
- struct TFamilyImpl: virtual TFamily,
- virtual TSource
- {
- //! Reimplement the TIDMapper::GetNodeObjID
- vtkIdType
- GetNodeObjID(vtkIdType theID) const ;
-
- //! Reimplement the TIDMapper::GetNodeVTKID
- virtual
- vtkIdType
- GetNodeVTKID(vtkIdType theID) const ;
-
- //! Reimplement the TIDMapper::GetElemVTKID
- virtual
- vtkIdType
- GetElemVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemObjID
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetVTKOutput
- virtual
- TVTKOutput*
- GetVTKOutput();
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
- TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
- TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
-
- TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
- };
- typedef SharedPtr<TFamilyImpl> PFamilyImpl;
-
-
- //---------------------------------------------------------------
- typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
- typedef TVector<PFamilyImpl> TFamilyArr;
-
- //! Specialize TGroup to provide VTK mapping for the entity
- struct TGroupImpl: virtual TGroup,
- virtual TAppendFilter
- {
- //! Calculate pair of values - number of cells and its size
- TNbASizeCells
- GetNbASizeCells() const;
-
- //! Reimplement the TIDMapper::GetElemVTKID
- virtual
- vtkIdType
- GetElemVTKID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetElemObjID
- virtual
- vtkIdType
- GetElemObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeObjID
- virtual
- vtkIdType
- GetNodeObjID(vtkIdType theID) const;
-
- //! Reimplement the TIDMapper::GetNodeVTKID
- virtual
- vtkIdType
- GetNodeVTKID(vtkIdType theID) const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
- TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilter
- PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
- };
- typedef SharedPtr<TGroupImpl> PGroupImpl;
-
-
- //---------------------------------------------------------------
- typedef TVector<TMinMax> TMinMaxArr;
-
- //! Specialize TField to provide VTK mapping for the entity
- struct TFieldImpl: virtual TField
- {
- TFieldImpl();
-
- //! To initialize the data structure
- void
- Init(vtkIdType theNbComp,
- vtkIdType theDataType);
-
- //! Gets type idetificator of the mesh data.
- vtkIdType
- GetDataType() const;
-
- //! Implement the TField::GetMinMax
- virtual
- TMinMax
- GetMinMax(vtkIdType theCompID);
-
- vtkIdType myDataSize; //!< Keeps size of the assigned data
- vtkIdType myDataType; //!< Keeps type idetificator of the mesh data
- TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
- };
- typedef SharedPtr<TFieldImpl> PFieldImpl;
-
-
- //---------------------------------------------------------------
- //! Define a base class for the container to get access to data assigned to mesh
- class TMeshValueBase
- {
- public:
- //! To intitilize the data strucutre
- void
- Init(vtkIdType theNbElem,
- vtkIdType theNbGauss,
- vtkIdType theNbComp);
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize() const = 0;
-
- //! Gets number of mesh elements where the data assigned to.
- vtkIdType
- GetNbElem() const;
-
- //! Gets number of components of corresponding MED FIELD.
- vtkIdType
- GetNbComp() const;
-
- //! Gets number of Gauss Points.
- vtkIdType
- GetNbGauss() const;
-
- size_t
- size() const;
-
- protected:
- vtkIdType myNbElem; //!< Defines number of mesh elements where the data assigned to
- vtkIdType myNbComp; //!< Keeps number of components of corresponding MED FIELD
- vtkIdType myNbGauss; //!< Defines number of Gauss Points
- vtkIdType myStep; //!< Internal variable
- };
- typedef SharedPtr<TMeshValueBase> PMeshValue;
-
-
- //---------------------------------------------------------------
- //! Define a container to get access to data assigned to mesh
- template<class TValueType>
- class TTMeshValue: public virtual TMeshValueBase
- {
- public:
- typedef TSlice<TValueType> TValueSlice;
- typedef TCSlice<TValueType> TCValueSlice;
-
- typedef TVector<TCValueSlice> TCValueSliceArr;
- typedef TVector<TValueSlice> TValueSliceArr;
-
- virtual
- const TValueType*
- GetPointer() const = 0;
-
- virtual
- TValueType*
- GetPointer() = 0;
-
- //! To get assigned values first by Gauss Points and then by components (constant version)
- TCValueSliceArr
- GetGaussValueSliceArr(vtkIdType theElemId) const
- {
- TCValueSliceArr aValueSliceArr(this->myNbGauss);
- vtkIdType anId = theElemId * this->myStep;
- for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
- aValueSliceArr[aGaussId] =
- TCValueSlice(this->GetPointer(),
- this->size(),
- std::slice(anId, this->myNbComp, 1));
- anId += this->myNbComp;
- }
- return aValueSliceArr;
- }
-
- //! To get assigned values first by Gauss Points and then by components
- TValueSliceArr
- GetGaussValueSliceArr(vtkIdType theElemId)
- {
- TValueSliceArr aValueSliceArr(this->myNbGauss);
- vtkIdType anId = theElemId * this->myStep;
- for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
- aValueSliceArr[aGaussId] =
- TValueSlice(this->GetPointer(),
- this->size(),
- std::slice(anId, this->myNbComp, 1));
- anId += this->myNbComp;
- }
- return aValueSliceArr;
- }
-
- //! To get assigned values first by components and then by Gauss Points (constant version)
- TCValueSliceArr
- GetCompValueSliceArr(vtkIdType theElemId) const
- {
- TCValueSliceArr aValueSliceArr(this->myNbComp);
- vtkIdType anId = theElemId * this->myStep;
- for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
- aValueSliceArr[aCompId] =
- TCValueSlice(this->GetPointer(),
- this->size(),
- std::slice(anId, this->myNbGauss, this->myNbComp));
- anId += 1;
- }
- return aValueSliceArr;
- }
-
- //! To get assigned values first by components and then by Gauss Points
- TValueSliceArr
- GetCompValueSliceArr(vtkIdType theElemId)
- {
- TValueSliceArr aValueSliceArr(this->myNbComp);
- vtkIdType anId = theElemId * this->myStep;
- for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
- aValueSliceArr[aCompId] =
- TValueSlice(this->GetPointer(),
- this->size(),
- std::slice(anId, this->myNbGauss, this->myNbComp));
- anId += 1;
- }
- return aValueSliceArr;
- }
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize() const
- {
- return this->size() * sizeof(TValueType);
- }
- };
-
-
- //---------------------------------------------------------------
- //! Define a container to get access to data assigned to mesh
- template<class TValueType, class TContainerType>
- class TTMeshValueHolder: public virtual TTMeshValue<TValueType>
- {
- protected:
- mutable TContainerType myContainer; //!< Keeps the mesh values container itself
-
- public:
- //! To initilize the class instance
- void
- Init(vtkIdType theNbElem,
- vtkIdType theNbGauss,
- vtkIdType theNbComp,
- const TContainerType& theContainer)
- {
- TMeshValueBase::Init(theNbElem, theNbGauss, theNbComp);
- myContainer = theContainer;
- }
- };
-
-
- //---------------------------------------------------------------
- typedef std::map<EGeometry, PMeshValue> TGeom2MeshValue;
-
- class TGeom2Value: public virtual TBaseStructure
- {
- TGeom2MeshValue myGeom2MeshValue;
- public:
-
- //! Gets mesh data for defined geometrical type (constant version)
- const PMeshValue&
- GetMeshValue(EGeometry theGeom) const;
-
- //! Gets mesh data for defined geometrical type
- PMeshValue&
- GetMeshValue(EGeometry theGeom);
-
- //! Gets container of the whole mesh data
- TGeom2MeshValue&
- GetGeom2MeshValue();
-
- //! Gets container of the whole mesh data (constant version)
- const TGeom2MeshValue&
- GetGeom2MeshValue() const;
-
- //! Gets mesh data for the first geometry
- PMeshValue
- GetFirstMeshValue() const;
- };
-
-
- //---------------------------------------------------------------
- typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
-
- //! Specialize TValForTime to provide VTK mapping for the entity
- struct TValForTimeImpl: virtual TValForTime
- {
- PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
- PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data
- TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
- TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
-
- TValForTimeImpl();
-
- TGeom2MeshValue&
- GetGeom2MeshValue();
-
- const TGeom2MeshValue&
- GetGeom2MeshValue() const;
-
- //! Get mesh data for defined geometrical type (constant version)
- const PMeshValue&
- GetMeshValue(EGeometry theGeom) const;
-
- //! Get mesh data for defined geometrical type
- PMeshValue&
- GetMeshValue(EGeometry theGeom);
-
- //! Gets mesh data for the first geometry
- PMeshValue
- GetFirstMeshValue() const;
-
- //! Get number of Gauss Points for defined geometrical type
- virtual
- int
- GetNbGauss(EGeometry theGeom) const;
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
- };
- typedef SharedPtr<TValForTimeImpl> PValForTimeImpl;
-}
+#include <boost/tuple/tuple.hpp>
+//---------------------------------------------------------------
//! This class perfroms mapping of intermediate data strucutres into corresponding VTK representation
/*!
It implements VISU_Convertor public interface and declare new pure virtual functions
//! Implemention of the VISU_Convertor::GetFamilyOnEntity
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
//! Implemention of the VISU_Convertor::GetMeshOnGroup
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName);
//! Implemention of the VISU_Convertor::GetTimeStampOnMesh
virtual
- VISU::PIDMapper
+ VISU::PUnstructuredGridIDMapper
GetTimeStampOnMesh(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFieldName,
FindMesh(const std::string& theMeshName);
//! An utility method to find TMeshOnEntity by name of its parent mesh and entity
- typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
+ typedef boost::tuple<VISU::PMeshImpl,
+ VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
TFindMeshOnEntity
FindMeshOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity);
//! An utility method to find TFamily by name of its parent mesh, corresponding entity and its name
- typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
+ typedef boost::tuple<VISU::PMeshImpl,
+ VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
TFindFamilyOnEntity
FindFamilyOnEntity(const std::string& theMeshName,
const VISU::TEntity& theEntity,
const std::string& theFamilyName);
//! An utility method to find Group by name of its parent mesh and its name
- typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
+ typedef boost::tuple<VISU::PMeshImpl,
+ VISU::PGroupImpl> TFindMeshOnGroup;
TFindMeshOnGroup
FindMeshOnGroup(const std::string& theMeshName,
const std::string& theGroupName);
const std::string& theFieldName,
int theStampsNum);
- VISU::TVTKOutput*
+ vtkUnstructuredGrid*
GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh,
const VISU::PMeshOnEntityImpl& theMeshOnEntity,
const VISU::PFieldImpl& theField,
const VISU::PValForTimeImpl& theValForTime,
- const VISU::PIDMapperFilter& theIDMapperFilter,
+ const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
const VISU::PProfileImpl& theProfile,
const VISU::TEntity& theEntity);
#include "VISU_IDMapper.hxx"
#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkDataSet.h>
namespace VISU
{
::GetNodeCoord(vtkIdType theObjID)
{
vtkIdType aVTKID = GetNodeVTKID(theObjID);
- return GetVTKOutput()->GetPoint(aVTKID);
+ return GetOutput()->GetPoint(aVTKID);
}
vtkIdType
::GetElemCell(int theObjID)
{
vtkIdType aVtkID = GetElemVTKID(theObjID);
- return GetVTKOutput()->GetCell(aVtkID);
+ return GetOutput()->GetCell(aVtkID);
}
vtkIdType
{
return theID;
}
+ //---------------------------------------------------------------
+
+
+ vtkDataSet*
+ TUnstructuredGridIDMapper
+ ::GetOutput()
+ {
+ return GetUnstructuredGridOutput();
+ }
+ //---------------------------------------------------------------
+
+
+ vtkDataSet*
+ TPolyDataIDMapper
+ ::GetOutput()
+ {
+ return GetPolyDataOutput();
+ }
+
+
+ //---------------------------------------------------------------
}
#include <string>
class vtkUnstructuredGrid;
+class vtkPolyData;
+class vtkDataSet;
class vtkCell;
namespace VISU
{
- using MED::SharedPtr;
-
//---------------------------------------------------------------
//! Defines a basic class for intemediate data structures
struct TBaseStructure
std::string myEntry; //!< To simplify publication of the object tree
};
- typedef SharedPtr<TBaseStructure> PBaseStructure;
+ typedef MED::SharedPtr<TBaseStructure> PBaseStructure;
//---------------------------------------------------------------
- typedef vtkUnstructuredGrid TVTKOutput;
-
//! Defines a basic abstract interface for VTK to object ID's and backward mapping
/*!
Where object ID means ID which attached to corresponding MED entity.
//! Get VTK representation of mesh for corresponding MED entity
virtual
- TVTKOutput*
- GetVTKOutput() = 0;
+ vtkDataSet*
+ GetOutput() = 0;
//! Gets memory size used by the instance (bytes).
virtual
unsigned long int
GetMemorySize() = 0;
};
- typedef SharedPtr<TIDMapper> PIDMapper;
+ typedef MED::SharedPtr<TIDMapper> PIDMapper;
+
+
+ //---------------------------------------------------------------
+ struct TUnstructuredGridIDMapper: virtual TIDMapper
+ {
+ //! Get VTK representation of mesh for corresponding MED entity
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput() = 0;
+
+ //! Reimplement the TIDMapper::GetOutput
+ virtual
+ vtkDataSet*
+ GetOutput();
+ };
+ typedef MED::SharedPtr<TUnstructuredGridIDMapper> PUnstructuredGridIDMapper;
//---------------------------------------------------------------
/*!
This class defines some additional methods that allow get names for corresponding mesh elements
*/
- struct TNamedIDMapper: virtual TIDMapper
+ struct TNamedIDMapper: virtual TUnstructuredGridIDMapper
{
//! Get name of mesh node for corresponding object ID
virtual
std::string
GetElemName(vtkIdType theObjID) const = 0;
};
- typedef SharedPtr<TNamedIDMapper> PNamedIDMapper;
+ typedef MED::SharedPtr<TNamedIDMapper> PNamedIDMapper;
+
+
+ //---------------------------------------------------------------
+ struct TPolyDataIDMapper: virtual TIDMapper
+ {
+ //! Get VTK representation of mesh for corresponding MED entity
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput() = 0;
+
+ //! Reimplement the TIDMapper::GetOutput
+ virtual
+ vtkDataSet*
+ GetOutput();
+ };
+ typedef MED::SharedPtr<TPolyDataIDMapper> PPolyDataIDMapper;
//---------------------------------------------------------------
//! Defines a type that represent complex ID for defined Gauss Point
typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
- struct TGaussPtsIDMapper: virtual TIDMapper
+ struct TGaussPtsIDMapper: virtual TPolyDataIDMapper
{
//! Gets complex Gauss Point ID by its VTK ID
virtual
TNamedIDMapper*
GetParent() = 0;
};
- typedef SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
+ typedef MED::SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
//---------------------------------------------------------------
}
#include "VISU_MedConvertor.hxx"
-#include "VISU_Convertor.hxx"
#include "VISU_ConvertorUtils.hxx"
#include "MED_Factory.hxx"
#include <vtkCellType.h>
-using namespace std;
-using namespace VISU;
-
using MED::TInt;
using MED::TFloat;
using MED::EBooleen;
MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
{
switch(theMEDEntity){
- case MED::eNOEUD: return NODE_ENTITY;
- case MED::eARETE: return EDGE_ENTITY;
- case MED::eFACE: return FACE_ENTITY;
- case MED::eMAILLE: return CELL_ENTITY;
+ case MED::eNOEUD: return VISU::NODE_ENTITY;
+ case MED::eARETE: return VISU::EDGE_ENTITY;
+ case MED::eFACE: return VISU::FACE_ENTITY;
+ case MED::eMAILLE: return VISU::CELL_ENTITY;
}
return VISU::TEntity(-1);
}
//---------------------------------------------------------------
MED::EEntiteMaillage
- VTKEntityToMED(TEntity theVTKEntity)
+ VTKEntityToMED(VISU::TEntity theVTKEntity)
{
switch(theVTKEntity){
- case NODE_ENTITY: return MED::eNOEUD;
- case EDGE_ENTITY: return MED::eARETE;
- case FACE_ENTITY: return MED::eFACE;
- case CELL_ENTITY: return MED::eMAILLE;
+ case VISU::NODE_ENTITY: return MED::eNOEUD;
+ case VISU::EDGE_ENTITY: return MED::eARETE;
+ case VISU::FACE_ENTITY: return MED::eFACE;
+ case VISU::CELL_ENTITY: return MED::eMAILLE;
}
return MED::EEntiteMaillage(-1);
}
//---------------------------------------------------------------
- PMEDSubProfile
+ VISU::PMEDSubProfile
CrSubProfile(const MED::PWrapper& theMEDWrapper,
const MED::PMeshInfo& theMeshInfo,
MED::EEntiteMaillage theMEntity,
VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
- PMEDSubProfile aSubProfile(new TMEDSubProfile());
+ VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
aSubProfile->myGeom = aEGeom;
aSubProfile->myMGeom = theMGeom;
- aSubProfile->myStatus = eAddAll;
+ aSubProfile->myStatus = VISU::eAddAll;
MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
if(aTimeStampIter == theGeom2Size.end())
- aSubProfile->myStatus = eRemoveAll;
+ aSubProfile->myStatus = VISU::eRemoveAll;
else{
MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
if(aProfileIter != theGeom2Profile.end()){
MED::PProfileInfo aProfileInfo = aProfileIter->second;
aSubProfile->myName = aProfileInfo->GetName();
- aSubProfile->myStatus = eAddPart;
+ aSubProfile->myStatus = VISU::eAddPart;
const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
TInt aNbElem = anElemNum.size();
//---------------------------------------------------------------
- TProfileKey
+ VISU::TProfileKey
GetProfileKey(const MED::PWrapper& theMEDWrapper,
const MED::PMeshInfo& theMeshInfo,
const MED::PTimeStampValueBase& theTimeStampValue,
{
INITMSG(MYDEBUG,"GetProfileKey"<<endl);
- TProfileKey aProfileKey;
+ VISU::TProfileKey aProfileKey;
const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
for(; anIter != aGeom2Size.end(); anIter++){
MED::EGeometrieElement aMGeom = anIter->first;
- PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
- theMeshInfo,
- theMEntity,
- aMGeom,
- theGeom2Size,
- aGeom2Profile);
+ VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
+ theMeshInfo,
+ theMEntity,
+ aMGeom,
+ theGeom2Size,
+ aGeom2Profile);
aProfileKey.insert(aSubProfile);
}
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
- TTimerLog aTimerLog(MYDEBUG,"InitProfile");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
INITMSG(MYDEBUG,"InitProfile"<<endl);
- TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
+ VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
- TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
+ VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
theMeshInfo,
theTimeStampValue,
theMeshOnEntity,
theMEntity,
theGeom2Size);
- TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
+ VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
if(anIter != aProfileMap.end()){
theValForTime.myProfile = anIter->second;
INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
}else{
- PMEDProfile aProfile(new TMEDProfile());
- TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
+ VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- TProfileKey::const_iterator anIter = aProfileKey.begin();
+ VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
for(; anIter != aProfileKey.end(); anIter++){
- PMEDSubProfile aSubProfile(*anIter);
+ VISU::PMEDSubProfile aSubProfile(*anIter);
- if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
+ if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
aProfile->myIsAll = false;
VISU::EGeometry aEGeom = aSubProfile->myGeom;
//---------------------------------------------------------------
- TGaussKey
+ VISU::TGaussKey
GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
const VISU::TMEDMeshOnEntity& theMeshOnEntity,
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
- TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
INITMSG(MYDEBUG,"GetGaussKey"<<endl);
- TGaussKey aGaussKey;
- PMEDProfile aProfile = theValForTime.myProfile;
- TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ VISU::TGaussKey aGaussKey;
+ VISU::PMEDProfile aProfile = theValForTime.myProfile;
+ VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
MED::EGeometrieElement aMGeom = anIter->first;
VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
- TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+ VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
if(anIter2 == aGeom2SubProfile.end()){
INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
continue;
}
- PMEDSubProfile aSubProfile = anIter2->second;
+ VISU::PMEDSubProfile aSubProfile = anIter2->second;
MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
if(aTimeStampIter != theGeom2Size.end()){
TInt aNbCells = aTimeStampIter->second;
- if(aSubProfile->myStatus == eAddPart)
+ if(aSubProfile->myStatus == VISU::eAddPart)
aNbCells = aSubProfile->myNbCells;
- PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
+ VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
aGaussSubMesh->mySubProfile = aSubProfile;
aGaussSubMesh->myStatus = aSubProfile->myStatus;
- PMEDGauss aGauss(new TMEDGauss());
+ VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
aGaussSubMesh->myGauss = aGauss;
aGauss->myGeom = aEGeom;
aGauss->myNbPoints = 1;
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
- TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
- if(theMeshOnEntity.myEntity == NODE_ENTITY)
+ if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
return;
- TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
+ VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
- TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
- theMeshOnEntity,
- theGeom2Size,
- theValForTime);
+ VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
+ theMeshOnEntity,
+ theGeom2Size,
+ theValForTime);
- TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
+ VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
if(anIter != aGaussMeshMap.end()){
theValForTime.myGaussMesh = anIter->second;
INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
}else{
- PMEDGaussMesh aGaussMesh(new TMEDGaussMesh());
- TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+ VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
+ VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
{
- TGaussKey::const_iterator anIter = aGaussKey.begin();
+ VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
for(; anIter != aGaussKey.end(); anIter++){
- PMEDGaussSubMesh aGaussSubMesh(*anIter);
- PMEDGauss aGauss = aGaussSubMesh->myGauss;
+ VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
+ VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
VISU::EGeometry aEGeom = aGauss->myGeom;
aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
}
}
{
- TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
+ VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
- TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+ VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
- const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+ const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
aGaussSubMeshArr[anID] = aGaussSubMesh;
}
}
- INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<endl);
+ INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
aGaussMeshMap[aGaussKey] = aGaussMesh;
theValForTime.myGaussMesh = aGaussMesh;
}
const MED::TGeom2Size& theGeom2Size,
VISU::TMEDValForTime& theValForTime)
{
- TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
- INITMSG(MYDEBUG,"InitGaussProfile"<<endl);
+ VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussProfile");
+ INITMSG(MYDEBUG,"InitGaussProfile"<<std::endl);
// The order of the function calls is important
InitProfile(theMEDWrapper,
//---------------------------------------------------------------
void
- BuildMeshOnEntityMap(PMEDMesh theMesh,
+ BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
const MED::TEntityInfo& theEntityInfo,
const MED::PNodeInfo& theNodeInfo,
const MED::PWrapper& theMEDWrapper)
{
- TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
const std::string& aMeshName = theMesh->myName;
- TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity =
+ aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
aMeshOnEntity->myEntity = aVEntity;
aMeshOnEntity->myMeshName = aMeshName;
aMeshOnEntity->myGeom2Size = aGeom2Size;
- TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+ VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
INITMSG(MYDEBUG,
"- aMEntity = "<<aMEntity<<
INITMSG(MYDEBUG,
"- myNbCells = "<<aMeshOnEntity->myNbCells<<
"; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
- endl);;
+ std::endl);
}else{
MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
//---------------------------------------------------------------
void
- BuildMeshGrilleOnEntityMap(PMEDMesh theMesh,
+ BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
const MED::TEntityInfo& theEntityInfo,
const MED::PGrilleInfo& theGrilleInfo,
const MED::PWrapper& theMEDWrapper)
{
- TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
const std::string& aMeshName = theMesh->myName;
- TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity =
+ aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
aMeshOnEntity->myEntity = aVEntity;
aMeshOnEntity->myMeshName = aMeshName;
aMeshOnEntity->myGeom2Size = aGeom2Size;
- TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+ VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
INITMSG(MYDEBUG,
"- aMEntity = "<<aMEntity<<
//---------------------------------------------------------------
void
- BuildFieldMap(PMEDMesh theMesh,
+ BuildFieldMap(VISU::PMEDMesh theMesh,
const MED::TEntityInfo& theEntityInfo,
MED::PWrapper theMEDWrapper)
{
- TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
TInt aNbFields = theMEDWrapper->GetNbFields();
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
const std::string& aMeshName = theMesh->myName;
INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
for(TInt iField = 1; iField <= aNbFields; iField++){
- TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
TInt aNbComp = aFieldInfo->GetNbComp();
std::string aFieldName = aFieldInfo->GetName();
if(aNbTimeStamps < 1)
continue;
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
vtkIdType aDataType = VTK_DOUBLE;
if(aFieldInfo->GetType() != MED::eFLOAT64)
aDataType = VTK_INT;
- PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
- TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+ VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+ VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
aField->myId = iField;
aField->Init(aNbComp, aDataType);
aField->myEntity = aVEntity;
}
for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
- TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
aMEntity,
aGeom2Size,
TFloat aDt = aTimeStampInfo->GetDt();
std::string anUnitDt = aTimeStampInfo->GetUnitDt();
- TValField& aValField = aField->myValField;
- PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+ VISU::TValField& aValField = aField->myValField;
+ VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
aValForTime->myId = iTimeStamp;
aValForTime->myFieldName = aField->myName;
aValForTime->myEntity = aField->myEntity;
aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
- TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
+ VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
for(; anIter != aMGeom2NbGauss.end(); anIter++){
const MED::EGeometrieElement& aMGeom = anIter->first;
- EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
TInt aNbGauss = anIter->second;
aVGeom2NbGauss[aEGeom] = aNbGauss;
}
//---------------------------------------------------------------
void
- BuildFamilyMap(PMEDMesh theMesh,
+ BuildFamilyMap(VISU::PMEDMesh theMesh,
const MED::TEntityInfo& theEntityInfo,
const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
const MED::TFamilyInfoSet& theFamilyInfoSet,
MED::PWrapper theMEDWrapper)
{
- TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
INITMSG(MYDEBUG,"BuildFamilyMap\n");
MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
- const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
- TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+ const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+ VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
if(aFamilyTSizeSet.empty())
continue;
std::string aFamilyName = aFamilyInfo->GetName();
- PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+ VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
aFamily->myId = anId;
aFamily->myEntity = aVEntity;
aFamily->myName = aFamilyName;
aFamily->myNbCells = aSize;
aFamily->myCellsSize = 0;
- TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
+ VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
if(anIter != aFamilyID2CellsSize.end())
aFamily->myCellsSize = anIter->second;
* Build grille family map
*/
void
- BuildGrilleFamilyMap(PMEDMesh theMesh,
+ BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
const MED::TEntityInfo& theEntityInfo,
const MED::TFamilyInfoSet& theFamilyInfoSet,
MED::PWrapper theMEDWrapper)
{
- TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
- TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
- MED::TFamilyInfoSet::iterator aFamInter = theFamilyInfoSet.begin();
- for(;aFamInter != theFamilyInfoSet.end();aFamInter++){
- TInt anId = (*aFamInter)->GetId();
+ MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
+ for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
+ const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
+ TInt anId = aFamilyInfo->GetId();
if(anId == 0)
continue;
- std::string aFamilyName = (*aFamInter)->GetName();
+ std::string aFamilyName = aFamilyInfo->GetName();
const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
anId);
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity;
- TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity;
+ VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
if(aMeshOnEntityIter != aMeshOnEntityMap.end())
aMeshOnEntity = aMeshOnEntityIter->second;
- TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+ VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
aFamily->myId = anId;
aFamily->myEntity = aVEntity;
aFamily->myName = aFamilyName;
aFamily->myNbCells = 0;
aFamily->myCellsSize = 0;
- TFamilyID2CellsSize::iterator aFamilyid2CellsSizeIter = (aMeshOnEntity->myFamilyID2CellsSize).find(anId);
+ const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+ VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
INITMSG(MY_FAMILY_DEBUG,
"- aFamilyName =|"<<aFamily->myName<<"|"
<< "; myId = "<<aFamily->myId
- << "; aNbAttr = "<<(*aFamInter)->GetNbAttr()
- << "; aNbGroup = "<<(*aFamInter)->GetNbGroup()
+ << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
+ << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
<< "; aVEntity = "<<aVEntity
<< "; myNbCells = "<<aFamily->myNbCells
<< "; myCellsSize = "<<aFamily->myCellsSize
//---------------------------------------------------------------
void
- BuildGroupMap(PMEDMesh theMesh,
+ BuildGroupMap(VISU::PMEDMesh theMesh,
const MED::TFamilyInfoSet& theFamilyInfoSet)
{
- TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
INITMSG(MYDEBUG,"BuildGroupMap\n");
- TGroupMap& aGroupMap = theMesh->myGroupMap;
+ VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
const std::string& aGroupName = aGroupInfoIter->first;
INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
- PMEDGroup aGroup(new TMEDGroup());
- TFamilySet& aFamilySet = aGroup->myFamilySet;
+ VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
+ VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
std::string aFamilyName = aFamilyInfo->GetName();
- TEntity aVEntity = TEntity(-1);
- PMEDFamily aFamily;
+ VISU::TEntity aVEntity = VISU::TEntity(-1);
+ VISU::PMEDFamily aFamily;
// Find aVisuEntity
- const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
- TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
- const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
- const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+ const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
const std::string& aName = aFamilyMapIter->first;
aFamily = aFamilyMapIter->second;
}
+ //---------------------------------------------------------------
+ struct TSetIsDone
+ {
+ bool& myIsDone;
+ TSetIsDone(bool& theIsDone):
+ myIsDone(theIsDone)
+ {}
+
+ ~TSetIsDone()
+ {
+ myIsDone = true;
+ }
+
+ };
+
+
+ //---------------------------------------------------------------
+}
+
+namespace VISU
+{
//---------------------------------------------------------------
void
TMEDNamedPointCoords
TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
myVersion = theVersion;
+ for(TInt iDim = 0; iDim < aDim; iDim++)
+ myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
+
myIsElemNum = theNodeInfo->IsElemNum();
- if(theNodeInfo->IsElemNum()){
+ if(theNodeInfo->IsElemNum())
myElemNum = theNodeInfo->myElemNum;
- for(vtkIdType anID = 0, anEnd = myElemNum->size(); anID < anEnd; anID++)
- myObj2VTKID[(*myElemNum)[anID]] = anID;
- }
myIsElemNames = theNodeInfo->IsElemNames();
if(theNodeInfo->IsElemNames())
MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
aCoordHolder->Init(aNbElem, aDim, aCoord);
TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
+
+ for(TInt iDim = 0; iDim < aDim; iDim++)
+ myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
+ MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
+ for(TInt iDim = 0; iDim < aDim; iDim++){
+ aVCoordSlice[iDim] = aMCoord[iDim];
+ }
+ }
}
vtkIdType
::GetVTKID(vtkIdType theID) const
{
if(myIsElemNum){
+ // To prepare corresponding mapper engine
+ if(myObj2VTKID.empty()){
+ vtkIdType anEnd = myElemNum->size();
+ for(vtkIdType anID = 0; anID < anEnd; anID++)
+ myObj2VTKID[(*myElemNum)[anID]] = anID;
+ }
TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
if(anIter != myObj2VTKID.end())
return anIter->second;
return aSize;
}
- //---------------------------------------------------------------
- struct TSetIsDone
- {
- bool& myIsDone;
- TSetIsDone(bool& theIsDone):
- myIsDone(theIsDone)
- {}
- ~TSetIsDone()
- {
- myIsDone = true;
- }
-
- };
+ //---------------------------------------------------------------
}
return this;
TSetIsDone aSetIsDone(myIsEntitiesDone);
- TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
TInt aNbMeshes = aMed->GetNbMeshes();
- TMeshMap& aMeshMap = myMeshMap;
+ VISU::TMeshMap& aMeshMap = myMeshMap;
INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
#ifndef _DEXCEPT_
try{
#endif
- TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
std::string aMeshName = aMeshInfo->GetName();
MED::EMaillage aType = aMeshInfo->GetType();
// creating TMesh structure and TMeshOnEntityMap
- PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+ VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
aMesh->myDim = aDim;
aMesh->myName = aMeshName;
aMesh->myMeshInfo = aMeshInfo;
- aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
+ aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
"; aDim = "<<aDim<<"\n");
return this;
TSetIsDone aSetIsDone(myIsFieldsDone);
- TTimerLog aTimerLog(MYDEBUG,"BuildFields");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
TInt aNbMeshes = aMed->GetNbMeshes();
- TMeshMap& aMeshMap = myMeshMap;
+ VISU::TMeshMap& aMeshMap = myMeshMap;
INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
#ifndef _DEXCEPT_
try{
#endif
- TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
std::string aMeshName = aMeshInfo->GetName();
- TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
if(anIter == aMeshMap.end())
continue;
- PMEDMesh aMesh = anIter->second;
+ VISU::PMEDMesh aMesh = anIter->second;
INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
#ifndef _DEXCEPT_
void
BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
const MED::TGeom2Gauss& theGeom2Gauss,
- TMinMaxArr& theMinMaxArr,
+ VISU::TMinMaxArr& theMinMaxArr,
TInt theNbComp,
TInt theNbComp2)
{
typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
for(TInt iComp = 0; iComp < theNbComp; iComp++){
const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
- TMinMax& aMinMax = theMinMaxArr[iComp+1];
+ VISU::TMinMax& aMinMax = theMinMaxArr[iComp+1];
vtkFloatingPointType& aMin = aMinMax.first;
vtkFloatingPointType& aMax = aMinMax.second;
for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
}
// To calculate min/max per vector modulus
- TMinMax& aMinMax = theMinMaxArr[0];
+ VISU::TMinMax& aMinMax = theMinMaxArr[0];
vtkFloatingPointType& aMin = aMinMax.first;
vtkFloatingPointType& aMax = aMinMax.second;
for(TInt iElem = 0; iElem < aNbElem; iElem++){
return this;
TSetIsDone aSetIsDone(myIsMinMaxDone);
- TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
TInt aNbMeshes = aMed->GetNbMeshes();
- TMeshMap& aMeshMap = myMeshMap;
+ VISU::TMeshMap& aMeshMap = myMeshMap;
INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
#ifndef _DEXCEPT_
try{
#endif
- TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
std::string aMeshName = aMeshInfo->GetName();
- TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
if(anIter == aMeshMap.end())
continue;
- PMEDMesh aMesh = anIter->second;
+ VISU::PMEDMesh aMesh = anIter->second;
#ifndef _DEXCEPT_
try{
MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
for(TInt iField = 1; iField <= aNbFields; iField++){
- TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
std::string aFieldName = aFieldInfo->GetName();
INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
if(aNbTimeStamps < 1)
continue;
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- PMEDField aField = aFieldMap[aFieldName];
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ VISU::PMEDField aField = aFieldMap[aFieldName];
TInt aNbComp = aField->myNbComp;
int aNbComp2 = aNbComp;
else if(aNbComp > 4)
aNbComp2 = 3;
- TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
+ VISU::TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
- TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
#ifndef _DEXCEPT_
return this;
TSetIsDone aSetIsDone(myIsGroupsDone);
- TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
TInt aNbMeshes = aMed->GetNbMeshes();
- TMeshMap& aMeshMap = myMeshMap;
+ VISU::TMeshMap& aMeshMap = myMeshMap;
INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
#ifndef _DEXCEPT_
try{
#endif
- TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
std::string aMeshName = aMeshInfo->GetName();
- TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
+ VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
if(anIter == aMeshMap.end())
continue;
- PMEDMesh aMesh = anIter->second;
+ VISU::PMEDMesh aMesh = anIter->second;
INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
VISU::PMeshOnEntityImpl theMeshOnEntity)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- const TEntity& anEntity = theMeshOnEntity->myEntity;
+ const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
- if(anEntity == NODE_ENTITY){
+ if(anEntity == VISU::NODE_ENTITY){
isPointsUpdated += LoadPoints(aMed,theMesh);
}else{
isPointsUpdated += LoadPoints(aMed,theMesh);
VISU::PMeshOnEntityImpl theMeshOnEntity,
VISU::PFamilyImpl theFamily)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- const TEntity& anEntity = theMeshOnEntity->myEntity;
+ const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
- if(anEntity == NODE_ENTITY){
+ if(anEntity == VISU::NODE_ENTITY){
isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily);
}else{
isPointsUpdated += LoadPoints(aMed,theMesh);
::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
const VISU::TFamilySet& theFamilySet)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
- TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
+ VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
- PMEDFamily aFamily = *aFamilyIter;
- const TEntity& anEntity = aFamily->myEntity;
- const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+ VISU::PMEDFamily aFamily = *aFamilyIter;
+ const VISU::TEntity& anEntity = aFamily->myEntity;
+ const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
isPointsUpdated += LoadPoints(aMed,theMesh);
- if(anEntity == NODE_ENTITY){
+ if(anEntity == VISU::NODE_ENTITY){
isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily);
}else{
isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily);
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- const TEntity& anEntity = theMeshOnEntity->myEntity;
+ const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
isPointsUpdated += LoadPoints(aMed,theMesh);
- if(anEntity != NODE_ENTITY)
+ if(anEntity != VISU::NODE_ENTITY)
isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
int isFieldUpdated = LoadValForTimeOnMesh(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- const TEntity& anEntity = theMeshOnEntity->myEntity;
+ const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
- if(anEntity != NODE_ENTITY)
+ if(anEntity != VISU::NODE_ENTITY)
isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
int isFieldUpdated = LoadValForTimeOnGaussPts(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
::LoadPoints(const MED::PWrapper& theMed,
VISU::PMEDMesh theMesh)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
try{
//Check on existing family
- PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+ VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
aMeshOnEntity->myMeshName = theMesh->myName;
- aMeshOnEntity->myEntity = NODE_ENTITY;
+ aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
//Main part of code
MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
TInt aNbElem = aNodeInfo->GetNbElem();
- TInt aDim = theMesh->myDim;
- PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
- TMEDNamedPointCoords& aCoords = aNamedPointCoords;
- aCoords.Init(aNodeInfo, theMed->GetVersion());
-
- for(int iDim = 0; iDim < aDim; iDim++)
- aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
-
- for(int iElem = 0; iElem < aNbElem; iElem++){
- TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
- MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
- for(int iDim = 0; iDim < aDim; iDim++)
- aVCoordSlice[iDim] = aMCoordSlice[iDim];
- }
+ VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+ aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
- TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
- PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+ VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+ VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
- aSubMesh->Init(MED::PElemInfo(aNodeInfo),theMed->GetVersion());
+ aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
aSubMesh->myNbCells = theMesh->myNbPoints;
aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
for (int iElem = 0; iElem < aNbElem; iElem++)
aCell2Connect[iElem] = VISU::TConnect(1,iElem);
//Main part of code
MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
TInt aNbElem = aGrilleInfo->GetNbNodes();
- TInt aDim = theMesh->myDim;
- PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
- TMEDNamedPointCoords& aCoords = aNamedPointCoords;
- aCoords.Init(aGrilleInfo);
+ VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+ aNamedPointCoords->Init(aGrilleInfo);
- for(int iDim = 0; iDim < aDim; iDim++)
- aCoords.GetName(iDim) = aGrilleInfo->GetCoordName(iDim);
-
- for(int iElem = 0; iElem < aNbElem; iElem++){
- TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
- MED::TNodeCoord aMCoord = aGrilleInfo->GetCoord(iElem);
- for(int iDim = 0; iDim < aDim; iDim++){
- aVCoordSlice[iDim] = aMCoord[iDim];
- }
- }
-
- TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
- PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+ VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+ VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
aSubMesh->Init(aGrilleInfo);
aSubMesh->myNbCells = theMesh->myNbPoints;
aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
- for (int iElem = 0; iElem < aNbElem; iElem++)
+ for(int iElem = 0; iElem < aNbElem; iElem++)
aCell2Connect[iElem] = VISU::TConnect(1,iElem);
}
const VISU::PMEDMesh theMesh,
const VISU::PMEDFamily theFamily)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
try{
if(theFamily->myIsDone)
return 0;
MED::EMaillage aType = aMeshInfo->GetType();
//Main part of code
- if(aType==MED::eNON_STRUCTURE){
+ if(aType == MED::eNON_STRUCTURE){
MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
TInt aNbElem = aNodeInfo->GetNbElem();
if(aNbElem > 0){
TInt anId = theFamily->myId;
- TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+ VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
for(TInt iElem = 0; iElem < aNbElem; iElem++)
if(aNodeInfo->GetFamNum(iElem) == anId)
aSubMeshID.push_back(iElem);
if(aNbElem > 0){
TInt anId = theFamily->myId;
- TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+ VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
for(TInt iElem = 0; iElem < aNbElem; iElem++)
if(aGrilleInfo->GetFamNumNode(iElem) == anId)
aSubMeshID.push_back(iElem);
const VISU::PMEDMesh theMesh,
const VISU::PMEDMeshOnEntity theMeshOnEntity)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
#ifndef _DEXCEPT_
try{
#endif
- const TEntity& aVEntity = theMeshOnEntity->myEntity;
+ const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
- TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+ VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
TInt aNbElem = aGrilleInfo->GetNbCells();
if(aNbElem > 0){
- PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+ VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
aSubMesh->Init(aGrilleInfo);
aSubMesh->myNbCells = aNbElem;
aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
- TVector<TInt> aConnect(aMNbNodes);
+ VISU::TVector<TInt> aConnect(aMNbNodes);
for(TInt iElem = 0; iElem < aNbElem; iElem++) {
MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
- TConnect& anArray = aCell2Connect[iElem];
+ VISU::TConnect& anArray = aCell2Connect[iElem];
anArray.resize(aVNbNodes);
if(anIsNodeNum){
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
- TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+ VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
TInt aNbElem = aPolygoneInfo->GetNbElem();
if(aNbElem > 0){
- PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+ VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
aSubMesh->myNbCells = aNbElem;
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
for(TInt iElem = 0; iElem < aNbElem; iElem++) {
MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
aSubMesh->myCellsSize += aNbConn;
- TConnect& anArray = aCell2Connect[iElem];
+ VISU::TConnect& anArray = aCell2Connect[iElem];
anArray.resize(aNbConn);
for(TInt iConn = 0; iConn < aNbConn; iConn++)
anArray[iConn] = aConnSlice[iConn] - 1;
TInt aNbElem = aPolyedreInfo->GetNbElem();
if(aNbElem > 0){
- PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+ VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
aSubMesh->myNbCells = aNbElem;
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
for(TInt iElem = 0; iElem < aNbElem; iElem++){
MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
- TConnect& anArray = aCell2Connect[iElem];
+ VISU::TConnect& anArray = aCell2Connect[iElem];
typedef std::set<TInt> TConnectSet;
TConnectSet aConnectSet;
TInt aNbFaces = aConnSliceArr.size();
TInt aNbElem = aCellInfo->GetNbElem();
if(aNbElem > 0){
- PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+ VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
aSubMesh->myNbCells = aNbElem;
aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
aCell2Connect.resize(aNbElem);
TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
- TVector<TInt> aConnect(aMNbNodes);
+ VISU::TVector<TInt> aConnect(aMNbNodes);
for(TInt iElem = 0; iElem < aNbElem; iElem++) {
MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
- TConnect& anArray = aCell2Connect[iElem];
+ VISU::TConnect& anArray = aCell2Connect[iElem];
anArray.resize(aVNbNodes);
if(anIsNodeNum){
const VISU::PMEDMeshOnEntity theMeshOnEntity,
const VISU::PMEDFamily theFamily)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
#ifndef _DEXCEPT_
try{
#endif
- const TEntity& aVEntity = theMeshOnEntity->myEntity;
+ const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
TInt anId = theFamily->myId;
const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
- TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+ VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
MED::EMaillage aType = aMeshInfo->GetType();
const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
}}
if(anElemInfo){
if(TInt aNbElem = anElemInfo->GetNbElem()){
- TSubMeshID aSubMeshID;
+ VISU::TSubMeshID aSubMeshID;
for(TInt iElem = 0; iElem < aNbElem; iElem++)
if(anElemInfo->GetFamNum(iElem) == anId)
aSubMeshID.push_back(iElem);
if(!aSubMeshID.empty()){
VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
- aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+ aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
}
}
}
if(anElemInfo){
TInt aNbElem = anElemInfo->GetNbCells();
if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
- TSubMeshID aSubMeshID;
+ VISU::TSubMeshID aSubMeshID;
for(TInt iElem = 0; iElem < aNbElem; iElem++)
if(anElemInfo->GetFamNum(iElem) == anId)
aSubMeshID.push_back(iElem);
if(!aSubMeshID.empty()){
VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
- aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
+ aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
}
}
}
VISU::TMEDValForTime& theValForTime,
VISU::TMEDMeshOnEntity& theMeshOnEntity)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
INITMSG(MYDEBUG,"LoadProfile"<<endl);
- PMEDProfile aProfile = theValForTime.myProfile;
+ VISU::PMEDProfile aProfile = theValForTime.myProfile;
if(aProfile->myIsDone)
return;
- const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
for(; anIter != aGeom2Profile.end(); anIter++){
MED::EGeometrieElement aMGeom = anIter->first;
VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
- TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+ VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
if(anIter2 != aGeom2SubProfile.end()){
- PMEDSubProfile aSubProfile = anIter2->second;
+ VISU::PMEDSubProfile aSubProfile = anIter2->second;
MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
if(!anElemNum.empty()){
- TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+ VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
TInt aSize = anElemNum.size();
aSubMeshID.resize(aSize);
for(TInt anId = 0; anId < aSize; anId++)
{
const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
- TEntity aVEntity = theMeshOnEntity.myEntity;
+ VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
- const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+ const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
for(; anIter != aGeom2SubProfile.end(); anIter++){
- const PMEDSubProfile& aSubProfile = anIter->second;
+ const VISU::PMEDSubProfile& aSubProfile = anIter->second;
MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
MED::PElemInfo anElemInfo;
anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
VISU::TMEDValForTime& theValForTime,
VISU::TMEDMeshOnEntity& theMeshOnEntity)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
// this part of code must be reimplemented in connection with GRILLE structures
if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
- EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+ EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
- PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
+ VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
if(!aGaussMesh || aGaussMesh->myIsDone)
return;
const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
- TEntity aVEntity = theMeshOnEntity.myEntity;
+ VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
- const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+ const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
- TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
+ VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
- PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
+ VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
VISU::EGeometry aEGeom = aSubMeshIter->first;
if(aGaussSubMesh->myIsDone)
continue;
- PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
- const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+ VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+ const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
MED::PPolygoneInfo aPolygoneInfo;
MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
if(aGaussIter != aGeom2Gauss.end()){
- PMEDGauss aGauss = aGaussSubMesh->myGauss;
+ VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
if(aGaussInfo){
aName = aGaussInfo->GetName();
}
if(anIsGaussCoord3D){
- TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
- TMEDGaussCoordHolder* aCoordHolder = new TMEDGaussCoordHolder();
+ VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+ VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
aCoordHolder->Init(aGaussCoordPtr);
- aCoords.Init(PCoordHolder(aCoordHolder));
+ aCoords.Init(VISU::PCoordHolder(aCoordHolder));
aGaussSubMesh->myIsDone = true;
"; aNbCells = "<<aNbCells<<
endl);
}else
- EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+ EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
}
aGaussMesh->myIsDone = true;
template<class TimeStampValueType>
void
FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
- const TGeom2SubProfile& theGeom2SubProfile,
+ const VISU::TGeom2SubProfile& theGeom2SubProfile,
VISU::PMEDValForTime theValForTime,
VISU::PMEDField theField)
{
theField->myDataSize = 0;
TInt aNbComp = theField->myNbComp;
- TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
+ VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
for(; anIter != theGeom2SubProfile.end(); anIter++){
VISU::EGeometry aEGeom = anIter->first;
- PMEDSubProfile aSubProfile(anIter->second);
+ VISU::PMEDSubProfile aSubProfile(anIter->second);
TInt aNbElem = aSubProfile->myNbCells;
theField->myDataSize += aNbElem * aNbComp;
- if(aSubProfile->myStatus != eRemoveAll){
+ if(aSubProfile->myStatus != VISU::eRemoveAll){
TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
INITMSG(MYDEBUG,
"; aNbGauss = "<<aNbGauss<<
endl);
- PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+ VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
typedef typename TimeStampValueType::TElement TElement;
- typedef TTMEDMeshValue<TElement> TVMeshValue;
+ typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
TVMeshValue* aMeshValue = new TVMeshValue();
MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
bool theIsGauss,
bool& theIsDone)
{
- TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
+ VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
//Check on loading already done
theValForTime,
theMeshOnEntity);
- PMEDProfile aProfile = theValForTime->myProfile;
- TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ VISU::PMEDProfile aProfile = theValForTime->myProfile;
+ VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
INITMSGA(MYDEBUG,0,
"- aMeshName = '"<<aMeshName<<"'"<<
VISU::PMEDField theField,
VISU::PMEDValForTime theValForTime)
{
- PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
+ VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
return LoadValForTime(theMed,
theMesh,
theMeshOnEntity,
theField,
theValForTime,
false,
- anIDMapperFilter->myIsVTKDone);
+ anUnstructuredGridIDMapper->myIsVTKDone);
}
VISU::PMEDField theField,
VISU::PMEDValForTime theValForTime)
{
- PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
+ VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
return LoadValForTime(theMed,
theMesh,
theMeshOnEntity,
#define VISU_MedConvertor_HeaderFile
#include "VISU_Convertor_impl.hxx"
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
#include "MED_Common.hxx"
#include "MED_Structures.hxx"
{
MED::EBooleen myIsElemNum; //!< Keeps whether the numeration exists or not
MED::PElemNum myElemNum; //!< Keeps objects numeration
- TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
+ mutable TObj2VTKID myObj2VTKID; //!< Keeps mapping from object number to VTK one
MED::EVersion myVersion;
MED::PString myElemNames; //!< Keeps whether the names exists or not
unsigned long int
GetMemorySize();
};
- typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
+ typedef MED::SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
//---------------------------------------------------------------
MED::PMeshInfo myMeshInfo;
MED::TEntityInfo myEntityInfo;
};
- typedef SharedPtr<TMEDMesh> PMEDMesh;
+ typedef MED::SharedPtr<TMEDMesh> PMEDMesh;
//---------------------------------------------------------------
unsigned long int
GetMemorySize();
};
- typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
+ typedef MED::SharedPtr<TMEDSubProfile> PMEDSubProfile;
//---------------------------------------------------------------
struct TMEDProfile: virtual TProfileImpl
{};
- typedef SharedPtr<TMEDProfile> PMEDProfile;
+ typedef MED::SharedPtr<TMEDProfile> PMEDProfile;
//---------------------------------------------------------------
LessThan(const PGaussImpl& theGauss,
bool& theResult) const;
};
- typedef SharedPtr<TMEDGauss> PMEDGauss;
+ typedef MED::SharedPtr<TMEDGauss> PMEDGauss;
//---------------------------------------------------------------
unsigned long int
GetMemorySize();
};
- typedef SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
+ typedef MED::SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
//---------------------------------------------------------------
struct TMEDGaussMesh: virtual TGaussMeshImpl
{};
- typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
+ typedef MED::SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
//---------------------------------------------------------------
unsigned long int
GetMemorySize();
};
- typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
+ typedef MED::SharedPtr<TMEDSubMesh> PMEDSubMesh;
//---------------------------------------------------------------
TFamilyID2CellsSize myFamilyID2CellsSize;
MED::TGeom2Size myGeom2Size;
};
- typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+ typedef MED::SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
//---------------------------------------------------------------
struct TMEDFamily: virtual TFamilyImpl
{};
- typedef SharedPtr<TMEDFamily> PMEDFamily;
+ typedef MED::SharedPtr<TMEDFamily> PMEDFamily;
//---------------------------------------------------------------
struct TMEDGroup: virtual TGroupImpl
{};
- typedef SharedPtr<TMEDGroup> PMEDGroup;
+ typedef MED::SharedPtr<TMEDGroup> PMEDGroup;
//---------------------------------------------------------------
struct TMEDField: virtual TFieldImpl
{};
- typedef SharedPtr<TMEDField> PMEDField;
+ typedef MED::SharedPtr<TMEDField> PMEDField;
//---------------------------------------------------------------
struct TMEDValForTime: virtual TValForTimeImpl
{};
- typedef SharedPtr<TMEDValForTime> PMEDValForTime;
+ typedef MED::SharedPtr<TMEDValForTime> PMEDValForTime;
}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:
+// Author:
+// Module : VISU
+
+#include "VISU_MeshValue.hxx"
+#include "VISU_Structures_impl.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include "VISU_PointCoords.hxx"
+#include "VISU_TypeList.hxx"
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+
+#include <vtkCharArray.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkShortArray.h>
+#include <vtkUnsignedShortArray.h>
+#include <vtkIntArray.h>
+#include <vtkUnsignedIntArray.h>
+#include <vtkLongArray.h>
+#include <vtkUnsignedLongArray.h>
+#include <vtkFloatArray.h>
+#include <vtkDoubleArray.h>
+
+#include <string>
+#include <algorithm>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ std::string
+ GenerateFieldName(const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime)
+ {
+ const VISU::TTime& aTime = theValForTime->myTime;
+ std::string aFieldName = theField->myMeshName + ", " + theField->myName + ": " +
+ VISU_Convertor::GenerateName(aTime);
+ return aFieldName;
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ TMeshValueBase
+ ::Init(vtkIdType theNbElem,
+ vtkIdType theNbGauss,
+ vtkIdType theNbComp)
+ {
+ myNbElem = theNbElem;
+ myNbGauss = theNbGauss;
+ myNbComp = theNbComp;
+ myStep = theNbComp*theNbGauss;
+ }
+
+ vtkIdType
+ TMeshValueBase
+ ::GetNbElem() const
+ {
+ return myNbElem;
+ }
+
+ vtkIdType
+ TMeshValueBase
+ ::GetNbComp() const
+ {
+ return myNbComp;
+ }
+
+ vtkIdType
+ TMeshValueBase
+ ::GetNbGauss() const
+ {
+ return myNbGauss;
+ }
+
+ size_t
+ TMeshValueBase
+ ::size() const
+ {
+ return myNbElem * myStep;
+ }
+
+
+ namespace TL
+ {
+ //----------------------------------------------------------------------------
+ typedef TList<char,
+ TList<unsigned char,
+ TList<short,
+ TList<unsigned short,
+ TList<int,
+ TList<unsigned int,
+ TList<long,
+ TList<unsigned long,
+ TList<float,
+ TList<double,
+ TNullType> > > > > > > > > >
+ TVTKBasicTypeList;
+
+
+ //----------------------------------------------------------------------------
+ typedef TList<vtkCharArray,
+ TList<vtkUnsignedCharArray,
+ TList<vtkShortArray,
+ TList<vtkUnsignedShortArray,
+ TList<vtkIntArray,
+ TList<vtkUnsignedIntArray,
+ TList<vtkLongArray,
+ TList<vtkUnsignedLongArray,
+ TList<vtkFloatArray,
+ TList<vtkDoubleArray,
+ TNullType> > > > > > > > > >
+ TVTKArrayTypeList;
+
+
+ typedef TList<TInt2Type<VTK_CHAR>,
+ TList<TInt2Type<VTK_UNSIGNED_CHAR>,
+ TList<TInt2Type<VTK_SHORT>,
+ TList<TInt2Type<VTK_UNSIGNED_SHORT>,
+ TList<TInt2Type<VTK_INT>,
+ TList<TInt2Type<VTK_UNSIGNED_INT>,
+ TList<TInt2Type<VTK_LONG>,
+ TList<TInt2Type<VTK_UNSIGNED_LONG>,
+ TList<TInt2Type<VTK_FLOAT>,
+ TList<TInt2Type<VTK_DOUBLE>,
+ TNullType> > > > > > > > > >
+ TVTKBasicEnumList;
+
+
+ //----------------------------------------------------------------------------
+ template <unsigned int type_enum>
+ struct TEnum2VTKBasicType
+ {
+ typedef typename TTypeAt<TVTKBasicTypeList, TIndexOf<TVTKBasicEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
+ };
+
+ //----------------------------------------------------------------------------
+ template <unsigned int type_enum>
+ struct TEnum2VTKArrayType
+ {
+ typedef typename TTypeAt<TVTKArrayTypeList, TIndexOf<TVTKBasicEnumList, TInt2Type<type_enum> >::value >::TResult TResult;
+ };
+
+ //----------------------------------------------------------------------------
+ template <class T>
+ struct TVTKBasicType2Enum
+ {
+ typedef typename TTypeAt<TVTKBasicEnumList, TIndexOf<TVTKBasicTypeList, T>::value >::TResult TResult;
+ };
+
+ }
+
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ void
+ InitTimeStampOnProfile(const PUnstructuredGrid& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime,
+ const VISU::TEntity& theEntity);
+
+
+ //----------------------------------------------------------------------------
+ void
+ GetTimeStampOnProfile(const PUnstructuredGrid& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime,
+ const VISU::TEntity& theEntity)
+ {
+ vtkIdType aDataType = theField->GetDataType();
+ switch(aDataType){
+ case VTK_DOUBLE:
+ InitTimeStampOnProfile<VTK_DOUBLE>(theSource, theField, theValForTime, theEntity);
+ break;
+ case VTK_FLOAT:
+ InitTimeStampOnProfile<VTK_FLOAT>(theSource, theField, theValForTime, theEntity);
+ break;
+ case VTK_INT:
+ InitTimeStampOnProfile<VTK_INT>(theSource, theField, theValForTime, theEntity);
+ break;
+ case VTK_LONG:
+ InitTimeStampOnProfile<VTK_LONG>(theSource, theField, theValForTime, theEntity);
+ break;
+ default:
+ EXCEPTION(std::runtime_error,
+ "GetTimeStampOnProfile - handling unsupported data type - "<<aDataType);
+ }
+ }
+
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ struct TDataArrayHolder
+ {
+ typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+ typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+ TVTKDataArray* myDataArray;
+
+ TDataArrayHolder(TVTKDataArray* theDataArray):
+ myDataArray(theDataArray)
+ {}
+
+ void
+ WritePointer(TVTKDataArray* theDataArray,
+ vtkIdType theTupleId,
+ TVTKBasicType* thePointer)
+ {
+ vtkIdType aNumberOfComponents = theDataArray->GetNumberOfComponents();
+ vtkIdType aPosition = theTupleId * aNumberOfComponents;
+ TVTKBasicType *aPtr = theDataArray->WritePointer(aPosition, aNumberOfComponents);
+ for(vtkIdType anId = 0; anId < aNumberOfComponents; anId++)
+ *aPtr++ = *thePointer++;
+ }
+
+ virtual
+ void
+ SetTuple(vtkIdType theTupleId,
+ TVTKBasicType* thePointer)
+ {
+ this->WritePointer(myDataArray, theTupleId, thePointer);
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ struct TDataArrayHolder2: TDataArrayHolder<EDataType>
+ {
+ typedef TDataArrayHolder<EDataType> TSuperClass;
+ typedef typename TSuperClass::TVTKDataArray TVTKDataArray;
+ typedef typename TSuperClass::TVTKBasicType TVTKBasicType;
+ TVTKDataArray* myDataArray2;
+
+ TDataArrayHolder2(TVTKDataArray* theDataArray,
+ TVTKDataArray* theDataArray2):
+ TSuperClass(theDataArray),
+ myDataArray2(theDataArray2)
+ {}
+
+ virtual
+ void
+ SetTuple(vtkIdType theTupleId,
+ TVTKBasicType* thePointer)
+ {
+ this->WritePointer(this->myDataArray, theTupleId, thePointer);
+ this->WritePointer(this->myDataArray2, theTupleId, thePointer);
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ struct TTimeStampOnProfileInitArray
+ {
+ typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+ typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+ typedef TTMeshValue<TVTKBasicType> TMeshValue;
+ typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+ typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+ typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+ PDataArrayHolder myDataArrayHolder;
+
+ TTimeStampOnProfileInitArray(const PDataArrayHolder& theDataArrayHolder):
+ myDataArrayHolder(theDataArrayHolder)
+ {}
+
+ void
+ Execute(const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime)
+ {
+ vtkIdType aNbComp = theField->myNbComp;
+ vtkIdType aSize = std::max(3, aNbComp);
+ TVector<TVTKBasicType> aDataValues(aSize);
+
+ const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+ TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
+ for(int aTupleId = 0; anIter != aGeom2MeshValue.end(); anIter++){
+ EGeometry aEGeom = anIter->first;
+ const TMeshValuePtr aMeshValue = anIter->second;
+
+ vtkIdType aNbElem = aMeshValue->GetNbElem();
+ vtkIdType aNbGauss = aMeshValue->GetNbGauss();
+
+ INITMSG(MYDEBUG,
+ "- aEGeom = "<<aEGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ std::endl);
+
+ for(vtkIdType iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
+ typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetCompValueSliceArr(iElem);
+ for(vtkIdType iComp = 0; iComp < aNbComp; iComp++){
+ const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
+ aDataValues[iComp] = TVTKBasicType();
+ for(vtkIdType iGauss = 0; iGauss < aNbGauss; iGauss++){
+ aDataValues[iComp] += aValueSlice[iGauss];
+ }
+ aDataValues[iComp] /= aNbGauss;
+ }
+ this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
+ }
+ }
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ void
+ InitTimeStampOnProfile(const PUnstructuredGrid& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime,
+ const VISU::TEntity& theEntity)
+ {
+ vtkIdType aNbTuples = theField->myDataSize / theField->myNbComp;
+ std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
+
+ vtkDataSetAttributes* aDataSetAttributes;
+ switch(theEntity){
+ case VISU::NODE_ENTITY :
+ aDataSetAttributes = theSource->GetPointData();
+ break;
+ default:
+ aDataSetAttributes = theSource->GetCellData();
+ }
+
+ typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+ TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
+ vtkIdType aNbComp = theField->myNbComp;
+ switch(aNbComp) {
+ case 1:
+ aSelectedDataArray->SetNumberOfComponents(1);
+ aDataSetAttributes->SetScalars(aSelectedDataArray);
+ break;
+ default:
+ aSelectedDataArray->SetNumberOfComponents(3);
+ aDataSetAttributes->SetVectors(aSelectedDataArray);
+ }
+ aSelectedDataArray->SetNumberOfTuples(aNbTuples);
+ aSelectedDataArray->SetName(aFieldName.c_str());
+
+ TVTKDataArray *aFullDataArray = TVTKDataArray::New();
+ aFullDataArray->SetNumberOfComponents(aNbComp);
+ aFullDataArray->SetNumberOfTuples(aNbTuples);
+ aFullDataArray->SetName("VISU_FIELD");
+ aDataSetAttributes->AddArray(aFullDataArray);
+
+ INITMSG(MYDEBUG,"InitTimeStampOnProfile "<<
+ "- theEntity = "<<theEntity<<
+ "; aNbTuples = "<<aNbTuples<<
+ "; aNbComp = "<<aNbComp<<
+ std::endl);
+ TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnProfile");
+
+ const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+ typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+ typedef TTMeshValue<TVTKBasicType> TMeshValue;
+ typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+ typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+ typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+
+ TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
+ if(aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1){
+ aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
+ aMeshValue->size(),
+ true);
+ INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<<std::endl);
+ if(aNbComp == 1){
+ aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
+ aMeshValue->size(),
+ true);
+ INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<<std::endl);
+ }else{
+ PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
+ TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+ }
+ }else{
+ typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
+ PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
+ TTimeStampOnProfileInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+ }
+
+ aSelectedDataArray->Delete();
+ aFullDataArray->Delete();
+ }
+
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ void
+ InitTimeStampOnGaussMesh(const PPolyData& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime);
+
+ void
+ GetTimeStampOnGaussMesh(const PPolyData& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime)
+ {
+ vtkIdType aDataType = theField->GetDataType();
+ switch(aDataType){
+ case VTK_DOUBLE:
+ InitTimeStampOnGaussMesh<VTK_DOUBLE>(theSource, theField, theValForTime);
+ break;
+ case VTK_FLOAT:
+ InitTimeStampOnGaussMesh<VTK_FLOAT>(theSource, theField, theValForTime);
+ break;
+ case VTK_INT:
+ InitTimeStampOnGaussMesh<VTK_INT>(theSource, theField, theValForTime);
+ break;
+ case VTK_LONG:
+ InitTimeStampOnGaussMesh<VTK_LONG>(theSource, theField, theValForTime);
+ break;
+ default:
+ EXCEPTION(std::runtime_error,
+ "GetTimeStampOnGaussMesh - handling unsupported data type - "<<aDataType);
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ template<int EDataType>
+ struct TTimeStampOnGaussMeshInitArray
+ {
+ typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+ typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+ typedef TTMeshValue<TVTKBasicType> TMeshValue;
+ typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+ typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+ typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+ PDataArrayHolder myDataArrayHolder;
+
+ TTimeStampOnGaussMeshInitArray(const PDataArrayHolder& theDataArrayHolder):
+ myDataArrayHolder(theDataArrayHolder)
+ {}
+
+ void
+ Execute(const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime)
+ {
+ vtkIdType aNbComp = theField->myNbComp;
+ vtkIdType aSize = std::max(3, aNbComp);
+ TVector<TVTKBasicType> aDataValues(aSize);
+
+ const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+
+ PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh;
+ const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+ TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+ for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
+ EGeometry aEGeom = anIter->first;
+
+ PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+ if(!aGaussSubMesh->myIsDone)
+ continue;
+
+ TGeom2MeshValue::const_iterator anIter2 = aGeom2MeshValue.find(aEGeom);
+ if(anIter2 == aGeom2MeshValue.end()){
+ EXCEPTION(std::runtime_error,
+ "TTimeStampOnGaussMeshInitArray >> Can't find values for corresponding Gauss Points SubMesh");
+ }
+ TMeshValuePtr aMeshValue = anIter2->second;
+ vtkIdType aNbGauss = aMeshValue->GetNbGauss();
+ vtkIdType aNbElem = aMeshValue->GetNbElem();
+
+ if(aNbGauss < 1)
+ continue;
+
+ const TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+
+ INITMSG(MYDEBUG,
+ "- aEGeom = "<<aEGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aCoords.GetNbPoints() = "<<aCoords.GetNbPoints()<<
+ std::endl);
+
+ if(aCoords.GetNbPoints() == aNbElem*aNbGauss){
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
+ const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ aDataValues[iComp] = aValueSlice[iComp];
+ }
+ this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
+ }
+ }
+ }else{
+ for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
+ typename TMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue->GetCompValueSliceArr(iElem);
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ const typename TMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iComp];
+ aDataValues[iComp] = TVTKBasicType();
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ aDataValues[iComp] += aValueSlice[iGauss];
+ }
+ aDataValues[iComp] /= aNbGauss;
+ }
+ this->myDataArrayHolder->SetTuple(aTupleId, &aDataValues[0]);
+ }
+ }
+ }
+ }
+ };
+
+
+ template<int EDataType>
+ void
+ InitTimeStampOnGaussMesh(const PPolyData& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime)
+ {
+ vtkIdType aNbTuples = theSource->GetNumberOfPoints();
+ std::string aFieldName = VISU::GenerateFieldName(theField, theValForTime);
+
+ vtkDataSetAttributes* aDataSetAttributes = theSource->GetPointData();
+
+ typedef typename TL::TEnum2VTKArrayType<EDataType>::TResult TVTKDataArray;
+ TVTKDataArray *aSelectedDataArray = TVTKDataArray::New();
+ vtkIdType aNbComp = theField->myNbComp;
+ switch(aNbComp){
+ case 1:
+ aSelectedDataArray->SetNumberOfComponents(1);
+ aDataSetAttributes->SetScalars(aSelectedDataArray);
+ break;
+ default:
+ aSelectedDataArray->SetNumberOfComponents(3);
+ aDataSetAttributes->SetVectors(aSelectedDataArray);
+ }
+ aSelectedDataArray->SetNumberOfTuples(aNbTuples);
+ aSelectedDataArray->SetName(aFieldName.c_str());
+
+ TVTKDataArray *aFullDataArray = TVTKDataArray::New();
+ aFullDataArray->SetNumberOfComponents(aNbComp);
+ aFullDataArray->SetNumberOfTuples(aNbTuples);
+ aFullDataArray->SetName("VISU_FIELD");
+ aDataSetAttributes->AddArray(aFullDataArray);
+
+ INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh "<<
+ "- aNbTuples = "<<aNbTuples<<
+ "; aNbComp = "<<aNbComp<<
+ std::endl);
+ TTimerLog aTimerLog(MYDEBUG,"InitTimeStampOnGaussMesh");
+
+ const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue();
+ typedef typename TL::TEnum2VTKBasicType<EDataType>::TResult TVTKBasicType;
+ typedef TTMeshValue<TVTKBasicType> TMeshValue;
+ typedef MED::SharedPtr<TMeshValue> TMeshValuePtr;
+
+ typedef TDataArrayHolder<EDataType> TTDataArrayHolder;
+ typedef MED::SharedPtr<TTDataArrayHolder> PDataArrayHolder;
+
+ TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue();
+ if(aGeom2MeshValue.size() == 1){
+ aFullDataArray->SetVoidArray(aMeshValue->GetPointer(),
+ aMeshValue->size(),
+ true);
+ INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aFullDataArray->SetVoidArray()"<<std::endl);
+ if(aNbComp == 1 || aNbComp == 3){
+ aSelectedDataArray->SetVoidArray(aMeshValue->GetPointer(),
+ aMeshValue->size(),
+ true);
+ INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aSelectedDataArray->SetVoidArray()"<<std::endl);
+ }else{
+ PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray));
+ TTimeStampOnGaussMeshInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+ }
+ }else{
+ typedef TDataArrayHolder2<EDataType> TTDataArrayHolder2;
+ PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray));
+ TTimeStampOnGaussMeshInitArray<EDataType>(aDataArrayHolder).Execute(theField, theValForTime);
+ }
+
+ aSelectedDataArray->Delete();
+ aFullDataArray->Delete();
+ }
+
+
+ //---------------------------------------------------------------
+}
--- /dev/null
+// VISU CONVERTOR :
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : VISU_Convertor.hxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MeshValue_HeaderFile
+#define VISU_MeshValue_HeaderFile
+
+/*!
+ \file VISU_MeshValue.hxx
+ \brief The file contains declarations for basic interfaces that defines mesh value of mesh elements
+*/
+
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorDef_impl.hxx"
+
+#include "MED_SliceArray.hxx"
+#include "MED_Vector.hxx"
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ //! Define a base class for the container to get access to data assigned to mesh
+ class TMeshValueBase
+ {
+ public:
+ //! To intitilize the data strucutre
+ void
+ Init(vtkIdType theNbElem,
+ vtkIdType theNbGauss,
+ vtkIdType theNbComp);
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize() const = 0;
+
+ //! Gets number of mesh elements where the data assigned to.
+ vtkIdType
+ GetNbElem() const;
+
+ //! Gets number of components of corresponding MED FIELD.
+ vtkIdType
+ GetNbComp() const;
+
+ //! Gets number of Gauss Points.
+ vtkIdType
+ GetNbGauss() const;
+
+ size_t
+ size() const;
+
+ protected:
+ vtkIdType myNbElem; //!< Defines number of mesh elements where the data assigned to
+ vtkIdType myNbComp; //!< Keeps number of components of corresponding MED FIELD
+ vtkIdType myNbGauss; //!< Defines number of Gauss Points
+ vtkIdType myStep; //!< Internal variable
+ };
+ typedef MED::SharedPtr<TMeshValueBase> PMeshValue;
+
+
+ //---------------------------------------------------------------
+ //! Define a container to get access to data assigned to mesh
+ template<class TValueType>
+ class TTMeshValue: public virtual TMeshValueBase
+ {
+ public:
+ typedef MED::TSlice<TValueType> TValueSlice;
+ typedef MED::TCSlice<TValueType> TCValueSlice;
+
+ typedef TVector<TCValueSlice> TCValueSliceArr;
+ typedef TVector<TValueSlice> TValueSliceArr;
+
+ virtual
+ const TValueType*
+ GetPointer() const = 0;
+
+ virtual
+ TValueType*
+ GetPointer() = 0;
+
+ //! To get assigned values first by Gauss Points and then by components (constant version)
+ TCValueSliceArr
+ GetGaussValueSliceArr(vtkIdType theElemId) const
+ {
+ TCValueSliceArr aValueSliceArr(this->myNbGauss);
+ vtkIdType anId = theElemId * this->myStep;
+ for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TCValueSlice(this->GetPointer(),
+ this->size(),
+ std::slice(anId, this->myNbComp, 1));
+ anId += this->myNbComp;
+ }
+ return aValueSliceArr;
+ }
+
+ //! To get assigned values first by Gauss Points and then by components
+ TValueSliceArr
+ GetGaussValueSliceArr(vtkIdType theElemId)
+ {
+ TValueSliceArr aValueSliceArr(this->myNbGauss);
+ vtkIdType anId = theElemId * this->myStep;
+ for(vtkIdType aGaussId = 0; aGaussId < this->myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TValueSlice(this->GetPointer(),
+ this->size(),
+ std::slice(anId, this->myNbComp, 1));
+ anId += this->myNbComp;
+ }
+ return aValueSliceArr;
+ }
+
+ //! To get assigned values first by components and then by Gauss Points (constant version)
+ TCValueSliceArr
+ GetCompValueSliceArr(vtkIdType theElemId) const
+ {
+ TCValueSliceArr aValueSliceArr(this->myNbComp);
+ vtkIdType anId = theElemId * this->myStep;
+ for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
+ aValueSliceArr[aCompId] =
+ TCValueSlice(this->GetPointer(),
+ this->size(),
+ std::slice(anId, this->myNbGauss, this->myNbComp));
+ anId += 1;
+ }
+ return aValueSliceArr;
+ }
+
+ //! To get assigned values first by components and then by Gauss Points
+ TValueSliceArr
+ GetCompValueSliceArr(vtkIdType theElemId)
+ {
+ TValueSliceArr aValueSliceArr(this->myNbComp);
+ vtkIdType anId = theElemId * this->myStep;
+ for(vtkIdType aCompId = 0; aCompId < this->myNbComp; aCompId++){
+ aValueSliceArr[aCompId] =
+ TValueSlice(this->GetPointer(),
+ this->size(),
+ std::slice(anId, this->myNbGauss, this->myNbComp));
+ anId += 1;
+ }
+ return aValueSliceArr;
+ }
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize() const
+ {
+ return this->size() * sizeof(TValueType);
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container to get access to data assigned to mesh
+ template<class TValueType, class TContainerType>
+ class TTMeshValueHolder: public virtual TTMeshValue<TValueType>
+ {
+ public:
+ //! To initilize the class instance
+ void
+ Init(vtkIdType theNbElem,
+ vtkIdType theNbGauss,
+ vtkIdType theNbComp,
+ const TContainerType& theContainer)
+ {
+ TMeshValueBase::Init(theNbElem, theNbGauss, theNbComp);
+ myContainer = theContainer;
+ }
+
+ protected:
+ mutable TContainerType myContainer; //!< Keeps the mesh values container itself
+ };
+
+
+ //---------------------------------------------------------------
+ // Initilize corresponding vtkDataSetAttributes for TValForTime
+ void
+ GetTimeStampOnProfile(const PUnstructuredGrid& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime,
+ const VISU::TEntity& theEntity);
+
+
+ //---------------------------------------------------------------
+ // Initilize corresponding vtkDataSetAttributes for TValForTime
+ void
+ GetTimeStampOnGaussMesh(const PPolyData& theSource,
+ const PFieldImpl& theField,
+ const PValForTimeImpl& theValForTime);
+
+
+ //---------------------------------------------------------------
+}
+
+#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:
+// Author:
+// Module : VISU
+
+#include "VISU_PointCoords.hxx"
+#include "VISU_ConvertorUtils.hxx"
+
+#include <vtkPoints.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ void
+ TCoordHolderBase
+ ::Init(vtkIdType theNbPoints,
+ vtkIdType theDim)
+ {
+ myDim = theDim;
+ myNbPoints = theNbPoints;
+ }
+
+ vtkIdType
+ TCoordHolderBase
+ ::GetNbPoints() const
+ {
+ return myNbPoints;
+ }
+
+ vtkIdType
+ TCoordHolderBase
+ ::GetDim() const
+ {
+ return myDim;
+ }
+
+ size_t
+ TCoordHolderBase
+ ::size() const
+ {
+ return GetNbPoints() * GetDim();
+ }
+
+ unsigned long int
+ TCoordHolderBase
+ ::GetMemorySize()
+ {
+ return sizeof(TCoord) * size();
+ }
+
+
+ //---------------------------------------------------------------
+ TPointCoords
+ ::TPointCoords():
+ myPoints(vtkPoints::New())
+ {
+ myPoints->SetDataType(VTK_DOUBLE);
+ myPoints->Delete();
+ }
+
+ void
+ TPointCoords
+ ::Init(const PCoordHolder& theCoord)
+ {
+ myPoints->SetNumberOfPoints(theCoord->GetNbPoints());
+ myCoord = theCoord;
+ }
+
+ vtkIdType
+ TPointCoords
+ ::GetNbPoints() const
+ {
+ return myCoord->GetNbPoints();
+ }
+
+ vtkIdType
+ TPointCoords
+ ::GetDim() const
+ {
+ return myCoord->GetDim();
+ }
+
+ TCCoordSlice
+ TPointCoords
+ ::GetCoordSlice(vtkIdType theNodeId) const
+ {
+ return myCoord->GetCoordSlice(theNodeId);
+ }
+
+ TCoordSlice
+ TPointCoords
+ ::GetCoordSlice(vtkIdType theNodeId)
+ {
+ return myCoord->GetCoordSlice(theNodeId);
+ }
+
+ void
+ TPointCoords
+ ::SetVoidArray() const
+ {
+ vtkDataArray* aDataArray = myPoints->GetData();
+ aDataArray->SetVoidArray(myCoord->GetValuePtr(), myCoord->size(), true);
+ }
+
+ vtkPoints*
+ TPointCoords
+ ::GetPoints() const
+ {
+ if(!myIsVTKDone){
+ TTimerLog aTimerLog(MYDEBUG,"TPointCoords::GetPoints()");
+ vtkIdType aNbPoints = GetNbPoints();
+ vtkIdType aDim = GetDim();
+
+ INITMSG(MYDEBUG,"TPointCoords::GetPoints - aNbPoints = "<<aNbPoints<<
+ "; aDim = "<<aDim<<
+ endl);
+
+ if(GetDim() == 3){
+ INITMSG(MYDEBUG,"TPointCoords::GetPoints - SetVoidArray()"<<endl);
+ SetVoidArray();
+ }else{
+ for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
+ TCCoordSlice aSlice = GetCoordSlice(aPointId);
+
+ vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
+ for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
+ aCoords[aDimId] = aSlice[aDimId];
+
+ myPoints->SetPoint(aPointId, aCoords);
+ }
+ }
+
+ myIsVTKDone = true;
+ }
+
+ return myPoints.GetPointer();
+ }
+
+ unsigned long int
+ TPointCoords
+ ::GetMemorySize()
+ {
+ size_t aSize = myCoord->GetMemorySize();
+ aSize += myPoints->GetActualMemorySize() * 1024;
+ return aSize;
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ TNamedPointCoords
+ ::Init(const PCoordHolder& theCoord)
+ {
+ TPointCoords::Init(theCoord);
+ myPointsDim.resize(theCoord->GetDim());
+ }
+
+ std::string&
+ TNamedPointCoords
+ ::GetName(vtkIdType theDim)
+ {
+ return myPointsDim[theDim];
+ }
+
+ const std::string&
+ TNamedPointCoords
+ ::GetName(vtkIdType theDim) const
+ {
+ return myPointsDim[theDim];
+ }
+
+ vtkIdType
+ TNamedPointCoords
+ ::GetObjID(vtkIdType theID) const
+ {
+ return theID;
+ }
+
+ vtkIdType
+ TNamedPointCoords
+ ::GetVTKID(vtkIdType theID) const
+ {
+ return theID;
+ }
+
+ std::string
+ TNamedPointCoords
+ ::GetNodeName(vtkIdType theObjID) const
+ {
+ return "";
+ }
+
+
+ //---------------------------------------------------------------
+ enum ECoordName{eX, eY, eZ, eNoneCoord};
+ typedef VISU::TCoord (*TGetCoord)(const VISU::TCCoordSlice& theCoordSlice);
+
+ template<ECoordName TCoordId>
+ VISU::TCoord
+ GetCoord(const VISU::TCCoordSlice& theCoordSlice)
+ {
+ return theCoordSlice[TCoordId];
+ }
+
+ template<>
+ VISU::TCoord
+ GetCoord<eNoneCoord>(const VISU::TCCoordSlice& theCoordSlice)
+ {
+ return 0.0;
+ }
+
+
+ TGetCoord aXYZGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eY>,
+ &GetCoord<eZ>
+ };
+
+
+ TGetCoord aXYGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eY>,
+ &GetCoord<eNoneCoord>
+ };
+
+ TGetCoord aYZGetCoord[3] = {
+ &GetCoord<eNoneCoord>,
+ &GetCoord<eX>,
+ &GetCoord<eY>
+ };
+
+ TGetCoord aXZGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eNoneCoord>,
+ &GetCoord<eY>
+ };
+
+
+ TGetCoord aXGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eNoneCoord>,
+ &GetCoord<eNoneCoord>
+ };
+
+ TGetCoord aYGetCoord[3] = {
+ &GetCoord<eNoneCoord>,
+ &GetCoord<eX>,
+ &GetCoord<eNoneCoord>
+ };
+
+ TGetCoord aZGetCoord[3] = {
+ &GetCoord<eNoneCoord>,
+ &GetCoord<eNoneCoord>,
+ &GetCoord<eX>
+ };
+
+
+ class TCoordHelper{
+ TGetCoord* myGetCoord;
+ public:
+ TCoordHelper(TGetCoord* theGetCoord):
+ myGetCoord(theGetCoord)
+ {}
+
+ virtual
+ ~TCoordHelper()
+ {}
+
+ VISU::TCoord
+ GetCoord(VISU::TCCoordSlice& theCoordSlice,
+ int theCoordId)
+ {
+ return (*myGetCoord[theCoordId])(theCoordSlice);
+ }
+ };
+ typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
+
+
+ //---------------------------------------------------------------
+ vtkPoints*
+ TNamedPointCoords
+ ::GetPoints() const
+ {
+ if(!myIsVTKDone){
+ TTimerLog aTimerLog(MYDEBUG,"TNamedPointCoords::GetPoints()");
+ TCoordHelperPtr aCoordHelperPtr;
+ bool anIsDimPresent[3] = {false, false, false};
+ for(int iDim = 0; iDim < GetDim(); iDim++){
+ std::string aName = GetName(iDim);
+ if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16
+ aName = aName.substr(0,1);
+ if(aName == "x" || aName == "X")
+ anIsDimPresent[eX] = true;
+ else if(aName == "y" || aName == "Y")
+ anIsDimPresent[eY] = true;
+ else if(aName == "z" || aName == "Z")
+ anIsDimPresent[eZ] = true;
+ }
+
+ switch(GetDim()){
+ case 3:
+ aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
+ break;
+ case 2:
+ if(anIsDimPresent[eY] && anIsDimPresent[eZ])
+ aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
+ else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
+ aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
+ else
+ aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
+ break;
+ case 1:
+ if(anIsDimPresent[eY])
+ aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
+ else if(anIsDimPresent[eZ])
+ aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
+ else
+ aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
+ break;
+ }
+
+ INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - aNbPoints = "<<GetNbPoints()<<
+ "; aDim = "<<GetDim()<<
+ endl);
+
+ if(anIsDimPresent[eX] && anIsDimPresent[eY] && anIsDimPresent[eZ]){
+ INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - SetVoidArray()"<<endl);
+ SetVoidArray();
+ }else{
+ for(vtkIdType aNodeId = 0; aNodeId < GetNbPoints(); aNodeId++){
+ TCCoordSlice aCoordSlice = GetCoordSlice(aNodeId);
+ myPoints->SetPoint(aNodeId,
+ aCoordHelperPtr->GetCoord(aCoordSlice,eX),
+ aCoordHelperPtr->GetCoord(aCoordSlice,eY),
+ aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
+ }
+ }
+
+ myIsVTKDone = true;
+ }
+
+ return myPoints.GetPointer();
+ }
+
+ unsigned long int
+ TNamedPointCoords
+ ::GetMemorySize()
+ {
+ return TPointCoords::GetMemorySize();
+ }
+
+
+ //---------------------------------------------------------------
+}
--- /dev/null
+// VISU CONVERTOR :
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File : VISU_Convertor.hxx
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PointCoords_HeaderFile
+#define VISU_PointCoords_HeaderFile
+
+/*!
+ \file VISU_PointCoords.hxx
+ \brief The file contains declarations for basic interfaces that defines point coords of mesh elements
+*/
+
+#include "VISU_Convertor.hxx"
+#include "VISU_ConvertorDef_impl.hxx"
+
+#include "MED_SliceArray.hxx"
+#include "MED_Structures.hxx"
+
+#include <vtkSmartPointer.h>
+
+class vtkPoints;
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ typedef vtkSmartPointer<vtkPoints> PPoints;
+
+ typedef MED::TFloat TCoord;
+ using MED::TCoordSlice;
+ using MED::TCCoordSlice;
+
+ //---------------------------------------------------------------
+ //! This class is responsible for keeping the mesh node coordinates
+ class TCoordHolderBase: public virtual TBaseStructure
+ {
+ public:
+ //! To initilize the instance
+ void
+ Init(vtkIdType theNbPoints,
+ vtkIdType theDim);
+
+ vtkIdType
+ GetNbPoints() const;
+
+ vtkIdType
+ GetDim() const;
+
+ size_t
+ size() const;
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! Get slice of coordinates for defined node (const version)
+ virtual
+ TCCoordSlice
+ GetCoordSlice(vtkIdType theNodeId) const = 0;
+
+ //! Get slice of coordinates for defined node
+ virtual
+ TCoordSlice
+ GetCoordSlice(vtkIdType theNodeId) = 0;
+
+ virtual
+ unsigned char*
+ GetValuePtr() = 0;
+
+ protected:
+ vtkIdType myDim; //!< Dimension of the nodal coordinates
+ vtkIdType myNbPoints; //!< Number of nodes in corresponding mesh
+ };
+ typedef MED::SharedPtr<TCoordHolderBase> PCoordHolder;
+
+
+ //---------------------------------------------------------------
+ template<class TContainerType>
+ class TCoordHolder: public virtual TCoordHolderBase
+ {
+ public:
+ //! To initilize the class instance
+ void
+ Init(vtkIdType theNbPoints,
+ vtkIdType theDim,
+ const TContainerType& theCoord)
+ {
+ TCoordHolderBase::Init(theNbPoints, theDim);
+ myCoord = theCoord;
+ }
+
+ //! Gets pointer to the first element in the node coordinates array
+ virtual
+ TCoord*
+ GetPointer() = 0;
+
+ //! Gets pointer to the first element in the node coordinates array (const version)
+ virtual
+ const TCoord*
+ GetPointer() const = 0;
+
+ //! Get slice of coordinates for defined node (const version)
+ virtual
+ TCCoordSlice
+ GetCoordSlice(vtkIdType theNodeId) const
+ {
+ return TCCoordSlice(this->GetPointer(),
+ this->size(),
+ std::slice(theNodeId * this->GetDim(), this->GetDim(), 1));
+ }
+
+ //! Get slice of coordinates for defined node
+ virtual
+ TCoordSlice
+ GetCoordSlice(vtkIdType theNodeId)
+ {
+ return TCoordSlice(this->GetPointer(),
+ this->size(),
+ std::slice(theNodeId * this->GetDim(), this->GetDim(), 1));
+ }
+
+ virtual
+ unsigned char*
+ GetValuePtr()
+ {
+ return (unsigned char*)this->GetPointer();
+ }
+
+ protected:
+ mutable TContainerType myCoord; //!< Keeps the node coordinates container itself
+ };
+
+
+ //---------------------------------------------------------------
+ //! This class is responsible for representation of mesh nodes
+ class TPointCoords: public virtual TIsVTKDone
+ {
+ public:
+ TPointCoords();
+
+ //! To initilize the class
+ void
+ Init(const PCoordHolder& theCoord);
+
+ vtkIdType
+ GetNbPoints() const;
+
+ vtkIdType
+ GetDim() const;
+
+ virtual
+ vtkPoints*
+ GetPoints() const; //!< Gets corresponding VTK structure
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! Get slice of coordinates for defined node (const version)
+ TCCoordSlice
+ GetCoordSlice(vtkIdType theNodeId) const;
+
+ //! Get slice of coordinates for defined node
+ TCoordSlice
+ GetCoordSlice(vtkIdType theNodeId);
+
+ protected:
+ //! An container for coordinates of the nodes
+ /*!
+ Usage of slices allow to minimize amount of memory to store the nodal coordinates and
+ provide unifirm way of conversation with this coordinates (independant from mesh dimension)
+ */
+ PCoordHolder myCoord; //!< A pointer to the coordinates container holder
+ PPoints myPoints; //!< VTK representation for the mesh nodes
+
+ void
+ SetVoidArray() const; //!< Passes the MED node coordinates data directly to VTK
+ };
+
+
+ //---------------------------------------------------------------
+ //! This class is responsible for representation of mesh nodes
+ /*!
+ In additition to its base functionlity it support mapping of VTK to object numeration and
+ keeps names for each of nodes.
+ */
+ class TNamedPointCoords: public virtual TPointCoords
+ {
+ public:
+ //! To initilize the class (numeration of the nodes can be missed)
+ void
+ Init(const PCoordHolder& theCoord);
+
+ //! Get name for defined dimension
+ std::string&
+ GetName(vtkIdType theDim);
+
+ //! Get name for defined dimension (const version)
+ const std::string&
+ GetName(vtkIdType theDim) const;
+
+ //! Get object number for node by its VTK one
+ virtual
+ vtkIdType
+ GetObjID(vtkIdType theID) const;
+
+ //! Get VTK number for node by its object one
+ virtual
+ vtkIdType
+ GetVTKID(vtkIdType theID) const;
+
+ //! Get name of node by its object number
+ virtual
+ std::string
+ GetNodeName(vtkIdType theObjID) const;
+
+ virtual
+ vtkPoints*
+ GetPoints() const; //!< Gets initialized corresponding VTK structure
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ protected:
+ typedef TVector<std::string> TPointsDim;
+ TPointsDim myPointsDim; //!< Keeps name of each dimension
+ };
+
+
+ //---------------------------------------------------------------
+}
+
+#endif
--- /dev/null
+//
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:
+// Author: Alexey PETROV
+// Module : VISU
+
+#include "VISU_Structures.hxx"
+
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ TIntId
+ ::TIntId():
+ myId(0)
+ {}
+
+
+ //---------------------------------------------------------------
+ TIsVTKDone
+ ::TIsVTKDone():
+ myIsVTKDone(false),
+ myIsDone(false)
+ {}
+
+
+ //---------------------------------------------------------------
+ TMesh
+ ::TMesh():
+ myDim(0)
+ {}
+
+
+ //---------------------------------------------------------------
+ TMeshOnEntity
+ ::TMeshOnEntity():
+ myEntity(TEntity(-1))
+ {}
+
+
+ //---------------------------------------------------------------
+ TFamily
+ ::TFamily():
+ myEntity(TEntity(-1))
+ {}
+
+
+ //---------------------------------------------------------------
+ TField
+ ::TField():
+ myNbComp(0),
+ myEntity(TEntity(-1)),
+ myIsMinMaxInitilized(false)
+ {}
+
+
+ //---------------------------------------------------------------
+}
--- /dev/null
+//
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File :
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_Structures_HeaderFile
+#define VISU_Structures_HeaderFile
+
+/*!
+ \file VISU_Structures.hxx
+ \brief The file contains definitions for basic classes of the VISU CONVERTER package
+*/
+
+#include "VISU_IDMapper.hxx"
+#include "VISU_ConvertorDef.hxx"
+
+#include "MED_Vector.hxx"
+
+#include <map>
+#include <set>
+#include <string>
+#include <stdexcept>
+
+namespace VISU
+{
+ using MED::TVector;
+
+ //---------------------------------------------------------------
+ typedef std::string TName;
+ typedef TVector<TName> TNames;
+
+ //---------------------------------------------------------------
+ //! Define a basic class for all MED entites which can be identified by its number
+ struct TIntId: virtual TBaseStructure
+ {
+ vtkIdType myId;
+
+ TIntId();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define an utility base class which is repsonsible for preventing repetion
+ struct TIsVTKDone: virtual TBaseStructure
+ {
+ mutable bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure
+ mutable bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation
+
+ TIsVTKDone();
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<TEntity, PMeshOnEntity> TMeshOnEntityMap;
+ typedef std::map<TName, PGroup> TGroupMap;
+
+ //! Define a basic class which corresponds to MED MESH entity
+ /*!
+ This class in its turn contains map of TMeshOnEntity and TGroup substructures,
+ also it keeps name and dimention of corresponding MED MESH entity.
+ */
+ struct TMesh: virtual TBaseStructure
+ {
+ TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
+ TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
+ TName myName; //! Name of the corresponding MED MESH
+ vtkIdType myDim; //! Dimension of the corresponding MED MESH
+
+ std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree
+ std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree
+
+ TMesh();
+ };
+ typedef std::map<std::string, PMesh> TMeshMap;
+
+
+ //---------------------------------------------------------------
+ //! Define a basic class which corresponds to MED PROFILE entity
+ struct TSubProfile: virtual TBaseStructure
+ {};
+
+
+ //---------------------------------------------------------------
+ //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
+ struct TProfile: virtual TNamedIDMapper
+ {};
+
+
+ //---------------------------------------------------------------
+ bool
+ operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
+
+ typedef std::set<PSubProfile> TProfileKey;
+ typedef std::map<TProfileKey, PProfile> TProfileMap;
+
+
+ //---------------------------------------------------------------
+ //! Define a basic class for MED GAUSS entity
+ struct TGauss: virtual TBaseStructure
+ {};
+
+
+ //---------------------------------------------------------------
+ //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
+ struct TGaussSubMesh: virtual TBaseStructure
+ {
+ PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
+ struct TGaussMesh: virtual TGaussPtsIDMapper
+ {};
+
+
+ //---------------------------------------------------------------
+ bool
+ operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
+
+ typedef std::set<PGaussSubMesh> TGaussKey;
+ typedef std::map<TGaussKey, PGaussMesh> TGaussMeshMap;
+
+
+ //---------------------------------------------------------------
+
+ typedef std::map<TName, PFamily> TFamilyMap;
+ typedef std::map<TName, PField> TFieldMap;
+
+ //! Define a basic class which corresponds to MED ENTITY
+ /*!
+ This class in its turn contains map of TGaussMesh and TProfile substructures,
+ also it keeps corresponding map of MED FAMILIES and FIELDS.
+ */
+ struct TMeshOnEntity: virtual TNamedIDMapper
+ {
+ TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
+ TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
+
+ TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
+ TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
+
+ TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
+ TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
+
+ TMeshOnEntity();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a basic class for MED FAMILY entity
+ struct TFamily: virtual TIntId,
+ virtual TUnstructuredGridIDMapper
+ {
+ TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
+ TName myName; //!< Contains name of the corresponding MED FAMILY
+
+ TFamily();
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::set<PFamily> TFamilySet;
+
+ //! Define a basic class for MED GROUP entity
+ struct TGroup: virtual TUnstructuredGridIDMapper
+ {
+ TFamilySet myFamilySet;
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<vtkIdType, PValForTime> TValField;
+ typedef std::pair<vtkFloatingPointType, vtkFloatingPointType> TMinMax;
+
+ //! Define a basic class for MED FIELD entity
+ struct TField: virtual TIntId
+ {
+ TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+ TName myName; //!< Contains name of the corresponding MED FIELD
+ TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+ TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
+ TNames myCompNames; //!< Contains names of components of the MED FIELD
+ TNames myUnitNames; //!< Contains names of units of the MED FIELD
+ vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
+
+ //! Calculate min/max values for each of the MED FIELD components among all its timestamps
+ /*!
+ Numeration of the components starts from 1.
+ Zero component contains min/max value for modulus of corresponding vector
+ */
+ virtual
+ TMinMax
+ GetMinMax(vtkIdType theCompID) = 0;
+
+ bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
+
+ TField();
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::pair<double, std::string> TTime;
+
+ //! Define a basic class for MED TIMESTAMP entity
+ struct TValForTime: virtual TIntId
+ {
+ TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
+ TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
+ TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
+ TTime myTime;
+
+ PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
+ PGaussMesh myGaussMesh;
+ };
+
+
+ //---------------------------------------------------------------
+}
+
+
+#endif
--- /dev/null
+//
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:
+// Author: Alexey PETROV
+// Module : VISU
+
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
+
+#include "VTKViewer_AppendFilter.h"
+#include "VISU_AppendPolyData.hxx"
+#include "VISU_MergeFilter.hxx"
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkCellType.h>
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ /*! Computes number of points by the given number of cells
+ * in assumption of regular hexahedral mesh structure
+ */
+ size_t
+ GetNumberOfPoints(size_t theNbCells)
+ {
+ return size_t(pow(pow(theNbCells, 1.0/3.0) + 1.0, 3.0));
+ }
+
+ //---------------------------------------------------------------
+ /*! Computes size dataset the given number of mesh macro metrics
+ * in assumption of regular hexahedral mesh structure
+ */
+ size_t
+ GetDataSetSize(size_t theNbOfPoints,
+ size_t theNbOfCells,
+ size_t theCellsSize,
+ bool theComputeLinks)
+ {
+ size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord);
+ size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType);
+ size_t aLocationsSize = theNbOfCells*sizeof(int);
+ vtkFloatingPointType aNbCellsPerPoint = theCellsSize / theNbOfCells - 1;
+ size_t aLinksSize = theNbOfPoints * (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
+ if(!theComputeLinks)
+ aLinksSize = 0;
+ size_t aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
+ return aResult;
+ }
+
+ //---------------------------------------------------------------
+ TSizeCounter
+ ::TSizeCounter():
+ myNbCells(0),
+ myCellsSize(0)
+ {}
+
+
+ //---------------------------------------------------------------
+ TPolyDataHolder
+ ::TPolyDataHolder()
+ {}
+
+ const PPolyData&
+ TPolyDataHolder
+ ::GetSource() const
+ {
+ if(!mySource.GetPointer()){
+ mySource = vtkPolyData::New();
+ mySource->Delete();
+ }
+ return mySource;
+ }
+
+ vtkPolyData*
+ TPolyDataHolder
+ ::GetPolyDataOutput()
+ {
+ return GetSource().GetPointer();
+ }
+
+ unsigned long int
+ TPolyDataHolder
+ ::GetMemorySize()
+ {
+ if(vtkDataSet* anOutput = GetPolyDataOutput()){
+ anOutput->Update();
+ return anOutput->GetActualMemorySize() * 1024;
+ }
+ if(myIsDone){
+ size_t aNbPoints = GetNumberOfPoints(myNbCells);
+ return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
+ }
+ throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
+ return 0;
+ }
+
+ //---------------------------------------------------------------
+ TUnstructuredGridHolder
+ ::TUnstructuredGridHolder()
+ {}
+
+ const PUnstructuredGrid&
+ TUnstructuredGridHolder
+ ::GetSource() const
+ {
+ if(!mySource.GetPointer()){
+ mySource = vtkUnstructuredGrid::New();
+ mySource->Delete();
+ }
+ return mySource;
+ }
+
+ vtkUnstructuredGrid*
+ TUnstructuredGridHolder
+ ::GetUnstructuredGridOutput()
+ {
+ return GetSource().GetPointer();
+ }
+
+ unsigned long int
+ TUnstructuredGridHolder
+ ::GetMemorySize()
+ {
+ if(vtkDataSet* anOutput = GetUnstructuredGridOutput()){
+ anOutput->Update();
+ return anOutput->GetActualMemorySize() * 1024;
+ }
+ if(myIsDone){
+ size_t aNbPoints = GetNumberOfPoints(myNbCells);
+ return GetDataSetSize(aNbPoints, myNbCells, myCellsSize, false);
+ }
+ throw std::runtime_error("TUnstructuredGridHolder::GetMemorySize - myIsDone == false !!!");
+ return 0;
+ }
+
+
+ //---------------------------------------------------------------
+ unsigned long int
+ TMemoryCheckIDMapper
+ ::GetMemorySize()
+ {
+ if(myIsVTKDone){
+ if(vtkDataSet* anOutput = GetOutput()){
+ anOutput->Update();
+ return anOutput->GetActualMemorySize() * 1024;
+ }
+ }
+ throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!");
+ return 0;
+ }
+
+
+ //---------------------------------------------------------------
+ TAppendFilterHolder
+ ::TAppendFilterHolder()
+ {}
+
+ const PAppendFilter&
+ TAppendFilterHolder
+ ::GetFilter() const
+ {
+ if(!myFilter.GetPointer()){
+ myFilter = VTKViewer_AppendFilter::New();
+ myFilter->Delete();
+ myFilter->SetDoMappingFlag(true);
+ }
+ return myFilter;
+ }
+
+ vtkUnstructuredGrid*
+ TAppendFilterHolder
+ ::GetUnstructuredGridOutput()
+ {
+ GetFilter()->Update();
+ return GetFilter()->GetOutput();
+ }
+
+ //---------------------------------------------------------------
+ TAppendPolyDataHolder
+ ::TAppendPolyDataHolder()
+ {}
+
+ const PAppendPolyData&
+ TAppendPolyDataHolder
+ ::GetFilter() const
+ {
+ if(!myFilter.GetPointer()){
+ myFilter = VISU_AppendPolyData::New();
+ myFilter->Delete();
+ myFilter->SetDoMappingFlag(true);
+ }
+ return myFilter;
+ }
+
+ vtkPolyData*
+ TAppendPolyDataHolder
+ ::GetPolyDataOutput()
+ {
+ GetFilter()->Update();
+ return GetFilter()->GetOutput();
+ }
+
+
+ //---------------------------------------------------------------
+ TMergeFilterHolder
+ ::TMergeFilterHolder()
+ {}
+
+ const PMergeFilter&
+ TMergeFilterHolder
+ ::GetFilter() const
+ {
+ if(!myFilter.GetPointer()){
+ myFilter = VISU_MergeFilter::New();
+ myFilter->Delete();
+ }
+ return myFilter;
+ }
+
+ vtkDataSet*
+ TMergeFilterHolder
+ ::GetOutput()
+ {
+ GetFilter()->Update();
+ return GetFilter()->GetOutput();
+ }
+
+
+ //---------------------------------------------------------------
+ TMeshImpl
+ ::TMeshImpl():
+ myNbPoints(0)
+ {}
+
+ vtkIdType
+ TMeshImpl::
+ GetNbPoints() const
+ {
+ return myNbPoints;
+ }
+
+ vtkIdType
+ TMeshImpl::
+ GetDim() const
+ {
+ return myDim;
+ }
+
+ vtkPoints*
+ TMeshImpl::
+ GetPoints()
+ {
+ return myNamedPointCoords->GetPoints();
+ }
+
+
+ //---------------------------------------------------------------
+ TSubProfileImpl::TSubProfileImpl():
+ myStatus(eNone),
+ myGeom(eNONE)
+ {}
+
+
+ vtkIdType
+ TSubProfileImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ return theID;
+ }
+
+ unsigned long int
+ TSubProfileImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TUnstructuredGridHolder::GetMemorySize();
+ aSize += sizeof(vtkIdType) * mySubMeshID.size();
+ return aSize;
+ }
+
+
+ //---------------------------------------------------------------
+ bool
+ operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
+ {
+ PSubProfileImpl aLeft(theLeft), aRight(theRight);
+
+ if(aLeft->myGeom != aRight->myGeom)
+ return aLeft->myGeom < aRight->myGeom;
+
+ if(aLeft->myStatus != aRight->myStatus)
+ return aLeft->myStatus < aRight->myStatus;
+
+ return aLeft->myName < aRight->myName;
+ }
+
+
+ //---------------------------------------------------------------
+ TProfileImpl
+ ::TProfileImpl():
+ myIsAll(true),
+ myMeshOnEntity(NULL)
+ {}
+
+ vtkIdType
+ TProfileImpl
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetObjID(theID);
+ }
+
+ vtkIdType
+ TProfileImpl
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetVTKID(theID);
+ }
+
+ vtkFloatingPointType*
+ TProfileImpl
+ ::GetNodeCoord(vtkIdType theObjID)
+ {
+ if(myIsAll)
+ return myMeshOnEntity->GetNodeCoord(theObjID);
+
+ vtkIdType aVtkID = GetNodeVTKID(theObjID);
+ return GetFilter()->GetOutput()->GetPoint(aVtkID);
+ }
+
+ vtkIdType
+ TProfileImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ if(myIsAll)
+ return myMeshOnEntity->GetElemObjID(theID);
+
+ vtkIdType anInputID, aStartID, anInputDataSetID;
+ const PAppendFilter& anAppendFilter = GetFilter();
+ anAppendFilter->GetCellInputID(theID,anInputID,aStartID,anInputDataSetID);
+ PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
+ return aSubProfileImpl->GetElemObjID(anInputID);
+ }
+
+ vtkIdType
+ TProfileImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ if(myIsAll)
+ return myMeshOnEntity->GetElemVTKID(theID);
+
+ if(myElemObj2VTKID.empty())
+ return theID;
+ else{
+ TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+ if(anIter != myElemObj2VTKID.end())
+ return anIter->second;
+ }
+ return -1;
+ }
+
+ vtkCell*
+ TProfileImpl
+ ::GetElemCell(vtkIdType theObjID)
+ {
+ if(myIsAll)
+ return myMeshOnEntity->GetElemCell(theObjID);
+
+ vtkIdType aVtkID = GetElemVTKID(theObjID);
+ return GetFilter()->GetOutput()->GetCell(aVtkID);
+ }
+
+ vtkUnstructuredGrid*
+ TProfileImpl
+ ::GetUnstructuredGridOutput()
+ {
+ const PAppendFilter& anAppendFilter = GetFilter();
+ return anAppendFilter->GetOutput();
+ }
+
+ unsigned long int
+ TProfileImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TAppendFilterHolder::GetMemorySize();
+ aSize += myNamedPointCoords->GetMemorySize();
+ aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+ TGeom2SubProfile::const_iterator anIter = myGeom2SubProfile.begin();
+ TGeom2SubProfile::const_iterator anIterEnd = myGeom2SubProfile.end();
+ for(; anIter != anIterEnd; anIter++){
+ const PSubProfileImpl& aSubProfile = anIter->second;
+ aSize += aSubProfile->GetMemorySize();
+ aSize += sizeof(EGeometry);
+ }
+ return aSize;
+ }
+
+ std::string
+ TProfileImpl
+ ::GetNodeName(vtkIdType theObjID) const
+ {
+ return myNamedPointCoords->GetNodeName(theObjID);
+ }
+
+ std::string
+ TProfileImpl
+ ::GetElemName(vtkIdType theObjID) const
+ {
+ if(myIsAll)
+ return myMeshOnEntity->GetElemName(theObjID);
+
+ vtkIdType aVTKId = GetElemVTKID(theObjID);
+ vtkIdType anInputID, aStartID, anInputDataSetID;
+ const PAppendFilter& anAppendFilter = GetFilter();
+ anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartID,anInputDataSetID);
+ PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputDataSetID];
+ vtkIdType anEntityObjId = aSubProfileImpl->GetElemObjID(anInputID);
+ return myMeshOnEntity->GetElemName(anEntityObjId);
+ }
+
+
+ //---------------------------------------------------------------
+ vtkIdType
+ TUnstructuredGridIDMapperImpl
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myIDMapper->GetNodeObjID(theID);
+ }
+
+ vtkIdType
+ TUnstructuredGridIDMapperImpl
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myIDMapper->GetNodeVTKID(theID);
+ }
+
+ vtkFloatingPointType*
+ TUnstructuredGridIDMapperImpl
+ ::GetNodeCoord(vtkIdType theObjID)
+ {
+ return myIDMapper->GetNodeCoord(theObjID);
+ }
+
+ vtkIdType
+ TUnstructuredGridIDMapperImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ return myIDMapper->GetElemObjID(theID);
+ }
+
+ vtkIdType
+ TUnstructuredGridIDMapperImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ return myIDMapper->GetElemVTKID(theID);
+ }
+
+ vtkCell*
+ TUnstructuredGridIDMapperImpl
+ ::GetElemCell(vtkIdType theObjID)
+ {
+ return myIDMapper->GetElemCell(theObjID);
+ }
+
+ vtkUnstructuredGrid*
+ TUnstructuredGridIDMapperImpl
+ ::GetUnstructuredGridOutput()
+ {
+ if(!myFilter.GetPointer()){
+ const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
+ vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
+
+ const PUnstructuredGrid& aSource = mySource.GetSource();
+ vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
+ aDataSet->ShallowCopy(aGeometry);
+
+ const PMergeFilter& aFilter = GetFilter();
+ aFilter->SetGeometry(aGeometry);
+ aFilter->SetScalars(aDataSet);
+ aFilter->SetVectors(aDataSet);
+ aFilter->AddField("VISU_FIELD",aDataSet);
+ }
+ return myFilter->GetUnstructuredGridOutput();
+ }
+
+ vtkDataSet*
+ TUnstructuredGridIDMapperImpl
+ ::GetOutput()
+ {
+ return GetUnstructuredGridOutput();
+ }
+
+ unsigned long int
+ TUnstructuredGridIDMapperImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = myIDMapper->GetMemorySize();
+ aSize += mySource.GetMemorySize();
+ return aSize;
+ }
+
+
+ //---------------------------------------------------------------
+ vtkIdType
+ TPolyDataIDMapperImpl
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myIDMapper->GetNodeObjID(theID);
+ }
+
+ vtkIdType
+ TPolyDataIDMapperImpl
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myIDMapper->GetNodeVTKID(theID);
+ }
+
+ vtkFloatingPointType*
+ TPolyDataIDMapperImpl
+ ::GetNodeCoord(vtkIdType theObjID)
+ {
+ return myIDMapper->GetNodeCoord(theObjID);
+ }
+
+ vtkIdType
+ TPolyDataIDMapperImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ return myIDMapper->GetElemObjID(theID);
+ }
+
+ vtkIdType
+ TPolyDataIDMapperImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ return myIDMapper->GetElemVTKID(theID);
+ }
+
+ vtkCell*
+ TPolyDataIDMapperImpl
+ ::GetElemCell(vtkIdType theObjID)
+ {
+ return myIDMapper->GetElemCell(theObjID);
+ }
+
+ vtkPolyData*
+ TPolyDataIDMapperImpl
+ ::GetPolyDataOutput()
+ {
+ if(!myFilter.GetPointer()){
+ const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter();
+ vtkPolyData* aGeometry = anAppendFilter->GetOutput();
+
+ const PPolyData& aSource = mySource.GetSource();
+ vtkPolyData* aDataSet = aSource.GetPointer();
+ aDataSet->ShallowCopy(aGeometry);
+
+ const PMergeFilter& aFilter = GetFilter();
+ aFilter->SetGeometry(aGeometry);
+ aFilter->SetScalars(aDataSet);
+ aFilter->SetVectors(aDataSet);
+ aFilter->AddField("VISU_FIELD",aDataSet);
+ }
+ return myFilter->GetPolyDataOutput();
+ }
+
+ vtkDataSet*
+ TPolyDataIDMapperImpl
+ ::GetOutput()
+ {
+ return GetPolyDataOutput();
+ }
+
+ unsigned long int
+ TPolyDataIDMapperImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = myIDMapper->GetMemorySize();
+ aSize += mySource.GetMemorySize();
+ return aSize;
+ }
+
+
+ //---------------------------------------------------------------
+ TGaussImpl
+ ::TGaussImpl():
+ myGeom(EGeometry(-1)),
+ myNbPoints(0)
+ {}
+
+ void
+ TGaussImpl
+ ::LessThan(const PGaussImpl& theGauss,
+ bool& theResult) const
+ {
+ theResult = false;
+ }
+
+
+ //---------------------------------------------------------------
+ TGaussSubMeshImpl
+ ::TGaussSubMeshImpl():
+ myPointCoords(new TPointCoords()),
+ myStatus(eNone)
+ {}
+
+ TGaussPointID
+ TGaussSubMeshImpl
+ ::GetObjID(vtkIdType theID,
+ vtkIdType theStartID) const
+ {
+ TCellID aCellID = theStartID + theID / myGauss->myNbPoints;
+ TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
+
+ return TGaussPointID(aCellID,aLocalPntID);
+ }
+
+ unsigned long int
+ TGaussSubMeshImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TPolyDataHolder::GetMemorySize();
+ aSize += myPointCoords->GetMemorySize();
+ return aSize;
+ }
+
+ //---------------------------------------------------------------
+ bool
+ operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
+ {
+ PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
+ const PGaussImpl& aGaussLeft = aLeft->myGauss;
+ const PGaussImpl& aGaussRight = aRight->myGauss;
+
+ if(aGaussLeft->myGeom != aGaussRight->myGeom)
+ return aGaussLeft->myGeom < aGaussRight->myGeom;
+
+ if(aLeft->mySubProfile != aRight->mySubProfile)
+ return aLeft->mySubProfile < aRight->mySubProfile;
+
+ bool aResult;
+ aGaussLeft->LessThan(aGaussRight,aResult);
+
+ return aResult;
+ }
+
+
+ //---------------------------------------------------------------
+ TGaussMeshImpl
+ ::TGaussMeshImpl():
+ myParent(NULL)
+ {}
+
+ TGaussPointID
+ TGaussMeshImpl
+ ::GetObjID(vtkIdType theID) const
+ {
+ vtkIdType anInputID, aStartId, anInputDataSetID;
+ const PAppendPolyData& aFilter = GetFilter();
+ aFilter->GetCellInputID(theID, anInputID, aStartId, anInputDataSetID);
+ const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anInputDataSetID];
+
+ return aSubMeshImpl.GetObjID(anInputID,aStartId);
+ }
+
+ vtkPolyData*
+ TGaussMeshImpl
+ ::GetPolyDataOutput()
+ {
+ return mySource.GetPolyDataOutput();
+ }
+
+ vtkDataSet*
+ TGaussMeshImpl
+ ::GetOutput()
+ {
+ return GetPolyDataOutput();
+ }
+
+ unsigned long int
+ TGaussMeshImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TAppendPolyDataHolder::GetMemorySize();
+ aSize += mySource.GetMemorySize();
+ TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin();
+ TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end();
+ for(; anIter != anIterEnd; anIter++){
+ const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+ aSize += aGaussSubMesh->GetMemorySize();
+ aSize += sizeof(EGeometry);
+ }
+ return aSize;
+ }
+
+ TNamedIDMapper*
+ TGaussMeshImpl
+ ::GetParent()
+ {
+ return myParent;
+ }
+
+
+ //---------------------------------------------------------------
+ TGaussPointID
+ TGaussPtsIDFilter
+ ::GetObjID(vtkIdType theID) const
+ {
+ return myGaussPtsIDMapper->GetObjID(theID);
+ }
+
+ TNamedIDMapper*
+ TGaussPtsIDFilter
+ ::GetParent()
+ {
+ return myGaussPtsIDMapper->GetParent();
+ }
+
+ vtkPolyData*
+ TGaussPtsIDFilter
+ ::GetPolyDataOutput()
+ {
+ return TPolyDataIDMapperImpl::GetPolyDataOutput();
+ }
+
+ vtkDataSet*
+ TGaussPtsIDFilter
+ ::GetOutput()
+ {
+ return GetPolyDataOutput();
+ }
+
+
+ //---------------------------------------------------------------
+ vtkIdType
+ TSubMeshImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ return myStartID + theID;
+ }
+
+ std::string
+ TSubMeshImpl
+ ::GetElemName(vtkIdType theObjID) const
+ {
+ return "";
+ }
+
+ unsigned long int
+ TSubMeshImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TUnstructuredGridHolder::GetMemorySize();
+ for(size_t anId = 0; anId < myCell2Connect.size(); anId++){
+ const TConnect& aConnect = myCell2Connect[anId];
+ aSize += aConnect.size() * sizeof(vtkIdType);
+ }
+ return aSize;
+ }
+
+ //---------------------------------------------------------------
+ vtkIdType
+ TMeshOnEntityImpl
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetVTKID(theID);
+ }
+
+ vtkIdType
+ TMeshOnEntityImpl
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetObjID(theID);
+ }
+
+ vtkIdType
+ TMeshOnEntityImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ if(myElemObj2VTKID.empty())
+ return theID;
+ else{
+ TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+ if(anIter != myElemObj2VTKID.end())
+ return anIter->second;
+ }
+ return -1;
+ }
+
+ vtkIdType
+ TMeshOnEntityImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ vtkIdType anInputID, aStartId, anInputDataSetID;
+ const PAppendFilter& anAppendFilter = GetFilter();
+ anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
+ const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
+ return aSubMesh->GetElemObjID(anInputID);
+ }
+
+ std::string
+ TMeshOnEntityImpl
+ ::GetNodeName(vtkIdType theObjID) const
+ {
+ return myNamedPointCoords->GetNodeName(theObjID);
+ }
+
+ std::string
+ TMeshOnEntityImpl
+ ::GetElemName(vtkIdType theObjID) const
+ {
+ vtkIdType aVTKId = GetElemVTKID(theObjID);
+ vtkIdType anInputID, aStartId, anInputDataSetID;
+ const PAppendFilter& anAppendFilter = GetFilter();
+ anAppendFilter->GetCellInputID(aVTKId,anInputID,aStartId,anInputDataSetID);
+ const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputDataSetID];
+ return aSubMesh->GetElemName(anInputID);
+ }
+
+ vtkUnstructuredGrid*
+ TMeshOnEntityImpl
+ ::GetUnstructuredGridOutput()
+ {
+ return TAppendFilterHolder::GetUnstructuredGridOutput();
+ }
+
+ unsigned long int
+ TMeshOnEntityImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TAppendFilterHolder::GetMemorySize();
+ aSize += myNamedPointCoords->GetMemorySize();
+ aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+ TGeom2SubMesh::const_iterator anIter = myGeom2SubMesh.begin();
+ TGeom2SubMesh::const_iterator anIterEnd = myGeom2SubMesh.end();
+ for(; anIter != anIterEnd; anIter++){
+ const PSubMeshImpl& aSubMesh = anIter->second;
+ aSize += aSubMesh->GetMemorySize();
+ aSize += sizeof(EGeometry);
+ }
+ return aSize;
+ }
+
+ //---------------------------------------------------------------
+ vtkIdType
+ TFamilyImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ if(myElemObj2VTKID.empty())
+ return theID;
+ else{
+ TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+ if(anIter != myElemObj2VTKID.end())
+ return anIter->second;
+ }
+ return -1;
+ }
+
+ vtkIdType
+ TFamilyImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ return myMeshID[theID];
+ }
+
+ vtkIdType
+ TFamilyImpl
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetObjID(theID);
+ }
+
+ vtkIdType
+ TFamilyImpl
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetVTKID(theID);
+ }
+
+ vtkUnstructuredGrid*
+ TFamilyImpl
+ ::GetUnstructuredGridOutput()
+ {
+ return TUnstructuredGridHolder::GetUnstructuredGridOutput();
+ }
+
+ unsigned long int
+ TFamilyImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TUnstructuredGridHolder::GetMemorySize();
+ aSize += myNamedPointCoords->GetMemorySize();
+ aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+ aSize += myMeshID.size() * sizeof(vtkIdType);
+ TGeom2SubMeshID::const_iterator anIter = myGeom2SubMeshID.begin();
+ TGeom2SubMeshID::const_iterator anIterEnd = myGeom2SubMeshID.end();
+ for(; anIter != anIterEnd; anIter++){
+ const TSubMeshID& aSubMeshID = anIter->second;
+ aSize += aSubMeshID.size() * sizeof(vtkIdType);
+ aSize += sizeof(EGeometry);
+ }
+ return aSize;
+ }
+
+
+ //---------------------------------------------------------------
+ TNbASizeCells
+ TGroupImpl
+ ::GetNbASizeCells() const
+ {
+ vtkIdType aNbCells = 0, aCellsSize = 0;
+ TFamilySet::const_iterator anIter = myFamilySet.begin();
+ for(; anIter != myFamilySet.end(); anIter++){
+ PFamilyImpl aFamily = *anIter;
+ aNbCells += aFamily->myNbCells;
+ aCellsSize += aFamily->myCellsSize;
+ }
+ return std::make_pair(aNbCells,aCellsSize);
+ }
+
+ vtkIdType
+ TGroupImpl
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ if(myElemObj2VTKID.empty())
+ return theID;
+ else{
+ TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+ if(anIter != myElemObj2VTKID.end())
+ return anIter->second;
+ }
+ return -1;
+ }
+
+ vtkIdType
+ TGroupImpl
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ vtkIdType anInputID, aStartId, anInputDataSetID;
+ const PAppendFilter& anAppendFilter = GetFilter();
+ anAppendFilter->GetCellInputID(theID,anInputID,aStartId,anInputDataSetID);
+ const PFamilyImpl& aFamily = myFamilyArr[anInputDataSetID];
+ return aFamily->GetElemObjID(anInputID);
+ }
+
+ vtkIdType
+ TGroupImpl
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetObjID(theID);
+ }
+
+ vtkIdType
+ TGroupImpl
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myNamedPointCoords->GetVTKID(theID);
+ }
+
+ vtkUnstructuredGrid*
+ TGroupImpl
+ ::GetUnstructuredGridOutput()
+ {
+ return TAppendFilterHolder::GetUnstructuredGridOutput();
+ }
+
+ unsigned long int
+ TGroupImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = TAppendFilterHolder::GetMemorySize();
+ aSize += myNamedPointCoords->GetMemorySize();
+ aSize += myElemObj2VTKID.size() * 2 * sizeof(vtkIdType);
+ for(size_t anId = 0; anId < myFamilyArr.size(); anId++){
+ const PFamilyImpl& aFamily = myFamilyArr[anId];
+ aSize += aFamily->GetMemorySize();
+ }
+ return aSize;
+ }
+
+
+
+ //---------------------------------------------------------------
+ TFieldImpl
+ ::TFieldImpl():
+ myDataSize(0),
+ myDataType(0)
+ {}
+
+ void
+ TFieldImpl
+ ::Init(vtkIdType theNbComp,
+ vtkIdType theDataType)
+ {
+ myNbComp = theNbComp;
+ myDataType = theDataType;
+ myCompNames.resize(theNbComp);
+ myUnitNames.resize(theNbComp);
+ myMinMaxArr.resize(theNbComp + 1);
+ for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
+ TMinMax& aMinMax = myMinMaxArr[iComp];
+ aMinMax.first = VTK_LARGE_FLOAT;
+ aMinMax.second = -VTK_LARGE_FLOAT;
+ }
+ }
+
+ vtkIdType
+ TFieldImpl
+ ::GetDataType() const
+ {
+ return myDataType;
+ }
+
+ TMinMax
+ TFieldImpl
+ ::GetMinMax(vtkIdType theCompID)
+ {
+ return myMinMaxArr[theCompID];
+ }
+
+
+ //----------------------------------------------------------------------------
+ const PMeshValue&
+ TGeom2Value
+ ::GetMeshValue(EGeometry theGeom) const
+ {
+ TGeom2MeshValue::const_iterator anIter = myGeom2MeshValue.find(theGeom);
+ if(anIter == myGeom2MeshValue.end())
+ EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails");
+ return anIter->second;
+ }
+
+ PMeshValue&
+ TGeom2Value
+ ::GetMeshValue(EGeometry theGeom)
+ {
+ return myGeom2MeshValue[theGeom];
+ }
+
+
+ //----------------------------------------------------------------------------
+ TGeom2MeshValue&
+ TGeom2Value
+ ::GetGeom2MeshValue()
+ {
+ return myGeom2MeshValue;
+ }
+
+ const TGeom2MeshValue&
+ TGeom2Value
+ ::GetGeom2MeshValue() const
+ {
+ return myGeom2MeshValue;
+ }
+
+ PMeshValue
+ TGeom2Value
+ ::GetFirstMeshValue() const
+ {
+ if(myGeom2MeshValue.size() == 1)
+ return myGeom2MeshValue.begin()->second;
+ return PMeshValue();
+ }
+
+
+ //---------------------------------------------------------------
+ TValForTimeImpl
+ ::TValForTimeImpl():
+ myGaussPtsIDFilter(new TGaussPtsIDFilter()),
+ myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl())
+ {}
+
+ const PMeshValue&
+ TValForTimeImpl
+ ::GetMeshValue(EGeometry theGeom) const
+ {
+ return myGeom2Value.GetMeshValue(theGeom);
+ }
+
+ PMeshValue&
+ TValForTimeImpl
+ ::GetMeshValue(EGeometry theGeom)
+ {
+ return myGeom2Value.GetMeshValue(theGeom);
+ }
+
+ TGeom2MeshValue&
+ TValForTimeImpl
+ ::GetGeom2MeshValue()
+ {
+ return myGeom2Value.GetGeom2MeshValue();
+ }
+
+ const TGeom2MeshValue&
+ TValForTimeImpl
+ ::GetGeom2MeshValue() const
+ {
+ return myGeom2Value.GetGeom2MeshValue();
+ }
+
+ PMeshValue
+ TValForTimeImpl
+ ::GetFirstMeshValue() const
+ {
+ return myGeom2Value.GetFirstMeshValue();
+ }
+
+ int
+ TValForTimeImpl
+ ::GetNbGauss(EGeometry theGeom) const
+ {
+ TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
+ if(anIter == myGeom2NbGauss.end()){
+ return 1;
+ }
+ return anIter->second;
+ }
+
+ unsigned long int
+ TValForTimeImpl
+ ::GetMemorySize()
+ {
+ size_t aSize = sizeof(TValForTimeImpl);
+ const TGeom2MeshValue& aGeom2MeshValue = GetGeom2MeshValue();
+ TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin();
+ TGeom2MeshValue::const_iterator anIterEnd = aGeom2MeshValue.end();
+ for(; anIter != anIterEnd; anIter++){
+ const PMeshValue& aMeshValue = anIter->second;
+ aSize += aMeshValue->GetMemorySize();
+ aSize += sizeof(EGeometry);
+ }
+ return aSize;
+ }
+
+
+ //---------------------------------------------------------------
+}
--- /dev/null
+//
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File :
+// Author : Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_Structures_impl_HeaderFile
+#define VISU_Structures_impl_HeaderFile
+
+/*!
+ \file VISU_Structures_impl.hxx
+ \brief The file contains definitions for basic classes of the implementation of VISU CONVERTER package
+*/
+
+#include "VISU_Structures.hxx"
+#include "VISU_ConvertorDef_impl.hxx"
+
+namespace VISU
+{
+ //---------------------------------------------------------------
+ //! Define an utility base class which allow to keep calculated number of cells and their size
+ struct TSizeCounter: virtual TIsVTKDone
+ {
+ TSizeCounter();
+ vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass
+ vtkIdType myCellsSize; //!< Size of cells contained into corresponding sublclass
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container for VTK representation
+ class TPolyDataHolder: public virtual TSizeCounter
+ {
+ protected:
+ mutable PPolyData mySource;
+ public:
+ TPolyDataHolder();
+
+ //! This method allow to create corresponding VTK data set by demand (not at once)
+ const PPolyData&
+ GetSource() const;
+
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container for VTK representation
+ class TUnstructuredGridHolder: public virtual TSizeCounter
+ {
+ public:
+ TUnstructuredGridHolder();
+
+ //! This method allow to create corresponding VTK data set by demand (not at once)
+ const PUnstructuredGrid&
+ GetSource() const;
+
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ protected:
+ mutable PUnstructuredGrid mySource;
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define an intermediate class which unifies memory size calculation
+ struct TMemoryCheckIDMapper: public virtual TIsVTKDone,
+ public virtual TIDMapper
+ {
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container for VTK representation
+ /*!
+ This container allow to combine other VTK representation into single one.
+ */
+ class TAppendFilterHolder: public virtual TMemoryCheckIDMapper
+ {
+ protected:
+ mutable PAppendFilter myFilter;
+ public:
+ TAppendFilterHolder();
+
+ //! This method allow to create corresponding VTK filter by demand (not at once)
+ const PAppendFilter&
+ GetFilter() const;
+
+ //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container for VTK representation
+ /*!
+ This container allow to combine other VTK representation into single one.
+ */
+ class TAppendPolyDataHolder: public virtual TMemoryCheckIDMapper
+ {
+ protected:
+ mutable PAppendPolyData myFilter;
+ public:
+ TAppendPolyDataHolder();
+
+ //! This method allow to create corresponding VTK filter by demand (not at once)
+ const PAppendPolyData&
+ GetFilter() const;
+
+ //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a container for VTK representation
+ /*!
+ This container allow to assign data to mesh and represent them into single VTK representation
+ */
+ class TMergeFilterHolder: public virtual TMemoryCheckIDMapper
+ {
+ protected:
+ mutable PMergeFilter myFilter;
+ public:
+ TMergeFilterHolder();
+
+ //! This method allow to create corresponding VTK filter by demand (not at once)
+ const PMergeFilter&
+ GetFilter() const;
+
+ //! Gets output of the filter as vtkDataSet
+ virtual
+ vtkDataSet*
+ GetOutput();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Specialize TMesh to provide VTK mapping for nodes
+ struct TMeshImpl: virtual TMesh,
+ virtual TIsVTKDone
+ {
+ PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes
+ vtkIdType myNbPoints; //!< Keeps number of the nodes
+
+ TMeshImpl();
+
+ vtkIdType
+ GetNbPoints() const;
+
+ vtkIdType
+ GetDim() const;
+
+ vtkPoints*
+ GetPoints(); //!< Gets initialized corresponding VTK structure
+ };
+
+
+ //---------------------------------------------------------------
+ typedef TVector<vtkIdType> TSubMeshID;
+ typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus;
+
+ //! Specialize TSubProfile to provide VTK mapping
+ struct TSubProfileImpl: virtual TSubProfile,
+ virtual TUnstructuredGridHolder
+ {
+ TSubProfileImpl();
+
+ EGeometry myGeom; //!< Defines to what geometrical type the MED PROFILE belong to
+ std::string myName; //!< Keeps its name
+
+ //! Get object number of mesh cell by its VTK one
+ virtual
+ vtkIdType
+ GetElemObjID(int theVtkI) const;
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! Keeps status of the structure
+ /*!
+ In some cases MED file does not use MED PROFILES, but at VISU creates corresponding data strucutre
+ in order to construct mesh for MED TIEMSTAMPS in uniform way.
+ */
+ ESubMeshStatus myStatus;
+ TSubMeshID mySubMeshID; //!< Keeps numbers of mesh cell which contain the MED PROFILE
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<vtkIdType,vtkIdType> TID2ID;
+ typedef TVector<PSubProfileImpl> TSubProfileArr;
+ typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
+
+ //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh
+ struct TProfileImpl: virtual TProfile,
+ virtual TAppendFilterHolder
+ {
+ TProfileImpl();
+ bool myIsAll; //!< Say, whether the MED TIMESTAMP defined on all MED ENTITY or not
+
+ //! Reimplement the TIDMapper::GetNodeObjID
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeVTKID
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeCoord
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ //! Reimplement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemCell
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! Reimplement the TNamedIDMapper::GetNodeName
+ virtual
+ std::string
+ GetNodeName(vtkIdType theObjID) const;
+
+ //! Reimplement the TNamedIDMapper::GetElemName
+ virtual
+ std::string
+ GetElemName(vtkIdType theObjID) const;
+
+ TID2ID myElemObj2VTKID; //!< Keeps object to VTK numeration mapping
+ TSubProfileArr mySubProfileArr; //!< Keeps sequence of TSubProfiles as they were added into TAppendFilterHolder
+ PNamedPointCoords myNamedPointCoords; //!< Keeps reference on the same TNamedPointCoords as TMesh
+ TMeshOnEntityImpl* myMeshOnEntity; //<! Keeps backward reference to corresponding MED ENTITY mesh
+
+ TGeom2SubProfile myGeom2SubProfile; //!< Keeps TSubProfiles according to their geometrical type
+ };
+
+
+ //---------------------------------------------------------------
+ //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
+ struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder,
+ virtual TUnstructuredGridIDMapper
+ {
+ PAppendFilterHolder myIDMapper; //!< Responsible for numbering
+ TUnstructuredGridHolder mySource; //!< Keeps assigned data
+
+ //! Reimplement the TIDMapper::GetNodeObjID
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeVTKID
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeCoord
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ //! Reimplement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemCell
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ //! Reimplement the TIDMapper::GetOutput
+ virtual
+ vtkDataSet*
+ GetOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh
+ struct TPolyDataIDMapperImpl: virtual TMergeFilterHolder,
+ virtual TPolyDataIDMapper
+ {
+ PAppendPolyDataHolder myIDMapper; //!< Responsible for numbering
+ TPolyDataHolder mySource; //!< Keeps assigned data
+
+ //! Reimplement the TIDMapper::GetNodeObjID
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeVTKID
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeCoord
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ //! Reimplement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemCell
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //! Reimplement the TPolyDataIDMapper::GetPolyDataOutput
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+
+ //! Reimplement the TIDMapper::GetOutput
+ virtual
+ vtkDataSet*
+ GetOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+ };
+
+
+ //---------------------------------------------------------------
+ //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping
+ struct TGaussImpl: virtual TGauss
+ {
+ EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs
+ std::string myName; //!< Keeps name of the MED GAUSS entity
+ vtkIdType myNbPoints; //<! Keeps number of points for the MED GAUSS entity
+
+ TGaussImpl();
+
+ //! To define a way to implement more detail comparision of the TGaussSubMesh instances
+ virtual
+ void
+ LessThan(const PGaussImpl& theGauss,
+ bool& theResult) const;
+ };
+
+
+ //---------------------------------------------------------------
+ //! Specialize TGaussSubMesh to provide VTK mapping for the entity
+ struct TGaussSubMeshImpl: virtual TGaussSubMesh,
+ virtual TPolyDataHolder
+ {
+ TGaussSubMeshImpl();
+
+ //! To implement the TGaussPtsIDMapper::GetObjID
+ virtual
+ TGaussPointID
+ GetObjID(vtkIdType theID,
+ vtkIdType theStartID) const;
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ PGaussImpl myGauss; //<! Keep reference to corresponding TGauss structure
+
+ //! Keeps status of the structure
+ /*!
+ In some cases MED file does not use MED GAUSS, but at VISU creates corresponding data strucutre
+ in order to construct mesh for MED TIEMSTAMPS in uniform way.
+ */
+ ESubMeshStatus myStatus;
+
+ PPointCoords myPointCoords; //!< Keeps coordinates of Gauss Points
+ };
+
+
+ //---------------------------------------------------------------
+ typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
+ typedef std::map<EGeometry, PGaussSubMeshImpl> TGeom2GaussSubMesh;
+
+ //! Specialize TGaussMesh to provide VTK mapping for the entity
+ struct TGaussMeshImpl: virtual TGaussMesh,
+ virtual TAppendPolyDataHolder
+ {
+ TGaussMeshImpl();
+
+ //! Reimplement the TGaussPtsIDMapper::GetObjID
+ virtual
+ TGaussPointID
+ GetObjID(vtkIdType theID) const;
+
+ //! Reimplement the TGaussPtsIDMapper::GetPolyDataOutput
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+
+ //! Reimplement the TIDMapper::GetOutput
+ virtual
+ vtkDataSet*
+ GetOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! Reimplement the TGaussPtsIDMapper::GetParent
+ virtual
+ TNamedIDMapper*
+ GetParent();
+
+ TPolyDataHolder mySource; //!< Keeps VTK representation of the Gauss Points
+ TNamedIDMapper* myParent; //!< Refer to parent mesh
+ TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilterHolder
+ TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type
+ };
+
+
+ //---------------------------------------------------------------
+ //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh
+ struct TGaussPtsIDFilter: virtual TPolyDataIDMapperImpl,
+ virtual TGaussPtsIDMapper
+ {
+ PGaussPtsIDMapper myGaussPtsIDMapper;
+
+ //! Reimplement the TGaussPtsIDMapper::GetObjID
+ virtual
+ TGaussPointID
+ GetObjID(vtkIdType theID) const;
+
+ //! Reimplement the TGaussPtsIDMapper::GetParent
+ virtual
+ TNamedIDMapper*
+ GetParent();
+
+ //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkPolyData*
+ GetPolyDataOutput();
+
+ //! Reimplement the TIDMapper::GetOutput
+ virtual
+ vtkDataSet*
+ GetOutput();
+ };
+
+
+ //---------------------------------------------------------------
+ typedef TVector<vtkIdType> TConnect;
+ typedef TVector<TConnect> TCell2Connect;
+
+ //! The class is responsible for mapping of cells of defined geometrical type
+ struct TSubMeshImpl: virtual TUnstructuredGridHolder
+ {
+ //! To implement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! To implement the TNamedIDMapper::GetElemName
+ virtual
+ std::string
+ GetElemName(vtkIdType theObjID) const;
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ vtkIdType myStartID;
+ TCell2Connect myCell2Connect; //!< Contains connectivity for the cells
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
+ typedef TVector<PSubMeshImpl> TSubMeshArr;
+
+ //! Specialize TMeshOnEntity to provide VTK mapping for the entity
+ struct TMeshOnEntityImpl: virtual TMeshOnEntity,
+ virtual TAppendFilterHolder,
+ virtual TSizeCounter
+ {
+ //! Reimplement the TIDMapper::GetNodeVTKID
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeObjID
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TNamedIDMapper::GetNodeName
+ virtual
+ std::string
+ GetNodeName(vtkIdType theObjID) const;
+
+ //! Reimplement the TNamedIDMapper::GetElemName
+ virtual
+ std::string
+ GetElemName(vtkIdType theObjID) const;
+
+ //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+ TSubMeshArr mySubMeshArr; //!< Keeps sequence of TSubMeshImpl as they were added into TAppendFilterHolder
+ PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
+
+ TGeom2SubMesh myGeom2SubMesh; //!< Keeps TSubMeshImpl according to their geometrical type
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
+
+ //! Specialize TFamily to provide VTK mapping for the entity
+ struct TFamilyImpl: virtual TFamily,
+ virtual TUnstructuredGridHolder
+ {
+ //! Reimplement the TIDMapper::GetNodeObjID
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const ;
+
+ //! Reimplement the TIDMapper::GetNodeVTKID
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const ;
+
+ //! Reimplement the TIDMapper::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
+ TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+ TSubMeshID myMeshID; //!< Keeps numbers of mesh elements that belongs to the MED FAMILY
+
+ TGeom2SubMeshID myGeom2SubMeshID; //!< Keeps TSubMeshID according to their geometrical type
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
+ typedef TVector<PFamilyImpl> TFamilyArr;
+
+ //! Specialize TGroup to provide VTK mapping for the entity
+ struct TGroupImpl: virtual TGroup,
+ virtual TAppendFilterHolder
+ {
+ //! Calculate pair of values - number of cells and its size
+ TNbASizeCells
+ GetNbASizeCells() const;
+
+ //! Reimplement the TIDMapper::GetElemVTKID
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetElemObjID
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeObjID
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const;
+
+ //! Reimplement the TIDMapper::GetNodeVTKID
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const;
+
+ //! Reimplement the TUnstructuredGridIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ TID2ID myElemObj2VTKID; //!< To support object to VTK number mapping
+ TFamilyArr myFamilyArr; //!< Keeps sequence of TFamily as they were added into TAppendFilterHolder
+ PNamedPointCoords myNamedPointCoords; //!< Share the same instance with TMesh to implement nodal mapping
+ };
+
+
+ //---------------------------------------------------------------
+ typedef TVector<TMinMax> TMinMaxArr;
+
+ //! Specialize TField to provide VTK mapping for the entity
+ struct TFieldImpl: virtual TField
+ {
+ TFieldImpl();
+
+ //! To initialize the data structure
+ void
+ Init(vtkIdType theNbComp,
+ vtkIdType theDataType);
+
+ //! Gets type idetificator of the mesh data.
+ vtkIdType
+ GetDataType() const;
+
+ //! Implement the TField::GetMinMax
+ virtual
+ TMinMax
+ GetMinMax(vtkIdType theCompID);
+
+ vtkIdType myDataSize; //!< Keeps size of the assigned data
+ vtkIdType myDataType; //!< Keeps type idetificator of the mesh data
+ TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EGeometry, PMeshValue> TGeom2MeshValue;
+
+ class TGeom2Value: public virtual TBaseStructure
+ {
+ TGeom2MeshValue myGeom2MeshValue;
+ public:
+
+ //! Gets mesh data for defined geometrical type (constant version)
+ const PMeshValue&
+ GetMeshValue(EGeometry theGeom) const;
+
+ //! Gets mesh data for defined geometrical type
+ PMeshValue&
+ GetMeshValue(EGeometry theGeom);
+
+ //! Gets container of the whole mesh data
+ TGeom2MeshValue&
+ GetGeom2MeshValue();
+
+ //! Gets container of the whole mesh data (constant version)
+ const TGeom2MeshValue&
+ GetGeom2MeshValue() const;
+
+ //! Gets mesh data for the first geometry
+ PMeshValue
+ GetFirstMeshValue() const;
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EGeometry,vtkIdType> TGeom2NbGauss;
+
+ //! Specialize TValForTime to provide VTK mapping for the entity
+ struct TValForTimeImpl: virtual TValForTime
+ {
+ PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points
+ PUnstructuredGridIDMapperImpl myUnstructuredGridIDMapper; //!< Keep VTK representation for ordinary mesh and data
+ TGeom2Value myGeom2Value; //!< Keep value that is assigned to the mesh
+ TGeom2NbGauss myGeom2NbGauss; //!< Keep number of Gauss Points
+
+ TValForTimeImpl();
+
+ TGeom2MeshValue&
+ GetGeom2MeshValue();
+
+ const TGeom2MeshValue&
+ GetGeom2MeshValue() const;
+
+ //! Get mesh data for defined geometrical type (constant version)
+ const PMeshValue&
+ GetMeshValue(EGeometry theGeom) const;
+
+ //! Get mesh data for defined geometrical type
+ PMeshValue&
+ GetMeshValue(EGeometry theGeom);
+
+ //! Gets mesh data for the first geometry
+ PMeshValue
+ GetFirstMeshValue() const;
+
+ //! Get number of Gauss Points for defined geometrical type
+ virtual
+ int
+ GetNbGauss(EGeometry theGeom) const;
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+ };
+
+
+ //---------------------------------------------------------------
+}
+
+
+#endif
// Module : VISU
#include "VISU_DataSetActor.h"
-#include "VISU_PipeLine.hxx"
+#include "VISU_UnstructuredGridPL.hxx"
#include "VISU_PipeLineUtils.hxx"
#include <vtkDataSetMapper.h>
{
Superclass::ShallowCopyPL(thePipeLine);
- vtkDataSetMapper* aTarget = GetDataSetMapper();
- vtkDataSetMapper* aSource = thePipeLine->GetDataSetMapper();
- VISU::CopyDataSetMapper(aTarget, aSource, true);
- aTarget->SetLookupTable(aSource->GetLookupTable());
+ if(VISU_UnstructuredGridPL* aPipeLine = dynamic_cast<VISU_UnstructuredGridPL*>(thePipeLine)){
+ vtkDataSetMapper* aTarget = GetDataSetMapper();
+ vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper();
+ VISU::CopyDataSetMapper(aTarget, aSource, true);
+ aTarget->SetLookupTable(aSource->GetLookupTable());
+ }
}
//----------------------------------------------------------------------------
#include "VISU_ScalarBarCtrl.hxx"
#include "VISU_ScalarBarActor.hxx"
-#include "SALOME_ExtractGeometry.h"
-
#include "VISU_Event.h"
#include "SVTK_Actor.h"
VISU_GaussPtsAct
::GetMapper()
{
- //vtkMapper* aMapper = myCurrentPL->GetPSMapper();
+ //vtkMapper* aMapper = myCurrentPL->GetPointSpriteMapper();
//aMapper->Update();
//return aMapper;
myMapper->Update();
myDeviceActor->SetPipeLine(GetGaussPointsPL());
myCurrentPL = myDeviceActor->GetPipeLine();
- //SetMapper(myCurrentPL->GetPSMapper());
+ //SetMapper(myCurrentPL->GetPointSpriteMapper());
myMapper->SetInput(myCurrentPL->GetPickableDataSet());
SetMapper(myMapper.GetPointer());
VISU_GaussPointsPL* theGaussPointsPL)
{
vtkFloatingPointType aRadius = 0.5;
- if(theGaussPointsPL->GetPSMapper()->GetPointSpriteMode() == 1) // Geometry mode
+ if(theGaussPointsPL->GetPointSpriteMapper()->GetPointSpriteMode() == 1) // Geometry mode
aRadius *= theGaussPointsPL->GetSize() * theGaussPointsPL->GetAverageCellSize();
else if(theGaussPointsPL->GetBicolor()){
vtkFloatingPointType aVal = theScalarArray->GetTuple1(theVTKID);
myCellSource->Reset();
myCellSource->Modified(); // a VTK bug
- myCellSource->SetPoints(aParent->GetVTKOutput()->GetPoints());
+ vtkUnstructuredGrid* aDataSet = aParent->GetUnstructuredGridOutput();
+ myCellSource->SetPoints(aDataSet->GetPoints());
VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
vtkIdType aCellID = aGaussPointID.first;
VISU_GaussPointsPL* aPipeline = theActor->GetPipeLine();
- SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
- vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
+ vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
aPipeline->ShallowCopy(GetGaussPointsPL(), true);
::GetMTime()
{
unsigned long int aTime = Superclass::GetMTime();
- aTime = std::max(aTime, myGaussPointsPL->GetPSMapper()->GetMTime() );
+ aTime = std::max(aTime, myGaussPointsPL->GetPointSpriteMapper()->GetMTime() );
return aTime;
}
myOutsideDeviceActor->SetPipeLine(aPipeLine);
aPipeLine->Delete();
- SALOME_ExtractGeometry* anExtractGeometry = aPipeLine->GetExtractGeometryFilter();
- anExtractGeometry->SetExtractBoundaryCells(true);
- anExtractGeometry->SetExtractInside(true);
+ aPipeLine->SetExtractBoundaryCells(true);
+ aPipeLine->SetExtractInside(true);
}
}
VISU_GaussPointsPL* aPipeline = myOutsideDeviceActor->GetPipeLine();
- SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
- vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
+ vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
vtkFloatingPointType aMagnification = aPipeline->GetMagnification();
aPipeline->ShallowCopy(GetGaussPointsPL(), true);
aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
- anExtractGeometry->SetExtractBoundaryCells(true);
- anExtractGeometry->SetExtractInside(true);
+ aPipeline->SetExtractBoundaryCells(true);
+ aPipeline->SetExtractInside(true);
aPipeline->SetMagnification( aMagnification );
aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() );
if( myOutsideCursorSettings->GetUniform() )
{
- myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOff();
- myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 1 ); // Geometry mode
+ myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOff();
+ myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 1 ); // Geometry mode
myOutsideDeviceActor->GetProperty()->SetColor( myOutsideCursorSettings->GetColor() );
}
else
{
- myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
- myOutsideDeviceActor->GetPSMapper()->SetColorModeToMapScalars();
- myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOn();
+ myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
+ myOutsideDeviceActor->GetPointSpriteMapper()->SetColorModeToMapScalars();
+ myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOn();
}
aPipeline->Update();
VISU_OpenGLPointSpriteMapper*
VISU_GaussPtsDeviceActor
-::GetPSMapper()
+::GetPointSpriteMapper()
{
return myMapper.GetPointer();
}
::SetPipeLine(VISU_GaussPointsPL* thePipeLine)
{
myPipeLine = thePipeLine;
- myMapper = thePipeLine->GetPSMapper();
+ myMapper = thePipeLine->GetPointSpriteMapper();
vtkPolyData* aDataSet = myMapper->GetInput();
int anId = 0;
ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
VISU_OpenGLPointSpriteMapper*
- GetPSMapper();
+ GetPointSpriteMapper();
//! Gets memory size used by the instance (bytes).
virtual
::SetBarVisibility(bool theMode)
{
myBarVisibility = theMode;
- if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility);
+ if(myScalarBar)
+ myScalarBar->SetVisibility(myBarVisibility);
}
@COMMENCE@
EXPORT_HEADERS = \
+ VISU_MapperHolder.hxx \
+ VISU_DataSetMapperHolder.hxx \
+ VISU_PolyDataMapperHolder.hxx \
+ VISU_PointSpriteMapperHolder.hxx \
VISU_PipeLine.hxx \
+ VISU_ColoredPL.hxx \
+ VISU_UnstructuredGridPL.hxx \
+ VISU_ScalarMapPL.hxx \
+ VISU_DeformedShapePL.hxx \
+ VISU_GaussPointsPL.hxx \
VISU_PipeLineUtils.hxx \
VISU_MeshPL.hxx \
- VISU_ScalarMapPL.hxx \
VISU_CutPlanesPL.hxx \
VISU_CutLinesPL.hxx \
VISU_IsoSurfacesPL.hxx \
- VISU_DeformedShapePL.hxx \
VISU_VectorsPL.hxx \
VISU_StreamLinesPL.hxx \
+ VISU_Plot3DPL.hxx \
+ VISU_ScalarMapOnDeformedShapePL.hxx \
VISU_LookupTable.hxx \
VISU_ScalarBarActor.hxx \
VISU_Extractor.hxx \
VISU_FieldTransform.hxx \
VISU_UsedPointsFilter.hxx \
- VISU_GaussPointsPL.hxx \
- VISU_Plot3DPL.hxx \
VISU_OpenGLPointSpriteMapper.hxx \
VISU_ImplicitFunctionWidget.hxx \
SALOME_ExtractGeometry.h \
+ SALOME_ExtractPolyDataGeometry.h \
VISU_ScalarBarCtrl.hxx \
VISU_PlanesWidget.hxx \
VISU_SphereWidget.hxx \
- VISU_WidgetCtrl.hxx \
- VISU_ScalarMapOnDeformedShapePL.hxx
+ VISU_WidgetCtrl.hxx
# Libraries targets
-
LIB = libVisuPipeLine.la
LIB_SRC = \
+ VISU_MapperHolder.cxx \
+ VISU_DataSetMapperHolder.cxx \
+ VISU_PolyDataMapperHolder.cxx \
+ VISU_PointSpriteMapperHolder.cxx \
+ VISU_Extractor.cxx \
VISU_PipeLine.cxx \
- VISU_PipeLineUtils.cxx \
- VISU_MeshPL.cxx \
+ VISU_ColoredPL.cxx \
+ VISU_UnstructuredGridPL.cxx \
VISU_ScalarMapPL.cxx \
+ VISU_DeformedShapePL.cxx \
+ VISU_GaussPointsPL.cxx \
+ VISU_MeshPL.cxx \
VISU_CutPlanesPL.cxx \
VISU_CutLinesPL.cxx \
VISU_IsoSurfacesPL.cxx \
- VISU_DeformedShapePL.cxx \
VISU_VectorsPL.cxx \
VISU_StreamLinesPL.cxx \
+ VISU_Plot3DPL.cxx \
+ VISU_ScalarMapOnDeformedShapePL.cxx \
VISU_LookupTable.cxx \
VISU_ScalarBarActor.cxx \
- VISU_Extractor.cxx \
VISU_FieldTransform.cxx \
VISU_UsedPointsFilter.cxx \
- VISU_GaussPointsPL.cxx \
- VISU_Plot3DPL.cxx \
SALOME_ExtractGeometry.cxx \
+ SALOME_ExtractPolyDataGeometry.cxx \
VISU_OpenGLPointSpriteMapper.cxx \
VISU_ImplicitFunctionWidget.cxx \
VISU_PlanesWidget.cxx \
VISU_SphereWidget.cxx \
VISU_WidgetCtrl.cxx \
VISU_ScalarBarCtrl.cxx \
- VISU_ScalarMapOnDeformedShapePL.cxx
+ VISU_PipeLineUtils.cxx
# Executables targets
#include <vtkImplicitBoolean.h>
#include <vtkImplicitFunctionCollection.h>
-using namespace std;
-
#if defined __GNUC__
#if __GNUC__ == 2
#define __GNUC_2__
{}
-//----------------------------------------------------------------------------
-unsigned long int
-SALOME_ExtractGeometry
-::GetMTime()
-{
- unsigned long int aTime = vtkExtractGeometry::GetMTime();
- return aTime;
-}
-
-
//----------------------------------------------------------------------------
vtkImplicitBoolean*
SALOME_ExtractGeometry
::SetImplicitFunction(vtkImplicitFunction* theImplicitFunction)
{
myImplicitBoolean = dynamic_cast<vtkImplicitBoolean*>(theImplicitFunction);
- vtkExtractGeometry::SetImplicitFunction(theImplicitFunction);
+ Superclass::SetImplicitFunction(theImplicitFunction);
}
SALOME_ExtractGeometry
::SetStoreMapping(bool theStoreMapping)
{
- myStoreMapping = theStoreMapping;
- Modified();
+ if(myStoreMapping != theStoreMapping){
+ myStoreMapping = theStoreMapping;
+ Modified();
+ }
}
bool
SALOME_ExtractGeometry
::GetElemObjId(int theVtkID)
{
- if (!myStoreMapping||myIsDoneShallowCopy){
+ if(!myStoreMapping || myIsDoneShallowCopy)
return theVtkID;
- }
- //
- if (theVtkID<myElemVTK2ObjIds.size()){
+
+ if(theVtkID < myElemVTK2ObjIds.size())
return myElemVTK2ObjIds[theVtkID];
- }
+
return -1;
}
SALOME_ExtractGeometry
::GetNodeObjId(int theVtkID)
{
- if (!myStoreMapping||myIsDoneShallowCopy){
+ if(!myStoreMapping || myIsDoneShallowCopy)
return theVtkID;
- }
- //
- if (theVtkID<myNodeVTK2ObjIds.size()){
+
+ if(theVtkID < myNodeVTK2ObjIds.size())
return myNodeVTK2ObjIds[theVtkID];
- }
+
return -1;
}
//
myIsDoneShallowCopy = !this->ImplicitFunction;
- if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
- if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
+ if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer())
+ if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction())
myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
- }
- }
-
- if(myIsDoneShallowCopy){
+
+ if(myIsDoneShallowCopy)
GetOutput()->ShallowCopy(GetInput());
- Modified();
- return;
- }
-
- Execute2();
+ else
+ Execute2();
}
+
+//----------------------------------------------------------------------------
void
SALOME_ExtractGeometry
::Execute2()
#ifndef SALOME_ExtractGeometry_H
#define SALOME_ExtractGeometry_H
-#include "VTKViewer.h"
-
#include <vtkExtractGeometry.h>
#include <vtkSmartPointer.h>
class SALOME_ExtractGeometry : public vtkExtractGeometry
{
public:
- vtkTypeMacro(SALOME_ExtractGeometry,vtkExtractGeometry);
+ vtkTypeMacro(SALOME_ExtractGeometry, vtkExtractGeometry);
- static SALOME_ExtractGeometry *New();
+ static
+ SALOME_ExtractGeometry*
+ New();
virtual
void
SetImplicitFunction(vtkImplicitFunction* theImplicitFunction);
- virtual
- unsigned long int
- GetMTime();
-
vtkImplicitBoolean*
GetImplicitBoolean();
bool
GetStoreMapping() const;
+
void
SetStoreMapping(bool theStoreMapping);
private:
bool myStoreMapping;
bool myIsDoneShallowCopy;
+
typedef std::vector<vtkIdType> TVectorId;
TVectorId myElemVTK2ObjIds;
TVectorId myNodeVTK2ObjIds;
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+
+#include "SALOME_ExtractPolyDataGeometry.h"
+
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkFloatArray.h>
+#include <vtkImplicitFunction.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(SALOME_ExtractPolyDataGeometry);
+
+
+//----------------------------------------------------------------------------
+SALOME_ExtractPolyDataGeometry
+::SALOME_ExtractPolyDataGeometry():
+ myStoreMapping(false),
+ myIsDoneShallowCopy(false)
+{}
+
+SALOME_ExtractPolyDataGeometry
+::~SALOME_ExtractPolyDataGeometry()
+{}
+
+
+//----------------------------------------------------------------------------
+vtkImplicitBoolean*
+SALOME_ExtractPolyDataGeometry
+::GetImplicitBoolean()
+{
+ return myImplicitBoolean.GetPointer();
+}
+
+
+void
+SALOME_ExtractPolyDataGeometry
+::SetImplicitFunction(vtkImplicitFunction* theImplicitFunction)
+{
+ myImplicitBoolean = dynamic_cast<vtkImplicitBoolean*>(theImplicitFunction);
+ Superclass::SetImplicitFunction(theImplicitFunction);
+}
+
+
+//----------------------------------------------------------------------------
+void
+SALOME_ExtractPolyDataGeometry
+::SetStoreMapping(bool theStoreMapping)
+{
+ if(myStoreMapping != theStoreMapping){
+ myStoreMapping = theStoreMapping;
+ Modified();
+ }
+}
+
+bool
+SALOME_ExtractPolyDataGeometry
+::GetStoreMapping() const
+{
+ return myStoreMapping;
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetElemVTKId(vtkIdType theID)
+{
+ if(!myStoreMapping || myIsDoneShallowCopy){
+ return theID;
+ }
+ vtkIdType iEnd = myElemVTK2ObjIds.size();
+ for(vtkIdType i = 0; i < iEnd; i++)
+ if(myElemVTK2ObjIds[i] == theID)
+ return i;
+
+ return -1;
+}
+
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetNodeVTKId(vtkIdType theID)
+{
+ return theID;
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetElemObjId(int theVtkID)
+{
+ if(!myStoreMapping || myIsDoneShallowCopy)
+ return theVtkID;
+
+ if(theVtkID < myElemVTK2ObjIds.size())
+ return myElemVTK2ObjIds[theVtkID];
+
+ return -1;
+}
+
+
+vtkIdType
+SALOME_ExtractPolyDataGeometry
+::GetNodeObjId(int theVtkID)
+{
+ return theVtkID;
+}
+
+
+//----------------------------------------------------------------------------
+void
+SALOME_ExtractPolyDataGeometry
+::Execute()
+{
+ myElemVTK2ObjIds.clear();
+ myNodeVTK2ObjIds.clear();
+ //
+ myIsDoneShallowCopy = !this->ImplicitFunction;
+
+ if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
+ if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
+ myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
+ }
+ }
+
+ if(myIsDoneShallowCopy)
+ GetOutput()->ShallowCopy(GetInput());
+ else
+ Execute2();
+}
+
+
+//----------------------------------------------------------------------------
+void
+SALOME_ExtractPolyDataGeometry
+::Execute2()
+{
+ vtkPolyData *input = this->GetInput();
+ vtkPointData *pd = input->GetPointData();
+ vtkCellData *cd = input->GetCellData();
+ vtkPolyData *output = this->GetOutput();
+ vtkPointData *outputPD = output->GetPointData();
+ vtkCellData *outputCD = output->GetCellData();
+ vtkPoints *inPts=input->GetPoints();
+ vtkIdType numPts, i, cellId = -1, newId;
+ float multiplier;
+ vtkCellArray *inVerts=NULL, *inLines=NULL, *inPolys=NULL, *inStrips=NULL;
+ vtkCellArray *newVerts=NULL, *newLines=NULL, *newPolys=NULL, *newStrips=NULL;
+
+ vtkDebugMacro(<< "Extracting poly data geometry");
+
+ if ( ! this->ImplicitFunction )
+ {
+ vtkErrorMacro(<<"No implicit function specified");
+ return;
+ }
+
+ numPts = input->GetNumberOfPoints();
+
+ if ( this->ExtractInside )
+ {
+ multiplier = 1.0;
+ }
+ else
+ {
+ multiplier = -1.0;
+ }
+
+ // Use a templated function to access the points. The points are
+ // passed through, but scalar values are generated.
+ vtkFloatArray *newScalars = vtkFloatArray::New();
+ newScalars->SetNumberOfValues(numPts);
+
+ for (int ptId=0; ptId < numPts; ptId++ )
+ {
+ newScalars->SetValue(ptId, this->ImplicitFunction->
+ FunctionValue(inPts->GetPoint(ptId))*multiplier);
+ }
+
+ output->SetPoints(inPts);
+ outputPD->PassData(pd);
+
+ // Now loop over all cells to see whether they are inside the implicit
+ // function. Copy if they are. Note: there is an awful hack here, that
+ // can result in bugs. The cellId is assumed to be arranged starting
+ // with the verts, then lines, then polys, then strips.
+ //
+ int numIn;
+ vtkIdType npts = 0;
+ vtkIdType *pts = 0;
+ if ( input->GetNumberOfVerts() )
+ {
+ inVerts = input->GetVerts();
+ newVerts = vtkCellArray::New();
+ newVerts->Allocate(inVerts->GetSize());
+ }
+ if ( input->GetNumberOfLines() )
+ {
+ inLines = input->GetLines();
+ newLines = vtkCellArray::New();
+ newLines->Allocate(inLines->GetSize());
+ }
+ if ( input->GetNumberOfPolys() )
+ {
+ inPolys = input->GetPolys();
+ newPolys = vtkCellArray::New();
+ newPolys->Allocate(inPolys->GetSize());
+ }
+ if ( input->GetNumberOfStrips() )
+ {
+ inStrips = input->GetStrips();
+ newStrips = vtkCellArray::New();
+ newStrips->Allocate(inStrips->GetSize());
+ }
+
+ // verts
+ if ( newVerts && !this->GetAbortExecute() )
+ {
+ for (inVerts->InitTraversal(); inVerts->GetNextCell(npts,pts); )
+ {
+ for (numIn=0, i=0; i<npts; i++)
+ {
+ if ( newScalars->GetValue(pts[i]) <= 0.0 )
+ {
+ numIn++;
+ }
+ }
+ if ( (numIn == npts) || (this->ExtractBoundaryCells && numIn > 0) )
+ {
+ newId = newVerts->InsertNextCell(npts,pts);
+ if(myStoreMapping)
+ myElemVTK2ObjIds.push_back(newId);
+ outputCD->CopyData(cd, cellId, newId);
+ }
+ cellId++;
+ }
+ }
+ this->UpdateProgress (0.6);
+
+ // lines
+ if ( newLines && !this->GetAbortExecute() )
+ {
+ for (inLines->InitTraversal(); inLines->GetNextCell(npts,pts); )
+ {
+ for (numIn=0, i=0; i<npts; i++)
+ {
+ if ( newScalars->GetValue(pts[i]) <= 0.0 )
+ {
+ numIn++;
+ }
+ }
+ if ( (numIn == npts) || (this->ExtractBoundaryCells && numIn > 0) )
+ {
+ newId = newLines->InsertNextCell(npts,pts);
+ if(myStoreMapping)
+ myElemVTK2ObjIds.push_back(newId);
+ outputCD->CopyData(cd, cellId, newId);
+ }
+ cellId++;
+ }
+ }
+ this->UpdateProgress (0.75);
+
+ // polys
+ if ( newPolys && !this->GetAbortExecute() )
+ {
+ for (inPolys->InitTraversal(); inPolys->GetNextCell(npts,pts); )
+ {
+ for (numIn=0, i=0; i<npts; i++)
+ {
+ if ( newScalars->GetValue(pts[i]) <= 0.0 )
+ {
+ numIn++;
+ }
+ }
+ if ( (numIn == npts) || (this->ExtractBoundaryCells && numIn > 0) )
+ {
+ newId = newPolys->InsertNextCell(npts,pts);
+ if(myStoreMapping)
+ myElemVTK2ObjIds.push_back(newId);
+ outputCD->CopyData(cd, cellId, newId);
+ }
+ cellId++;
+ }
+ }
+ this->UpdateProgress (0.90);
+
+ // strips
+ if ( newStrips && !this->GetAbortExecute() )
+ {
+ for (inStrips->InitTraversal(); inStrips->GetNextCell(npts,pts); )
+ {
+ for (numIn=0, i=0; i<npts; i++)
+ {
+ if ( newScalars->GetValue(pts[i]) <= 0.0 )
+ {
+ numIn++;
+ }
+ }
+ if ( (numIn == npts) || (this->ExtractBoundaryCells && numIn > 0) )
+ {
+ newId = newStrips->InsertNextCell(npts,pts);
+ if(myStoreMapping)
+ myElemVTK2ObjIds.push_back(newId);
+ outputCD->CopyData(cd, cellId, newId);
+ }
+ cellId++;
+ }
+ }
+ this->UpdateProgress (1.0);
+
+ // Update ourselves and release memory
+ //
+ newScalars->Delete();
+
+ if ( newVerts )
+ {
+ output->SetVerts(newVerts);
+ newVerts->Delete();
+ }
+ if ( newLines )
+ {
+ output->SetLines(newLines);
+ newLines->Delete();
+ }
+ if ( newPolys )
+ {
+ output->SetPolys(newPolys);
+ newPolys->Delete();
+ }
+ if ( newStrips )
+ {
+ output->SetStrips(newStrips);
+ newStrips->Delete();
+ }
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef SALOME_ExtractPolyDataGeometry_H
+#define SALOME_ExtractPolyDataGeometry_H
+
+#include <vtkExtractPolyDataGeometry.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+
+class vtkImplicitBoolean;
+
+class SALOME_ExtractPolyDataGeometry : public vtkExtractPolyDataGeometry
+{
+public:
+ vtkTypeMacro(SALOME_ExtractPolyDataGeometry, vtkExtractPolyDataGeometry);
+
+ static
+ SALOME_ExtractPolyDataGeometry*
+ New();
+
+ virtual
+ void
+ SetImplicitFunction(vtkImplicitFunction* theImplicitFunction);
+
+ vtkImplicitBoolean*
+ GetImplicitBoolean();
+
+ bool
+ GetStoreMapping() const;
+
+ void
+ SetStoreMapping(bool theStoreMapping);
+
+ virtual
+ vtkIdType
+ GetNodeObjId(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemObjId(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetNodeVTKId(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemVTKId(vtkIdType theID);
+
+protected:
+ SALOME_ExtractPolyDataGeometry();
+ ~SALOME_ExtractPolyDataGeometry();
+
+ virtual
+ void
+ Execute();
+
+ void
+ Execute2();
+
+private:
+ bool myStoreMapping;
+ bool myIsDoneShallowCopy;
+
+ typedef std::vector<vtkIdType> TVectorId;
+ TVectorId myElemVTK2ObjIds;
+ TVectorId myNodeVTK2ObjIds;
+
+ vtkSmartPointer<vtkImplicitBoolean> myImplicitBoolean;
+
+ SALOME_ExtractPolyDataGeometry(const SALOME_ExtractPolyDataGeometry&); // Not implemented.
+ void operator=(const SALOME_ExtractPolyDataGeometry&); // Not implemented.
+};
+
+#endif
+
+
// Author: Alexey PETROV
// Module : VISU
-#include "VISU_Convertor.hxx"
#include "VISU_MeshPL.hxx"
#include "VISU_ScalarMapPL.hxx"
#include "VISU_IsoSurfacesPL.hxx"
#include "VISU_StreamLinesPL.hxx"
#include "VISU_GaussPointsPL.hxx"
#include "VISU_Plot3DPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
+
+#include "VISU_Convertor.hxx"
-typedef VISU_GaussPointsPL TPresent;
+typedef VISU_DeformedShapePL TPresent;
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
static int isOnlyMesh = false;
-int main(int argc, char** argv){
+
+//----------------------------------------------------------------------------
+template<class TPipeLine>
+VISU_ColoredPL*
+CreateColoredPL(VISU_Convertor* theConvertor,
+ const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber);
+
+
+//----------------------------------------------------------------------------
+template<>
+VISU_ColoredPL*
+CreateColoredPL<VISU_GaussPointsPL>(VISU_Convertor* theConvertor,
+ const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber)
+{
+ VISU_GaussPointsPL* aPresent = VISU_GaussPointsPL::New();
+ VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
+ theConvertor->GetTimeStampOnGaussPts(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
+ aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+
+ char aMainTexture[80];
+ strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+ strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
+
+ char anAlphaTexture[80];
+ strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+ strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
+
+ vtkSmartPointer<vtkImageData> aTextureValue =
+ VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+ aPresent->SetImageData( aTextureValue.GetPointer() );
+
+ aPresent->Update();
+
+ return aPresent;
+}
+
+
+//----------------------------------------------------------------------------
+template<class TPipeLine>
+VISU_ColoredPL*
+CreateColoredPL(VISU_Convertor* theConvertor,
+ const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theTimeStampNumber)
+{
+ TPipeLine* aPresent = TPipeLine::New();
+ VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper =
+ theConvertor->GetTimeStampOnMesh(theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber);
+ aPresent->SetUnstructuredGridIDMapper(anUnstructuredGridIDMapper);
+ return aPresent;
+}
+
+
+//----------------------------------------------------------------------------
+int
+main(int argc, char** argv)
+{
try{
if(argc > 1){
vtkRenderWindow *renWin = vtkRenderWindow::New();
const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
- VISU::PIDMapper anIDMapper =
+ VISU::PNamedIDMapper anIDMapper =
aConvertor->GetMeshOnEntity(aMeshName,anEntity);
- VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
VISU_MeshPL* aPresent = VISU_MeshPL::New();
- aPresent->SetInput(aDataSet);
- aPresent->Build();
+ aPresent->SetUnstructuredGridIDMapper(anIDMapper);
vtkActor* aActor = vtkActor::New();
aActor->SetMapper(aPresent->GetMapper());
VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
const VISU::PField aField = aFieldMapIter->second;
- /*
+ ///*
if(aField->myNbComp == 1)
continue;
- */
+ //*/
const string& aFieldName = aFieldMapIter->first;
const VISU::TValField& aValField = aField->myValField;
VISU::TValField::const_iterator aValFieldIter = aValField.begin();
if(aValFieldIter == aValField.end()) return 0;
int aTimeStamp = aValFieldIter->first;
- TPresent* aPresent = TPresent::New();
- VISU::PIDMapper anIDMapper;
+ VISU_ColoredPL* aPresent = NULL;
if(anEntity != VISU::NODE_ENTITY){
- VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
- aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+ aPresent = CreateColoredPL<TPresent>(aConvertor,
+ aMeshName,
+ anEntity,
+ aFieldName,
+ aTimeStamp);
}else{
- continue;
- VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
- aPresent->SetIDMapper(anIDMapper);
+ //continue;
+ aPresent = CreateColoredPL<TPresent>(aConvertor,
+ aMeshName,
+ anEntity,
+ aFieldName,
+ aTimeStamp);
}
- aPresent->Build();
- aPresent->Init();
-
- char aMainTexture[80];
- strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
- strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
- //cout << aMainTexture << endl;
-
- char anAlphaTexture[80];
- strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
- strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
- //cout << anAlphaTexture << endl;
-
- vtkSmartPointer<vtkImageData> aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
- aPresent->SetImageData( aTextureValue.GetPointer() );
-
- aPresent->Update();
-
vtkActor* anActor = vtkActor::New();
anActor->SetMapper(aPresent->GetMapper());
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_ColoredPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_ColoredPL.hxx"
+#include "VISU_Extractor.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_MapperHolder.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+
+//----------------------------------------------------------------------------
+VISU_ColoredPL
+::VISU_ColoredPL():
+ myMapperTable(VISU_LookupTable::New()),
+ myBarTable(VISU_LookupTable::New()),
+ myExtractor(VISU_Extractor::New()),
+ myFieldTransform(VISU_FieldTransform::New())
+{
+ myMapperTable->Delete();
+ myMapperTable->SetScale(VTK_SCALE_LINEAR);
+ myMapperTable->SetHueRange(0.667, 0.0);
+
+ myBarTable->Delete();
+ myBarTable->SetScale(VTK_SCALE_LINEAR);
+ myBarTable->SetHueRange(0.667, 0.0);
+
+ myExtractor->Delete();
+
+ myFieldTransform->Delete();
+}
+
+
+VISU_ColoredPL
+::~VISU_ColoredPL()
+{}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ if(VISU_ColoredPL *aPipeLine = dynamic_cast<VISU_ColoredPL*>(thePipeLine)){
+ if(theIsCopyInput)
+ SetScalarRange(aPipeLine->GetScalarRange());
+ SetScalarMode(aPipeLine->GetScalarMode());
+ SetNbColors(aPipeLine->GetNbColors());
+ SetScaling(aPipeLine->GetScaling());
+ SetMapScale(aPipeLine->GetMapScale());
+ }
+
+ Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_ColoredPL
+::GetScalarMode()
+{
+ return myExtractor->GetScalarMode();
+}
+
+void
+VISU_ColoredPL
+::SetScalarMode(int theScalarMode)
+{
+ if(vtkDataSet *anInput = GetInput()){
+ if(anInput->GetPointData()->GetNumberOfArrays()){
+ vtkPointData *aPointData = anInput->GetPointData();
+ if(!aPointData->GetAttribute(vtkDataSetAttributes::VECTORS))
+ if(theScalarMode == 0)
+ return;
+ }else{
+ vtkCellData *aCellData = anInput->GetCellData();
+ if(!aCellData->GetAttribute(vtkDataSetAttributes::VECTORS))
+ if(theScalarMode == 0)
+ return;
+ }
+ }
+
+ myExtractor->SetScalarMode(theScalarMode);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetScalarRange(vtkFloatingPointType theRange[2])
+{
+ myFieldTransform->SetScalarRange(theRange);
+ myBarTable->SetRange(theRange);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType*
+VISU_ColoredPL
+::GetScalarRange()
+{
+ return myFieldTransform->GetScalarRange();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetScaling(int theScaling)
+{
+ myBarTable->SetScale(theScaling);
+ if(theScaling == VTK_SCALE_LOG10)
+ myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
+ else
+ myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
+}
+
+//----------------------------------------------------------------------------
+int
+VISU_ColoredPL
+::GetScaling()
+{
+ return myBarTable->GetScale();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetNbColors(int theNbColors)
+{
+ myMapperTable->SetNumberOfColors(theNbColors);
+ myBarTable->SetNumberOfColors(theNbColors);
+}
+
+int
+VISU_ColoredPL
+::GetNbColors()
+{
+ return myMapperTable->GetNumberOfColors();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::Init()
+{
+ SetScalarMode(0);
+ SetSourceRange();
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_ColoredPL
+::InsertCustomPL()
+{
+ return GetFieldTransformFilter()->GetUnstructuredGridOutput();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::Build()
+{
+ myExtractor->SetInput(GetClippedInput());
+ myFieldTransform->SetInput(myExtractor->GetOutput());
+
+ GetMapperHolder()->SetLookupTable(GetMapperTable());
+ GetMapper()->SetUseLookupTableScalarRange(true);
+ GetMapper()->SetColorModeToMapScalars();
+ GetMapper()->ScalarVisibilityOn();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::Update()
+{
+ vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange();
+ vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
+ if(myBarTable->GetScale() == VTK_SCALE_LOG10)
+ VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
+ myMapperTable->SetRange(aScalarRange);
+
+ myMapperTable->Build();
+ myBarTable->Build();
+
+ VISU_PipeLine::Update();
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ColoredPL
+::GetMemorySize()
+{
+ unsigned long int aSize = 0;
+
+ if(vtkDataSet* aDataSet = myExtractor->GetInput())
+ aSize = aDataSet->GetActualMemorySize() * 1024;
+
+ if(vtkDataSet* aDataSet = myFieldTransform->GetInput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
+
+ aSize += Superclass::GetMemorySize();
+
+ return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+VISU_LookupTable *
+VISU_ColoredPL
+::GetMapperTable()
+{
+ return myMapperTable.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_LookupTable*
+VISU_ColoredPL
+::GetBarTable()
+{
+ return myBarTable.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_Extractor*
+VISU_ColoredPL
+::GetExtractorFilter()
+{
+ return myExtractor.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_FieldTransform*
+VISU_ColoredPL
+::GetFieldTransformFilter()
+{
+ return myFieldTransform.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetMapScale(vtkFloatingPointType theMapScale)
+{
+ if(!VISU::CheckIsSameValue(myMapperTable->GetMapScale(), theMapScale)){
+ myMapperTable->SetMapScale(theMapScale);
+ myMapperTable->Build();
+ }
+}
+
+vtkFloatingPointType
+VISU_ColoredPL
+::GetMapScale()
+{
+ return myMapperTable->GetMapScale();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::GetSourceRange(vtkFloatingPointType theRange[2])
+{
+ myExtractor->Update();
+ myExtractor->GetOutput()->GetScalarRange(theRange);
+}
+
+void
+VISU_ColoredPL
+::SetSourceRange()
+{
+ vtkFloatingPointType aRange[2];
+ GetSourceRange(aRange);
+ SetScalarRange(aRange);
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_ColoredPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_ColoredPL_HeaderFile
+#define VISU_ColoredPL_HeaderFile
+
+#include "VISU_PipeLine.hxx"
+
+#include <vtkSmartPointer.h>
+
+class VISU_Extractor;
+class VISU_FieldTransform;
+class VISU_LookupTable;
+
+
+//----------------------------------------------------------------------------
+class VISU_ColoredPL : public VISU_PipeLine
+{
+public:
+ vtkTypeMacro(VISU_ColoredPL, VISU_PipeLine);
+
+ //----------------------------------------------------------------------------
+ virtual
+ int
+ GetScalarMode();
+
+ virtual
+ void
+ SetScalarMode(int theScalarMode = 0);
+
+ virtual
+ vtkFloatingPointType*
+ GetScalarRange();
+
+ virtual
+ void
+ SetScalarRange(vtkFloatingPointType theRange[2]);
+
+ virtual
+ void
+ SetScaling(int theScaling);
+
+ virtual
+ int
+ GetScaling();
+
+ virtual
+ void
+ SetNbColors(int theNbColors);
+
+ virtual
+ int
+ GetNbColors();
+
+ //----------------------------------------------------------------------------
+public:
+ virtual
+ void
+ Init();
+
+ virtual
+ void
+ Update();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ virtual
+ VISU_LookupTable*
+ GetMapperTable();
+
+ virtual
+ VISU_LookupTable*
+ GetBarTable();
+
+ virtual
+ void
+ SetMapScale(vtkFloatingPointType theMapScale = 1.0);
+
+ virtual
+ vtkFloatingPointType
+ GetMapScale();
+
+ virtual
+ void
+ GetSourceRange(vtkFloatingPointType theRange[2]);
+
+ virtual
+ void
+ SetSourceRange();
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_ColoredPL();
+ VISU_ColoredPL(const VISU_ColoredPL&);
+
+ virtual
+ ~VISU_ColoredPL();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ Build();
+
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
+ //----------------------------------------------------------------------------
+ VISU_Extractor*
+ GetExtractorFilter();
+
+ VISU_FieldTransform*
+ GetFieldTransformFilter();
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkDataSet*
+ InsertCustomPL();
+
+private:
+ vtkSmartPointer<VISU_LookupTable> myMapperTable;
+ vtkSmartPointer<VISU_LookupTable> myBarTable;
+ vtkSmartPointer<VISU_Extractor> myExtractor;
+ vtkSmartPointer<VISU_FieldTransform> myFieldTransform;
+};
+
+#endif
#include <vtkAppendPolyData.h>
-using namespace std;
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_CutLinesPL);
+
+//----------------------------------------------------------------------------
VISU_CutLinesPL
::VISU_CutLinesPL()
{
myPosition = 0;
}
+
+//----------------------------------------------------------------------------
void
VISU_CutLinesPL
::DoShallowCopy(VISU_PipeLine *thePipeLine,
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+
+//----------------------------------------------------------------------------
void
VISU_CutLinesPL
::Init()
}
+//----------------------------------------------------------------------------
void
VISU_CutLinesPL
::SetPosition(vtkFloatingPointType thePosition)
myCondition = 0;
Modified();
}
+
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_CutLinesPL
::GetPosition()
{
vtkFloatingPointType aPosition = myPosition;
if(myCondition){
- vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
- GetInput2()->GetBounds(aBounds);
- GetDir(aDir,myAng[0],myBasePlane[0]);
- GetBoundProject(aBoundPrj,aBounds,aDir);
- aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[0];
+ vtkFloatingPointType aBounds[6];
+ GetClippedInput()->GetBounds(aBounds);
+
+ vtkFloatingPointType aDir[3];
+ GetDir(aDir,
+ myAng[0],
+ myBasePlane[0]);
+
+ vtkFloatingPointType aBoundPrj[3];
+ GetBoundProject(aBoundPrj,
+ aBounds,
+ aDir);
+
+ aPosition = aBoundPrj[0] + aBoundPrj[2] * myDisplacement[0];
}
return aPosition;
}
+
+//----------------------------------------------------------------------------
void
VISU_CutLinesPL
::SetDefault()
myCondition = 1;
Modified();
}
+
+
+//----------------------------------------------------------------------------
int
VISU_CutLinesPL
::IsDefault()
}
+//----------------------------------------------------------------------------
void
VISU_CutLinesPL
::Update()
{
ClearAppendPolyData(myAppendPolyData);
+
SetPartPosition(1);
+
vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
+
//Build base plane
- vtkFloatingPointType aDir[2][3], aBaseBounds[6];
- GetInput2()->GetBounds(aBaseBounds);
- GetDir(aDir[0],myAng[0],myBasePlane[0]);
- vtkUnstructuredGrid* anUnstructuredGrid =
- myFieldTransform->GetUnstructuredGridOutput();
- CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds,
- myPosition,myCondition,myDisplacement[0]);
+ vtkFloatingPointType aBaseBounds[6];
+ GetClippedInput()->GetBounds(aBaseBounds);
+
+ vtkFloatingPointType aDir[2][3];
+ GetDir(aDir[0],
+ myAng[0],
+ myBasePlane[0]);
+
+ vtkUnstructuredGrid* aGrid = GetFieldTransformFilter()->GetUnstructuredGridOutput();
+ CutWithPlanes(anAppendPolyData,
+ aGrid,1,
+ aDir[0],
+ aBaseBounds,
+ myPosition,
+ myCondition,
+ myDisplacement[0]);
//Build lines
- vtkFloatingPointType aBounds[6];
vtkDataSet *aDataSet = anAppendPolyData->GetOutput();
aDataSet->Update();
+
if(aDataSet->GetNumberOfCells() == 0)
- aDataSet = anUnstructuredGrid;
+ aDataSet = aGrid;
+
+ vtkFloatingPointType aBounds[6];
aDataSet->GetBounds(aBounds);
- GetDir(aDir[1],myAng[1],myBasePlane[1]);
- VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,aDataSet,GetNbParts(),aDir[1],aBounds,
- myPartPosition,myPartCondition,myDisplacement[1]);
+
+ GetDir(aDir[1],
+ myAng[1],
+ myBasePlane[1]);
+
+ VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,
+ aDataSet,
+ GetNbParts(),
+ aDir[1],
+ aBounds,
+ myPartPosition,
+ myPartCondition,
+ myDisplacement[1]);
anAppendPolyData->Delete();
+
//Calculate values for building of table
vtkMath::Cross(aDir[0],aDir[1],myDirLn);
for (int i = 0; i<3 ; i++) {
if(myDirLn[i] < 0.0)
myDirLn[i] = -1.0*myDirLn[i];//enk:: correction of bug Bug PAL10401
}
- GetBoundProject(myBoundPrjLn, aBaseBounds, myDirLn);
- VISU::Mul(myDirLn,myBoundPrjLn[0],myBasePnt);
+
+ GetBoundProject(myBoundPrjLn,
+ aBaseBounds,
+ myDirLn);
+
+ VISU::Mul(myDirLn,
+ myBoundPrjLn[0],
+ myBasePnt);
- CorrectPnt(myBasePnt,aBaseBounds);
+ CorrectPnt(myBasePnt,
+ aBaseBounds);
VISU_ScalarMapPL::Update();
}
+//----------------------------------------------------------------------------
void
VISU_CutLinesPL
::CutWithPlanes(vtkAppendPolyData* theAppendPolyData,
int thePartCondition,
vtkFloatingPointType theDisplacement)
{
- vector<vtkFloatingPointType> aPartPosition(1,thePartPosition);
- vector<int> aPartCondition(1,thePartCondition);
- VISU_CutPlanesPL::CutWithPlanes(theAppendPolyData,theDataSet,theNbPlanes,theDir,theBounds,
- aPartPosition,aPartCondition,theDisplacement);
+ std::vector<vtkFloatingPointType> aPartPosition(1,thePartPosition);
+ std::vector<int> aPartCondition(1,thePartCondition);
+ VISU_CutPlanesPL::CutWithPlanes(theAppendPolyData,
+ theDataSet,
+ theNbPlanes,
+ theDir,
+ theBounds,
+ aPartPosition,
+ aPartCondition,
+ theDisplacement);
}
+
+
+//----------------------------------------------------------------------------
class vtkAppendPolyData;
+
+//----------------------------------------------------------------------------
class VISU_CutLinesPL : public VISU_CutPlanesPL
{
public:
#include <vtkCutter.h>
#include <vtkPlane.h>
-using namespace std;
-
static vtkFloatingPointType EPS = 1.0E-3;
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_CutPlanesPL);
+
+//----------------------------------------------------------------------------
VISU_CutPlanesPL
::VISU_CutPlanesPL()
{
+ SetIsShrinkable(false);
+
myAppendPolyData = vtkAppendPolyData::New();
- myIsShrinkable = false;
myNbParts = 10;
myAng[1][0] = myAng[1][1] = myAng[1][2] = 0.0;
}
+
+//----------------------------------------------------------------------------
VISU_CutPlanesPL
::~VISU_CutPlanesPL()
{
myAppendPolyData->Delete();
+ myAppendPolyData = NULL;
}
+
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::DoShallowCopy(VISU_PipeLine *thePipeLine,
bool theIsCopyInput)
{
if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
+
SetOrientation(aPipeLine->GetPlaneOrientation(),
- aPipeLine->GetRotateX(),aPipeLine->GetRotateY());
+ aPipeLine->GetRotateX(),
+ aPipeLine->GetRotateY());
+
SetDisplacement(aPipeLine->GetDisplacement());
+
SetNbParts(aPipeLine->GetNbParts());
- for (int i = 0, iend = GetNbParts(); i < iend; i++)
- if(!aPipeLine->IsPartDefault(i)) SetPartPosition(i, aPipeLine->GetPartPosition(i));
+ for (int i = 0, iEnd = GetNbParts(); i < iEnd; i++)
+ if(!aPipeLine->IsPartDefault(i))
+ SetPartPosition(i, aPipeLine->GetPartPosition(i));
}
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::Init()
myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
}
-VISU_ScalarMapPL::THook*
+
+//----------------------------------------------------------------------------
+vtkDataSet*
VISU_CutPlanesPL
-::DoHook()
+::InsertCustomPL()
{
return myAppendPolyData->GetOutput();
}
+
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::Update()
{
ClearAppendPolyData(myAppendPolyData);
+
SetPartPosition();
+
vtkFloatingPointType aDir[3];
- GetDir(aDir,myAng[0],myBasePlane[0]);
+ GetDir(aDir,
+ myAng[0],
+ myBasePlane[0]);
+
vtkFloatingPointType aBounds[6];
- GetInput2()->GetBounds(aBounds);
- vtkDataSet* aDataSet = myFieldTransform->GetUnstructuredGridOutput();
- CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds,
- myPartPosition,myPartCondition,myDisplacement[0]);
+ GetClippedInput()->GetBounds(aBounds);
+
+ vtkDataSet* aDataSet = GetFieldTransformFilter()->GetUnstructuredGridOutput();
+ CutWithPlanes(myAppendPolyData,
+ aDataSet,
+ myNbParts,
+ aDir,
+ aBounds,
+ myPartPosition,
+ myPartCondition,
+ myDisplacement[0]);
Superclass::Update();
}
+
//----------------------------------------------------------------------------
unsigned long int
VISU_CutPlanesPL
theAppendPolyData->RemoveInput(theAppendPolyData->GetInput(i));
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType*
VISU_CutPlanesPL::
GetRx(vtkFloatingPointType theRx[3][3],
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType*
VISU_CutPlanesPL
::GetRy(vtkFloatingPointType theRy[3][3],
}
+//----------------------------------------------------------------------------
vtkFloatingPointType*
VISU_CutPlanesPL
::GetRz(vtkFloatingPointType theRz[3][3],
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::CorrectPnt(vtkFloatingPointType thePnt[3],
}
}
+
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::GetBoundProject(vtkFloatingPointType BoundPrj[3],
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
}
+//----------------------------------------------------------------------------
const VISU_CutPlanesPL::PlaneOrientation&
VISU_CutPlanesPL
::GetPlaneOrientation(int theNum)
return 0;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_CutPlanesPL
::GetRotateY(int theNum)
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_CutPlanesPL
::GetDisplacement(int theNum)
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::SetDisplacement(vtkFloatingPointType theDisp,
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::SetNbParts(int theNb)
{
myNbParts = theNb;
myPartPosition.resize(myNbParts);
- myPartCondition.resize(myNbParts,1);
+ myPartCondition.resize(myNbParts, 1);
Modified();
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::SetPartPosition(int thePartNumber,
{
if(thePartNumber >= myNbParts)
return;
+
myPartPosition[thePartNumber] = thePartPosition;
myPartCondition[thePartNumber] = 0;
Modified();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_CutPlanesPL
::GetPartPosition(int thePartNumber,
{
if(thePartNumber >= myNbParts)
return 0;
+
vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
if(myPartCondition[thePartNumber]){
vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
- GetInput2()->GetBounds(aBounds);
- GetDir(aDir,myAng[theNum],myBasePlane[theNum]);
- GetBoundProject(aBoundPrj,aBounds,aDir);
- if (myNbParts > 1){
+ GetClippedInput()->GetBounds(aBounds);
+
+ GetDir(aDir,
+ myAng[theNum],
+ myBasePlane[theNum]);
+
+ GetBoundProject(aBoundPrj,
+ aBounds,
+ aDir);
+
+ if(myNbParts > 1){
vtkFloatingPointType aDBoundPrj = aBoundPrj[2]/(myNbParts - 1);
vtkFloatingPointType aDisplacement = aDBoundPrj * myDisplacement[theNum];
vtkFloatingPointType aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
}else
aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
}
+
return aPosition;
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::SetPartDefault(int thePartNumber)
{
- if(thePartNumber >= myNbParts) return;
+ if(thePartNumber >= myNbParts)
+ return;
+
myPartPosition[thePartNumber] = GetPartPosition(thePartNumber);
myPartCondition[thePartNumber] = 1;
Modified();
}
+
+
+//----------------------------------------------------------------------------
int
VISU_CutPlanesPL
::IsPartDefault(int thePartNumber)
{
- if(thePartNumber >= myNbParts) return 1;
+ if(thePartNumber >= myNbParts)
+ return 1;
+
return myPartCondition[thePartNumber];
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::GetDir(vtkFloatingPointType theDir[3],
iPlane = 1;
break;
}
+
for(int i = 0; i < 3; i++)
theDir[i] = aRotation[i][iPlane];
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
}
+//----------------------------------------------------------------------------
void
VISU_CutPlanesPL
::CutWithPlanes(vtkAppendPolyData* theAppendPolyData,
int theNbPlanes,
vtkFloatingPointType theDir[3],
vtkFloatingPointType theBounds[6],
- const vector<vtkFloatingPointType>& thePlanePosition,
- const vector<int>& thePlaneCondition,
+ const std::vector<vtkFloatingPointType>& thePlanePosition,
+ const std::vector<int>& thePlaneCondition,
vtkFloatingPointType theDisplacement)
{
vtkFloatingPointType aBoundPrj[3], aOrig[3], aPosition;
aPolyData->Update();
theAppendPolyData->Update();
}
+
+
+//----------------------------------------------------------------------------
class vtkAppendPolyData;
+
+//----------------------------------------------------------------------------
class VISU_CutPlanesPL : public VISU_ScalarMapPL
{
-protected:
- VISU_CutPlanesPL();
- VISU_CutPlanesPL(const VISU_CutPlanesPL&);
public:
vtkTypeMacro(VISU_CutPlanesPL,VISU_ScalarMapPL);
static VISU_CutPlanesPL* New();
const std::vector<int>& thePlaneCondition,
vtkFloatingPointType theDisplacement);
protected:
+ VISU_CutPlanesPL();
+ VISU_CutPlanesPL(const VISU_CutPlanesPL&);
+
virtual
- THook*
- DoHook();
+ vtkDataSet*
+ InsertCustomPL();
virtual
void
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_DataSetMapperHolder.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_DataSetMapperHolder.hxx"
+#include "SALOME_ExtractGeometry.h"
+#include "VISU_LookupTable.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkDataSetMapper.h>
+#include <vtkUnstructuredGrid.h>
+
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_DataSetMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_DataSetMapperHolder
+::VISU_DataSetMapperHolder():
+ myExtractGeometry(SALOME_ExtractGeometry::New())
+{
+ if(MYDEBUG) MESSAGE("VISU_DataSetMapperHolder::VISU_DataSetMapperHolder - "<<this);
+
+ // Clipping functionality
+ myExtractGeometry->Delete();
+ myExtractGeometry->SetStoreMapping(true);
+
+ vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+ myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
+ anImplicitBoolean->SetOperationTypeToIntersection();
+ anImplicitBoolean->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_DataSetMapperHolder
+::~VISU_DataSetMapperHolder()
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_DataSetMapperHolder::~VISU_DataSetMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput)
+{
+ if(VISU_DataSetMapperHolder* aMapperHolder = dynamic_cast<VISU_DataSetMapperHolder*>(theMapperHolder)){
+ if(theIsCopyInput)
+ SetUnstructuredGridIDMapper(aMapperHolder->GetUnstructuredGridIDMapper());
+
+ VISU::CopyDataSetMapper(GetDataSetMapper(),
+ aMapperHolder->GetDataSetMapper(),
+ theIsCopyInput);
+ }
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_DataSetMapperHolder
+::GetMemorySize()
+{
+ unsigned long int aSize = 0;
+
+ if(myExtractGeometry->GetInput())
+ if(vtkDataSet* aDataSet = myExtractGeometry->GetOutput())
+ aSize = aDataSet->GetActualMemorySize() * 1024;
+
+ aSize += Superclass::GetMemorySize();
+
+ return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
+{
+ myExtractGeometry->SetInput(theIDMapper->GetUnstructuredGridOutput());
+ myUnstructuredGridIDMapper = theIDMapper;
+ SetIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PUnstructuredGridIDMapper&
+VISU_DataSetMapperHolder
+::GetUnstructuredGridIDMapper()
+{
+ return myUnstructuredGridIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkUnstructuredGrid*
+VISU_DataSetMapperHolder
+::GetUnstructuredGridInput()
+{
+ if(myUnstructuredGridIDMapper)
+ return myUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_DataSetMapperHolder
+::GetClippedInput()
+{
+ vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
+ aDataSet->Update();
+ return aDataSet;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::OnCreateMapper()
+{
+ myDataSetMapper = vtkDataSetMapper::New();
+ myDataSetMapper->Delete();
+ SetMapper(myDataSetMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetDataSetMapper(vtkDataSetMapper* theMapper)
+{
+ myDataSetMapper = theMapper;
+ SetMapper(myDataSetMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSetMapper*
+VISU_DataSetMapperHolder
+::GetDataSetMapper()
+{
+ GetMapper();
+ return myDataSetMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetLookupTable(VISU_LookupTable* theLookupTable)
+{
+ myDataSetMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetNodeObjID(vtkIdType theID)
+{
+ vtkIdType anID = myExtractGeometry->GetNodeObjId(theID);
+ return Superclass::GetNodeObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetNodeVTKID(vtkIdType theID)
+{
+ vtkIdType anID = Superclass::GetNodeVTKID(theID);
+ return myExtractGeometry->GetNodeVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType*
+VISU_DataSetMapperHolder
+::GetNodeCoord(int theObjID)
+{
+ return Superclass::GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetElemObjID(vtkIdType theID)
+{
+ vtkIdType anID = myExtractGeometry->GetElemObjId(theID);
+ return Superclass::GetElemObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetElemVTKID(vtkIdType theID)
+{
+ vtkIdType anID = Superclass::GetElemVTKID(theID);
+ return myExtractGeometry->GetElemVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkCell*
+VISU_DataSetMapperHolder
+::GetElemCell(vtkIdType theObjID)
+{
+ return Superclass::GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+ myExtractGeometry->SetImplicitFunction(theFunction);
+}
+
+//----------------------------------------------------------------------------
+vtkImplicitFunction *
+VISU_DataSetMapperHolder
+::GetImplicitFunction()
+{
+ return myExtractGeometry->GetImplicitFunction();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::RemoveAllClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->RemoveAllItems();
+ aBoolean->Modified(); // VTK bug
+ }
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_DataSetMapperHolder
+::GetNumberOfClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ return aFunction->GetNumberOfItems();
+ }
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU_DataSetMapperHolder
+::AddClippingPlane(vtkPlane* thePlane)
+{
+ if (thePlane) {
+ if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->AddItem(thePlane);
+ // Check, that at least one cell present after clipping.
+ // This check was introduced because of bug IPAL8849.
+ vtkDataSet* aClippedDataSet = GetClippedInput();
+ if(aClippedDataSet->GetNumberOfCells() < 1)
+ return false;
+ }
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane*
+VISU_DataSetMapperHolder
+::GetClippingPlane(vtkIdType theID)
+{
+ vtkPlane* aPlane = NULL;
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ vtkImplicitFunction* aFun = NULL;
+ aFunction->InitTraversal();
+ for(vtkIdType anID = 0; anID <= theID; anID++)
+ aFun = aFunction->GetNextItem();
+ aPlane = dynamic_cast<vtkPlane*>(aFun);
+ }
+ }
+ return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetExtractInside(bool theMode)
+{
+ myExtractGeometry->SetExtractInside(theMode);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetExtractBoundaryCells(bool theMode)
+{
+ myExtractGeometry->SetExtractBoundaryCells(theMode);
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_DataSetMapperHolder.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_DataSetMapperHolder_HeaderFile
+#define VISU_DataSetMapperHolder_HeaderFile
+
+#include "VISU_MapperHolder.hxx"
+
+class vtkDataSetMapper;
+class vtkUnstructuredGrid;
+class SALOME_ExtractGeometry;
+
+
+//----------------------------------------------------------------------------
+class VISU_DataSetMapperHolder : public VISU_MapperHolder
+{
+public:
+ vtkTypeMacro(VISU_DataSetMapperHolder, VISU_MapperHolder);
+
+ static
+ VISU_DataSetMapperHolder*
+ New();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput);
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //----------------------------------------------------------------------------
+ void
+ SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper);
+
+ const VISU::PUnstructuredGridIDMapper&
+ GetUnstructuredGridIDMapper();
+
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridInput();
+
+ virtual
+ vtkDataSetMapper*
+ GetDataSetMapper();
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID);
+
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID);
+
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+ virtual
+ vtkImplicitFunction*
+ GetImplicitFunction();
+
+ virtual
+ void
+ SetExtractInside(bool theMode);
+
+ virtual
+ void
+ SetExtractBoundaryCells(bool theMode);
+
+ //----------------------------------------------------------------------------
+ // Clipping planes
+ virtual
+ void
+ RemoveAllClippingPlanes();
+
+ virtual
+ vtkIdType
+ GetNumberOfClippingPlanes();
+
+ virtual
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID);
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_DataSetMapperHolder();
+ VISU_DataSetMapperHolder(const VISU_DataSetMapperHolder&);
+
+ virtual
+ ~VISU_DataSetMapperHolder();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ OnCreateMapper();
+
+ void
+ SetDataSetMapper(vtkDataSetMapper* theMapper);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetLookupTable(VISU_LookupTable* theLookupTable);
+
+ virtual
+ vtkDataSet*
+ GetClippedInput();
+
+private:
+ //----------------------------------------------------------------------------
+ VISU::PUnstructuredGridIDMapper myUnstructuredGridIDMapper;
+ vtkSmartPointer<vtkDataSetMapper> myDataSetMapper;
+ vtkSmartPointer<SALOME_ExtractGeometry> myExtractGeometry; //!< Clipping
+};
+
+#endif
#include <vtkWarpVector.h>
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_DeformedShapePL);
+
+//----------------------------------------------------------------------------
VISU_DeformedShapePL
-::VISU_DeformedShapePL()
+::VISU_DeformedShapePL():
+ myScaleFactor(0.0)
{
myWarpVector = vtkWarpVector::New();
myCellDataToPointData = vtkCellDataToPointData::New();
}
+
+//----------------------------------------------------------------------------
VISU_DeformedShapePL
::~VISU_DeformedShapePL()
{
- myWarpVector->UnRegisterAllOutputs();
myWarpVector->Delete();
- myCellDataToPointData->UnRegisterAllOutputs();
myCellDataToPointData->Delete();
}
+
+//----------------------------------------------------------------------------
void
VISU_DeformedShapePL
::DoShallowCopy(VISU_PipeLine *thePipeLine,
if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
SetScale(aPipeLine->GetScale());
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_DeformedShapePL
::GetScaleFactor(vtkDataSet* theDataSet)
{
- if(!theDataSet) return 0.0;
+ if(!theDataSet)
+ return 0.0;
+
theDataSet->Update();
+
int aNbCells = theDataSet->GetNumberOfCells();
int aNbPoints = theDataSet->GetNumberOfPoints();
int aNbElem = aNbCells? aNbCells: aNbPoints;
+
vtkFloatingPointType* aBounds = theDataSet->GetBounds();
vtkFloatingPointType aVolume = 1, aVol, idim = 0;
for(int i = 0; i < 6; i += 2){
}
}
aVolume /= aNbElem;
- return pow(aVolume,vtkFloatingPointType(1.0/idim));
+ return pow(aVolume, vtkFloatingPointType(1.0/idim));
}
+//----------------------------------------------------------------------------
void
VISU_DeformedShapePL
::SetScale(vtkFloatingPointType theScale)
{
+ if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), theScale))
+ return;
+
myWarpVector->SetScaleFactor(theScale);
myScaleFactor = theScale;
- Modified();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_DeformedShapePL
::GetScale()
return myScaleFactor;
}
+
//----------------------------------------------------------------------------
void
VISU_DeformedShapePL
::Init()
{
Superclass::Init();
+
vtkFloatingPointType aScalarRange[2];
GetSourceRange(aScalarRange);
- vtkDataSet* aDataSet = GetInput2();
+ vtkDataSet* aDataSet = GetClippedInput();
vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
static double EPS = 1.0 / VTK_LARGE_FLOAT;
SetScale(0.0);
}
+
//----------------------------------------------------------------------------
-VISU_ScalarMapPL::THook*
+vtkDataSet*
VISU_DeformedShapePL
-::DoHook()
+::InsertCustomPL()
{
- VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,GetInput2(),myFieldTransform);
+ VISU::CellDataToPoint(myWarpVector,
+ myCellDataToPointData,
+ GetClippedInput(),
+ GetFieldTransformFilter());
return myWarpVector->GetOutput();
}
-//----------------------------------------------------------------------------
-void
-VISU_DeformedShapePL
-::Update()
-{
- Superclass::Update();
-}
//----------------------------------------------------------------------------
unsigned long int
Superclass::SetMapScale(theMapScale);
myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
- Modified();
}
+
+
+//----------------------------------------------------------------------------
void
Init();
- virtual
- void
- Update();
-
//! Gets memory size used by the instance (bytes).
virtual
unsigned long int
~VISU_DeformedShapePL();
virtual
- THook*
- DoHook();
+ vtkDataSet*
+ InsertCustomPL();
virtual
void
myScalarMode = 1;
}
+
//----------------------------------------------------------------------------
VISU_Extractor
::~VISU_Extractor()
{}
+
//----------------------------------------------------------------------------
void
VISU_Extractor
}
}
+//----------------------------------------------------------------------------
+int
+VISU_Extractor
+::GetScalarMode()
+{
+ return myScalarMode;
+}
+
//----------------------------------------------------------------------------
template<typename TValueType>
//----------------------------------------------------------------------------
-void VISU_Extractor::Execute()
+void
+VISU_Extractor
+::Execute()
{
vtkDataSet *input = this->GetInput(), *output = this->GetOutput();
output->CopyStructure(input);
#ifndef VISU_Extractor_HeaderFile
#define VISU_Extractor_HeaderFile
-#include <vtkPointSetToPointSetFilter.h>
+#include <vtkDataSetToDataSetFilter.h>
-class VTK_EXPORT VISU_Extractor : public vtkPointSetToPointSetFilter{
+
+//----------------------------------------------------------------------------
+class VTK_EXPORT VISU_Extractor : public vtkDataSetToDataSetFilter
+{
public:
- vtkTypeMacro(VISU_Extractor,vtkPointSetToPointSetFilter);
- static VISU_Extractor *New();
+ vtkTypeMacro(VISU_Extractor, vtkDataSetToDataSetFilter);
+
+ static
+ VISU_Extractor
+ *New();
- virtual int GetScalarMode(){ return myScalarMode;}
- virtual void SetScalarMode(int theScalarMode = 0);
+ virtual
+ int
+ GetScalarMode();
+
+ virtual
+ void
+ SetScalarMode(int theScalarMode = 0);
protected:
VISU_Extractor();
VISU_Extractor(const VISU_Extractor&);
+
~VISU_Extractor();
- virtual void Execute();
+ virtual
+ void
+ Execute();
int myScalarMode;
};
vtkTypeMacro(VISU_FieldTransform,vtkDataSetToDataSetFilter);
static VISU_FieldTransform *New();
- virtual void Update();
- virtual unsigned long GetMTime();
+ virtual
+ void
+ Update();
+
+ virtual
+ unsigned long
+ GetMTime();
- static double Ident(double theArg);
- static double Log10(double theArg);
+ static
+ double
+ Ident(double theArg);
+
+ static
+ double
+ Log10(double theArg);
+
typedef double (*TTransformFun)(double);
- void SetScalarTransform(TTransformFun theFunction);
- TTransformFun GetScalarTransform() { return myFunction;}
- void SetSpaceTransform(VTKViewer_Transform* theTransform);
- VTKViewer_Transform* GetSpaceTransform() { return myTransform;}
+ void
+ SetScalarTransform(TTransformFun theFunction);
+
+ TTransformFun
+ GetScalarTransform()
+ {
+ return myFunction;
+ }
+
+ void
+ SetSpaceTransform(VTKViewer_Transform* theTransform);
+
+ VTKViewer_Transform*
+ GetSpaceTransform()
+ {
+ return myTransform;
+ }
- vtkFloatingPointType* GetScalarRange(){ return myScalarRange; }
- void SetScalarRange(vtkFloatingPointType theScalarRange[2]);
- void SetScalarMin(vtkFloatingPointType theValue);
- void SetScalarMax(vtkFloatingPointType theValue);
+ vtkFloatingPointType*
+ GetScalarRange()
+ {
+ return myScalarRange;
+ }
+
+ void
+ SetScalarRange(vtkFloatingPointType theScalarRange[2]);
+
+ void
+ SetScalarMin(vtkFloatingPointType theValue);
+
+ void
+ SetScalarMax(vtkFloatingPointType theValue);
protected:
VISU_FieldTransform();
- virtual ~VISU_FieldTransform();
+
+ virtual
+ ~VISU_FieldTransform();
+
VISU_FieldTransform(const VISU_FieldTransform&) {};
void operator=(const VISU_FieldTransform&) {};
- void Execute();
+
+ virtual
+ void
+ Execute();
VTKViewer_Transform *myTransform;
TTransformFun myFunction;
#include "VISU_GaussPointsPL.hxx"
-#include "VISU_DeformedShapePL.hxx"
-#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_ExtractGeometry.h"
-#include "VISU_DeformedShapePL.hxx"
+#include "VISU_PointSpriteMapperHolder.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VTKViewer_PassThroughFilter.h"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_LookupTable.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
#include <vtkPointSource.h>
#include <vtkElevationFilter.h>
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::VISU_GaussPointsPL():
- myIsDeformed(false),
myScaleFactor(0.0),
myMagnificationIncrement(2)
{
- myExtractGeometry->SetExtractInside(0);
-
- myPSMapper = VISU_OpenGLPointSpriteMapper::New();
- myPSMapper->SetColorModeToMapScalars();
- myPSMapper->ScalarVisibilityOn();
-
- myGeomFilter = vtkGeometryFilter::New();
-
myWarpVector = vtkWarpVector::New();
myGlyph = vtkGlyph3D::New();
myGlyph->SetColorModeToColorByScalar();
myGlyph->ClampingOn();
- myExtractor->SetInput( myExtractGeometry->GetOutput() );
- myFieldTransform->SetInput( myExtractor->GetOutput() );
-
mySphereSource = vtkSphereSource::New();
mySphereSource->SetThetaResolution( 8 );
mySphereSource->SetPhiResolution( 8 );
for(int i = 0; i < 3; i++)
myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
-
- // Deformed Shape
- myPassFilter[0]->SetInput(myFieldTransform->GetUnstructuredGridOutput());
-
- myPassFilter[1]->SetInput(myPassFilter[0]->GetOutput());
-
- myGeomFilter->SetInput( myPassFilter[1]->GetOutput() );
-
- // Geometrical Sphere
- myPassFilter[2]->SetInput(myGeomFilter->GetOutput());
-
- myPSMapper->SetInput( myPassFilter[2]->GetPolyDataOutput() );
}
VISU_GaussPointsPL
::~VISU_GaussPointsPL()
{
- if (this->myPSMapper)
- {
- this->myPSMapper->Delete();
- this->myPSMapper = NULL;
- }
- if (this->myGeomFilter)
- {
- this->myGeomFilter->Delete();
- this->myGeomFilter = NULL;
- }
-
myWarpVector->Delete();
myGlyph->Delete();
//----------------------------------------------------------------------------
-unsigned long int
+void
+VISU_GaussPointsPL
+::OnCreateMapperHolder()
+{
+ myPointSpriteMapperHolder = VISU_PointSpriteMapperHolder::New();
+ myPointSpriteMapperHolder->Delete();
+
+ SetMapperHolder(myPointSpriteMapperHolder.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theIDMapper)
+{
+ GetPointSpriteMapperHolder()->SetGaussPtsIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PGaussPtsIDMapper&
+VISU_GaussPointsPL
+::GetGaussPtsIDMapper()
+{
+ return GetPointSpriteMapperHolder()->GetGaussPtsIDMapper();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PointSpriteMapperHolder*
VISU_GaussPointsPL
-::GetMTime()
+::GetPointSpriteMapperHolder()
{
- unsigned long int aTime = std::max(Superclass::GetMTime(), myPSMapper->GetMTime());
- return aTime;
+ GetMapperHolder();
+
+ return myPointSpriteMapperHolder.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_GaussPointsPL
+::GetParentMesh()
+{
+ VISU::TNamedIDMapper* aNamedIDMapper = GetGaussPtsIDMapper()->GetParent();
+ return aNamedIDMapper->GetOutput();
}
//----------------------------------------------------------------------------
CopyGlyph( aPipeLine->myGlyph, this->myGlyph );
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
//----------------------------------------------------------------------------
-void
+VISU_OpenGLPointSpriteMapper*
VISU_GaussPointsPL
-::DoCopyMapper(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
+::GetPointSpriteMapper()
{
- if(VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
- if(theIsCopyInput)
- SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
- Update();
- VISU::CopyPointSpriteDataMapper(GetPSMapper(),
- aPipeLine->GetPSMapper(),
- theIsCopyInput);
- }
+ return GetPointSpriteMapperHolder()->GetPointSpriteMapper();
}
//----------------------------------------------------------------------------
-VISU_PipeLine::TMapper*
-VISU_GaussPointsPL
-::GetMapper()
-{
- return GetPSMapper();
-}
-
-VISU_OpenGLPointSpriteMapper*
-VISU_GaussPointsPL
-::GetPSMapper()
-{
- if(GetInput()){
- if(!myPSMapper->GetInput()){
- GetInput2()->Update();
- Build();
- Init();
- }
- myPSMapper->Update();
- }
- return myPSMapper;
-}
-
vtkPolyData*
VISU_GaussPointsPL
::GetPickableDataSet()
{
- return myGeomFilter->GetOutput();
+ return myPassFilter[1]->GetPolyDataOutput();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
{
Superclass::Init();
+ SetExtractInside(false);
+
vtkDataSet* aDataSet = GetParentMesh();
vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
SetScale(0.0);
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::Build()
-{}
+{
+ Superclass::Build();
+
+ // Deformed Shape
+ myPassFilter[0]->SetInput(GetFieldTransformFilter()->GetOutput());
+
+ myPassFilter[1]->SetInput(myPassFilter[0]->GetOutput());
+
+ // Geometrical Sphere
+ myPassFilter[2]->SetInput(myPassFilter[1]->GetOutput());
+
+ GetPointSpriteMapper()->SetInput( myPassFilter[2]->GetPolyDataOutput() );
+
+ // Update according the current state
+ SetIsDeformed(GetIsDeformed());
+
+ SetPrimitiveType(GetPrimitiveType());
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::Update()
{
- //cout << "VISU_GaussPointsPL::Update()" << endl;
- vtkFloatingPointType* aScalarRange = GetScalarRange();
- mySourceScalarRange[0] = aScalarRange[0];
- mySourceScalarRange[1] = aScalarRange[1];
- myDeltaScalarRange = aScalarRange[1] - aScalarRange[0];
-
SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) );
- vtkMapper* aMapper = GetMapper();
- vtkDataSet* aDataSet = aMapper->GetInput();
- vtkCellData* aCellData = aDataSet->GetCellData();
- myScalarArray = aCellData->GetScalars();
-
- myPSMapper->SetLookupTable( myMapperTable );
- if(!VISU::CheckIsSameRange(myPSMapper->GetScalarRange(), aScalarRange))
- myPSMapper->SetScalarRange( aScalarRange );
-
this->UpdateGlyph();
Superclass::Update();
}
+
//----------------------------------------------------------------------------
unsigned long int
VISU_GaussPointsPL
::GetMemorySize()
{
- vtkDataSet* aDataSet = myGeomFilter->GetOutput();
- unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
+ unsigned long int aSize = 0;
- if(GetIsDeformed()){
- aDataSet = myWarpVector->GetOutput();
- aSize += aDataSet->GetActualMemorySize() * 1024;
- }
+ if(GetIsDeformed())
+ if(vtkDataSet* aDataSet = myWarpVector->GetOutput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
- if(GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere){
- aDataSet = myGlyph->GetOutput();
- aSize += aDataSet->GetActualMemorySize() * 1024;
- }
+ if(GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere)
+ if(vtkDataSet* aDataSet = myGlyph->GetOutput())
+ aSize += aDataSet->GetActualMemorySize() * 1024;
return aSize;
}
{
vtkFloatingPointType* aScalarRange = GetScalarRange();
- if( myPSMapper->GetPointSpriteMode() == 0 ) // Results
+ if( GetPointSpriteMapper()->GetPointSpriteMode() == 0 ) // Results
{
myGlyph->ClampingOn();
myGlyph->SetScaleModeToScaleByScalar();
myGlyph->SetScaleFactor( 1.0 );
}
}
- else if( myPSMapper->GetPointSpriteMode() == 1 ) // Geometry
+ else if( GetPointSpriteMapper()->GetPointSpriteMode() == 1 ) // Geometry
{
myGlyph->ClampingOff();
myGlyph->SetScaleModeToDataScalingOff();
if(!VISU::CheckIsSameValue(myGlyph->GetScaleFactor(), aScaleFactor))
myGlyph->SetScaleFactor( aScaleFactor );
}
- else if( myPSMapper->GetPointSpriteMode() == 2 ) // Outside
+ else if( GetPointSpriteMapper()->GetPointSpriteMode() == 2 ) // Outside
{
myGlyph->ClampingOff();
myGlyph->SetScaleModeToDataScalingOff();
mySphereSource->SetRadius( aRadius );
}
+
//----------------------------------------------------------------------------
VISU::TGaussPointID
VISU_GaussPointsPL
-::GetObjID(vtkIdType theID) const
+::GetObjID(vtkIdType theID)
{
- return myGaussPtsIDMapper->GetObjID(theID);
+ return GetGaussPtsIDMapper()->GetObjID(theID);
}
-vtkFloatingPointType*
-VISU_GaussPointsPL
-::GetNodeCoord(int theObjID)
-{
- vtkIdType anID = GetNodeVTKID(theObjID);
- vtkDataSet* aDataSet = myGeomFilter->GetInput();
- return aDataSet->GetPoint(anID);
-}
-
-void
-VISU_GaussPointsPL
-::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper)
-{
- myGaussPtsIDMapper = theGaussPtsIDMapper;
- SetIDMapper(myGaussPtsIDMapper);
-}
-
-const VISU::PGaussPtsIDMapper&
-VISU_GaussPointsPL
-::GetGaussPtsIDMapper() const
-{
- return myGaussPtsIDMapper;
-}
-
-VISU::TVTKOutput*
-VISU_GaussPointsPL
-::GetParentMesh() const
-{
- VISU::TNamedIDMapper* aNamedIDMapper = myGaussPtsIDMapper->GetParent();
- return aNamedIDMapper->GetVTKOutput();
-}
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetIsDeformed( bool theIsDeformed )
{
- if( GetIsDeformed() == theIsDeformed )
+ if(GetIsDeformed() == theIsDeformed)
return;
- if( theIsDeformed )
- {
+ if(theIsDeformed){
myWarpVector->SetInput( myPassFilter[0]->GetUnstructuredGridOutput() );
myPassFilter[1]->SetInput(myWarpVector->GetOutput());
- }
- else
+ }else
myPassFilter[1]->SetInput(myPassFilter[0]->GetOutput());
-
- myIsDeformed = theIsDeformed;
}
//----------------------------------------------------------------------------
bool
VISU_GaussPointsPL
-::GetIsDeformed() const
+::GetIsDeformed()
{
- return myIsDeformed;
+ return myPassFilter[1]->GetInput() != myPassFilter[0]->GetOutput();
}
//----------------------------------------------------------------------------
if(GetBicolor() == theBicolor)
return;
- myMapperTable->SetBicolor( theBicolor );
- myBarTable->SetBicolor( theBicolor );
+ GetMapperTable()->SetBicolor( theBicolor );
+ GetBarTable()->SetBicolor( theBicolor );
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::GetBicolor()
{
- return myMapperTable->GetBicolor();
+ return GetMapperTable()->GetBicolor();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetIsColored(bool theIsColored)
{
- myPSMapper->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry
+ GetPointSpriteMapper()->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::GetIsColored()
{
- return myPSMapper->GetPointSpriteMode() == 0;
+ return GetPointSpriteMapper()->GetPointSpriteMode() == 0;
}
//----------------------------------------------------------------------------
if( thePrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
{
- myGlyph->SetInput( myGeomFilter->GetOutput() );
+ myGlyph->SetInput( myPassFilter[1]->GetOutput() );
myPassFilter[2]->SetInput(myGlyph->GetOutput());
}
else
- myPassFilter[2]->SetInput(myGeomFilter->GetOutput());
+ myPassFilter[2]->SetInput(myPassFilter[1]->GetOutput());
- myPSMapper->SetPrimitiveType( thePrimitiveType );
+ GetPointSpriteMapper()->SetPrimitiveType( thePrimitiveType );
}
+
//----------------------------------------------------------------------------
int
VISU_GaussPointsPL
::GetPrimitiveType()
{
- return myPSMapper->GetPrimitiveType();
+ return GetPointSpriteMapper()->GetPrimitiveType();
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetMaximumSupportedSize()
{
- return myPSMapper->GetMaximumSupportedSize();
+ return GetPointSpriteMapper()->GetMaximumSupportedSize();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetClamp(vtkFloatingPointType theClamp)
{
- myPSMapper->SetPointSpriteClamp( theClamp );
+ GetPointSpriteMapper()->SetPointSpriteClamp( theClamp );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetClamp()
{
- return myPSMapper->GetPointSpriteClamp();
+ return GetPointSpriteMapper()->GetPointSpriteClamp();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetSize(vtkFloatingPointType theSize)
{
- myPSMapper->SetPointSpriteSize( theSize );
+ GetPointSpriteMapper()->SetPointSpriteSize( theSize );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetSize()
{
- return myPSMapper->GetPointSpriteSize();
+ return GetPointSpriteMapper()->GetPointSpriteSize();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetMinSize(vtkFloatingPointType theMinSize)
{
- myPSMapper->SetPointSpriteMinSize( theMinSize );
+ GetPointSpriteMapper()->SetPointSpriteMinSize( theMinSize );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetMinSize()
{
- return myPSMapper->GetPointSpriteMinSize();
+ return GetPointSpriteMapper()->GetPointSpriteMinSize();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetMaxSize(vtkFloatingPointType theMaxSize)
{
- myPSMapper->SetPointSpriteMaxSize( theMaxSize );
+ GetPointSpriteMapper()->SetPointSpriteMaxSize( theMaxSize );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetMaxSize()
{
- return myPSMapper->GetPointSpriteMaxSize();
+ return GetPointSpriteMapper()->GetPointSpriteMaxSize();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetMagnification(vtkFloatingPointType theMagnification)
{
- myPSMapper->SetPointSpriteMagnification( theMagnification );
+ GetPointSpriteMapper()->SetPointSpriteMagnification( theMagnification );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetMagnification()
{
- return myPSMapper->GetPointSpriteMagnification();
+ return GetPointSpriteMapper()->GetPointSpriteMagnification();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
Modified();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold)
{
- myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
+ GetPointSpriteMapper()->SetPointSpriteAlphaThreshold( theAlphaThreshold );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetAlphaThreshold()
{
- return myPSMapper->GetPointSpriteAlphaThreshold();
+ return GetPointSpriteMapper()->GetPointSpriteAlphaThreshold();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
mySphereSource->SetPhiResolution( theResolution );
}
+
//----------------------------------------------------------------------------
int
VISU_GaussPointsPL
return mySphereSource->GetThetaResolution();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
SetMagnification( GetMagnification() * anIncrement );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
vtkFloatingPointType aDelta = aMaxSize - aMinSize;
vtkFloatingPointType aVal = theScalarArray->GetTuple1(theID);
- return aMinSize + aDelta*(aVal - mySourceScalarRange[0])/myDeltaScalarRange;
+ vtkFloatingPointType* aScalarRange = GetScalarRange();
+ vtkFloatingPointType aDeltaScalarRange = aScalarRange[1] - aScalarRange[0];
+
+ return aMinSize + aDelta*(aVal - aScalarRange[0]) / aDeltaScalarRange;
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
return GetAverageCellSize() * GetMaxSize();
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
{
vtkMapper* aMapper = GetMapper();
vtkDataSet* aDataSet = aMapper->GetInput();
- vtkCellData* aCellData = aDataSet->GetCellData();
- vtkDataArray* aScalarArray = aCellData->GetScalars();
+ vtkPointData* aPointData = aDataSet->GetPointData();
+ vtkDataArray* aScalarArray = aPointData->GetScalars();
return GetPointSize(theID, aScalarArray);
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetAverageCellSize(vtkFloatingPointType theAverageCellSize)
{
- myPSMapper->SetAverageCellSize( theAverageCellSize );
+ GetPointSpriteMapper()->SetAverageCellSize( theAverageCellSize );
}
+
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPointsPL
::GetAverageCellSize()
{
- return myPSMapper->GetAverageCellSize();
+ return GetPointSpriteMapper()->GetAverageCellSize();
}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetImageData(vtkImageData* theImageData)
{
- myPSMapper->SetImageData( theImageData );
+ GetPointSpriteMapper()->SetImageData( theImageData );
}
+
//----------------------------------------------------------------------------
vtkSmartPointer<vtkImageData>
VISU_GaussPointsPL
return aCompositeImageData;
}
-void VISU_GaussPointsPL::SetScale( vtkFloatingPointType theScale )
+
+void
+VISU_GaussPointsPL
+::SetScale( vtkFloatingPointType theScale )
{
if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), theScale))
return;
myScaleFactor = theScale;
}
-vtkFloatingPointType VISU_GaussPointsPL::GetScale()
+
+vtkFloatingPointType
+VISU_GaussPointsPL
+::GetScale()
{
return myWarpVector->GetScaleFactor();
}
-void VISU_GaussPointsPL::SetMapScale( vtkFloatingPointType theMapScale )
+
+void
+VISU_GaussPointsPL
+::SetMapScale( vtkFloatingPointType theMapScale )
{
Superclass::SetMapScale( theMapScale );
- myWarpVector->SetScaleFactor( myScaleFactor * theMapScale );
- Modified();
+ vtkFloatingPointType aMapScale = myScaleFactor * theMapScale;
+ if(VISU::CheckIsSameValue(myWarpVector->GetScaleFactor(), aMapScale))
+ return;
+
+ myWarpVector->SetScaleFactor( aMapScale );
}
#ifndef VISU_GaussPointsPL_HeaderFile
#define VISU_GaussPointsPL_HeaderFile
-#include "VISU_ScalarMapPL.hxx"
-#include "VISU_Convertor.hxx"
+#include "VISU_ColoredPL.hxx"
#include <vector>
class VTKViewer_PassThroughFilter;
class VISU_OpenGLPointSpriteMapper;
+class VISU_PointSpriteMapperHolder;
class vtkGeometryFilter;
class vtkGlyph3D;
class vtkWarpVector;
class SALOME_Transform;
+
+//----------------------------------------------------------------------------
//! Pipeline for the Gauss Points presentation.
/*!
* This class uses the special mapper (VISU_OpenGLPointSpriteMapper)
* for rendering the Gauss Points as Point Sprites.
*/
-class VISU_GaussPointsPL : public VISU_ScalarMapPL
+class VISU_GaussPointsPL : public VISU_ColoredPL
{
public:
- vtkTypeMacro(VISU_GaussPointsPL,VISU_ScalarMapPL);
+ //----------------------------------------------------------------------------
+ vtkTypeMacro(VISU_GaussPointsPL, VISU_ColoredPL);
static
- VISU_GaussPointsPL* New();
+ VISU_GaussPointsPL*
+ New();
- virtual
- unsigned long int
- GetMTime();
+ //----------------------------------------------------------------------------
+ void
+ SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
- //! Get the native mapper.
- virtual
- TMapper*
- GetMapper();
+ const VISU::PGaussPtsIDMapper&
+ GetGaussPtsIDMapper();
+
+ VISU_PointSpriteMapperHolder*
+ GetPointSpriteMapperHolder();
//! Get the internal #VISU_OpenGLPointSpriteMapper.
VISU_OpenGLPointSpriteMapper*
- GetPSMapper();
+ GetPointSpriteMapper();
+
+ vtkDataSet*
+ GetParentMesh();
//! Get an intermediate dataset that can be picked
vtkPolyData*
GetPickableDataSet();
+ //----------------------------------------------------------------------------
//! Redefined method for initialization of the pipeline.
virtual
void
Init();
- //! Redefined method for building the pipeline.
- virtual
- void
- Build();
-
//! Redefined method for updating the pipeline.
virtual
void
unsigned long int
GetMemorySize();
+ //----------------------------------------------------------------------------
//! Update glyph.
void
UpdateGlyph();
virtual
VISU::TGaussPointID
- GetObjID(vtkIdType theID) const;
-
- virtual
- vtkFloatingPointType*
- GetNodeCoord(vtkIdType theObjID);
-
- void
- SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
-
- const VISU::PGaussPtsIDMapper&
- GetGaussPtsIDMapper() const;
-
- VISU::TVTKOutput*
- GetParentMesh() const;
+ GetObjID(vtkIdType theID);
//! Set the Bicolor mode.
/*!
const char* theAlphaTexture );
public:
+ //----------------------------------------------------------------------------
virtual
void
SetIsDeformed( bool theIsDeformed );
virtual
bool
- GetIsDeformed() const;
+ GetIsDeformed();
virtual
void
SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
protected:
+ //----------------------------------------------------------------------------
VISU_GaussPointsPL();
virtual
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
+ OnCreateMapperHolder();
virtual
void
- DoCopyMapper(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
+ Build();
- bool myIsDeformed;
+ virtual
+ void
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
+private:
+ //----------------------------------------------------------------------------
vtkFloatingPointType myScaleFactor;
vtkWarpVector *myWarpVector;
std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
+ vtkSmartPointer<VISU_PointSpriteMapperHolder> myPointSpriteMapperHolder;
vtkGlyph3D* myGlyph;
vtkSphereSource* mySphereSource;
- VISU_OpenGLPointSpriteMapper* myPSMapper;
- VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
-
- vtkGeometryFilter* myGeomFilter;
-
- vtkDataArray *myScalarArray;
- vtkFloatingPointType mySourceScalarRange[2];
- vtkFloatingPointType myDeltaScalarRange;
-
- int myPrimitiveType;
vtkFloatingPointType myMagnificationIncrement;
};
#include "VISU_IsoSurfacesPL.hxx"
+#include "VISU_LookupTable.hxx"
+
#include "VISU_PipeLineUtils.hxx"
#include <vtkContourFilter.h>
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_IsoSurfacesPL);
+
+//----------------------------------------------------------------------------
VISU_IsoSurfacesPL
::VISU_IsoSurfacesPL()
{
+ SetIsShrinkable(false);
+
myContourFilter = vtkContourFilter::New();
+
myCellDataToPointData = vtkCellDataToPointData::New();
- myIsShrinkable = false;
}
+
+//----------------------------------------------------------------------------
VISU_IsoSurfacesPL
::~VISU_IsoSurfacesPL()
{
- myContourFilter->UnRegisterAllOutputs();
myContourFilter->Delete();
+ myContourFilter = NULL;
- myCellDataToPointData->UnRegisterAllOutputs();
myCellDataToPointData->Delete();
+ myCellDataToPointData = NULL;
}
+
+//----------------------------------------------------------------------------
void
VISU_IsoSurfacesPL
::DoShallowCopy(VISU_PipeLine *thePipeLine,
vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
SetRange(aRange);
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+
+//----------------------------------------------------------------------------
int
VISU_IsoSurfacesPL
::GetNbParts()
{
return myContourFilter->GetNumberOfContours();
}
+
+
+//----------------------------------------------------------------------------
void
VISU_IsoSurfacesPL
::SetNbParts(int theNb)
}
+//----------------------------------------------------------------------------
void
VISU_IsoSurfacesPL
-::SetScaling(int theScaling)
+::SetScalarRange(vtkFloatingPointType theRange[2])
{
- Superclass::SetScaling(theScaling);
+ Superclass::SetScalarRange(theRange);
SetRange(myRange);
}
+
+
+//----------------------------------------------------------------------------
void
VISU_IsoSurfacesPL
::SetRange(vtkFloatingPointType theRange[2])
{
if(theRange[0] <= theRange[1]){
- myRange[0] = theRange[0]; myRange[1] = theRange[1];
- vtkFloatingPointType aRange[2] = {myRange[0], myRange[1]};
+ myRange[0] = theRange[0];
+ myRange[1] = theRange[1];
+ vtkFloatingPointType aRange[2] = {theRange[0], theRange[1]};
if(GetScaling() == VTK_SCALE_LOG10)
- VISU_LookupTable::ComputeLogRange(theRange,aRange);
- myContourFilter->GenerateValues(GetNbParts(),aRange);
- Modified();
+ VISU_LookupTable::ComputeLogRange(theRange, aRange);
+ myContourFilter->GenerateValues(GetNbParts(), aRange);
}
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_IsoSurfacesPL
::GetMin()
return myRange[0];
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_IsoSurfacesPL
::GetMax()
void
+//----------------------------------------------------------------------------
VISU_IsoSurfacesPL
::Init()
{
Superclass::Init();
SetNbParts(10);
+
vtkFloatingPointType aScalarRange[2];
GetSourceRange(aScalarRange);
SetRange(aScalarRange);
}
-VISU_ScalarMapPL::THook*
+//----------------------------------------------------------------------------
+
+vtkDataSet*
VISU_IsoSurfacesPL
-::DoHook()
+::InsertCustomPL()
{
- VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
+ VISU::CellDataToPoint(myContourFilter,
+ myCellDataToPointData,
+ GetClippedInput(),
+ GetFieldTransformFilter());
return myContourFilter->GetOutput();
}
+//----------------------------------------------------------------------------
void
VISU_IsoSurfacesPL
::Update()
Superclass::Update();
}
+
//----------------------------------------------------------------------------
unsigned long int
VISU_IsoSurfacesPL
vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]};
if(GetScaling() == VTK_SCALE_LOG10)
VISU_LookupTable::ComputeLogRange(aRange,aNewRange);
- myContourFilter->GenerateValues(GetNbParts(),aNewRange);
- Modified();
+ myContourFilter->GenerateValues(GetNbParts(), aNewRange);
}
+
+
+//----------------------------------------------------------------------------
class vtkContourFilter;
class vtkCellDataToPointData;
+
+//----------------------------------------------------------------------------
class VISU_IsoSurfacesPL : public VISU_ScalarMapPL
{
public:
- vtkTypeMacro(VISU_IsoSurfacesPL,VISU_ScalarMapPL);
+ vtkTypeMacro(VISU_IsoSurfacesPL, VISU_ScalarMapPL);
static
VISU_IsoSurfacesPL*
virtual
void
- SetScaling(int theScaling = VTK_SCALE_LINEAR);
+ SetScalarRange(vtkFloatingPointType theRange[2]);
virtual
void
GetMemorySize();
virtual
- THook*
- DoHook();
+ vtkDataSet*
+ InsertCustomPL();
virtual
void
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_MapperHolder.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MapperHolder.hxx"
+#include "VISU_PipeLine.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkDataSet.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+VISU_MapperHolder
+::VISU_MapperHolder():
+ myPipeLine(NULL)
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_MapperHolder::VISU_MapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_MapperHolder
+::~VISU_MapperHolder()
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_MapperHolder::~VISU_MapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput)
+{
+ if(theIsCopyInput)
+ SetIDMapper(theMapperHolder->GetIDMapper());
+
+ VISU::CopyMapper(GetMapper(),
+ theMapperHolder->GetMapper(),
+ theIsCopyInput);
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_MapperHolder
+::GetMemorySize()
+{
+ unsigned long int aSize = 0;
+
+ if(myMapper.GetPointer())
+ if(vtkDataSet* aDataSet = myMapper->GetInput())
+ aSize = aDataSet->GetActualMemorySize() * 1024;
+
+ if(myIDMapper)
+ aSize += myIDMapper->GetMemorySize();
+
+ return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_MapperHolder
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+
+ if(myIDMapper)
+ if(vtkDataSet* aDataSet = myIDMapper->GetOutput())
+ aTime = std::max(aTime, aDataSet->GetMTime());
+
+ if(myMapper.GetPointer())
+ aTime = std::max(aTime, myMapper->GetMTime());
+
+ return aTime;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::SetPipeLine(VISU_PipeLine* thePipeLine)
+{
+ myPipeLine = thePipeLine;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::SetIDMapper(const VISU::PIDMapper& theIDMapper)
+{
+ myIDMapper = theIDMapper;
+
+ if(myPipeLine && GetInput())
+ if(!GetMapper()->GetInput()){
+ myPipeLine->Build();
+ myPipeLine->Init();
+ myPipeLine->Update();
+ }
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PIDMapper&
+VISU_MapperHolder
+::GetIDMapper()
+{
+ return myIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_MapperHolder
+::GetInput()
+{
+ if(myIDMapper)
+ return myIDMapper->GetOutput();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkMapper*
+VISU_MapperHolder
+::GetMapper()
+{
+ if(!myMapper.GetPointer())
+ OnCreateMapper();
+
+ return myMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_MapperHolder
+::GetOutput()
+{
+ if(myMapper.GetPointer())
+ return myMapper->GetInput();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::Update()
+{
+ if(myMapper.GetPointer())
+ return myMapper->Update();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_MapperHolder
+::SetMapper(vtkMapper* theMapper)
+{
+ myMapper = theMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_MapperHolder
+::GetNodeObjID(vtkIdType theID)
+{
+ return myIDMapper->GetNodeObjID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_MapperHolder
+::GetNodeVTKID(vtkIdType theID)
+{
+ return myIDMapper->GetNodeVTKID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType*
+VISU_MapperHolder
+::GetNodeCoord(vtkIdType theObjID)
+{
+ return myIDMapper->GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_MapperHolder
+::GetElemObjID(vtkIdType theID)
+{
+ return myIDMapper->GetElemObjID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_MapperHolder
+::GetElemVTKID(vtkIdType theID)
+{
+ return myIDMapper->GetElemVTKID(theID);
+}
+
+//----------------------------------------------------------------------------
+vtkCell*
+VISU_MapperHolder
+::GetElemCell(vtkIdType theObjID)
+{
+ return myIDMapper->GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_MapperHolder.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MapperHolder_HeaderFile
+#define VISU_MapperHolder_HeaderFile
+
+#include "VISU_IDMapper.hxx"
+
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+
+class vtkCell;
+class vtkPlane;
+class vtkMapper;
+class vtkDataSet;
+class vtkPointSet;
+class vtkImplicitFunction;
+
+class VISU_PipeLine;
+class VISU_LookupTable;
+
+
+//----------------------------------------------------------------------------
+class VISU_MapperHolder : public vtkObject
+{
+public:
+ vtkTypeMacro(VISU_MapperHolder, vtkObject);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput);
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
+ void
+ SetPipeLine(VISU_PipeLine* thePipeLine);
+
+ const VISU::PIDMapper&
+ GetIDMapper();
+
+ virtual
+ vtkDataSet*
+ GetInput();
+
+ virtual
+ vtkMapper*
+ GetMapper();
+
+ virtual
+ vtkDataSet*
+ GetOutput();
+
+ virtual
+ void
+ Update();
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID);
+
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID);
+
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction) = 0;
+
+ virtual
+ vtkImplicitFunction*
+ GetImplicitFunction() = 0;
+
+ //----------------------------------------------------------------------------
+ // Clipping planes
+ virtual
+ void
+ RemoveAllClippingPlanes() = 0;
+
+ virtual
+ vtkIdType
+ GetNumberOfClippingPlanes() = 0;
+
+ virtual
+ bool
+ AddClippingPlane(vtkPlane* thePlane) = 0;
+
+ virtual
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID) = 0;
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetLookupTable(VISU_LookupTable* theLookupTable) = 0;
+
+ virtual
+ vtkDataSet*
+ GetClippedInput() = 0;
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetExtractInside(bool theMode) = 0;
+
+ virtual
+ void
+ SetExtractBoundaryCells(bool theMode) = 0;
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_MapperHolder();
+ VISU_MapperHolder(const VISU_MapperHolder&);
+
+ virtual
+ ~VISU_MapperHolder();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ OnCreateMapper() = 0;
+
+ void
+ SetMapper(vtkMapper* theMapper);
+
+ void
+ SetIDMapper(const VISU::PIDMapper& theIDMapper);
+
+private:
+ //----------------------------------------------------------------------------
+ vtkSmartPointer<vtkMapper> myMapper;
+ VISU::PIDMapper myIDMapper;
+ VISU_PipeLine* myPipeLine;
+};
+
+#endif
//
//
//
-// File: VISU_PipeLine.cxx
+// File: VISU_MeshPL.cxx
// Author: Alexey PETROV
// Module : VISU
#include "VISU_MeshPL.hxx"
-#include "VTKViewer_GeometryFilter.h"
-#include <vtkProperty.h>
-#include <vtkObjectFactory.h>
+#include "VISU_DataSetMapperHolder.hxx"
+
#include <vtkDataSetMapper.h>
-#include <vtkUnstructuredGrid.h>
+#include <vtkObjectFactory.h>
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_MeshPL);
-VISU_MeshPL::VISU_MeshPL()
+
+//----------------------------------------------------------------------------
+VISU_MeshPL
+::VISU_MeshPL():
+ VISU_UnstructuredGridPL(this)
{
- myIsShrinkable = true;
+ SetIsShrinkable(true);
}
-void VISU_MeshPL::Build()
+
+//----------------------------------------------------------------------------
+void
+VISU_MeshPL
+::OnCreateMapperHolder()
{
- myMapper->SetInput(GetInput2());
+ VISU_UnstructuredGridPL::OnCreateMapperHolder();
}
-void VISU_MeshPL::Init()
+
+//----------------------------------------------------------------------------
+void
+VISU_MeshPL
+::Build()
{
+ GetDataSetMapperHolder()->GetDataSetMapper()->SetInput(GetInput());
}
+
+
+//----------------------------------------------------------------------------
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
-// File: VISU_PipeLine.hxx
+// File: VISU_MeshPL.hxx
// Author: Alexey PETROV
// Module : VISU
#define VISU_MeshPL_HeaderFile
#include "VISU_PipeLine.hxx"
+#include "VISU_UnstructuredGridPL.hxx"
-class VISU_MeshPL : public VISU_PipeLine{
+
+//----------------------------------------------------------------------------
+class VISU_MeshPL : public VISU_PipeLine,
+ public VISU_UnstructuredGridPL
+{
+public:
+ vtkTypeMacro(VISU_MeshPL, VISU_PipeLine);
+
+ //----------------------------------------------------------------------------
+ static
+ VISU_MeshPL*
+ New();
+
protected:
+ //----------------------------------------------------------------------------
VISU_MeshPL();
VISU_MeshPL(const VISU_MeshPL&);
-public:
- vtkTypeMacro(VISU_MeshPL,VISU_PipeLine);
- static VISU_MeshPL* New();
-
-public:
- virtual void Build();
- virtual void Init();
+
+ virtual
+ void
+ OnCreateMapperHolder();
+
+ virtual
+ void
+ Build();
};
#endif
#include "VISU_PipeLine.hxx"
-#include "VISU_PipeLineUtils.hxx"
-
-#include "SALOME_ExtractGeometry.h"
+#include "VISU_MapperHolder.hxx"
-#include <float.h>
-#include <algorithm>
+#include "VISU_PipeLineUtils.hxx"
#include <vtkObjectFactory.h>
-#include <vtkDataSetMapper.h>
-#include <vtkUnstructuredGrid.h>
-
#include <vtkPlane.h>
-#include <vtkExtractGeometry.h>
-#include <vtkImplicitBoolean.h>
-#include <vtkImplicitFunction.h>
-#include <vtkImplicitFunctionCollection.h>
-#include <vtkMath.h>
-static int MYVTKDEBUG = 0;
+#include <float.h>
+#include <algorithm>
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 0;
#endif
+
//----------------------------------------------------------------------------
VISU_PipeLine
::VISU_PipeLine():
- myMapper(vtkDataSetMapper::New()),
- myExtractGeometry(SALOME_ExtractGeometry::New())
+ myIsShrinkable(false)
{
if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
- SetDebug(MYVTKDEBUG);
-
- myMapper->Delete();
-
- // Clipping planes
- myExtractGeometry->Delete();
- myExtractGeometry->SetStoreMapping(true);
-
- vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
- myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
- anImplicitBoolean->SetOperationTypeToIntersection();
- anImplicitBoolean->Delete();
-
- myIsShrinkable = false;
}
+
//----------------------------------------------------------------------------
VISU_PipeLine
::~VISU_PipeLine()
if(MYDEBUG) MESSAGE("VISU_PipeLine::~VISU_PipeLine - "<<this);
}
+
//----------------------------------------------------------------------------
unsigned long int
VISU_PipeLine
::GetMTime()
{
- unsigned long int aTime = std::max(Superclass::GetMTime(),myMapper->GetMTime());
+ unsigned long int aTime = Superclass::GetMTime();
+
+ if(myMapperHolder.GetPointer())
+ aTime = std::max(aTime, myMapperHolder->GetMTime());
+
return aTime;
}
-//----------------------------------------------------------------------------
-// Turn debugging output on.
-void
-VISU_PipeLine
-::DebugOn()
-{
- //myExtractGeometry->DebugOn();
- Superclass::DebugOn();
-}
//----------------------------------------------------------------------------
-// Turn debugging output off.
-void
+unsigned long int
VISU_PipeLine
-::DebugOff()
+::GetMemorySize()
{
- //myExtractGeometry->DebugOff();
- Superclass::DebugOff();
+ unsigned long int aSize = 0;
+
+ if(myMapperHolder.GetPointer())
+ aSize += myMapperHolder->GetMemorySize();
+
+ return aSize;
}
+
//----------------------------------------------------------------------------
void
VISU_PipeLine
DoShallowCopy(thePipeLine, theIsCopyInput);
}
+
//----------------------------------------------------------------------------
void
VISU_PipeLine
::DoShallowCopy(VISU_PipeLine *thePipeLine,
bool theIsCopyInput)
{
- DoCopyMapper(thePipeLine, theIsCopyInput);
+ GetMapperHolder()->ShallowCopy(thePipeLine->GetMapperHolder(),
+ theIsCopyInput);
Build();
}
-//----------------------------------------------------------------------------
-void
-VISU_PipeLine
-::DoCopyMapper(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
-{
- if(theIsCopyInput)
- SetIDMapper(thePipeLine->GetIDMapper());
- Update();
- VISU::CopyDataSetMapper(GetDataSetMapper(),
- thePipeLine->GetDataSetMapper(),
- theIsCopyInput);
-}
//----------------------------------------------------------------------------
void
DoShallowCopy(thePipeLine, false);
}
+
//----------------------------------------------------------------------------
-TInput*
+VISU_MapperHolder*
VISU_PipeLine
-::GetInput() const
+::GetMapperHolder()
{
- return myInput.GetPointer();
+ if(!myMapperHolder.GetPointer())
+ OnCreateMapperHolder();
+
+ return myMapperHolder.GetPointer();
}
+
//----------------------------------------------------------------------------
-vtkDataSet*
+const VISU::PIDMapper&
VISU_PipeLine
-::GetOutput()
+::GetIDMapper()
{
- return GetMapper()->GetInput();
+ return GetMapperHolder()->GetIDMapper();
}
+
//----------------------------------------------------------------------------
-TInput*
+vtkDataSet*
VISU_PipeLine
-::GetInput2() const
+::GetInput()
{
- vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
- aDataSet->Update();
- return aDataSet;
+ return GetMapperHolder()->GetInput();
}
+
//----------------------------------------------------------------------------
-void
+vtkMapper*
VISU_PipeLine
-::SetInput(TInput* theInput)
+::GetMapper()
{
- if(GetInput() == theInput)
- return;
+ return GetMapperHolder()->GetMapper();
+}
- if(theInput)
- theInput->Update();
- myExtractGeometry->SetInput(theInput);
- myInput = theInput;
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_PipeLine
+::GetOutput()
+{
+ return GetMapperHolder()->GetOutput();
}
+
//----------------------------------------------------------------------------
-VISU_PipeLine::TMapper*
+bool
VISU_PipeLine
-::GetMapper()
+::IsPlanarInput()
{
- if(GetInput()){
- if(!myMapper->GetInput()){
- GetInput2()->Update();
- Build();
- }
- myMapper->Update();
- }
- return myMapper.GetPointer();
+ vtkFloatingPointType aBounds[6];
+ GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
+ if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN ||
+ fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN ||
+ fabs( aBounds[4] - aBounds[5] ) <= FLT_MIN )
+ return true;
+
+ return false;
}
+
//----------------------------------------------------------------------------
-vtkDataSetMapper*
+void
VISU_PipeLine
-::GetDataSetMapper()
+::SetMapperHolder(VISU_MapperHolder* theHolder)
{
- GetMapper();
- return myMapper.GetPointer();
+ myMapperHolder = theHolder;
+ theHolder->SetPipeLine(this);
}
+
+//----------------------------------------------------------------------------
+void
+VISU_PipeLine
+::Init()
+{}
+
+
//----------------------------------------------------------------------------
void
VISU_PipeLine
::Update()
{
- myMapper->Update();
+ GetMapperHolder()->Update();
}
+
//----------------------------------------------------------------------------
-size_t
+vtkIdType
VISU_PipeLine
-::CheckAvailableMemory(size_t theSize)
+::GetNodeObjID(vtkIdType theID)
{
- if(theSize < ULONG_MAX){
- try{
- if(char *aCheck = new char[theSize]){
- delete [] aCheck;
- return theSize;
- }
- }catch(std::bad_alloc& exc){
- }catch(...){
- }
- }
- return 0;
+ return GetMapperHolder()->GetNodeObjID(theID);
}
//----------------------------------------------------------------------------
-size_t
+vtkIdType
VISU_PipeLine
-::GetAvailableMemory(size_t theSize,
- size_t theMinSize)
+::GetNodeVTKID(vtkIdType theID)
{
- // Finds acceptable memory size by half-deflection methods
- static size_t EPSILON = 2 * 1024;
- size_t aMax = std::max(theSize, theMinSize);
- size_t aMin = std::min(theSize, theMinSize);
- //cout<<"GetAvailableMemory - "<<aMax<<"; "<<aMin;
- while(CheckAvailableMemory(aMax) == 0 && CheckAvailableMemory(aMin) > 0 && (aMax - aMin) > EPSILON){
- size_t aRoot = (aMax + aMin) / 2;
- if(CheckAvailableMemory(aRoot))
- aMin = aRoot;
- else
- aMax = aRoot;
- }
- //cout<<"; "<<aMax<<endl;
- return aMax;
+ return GetMapperHolder()->GetNodeVTKID(theID);
}
//----------------------------------------------------------------------------
-unsigned long int
+vtkFloatingPointType*
VISU_PipeLine
-::GetMemorySize()
+::GetNodeCoord(int theObjID)
{
- vtkDataSet* aDataSet = myExtractGeometry->GetInput();
- unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
-
- aDataSet = myExtractGeometry->GetOutput();
- aSize += aDataSet->GetActualMemorySize() * 1024;
-
- return aSize;
+ return GetMapperHolder()->GetNodeCoord(theObjID);
}
-//------------------------ Clipping planes -----------------------------------
-bool
+
+//----------------------------------------------------------------------------
+vtkIdType
VISU_PipeLine
-::AddClippingPlane(vtkPlane* thePlane)
+::GetElemObjID(vtkIdType theID)
{
- if (thePlane) {
- if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- aFunction->AddItem(thePlane);
-
- // Check, that at least one cell present after clipping.
- // This check was introduced because of bug IPAL8849.
- vtkUnstructuredGrid* aClippedGrid = GetInput2();
- if (aClippedGrid->GetNumberOfCells() < 1) {
- return false;
- }
- }
- }
- return true;
+ return GetMapperHolder()->GetElemObjID(theID);
}
//----------------------------------------------------------------------------
-vtkPlane*
+vtkIdType
VISU_PipeLine
-::GetClippingPlane(vtkIdType theID) const
-{
- vtkPlane* aPlane = NULL;
- if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
- if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- vtkImplicitFunction* aFun = NULL;
- aFunction->InitTraversal();
- for(vtkIdType anID = 0; anID <= theID; anID++)
- aFun = aFunction->GetNextItem();
- aPlane = dynamic_cast<vtkPlane*>(aFun);
- }
- }
- return aPlane;
+::GetElemVTKID(vtkIdType theID)
+{
+ return GetMapperHolder()->GetElemVTKID(theID);
}
//----------------------------------------------------------------------------
-void
+vtkCell*
VISU_PipeLine
-::RemoveAllClippingPlanes()
+::GetElemCell(vtkIdType theObjID)
{
- if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- aFunction->RemoveAllItems();
- aBoolean->Modified(); // VTK bug
- }
+ return GetMapperHolder()->GetElemCell(theObjID);
}
+
//----------------------------------------------------------------------------
-vtkIdType
+bool
VISU_PipeLine
-::GetNumberOfClippingPlanes() const
+::IsShrinkable()
{
- if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
- vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
- return aFunction->GetNumberOfItems();
- }
- return 0;
+ return myIsShrinkable;
}
-//----------------------------------------------------------------------------
-static
-void
-ComputeBoundsParam (vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3],
- vtkFloatingPointType theMinPnt[3],
- vtkFloatingPointType& theMaxBoundPrj,
- vtkFloatingPointType& theMinBoundPrj)
+void
+VISU_PipeLine
+::SetIsShrinkable(bool theIsShrinkable)
{
- vtkFloatingPointType aBounds[6];
- theDataSet->GetBounds(aBounds);
-
- //Enlarge bounds in order to avoid conflicts of precision
- for(int i = 0; i < 6; i += 2){
- static double EPS = 1.0E-3;
- vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS;
- aBounds[i] -= aDelta;
- aBounds[i+1] += aDelta;
- }
-
- vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
- {aBounds[1],aBounds[2],aBounds[4]},
- {aBounds[0],aBounds[3],aBounds[4]},
- {aBounds[1],aBounds[3],aBounds[4]},
- {aBounds[0],aBounds[2],aBounds[5]},
- {aBounds[1],aBounds[2],aBounds[5]},
- {aBounds[0],aBounds[3],aBounds[5]},
- {aBounds[1],aBounds[3],aBounds[5]}};
-
- int aMaxId = 0, aMinId = aMaxId;
- theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
- theMinBoundPrj = theMaxBoundPrj;
- for(int i = 1; i < 8; i++){
- vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
- if(theMaxBoundPrj < aTmp){
- theMaxBoundPrj = aTmp;
- aMaxId = i;
- }
- if(theMinBoundPrj > aTmp){
- theMinBoundPrj = aTmp;
- aMinId = i;
- }
- }
- vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId];
- theMinPnt[0] = aMinPnt[0];
- theMinPnt[1] = aMinPnt[1];
- theMinPnt[2] = aMinPnt[2];
+ myIsShrinkable = theIsShrinkable;
}
+
//----------------------------------------------------------------------------
-static
void
-DistanceToPosition(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3],
- vtkFloatingPointType theDist,
- vtkFloatingPointType thePos[3])
+VISU_PipeLine
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
{
- vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
- ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
- vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
- thePos[0] = aMinPnt[0]-theDirection[0]*aLength;
- thePos[1] = aMinPnt[1]-theDirection[1]*aLength;
- thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
-}
+ GetMapperHolder()->SetImplicitFunction(theFunction);
+}
//----------------------------------------------------------------------------
-static
-void
-PositionToDistance (vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3],
- vtkFloatingPointType thePos[3],
- vtkFloatingPointType& theDist)
+vtkImplicitFunction *
+VISU_PipeLine
+::GetImplicitFunction()
{
- vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
- ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
- vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos);
- theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
+ return GetMapperHolder()->GetImplicitFunction();
}
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::SetPlaneParam(vtkFloatingPointType theDir[3],
- vtkFloatingPointType theDist,
- vtkPlane* thePlane)
+::SetExtractInside(bool theMode)
{
- thePlane->SetNormal(theDir);
- vtkFloatingPointType anOrigin[3];
- ::DistanceToPosition(GetInput(),theDir,theDist,anOrigin);
- thePlane->SetOrigin(anOrigin);
+ GetMapperHolder()->SetExtractInside(theMode);
}
//----------------------------------------------------------------------------
void
VISU_PipeLine
-::GetPlaneParam(vtkFloatingPointType theDir[3],
- vtkFloatingPointType& theDist,
- vtkPlane* thePlane)
+::SetExtractBoundaryCells(bool theMode)
{
- thePlane->GetNormal(theDir);
-
- vtkFloatingPointType anOrigin[3];
- thePlane->GetOrigin(anOrigin);
- ::PositionToDistance(GetInput(),theDir,anOrigin,theDist);
+ GetMapperHolder()->SetExtractBoundaryCells(theMode);
}
+
//----------------------------------------------------------------------------
-bool
+void
VISU_PipeLine
-::IsPlanarInput() const
+::RemoveAllClippingPlanes()
{
- vtkFloatingPointType aBounds[6];
- GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
- if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN ||
- fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN ||
- fabs( aBounds[4] - aBounds[5] ) <= FLT_MIN )
- return true;
-
- return false;
+ GetMapperHolder()->RemoveAllClippingPlanes();
}
-//=======================================================================
-vtkIdType
+//----------------------------------------------------------------------------
+vtkIdType
VISU_PipeLine
-::GetNodeObjID(vtkIdType theID)
+::GetNumberOfClippingPlanes()
{
- vtkIdType anID = myExtractGeometry->GetNodeObjId(theID);
- return myIDMapper->GetNodeObjID(anID);
+ return GetMapperHolder()->GetNumberOfClippingPlanes();
}
-vtkIdType
+//----------------------------------------------------------------------------
+bool
VISU_PipeLine
-::GetNodeVTKID(vtkIdType theID)
+::AddClippingPlane(vtkPlane* thePlane)
{
- vtkIdType anID = myIDMapper->GetNodeVTKID(theID);
- return myExtractGeometry->GetNodeVTKId(anID);
+ return GetMapperHolder()->AddClippingPlane(thePlane);
}
-vtkFloatingPointType*
+//----------------------------------------------------------------------------
+vtkPlane*
VISU_PipeLine
-::GetNodeCoord(int theObjID)
+::GetClippingPlane(vtkIdType theID)
{
- return myIDMapper->GetNodeCoord(theObjID);
+ return GetMapperHolder()->GetClippingPlane(theID);
}
-//=======================================================================
-vtkIdType
+//----------------------------------------------------------------------------
+vtkDataSet*
VISU_PipeLine
-::GetElemObjID(vtkIdType theID)
+::GetClippedInput()
{
- vtkIdType anID = myExtractGeometry->GetElemObjId(theID);
- return myIDMapper->GetElemObjID(anID);
+ return GetMapperHolder()->GetClippedInput();
}
-vtkIdType
-VISU_PipeLine
-::GetElemVTKID(vtkIdType theID)
-{
- vtkIdType anID = myIDMapper->GetElemVTKID(theID);
- return myExtractGeometry->GetElemVTKId(anID);
-}
-vtkCell*
+//----------------------------------------------------------------------------
+void
VISU_PipeLine
-::GetElemCell(vtkIdType theObjID)
+::SetPlaneParam(vtkFloatingPointType theDir[3],
+ vtkFloatingPointType theDist,
+ vtkPlane* thePlane)
{
- return myIDMapper->GetElemCell(theObjID);
+ thePlane->SetNormal(theDir);
+
+ vtkFloatingPointType anOrigin[3];
+ VISU::DistanceToPosition(GetInput(),
+ theDir,
+ theDist,
+ anOrigin);
+
+ thePlane->SetOrigin(anOrigin);
}
-//=======================================================================
+
+//----------------------------------------------------------------------------
void
VISU_PipeLine
-::SetIDMapper(const VISU::PIDMapper& theIDMapper)
+::GetPlaneParam(vtkFloatingPointType theDir[3],
+ vtkFloatingPointType& theDist,
+ vtkPlane* thePlane)
{
- myIDMapper = theIDMapper;
- SetInput(myIDMapper->GetVTKOutput());
+ thePlane->GetNormal(theDir);
+
+ vtkFloatingPointType anOrigin[3];
+ thePlane->GetOrigin(anOrigin);
+
+ VISU::PositionToDistance(GetInput(),
+ theDir,
+ anOrigin,
+ theDist);
}
-const VISU::PIDMapper&
+
+//----------------------------------------------------------------------------
+size_t
VISU_PipeLine
-::GetIDMapper() const
+::CheckAvailableMemory(size_t theSize)
{
- return myIDMapper;
+ if(theSize < ULONG_MAX){
+ try{
+ if(char *aCheck = new char[theSize]){
+ delete [] aCheck;
+ return theSize;
+ }
+ }catch(std::bad_alloc& exc){
+ }catch(...){
+ }
+ }
+ return 0;
}
-//=======================================================================
-void
-VISU_PipeLine
-::SetImplicitFunction(vtkImplicitFunction *theFunction)
-{
- myExtractGeometry->SetImplicitFunction(theFunction);
-}
-vtkImplicitFunction *
+//----------------------------------------------------------------------------
+size_t
VISU_PipeLine
-::GetImplicitFunction()
+::GetAvailableMemory(size_t theSize,
+ size_t theMinSize)
{
- return myExtractGeometry->GetImplicitFunction();
+ // Finds acceptable memory size by half-deflection methods
+ static size_t EPSILON = 2 * 1024;
+ size_t aMax = std::max(theSize, theMinSize);
+ size_t aMin = std::min(theSize, theMinSize);
+ //cout<<"GetAvailableMemory - "<<aMax<<"; "<<aMin;
+ while(CheckAvailableMemory(aMax) == 0 && CheckAvailableMemory(aMin) > 0 && (aMax - aMin) > EPSILON){
+ size_t aRoot = (aMax + aMin) / 2;
+ if(CheckAvailableMemory(aRoot))
+ aMin = aRoot;
+ else
+ aMax = aRoot;
+ }
+ //cout<<"; "<<aMax<<endl;
+ return aMax;
}
-SALOME_ExtractGeometry*
-VISU_PipeLine
-::GetExtractGeometryFilter()
-{
- return myExtractGeometry.GetPointer();
-}
+
+//----------------------------------------------------------------------------
#ifndef VISU_PipeLine_HeaderFile
#define VISU_PipeLine_HeaderFile
-#include <vector>
+#include "VISU_IDMapper.hxx"
+
#include <vtkObject.h>
#include <vtkSmartPointer.h>
-#include <vtkTimeStamp.h>
-
-#include "VISU_IDMapper.hxx"
class vtkCell;
+class vtkPlane;
+class vtkMapper;
class vtkDataSet;
+class vtkPointSet;
class vtkImplicitFunction;
-
//----------------------------------------------------------------------------
-template <class T>
-class TVTKSmartPtr: public vtkSmartPointer<T>
-{
-public:
- TVTKSmartPtr()
- {}
-
- TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r)
- {
- if(r && theIsOwner)
- r->Delete();
- }
-
- TVTKSmartPtr& operator()(T* r, bool theIsOwner = false)
- {
- vtkSmartPointer<T>::operator=(r);
- if(r && theIsOwner)
- r->Delete();
- return *this;
- }
-
- TVTKSmartPtr& operator=(T* r)
- {
- vtkSmartPointer<T>::operator=(r);
- return *this;
- }
-
- operator T* () const
- {
- return vtkSmartPointer<T>::GetPointer();
- }
-};
-
-
-//----------------------------------------------------------------------------
-class vtkMapper;
-class vtkDataSetMapper;
-class vtkUnstructuredGrid;
-class vtkExtractGeometry;
-class vtkImplicitBoolean;
-class vtkPlane;
-
-class SALOME_ExtractGeometry;
-
-typedef VISU::TVTKOutput TInput;
-
class VISU_PipeLine : public vtkObject
{
-public:
- vtkTypeMacro(VISU_PipeLine,vtkObject);
+ friend class VISU_MapperHolder;
- virtual
- unsigned long int
- GetMTime();
+public:
+ vtkTypeMacro(VISU_PipeLine, vtkObject);
+ //! Gets memory size used by the instance (bytes).
virtual
- void
- DebugOn();
+ unsigned long int
+ GetMemorySize();
virtual
- void
- DebugOff();
+ unsigned long int
+ GetMTime();
+ //----------------------------------------------------------------------------
virtual
void
ShallowCopy(VISU_PipeLine *thePipeLine,
void
SameAs(VISU_PipeLine *thePipeLine);
-public:
- virtual
- void
- SetInput(TInput* theInput);
+ //----------------------------------------------------------------------------
+ void
+ SetMapperHolder(VISU_MapperHolder* theHolder);
- virtual
- TInput*
- GetInput() const;
+ VISU_MapperHolder*
+ GetMapperHolder();
+
+ const VISU::PIDMapper&
+ GetIDMapper();
virtual
vtkDataSet*
- GetOutput();
-
- bool
- IsPlanarInput() const;
-
- typedef vtkMapper TMapper;
+ GetInput();
virtual
- TMapper*
+ vtkMapper*
GetMapper();
- virtual
- vtkDataSetMapper*
- GetDataSetMapper();
-
virtual
- void
- Init() = 0;
+ vtkDataSet*
+ GetOutput();
+ //----------------------------------------------------------------------------
virtual
void
- Update();
+ Init();
- static
- size_t
- CheckAvailableMemory(size_t theSize);
-
- static
- size_t
- GetAvailableMemory(size_t theSize,
- size_t theMinSize = 1024*1024);
-
- //! Gets memory size used by the instance (bytes).
virtual
- unsigned long int
- GetMemorySize();
-
- // Clipping planes
- void
- RemoveAllClippingPlanes();
-
- vtkIdType
- GetNumberOfClippingPlanes() const;
-
- bool
- AddClippingPlane(vtkPlane* thePlane);
-
- vtkPlane*
- GetClippingPlane(vtkIdType theID) const;
-
- void
- SetPlaneParam(vtkFloatingPointType theDir[3],
- vtkFloatingPointType theDist,
- vtkPlane* thePlane);
-
void
- GetPlaneParam(vtkFloatingPointType theDir[3],
- vtkFloatingPointType& theDist,
- vtkPlane* thePlane);
-
- bool
- IsShrinkable() { return myIsShrinkable; }
+ Update();
+ //----------------------------------------------------------------------------
virtual
vtkIdType
GetNodeObjID(vtkIdType theID);
vtkCell*
GetElemCell(vtkIdType theObjID);
- void
- SetIDMapper(const VISU::PIDMapper& theIDMapper);
+ //----------------------------------------------------------------------------
+ bool
+ IsPlanarInput();
- const VISU::PIDMapper&
- GetIDMapper()const;
+ bool
+ IsShrinkable();
+ //----------------------------------------------------------------------------
void
SetImplicitFunction(vtkImplicitFunction *theFunction);
vtkImplicitFunction*
GetImplicitFunction();
- SALOME_ExtractGeometry*
- GetExtractGeometryFilter();
+ void
+ SetExtractInside(bool theMode);
+
+ void
+ SetExtractBoundaryCells(bool theMode);
+
+ //----------------------------------------------------------------------------
+ void
+ RemoveAllClippingPlanes();
+
+ vtkIdType
+ GetNumberOfClippingPlanes();
+
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID);
+
+ virtual
+ void
+ SetPlaneParam(vtkFloatingPointType theDir[3],
+ vtkFloatingPointType theDist,
+ vtkPlane* thePlane);
+
+ virtual
+ void
+ GetPlaneParam(vtkFloatingPointType theDir[3],
+ vtkFloatingPointType& theDist,
+ vtkPlane* thePlane);
+
+ //----------------------------------------------------------------------------
+ static
+ size_t
+ CheckAvailableMemory(size_t theSize);
+
+ static
+ size_t
+ GetAvailableMemory(size_t theSize,
+ size_t theMinSize = 1024*1024);
protected:
+ //----------------------------------------------------------------------------
VISU_PipeLine();
VISU_PipeLine(const VISU_PipeLine&);
virtual
~VISU_PipeLine();
+ //----------------------------------------------------------------------------
virtual
void
- DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
+ Build() = 0;
virtual
void
- DoCopyMapper(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
-
- virtual
- TInput*
- GetInput2() const;
+ OnCreateMapperHolder() = 0;
virtual
void
- Build() = 0;
+ DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
- bool myIsShrinkable;
+ //----------------------------------------------------------------------------
+ vtkDataSet*
+ GetClippedInput();
- TVTKSmartPtr<TInput> myInput;
- VISU::PIDMapper myIDMapper;
- TVTKSmartPtr<vtkDataSetMapper> myMapper;
+ void
+ SetIsShrinkable(bool theIsShrinkable);
- // Clipping planes
- TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;
+private:
+ //----------------------------------------------------------------------------
+ vtkSmartPointer<VISU_MapperHolder> myMapperHolder;
+ bool myIsShrinkable;
};
#endif
#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
-void
-VISU::Mul(const vtkFloatingPointType A[3],
- vtkFloatingPointType b,
- vtkFloatingPointType C[3])
-{ // A*b;
- for(int i = 0; i < 3; i++) C[i] = A[i]*b;
-}
-
-void
-VISU::Sub(const vtkFloatingPointType A[3],
- const vtkFloatingPointType B[3],
- vtkFloatingPointType C[3])
-{ //A-B
- for(int i = 0; i < 3; i++) C[i] = A[i] - B[i];
-}
-
namespace VISU
{
+ //----------------------------------------------------------------------------
+ void
+ Mul(const vtkFloatingPointType A[3],
+ vtkFloatingPointType b,
+ vtkFloatingPointType C[3])
+ { // A*b;
+ for(int i = 0; i < 3; i++)
+ C[i] = A[i]*b;
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ Sub(const vtkFloatingPointType A[3],
+ const vtkFloatingPointType B[3],
+ vtkFloatingPointType C[3])
+ { //A-B
+ for(int i = 0; i < 3; i++)
+ C[i] = A[i] - B[i];
+ }
+
+
+ //----------------------------------------------------------------------------
bool
CheckIsSameValue(vtkFloatingPointType theTarget,
vtkFloatingPointType theSource)
return false;
}
+
+ //----------------------------------------------------------------------------
bool
CheckIsSameRange(vtkFloatingPointType* theTarget,
vtkFloatingPointType* theSource)
CheckIsSameValue(theTarget[1], theSource[1]);
}
+
+ //----------------------------------------------------------------------------
void
CopyMapper(vtkMapper* theTarget,
vtkMapper* theSource,
theTarget->SetClippingPlanes(theSource->GetClippingPlanes());
}
+
+ //----------------------------------------------------------------------------
void
CopyDataSetMapper(vtkDataSetMapper* theTarget,
vtkDataSetMapper* theSource,
CopyMapper(theTarget, theSource, theIsCopyInput);
}
+
+ //----------------------------------------------------------------------------
void
CopyPolyDataMapper(vtkPolyDataMapper* theTarget,
vtkPolyDataMapper* theSource,
CopyMapper(theTarget, theSource, theIsCopyInput);
}
+
+ //----------------------------------------------------------------------------
void
CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget,
VISU_OpenGLPointSpriteMapper* theSource,
CopyPolyDataMapper(theTarget, theSource, theIsCopyInput);
}
+
+
+ //----------------------------------------------------------------------------
+ void
+ ComputeBoundsParam(vtkDataSet* theDataSet,
+ vtkFloatingPointType theDirection[3],
+ vtkFloatingPointType theMinPnt[3],
+ vtkFloatingPointType& theMaxBoundPrj,
+ vtkFloatingPointType& theMinBoundPrj)
+ {
+ vtkFloatingPointType aBounds[6];
+ theDataSet->GetBounds(aBounds);
+
+ //Enlarge bounds in order to avoid conflicts of precision
+ for(int i = 0; i < 6; i += 2){
+ static double EPS = 1.0E-3;
+ vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS;
+ aBounds[i] -= aDelta;
+ aBounds[i+1] += aDelta;
+ }
+
+ vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
+ {aBounds[1],aBounds[2],aBounds[4]},
+ {aBounds[0],aBounds[3],aBounds[4]},
+ {aBounds[1],aBounds[3],aBounds[4]},
+ {aBounds[0],aBounds[2],aBounds[5]},
+ {aBounds[1],aBounds[2],aBounds[5]},
+ {aBounds[0],aBounds[3],aBounds[5]},
+ {aBounds[1],aBounds[3],aBounds[5]}};
+
+ int aMaxId = 0, aMinId = aMaxId;
+ theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
+ theMinBoundPrj = theMaxBoundPrj;
+ for(int i = 1; i < 8; i++){
+ vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
+ if(theMaxBoundPrj < aTmp){
+ theMaxBoundPrj = aTmp;
+ aMaxId = i;
+ }
+ if(theMinBoundPrj > aTmp){
+ theMinBoundPrj = aTmp;
+ aMinId = i;
+ }
+ }
+ vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId];
+ theMinPnt[0] = aMinPnt[0];
+ theMinPnt[1] = aMinPnt[1];
+ theMinPnt[2] = aMinPnt[2];
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ DistanceToPosition(vtkDataSet* theDataSet,
+ vtkFloatingPointType theDirection[3],
+ vtkFloatingPointType theDist,
+ vtkFloatingPointType thePos[3])
+ {
+ vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+ ComputeBoundsParam(theDataSet,
+ theDirection,
+ aMinPnt,
+ aMaxBoundPrj,
+ aMinBoundPrj);
+ vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
+ thePos[0] = aMinPnt[0] - theDirection[0] * aLength;
+ thePos[1] = aMinPnt[1] - theDirection[1] * aLength;
+ thePos[2] = aMinPnt[2] - theDirection[2] * aLength;
+ }
+
+
+ //----------------------------------------------------------------------------
+ void
+ PositionToDistance(vtkDataSet* theDataSet,
+ vtkFloatingPointType theDirection[3],
+ vtkFloatingPointType thePos[3],
+ vtkFloatingPointType& theDist)
+ {
+ vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
+ ComputeBoundsParam(theDataSet,
+ theDirection,
+ aMinPnt,
+ aMaxBoundPrj,
+ aMinBoundPrj);
+ vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos);
+ theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
+ }
+
+
+ //----------------------------------------------------------------------------
}
#define VISU_PipeLineUtils_HeaderFile
#include "VISU_FieldTransform.hxx"
-#include "VISU_LookupTable.hxx"
-#include "VISU_Extractor.hxx"
#include <vtkProperty.h>
#include <vtkObjectFactory.h>
namespace VISU
{
+ //----------------------------------------------------------------------------
void
Mul(const vtkFloatingPointType A[3],
vtkFloatingPointType b,
vtkFloatingPointType C[3]); // C = A * b
+
+ //----------------------------------------------------------------------------
void
Sub(const vtkFloatingPointType A[3],
const vtkFloatingPointType B[3],
vtkFloatingPointType C[3]); // C = A - B
- template<class TItem>
+
+ //----------------------------------------------------------------------------
+ template<class TEndFilter>
void
- CellDataToPoint(TItem* theTItem,
+ CellDataToPoint(TEndFilter* theEndFilter,
vtkCellDataToPointData *theFilter,
vtkDataSet* theDataSet,
VISU_FieldTransform *theFieldTransform)
if(theDataSet->GetCellData()->GetNumberOfArrays()){
theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
theFilter->PassCellDataOn();
- theTItem->SetInput(theFilter->GetUnstructuredGridOutput());
+ theEndFilter->SetInput(theFilter->GetUnstructuredGridOutput());
}else
- theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+ theEndFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
}
- template<class TItem>
+
+ //----------------------------------------------------------------------------
+ template<class TEndFilter>
void
- ToCellCenters(TItem* theTItem,
+ ToCellCenters(TEndFilter* theEndFilter,
vtkCellCenters *theFilter,
vtkDataSet* theDataSet,
VISU_FieldTransform *theFieldTransform)
if(theDataSet->GetCellData()->GetNumberOfArrays()){
theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
theFilter->VertexCellsOn();
- theTItem->SetInput(theFilter->GetOutput());
+ theEndFilter->SetInput(theFilter->GetOutput());
}else
- theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+ theEndFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
}
+
+ //----------------------------------------------------------------------------
//! Checks whether the float values are the same or not
bool
CheckIsSameValue(vtkFloatingPointType theTarget,
CheckIsSameRange(vtkFloatingPointType* theTarget,
vtkFloatingPointType* theSource);
+ //! Customizes vtkMapper::ShallowCopy
+ void
+ CopyMapper(vtkMapper* theTarget,
+ vtkMapper* theSource,
+ bool theIsCopyInput);
+
//! Customizes vtkDataSetMapper::ShallowCopy
void
CopyDataSetMapper(vtkDataSetMapper* theTarget,
CopyPointSpriteDataMapper(VISU_OpenGLPointSpriteMapper* theTarget,
VISU_OpenGLPointSpriteMapper* theSource,
bool theIsCopyInput);
+
+
+ //----------------------------------------------------------------------------
+ void
+ ComputeBoundsParam(vtkDataSet* theDataSet,
+ vtkFloatingPointType theDirection[3],
+ vtkFloatingPointType theMinPnt[3],
+ vtkFloatingPointType& theMaxBoundPrj,
+ vtkFloatingPointType& theMinBoundPrj);
+
+
+ //----------------------------------------------------------------------------
+ void
+ DistanceToPosition(vtkDataSet* theDataSet,
+ vtkFloatingPointType theDirection[3],
+ vtkFloatingPointType theDist,
+ vtkFloatingPointType thePos[3]);
+
+
+ //----------------------------------------------------------------------------
+ void
+ PositionToDistance(vtkDataSet* theDataSet,
+ vtkFloatingPointType theDirection[3],
+ vtkFloatingPointType thePos[3],
+ vtkFloatingPointType& theDist);
}
#endif
#include <vtkWarpScalar.h>
#include <vtkOutlineFilter.h>
-using namespace std;
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_Plot3DPL);
-VISU_Plot3DPL::VISU_Plot3DPL():
- myCellDataToPointData(vtkCellDataToPointData::New(),true),
- myAppendPolyData(vtkAppendPolyData::New(),true),
- myGeometryFilter(vtkGeometryFilter::New(),true),
- myContourFilter(vtkContourFilter::New(),true),
- myWarpScalar(vtkWarpScalar::New(),true),
+
+//----------------------------------------------------------------------------
+VISU_Plot3DPL
+::VISU_Plot3DPL():
+ myCellDataToPointData(vtkCellDataToPointData::New()),
+ myAppendPolyData(vtkAppendPolyData::New()),
+ myGeometryFilter(vtkGeometryFilter::New()),
+ myContourFilter(vtkContourFilter::New()),
+ myWarpScalar(vtkWarpScalar::New()),
myOrientation(VISU_CutPlanesPL::YZ),
myIsRelative(true),
myIsContour(false),
myPosition(0.5),
- myScaleFactor(1.)
+ myScaleFactor(1.0)
{
- myAngle[0] = myAngle[1] = myAngle[2] = 0.;
+ SetIsShrinkable(false);
+
+ myCellDataToPointData->Delete();
+ myAppendPolyData->Delete();
+ myGeometryFilter->Delete();
+ myContourFilter->Delete();
+ myWarpScalar->Delete();
+
+ myAngle[0] = myAngle[1] = myAngle[2] = 0.0;
+
SetNumberOfContours(32);
- myIsShrinkable = false;
}
-VISU_Plot3DPL::~VISU_Plot3DPL()
+
+//----------------------------------------------------------------------------
+VISU_Plot3DPL
+::~VISU_Plot3DPL()
{
}
+
+//----------------------------------------------------------------------------
void
-VISU_Plot3DPL::
-DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
+VISU_Plot3DPL
+::DoShallowCopy(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
{
if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
SetOrientation (aPipeLine->GetPlaneOrientation(),
SetContourPrs( aPipeLine->GetIsContourPrs() );
SetNumberOfContours( aPipeLine->GetNumberOfContours() );
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+
+//----------------------------------------------------------------------------
VISU_CutPlanesPL::PlaneOrientation
-VISU_Plot3DPL::
-GetOrientation(vtkDataSet* theDataSet)
+VISU_Plot3DPL
+::GetOrientation(vtkDataSet* theDataSet)
{
theDataSet->Update();
return VISU_CutPlanesPL::XY;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
-VISU_Plot3DPL::
-GetScaleFactor(vtkDataSet* theDataSet)
+VISU_Plot3DPL
+::GetScaleFactor(vtkDataSet* theDataSet)
{
theDataSet->Update();
vtkFloatingPointType aLength = theDataSet->GetLength(); // diagonal length
return 0.0;
}
+
+//----------------------------------------------------------------------------
void
-VISU_Plot3DPL::
-Init()
+VISU_Plot3DPL
+::Init()
{
Superclass::Init();
- myOrientation = GetOrientation(GetInput2());
- SetScaleFactor(GetScaleFactor(GetInput2()));
+ myOrientation = GetOrientation(GetClippedInput());
+ SetScaleFactor(GetScaleFactor(GetClippedInput()));
}
-VISU_ScalarMapPL::THook*
-VISU_Plot3DPL::
-DoHook()
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_Plot3DPL
+::InsertCustomPL()
{
return myAppendPolyData->GetOutput();
}
+
+//----------------------------------------------------------------------------
void
-VISU_Plot3DPL::
-Update()
+VISU_Plot3DPL
+::Update()
{
vtkFloatingPointType aPlaneNormal[3];
vtkFloatingPointType anOrigin[3];
vtkPolyData* aPolyData = 0;
vtkCutter *aCutPlane = 0;
vtkUnstructuredGrid* anUnstructuredGrid =
- myFieldTransform->GetUnstructuredGridOutput();
+ GetFieldTransformFilter()->GetUnstructuredGridOutput();
if ( !IsPlanarInput() )
{
myWarpScalar->SetInput(myContourFilter->GetOutput());
}
- VISU_CutPlanesPL::ClearAppendPolyData(myAppendPolyData);
+ VISU_CutPlanesPL::ClearAppendPolyData(myAppendPolyData.GetPointer());
myAppendPolyData->AddInput(myWarpScalar->GetPolyDataOutput());
if ( aCutPlane )
myContourFilter->SetNumberOfContours(theNumber);
}
+
+//----------------------------------------------------------------------------
int
-VISU_Plot3DPL::
-GetNumberOfContours() const
+VISU_Plot3DPL
+::GetNumberOfContours()
{
return myContourFilter->GetNumberOfContours();
}
+
+//----------------------------------------------------------------------------
void
-VISU_Plot3DPL::
-SetScaleFactor(vtkFloatingPointType theScaleFactor)
+VISU_Plot3DPL
+::SetScaleFactor(vtkFloatingPointType theScaleFactor)
{
myScaleFactor = theScaleFactor;
myWarpScalar->SetScaleFactor(theScaleFactor);
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
-VISU_Plot3DPL::
-GetScaleFactor() const
+VISU_Plot3DPL
+::GetScaleFactor()
{
return myScaleFactor;
}
+
+//----------------------------------------------------------------------------
void
VISU_Plot3DPL::
SetContourPrs(bool theIsContourPrs )
Modified();
}
+
+//----------------------------------------------------------------------------
bool
-VISU_Plot3DPL::
-GetIsContourPrs() const
+VISU_Plot3DPL
+::GetIsContourPrs()
{
return myIsContour;
}
+
+//----------------------------------------------------------------------------
void
-VISU_Plot3DPL::
-SetPlanePosition(vtkFloatingPointType thePosition,
- bool theIsRelative)
+VISU_Plot3DPL
+::SetPlanePosition(vtkFloatingPointType thePosition,
+ bool theIsRelative)
{
myIsRelative = theIsRelative;
myPosition = thePosition;
Modified();
}
+
+//----------------------------------------------------------------------------
bool
-VISU_Plot3DPL::
-IsPositionRelative() const
+VISU_Plot3DPL
+::IsPositionRelative()
{
return myIsRelative;
}
+
+//----------------------------------------------------------------------------
VISU_CutPlanesPL::PlaneOrientation
-VISU_Plot3DPL::
-GetPlaneOrientation() const
+VISU_Plot3DPL
+::GetPlaneOrientation()
{
return myOrientation;
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_Plot3DPL::
GetRotateX()
return 0;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_Plot3DPL::
GetRotateY(){
return 0;
}
+
+//----------------------------------------------------------------------------
void
VISU_Plot3DPL::
SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation,
Modified();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
-VISU_Plot3DPL::
-GetPlanePosition() const
+VISU_Plot3DPL
+::GetPlanePosition()
{
return myPosition;
}
VISU_Plot3DPL
::GetBasePlane(vtkFloatingPointType theOrigin[3],
vtkFloatingPointType theNormal[3],
- bool theCenterOrigine ) const
+ bool theCenterOrigine )
{
VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation);
if ( theCenterOrigine ) {
// move theOrigin to the center of aBounds projections to the plane
- GetInput2()->GetBounds(aBounds);
+ GetClippedInput()->GetBounds(aBounds);
vtkFloatingPointType boundPoints[8][3] = {
{aBounds[0],aBounds[2],aBounds[4]},
{aBounds[1],aBounds[2],aBounds[4]},
void
VISU_Plot3DPL
::GetMinMaxPosition( vtkFloatingPointType& minPos,
- vtkFloatingPointType& maxPos ) const
+ vtkFloatingPointType& maxPos )
{
vtkFloatingPointType aBounds[6], aBoundPrj[3], aNormal[3];
VISU_CutPlanesPL::GetDir(aNormal,myAngle,myOrientation);
class vtkGeometryFilter;
class vtkCellDataToPointData;
+
+//----------------------------------------------------------------------------
class VISU_Plot3DPL : public VISU_ScalarMapPL
{
public:
virtual ~VISU_Plot3DPL();
VISU_CutPlanesPL::PlaneOrientation
- GetPlaneOrientation() const;
+ GetPlaneOrientation();
vtkFloatingPointType
GetRotateX();
vtkFloatingPointType theYAngle = 0.0);
vtkFloatingPointType
- GetPlanePosition() const;
+ GetPlanePosition();
bool
- IsPositionRelative() const;
+ IsPositionRelative();
void
SetPlanePosition(vtkFloatingPointType thePosition,
SetScaleFactor(vtkFloatingPointType theScaleFactor);
vtkFloatingPointType
- GetScaleFactor() const;
+ GetScaleFactor();
void
SetContourPrs(bool theIsContourPrs );
bool
- GetIsContourPrs() const;
+ GetIsContourPrs();
void
SetNumberOfContours(int theNumber);
int
- GetNumberOfContours() const;
+ GetNumberOfContours();
void
GetBasePlane (vtkFloatingPointType theOrigin[3],
vtkFloatingPointType theNormal[3],
- bool theCenterOrigine = false ) const;
+ bool theCenterOrigine = false );
void
GetMinMaxPosition( vtkFloatingPointType& minPos,
- vtkFloatingPointType& maxPos ) const;
+ vtkFloatingPointType& maxPos );
public:
virtual
VISU_Plot3DPL(const VISU_Plot3DPL&);
virtual
- THook*
- DoHook();
+ vtkDataSet*
+ InsertCustomPL();
virtual
void
vtkFloatingPointType myPosition, myScaleFactor;
VISU_CutPlanesPL::PlaneOrientation myOrientation;
- TVTKSmartPtr<vtkCellDataToPointData> myCellDataToPointData;
- TVTKSmartPtr<vtkAppendPolyData> myAppendPolyData;
- TVTKSmartPtr<vtkGeometryFilter> myGeometryFilter;
- TVTKSmartPtr<vtkContourFilter> myContourFilter;
- TVTKSmartPtr<vtkWarpScalar> myWarpScalar;
+ vtkSmartPointer<vtkCellDataToPointData> myCellDataToPointData;
+ vtkSmartPointer<vtkAppendPolyData> myAppendPolyData;
+ vtkSmartPointer<vtkGeometryFilter> myGeometryFilter;
+ vtkSmartPointer<vtkContourFilter> myContourFilter;
+ vtkSmartPointer<vtkWarpScalar> myWarpScalar;
};
#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_PointSpriteMapperHolder.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_PointSpriteMapperHolder.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_PointSpriteMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_PointSpriteMapperHolder
+::VISU_PointSpriteMapperHolder()
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_PointSpriteMapperHolder::VISU_PointSpriteMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PointSpriteMapperHolder
+::~VISU_PointSpriteMapperHolder()
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_PointSpriteMapperHolder::~VISU_PointSpriteMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PointSpriteMapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput)
+{
+ if(VISU_PointSpriteMapperHolder* aMapperHolder = dynamic_cast<VISU_PointSpriteMapperHolder*>(theMapperHolder)){
+ if(theIsCopyInput)
+ SetGaussPtsIDMapper(aMapperHolder->GetGaussPtsIDMapper());
+
+ VISU::CopyPointSpriteDataMapper(GetPointSpriteMapper(),
+ aMapperHolder->GetPointSpriteMapper(),
+ theIsCopyInput);
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PointSpriteMapperHolder
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theIDMapper)
+{
+ myGaussPtsIDMapper = theIDMapper;
+ SetPolyDataIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PGaussPtsIDMapper&
+VISU_PointSpriteMapperHolder
+::GetGaussPtsIDMapper()
+{
+ return myGaussPtsIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PointSpriteMapperHolder
+::OnCreateMapper()
+{
+ myPointSpriteMapper = VISU_OpenGLPointSpriteMapper::New();
+ myPointSpriteMapper->Delete();
+ myPointSpriteMapper->SetColorModeToMapScalars();
+ myPointSpriteMapper->ScalarVisibilityOn();
+ SetPolyDataMapper(myPointSpriteMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+VISU_OpenGLPointSpriteMapper*
+VISU_PointSpriteMapperHolder
+::GetPointSpriteMapper()
+{
+ GetMapper();
+ return myPointSpriteMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_PointSpriteMapperHolder.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PointSpriteMapperHolder_HeaderFile
+#define VISU_PointSpriteMapperHolder_HeaderFile
+
+#include "VISU_PolyDataMapperHolder.hxx"
+
+class VISU_OpenGLPointSpriteMapper;
+
+
+//----------------------------------------------------------------------------
+class VISU_PointSpriteMapperHolder : public VISU_PolyDataMapperHolder
+{
+public:
+ vtkTypeMacro(VISU_PointSpriteMapperHolder, VISU_PolyDataMapperHolder);
+
+ static
+ VISU_PointSpriteMapperHolder*
+ New();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput);
+
+ //----------------------------------------------------------------------------
+ void
+ SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
+
+ const VISU::PGaussPtsIDMapper&
+ GetGaussPtsIDMapper();
+
+ virtual
+ VISU_OpenGLPointSpriteMapper*
+ GetPointSpriteMapper();
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_PointSpriteMapperHolder();
+ VISU_PointSpriteMapperHolder(const VISU_PointSpriteMapperHolder&);
+
+ virtual
+ ~VISU_PointSpriteMapperHolder();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ OnCreateMapper();
+
+private:
+ //----------------------------------------------------------------------------
+ VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+ vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myPointSpriteMapper;
+};
+
+#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_PolyDataMapperHolder.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_PolyDataMapperHolder.hxx"
+#include "SALOME_ExtractPolyDataGeometry.h"
+#include "VISU_LookupTable.hxx"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_PolyDataMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_PolyDataMapperHolder
+::VISU_PolyDataMapperHolder():
+ myExtractPolyDataGeometry(SALOME_ExtractPolyDataGeometry::New())
+{
+ if(MYDEBUG) MESSAGE("VISU_PolyDataMapperHolder::VISU_PolyDataMapperHolder - "<<this);
+
+ // Clipping functionality
+ myExtractPolyDataGeometry->Delete();
+ myExtractPolyDataGeometry->SetStoreMapping(true);
+
+ vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+ myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean);
+ anImplicitBoolean->SetOperationTypeToIntersection();
+ anImplicitBoolean->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PolyDataMapperHolder
+::~VISU_PolyDataMapperHolder()
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_PolyDataMapperHolder::~VISU_PolyDataMapperHolder - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput)
+{
+ if(VISU_PolyDataMapperHolder* aMapperHolder = dynamic_cast<VISU_PolyDataMapperHolder*>(theMapperHolder)){
+ if(theIsCopyInput)
+ SetPolyDataIDMapper(aMapperHolder->GetPolyDataIDMapper());
+
+ VISU::CopyPolyDataMapper(GetPolyDataMapper(),
+ aMapperHolder->GetPolyDataMapper(),
+ theIsCopyInput);
+ }
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_PolyDataMapperHolder
+::GetMemorySize()
+{
+ unsigned long int aSize = 0;
+
+ if(myExtractPolyDataGeometry->GetInput())
+ if(vtkDataSet* aDataSet = myExtractPolyDataGeometry->GetOutput())
+ aSize = aDataSet->GetActualMemorySize() * 1024;
+
+ aSize += Superclass::GetMemorySize();
+
+ return aSize;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper)
+{
+ myExtractPolyDataGeometry->SetInput(theIDMapper->GetPolyDataOutput());
+ myPolyDataIDMapper = theIDMapper;
+ SetIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PPolyDataIDMapper&
+VISU_PolyDataMapperHolder
+::GetPolyDataIDMapper()
+{
+ return myPolyDataIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyData*
+VISU_PolyDataMapperHolder
+::GetPolyDataInput()
+{
+ if(myPolyDataIDMapper)
+ return myPolyDataIDMapper->GetPolyDataOutput();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_PolyDataMapperHolder
+::GetClippedInput()
+{
+ vtkPolyData* aDataSet = myExtractPolyDataGeometry->GetOutput();
+ aDataSet->Update();
+ return aDataSet;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::OnCreateMapper()
+{
+ myPolyDataMapper = vtkPolyDataMapper::New();
+ myPolyDataMapper->Delete();
+ SetMapper(myPolyDataMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetPolyDataMapper(vtkPolyDataMapper* theMapper)
+{
+ myPolyDataMapper = theMapper;
+ SetMapper(myPolyDataMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyDataMapper*
+VISU_PolyDataMapperHolder
+::GetPolyDataMapper()
+{
+ GetMapper();
+ return myPolyDataMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetLookupTable(VISU_LookupTable* theLookupTable)
+{
+ myPolyDataMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetNodeObjID(vtkIdType theID)
+{
+ vtkIdType anID = myExtractPolyDataGeometry->GetNodeObjId(theID);
+ return Superclass::GetNodeObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetNodeVTKID(vtkIdType theID)
+{
+ vtkIdType anID = Superclass::GetNodeVTKID(theID);
+ return myExtractPolyDataGeometry->GetNodeVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType*
+VISU_PolyDataMapperHolder
+::GetNodeCoord(vtkIdType theObjID)
+{
+ return Superclass::GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetElemObjID(vtkIdType theID)
+{
+ vtkIdType anID = myExtractPolyDataGeometry->GetElemObjId(theID);
+ return Superclass::GetElemObjID(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetElemVTKID(vtkIdType theID)
+{
+ vtkIdType anID = Superclass::GetElemVTKID(theID);
+ return myExtractPolyDataGeometry->GetElemVTKId(anID);
+}
+
+//----------------------------------------------------------------------------
+vtkCell*
+VISU_PolyDataMapperHolder
+::GetElemCell(vtkIdType theObjID)
+{
+ return Superclass::GetElemCell(theObjID);
+}
+
+
+//------------------------ Clipping planes -----------------------------------
+bool
+VISU_PolyDataMapperHolder
+::AddClippingPlane(vtkPlane* thePlane)
+{
+ if (thePlane) {
+ if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->AddItem(thePlane);
+ // Check, that at least one cell present after clipping.
+ // This check was introduced because of bug IPAL8849.
+ vtkDataSet* aClippedDataSet = GetClippedInput();
+ if(aClippedDataSet->GetNumberOfCells() < 1)
+ return false;
+ }
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane*
+VISU_PolyDataMapperHolder
+::GetClippingPlane(vtkIdType theID)
+{
+ vtkPlane* aPlane = NULL;
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ vtkImplicitFunction* aFun = NULL;
+ aFunction->InitTraversal();
+ for(vtkIdType anID = 0; anID <= theID; anID++)
+ aFun = aFunction->GetNextItem();
+ aPlane = dynamic_cast<vtkPlane*>(aFun);
+ }
+ }
+ return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::RemoveAllClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->RemoveAllItems();
+ aBoolean->Modified(); // VTK bug
+ }
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataMapperHolder
+::GetNumberOfClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ return aFunction->GetNumberOfItems();
+ }
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+ myExtractPolyDataGeometry->SetImplicitFunction(theFunction);
+}
+
+//----------------------------------------------------------------------------
+vtkImplicitFunction*
+VISU_PolyDataMapperHolder
+::GetImplicitFunction()
+{
+ return myExtractPolyDataGeometry->GetImplicitFunction();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetExtractInside(bool theMode)
+{
+ myExtractPolyDataGeometry->SetExtractInside(theMode);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataMapperHolder
+::SetExtractBoundaryCells(bool theMode)
+{
+ myExtractPolyDataGeometry->SetExtractBoundaryCells(theMode);
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_PolyDataMapperHolder.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PolyDataMapperHolder_HeaderFile
+#define VISU_PolyDataMapperHolder_HeaderFile
+
+#include "VISU_MapperHolder.hxx"
+
+class vtkPolyDataMapper;
+class vtkPolyData;
+class SALOME_ExtractPolyDataGeometry;
+
+
+//----------------------------------------------------------------------------
+class VISU_PolyDataMapperHolder : public VISU_MapperHolder
+{
+public:
+ vtkTypeMacro(VISU_PolyDataMapperHolder, VISU_MapperHolder);
+
+ static
+ VISU_PolyDataMapperHolder*
+ New();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ ShallowCopy(VISU_MapperHolder *theMapperHolder,
+ bool theIsCopyInput);
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //----------------------------------------------------------------------------
+ void
+ SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper);
+
+ const VISU::PPolyDataIDMapper&
+ GetPolyDataIDMapper();
+
+ virtual
+ vtkPolyData*
+ GetPolyDataInput();
+
+ virtual
+ vtkPolyDataMapper*
+ GetPolyDataMapper();
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID);
+
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID);
+
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+ virtual
+ vtkImplicitFunction*
+ GetImplicitFunction();
+
+ virtual
+ void
+ SetExtractInside(bool theMode);
+
+ virtual
+ void
+ SetExtractBoundaryCells(bool theMode);
+
+ //----------------------------------------------------------------------------
+ // Clipping planes
+ virtual
+ void
+ RemoveAllClippingPlanes();
+
+ virtual
+ vtkIdType
+ GetNumberOfClippingPlanes();
+
+ virtual
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID);
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_PolyDataMapperHolder();
+ VISU_PolyDataMapperHolder(const VISU_PolyDataMapperHolder&);
+
+ virtual
+ ~VISU_PolyDataMapperHolder();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ OnCreateMapper();
+
+ void
+ SetPolyDataMapper(vtkPolyDataMapper* theMapper);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetLookupTable(VISU_LookupTable* theLookupTable);
+
+ virtual
+ vtkDataSet*
+ GetClippedInput();
+
+private:
+ //----------------------------------------------------------------------------
+ VISU::PPolyDataIDMapper myPolyDataIDMapper;
+ vtkSmartPointer<vtkPolyDataMapper> myPolyDataMapper;
+ vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myExtractPolyDataGeometry; //!< Clipping
+};
+
+#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_PolyDataPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_PolyDataPL.hxx"
+#include "SALOME_ExtractPolyDataGeometry.h"
+
+#include "VISU_PipeLineUtils.hxx"
+
+#include <float.h>
+#include <algorithm>
+
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+
+#include <vtkPlane.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------------------
+VISU_PolyDataPL
+::VISU_PolyDataPL():
+ myExtractPolyDataGeometry(SALOME_ExtractPolyDataGeometry::New())
+{
+ if(MYDEBUG) MESSAGE("VISU_PolyDataPL::VISU_PolyDataPL - "<<this);
+
+ SetIsShrinkable(true);
+
+ // Clipping functionality
+ myExtractPolyDataGeometry->Delete();
+ myExtractPolyDataGeometry->SetStoreMapping(true);
+
+ vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+ myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean);
+ anImplicitBoolean->SetOperationTypeToIntersection();
+ anImplicitBoolean->Delete();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PolyDataPL
+::~VISU_PolyDataPL()
+{
+ if(MYDEBUG)
+ MESSAGE("VISU_PolyDataPL::~VISU_PolyDataPL - "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper)
+{
+ myExtractPolyDataGeometry->SetInput(theIDMapper->GetPolyDataOutput());
+ myPolyDataIDMapper = theIDMapper;
+ SetIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PPolyDataIDMapper&
+VISU_PolyDataPL
+::GetPolyDataIDMapper() const
+{
+ return myPolyDataIDMapper;
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyData*
+VISU_PolyDataPL
+::GetPolyDataInput()
+{
+ if(myPolyDataIDMapper)
+ return myPolyDataIDMapper->GetPolyDataOutput();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+vtkPointSet*
+VISU_PolyDataPL
+::GetClippedInput() const
+{
+ vtkPolyData* aDataSet = myExtractPolyDataGeometry->GetOutput();
+ aDataSet->Update();
+ return aDataSet;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::OnCreateMapper()
+{
+ myPolyDataMapper = vtkPolyDataMapper::New();
+ myPolyDataMapper->Delete();
+ SetMapper(myPolyDataMapper.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetPolyDataMapper(vtkPolyDataMapper* theMapper)
+{
+ myPolyDataMapper = theMapper;
+ SetMapper(theMapper);
+}
+
+
+//----------------------------------------------------------------------------
+vtkPolyDataMapper*
+VISU_PolyDataPL
+::GetPolyDataMapper()
+{
+ return myPolyDataMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::DoCopyMapper(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput)
+{
+ if(VISU_PolyDataPL* aPipeLine = dynamic_cast<VISU_PolyDataPL*>(thePipeLine)){
+ if(theIsCopyInput)
+ SetPolyDataIDMapper(aPipeLine->GetPolyDataIDMapper());
+ Update();
+ VISU::CopyPolyDataMapper(GetPolyDataMapper(),
+ aPipeLine->GetPolyDataMapper(),
+ theIsCopyInput);
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetLookupTable(VISU_LookupTable* theLookupTable)
+{
+ myPolyDataMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_PolyDataPL
+::GetMemorySize()
+{
+ unsigned long int aSize = 0;
+ if(myExtractPolyDataGeometry->GetInput())
+ if(vtkDataSet* aDataSet = myExtractPolyDataGeometry->GetOutput())
+ aSize = aDataSet->GetActualMemorySize() * 1024;
+
+ aSize += Superclass::GetMemorySize();
+
+ return aSize;
+}
+
+
+//------------------------ Clipping planes -----------------------------------
+bool
+VISU_PolyDataPL
+::AddClippingPlane(vtkPlane* thePlane)
+{
+ if (thePlane) {
+ if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->AddItem(thePlane);
+ // Check, that at least one cell present after clipping.
+ // This check was introduced because of bug IPAL8849.
+ vtkDataSet* aClippedDataSet = GetClippedInput();
+ if(aClippedDataSet->GetNumberOfCells() < 1)
+ return false;
+ }
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane*
+VISU_PolyDataPL
+::GetClippingPlane(vtkIdType theID) const
+{
+ vtkPlane* aPlane = NULL;
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ vtkImplicitFunction* aFun = NULL;
+ aFunction->InitTraversal();
+ for(vtkIdType anID = 0; anID <= theID; anID++)
+ aFun = aFunction->GetNextItem();
+ aPlane = dynamic_cast<vtkPlane*>(aFun);
+ }
+ }
+ return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::RemoveAllClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->RemoveAllItems();
+ aBoolean->Modified(); // VTK bug
+ }
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataPL
+::GetNumberOfClippingPlanes() const
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ return aFunction->GetNumberOfItems();
+ }
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataPL
+::GetNodeObjID(vtkIdType theID)
+{
+ vtkIdType anID = myExtractPolyDataGeometry->GetNodeObjId(theID);
+ return Superclass::GetNodeObjID(anID);
+}
+
+vtkIdType
+VISU_PolyDataPL
+::GetNodeVTKID(vtkIdType theID)
+{
+ vtkIdType anID = Superclass::GetNodeVTKID(theID);
+ return myExtractPolyDataGeometry->GetNodeVTKId(anID);
+}
+
+vtkFloatingPointType*
+VISU_PolyDataPL
+::GetNodeCoord(int theObjID)
+{
+ return Superclass::GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_PolyDataPL
+::GetElemObjID(vtkIdType theID)
+{
+ vtkIdType anID = myExtractPolyDataGeometry->GetElemObjId(theID);
+ return Superclass::GetElemObjID(anID);
+}
+
+vtkIdType
+VISU_PolyDataPL
+::GetElemVTKID(vtkIdType theID)
+{
+ vtkIdType anID = Superclass::GetElemVTKID(theID);
+ return myExtractPolyDataGeometry->GetElemVTKId(anID);
+}
+
+vtkCell*
+VISU_PolyDataPL
+::GetElemCell(vtkIdType theObjID)
+{
+ return Superclass::GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_PolyDataPL
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+ myExtractPolyDataGeometry->SetImplicitFunction(theFunction);
+}
+
+vtkImplicitFunction *
+VISU_PolyDataPL
+::GetImplicitFunction()
+{
+ return myExtractPolyDataGeometry->GetImplicitFunction();
+}
+
+SALOME_ExtractPolyDataGeometry*
+VISU_PolyDataPL
+::GetExtractPolyDataGeometryFilter()
+{
+ return myExtractPolyDataGeometry.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_UnstructuredGripPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_PolyDataPL_HeaderFile
+#define VISU_PolyDataPL_HeaderFile
+
+#include "VISU_ColoredPL.hxx"
+
+class vtkPolyDataMapper;
+class vtkPolyData;
+class SALOME_ExtractPolyDataGeometry;
+
+
+//----------------------------------------------------------------------------
+class VISU_PolyDataPL : public VISU_ColoredPL
+{
+public:
+ vtkTypeMacro(VISU_PolyDataPL, VISU_ColoredPL);
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkPolyDataMapper*
+ GetPolyDataMapper();
+
+ virtual
+ vtkPolyData*
+ GetPolyDataInput();
+
+ //! Gets memory size used by the instance (bytes).
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+ virtual
+ vtkImplicitFunction*
+ GetImplicitFunction();
+
+ virtual
+ SALOME_ExtractPolyDataGeometry*
+ GetExtractPolyDataGeometryFilter();
+
+ //----------------------------------------------------------------------------
+ // Clipping planes
+ virtual
+ void
+ RemoveAllClippingPlanes();
+
+ virtual
+ vtkIdType
+ GetNumberOfClippingPlanes() const;
+
+ virtual
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID) const;
+
+ //----------------------------------------------------------------------------
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID);
+
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(vtkIdType theObjID);
+
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID);
+
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID);
+
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ //----------------------------------------------------------------------------
+ void
+ SetPolyDataIDMapper(const VISU::PPolyDataIDMapper& theIDMapper);
+
+ const VISU::PPolyDataIDMapper&
+ GetPolyDataIDMapper() const;
+
+protected:
+ VISU_PolyDataPL();
+ VISU_PolyDataPL(const VISU_PolyDataPL&);
+
+ virtual
+ ~VISU_PolyDataPL();
+
+ virtual
+ void
+ DoCopyMapper(VISU_PipeLine *thePipeLine,
+ bool theIsCopyInput);
+
+ virtual
+ void
+ OnCreateMapper();
+
+ void
+ SetPolyDataMapper(vtkPolyDataMapper* theMapper);
+
+ virtual
+ void
+ SetLookupTable(VISU_LookupTable* theLookupTable);
+
+ virtual
+ vtkPointSet*
+ GetClippedInput() const;
+
+private:
+ VISU::PPolyDataIDMapper myPolyDataIDMapper;
+ vtkSmartPointer<vtkPolyDataMapper> myPolyDataMapper;
+ vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myExtractPolyDataGeometry; //!< Clipping
+};
+
+#endif
// Module : VISU
#include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "VISU_Extractor.hxx"
+#include "VISU_LookupTable.hxx"
#include "VISU_DeformedShapePL.hxx"
-#include "VISU_PipeLineUtils.hxx"
#include "VTKViewer_TransformFilter.h"
#include "VTKViewer_Transform.h"
+#include "VISU_PipeLineUtils.hxx"
+
#include <vtkWarpVector.h>
#include <vtkMergeFilter.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCellDataToPointData.h>
#include <vtkPointDataToCellData.h>
-#include <VISU_Convertor.hxx>
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL)
+//----------------------------------------------------------------------------
/*!
* Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid
* Where:
myCellDataToPointData = vtkCellDataToPointData::New();
}
+//----------------------------------------------------------------------------
/*!
* Destructor.
* Delete all fields.
myCellDataToPointData->Delete();
}
+//----------------------------------------------------------------------------
/*!
* Initial method
*/
VISU_ScalarMapOnDeformedShapePL
::Init()
{
- if (GetScalars() == NULL) SetScalars(GetInput2());
+ if(GetScalars() == NULL)
+ SetScalars(GetClippedInput());
Superclass::Init();
vtkFloatingPointType aScalarRange[2];
GetSourceRange(aScalarRange);
+
static double EPS = 1.0 / VTK_LARGE_FLOAT;
if(aScalarRange[1] > EPS)
- SetScale(VISU_DeformedShapePL::GetScaleFactor(GetInput2())/aScalarRange[1]);
+ SetScale(VISU_DeformedShapePL::GetScaleFactor(GetClippedInput()) / aScalarRange[1]);
else
SetScale(0.0);
- myMapper->SetColorModeToMapScalars();
- myMapper->ScalarVisibilityOn();
-
- // Sets input for field transformation filter
- myFieldTransform->SetInput(myExtractor->GetOutput());
-
+ GetMapper()->SetColorModeToMapScalars();
+ GetMapper()->ScalarVisibilityOn();
}
+//----------------------------------------------------------------------------
/*!
* Build method
* Building of deformation and puts result to merge filter.
VISU_ScalarMapOnDeformedShapePL
::Build()
{
- // Set input for extractor
- myExtractor->SetInput(GetInput2());
-
- VISU::CellDataToPoint(myDeformVectors,myCellDataToPointData,
- GetInput2(),myFieldTransform);
+ VISU::CellDataToPoint(myDeformVectors,
+ myCellDataToPointData,
+ GetClippedInput(),
+ GetFieldTransformFilter());
// Sets geometry for merge filter
myMergeFilter->SetGeometry(myDeformVectors->GetOutput());
myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
+
// Sets data to mapper
- myMapper->SetInput(myMergeFilter->GetOutput());
+ GetDataSetMapper()->SetInput(myMergeFilter->GetOutput());
}
+//----------------------------------------------------------------------------
/*!
* Update method
*/
GetSourceRange(aRange);
vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
- if(myBarTable->GetScale() == VTK_SCALE_LOG10)
+ if(GetBarTable()->GetScale() == VTK_SCALE_LOG10)
VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
- myMapperTable->SetRange(aScalarRange);
+ GetMapperTable()->SetRange(aScalarRange);
- myMapperTable->Build();
- myBarTable->Build();
+ GetMapperTable()->Build();
+ GetBarTable()->Build();
- myMapper->SetLookupTable(myMapperTable);
- myMapper->SetScalarRange(aScalarRange);
+ GetMapper()->SetLookupTable(GetMapperTable());
+ GetMapper()->SetScalarRange(aScalarRange);
VISU_PipeLine::Update();
}
return aSize;
}
-
//----------------------------------------------------------------------------
/*!
* Update scalars method.
myExtractorScalars->Update();
}
+//----------------------------------------------------------------------------
/*!
* Copy information about pipline.
* Copy scale and scalars.
aPipeLine->GetSourceRange(aRange);
SetScalarRange(aRange);
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+//----------------------------------------------------------------------------
/*!
* Set scalars.
* Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction.
Modified();
}
+//----------------------------------------------------------------------------
/*!
* Get pointer to input scalars.
*/
return myScalars.GetPointer();
}
+//----------------------------------------------------------------------------
/*!
* Sets scale for deformed shape
*/
VISU_ScalarMapOnDeformedShapePL
::SetScale(vtkFloatingPointType theScale)
{
- if(myScaleFactor == theScale) return;
- myScaleFactor = theScale;
+ if(VISU::CheckIsSameValue(myScaleFactor, theScale))
+ return;
+
myDeformVectors->SetScaleFactor(myScaleFactor);
- Modified();
+ myScaleFactor = theScale;
}
+//----------------------------------------------------------------------------
/*!
* Gets scale of deformed shape.
*/
VISU_ScalarMapOnDeformedShapePL
::GetScale()
{
- vtkFloatingPointType aScale=myDeformVectors->GetScaleFactor();
- return aScale;
+ return myDeformVectors->GetScaleFactor();
}
+//----------------------------------------------------------------------------
/*!
* Set scale factor of deformation.
*/
VISU_ScalarMapOnDeformedShapePL
::SetMapScale(vtkFloatingPointType theMapScale)
{
- myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale);
- Modified();
+ myDeformVectors->SetScaleFactor(myScaleFactor * theMapScale);
}
+//----------------------------------------------------------------------------
/*!
* Gets scalar mode.
*/
VISU_ScalarMapOnDeformedShapePL
::GetScalarMode()
{
- int aMode=myExtractorScalars->GetScalarMode();
- return aMode;
+ return myExtractorScalars->GetScalarMode();
}
+//----------------------------------------------------------------------------
/*!
* Sets scalar mode.
*/
Modified();
}
+//----------------------------------------------------------------------------
/*!
* Gets ranges of extracted scalars
* \param theRange[2] - output values
class vtkCellDataToPointData;
class vtkPointDataToCellData;
+
+//----------------------------------------------------------------------------
class VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL
{
-protected:
public:
- vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_ScalarMapPL);
+ vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL, VISU_ScalarMapPL);
static
VISU_ScalarMapOnDeformedShapePL*
//
//
//
-// File: VISU_PipeLine.cxx
+// File: VISU_ScalarMapPL.cxx
// Author: Alexey PETROV
// Module : VISU
#include "VISU_ScalarMapPL.hxx"
-#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_ExtractGeometry.h"
+#include "VISU_DataSetMapperHolder.hxx"
-
-//============================================================================
-vtkStandardNewMacro(VISU_ScalarMapPL);
-
-
-//----------------------------------------------------------------------------
-VISU_ScalarMapPL
-::VISU_ScalarMapPL()
-{
- myMapperTable = VISU_LookupTable::New();
- myMapperTable->SetScale(VTK_SCALE_LINEAR);
- myMapperTable->SetHueRange(0.667,0.0);
-
- myBarTable = VISU_LookupTable::New();
- myBarTable->SetScale(VTK_SCALE_LINEAR);
- myBarTable->SetHueRange(0.667,0.0);
-
- myExtractor = VISU_Extractor::New();
- myExtractor->SetInput(myExtractGeometry->GetOutput());
-
- myFieldTransform = VISU_FieldTransform::New();
- myFieldTransform->SetInput(myExtractor->GetOutput());
-
- myIsShrinkable = true;
-}
-
-
-VISU_ScalarMapPL
-::~VISU_ScalarMapPL()
-{
- myFieldTransform->Delete();
- myMapperTable->Delete();
- myBarTable->Delete();
- myExtractor->Delete();
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput)
-{
- if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
- if(theIsCopyInput)
- SetScalarRange(aPipeLine->GetScalarRange());
- SetScalarMode(aPipeLine->GetScalarMode());
- SetNbColors(aPipeLine->GetNbColors());
- SetScaling(aPipeLine->GetScaling());
- SetMapScale(aPipeLine->GetMapScale());
- }
- Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
-}
-
-
-//----------------------------------------------------------------------------
-int
-VISU_ScalarMapPL
-::GetScalarMode()
-{
- return myExtractor->GetScalarMode();
-}
-
-void
-VISU_ScalarMapPL
-::SetScalarMode(int theScalarMode)
-{
- vtkDataSet *input = GetInput();
- if (input){
- if(input->GetPointData()->GetNumberOfArrays()){
- vtkPointData *inData = input->GetPointData();
- if(!inData->GetAttribute(vtkDataSetAttributes::VECTORS)) {
- if (theScalarMode==0){
- return;
- }
- }
- }
- else {
- vtkCellData *inData = input->GetCellData();
- if(!inData->GetAttribute(vtkDataSetAttributes::VECTORS)){
- if (theScalarMode==0){
- return;
- }
- }
- }
- }
- //
- myExtractor->SetScalarMode(theScalarMode);
-}
+#include <vtkDataSetMapper.h>
+#include <vtkObjectFactory.h>
//----------------------------------------------------------------------------
-int
-VISU_ScalarMapPL
-::GetScaling()
-{
- return myBarTable->GetScale();
-}
-
-void
-VISU_ScalarMapPL
-::SetScaling(int theScaling)
-{
- myBarTable->SetScale(theScaling);
- if(theScaling == VTK_SCALE_LOG10)
- myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
- else
- myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
-}
+vtkStandardNewMacro(VISU_ScalarMapPL);
//----------------------------------------------------------------------------
-vtkFloatingPointType*
-VISU_ScalarMapPL
-::GetScalarRange()
-{
- return myFieldTransform->GetScalarRange();
-}
-
-void
-VISU_ScalarMapPL
-::SetScalarRange(vtkFloatingPointType theRange[2])
-{
- if(!VISU::CheckIsSameRange(GetScalarRange(), theRange)){
- myFieldTransform->SetScalarRange(theRange);
- myBarTable->SetRange(theRange);
- }
-}
-
-void
-VISU_ScalarMapPL
-::SetScalarMin(vtkFloatingPointType theValue)
-{
- vtkFloatingPointType aScalarRange[2] = {theValue, GetScalarRange()[1]};
- if(!VISU::CheckIsSameRange(GetScalarRange(), aScalarRange))
- SetScalarRange(aScalarRange);
-}
-
-void
VISU_ScalarMapPL
-::SetScalarMax(vtkFloatingPointType theValue)
-{
- vtkFloatingPointType aScalarRange[2] = {GetScalarRange()[0], theValue};
- if(!VISU::CheckIsSameRange(GetScalarRange(), aScalarRange))
- SetScalarRange(aScalarRange);
-}
+::VISU_ScalarMapPL():
+ VISU_UnstructuredGridPL(this)
+{}
//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::SetNbColors(int theNbColors)
-{
- myMapperTable->SetNumberOfColors(theNbColors);
- myBarTable->SetNumberOfColors(theNbColors);
-}
-
-int
VISU_ScalarMapPL
-::GetNbColors()
-{
- return myMapperTable->GetNumberOfColors();
-}
+::~VISU_ScalarMapPL()
+{}
//----------------------------------------------------------------------------
-VISU_ScalarMapPL::THook*
+void
VISU_ScalarMapPL
-::DoHook()
+::OnCreateMapperHolder()
{
- myMapper->SetColorModeToMapScalars();
- myMapper->ScalarVisibilityOn();
- return myFieldTransform->GetUnstructuredGridOutput();
+ VISU_UnstructuredGridPL::OnCreateMapperHolder();
}
-//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::Init()
-{
- SetScalarMode(0);
- SetSourceRange();
-}
-
//----------------------------------------------------------------------------
void
VISU_ScalarMapPL
::Build()
{
- myMapper->SetInput(DoHook());
-}
-
-
-//----------------------------------------------------------------------------
-unsigned long int
-VISU_ScalarMapPL
-::GetMemorySize()
-{
- vtkDataSet* aDataSet = myExtractor->GetOutput();
- unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
-
- aDataSet = myFieldTransform->GetOutput();
- aSize += aDataSet->GetActualMemorySize() * 1024;
-
- aSize += Superclass::GetMemorySize();
-
- return aSize;
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::Update()
-{
- vtkFloatingPointType *aRange = GetScalarRange();
- vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
- if(myBarTable->GetScale() == VTK_SCALE_LOG10)
- VISU_LookupTable::ComputeLogRange(aRange, aScalarRange);
-
- if(!VISU::CheckIsSameRange(myMapperTable->GetTableRange(), aScalarRange))
- myMapperTable->SetRange(aScalarRange);
-
- myMapperTable->Build();
- myBarTable->Build();
-
- myMapper->SetLookupTable(myMapperTable);
- if(!VISU::CheckIsSameRange(myMapper->GetScalarRange(), aScalarRange))
- myMapper->SetScalarRange(aScalarRange);
-
- Superclass::Update();
-}
-
-
-//----------------------------------------------------------------------------
-VISU_LookupTable *
-VISU_ScalarMapPL
-::GetMapperTable()
-{
- return myMapperTable;
-}
-
-VISU_LookupTable*
-VISU_ScalarMapPL
-::GetBarTable()
-{
- return myBarTable;
-}
-
-
-//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::SetMapScale(vtkFloatingPointType theMapScale)
-{
- myMapperTable->SetMapScale(theMapScale);
- myMapperTable->Build();
-}
+ Superclass::Build();
-vtkFloatingPointType
-VISU_ScalarMapPL::GetMapScale()
-{
- return myMapperTable->GetMapScale();
+ GetDataSetMapper()->SetInput(InsertCustomPL());
}
//----------------------------------------------------------------------------
-void
-VISU_ScalarMapPL
-::GetSourceRange(vtkFloatingPointType theRange[2])
-{
- myExtractor->Update();
- myExtractor->GetOutput()->GetScalarRange(theRange);
-}
-
-void
-VISU_ScalarMapPL
-::SetSourceRange()
-{
- vtkFloatingPointType aRange[2];
- GetSourceRange(aRange);
- SetScalarRange(aRange);
-}
//
//
//
-// File: VISU_PipeLine.hxx
+// File: VISU_ScalarMapPL.hxx
// Author: Alexey PETROV
// Module : VISU
-#ifndef VISU_ScalrMapPL_HeaderFile
-#define VISU_ScalrMapPL_HeaderFile
+#ifndef VISU_ScalarMapPL_HeaderFile
+#define VISU_ScalarMapPL_HeaderFile
-#include "VISU_PipeLine.hxx"
-#include "VISU_ScalarBarActor.hxx"
+#include "VISU_ColoredPL.hxx"
+#include "VISU_UnstructuredGridPL.hxx"
-class vtkCell;
-class vtkDataSet;
+class VISU_DataSetMapperHolder;
-class VISU_Extractor;
-class VISU_FieldTransform;
-
-//============================================================================
-class VISU_ScalarMapPL : public VISU_PipeLine
+//----------------------------------------------------------------------------
+class VISU_ScalarMapPL : public VISU_ColoredPL,
+ public VISU_UnstructuredGridPL
{
-protected:
- VISU_ScalarMapPL();
- VISU_ScalarMapPL(const VISU_ScalarMapPL&);
-
- virtual
- ~VISU_ScalarMapPL();
-
public:
- //----------------------------------------------------------------------------
- vtkTypeMacro(VISU_ScalarMapPL,VISU_PipeLine);
+ vtkTypeMacro(VISU_ScalarMapPL, VISU_ColoredPL);
- static
+ static
VISU_ScalarMapPL*
New();
+protected:
//----------------------------------------------------------------------------
- virtual
- int
- GetScalarMode();
-
- virtual
- void
- SetScalarMode(int theScalarMode = 0);
-
- virtual
- int
- GetScaling();
- virtual
- void
- SetScaling(int theScaling = VTK_SCALE_LINEAR);
-
- virtual
- vtkFloatingPointType*
- GetScalarRange();
-
- virtual
- void
- SetScalarRange(vtkFloatingPointType theRange[2]);
-
- virtual
- void
- SetScalarMin(vtkFloatingPointType theValue);
-
- virtual
- void
- SetScalarMax(vtkFloatingPointType theValue);
+ VISU_ScalarMapPL();
+ VISU_ScalarMapPL(const VISU_ScalarMapPL&);
virtual
- void
- SetNbColors(int theNbColors = 16);
+ ~VISU_ScalarMapPL();
- virtual
- int
- GetNbColors();
-
- //----------------------------------------------------------------------------
-public:
virtual
void
- Init();
+ OnCreateMapperHolder();
virtual
void
Build();
-
- virtual
- void
- Update();
-
- //! Gets memory size used by the instance (bytes).
- virtual
- unsigned long int
- GetMemorySize();
-
- virtual
- VISU_LookupTable*
- GetMapperTable();
-
- virtual
- VISU_LookupTable*
- GetBarTable();
-
- virtual
- void
- SetMapScale(vtkFloatingPointType theMapScale = 1.0);
-
- virtual
- vtkFloatingPointType
- GetMapScale();
-
- virtual
- void
- GetSourceRange(vtkFloatingPointType theRange[2]);
-
- virtual
- void
- SetSourceRange();
-
- //----------------------------------------------------------------------------
-protected:
- typedef vtkDataSet THook;
- virtual THook* DoHook();
-
- virtual
- void
- DoShallowCopy(VISU_PipeLine *thePipeLine,
- bool theIsCopyInput);
-
- VISU_LookupTable* myMapperTable;
- VISU_LookupTable* myBarTable;
- VISU_FieldTransform* myFieldTransform;
- VISU_Extractor* myExtractor;
};
#endif
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
-// File: VISU_PipeLine.cxx
+// File: VISU_StreamLinesPL.cxx
// Author: Alexey PETROV
// Module : VISU
#include "VISU_StreamLinesPL.hxx"
-#include "VISU_PipeLineUtils.hxx"
+#include "VISU_Extractor.hxx"
#include "VISU_UsedPointsFilter.hxx"
#include "VTKViewer_GeometryFilter.h"
+#include "VISU_PipeLineUtils.hxx"
+
#include <algo.h>
#include <vtkCell.h>
-#include <vtkPointSet.h>
+#include <vtkDataSet.h>
#include <vtkStreamLine.h>
#ifdef _DEBUG_
static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1;
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_StreamLinesPL);
+
+//----------------------------------------------------------------------------
VISU_StreamLinesPL
::VISU_StreamLinesPL()
{
mySource = NULL;
}
+
+//----------------------------------------------------------------------------
VISU_StreamLinesPL
::~VISU_StreamLinesPL()
{
- myPointsFilter->UnRegisterAllOutputs();
myPointsFilter->Delete();
+ myPointsFilter = NULL;
myCenters->UnRegisterAllOutputs();
- myCenters->Delete();
+ myCenters = NULL;
myGeomFilter->UnRegisterAllOutputs();
- myGeomFilter->Delete();
+ myGeomFilter = NULL;
myStream->UnRegisterAllOutputs();
- myStream->Delete();
+ myStream = NULL;
}
+
+//----------------------------------------------------------------------------
void
VISU_StreamLinesPL
::DoShallowCopy(VISU_PipeLine *thePipeLine,
aPipeLine->GetUsedPoints(),
aPipeLine->GetDirection());
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+//----------------------------------------------------------------------------
size_t
VISU_StreamLinesPL
::GetNecasseryMemorySize(vtkIdType theNbOfPoints,
return aResult;
}
+
+//----------------------------------------------------------------------------
size_t
VISU_StreamLinesPL
-::FindPossibleParams(vtkPointSet* theDataSet,
+::FindPossibleParams(vtkDataSet* theDataSet,
vtkFloatingPointType& theStepLength,
vtkFloatingPointType& thePropogationTime,
vtkFloatingPointType& thePercents)
}
+//----------------------------------------------------------------------------
size_t
VISU_StreamLinesPL
::SetParams(vtkFloatingPointType theIntStep,
vtkFloatingPointType thePropogationTime,
vtkFloatingPointType theStepLength,
- vtkPointSet* theSource,
+ vtkDataSet* theSource,
vtkFloatingPointType thePercents,
int theDirection,
int isOnlyTry)
{
- vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->GetUnstructuredGridOutput();
+ vtkDataSet* aDataSet = theSource? theSource:
+ GetFieldTransformFilter()->GetUnstructuredGridOutput();
aDataSet->Update();
+
vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
- vtkPointSet* aPointSet = myExtractor->GetOutput();
- if(thePercents*aNbOfPoints < 1) thePercents = 2.0/aNbOfPoints;
- theIntStep = CorrectIntegrationStep(theIntStep,aPointSet,thePercents);
- thePropogationTime = CorrectPropagationTime(thePropogationTime,aPointSet);
- theStepLength = CorrectStepLength(theStepLength,aPointSet);
- size_t isAccepted = FindPossibleParams(aPointSet,theStepLength,thePropogationTime,thePercents);
+ vtkDataSet* aPointSet = GetExtractorFilter()->GetOutput();
+ if(thePercents * aNbOfPoints < 1)
+ thePercents = 2.0 / aNbOfPoints;
+
+ theIntStep = CorrectIntegrationStep(theIntStep,
+ aPointSet,
+ thePercents);
+
+ thePropogationTime = CorrectPropagationTime(thePropogationTime,
+ aPointSet);
+
+ theStepLength = CorrectStepLength(theStepLength,
+ aPointSet);
+
+ size_t isAccepted = FindPossibleParams(aPointSet,
+ theStepLength,
+ thePropogationTime,
+ thePercents);
+
if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
mySource = theSource;
myPercents = thePercents;
- if(GetInput2()->GetCellData()->GetNumberOfArrays()){
+ if(GetClippedInput()->GetCellData()->GetNumberOfArrays()){
myCenters->SetInput(aDataSet);
myCenters->VertexCellsOn();
aDataSet = myCenters->GetOutput();
}
-vtkPointSet*
+//----------------------------------------------------------------------------
+vtkDataSet*
VISU_StreamLinesPL
::GetSource()
{
return mySource;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetUsedPoints()
return myPercents;
}
+
+//----------------------------------------------------------------------------
vtkDataSet*
VISU_StreamLinesPL
::GetStreamerSource()
return myStream->GetSource();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetVelocityCoeff()
{
- return GetVelocityCoeff(myExtractor->GetOutput());
+ return GetVelocityCoeff(GetExtractorFilter()->GetOutput());
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetVelocityCoeff(vtkPointSet* theDataSet)
+::GetVelocityCoeff(vtkDataSet* theDataSet)
{
vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange();
return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
}
+//----------------------------------------------------------------------------
size_t
VISU_StreamLinesPL
-::IsPossible(vtkPointSet* theDataSet,
+::IsPossible(vtkDataSet* theDataSet,
vtkFloatingPointType thePercents)
{
vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
aPointsFilter->SetInput(theDataSet);
- vtkPointSet* aDataSet = aPointsFilter->GetOutput();
+ vtkDataSet* aDataSet = aPointsFilter->GetOutput();
aDataSet->Update();
- size_t aRes = FindPossibleParams(aDataSet,aStepLength,aBasePropTime,thePercents);
- aPointsFilter->UnRegisterAllOutputs();
+ size_t aRes = FindPossibleParams(aDataSet,
+ aStepLength,
+ aBasePropTime,
+ thePercents);
aPointsFilter->Delete();
return aRes;
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetIntegrationStep()
return myStream->GetIntegrationStepLength();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetStepLength()
return myStream->GetStepLength();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetPropagationTime()
return myStream->GetMaximumPropagationTime();
}
+
+//----------------------------------------------------------------------------
int
VISU_StreamLinesPL
::GetDirection()
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetMinIntegrationStep(vtkPointSet* theDataSet,
+::GetMinIntegrationStep(vtkDataSet* theDataSet,
vtkFloatingPointType thePercents)
{
- if(!theDataSet) return -1.0;
- vtkFloatingPointType aVolume = 1.0;
- int degree = 0;
+ if(!theDataSet)
+ return -1.0;
+
theDataSet->Update();
+
+ int degree = 0;
+ vtkFloatingPointType aVolume = 1.0;
vtkFloatingPointType* aBounds = theDataSet->GetBounds();
for(int i = 0, j = 0; i < 3; ++i, j = 2*i){
vtkFloatingPointType tmp = aBounds[j+1] - aBounds[j];
degree += 1;
}
}
- if (degree < 1) return 0.0; // absolutely empty object
+
+ if (degree < 1)
+ return 0.0; // absolutely empty object
+
vtkFloatingPointType anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep;
vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet);
thePercents = 1.0;
return aStep;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetMinIntegrationStep()
{
- return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints());
+ return GetMinIntegrationStep(GetExtractorFilter()->GetOutput(), GetUsedPoints());
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetMaxIntegrationStep(vtkPointSet* theDataSet)
+::GetMaxIntegrationStep(vtkDataSet* theDataSet)
{
- if(!theDataSet) return -1.0;
+ if(!theDataSet)
+ return -1.0;
+
theDataSet->Update();
+
vtkFloatingPointType aLength = theDataSet->GetLength();
vtkFloatingPointType* aBounds = theDataSet->GetBounds();
vtkFloatingPointType aMaxSizeY = (aBounds[3]-aBounds[2])/aLength;
vtkFloatingPointType aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength;
vtkFloatingPointType aMinMax = (aBounds[1] - aBounds[0])/aLength;
- if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY;
- if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ;
+ if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS))
+ aMinMax = aMaxSizeY;
+ if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS))
+ aMinMax = aMaxSizeZ;
return aMinMax*aLength/2.0;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetMaxIntegrationStep()
{
- return GetMaxIntegrationStep(myExtractor->GetOutput());
+ return GetMaxIntegrationStep(GetExtractorFilter()->GetOutput());
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetBaseIntegrationStep(vtkPointSet* theDataSet,
+::GetBaseIntegrationStep(vtkDataSet* theDataSet,
vtkFloatingPointType thePercents)
{
theDataSet->Update();
- vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
+
vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
vtkFloatingPointType anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
- vtkFloatingPointType aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
+ vtkFloatingPointType aMinMax = theDataSet->GetLength() / theDataSet->GetNumberOfPoints();
if(aMinMax > anIntegrationStep)
anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
+
+ vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet, thePercents);
if(aMinIntegrationStep > anIntegrationStep)
anIntegrationStep = aMinIntegrationStep;
+
return anIntegrationStep;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::CorrectIntegrationStep(vtkFloatingPointType theStep,
- vtkPointSet* theDataSet,
+ vtkDataSet* theDataSet,
vtkFloatingPointType thePercents)
{
theDataSet->Update();
- vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
- vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
+
+ vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet, thePercents);
if(aMinIntegrationStep > theStep)
theStep = aMinIntegrationStep;
+
+ vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
if(aMaxIntegrationStep < theStep)
theStep = aMaxIntegrationStep;
+
return theStep;
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetMinPropagationTime(vtkPointSet* theDataSet)
+::GetMinPropagationTime(vtkDataSet* theDataSet)
{
- if(!theDataSet) return -1.0;
+ if(!theDataSet)
+ return -1.0;
+
return GetMinStepLength(theDataSet);
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetMinPropagationTime()
{
- return GetMinPropagationTime(myExtractor->GetOutput());
+ return GetMinPropagationTime(GetExtractorFilter()->GetOutput());
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetMaxPropagationTime(vtkPointSet* theDataSet)
+::GetMaxPropagationTime(vtkDataSet* theDataSet)
{
- if(!theDataSet) return -1.0;
+ if(!theDataSet)
+ return -1.0;
+
return GetBasePropagationTime(theDataSet)*aMinNbOfSteps;
}
-vtkFloatingPointType VISU_StreamLinesPL::GetMaxPropagationTime(){
- return GetMaxPropagationTime(myExtractor->GetOutput());
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxPropagationTime()
+{
+ return GetMaxPropagationTime(GetExtractorFilter()->GetOutput());
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::CorrectPropagationTime(vtkFloatingPointType thePropagationTime,
- vtkPointSet* theDataSet)
+ vtkDataSet* theDataSet)
{
vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet);
- vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
if(aMinPropagationTime > thePropagationTime)
thePropagationTime = aMinPropagationTime;
+
+ vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
if(aMaxPropagationTime < thePropagationTime)
thePropagationTime = aMaxPropagationTime;
+
return thePropagationTime;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetBasePropagationTime(vtkPointSet* theDataSet)
+::GetBasePropagationTime(vtkDataSet* theDataSet)
{
- if(!theDataSet) return -1.0;
+ if(!theDataSet)
+ return -1.0;
+
theDataSet->Update();
- vtkFloatingPointType aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
+ vtkFloatingPointType aPropagationTime = theDataSet->GetLength() / GetVelocityCoeff(theDataSet);
+
return aPropagationTime;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetBasePropagationTime()
{
- return GetBasePropagationTime(myExtractor->GetOutput());
+ return GetBasePropagationTime(GetExtractorFilter()->GetOutput());
}
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetMinStepLength(vtkPointSet* theDataSet)
+::GetMinStepLength(vtkDataSet* theDataSet)
{
static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1;
vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet);
- vtkFloatingPointType aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet);
+ vtkFloatingPointType aStepLength = anIntStep * aNbOfStepsOfIntStep / GetVelocityCoeff(theDataSet);
return aStepLength;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetMinStepLength()
{
- return GetMinStepLength(myExtractor->GetOutput());
+ return GetMinStepLength(GetExtractorFilter()->GetOutput());
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetMaxStepLength(vtkPointSet* theDataSet)
+::GetMaxStepLength(vtkDataSet* theDataSet)
{
vtkFloatingPointType aStepLength = GetBasePropagationTime(theDataSet);
return aStepLength;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::GetMaxStepLength()
{
- return GetMaxStepLength(myExtractor->GetOutput());
+ return GetMaxStepLength(GetExtractorFilter()->GetOutput());
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
::CorrectStepLength(vtkFloatingPointType theStep,
- vtkPointSet* theDataSet)
+ vtkDataSet* theDataSet)
{
vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet);
- if(theStep < aMinStep) theStep = aMinStep;
+ if(theStep < aMinStep)
+ theStep = aMinStep;
+
vtkFloatingPointType aMaxStep = GetMaxStepLength(theDataSet);
- if(theStep > aMaxStep) theStep = aMaxStep;
+ if(theStep > aMaxStep)
+ theStep = aMaxStep;
+
return theStep;
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_StreamLinesPL
-::GetBaseStepLength(vtkPointSet* theDataSet)
+::GetBaseStepLength(vtkDataSet* theDataSet)
{
static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2;
vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet);
vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps;
aStepLength = CorrectStepLength(aStepLength,theDataSet);
+
return aStepLength;
}
+//----------------------------------------------------------------------------
void
VISU_StreamLinesPL
::Init()
{
VISU_ScalarMapPL::Init();
- vtkPointSet* aDataSet = myExtractor->GetOutput();
+
+ vtkDataSet* aDataSet = GetExtractorFilter()->GetOutput();
vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet);
- SetParams(anIntStep,aPropagationTime,aStepLength);
+ SetParams(anIntStep,
+ aPropagationTime,
+ aStepLength);
}
-VISU_ScalarMapPL::THook*
+
+//----------------------------------------------------------------------------
+vtkDataSet*
VISU_StreamLinesPL
-::DoHook()
+::InsertCustomPL()
{
- GetInput2()->Update();
- VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
- vtkFloatingPointType *aBounds = GetInput2()->GetBounds();
+ GetClippedInput()->Update();
+
+ VISU::CellDataToPoint(myStream,
+ myCellDataToPointData,
+ GetClippedInput(),
+ GetFieldTransformFilter());
+
+ vtkFloatingPointType *aBounds = GetClippedInput()->GetBounds();
myGeomFilter->SetExtent(aBounds);
myGeomFilter->ExtentClippingOn();
myGeomFilter->SetInput(myStream->GetOutput());
+
return myGeomFilter->GetOutput();
}
+
+//----------------------------------------------------------------------------
void
VISU_StreamLinesPL
::Update()
VISU_ScalarMapPL::Update();
}
+
//----------------------------------------------------------------------------
unsigned long int
VISU_StreamLinesPL
{
VISU_ScalarMapPL::SetMapScale(theMapScale);
}
+
+
+//----------------------------------------------------------------------------
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
-// File: VISU_PipeLine.hxx
+// File: VISU_StreamLinesPL.hxx
// Author: Alexey PETROV
// Module : VISU
#include "VISU_DeformedShapePL.hxx"
#include <vtkStreamLine.h>
-using namespace std;
-
-class vtkPointSet;
+class vtkDataSet;
class vtkCellCenters;
class VTKViewer_GeometryFilter;
class VISU_UsedPointsFilter;
+
+//----------------------------------------------------------------------------
class VISU_StreamLinesPL : public VISU_DeformedShapePL
{
-protected:
- VISU_StreamLinesPL();
- VISU_StreamLinesPL(const VISU_StreamLinesPL&);
-
- virtual
- ~VISU_StreamLinesPL();
-
public:
- vtkTypeMacro(VISU_StreamLinesPL,VISU_DeformedShapePL);
+ vtkTypeMacro(VISU_StreamLinesPL, VISU_DeformedShapePL);
static
VISU_StreamLinesPL*
SetParams(vtkFloatingPointType theIntStep,
vtkFloatingPointType thePropogationTime,
vtkFloatingPointType theStepLength,
- vtkPointSet* theSource = NULL,
+ vtkDataSet* theSource = NULL,
vtkFloatingPointType thePercents = 0.3,
int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS,
int isOnlyTry = false);
virtual
- vtkPointSet*
+ vtkDataSet*
GetSource();
virtual
public:
virtual
- THook*
- DoHook();
+ vtkDataSet*
+ InsertCustomPL();
virtual
void
public:
static
vtkFloatingPointType
- GetMaxIntegrationStep(vtkPointSet* theDataSet);
+ GetMaxIntegrationStep(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetMinIntegrationStep(vtkPointSet* theDataSet,
+ GetMinIntegrationStep(vtkDataSet* theDataSet,
vtkFloatingPointType thePercents = 0.3);
static
vtkFloatingPointType
- GetBaseIntegrationStep(vtkPointSet* theDataSet,
+ GetBaseIntegrationStep(vtkDataSet* theDataSet,
vtkFloatingPointType thePercents = 0.3);
static
vtkFloatingPointType
- GetMinPropagationTime(vtkPointSet* theDataSet);
+ GetMinPropagationTime(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetMaxPropagationTime(vtkPointSet* theDataSet);
+ GetMaxPropagationTime(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetBasePropagationTime(vtkPointSet* theDataSet);
+ GetBasePropagationTime(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetMinStepLength(vtkPointSet* theDataSet);
+ GetMinStepLength(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetMaxStepLength(vtkPointSet* theDataSet);
+ GetMaxStepLength(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetBaseStepLength(vtkPointSet* theDataSet);
+ GetBaseStepLength(vtkDataSet* theDataSet);
static
vtkFloatingPointType
- GetVelocityCoeff(vtkPointSet* theDataSet);
+ GetVelocityCoeff(vtkDataSet* theDataSet);
static
size_t
- IsPossible(vtkPointSet* theDataSet,
+ IsPossible(vtkDataSet* theDataSet,
vtkFloatingPointType thePercents = 0.3);
protected:
+ VISU_StreamLinesPL();
+ VISU_StreamLinesPL(const VISU_StreamLinesPL&);
+
+ virtual
+ ~VISU_StreamLinesPL();
+
virtual
void
DoShallowCopy(VISU_PipeLine *thePipeLine,
static
size_t
- FindPossibleParams(vtkPointSet* theDataSet,
+ FindPossibleParams(vtkDataSet* theDataSet,
vtkFloatingPointType& theStepLength,
vtkFloatingPointType& thePropogationTime,
vtkFloatingPointType& thePercents);
static
vtkFloatingPointType
CorrectIntegrationStep(vtkFloatingPointType theStep,
- vtkPointSet* theDataSet,
+ vtkDataSet* theDataSet,
vtkFloatingPointType thePercents = 0.3);
static
vtkFloatingPointType
CorrectPropagationTime(vtkFloatingPointType thePropagationTime,
- vtkPointSet* theDataSet);
+ vtkDataSet* theDataSet);
static
vtkFloatingPointType
CorrectStepLength(vtkFloatingPointType theStep,
- vtkPointSet* theDataSet);
+ vtkDataSet* theDataSet);
vtkStreamLine* myStream;
- vtkPointSet* mySource;
+ vtkDataSet* mySource;
vtkCellCenters* myCenters;
VTKViewer_GeometryFilter *myGeomFilter;
VISU_UsedPointsFilter *myPointsFilter;
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File: VISU_UnstructuredGridPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_UnstructuredGridPL.hxx"
+#include "VISU_DataSetMapperHolder.hxx"
+
+
+//----------------------------------------------------------------------------
+VISU_UnstructuredGridPL
+::VISU_UnstructuredGridPL(VISU_PipeLine* thePipeLine):
+ myPipeLine(thePipeLine)
+{}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_UnstructuredGridPL
+::OnCreateMapperHolder()
+{
+ myDataSetMapperHolder = VISU_DataSetMapperHolder::New();
+ myDataSetMapperHolder->Delete();
+
+ myPipeLine->SetMapperHolder(myDataSetMapperHolder.GetPointer());
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_UnstructuredGridPL
+::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
+{
+ GetDataSetMapperHolder()->SetUnstructuredGridIDMapper(theIDMapper);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_DataSetMapperHolder*
+VISU_UnstructuredGridPL
+::GetDataSetMapperHolder()
+{
+ myPipeLine->GetMapperHolder();
+
+ return myDataSetMapperHolder.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSetMapper*
+VISU_UnstructuredGridPL
+::GetDataSetMapper()
+{
+ return GetDataSetMapperHolder()->GetDataSetMapper();
+}
+
+
+//----------------------------------------------------------------------------
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File: VISU_UnstructuredGripPL.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_UnstructuredGridPL_HeaderFile
+#define VISU_UnstructuredGridPL_HeaderFile
+
+#include "VISU_PipeLine.hxx"
+
+class VISU_DataSetMapperHolder;
+class vtkDataSetMapper;
+
+//----------------------------------------------------------------------------
+class VISU_UnstructuredGridPL
+{
+public:
+ //----------------------------------------------------------------------------
+ void
+ SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper);
+
+ VISU_DataSetMapperHolder*
+ GetDataSetMapperHolder();
+
+ vtkDataSetMapper*
+ GetDataSetMapper();
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_UnstructuredGridPL(VISU_PipeLine* thePipeLine);
+
+ virtual
+ void
+ OnCreateMapperHolder();
+
+private:
+ //----------------------------------------------------------------------------
+ VISU_UnstructuredGridPL(); // Not implemented
+ VISU_UnstructuredGridPL(const VISU_UnstructuredGridPL&); // Not implemented
+
+ VISU_PipeLine* myPipeLine;
+ vtkSmartPointer<VISU_DataSetMapperHolder> myDataSetMapperHolder;
+};
+
+#endif
#include "VISU_UsedPointsFilter.hxx"
#include <vtkObjectFactory.h>
-#include <vtkPointSet.h>
+#include <vtkUnstructuredGrid.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkPoints.h>
#include <vtkIdList.h>
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_UsedPointsFilter);
-VISU_UsedPointsFilter::VISU_UsedPointsFilter(){
+
+//----------------------------------------------------------------------------
+VISU_UsedPointsFilter
+::VISU_UsedPointsFilter()
+{
PercentsOfUsedPoints = 1.0;
}
-VISU_UsedPointsFilter::~VISU_UsedPointsFilter(){}
-void VISU_UsedPointsFilter::Execute(){
- vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
+//----------------------------------------------------------------------------
+VISU_UsedPointsFilter
+::~VISU_UsedPointsFilter()
+{}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_UsedPointsFilter
+::Execute()
+{
+ vtkDataSet *anInput = this->GetInput();
+ vtkPointSet *anOutput = this->GetOutput();
anOutput->GetPointData()->CopyAllOff();
anOutput->GetCellData()->CopyAllOff();
anOutput->CopyStructure(anInput);
aNewPoints->Delete();
aPoints->Delete();
}
+
+
+//----------------------------------------------------------------------------
#ifndef VISU_UsedPointsFilter_HeaderFile
#define VISU_UsedPointsFilter_HeaderFile
-#include <vtkPointSetToPointSetFilter.h>
+#include <vtkDataSetToUnstructuredGridFilter.h>
+
+
+//----------------------------------------------------------------------------
+class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter
+{
+public:
+ vtkTypeMacro(VISU_UsedPointsFilter, vtkDataSetToUnstructuredGridFilter);
+
+ static
+ VISU_UsedPointsFilter*
+ New();
+
+ vtkSetMacro(PercentsOfUsedPoints,float);
+ vtkGetMacro(PercentsOfUsedPoints,float);
-class VISU_UsedPointsFilter : public vtkPointSetToPointSetFilter{
protected:
VISU_UsedPointsFilter();
VISU_UsedPointsFilter(const VISU_UsedPointsFilter&);
- virtual void Execute();
- float PercentsOfUsedPoints;
+ virtual
+ ~VISU_UsedPointsFilter();
-public:
- vtkTypeMacro(VISU_UsedPointsFilter,vtkPointSetToPointSetFilter);
- static VISU_UsedPointsFilter* New();
- virtual ~VISU_UsedPointsFilter();
+ virtual
+ void
+ Execute();
- vtkSetMacro(PercentsOfUsedPoints,float);
- vtkGetMacro(PercentsOfUsedPoints,float);
+ float PercentsOfUsedPoints;
};
#endif
#include <vtkGlyphSource2D.h>
#include <vtkPolyData.h>
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_VectorsPL);
+
+//----------------------------------------------------------------------------
VISU_VectorsPL
::VISU_VectorsPL()
{
+ SetIsShrinkable(false);
+
myBaseGlyph = vtkGlyph3D::New();
myTransformedGlyph = vtkGlyph3D::New();
myCenters = vtkCellCenters::New();
myTransformFilter = VTKViewer_TransformFilter::New();
- myIsShrinkable = false;
}
+
+//----------------------------------------------------------------------------
VISU_VectorsPL
::~VISU_VectorsPL()
{
myTransformFilter->Delete();
}
+
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::DoShallowCopy(VISU_PipeLine *thePipeLine,
SetGlyphType(aPipeLine->GetGlyphType());
SetGlyphPos(aPipeLine->GetGlyphPos());
}
+
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
}
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::SetTransform(VTKViewer_Transform* theTransform)
{
- myFieldTransform->SetSpaceTransform(theTransform);
+ GetFieldTransformFilter()->SetSpaceTransform(theTransform);
myTransformFilter->SetTransform(theTransform);
myTransformFilter->Modified();
}
+
+//----------------------------------------------------------------------------
VTKViewer_Transform*
VISU_VectorsPL
::GetTransform()
{
- return myFieldTransform->GetSpaceTransform();
+ return GetFieldTransformFilter()->GetSpaceTransform();
}
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::SetScale(vtkFloatingPointType theScale)
Modified();
}
+
+//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_VectorsPL
::GetScale()
}
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::SetGlyphType(VISU_VectorsPL::GlyphType theType)
Modified();
}
+
+//----------------------------------------------------------------------------
VISU_VectorsPL::GlyphType
VISU_VectorsPL
::GetGlyphType() const
}
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::SetGlyphPos(VISU_VectorsPL::GlyphPos thePos)
Modified();
}
+
+//----------------------------------------------------------------------------
VISU_VectorsPL::GlyphPos
VISU_VectorsPL
::GetGlyphPos() const
}
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::Init()
}
+//----------------------------------------------------------------------------
vtkDataSet*
VISU_VectorsPL
::GetOutput()
}
-VISU_ScalarMapPL::THook*
+//----------------------------------------------------------------------------
+vtkDataSet*
VISU_VectorsPL
-::DoHook()
+::InsertCustomPL()
{
- VISU::ToCellCenters(myBaseGlyph,myCenters,GetInput2(),myFieldTransform);
+ VISU::ToCellCenters(myBaseGlyph,
+ myCenters,
+ GetClippedInput(),
+ GetFieldTransformFilter());
+
myBaseGlyph->SetVectorModeToUseVector();
myBaseGlyph->SetScaleModeToScaleByVector();
myBaseGlyph->SetColorModeToColorByScalar();
- VISU::ToCellCenters(myTransformFilter,myCenters,GetInput2(),myFieldTransform);
+ VISU::ToCellCenters(myTransformFilter,
+ myCenters,
+ GetClippedInput(),
+ GetFieldTransformFilter());
+
myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
myTransformedGlyph->SetVectorModeToUseVector();
myTransformedGlyph->SetScaleModeToScaleByVector();
}
+//----------------------------------------------------------------------------
void
VISU_VectorsPL
::Update()
Modified();
}
+
+
+//----------------------------------------------------------------------------
class vtkGlyph3D;
+
+//----------------------------------------------------------------------------
class VISU_VectorsPL : public VISU_DeformedShapePL
{
-protected:
- VISU_VectorsPL();
- VISU_VectorsPL(const VISU_VectorsPL&);
-
- virtual
- ~VISU_VectorsPL();
-
public:
vtkTypeMacro(VISU_VectorsPL,VISU_DeformedShapePL);
SetMapScale(vtkFloatingPointType theMapScale = 1.0);
protected:
+ VISU_VectorsPL();
+ VISU_VectorsPL(const VISU_VectorsPL&);
+
virtual
- THook*
- DoHook();
+ ~VISU_VectorsPL();
+
+ virtual
+ vtkDataSet*
+ InsertCustomPL();
virtual
void
// Check contents of the resulting (clipped) presentation data
if (!isFailed) {
VISU_PipeLine* aPL = myPrs3d->GetPipeLine();
- VISU_PipeLine::TMapper* aM = aPL->GetMapper();
- vtkDataSet* aPrsData = aM->GetInput();
+ vtkMapper* aMapper = aPL->GetMapper();
+ vtkDataSet* aPrsData = aMapper->GetInput();
aPrsData->Update();
if (aPrsData->GetNumberOfCells() < 1) {
isFailed = true;
#include "VISUConfig.hh"
#include "VISU_Convertor.hxx"
#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
#include "VISU_ScalarMapAct.h"
#include "VISU_ScalarMap_i.hh"
#include "VISU_Result_i.hh"
#include "VISU_ColoredPrs3d_i.hh"
-#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ColoredPL.hxx"
#include "VISU_Result_i.hh"
#include "VISU_Convertor.hxx"
ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
myPublishInStudyMode(thePublishInStudyMode),
myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
- myScalarMapPL(NULL),
+ myColoredPL(NULL),
myIsFixedRange(false)
{}
VISU::ColoredPrs3d_i
::GetScalarMode()
{
- return myScalarMapPL->GetScalarMode();
+ return myColoredPL->GetScalarMode();
}
//----------------------------------------------------------------------------
else if(theScalarMode > aNbComp)
theScalarMode = 0;
- myScalarMapPL->SetScalarMode(theScalarMode);
+ myColoredPL->SetScalarMode(theScalarMode);
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::GetMin()
{
- return myScalarMapPL->GetScalarRange()[0];
+ return myColoredPL->GetScalarRange()[0];
}
//----------------------------------------------------------------------------
VISU::ColoredPrs3d_i
::GetMax()
{
- return myScalarMapPL->GetScalarRange()[1];
+ return myColoredPL->GetScalarRange()[1];
}
//----------------------------------------------------------------------------
::CreatePipeLine(VISU_PipeLine* thePipeLine)
{
if(MYDEBUG) MESSAGE("ColoredPrs3d_i::CreatePipeLine() - "<<thePipeLine);
- if(!thePipeLine){
- myScalarMapPL = VISU_ScalarMapPL::New();
- myScalarMapPL->GetMapper()->SetScalarVisibility(1);
- }else
- myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine);
+ myColoredPL = dynamic_cast<VISU_ColoredPL*>(thePipeLine);
- SetPipeLine(myScalarMapPL);
+ SetPipeLine(myColoredPL);
}
//----------------------------------------------------------------------------
#include "VISU_Prs3d_i.hh"
-class VISU_ScalarMapPL;
+class VISU_ColoredPL;
namespace VISU
{
vtkFloatingPointType theG,
vtkFloatingPointType theB);
- VISU_ScalarMapPL*
+ VISU_ColoredPL*
GetSpecificPL() const
{
- return myScalarMapPL;
+ return myColoredPL;
}
//----------------------------------------------------------------------------
int myLblFontType;
vtkFloatingPointType myLabelColor[3];
- VISU_ScalarMapPL* myScalarMapPL;
+ VISU_ColoredPL* myColoredPL;
bool myIsFixedRange;
};
// Copyright (C) 2003 CEA/DEN, EDF R&D
#include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
#include <vtkCellType.h>
VISU::PCValForTime theValForTime)
{
//Check on loading already done
- PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
- if(anIDMapperFilter->myIsVTKDone)
+ PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
+ if(anUnstructuredGridIDMapper->myIsVTKDone)
return 0;
PCProfile aProfile(new TCProfile());
if(!aFieldDouble->_is_nil()){
SALOME_MED::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDDOUBLE = "<<anArray->length());
- ImportField<CORBA::Double>(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
+ ImportField<CORBA::Double>(anArray,
+ theMesh,
+ theField,
+ theValForTime,
+ theMeshOnEntity);
}
+
SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(aMEDField);
if(!aFieldInt->_is_nil()){
SALOME_MED::long_array_var anArray = aFieldInt->getValue(SALOME_MED::MED_FULL_INTERLACE);
if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
- ImportField<CORBA::Long>(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
+ ImportField<CORBA::Long>(anArray,
+ theMesh,
+ theField,
+ theValForTime,
+ theMeshOnEntity);
}
- anIDMapperFilter->myIsVTKDone = true;
+ anUnstructuredGridIDMapper->myIsVTKDone = true;
return 1;
}
#include "VISUConfig.hh"
#include "VISU_Convertor_impl.hxx"
+#include "VISU_Structures_impl.hxx"
+#include "VISU_PointCoords.hxx"
+#include "VISU_MeshValue.hxx"
#include <string>
{
SALOME_MED::MESH_var myMesh;
};
- typedef SharedPtr<TCMesh> PCMesh;
+ typedef MED::SharedPtr<TCMesh> PCMesh;
//---------------------------------------------------------------
struct TCProfile: virtual TProfileImpl
{};
- typedef SharedPtr<TCProfile> PCProfile;
+ typedef MED::SharedPtr<TCProfile> PCProfile;
//---------------------------------------------------------------
struct TCSubMesh: virtual TSubMeshImpl
{};
- typedef SharedPtr<TCSubMesh> PCSubMesh;
+ typedef MED::SharedPtr<TCSubMesh> PCSubMesh;
//---------------------------------------------------------------
typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
TCellsFirstIndex myCellsFirstIndex;
};
- typedef SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
+ typedef MED::SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
//---------------------------------------------------------------
{
SALOME_MED::FAMILY_var myFamily;
};
- typedef SharedPtr<TCFamily> PCFamily;
+ typedef MED::SharedPtr<TCFamily> PCFamily;
//---------------------------------------------------------------
{
SALOME_MED::GROUP_var myGroup;
};
- typedef SharedPtr<TCGroup> PCGroup;
+ typedef MED::SharedPtr<TCGroup> PCGroup;
//---------------------------------------------------------------
struct TCField: virtual TFieldImpl
{};
- typedef SharedPtr<TCField> PCField;
+ typedef MED::SharedPtr<TCField> PCField;
//---------------------------------------------------------------
{
SALOME_MED::FIELD_var myField;
};
- typedef SharedPtr<TCValForTime> PCValForTime;
+ typedef MED::SharedPtr<TCValForTime> PCValForTime;
}
#include "VISU_Table_i.hh"
#include "VISU_GaussPoints_i.hh"
#include "VISU_ScalarMapOnDeformedShape_i.hh"
-#include "VISU_ColoredPrs3dCache_i.hh"
-#include "VISU_ColoredPrs3dHolder_i.hh"
#include "utilities.h"
{
static std::string PREFIX(" ");
- static std::string aResultName;
-
typedef std::map<std::string,std::string> TName2EntryMap;
typedef std::map<std::string,std::string> TEntry2NameMap;
switch(aType){
case VISU::TRESULT:
if(Result_i* aServant = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- aResultName = aName;
std::string aFileName = aServant->GetFileName();
Result_i::ECreationId anId = aServant->GetCreationId();
if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){
}
}
return;
- case VISU::TCOLOREDPRS3DCACHE:
- if(ColoredPrs3dCache_i* aServant = dynamic_cast<ColoredPrs3dCache_i*>(GetServant(anObj).in())){
- theStr<<thePrefix<<"aCache = aVisu.GetColoredPrs3dCache(aVisu.GetCurrentStudy())"<<endl<<endl;
- TColoredPrs3dHolderMap aHolderMap = aServant->GetHolderMap();
- TColoredPrs3dHolderMap::const_iterator aHolderIter = aHolderMap.begin();
- TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = aHolderMap.end();
- for(; aHolderIter != aHolderIterEnd; aHolderIter++){
- const TLastVisitedPrsList& aPrsList = aHolderIter->second;
- if(TPrs3dPtr aPrs3d = aPrsList.front())
- {
- ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput();
-
- std::string anEntity;
- switch(anInput->myEntity){
- case VISU::NODE : anEntity = "VISU.NODE"; break;
- case VISU::EDGE : anEntity = "VISU.EDGE"; break;
- case VISU::FACE : anEntity = "VISU.FACE"; break;
- case VISU::CELL : anEntity = "VISU.CELL"; break;
- }
-
- theStr<<thePrefix<<"anInput = VISU.ColoredPrs3dHolder.BasicInput("<<aResultName<<",'"<<
- anInput->myMeshName<<"',"<<anEntity<<",'"<<
- anInput->myFieldName<<"',"<<anInput->myTimeStampNumber<<")"<<endl;
-
- std::string aType = aPrs3d->GetComment();
- theStr<<thePrefix<<"aHolder = aCache.CreateHolder(VISU.T"<<aType<<",anInput)"<<endl<<endl;
- }
- }
- }
- return;
}
}
} else { /*if(!CORBA::is_nil(anObj))*/
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_ScalarBarCtrl.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_Convertor.hxx"
#include "SUIT_ResourceMgr.h"
GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper);
if(theIsInitilizePipe){
GetSpecificPL()->Init();
- GetSpecificPL()->Build();
}
GetCResult()->MinMaxConnect(this);
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
Mesh_i* aPresent = new Mesh_i();
- if(!aPresent->Create(aResult, theMeshName, theEntity))
+ if(aPresent->Create(aResult, theMeshName, theEntity))
return aPresent->_this();
else{
aPresent->_remove_ref();
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
Mesh_i* aPresent = new Mesh_i();
- if(!aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
+ if(aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
return aPresent->_this();
else{
aPresent->_remove_ref();
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
Mesh_i* aPresent = new Mesh_i();
- if(!aPresent->Create(aResult, theMeshName, theGroupName))
+ if(aPresent->Create(aResult, theMeshName, theGroupName))
return aPresent->_this();
else{
aPresent->_remove_ref();
if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
QString aComment,aTmp;
- VISU::PIDMapper anIDMapper;
+ VISU::PUnstructuredGridIDMapper anIDMapper;
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
switch(myType){
case VISU::TENTITY :
if(!anIDMapper)
throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
- myMeshPL->SetIDMapper(anIDMapper);
- myMeshPL->Build();
+ myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
if(!theRestoring) { //Setting IOR on the label
myMeshPL->Init();
}
//----------------------------------------------------------------------------
-vtkUnstructuredGrid*
+vtkDataSet*
VISU::Prs3d_i
::GetInput()
{
class vtkPlane;
class vtkActorCollection;
-class vtkUnstructuredGrid;
+class vtkDataSet;
namespace VISU
{
IsPipeLineExists();
//! Get input of the VISU_PipeLine
- vtkUnstructuredGrid*
+ vtkDataSet*
GetInput();
//----------------------------------------------------------------------------
return components;
}
- VISU::PIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName,
- CELL_ENTITY);
- VISU::TVTKOutput* aMesh = anIDMapper->GetVTKOutput();
+ VISU::PUnstructuredGridIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName,
+ CELL_ENTITY);
+ vtkUnstructuredGrid* aMesh = anIDMapper->GetUnstructuredGridOutput();
if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) {
MESSAGE( "No cells in the mesh: " << theMeshName );
{
VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
SetField(anInput->GetField(theMeshName,theEntity,theFieldName));
- VISU::PIDMapper anIDMapper = anInput->GetTimeStampOnMesh(theMeshName,
- theEntity,
- theFieldName,
- theIteration);
- TVTKOutput* anOutput = anIDMapper->GetVTKOutput();
+
+ VISU::PUnstructuredGridIDMapper anIDMapper =
+ anInput->GetTimeStampOnMesh(theMeshName,
+ theEntity,
+ theFieldName,
+ theIteration);
+
+ vtkUnstructuredGrid* anOutput = anIDMapper->GetUnstructuredGridOutput();
if(myScalarMapOnDeformedShapePL && anOutput)
myScalarMapOnDeformedShapePL->SetScalars(anOutput);
#include "VISU_ScalarMapAct.h"
#include "VISU_ScalarMapPL.hxx"
+#include "VISU_LookupTable.hxx"
+#include "VISU_ScalarBarActor.hxx"
#include "VISU_Convertor.hxx"
#include "SUIT_ResourceMgr.h"
if(!GetField())
throw std::runtime_error("There is no Field with the parameters !!!");
- VISU::PIDMapper anIDMapper =
+ VISU::PUnstructuredGridIDMapper anIDMapper =
anInput->GetTimeStampOnMesh(GetCMeshName(),GetTEntity(),GetCFieldName(),GetTimeStampNumber());
if(!anIDMapper)
throw std::runtime_error("There is no TimeStamp with the parameters !!!");
- GetSpecificPL()->SetIDMapper(anIDMapper);
+ GetSpecificPL()->SetUnstructuredGridIDMapper(anIDMapper);
if(theIsInitilizePipe){
GetSpecificPL()->Init();
- GetSpecificPL()->Build();
}
// To update scalar range according to the new input
}
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+ if(MYDEBUG) MESSAGE("ScalarMap_i::CreatePipeLine() - "<<thePipeLine);
+ if(!thePipeLine){
+ myScalarMapPL = VISU_ScalarMapPL::New();
+ myScalarMapPL->GetMapper()->SetScalarVisibility(1);
+ }else
+ myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine);
+
+ TSuperClass::CreatePipeLine(myScalarMapPL);
+}
+
//----------------------------------------------------------------------------
void
VISU::ScalarMap_i
#include "VISU_ColoredPrs3d_i.hh"
+class VISU_ScalarMapPL;
namespace VISU
{
VISU::ScalarMap::Orientation
GetBarOrientation();
+ //----------------------------------------------------------------------------
+ VISU_ScalarMapPL*
+ GetSpecificPL() const
+ {
+ return myScalarMapPL;
+ }
+
protected:
//! Redefines VISU_ColoredPrs3d_i::DoSetInput
virtual
void
DoSetInput(bool theIsInitilizePipe, bool theReInit);
+ //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
+ virtual
+ void
+ CreatePipeLine(VISU_PipeLine* thePipeLine);
+
//! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
virtual
bool
virtual
void
UpdateActor(VISU_Actor* theActor);
+
+ private:
+ VISU_ScalarMapPL* myScalarMapPL;
};
}
bool theIsMemoryCheck)
{
try{
- if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theTimeStampNumber,false))
+ if(!VISU::ScalarMap_i::IsPossible(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber, false))
return 0;
VISU::Result_i::TInput* anInput = theResult->GetInput();
- VISU::PIDMapper anIDMapper =
- anInput->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theTimeStampNumber);
- VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
+ VISU::PUnstructuredGridIDMapper anIDMapper =
+ anInput->GetTimeStampOnMesh(theMeshName,
+ VISU::TEntity(theEntity),
+ theFieldName,
+ theTimeStampNumber);
+
+ vtkUnstructuredGrid* aDataSet = anIDMapper->GetUnstructuredGridOutput();
size_t aResult = VISU_StreamLinesPL::IsPossible(aDataSet);
MESSAGE("StreamLines_i::IsPossible - aResult = "<<aResult);
return aResult;
#include "VISU_Convertor.hxx"
#include "VISU_ScalarMapPL.hxx"
+#include "VISU_ScalarBarActor.hxx"
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
: myScalarMap(NULL)
{
if(VISU_Convertor* aConvertor = theConvertor->GetImpl()){
- VISU::PIDMapper anIDMapper =
+ VISU::PUnstructuredGridIDMapper anIDMapper =
aConvertor->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
- VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
- if(aDataSet){
+ if(anIDMapper){
myScalarMap = VISU_ScalarMapPL::New();
- myScalarMap->SetInput(aDataSet);
- myScalarMap->Build();
- myScalarMap->Init();
- myScalarMap->SetSourceRange();
+ myScalarMap->SetUnstructuredGridIDMapper(anIDMapper);
}
}
}
VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
aScalarBar->SetLookupTable(aScalarMap->GetBarTable());
- aScalarMap->Build();
-
myRen->AddActor(anActor);
myRen->AddActor2D(aScalarBar);
myRen->ResetCameraClippingRange();