Back to index

salome-med  6.5.0
ParaMEDMEMComponent_i.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __PARAMEDMEMCOMPOCOMPONENT_I__
00021 #define __PARAMEDMEMCOMPOCOMPONENT_I__
00022 
00023 #include "SALOMEconfig.h"
00024 #include CORBA_SERVER_HEADER(ParaMEDMEMComponent)
00025 #include "MPIObject_i.hxx"
00026 #include "SALOME_Component_i.hxx"
00027 #include "Topology.hxx"
00028 #include "MEDCouplingFieldDouble.hxx"
00029 #include "InterpKernelDEC.hxx"
00030 #include "InterpolationOptions.hxx"
00031 #include "MPIProcessorGroup.hxx"
00032 #include "CommInterface.hxx"
00033 #include "MEDCouplingFieldDoubleServant.hxx"
00034 #include "Utils_CorbaException.hxx"
00035 #include <map>
00036 
00037 void * th_setinterpolationoptions(void *st);
00038 void * th_initializecoupling(void *st);
00039 void * th_terminatecoupling(void *st);
00040 void * th_getdata(void *st);
00041 void * th_initializecouplingdist (void *st);
00042 void * th_terminatecouplingdist (void *st);
00043 
00044 typedef struct
00045 {
00046   int ip;
00047   long print_level;
00048   const char * intersection_type;
00049   double precision;
00050   double median_plane;
00051   bool do_rotate;
00052   double bounding_box_adjustment;
00053   double bounding_box_adjustment_abs;
00054   double max_distance_for_3Dsurf_intersect;
00055   long orientation;
00056   bool measure_abs;
00057   const char * splitting_policy;
00058   bool P1P0_bary_method;
00059   std::string coupling;
00060   std::string ior;
00061   Engines::IORTab* tior;
00062   SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr fieldptr;
00063   SALOME_MED::ParaMEDMEMComponent_ptr compo;
00064 } thread_st;
00065 
00066 namespace ParaMEDMEM
00067 {
00068   class ParaMEDMEMComponent_i : public virtual POA_SALOME_MED::ParaMEDMEMComponent, public Engines_Component_i, public MPIObject_i
00069   {
00070 
00071   public:
00072     // Constructor
00073     ParaMEDMEMComponent_i();
00074     ParaMEDMEMComponent_i(CORBA::ORB_ptr orb,
00075                           PortableServer::POA_ptr poa, 
00076                           PortableServer::ObjectId * contId, 
00077                           const char *instanceName,
00078                           const char *interfaceName,
00079                           bool regist);
00080     
00081     // Destructor
00082     virtual ~ParaMEDMEMComponent_i();
00083     void setInterpolationOptions(const char * coupling,
00084                                  CORBA::Long print_level,
00085                                  const char * intersection_type,
00086                                  CORBA::Double precision,
00087                                  CORBA::Double median_plane,
00088                                  CORBA::Boolean do_rotate,
00089                                  CORBA::Double bounding_box_adjustment,
00090                                  CORBA::Double bounding_box_adjustment_abs,
00091                                  CORBA::Double max_distance_for_3Dsurf_intersect,
00092                                  CORBA::Long orientation,
00093                                  CORBA::Boolean measure_abs,
00094                                  const char * splitting_policy,
00095                                  CORBA::Boolean P1P0_bary_method ) throw(SALOME::SALOME_Exception);
00096     virtual void initializeCoupling(const char * coupling, const char * ior) throw(SALOME::SALOME_Exception);
00097     virtual void terminateCoupling(const char * coupling) throw(SALOME::SALOME_Exception);
00098     virtual void _getOutputField(const char * coupling, MEDCouplingFieldDouble* field);
00099     
00100   protected:
00101     void _initializeCoupling(SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr fieldptr);
00102     void _setInputField(SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr fieldptr, MEDCouplingFieldDouble* field);
00103     bool amICoupledWithThisComponent(const char * cref);
00104 
00105   private:
00106     std::map<std::string,std::string>::const_iterator mapSearchByValue(std::map<std::string,std::string> & search_map, std::string search_val);
00107     
00108     CommInterface* _interface;
00109     std::map<std::string,InterpKernelDEC*> _dec;
00110     std::map<std::string,MPIProcessorGroup*> _source, _target;
00111     std::map<std::string,ProcessorGroup*> _commgroup;
00112     std::map<std::string,INTERP_KERNEL::InterpolationOptions*> _dec_options;
00113     std::map<std::string,std::string> _connectto;  //IOR of distant objects
00114   };
00115 }
00116 #endif