Back to index

salome-paravis  6.5.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
vtkParaMEDCorbaSource Class Reference

#include <vtkParaMEDCorbaSource.h>

List of all members.

Public Member Functions

 vtkTypeRevisionMacro (vtkParaMEDCorbaSource, vtkAlgorithm)
virtual void PrintSelf (ostream &os, vtkIndent indent)
const char * GetIORCorba ()
void SetIORCorba (char *ior)
void SetBufferingPolicy (int pol)
int GetBufferingPolicy ()

Static Public Member Functions

static ParaMEDMEM2VTK_EXPORT
vtkParaMEDCorbaSource
New ()

Protected Member Functions

 vtkParaMEDCorbaSource ()
virtual ~vtkParaMEDCorbaSource ()
int FillOutputPortInformation (int vtkNotUsed(port), vtkInformation *info)
int ProcessRequest (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual int RequestInformation (vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
virtual int RequestData (vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)

Protected Attributes

int TotalNumberOfPieces
int NumberOfPieces
int UpdatePiece
int GhostLevel
int StartPiece
int EndPiece
int BufferingPolicy
vtkUnstructuredGrid * MyDataSet
vtkstd::vector< char > IOR
ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher * mfieldsFetcher

Static Protected Attributes

static void * Orb = 0

Private Member Functions

 vtkParaMEDCorbaSource (const vtkParaMEDCorbaSource &)
void operator= (const vtkParaMEDCorbaSource &)

Detailed Description

Definition at line 36 of file vtkParaMEDCorbaSource.h.


Constructor & Destructor Documentation

Definition at line 56 of file vtkParaMEDCorbaSource.cxx.

                                            :mfieldsFetcher(0)
{
  this->MyDataSet=0;
  if(!Orb)
    {
      CORBA::ORB_var *OrbC=new CORBA::ORB_var;
      int argc=0;
      *OrbC=CORBA::ORB_init(argc,0);
      this->Orb=OrbC;
    }
  this->SetNumberOfInputPorts(0);
  this->SetNumberOfOutputPorts(1);
}

Definition at line 70 of file vtkParaMEDCorbaSource.cxx.

{
  delete mfieldsFetcher;
}

Member Function Documentation

int vtkParaMEDCorbaSource::FillOutputPortInformation ( int   vtkNotUsedport,
vtkInformation *  info 
) [protected]

Definition at line 134 of file vtkParaMEDCorbaSource.cxx.

{
  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
  return 1;
}

Definition at line 97 of file vtkParaMEDCorbaSource.cxx.

{
  return BufferingPolicy;
}

Definition at line 75 of file vtkParaMEDCorbaSource.cxx.

{
  return &IOR[0];
}

Here is the caller graph for this function:

void vtkParaMEDCorbaSource::operator= ( const vtkParaMEDCorbaSource ) [private]
void vtkParaMEDCorbaSource::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Definition at line 268 of file vtkParaMEDCorbaSource.cxx.

{
  this->Superclass::PrintSelf( os, indent );
  os << "Data: " << this->MyDataSet << "\n";
}
int vtkParaMEDCorbaSource::ProcessRequest ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
) [protected]

Definition at line 118 of file vtkParaMEDCorbaSource.cxx.

{
  // generate the data
  if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))
    {
    return this->RequestData(request, inputVector, outputVector);
    }
  if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))
    {
    return this->RequestInformation(request, inputVector, outputVector);
    }
  return this->Superclass::ProcessRequest(request, inputVector, outputVector);
}

Here is the call graph for this function:

int vtkParaMEDCorbaSource::RequestData ( vtkInformation *  request,
vtkInformationVector **  inInfo,
vtkInformationVector *  outInfo 
) [protected, virtual]

Definition at line 186 of file vtkParaMEDCorbaSource.cxx.

{
  vtkInformation *outInfo=outputVector->GetInformationObject(0);
  //
  this->UpdatePiece = this->GetOutputDataObject(0)->GetUpdatePiece();//emulation vtkUnstructuredGrid::GetUpdateExtent(int&,int&,int&)
  this->NumberOfPieces = this->GetOutputDataObject(0)->GetUpdateNumberOfPieces();//emulation vtkUnstructuredGrid::GetUpdateExtent(int&,int&,int&)
  this->GhostLevel = this->GetOutputDataObject(0)->GetUpdateGhostLevel();//emulation vtkUnstructuredGrid::GetUpdateExtent(int&,int&,int&)
  this->StartPiece=((this->UpdatePiece*this->TotalNumberOfPieces)/this->NumberOfPieces);
  this->EndPiece=(((this->UpdatePiece+1)*this->TotalNumberOfPieces)/this->NumberOfPieces);
  vtkMultiBlockDataSet *ret0=vtkMultiBlockDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
  double *reqTS = 0;
  if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
    reqTS = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS());
  //Client request on ORB.
  CORBA::ORB_var *OrbC=(CORBA::ORB_var *)this->Orb;
  CORBA::Object_var obj=(*OrbC)->string_to_object(&IOR[0]);
  //
  Engines::MPIObject_var objPara=Engines::MPIObject::_narrow(obj);
  if(CORBA::is_nil(objPara))
    {//sequential
       SALOME_MED::MEDCouplingMeshCorbaInterface_var meshPtr=SALOME_MED::MEDCouplingMeshCorbaInterface::_narrow(obj);
       if(!CORBA::is_nil(meshPtr))
         {
           bool dummy;//bug VTK
           vtkDataSet *ret=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(meshPtr,dummy);//bug VTK
           if(!ret)
             return 0;
           ret0->SetBlock(0,ret);
           ret->Delete();
           return 1;
         }
       SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_var fieldPtr=SALOME_MED::MEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
       if(!CORBA::is_nil(fieldPtr))
         {
           std::vector<double> ret2;
           vtkDataSet *ret=ParaMEDMEM2VTK::BuildFullyFilledFromMEDCouplingFieldDoubleInstance(fieldPtr,ret2);
           if(!ret)
             {
               vtkErrorMacro("On single field CORBA fetching an error occurs !");
               return 0;
             }
           ret0->SetBlock(0,ret);
           ret->Delete();
           //
           double timeRange[2];
           timeRange[0]=ret2[0];
           timeRange[1]=ret2[0];
           outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&ret2[0],1);
           outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
           ret0->GetInformation()->Set(vtkDataObject::DATA_TIME_STEPS(), &ret2[0], 1);
           return 1;
         }
       SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var multiPtr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(obj);
       if(!CORBA::is_nil(multiPtr))
         {
           vtkDataSet *ret=mfieldsFetcher->buildDataSetOnTime(reqTS[0]);
           if(!ret)
             {
               vtkErrorMacro("On multi fields CORBA fetching an error occurs !");
               return 0;
             }
           ret0->SetBlock(0,ret);
           ret->Delete();
           ret0->GetInformation()->Set(vtkDataObject::DATA_TIME_STEPS(),reqTS, 1);
           return 1;
         }
       vtkErrorMacro("Unrecognized sequential CORBA reference !");
       return 0;
    }
  else
    {
      SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface_var paraFieldCorba=SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
      if(!CORBA::is_nil(paraFieldCorba))
        {
          ParaMEDMEM2VTK::FillMEDCouplingParaFieldDoubleInstanceFrom(paraFieldCorba,this->StartPiece,this->EndPiece,ret0);
          return 1;
        }
      vtkErrorMacro("Unrecognized parallel CORBA reference !");
      return 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int vtkParaMEDCorbaSource::RequestInformation ( vtkInformation *  request,
vtkInformationVector **  inInfo,
vtkInformationVector *  outInfo 
) [protected, virtual]

Definition at line 140 of file vtkParaMEDCorbaSource.cxx.

{
  vtkInformation* myInfo=outInfo->GetInformationObject(0);
  //myInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkUnstructuredGrid");
  if(!IOR.empty())
    {
      //myInfo->Remove(vtkDataObject::DATA_TYPE_NAME());
      //myInfo->Remove(PORT_REQUIREMENTS_FILLED());
      //myInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkUnstructuredGrid");
      //myInfo->Set(PORT_REQUIREMENTS_FILLED(),1);
      //vtkUnstructuredGrid *tony=vtkUnstructuredGrid::New();
      //tony->SetInformation(myInfo);
      //myInfo->Set(vtkDataObject::DATA_OBJECT(),tony);
      //
      CORBA::ORB_var *OrbC=(CORBA::ORB_var *)this->Orb;
      CORBA::Object_var obj=(*OrbC)->string_to_object(&IOR[0]);
      //
      Engines::MPIObject_ptr objPara=Engines::MPIObject::_narrow(obj);
      if(CORBA::is_nil(objPara))
        {//sequential
         this->TotalNumberOfPieces=1;
         SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var multiPtr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(obj);
          if(!CORBA::is_nil(multiPtr))
           {//Request for multiFields
              delete mfieldsFetcher;
              mfieldsFetcher=new ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher(BufferingPolicy,multiPtr);
              std::vector<double> tsteps=mfieldsFetcher->getTimeStepsForPV();
              double timeRange[2];
              timeRange[0]=tsteps.front();
              timeRange[1]=tsteps.back();
              myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],tsteps.size());
              myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
           }
        }
      else
        {
          Engines::IORTab *iorTab=objPara->tior();
          this->TotalNumberOfPieces=iorTab->length();
          delete iorTab;
          CORBA::release(objPara);
        }
      myInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),this->TotalNumberOfPieces);
    }
  return 1;
}

Here is the caller graph for this function:

Definition at line 92 of file vtkParaMEDCorbaSource.cxx.

{
  BufferingPolicy=pol;
}
void vtkParaMEDCorbaSource::SetIORCorba ( char *  ior)

Definition at line 80 of file vtkParaMEDCorbaSource.cxx.

{
  if(!ior)
    return;
  if(ior[0]=='\0')
    return;
  int length=strlen(ior);
  IOR.resize(length+1);
  vtkstd::copy(ior,ior+length+1,&IOR[0]);
  this->Modified();
}

Member Data Documentation

Definition at line 61 of file vtkParaMEDCorbaSource.h.

Definition at line 60 of file vtkParaMEDCorbaSource.h.

Definition at line 58 of file vtkParaMEDCorbaSource.h.

vtkstd::vector<char> vtkParaMEDCorbaSource::IOR [protected]

Definition at line 63 of file vtkParaMEDCorbaSource.h.

ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher* vtkParaMEDCorbaSource::mfieldsFetcher [protected]

Definition at line 64 of file vtkParaMEDCorbaSource.h.

vtkUnstructuredGrid* vtkParaMEDCorbaSource::MyDataSet [protected]

Definition at line 62 of file vtkParaMEDCorbaSource.h.

Definition at line 56 of file vtkParaMEDCorbaSource.h.

void * vtkParaMEDCorbaSource::Orb = 0 [static, protected]

Definition at line 66 of file vtkParaMEDCorbaSource.h.

Definition at line 59 of file vtkParaMEDCorbaSource.h.

Definition at line 55 of file vtkParaMEDCorbaSource.h.

Definition at line 57 of file vtkParaMEDCorbaSource.h.


The documentation for this class was generated from the following files: