TCONTAINER, /*!< Container object used for storing a set of curve lines */
TMESH, /*!< Meshing object */
TSCALARMAP, /*!< Scalarmap 3D presentation object */
+ TELNOSCALARMAP, /*!< 3D Scalarmap by points presentation object */
TISOSURFACES, /*!< Iso surface 3D presentation object */
TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
TSCALARMAPONDEFORMEDSHAPE, /*!< Scalar map on deformed shape 3D presentation object */
};
+ //-------------------------------------------------------
+ /*! \brief Elno Scalar Map presentation interface
+ *
+ * This interface is responsable for coloring of 3D field presentations
+ * according the scalar values applied to different points of cells.
+ */
+ //-------------------------------------------------------
+
+ interface ElnoScalarMap : ColoredPrs3d, ScaledPrs3d {
+
+ };
+
//-------------------------------------------------------
/*! \brief Gauss Points presentation interface
*
VISU_ScalarMapOnDeformedShapePL.hxx \
VISU_OpenGLElnoMapper.hxx \
VISUPipeline.hxx \
- VISU_ElnoGeometryFilter.hxx
+ VISU_ElnoGeometryFilter.hxx \
+ VISU_ElnoMapperHolder.hxx \
+ VISU_ElnoScalarMapPL.hxx
dist_libVisuPipeLine_la_SOURCES= \
VISU_MapperHolder.cxx \
VISU_ScalarBarCtrl.cxx \
VISU_ScalarMapOnDeformedShapePL.cxx \
VISU_OpenGLElnoMapper.cxx \
- VISU_ElnoGeometryFilter.cxx
+ VISU_ElnoGeometryFilter.cxx \
+ VISU_ElnoMapperHolder.cxx \
+ VISU_ElnoScalarMapPL.cxx
libVisuPipeLine_la_CPPFLAGS= \
aMapper->SetInput( aGeometryFilter->GetOutput() );
- double* range = aGeometryFilter->GetRange();
-
VISU_LookupTable* aMapperTable( VISU_LookupTable::New() );
aMapperTable->SetHueRange(0.667, 0.0);
aMapperTable->SetRange( aGeometryFilter->GetRange() );
}
//----------------------------------------------------------------------------------------------
template<typename TValueType>
-void CopyArray(TValueType *outputPtr, TValueType* inputPtr,const vtkIdType& theDataSize){
+void BuildMinMax(TValueType* inputPtr, double *outres, const vtkIdType& theDataSize){
+ double s;
+ outres[0] = static_cast<double>(*inputPtr); //Min
+ outres[1] = static_cast<double>(*inputPtr); //Max
for(vtkIdType iData =0;iData < theDataSize;iData++){
- *outputPtr = *inputPtr;
- outputPtr++;inputPtr++;
- }
+ s = static_cast<double>(*inputPtr);
+ if(s < outres[0]){
+ outres[0] = s;
+ }
+ else if(s > outres[1])
+ {
+ outres[1] = s;
+ }
+ inputPtr++;
+ }
}
//----------------------------------------------------------------------------------------------
void VISU_ElnoGeometryFilter::UnstructuredGridExecute(vtkDataSet *dataSetInput,
return;
}
- //Create data array
- vtkDataArray * aElnoScalars = vtkDataArray::CreateDataArray(myElnoData->GetDataType());
-
vtkIdType cellId;
int i;
int allVisible;
Polys->Allocate(numCells/4+1,numCells);
Strips = vtkCellArray::New();
Strips->Allocate(numCells/4+1,numCells);
+
// Loop over the cells determining what's visible
if (!allVisible)
// Loop over all cells now that visibility is known
// (Have to compute visibility first for 3D cell boundarys)
int progressInterval = numCells/20 + 1;
+ int info[2];
+ this->GetInfoOnVisibleElements(Connectivity,input,
+ allVisible,
+ cellVis,
+ cellGhostLevels,
+ updateLevel,
+ info);
+ int aNbVisibleCells = info[0];
+ int aNbVisiblePointsOnCells = info[1];
+
- vtkDataArray *aTmpElnoComponents = vtkDataArray::CreateDataArray(myElnoData->GetDataType());
- aTmpElnoComponents->SetNumberOfComponents(1);
+ //Re-create "ELNO_FIELD"
+ vtkDataArray *aElnoVectors = vtkDataArray::CreateDataArray(myElnoData->GetDataType());
+ int aNbElnoComponents = VISU_ElnoGeometryFilter::GetNbOfElnoComponents(cd);
+ int aNbEffectiveVectorComponents = (aNbVisiblePointsOnCells*aNbElnoComponents/aNbVisibleCells) + 1;
+ aElnoVectors->SetNumberOfComponents(aNbEffectiveVectorComponents);
+ aElnoVectors->SetNumberOfTuples(aNbVisibleCells);
+ aElnoVectors->SetName("ELNO_FIELD");
- vtkDataArray *aTmpElnoScalars = vtkDataArray::CreateDataArray(myElnoData->GetDataType());
- aTmpElnoScalars->SetNumberOfComponents(1);
+ vtkDataArray *aElnoScalars = vtkDataArray::CreateDataArray(myElnoData->GetDataType());
+ int aNbEffectiveScalarsComponents = (aNbVisiblePointsOnCells/aNbVisibleCells) + 1;
+ aElnoScalars->SetNumberOfComponents(aNbEffectiveScalarsComponents);
+ aElnoScalars->SetNumberOfTuples(aNbVisibleCells);
+ aElnoScalars->SetName("ELNO_PSEUDO_SCALARS");
+
+ vtkIntArray *aElnoMapper = vtkIntArray::New();
+ aElnoMapper->SetNumberOfTuples(aNbVisibleCells);
+ aElnoMapper->SetNumberOfComponents(3);
+ aElnoMapper->SetName("ELNO_COMPONENT_MAPPER");
+
vtkIdType aPosition = 0;
for (cellId=0, Connectivity->InitTraversal();
newCellId = Polys->InsertNextCell(npts,pts);
outputCD->CopyData(cd,cellId,newCellId);
- //Copy Elno Data
- this->GetElementData(cellId, aComponents);
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition);
+ //Copy Elno Data
+ this->GetElementData(cellId, aComponents);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition);
+ this->WriteElnoMapperInfo(aElnoMapper,npts,aNbElnoComponents,newCellId);
break;
case VTK_TRIANGLE_STRIP:
{
Polys->InsertCellPoint(pts[PixelConvert[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,PixelConvert[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,PixelConvert[i]);
}
+ this->WriteElnoMapperInfo(aElnoMapper,npts,aNbElnoComponents,newCellId);
outputCD->CopyData(cd,cellId,newCellId);
break;
{
Polys->InsertCellPoint(pts[faceVerts[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[i]);
}
outputCD->CopyData(cd,cellId,newCellId);
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
}
}
break;
{
Polys->InsertCellPoint(pts[faceVerts[PixelConvert[i]]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[PixelConvert[i]]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[PixelConvert[i]]);
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
}
outputCD->CopyData(cd,cellId,newCellId);
}
{
Polys->InsertCellPoint(pts[faceVerts[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[i]);
}
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
{
Polys->InsertCellPoint(pts[faceVerts[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[i]);
}
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
{
Polys->InsertCellPoint(pts[faceVerts[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[i]);
}
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
{
Polys->InsertCellPoint(pts[faceVerts[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[i]);
}
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
{
Polys->InsertCellPoint(pts[faceVerts[i]]);
//Copy Elno Data
- this->CopyElementData(aTmpElnoComponents,aTmpElnoScalars,aComponents,aPosition,faceVerts[i]);
+ this->CopyElementData(aElnoVectors,aElnoScalars,aComponents,aPosition,faceVerts[i]);
}
+ this->WriteElnoMapperInfo(aElnoMapper,numFacePts,aNbElnoComponents,newCellId);
outputCD->CopyData(cd,cellId,newCellId);
}
}
output->SetStrips(Strips);
Strips->Delete();
-
- myMinMax[0] = *(aTmpElnoScalars->GetTuple(0));
- myMinMax[1] = *(aTmpElnoScalars->GetTuple(0));
-
- //Build Min and Max
- for(vtkIdType count = 0;count < aTmpElnoScalars->GetSize();count++){
- double s = *(aTmpElnoScalars->GetTuple(count));
- if(s < myMinMax[0]){
- myMinMax[0] = s;
- }
- else if(s > myMinMax[1])
- {
- myMinMax[1] = s;
- }
- }
-
- vtkIdType aNbEffectiveComponents = (aTmpElnoScalars->GetSize()/output->GetNumberOfCells())+1;
-
- vtkDataArray *aElnoPseudoScalars = vtkDataArray::CreateDataArray(this->myElnoData->GetDataType());
- aElnoPseudoScalars->SetName("ELNO_PSEUDO_SCALARS");
- aElnoPseudoScalars->SetNumberOfTuples(aTmpElnoComponents->GetSize());
- aElnoPseudoScalars->SetNumberOfComponents(1);
-
-
- switch(this->myElnoData->GetDataType()){
-
- vtkTemplateMacro3(CopyArray,
- static_cast<VTK_TT*>(aElnoPseudoScalars->GetVoidPointer(0)),
- static_cast<VTK_TT*>(aTmpElnoScalars->GetVoidPointer(0)),
- aTmpElnoScalars->GetSize());
- default:
- break;
+ //Compute Min and Max
+ switch(myElnoData->GetDataType()){
+ vtkTemplateMacro3(BuildMinMax,
+ static_cast<VTK_TT*>(aElnoScalars->GetVoidPointer(0)),
+ this->myMinMax,
+ aNbVisiblePointsOnCells);
+ default:
+ break;
}
-
- output->GetCellData()->AddArray(aElnoPseudoScalars);
+
+ output->GetCellData()->AddArray(aElnoScalars);
+ output->GetCellData()->AddArray(aElnoMapper);
output->Squeeze();
- aElnoPseudoScalars->Delete();
-
- aTmpElnoComponents->Delete();
+ aElnoScalars->Delete();
+ aElnoVectors->Delete();
+ aElnoMapper->Delete();
vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points,"
<< output->GetNumberOfCells() << " cells.");
{
//Optimize needed
vtkIdType aNbComponents = from->GetNumberOfComponents();
-
- vtkDataArray *tmpComponents = vtkDataArray::CreateDataArray(this->myElnoData->GetDataType());
- tmpComponents->SetNumberOfTuples(toComponents->GetNumberOfTuples());
- tmpComponents->DeepCopy(toComponents);
-
- vtkDataArray *tmpScalars = vtkDataArray::CreateDataArray(this->myElnoData->GetDataType());
- tmpScalars->SetNumberOfTuples(toScalars->GetNumberOfTuples());
- tmpScalars->DeepCopy(toScalars);
vtkIdType aDataSize = 0;
void *inputPtr = NULL;
-
-
+
if(PntId == -2){
aDataSize = from->GetNumberOfTuples();
inputPtr = from->GetVoidPointer(0);
inputPtr = from->GetVoidPointer(PntId*aNbComponents);
}
- toComponents->Allocate(position*aNbComponents + aDataSize*aNbComponents);
- toScalars->Allocate(position+aDataSize);
-
- switch(this->myElnoData->GetDataType()){
- vtkTemplateMacro4(CopyArray1,
- static_cast<VTK_TT*>(tmpComponents->GetVoidPointer(0)),
- static_cast<VTK_TT*>(toComponents->GetVoidPointer(0)),
- position*aNbComponents,
- 1);
- default:
- break;
- }
-
- switch(this->myElnoData->GetDataType()){
- vtkTemplateMacro4(CopyArray1,
- static_cast<VTK_TT*>(tmpScalars->GetVoidPointer(0)),
- static_cast<VTK_TT*>(toScalars->GetVoidPointer(0)),
- position,
- 1);
- default:
- break;
- }
-
- //Optimize needed
-
//Fill Elno Field
void *outputComponentsPtr = toComponents->GetVoidPointer(position*aNbComponents);
switch(this->myElnoData->GetDataType()){
break;
}
-
-
//Fill Scalars array
void *outputScalarasPtr = toScalars->GetVoidPointer(position);
if( !myScalarMode ) {
}
}
position+=aDataSize;
- tmpComponents->Delete();
- tmpScalars->Delete();
}
//----------------------------------------------------------------------------------------------
return -1;
}
//----------------------------------------------------------------------------------------------
+
+void VISU_ElnoGeometryFilter::WriteElnoMapperInfo(vtkIntArray *theMapperArray,
+ const vtkIdType &theNbPoints,
+ const vtkIdType &theNbComponents,
+ const vtkIdType &theCellId){
+ int aCellInfo[3] = {0,theNbComponents,theNbPoints};
+ if(theCellId){
+ int aPrevCellInfo[3];
+ theMapperArray->GetTupleValue(theCellId - 1, aPrevCellInfo);
+ aCellInfo[0] = aPrevCellInfo[1]*aPrevCellInfo[2]+aPrevCellInfo[0];
+ }
+
+ theMapperArray->InsertTupleValue(theCellId,aCellInfo);
+}
+
+//----------------------------------------------------------------------------------------------
+
+void VISU_ElnoGeometryFilter::GetInfoOnVisibleElements(vtkCellArray *Connectivity,
+ vtkUnstructuredGrid *input,
+ const bool allVisible,
+ const char *cellVis,
+ const unsigned char *cellGhostLevels,
+ const unsigned char updateLevel,
+ int *outres){
+
+ vtkIdType npts = 0;
+ vtkIdType *pts = 0;
+ vtkIdList *faceIds = vtkIdList::New();
+ vtkIdList *cellIds = vtkIdList::New();
+ int faceId, *faceVerts, numFacePts;
+ vtkIdType cellId;
+
+ vtkIdType aNbVisibleCells = 0;
+ vtkIdType aNbPointOnVisibleCells = 0;
+
+ for (cellId=0, Connectivity->InitTraversal();
+ Connectivity->GetNextCell(npts,pts);
+ cellId++)
+ {
+
+ // Handle ghost cells here. Another option was used cellVis array.
+ if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel)
+ { // Do not create surfaces in outer ghost cells.
+ continue;
+ }
+
+ if (allVisible || cellVis[cellId]) //now if visible extract geometry
+ {
+ //special code for nonlinear cells - rarely occurs, so right now it
+ //is slow.
+ //Create temporary data array
+ switch (input->GetCellType(cellId))
+ {
+ case VTK_EMPTY_CELL:
+ break;
+
+ case VTK_VERTEX:
+ case VTK_POLY_VERTEX:
+ break;
+
+ case VTK_LINE:
+ case VTK_POLY_LINE:
+ break;
+
+ case VTK_TRIANGLE:
+ case VTK_QUAD:
+ case VTK_POLYGON:
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=npts;
+ break;
+
+ case VTK_TRIANGLE_STRIP:
+ break;
+
+ case VTK_PIXEL:
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=npts;
+ break;
+
+ case VTK_TETRA:
+ //Get Elno Data
+ for (faceId = 0; faceId < 4; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkTetra::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ numFacePts = 3;
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ case VTK_VOXEL:
+ for (faceId = 0; faceId < 6; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkVoxel::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ numFacePts = 4;
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ case VTK_HEXAHEDRON:
+ for (faceId = 0; faceId < 6; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkHexahedron::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ numFacePts = 4;
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ case VTK_WEDGE:
+ for (faceId = 0; faceId < 5; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkWedge::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ numFacePts = 3;
+ if (faceVerts[3] >= 0)
+ {
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ numFacePts = 4;
+ }
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ case VTK_PYRAMID:
+ for (faceId = 0; faceId < 5; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkPyramid::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ numFacePts = 3;
+ if (faceVerts[3] >= 0)
+ {
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ numFacePts = 4;
+ }
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ case VTK_PENTAGONAL_PRISM:
+ for (faceId = 0; faceId < 7; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkPentagonalPrism::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ numFacePts = 4;
+ if (faceVerts[4] >= 0)
+ {
+ faceIds->InsertNextId(pts[faceVerts[4]]);
+ numFacePts = 5;
+ }
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ case VTK_HEXAGONAL_PRISM:
+ for (faceId = 0; faceId < 8; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkHexagonalPrism::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ numFacePts = 4;
+ if (faceVerts[4] >= 0)
+ {
+ faceIds->InsertNextId(pts[faceVerts[4]]);
+ faceIds->InsertNextId(pts[faceVerts[5]]);
+ numFacePts = 6;
+ }
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ aNbVisibleCells+=1;
+ aNbPointOnVisibleCells+=numFacePts;
+ }
+ }
+ break;
+
+ //Quadratic cells
+ case VTK_QUADRATIC_EDGE:
+ case VTK_QUADRATIC_TRIANGLE:
+ case VTK_QUADRATIC_QUAD:
+ case VTK_QUADRATIC_TETRA:
+ case VTK_QUADRATIC_HEXAHEDRON:
+ case VTK_QUADRATIC_WEDGE:
+ case VTK_QUADRATIC_PYRAMID:
+ break;
+
+ } //switch
+ } //if visible
+ }
+
+ outres[0] = aNbVisibleCells;
+ outres[1] = aNbPointOnVisibleCells;
+}
#include <vtkGeometryFilter.h>
+class vtkUnstructuredGrid;
+
class VISU_ElnoGeometryFilter : public vtkGeometryFilter {
public:
vtkIdType& position,
const vtkIdType& PntId = -2 ) const;
+ void GetInfoOnVisibleElements(vtkCellArray *Connectivity,
+ vtkUnstructuredGrid *input,
+ const bool allVisible,
+ const char *cellVis,
+ const unsigned char *cellGhostLevels,
+ const unsigned char updateLevel,
+ int* outres);
+
+ void WriteElnoMapperInfo(vtkIntArray *theMapperArray,
+ const vtkIdType &theNbPoints,
+ const vtkIdType &theNbComponents,
+ const vtkIdType &theCellId);
+
private:
double myMinMax[2]; // myMinMax[0] - Min
// myMinMax[1] - Max
--- /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: VISU_ElnoMapperHolder.cxx
+// Author: Roman NIKOLAEV
+// Module : VISU
+
+
+#include "VISU_ElnoMapperHolder.hxx"
+#include "VISU_OpenGLElnoMapper.hxx"
+#include "VISU_ElnoGeometryFilter.hxx"
+#include "VISU_PipeLineUtils.hxx"
+#include "VISU_LookupTable.hxx"
+
+#include <vtkPlane.h>
+#include <vtkObjectFactory.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkImplicitFunction.h>
+#include <vtkImplicitFunctionCollection.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_ElnoMapperHolder);
+
+
+//----------------------------------------------------------------------------
+VISU_ElnoMapperHolder
+::VISU_ElnoMapperHolder() :
+ myPolyDataFilter(VISU_ElnoGeometryFilter::New())
+{
+}
+
+
+//----------------------------------------------------------------------------
+VISU_ElnoMapperHolder
+::~VISU_ElnoMapperHolder()
+{
+}
+
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_ElnoMapperHolder::GetMemorySize(){
+ unsigned long int aSize = Superclass::GetMemorySize();
+
+ if(myPolyDataFilter->GetInput())
+ if(vtkDataSet* aDataSet = myPolyDataFilter->GetOutput())
+ aSize = aDataSet->GetActualMemorySize() * 1024;
+ return aSize;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ElnoMapperHolder::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
+{
+ myPolyDataFilter->SetInput(theIDMapper->GetUnstructuredGridOutput());
+ myUnstructuredGridIDMapper = theIDMapper;
+ SetIDMapper(theIDMapper);
+}
+
+const VISU::PUnstructuredGridIDMapper&
+VISU_ElnoMapperHolder::GetUnstructuredGridIDMapper()
+{
+ return myUnstructuredGridIDMapper;
+}
+
+//----------------------------------------------------------------------------
+vtkPointSet* VISU_ElnoMapperHolder::GetClippedInput()
+{
+ if(myPolyDataFilter->GetInput())
+ myPolyDataFilter->Update();
+ return myPolyDataFilter->GetOutput();
+}
+
+//----------------------------------------------------------------------------
+void VISU_ElnoMapperHolder::OnCreateMapper(){
+
+ myElnoMapper = VISU_OpenGLElnoMapper::New();
+ myElnoMapper->Delete();
+ SetMapper(myElnoMapper.GetPointer());
+}
+
+//----------------------------------------------------------------------------
+void VISU_ElnoMapperHolder::SetExtractInside(bool theMode){
+ //temporary it is stub
+}
+
+void VISU_ElnoMapperHolder::SetExtractBoundaryCells(bool theMode){
+ //temporary it is stub
+}
+
+//----------------------------------------------------------------------------
+void VISU_ElnoMapperHolder::SetLookupTable(VISU_LookupTable* theLookupTable){
+ myElnoMapper->SetLookupTable(theLookupTable);
+}
+
+
+//----------------------------------------------------------------------------
+bool VISU_ElnoMapperHolder::AddClippingPlane(vtkPlane* thePlane)
+{
+ /*if (thePlane) {
+ if (vtkImplicitBoolean* aBoolean = myPolyDataFilter->GetImplicitBoolean()) {
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->AddItem(thePlane);
+ vtkDataSet* aClippedDataSet = GetClippedInput();
+ if(aClippedDataSet->GetNumberOfCells() < 1)
+ return false;
+ }
+ }
+ return true;
+ */
+ //temporary it is stub
+ return false;
+}
+
+//----------------------------------------------------------------------------
+vtkPlane* VISU_ElnoMapperHolder::GetClippingPlane(vtkIdType theID){
+ vtkPlane* aPlane = NULL;
+ //temporary it is stub
+ return aPlane;
+}
+
+//----------------------------------------------------------------------------
+void VISU_ElnoMapperHolder::RemoveAllClippingPlanes(){
+ //temporary it is stub
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType VISU_ElnoMapperHolder::GetNumberOfClippingPlanes(){
+ //temporary it is stub
+ return 0;
+}
+
+
+//----------------------------------------------------------------------------
+vtkImplicitFunction* VISU_ElnoMapperHolder::GetImplicitFunction()
+{
+ //temporary it is stub
+ return NULL;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU_ElnoMapperHolder::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+ //temporary it is stub
+}
--- /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: VISU_ElnoMapperHolder.hxx
+// Author: Roman NIKOLAEV
+// Module : VISU
+
+#ifndef VISU_ElnoMapperHolder_HeaderFile
+#define VISU_ElnoMapperHolder_HeaderFile
+
+#include "VISU_MapperHolder.hxx"
+
+class vtkUnstructuredGrid;
+class VISU_OpenGLElnoMapper;
+class VISU_ElnoGeometryFilter;
+
+class VISU_ElnoMapperHolder : public VISU_MapperHolder
+{
+public:
+ vtkTypeMacro(VISU_ElnoMapperHolder, VISU_MapperHolder);
+
+ static
+ VISU_ElnoMapperHolder*
+ 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
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+ virtual
+ vtkImplicitFunction*
+ GetImplicitFunction();
+
+ //----------------------------------------------------------------------------
+ // Clipping planes
+ virtual
+ void
+ RemoveAllClippingPlanes();
+
+ virtual
+ vtkIdType
+ GetNumberOfClippingPlanes();
+
+ virtual
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ vtkPlane*
+ GetClippingPlane(vtkIdType theID);
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetLookupTable(VISU_LookupTable* theLookupTable);
+
+ virtual
+ vtkPointSet*
+ GetClippedInput();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ SetExtractInside(bool theMode);
+
+ virtual
+ void
+ SetExtractBoundaryCells(bool theMode);
+
+
+
+protected:
+ //----------------------------------------------------------------------------
+ VISU_ElnoMapperHolder();
+ VISU_ElnoMapperHolder(const VISU_ElnoMapperHolder&);
+
+ virtual
+ ~VISU_ElnoMapperHolder();
+
+ //----------------------------------------------------------------------------
+ virtual
+ void
+ OnCreateMapper();
+
+private:
+ //----------------------------------------------------------------------------
+ VISU::PUnstructuredGridIDMapper myUnstructuredGridIDMapper;
+ vtkSmartPointer<VISU_OpenGLElnoMapper> myElnoMapper;
+ vtkSmartPointer<VISU_ElnoGeometryFilter> myPolyDataFilter;
+};
+
+#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: VISU_ElnoScalarMapPL.cxx
+// Author: Roman NIKOLAEV
+// Module : VISU
+
+
+#include "VISU_ElnoScalarMapPL.hxx"
+#include "VISU_ElnoMapperHolder.hxx"
+
+
+#include <vtkObjectFactory.h>
+#include <vtkPolyData.h>
+#include <vtkMapper.h>
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_ElnoScalarMapPL);
+
+
+//----------------------------------------------------------------------------
+//Constructor
+VISU_ElnoScalarMapPL::VISU_ElnoScalarMapPL(){
+ SetIsShrinkable(true);
+}
+
+//----------------------------------------------------------------------------
+VISU_ElnoScalarMapPL::~VISU_ElnoScalarMapPL()
+{}
+
+//----------------------------------------------------------------------------
+unsigned long int VISU_ElnoScalarMapPL::GetMTime(){
+
+ unsigned long int aTime = Superclass::GetMTime();
+ return aTime;
+}
+
+
+//----------------------------------------------------------------------------
+void VISU_ElnoScalarMapPL::OnCreateMapperHolder(){
+
+ myElnoMapperHolder = VISU_ElnoMapperHolder::New();
+ myElnoMapperHolder->Delete();
+ SetMapperHolder(myElnoMapperHolder.GetPointer());
+}
+
+//----------------------------------------------------------------------------
+void VISU_ElnoScalarMapPL::Build()
+{
+
+ GetMapperHolder()->SetLookupTable(GetMapperTable());
+ GetMapper()->SetUseLookupTableScalarRange(true);
+ GetMapper()->SetColorModeToMapScalars();
+ GetMapper()->ScalarVisibilityOn();
+}
--- /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: VISU_ElnoScalarMapPL.hxx
+// Author: Roman NIKOLAEV
+// Module : VISU
+
+#ifndef VISU_ElnoScalarMapPL_HeaderFile
+#define VISU_ElnoScalarMapPL_HeaderFile
+
+#include "VISUPipeline.hxx"
+#include "VISU_ColoredPL.hxx"
+
+class VISU_ElnoMapperHolder;
+
+class VISU_PIPELINE_EXPORT VISU_ElnoScalarMapPL : public VISU_ColoredPL
+{
+public:
+ vtkTypeMacro(VISU_ElnoScalarMapPL, VISU_ColoredPL);
+
+ static
+ VISU_ElnoScalarMapPL* New();
+
+ //----------------------------------------------------------------------------
+ virtual unsigned long int GetMTime();
+
+protected:
+
+ //----------------------------------------------------------------------------
+ VISU_ElnoScalarMapPL();
+
+ virtual ~VISU_ElnoScalarMapPL();
+
+ //----------------------------------------------------------------------------
+ virtual void Build();
+
+ //----------------------------------------------------------------------------
+ virtual void OnCreateMapperHolder();
+
+private:
+ vtkSmartPointer<VISU_ElnoMapperHolder> myElnoMapperHolder;
+
+
+private:
+ VISU_ElnoScalarMapPL(const VISU_ElnoScalarMapPL&); // Not implemented.
+ void operator=(const VISU_ElnoScalarMapPL&); // Not implemented.
+
+};
+
+
+#endif
#include "VISU_OpenGLElnoMapper.hxx"
+#include "VISU_ElnoGeometryFilter.hxx"
#include "vtkCellArray.h"
#include "vtkCellData.h"
//-----------------------------------------------------------------------------
-/*template<typename TValueType>
+template<typename TValueType>
void CopyArray(TValueType* input,TValueType* output,vtkIdType theNbElem){
for(vtkIdType iTuple = 0; iTuple < theNbElem ; iTuple++){
}
}
-vtkDataArray* VISU_OpenGLElnoMapper::GetElnoScalars(int cellFlag){
+vtkDataArray* VISU_OpenGLElnoMapper::GetElnoScalars(){
- vtkDataArray *scalars = vtkAbstractMapper::
- GetScalars(this->GetInput(), this->ScalarMode, this->ArrayAccessMode,
- this->ArrayId, this->ArrayName, cellFlag);
+ vtkDataArray *scalars = this->GetInput()->GetCellData()->GetArray("ELNO_PSEUDO_SCALARS");
+ if(!scalars)
+ return NULL;
+
vtkIdType anInputDataType = scalars->GetDataType();
vtkDataArray *elnoScalars = vtkDataArray::CreateDataArray(anInputDataType);
- vtkIdType aNbElnoTuples = VISU_ElnoExtractor::GetNbOfElnoTuples(this->GetInput()->GetCellData());
+ vtkIdType aNbElnoTuples = VISU_ElnoGeometryFilter::GetNbOfElnoTuples(this->GetInput()->GetCellData());
elnoScalars->SetNumberOfComponents(1);
elnoScalars->SetNumberOfTuples(aNbElnoTuples);
}
return elnoScalars;
- }*/
+}
vtkUnsignedCharArray *VISU_OpenGLElnoMapper::MapScalars(double alpha)
{
int cellFlag = 0;
- vtkDataArray *scalars = this->GetInput()->GetCellData()->GetArray("ELNO_PSEUDO_SCALARS");
+ vtkDataArray *scalars = this->GetElnoScalars();
if(!scalars)
return NULL;
// This is for a legacy feature: selection of the array component to color by
int ListId;
vtkOpenGLTexture* InternalColorTexture;
- // vtkDataArray* GetElnoScalars(int cellFlag);
+ vtkDataArray* GetElnoScalars();
vtkUnsignedCharArray* MapScalars(double alpha);
+
/*private:
}
+void VisuGUI::OnCreateElnoScalarMap()
+{
+
+}
+
void
VisuGUI
::OnCreateDeformedShape()
tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
this, SLOT(OnCreateScalarMap()));
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ELNO_SCALARMAP"));
+ createAction( VISU_ELNO_SCALARMAP, tr("MEN_ELNO_SCALARMAP"),QIconSet(aPixmap),
+ tr("MEN_ELNO_SCALARMAP"), "", 0, aParent, false,
+ this, SLOT(OnCreateElnoScararMap()));
+
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
void OnCreateMesh();
void OnCreateScalarMap();
+ void OnCreateElnoScalarMap();
void OnCreateDeformedShape();
void OnCreateVectors();
void OnCreateIsoSurfaces();
#define VISU_PLOT2D 4018
#define VISU_PLOT_3D 4019
#define VISU_SCALAR_MAP_ON_DEFORMED_SHAPE 40110
+#define VISU_ELNO_SCALARMAP 40111
//#define VISU_DELETE 4021
#define VISU_DELETE_OBJS 4022
#define VISU_EDIT_STREAMLINES 40626
#define VISU_EDIT_PLOT3D 40627
#define VISU_EDIT_SCALARMAPONDEFORMEDSHAPE 40628
+#define VISU_EDIT_ELNOSCALAR_MAP 40629
#define VISU_EDIT_PRS 4062
#define VISU_CREATE_TABLE 4063