1 // Copyright (C) 2007-2023 CEA, EDF
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __DISJOINTDEC_HXX__
21 #define __DISJOINTDEC_HXX__
23 #include "MEDCouplingFieldDouble.hxx"
24 #include "NormalizedUnstructuredMesh.hxx"
41 * \anchor DisjointDEC-det
44 * \section DisjointDEC-over Overview
46 * Abstract interface class representing a link between two
47 * processor groups for exchanging mesh or field data. The two processor groups must
48 * have a void intersection (\ref MEDCoupling::OverlapDEC "OverlapDEC" is to be considered otherwise).
49 * The %DEC is initialized by attaching a field on the receiving or on the
52 * The data is sent or received through calls to the (abstract) methods recvData() and sendData().
54 * One can attach either a \c MEDCoupling::ParaFIELD, or a
55 * \c ICoCo::Field, or directly a \c MEDCoupling::MEDCouplingFieldDouble instance.
56 * See the various signatures of the method DisjointDEC::attachLocalField()
58 * The derivations of this class should be considered for practical instantiation:
59 * - \ref InterpKernelDEC-det "InterpKernelDEC"
60 * - \ref ExplicitCoincidentDEC-det "ExplicitCoincidentDEC"
61 * - \ref StructuredCoincidentDEC-det "StructuredCoincidentDEC"
63 * \section DisjointDEC-options DisjointDEC options
64 * The options supported by %DisjointDEC objects are the same that the ones supported for all
65 * DECs in general and are all inherited from the class \ref MEDCoupling::DECOptions "DECOptions"
69 class DisjointDEC : public DEC
72 DisjointDEC():_local_field(0),_union_group(0),_source_group(0),_target_group(0),
74 _owns_field(false),_owns_groups(false),
75 _union_comm(MPI_COMM_NULL)
77 DisjointDEC(ProcessorGroup& source_group, ProcessorGroup& target_group);
78 DisjointDEC(const DisjointDEC&);
79 DisjointDEC &operator=(const DisjointDEC& s);
80 DisjointDEC(const std::set<int>& src_ids, const std::set<int>& trg_ids,
81 const MPI_Comm& world_comm=MPI_COMM_WORLD);
82 virtual ~DisjointDEC();
84 void setNature(NatureOfField nature);
85 void attachLocalField( MEDCouplingFieldDouble *field);
86 void attachLocalField(const ParaFIELD *field, bool ownPt=false);
87 void attachLocalField(const ICoCo::MEDDoubleField *field);
89 virtual void prepareSourceDE() = 0;
90 virtual void prepareTargetDE() = 0;
91 virtual void recvData() = 0;
92 virtual void sendData() = 0;
93 void sendRecvData(bool way=true);
94 virtual void synchronize() = 0;
96 virtual void computeProcGroup() { }
97 void renormalizeTargetField(bool isWAbs);
99 ProcessorGroup *getSourceGrp() const { return _source_group; }
100 ProcessorGroup *getTargetGrp() const { return _target_group; }
101 bool isInSourceSide() const;
102 bool isInTargetSide() const;
103 bool isInUnion() const;
105 void compareFieldAndMethod() const;
106 void cleanInstance();
107 void copyInstance(const DisjointDEC& other);
108 void checkPartitionGroup() const;
110 const ParaFIELD* _local_field;
111 //! Processor group representing the union of target and source processors
112 ProcessorGroup* _union_group;
113 ProcessorGroup* _source_group;
114 ProcessorGroup* _target_group;
116 const CommInterface* _comm_interface;
119 MPI_Comm _union_comm;