1 // Copyright (C) 2007-2023 CEA/DEN, EDF R&D
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 __STRUCTUREDCOINCIDENTDEC_HXX__
21 #define __STRUCTUREDCOINCIDENTDEC_HXX__
23 #include "DisjointDEC.hxx"
24 #include "BlockTopology.hxx"
33 \anchor StructuredCoincidentDEC-det
34 \class StructuredCoincidentDEC
36 This class aims at \ref interpolation "remapping fields" that have identical
37 structured supports (=the same underlying mesh) but different parallel topologies
38 (=different sub-domains in the structured mesh). It can be used to couple
39 together multi-physics codes that operate on the same domain
40 with different partitioning. This can be useful for example if one of
41 the computation is much faster than the other. It can also be used
42 to couple together codes that share an interface that was generated
43 in the same manner (with identical global ids).
44 Also, this \ref para-dec "DEC" can be used for fields that have component topologies,
45 i.e., components that are scattered over several processors.
47 The remapping between the two supports is based on identity of global
48 ids, instead of geometrical considerations (as it is the case for
49 \ref InterpKernelDEC-det "InterpKernelDEC").
50 Therefore, beware that this \ref para-dec "DEC" can not be used
51 for coincident meshes if they do *not* have the exact same numbering.
53 With this %DEC no projection, and no interpolation of the field data is done, contrary
54 to what happens in \ref InterpKernelDEC-det "InterpKernelDEC". It is just
55 a matter of allocating the values from one side to the other, using directly the cell
58 As all the other DECs, its usage requires two phases :
59 - a setup phase during which the topologies are exchanged so that
60 the target side knows from which processors it should expect
62 - a send/recv phase during which the field data is actually transferred.
64 This example illustrates the sending of a field with
65 the \c StructuredCoincidentDEC :
68 StructuredCoincidentDEC dec(groupA, groupB);
69 dec.attachLocalField(field);
71 if (groupA.containsMyRank())
73 else if (groupB.containsMyRank())
78 Creating a ParaFIELD to be attached to the %DEC is done in exactly the same way as for
79 the other DECs, if only the partitioning of the support mesh differs.
81 fields have also different *component* topologies, creating the ParaFIELD
82 requires some more effort. See the \ref para-over "parallelism" section for more details.
84 class StructuredCoincidentDEC : public DisjointDEC
87 StructuredCoincidentDEC();
88 StructuredCoincidentDEC( ProcessorGroup& source, ProcessorGroup& target);
89 virtual ~StructuredCoincidentDEC();
95 void prepareSourceDE();
96 void prepareTargetDE();
99 void synchronizeTopology();
100 void broadcastTopology(BlockTopology*&, int tag);
102 BlockTopology* _topo_source;
103 BlockTopology* _topo_target;
105 bool _owns_topo_source;
106 bool _owns_topo_target;
112 double* _recv_buffer;
113 double* _send_buffer;