// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.hxx
#include "VISU_DeformedShapePL.hxx"
#include "VISU_VectorsPL.hxx"
#include "VISU_StreamLinesPL.hxx"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_Plot3DPL.hxx"
-typedef VISU_StreamLinesPL TPresent;
+typedef VISU_GaussPointsPL TPresent;
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
#include <vtkRenderWindowInteractor.h>
-#include <vtkRenderWindow.h>
+#include <vtkRenderWindow.h>
+#include <vtkImageData.h>
#include <vtkRenderer.h>
#include <vtkCamera.h>
#include <vtkActor.h>
+#include <vtkProperty.h>
+
+#include "utilities.h"
+
using namespace std;
static int isOnlyMesh = false;
-int main(int argc, char** argv){
+int main(int argc, char** argv){
try{
if(argc > 1){
vtkRenderWindow *renWin = vtkRenderWindow::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
VISU_Convertor* aConvertor = CreateConvertor(argv[1]);
+ aConvertor->BuildEntities();
+ aConvertor->BuildFields();
+ aConvertor->BuildMinMax();
const VISU::TMeshMap& aMeshMap = aConvertor->GetMeshMap();
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
if(aMeshMapIter == aMeshMap.end()) return 0;
const string& aMeshName = aMeshMapIter->first;
- const VISU::TMesh& aMesh = aMeshMapIter->second;
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+ const VISU::PMesh aMesh = aMeshMapIter->second;
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
if(isOnlyMesh){
const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
- vtkUnstructuredGrid* aDataSet = aConvertor->GetMeshOnEntity(aMeshName,anEntity);
-
+
+ VISU::PIDMapper anIDMapper =
+ aConvertor->GetMeshOnEntity(aMeshName,anEntity);
+ VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
+
VISU_MeshPL* aPresent = VISU_MeshPL::New();
aPresent->SetInput(aDataSet);
aPresent->Build();
-
+
vtkActor* aActor = vtkActor::New();
aActor->SetMapper(aPresent->GetMapper());
aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME);
//ren->ResetCameraClippingRange();
-
+
ren->AddActor(aActor);
-
+
renWin->Render();
iren->Start();
return 0;
aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
- const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
- const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+ const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+ const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
- const VISU::TField& aField = aFieldMapIter->second;
- if(aField.myNbComp == 1) continue;
+ const VISU::PField aField = aFieldMapIter->second;
+ /*
+ if(aField->myNbComp == 1)
+ continue;
+ */
const string& aFieldName = aFieldMapIter->first;
- const VISU::TField::TValField& aValField = aField.myValField;
- VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+ const VISU::TValField& aValField = aField->myValField;
+ VISU::TValField::const_iterator aValFieldIter = aValField.begin();
if(aValFieldIter == aValField.end()) return 0;
int aTimeStamp = aValFieldIter->first;
- vtkUnstructuredGrid* aDataSet = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-
+
TPresent* aPresent = TPresent::New();
- aPresent->SetInput(aDataSet);
+ VISU::PIDMapper anIDMapper;
+ if(anEntity != VISU::NODE_ENTITY){
+ VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
+ aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+ }else{
+ continue;
+ VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+ aPresent->SetIDMapper(anIDMapper);
+ }
+
aPresent->Build();
aPresent->Init();
- //aPresent->SetPartDefault(0);
- //aPresent->SetScalarMin(0.01);
- //aPresent->SetScaling(VTK_SCALE_LOG10);
+
+ char aMainTexture[80];
+ strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+ strcat( aMainTexture, "/share/salome/resources/sprite_texture.vti" );
+ //cout << aMainTexture << endl;
+
+ char anAlphaTexture[80];
+ strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+ strcat( anAlphaTexture, "/share/salome/resources/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());
-
+
VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New();
aScalarBar->SetLookupTable(aPresent->GetBarTable());
- aPresent->Build();
-
ren->AddActor(anActor);
ren->AddActor2D(aScalarBar);
- ren->ResetCameraClippingRange();
-
+
renWin->Render();
+ ren->ResetCamera();
+
iren->Start();
return 0;
}
}
}
- }catch(std::runtime_error& exc){
- cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
+ }catch(std::exception& exc){
+ MESSAGE("Follow exception was occured :\n"<<exc.what());
}catch(...){
- cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
- }
+ MESSAGE("Unknown exception was occured in VISU_Convertor_impl");
+ }
return 1;
}