Back to index

salome-med  6.5.0
MEDSPLITTER_JointExchangeData.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 // File      : MEDSPLITTER_JointExchangeData.hxx
00020 // Created   : Wed Jul 22 15:29:44 2009
00021 // Author    : Edward AGAPOV (eap)
00022 
00023 
00024 #ifndef __MEDSPLITTER_JointExchangeData_HXX__
00025 #define __MEDSPLITTER_JointExchangeData_HXX__
00026 
00027 #include "MEDSPLITTER_Topology.hxx"
00028 
00029 #include <map>
00030 #include <vector>
00031 
00032 namespace MEDMEM
00033 {
00034   class MESH;
00035   class CONNECTZONE;
00036   class MEDSKYLINEARRAY;
00037 }
00038 
00039 namespace MEDSPLITTER
00040 {
00046   class JointExchangeData
00047   {
00048   public:
00049 
00050     JointExchangeData();
00051 
00052     // Store cell/cell pair of joint between domains (residing different procs by default)
00053     void addCellCorrespondence(const MEDMEM::MESH* mesh_here,
00054                                int domain_dist, int domain_here,
00055                                int glob_dist, int glob_here,
00056                                int loc_here, int loc_dist = -1 );
00057 
00058     // Return nb of cell pairs
00059     int nbCellPairs() const { return _glob_to_locs_here_and_dist.size(); }
00060 
00061     // Stores meshes and corresponding domain ids
00062     void setMeshes( int domain_dist, const MEDMEM::MESH* mesh_dist,
00063                     int domain_here, const MEDMEM::MESH* mesh_here); 
00064 
00065     // Stores local and global connectivity of joint cells on this proc
00066     void setConnectivity( const int* glob_fused_nodes);
00067 
00068     int distantDomain() const { return _dist_domain; }
00069     int   localDomain() const { return _loc_domain; }
00070 
00071     // Exchanging
00072     int serialize (std::vector<int> & out_data) const;
00073     void deserialize(const std::vector<int> & in_data);
00074 
00076     void setFisrtGlobalIdOfSubentity(int id) { _first_glob_sub_id = id; }
00077 
00078     // Create MEDSKYLINEARRAY describing cell/cell correspondencies of the joint
00079     MEDMEM::MEDSKYLINEARRAY* makeCellCorrespArray() const;
00080 
00081     // Creates CONNECTZONE
00082     MEDMEM::CONNECTZONE* makeConnectZone(TGeom2FacesByDomian& face_map);
00083 
00084   private:
00085 
00086     // map global cell id on of procs to pair of local cell ids: here and distant
00087     typedef std::multimap<int, std::pair< int, int > > TGlob2LocsHD;
00088     TGlob2LocsHD _glob_to_locs_here_and_dist;
00089 
00090     int _dist_domain, _loc_domain, _conn_here_size, _nb_cell_pairs, _first_glob_sub_id;
00091 
00092     const MEDMEM::MESH* _dist_mesh;
00093     const MEDMEM::MESH* _loc_mesh;
00094 
00095     std::vector<int> _global_conn_here, _global_conn_dist;
00096     std::vector<int> _local_conn_here,  _local_conn_dist;
00097 
00098   };
00099 }
00100 #endif