X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FParaMEDMEM%2FStructuredCoincidentDEC.hxx;h=2cf1bf9d43d2b7b1e31a6db6848d3a4ba914dce6;hb=34b392fa962cf123d25a685aa983d79ede02f3cd;hp=0ef87b27fa90868e9b9244bd04f9504b756f290d;hpb=10f37bf6f33a762626d7f1093b2f5450c1688667;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/StructuredCoincidentDEC.hxx b/src/ParaMEDMEM/StructuredCoincidentDEC.hxx index 0ef87b27f..2cf1bf9d4 100644 --- a/src/ParaMEDMEM/StructuredCoincidentDEC.hxx +++ b/src/ParaMEDMEM/StructuredCoincidentDEC.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,16 +24,71 @@ #include "BlockTopology.hxx" -namespace ParaMEDMEM +namespace MEDCoupling { class DEC; class BlockTopology; + + /*! + \anchor StructuredCoincidentDEC-det + \class StructuredCoincidentDEC + + This class aims at \ref interpolation "remapping fields" that have identical + structured supports (=the same underlying mesh) but different parallel topologies + (=different sub-domains in the structured mesh). It can be used to couple + together multi-physics codes that operate on the same domain + with different partitioning. This can be useful for example if one of + the computation is much faster than the other. It can also be used + to couple together codes that share an interface that was generated + in the same manner (with identical global ids). + Also, this \ref para-dec "DEC" can be used for fields that have component topologies, + i.e., components that are scattered over several processors. + + The remapping between the two supports is based on identity of global + ids, instead of geometrical considerations (as it is the case for + \ref InterpKernelDEC-det "InterpKernelDEC"). + Therefore, beware that this \ref para-dec "DEC" can not be used + for coincident meshes if they do *not* have the exact same numbering. + + With this %DEC no projection, and no interpolation of the field data is done, contrary + to what happens in \ref InterpKernelDEC-det "InterpKernelDEC". It is just + a matter of allocating the values from one side to the other, using directly the cell + identifiers. + + As all the other DECs, its usage requires two phases : + - a setup phase during which the topologies are exchanged so that + the target side knows from which processors it should expect + the data. + - a send/recv phase during which the field data is actually transferred. + + This example illustrates the sending of a field with + the \c StructuredCoincidentDEC : + \code + ... + StructuredCoincidentDEC dec(groupA, groupB); + dec.attachLocalField(field); + dec.synchronize(); + if (groupA.containsMyRank()) + dec.recvData(); + else if (groupB.containsMyRank()) + dec.sendData(); + ... + \endcode + + Creating a ParaFIELD to be attached to the %DEC is done in exactly the same way as for + the other DECs, if only the partitioning of the support mesh differs. + In the case where the + fields have also different *component* topologies, creating the ParaFIELD + requires some more effort. See the \ref para-over "parallelism" section for more details. + */ class StructuredCoincidentDEC : public DisjointDEC { public: StructuredCoincidentDEC(); StructuredCoincidentDEC( ProcessorGroup& source, ProcessorGroup& target); virtual ~StructuredCoincidentDEC(); + void release(); + void synchronize(); void recvData(); void sendData(); @@ -46,6 +101,10 @@ namespace ParaMEDMEM BlockTopology* _topo_source; BlockTopology* _topo_target; + + bool _owns_topo_source; + bool _owns_topo_target; + int* _send_counts; int* _recv_counts; int* _send_displs;