Back to index

salome-med  6.5.0
DisjointDEC.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 __DISJOINTDEC_HXX__
00021 #define __DISJOINTDEC_HXX__
00022 
00023 #include "MEDCouplingFieldDouble.hxx"
00024 #include "NormalizedUnstructuredMesh.hxx"
00025 #include "DEC.hxx"
00026 
00027 #include <mpi.h>
00028 #include <set>
00029 
00030 namespace ICoCo
00031 {
00032   class Field;
00033 }
00034 
00035 namespace ParaMEDMEM
00036 {
00037   class ProcessorGroup;
00038   class ParaFIELD;
00039   
00040   class DisjointDEC : public DEC
00041   {
00042   public:
00043     DisjointDEC():_local_field(0),_union_group(0),_source_group(0),_target_group(0),_owns_field(false),_owns_groups(false),_icoco_field(0) { }
00044     DisjointDEC(ProcessorGroup& source_group, ProcessorGroup& target_group);
00045     DisjointDEC(const DisjointDEC&);
00046     DisjointDEC &operator=(const DisjointDEC& s);
00047     DisjointDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids,
00048                 const MPI_Comm& world_comm=MPI_COMM_WORLD);
00049     void setNature(NatureOfField nature);
00050     void attachLocalField( MEDCouplingFieldDouble* field);
00051     void attachLocalField(const ParaFIELD* field, bool ownPt=false);
00052     void attachLocalField(const ICoCo::Field* field);
00053     
00054     virtual void prepareSourceDE() = 0;
00055     virtual void prepareTargetDE() = 0;
00056     virtual void recvData() = 0;
00057     virtual void sendData() = 0;
00058     void sendRecvData(bool way=true);
00059     virtual void synchronize() = 0;
00060     virtual ~DisjointDEC();
00061     virtual void computeProcGroup() { }
00062     void renormalizeTargetField(bool isWAbs);
00063     //
00064     ProcessorGroup *getSourceGrp() const { return _source_group; }
00065     ProcessorGroup *getTargetGrp() const { return _target_group; }
00066     bool isInSourceSide() const;
00067     bool isInTargetSide() const;
00068     bool isInUnion() const;
00069   protected:
00070     void compareFieldAndMethod() const throw(INTERP_KERNEL::Exception);
00071     void cleanInstance();
00072     void copyInstance(const DisjointDEC& other);
00073   protected:
00074     const ParaFIELD* _local_field;
00076     ProcessorGroup* _union_group;
00077     ProcessorGroup* _source_group;
00078     ProcessorGroup* _target_group;
00079     
00080     const CommInterface* _comm_interface;
00081     bool _owns_field;
00082     bool _owns_groups;
00083   private:
00084     ICoCo::Field* _icoco_field;
00085   };
00086 }
00087 
00088 #endif