Salome HOME
cb5b9a51b98e0b0a1ee329793726ac7a80fa13d9
[modules/med.git] / src / ParaMEDMEMComponent / ParaMEDMEMComponent_i.hxx
1 // Copyright (C) 2007-2024  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __PARAMEDMEMCOMPOCOMPONENT_I__
21 #define __PARAMEDMEMCOMPOCOMPONENT_I__
22
23 #include "SALOMEconfig.h"
24 #include CORBA_SERVER_HEADER(ParaMEDMEMComponent)
25 #include "MPIObject_i.hxx"
26 #include "SALOME_Component_i.hxx"
27 #include "Topology.hxx"
28 #include "MEDCouplingFieldDouble.hxx"
29 #include "InterpKernelDEC.hxx"
30 #include "InterpolationOptions.hxx"
31 #include "MPIProcessorGroup.hxx"
32 #include "CommInterface.hxx"
33 #include "MEDCouplingFieldDoubleServant.hxx"
34 #include "Utils_CorbaException.hxx"
35 #include <map>
36
37 void * th_setinterpolationoptions(void *st);
38 void * th_initializecoupling(void *st);
39 void * th_terminatecoupling(void *st);
40 void * th_getdata(void *st);
41 void * th_initializecouplingdist (void *st);
42 void * th_terminatecouplingdist (void *st);
43
44 typedef struct
45 {
46   int ip;
47   long print_level;
48   const char * intersection_type;
49   double precision;
50   double median_plane;
51   bool do_rotate;
52   double bounding_box_adjustment;
53   double bounding_box_adjustment_abs;
54   double max_distance_for_3Dsurf_intersect;
55   long orientation;
56   bool measure_abs;
57   const char * splitting_policy;
58   std::string coupling;
59   std::string ior;
60   Engines::IORTab* tior;
61   SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr fieldptr;
62   SALOME_MED::ParaMEDMEMComponent_ptr compo;
63 } thread_st;
64
65 namespace MEDCoupling
66 {
67   class ParaMEDMEMComponent_i : public virtual POA_SALOME_MED::ParaMEDMEMComponent, public Engines_Component_i, public MPIObject_i
68   {
69
70   public:
71     // Constructor
72     ParaMEDMEMComponent_i();
73     ParaMEDMEMComponent_i(CORBA::ORB_ptr orb,
74                           PortableServer::POA_ptr poa, 
75                           PortableServer::ObjectId * contId, 
76                           const char *instanceName,
77                           const char *interfaceName,
78                           bool regist);
79     
80     // Destructor
81     virtual ~ParaMEDMEMComponent_i();
82     void setInterpolationOptions(const char * coupling,
83                                  CORBA::Long print_level,
84                                  const char * intersection_type,
85                                  CORBA::Double precision,
86                                  CORBA::Double median_plane,
87                                  CORBA::Boolean do_rotate,
88                                  CORBA::Double bounding_box_adjustment,
89                                  CORBA::Double bounding_box_adjustment_abs,
90                                  CORBA::Double max_distance_for_3Dsurf_intersect,
91                                  CORBA::Long orientation,
92                                  CORBA::Boolean measure_abs,
93                                  const char * splitting_policy );
94     virtual void initializeCoupling(const char * coupling, const char * ior);
95     virtual void terminateCoupling(const char * coupling);
96     virtual void _getOutputField(const char * coupling, MEDCouplingFieldDouble* field);
97     
98   protected:
99     void _initializeCoupling(SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr fieldptr);
100     void _setInputField(SALOME_MED::MPIMEDCouplingFieldDoubleCorbaInterface_ptr fieldptr, MEDCouplingFieldDouble* field);
101     bool amICoupledWithThisComponent(const char * cref);
102
103   private:
104     std::map<std::string,std::string>::const_iterator mapSearchByValue(std::map<std::string,std::string> & search_map, std::string search_val);
105     
106     CommInterface* _interface;
107     std::map<std::string,InterpKernelDEC*> _dec;
108     std::map<std::string,MPIProcessorGroup*> _source, _target;
109     std::map<std::string,ProcessorGroup*> _commgroup;
110     std::map<std::string,INTERP_KERNEL::InterpolationOptions*> _dec_options;
111     std::map<std::string,std::string> _connectto;  //IOR of distant objects
112   };
113 }
114 #endif