1 // Copyright (C) 2007-2015 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
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __OVERLAPMAPPING_HXX__
22 #define __OVERLAPMAPPING_HXX__
24 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
33 class MEDCouplingFieldDouble;
36 * Internal class, not part of the public API.
38 * Used by the impl of OverlapInterpolationMatrix, plays an equivalent role than what the NxM_Mapping
39 * does for the InterpolationMatrix.
45 OverlapMapping(const ProcessorGroup& group);
46 void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
47 void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
48 void addContributionST(const std::vector< std::map<int,double> >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId);
49 void prepare(const std::vector< std::vector<int> >& procsInInteraction, int nbOfTrgElems);
50 void computeDenoConservativeVolumic(int nbOfTuplesTrg);
51 void computeDenoGlobConstraint();
53 void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput) const;
54 void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput);
56 void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
57 int *countForRecv, int *offsetsForRecv) const;
58 int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
59 int *&bigArrI, double *&bigArrD, int *count, int *offsets,
60 int *countForRecv, int *offsForRecv) const;
61 void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
62 const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
63 void finishToFillFinalMatrixST();
64 void prepareIdsToSendST();
65 void updateZipSourceIdsForFuture();
66 //void printTheMatrix() const;
68 const ProcessorGroup &_group;
70 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _src_ids_st2;//item #1
71 std::vector< int > _src_proc_st2;//item #1
72 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _trg_ids_st2;//item #0
73 std::vector< int > _trg_proc_st2;//item #0
74 std::vector< int > _nb_of_src_ids_proc_st2;//item #1
75 std::vector< int > _src_ids_proc_st2;//item #1
76 std::vector< std::vector<int> > _src_ids_zip_st2;//same size as _src_ids_zip_proc_st2. Sorted. specifies for each id the corresponding ids to send. This is for item0 of Step2 of main algorithm
77 std::vector< int > _src_ids_zip_proc_st2;
78 //! vector of matrixes the first entry correspond to source proc id in _source_ids_st
79 std::vector< std::vector< std::map<int,double> > > _matrixes_st;
80 std::vector< std::vector<int> > _source_ids_st;
81 std::vector< int > _source_proc_id_st;
82 std::vector< std::vector<int> > _target_ids_st;
83 std::vector< int > _target_proc_id_st;
84 //! the matrix for matrix-vector product. The first dimension the set of target procs that interacts with local source mesh. The second dimension correspond to nb of local source ids.
85 std::vector< std::vector< std::map<int,double> > > _the_matrix_st;
86 std::vector< int > _the_matrix_st_source_proc_id;
87 std::vector< std::vector<int> > _the_matrix_st_source_ids;
88 std::vector< std::vector< std::map<int,double> > > _the_deno_st;
89 //! this attribute stores the proc ids that wait for data from this proc ids for matrix-vector computation
90 std::vector< int > _proc_ids_to_send_vector_st;
91 std::vector< int > _proc_ids_to_recv_vector_st;
92 //! this attribute is of size _group.size(); for each procId in _group _source_ids_to_send_st[procId] contains tupleId to send abroad
93 std::vector< std::vector<int> > _source_ids_to_send_st;