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;
38 OverlapMapping(const ProcessorGroup& group);
39 void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
40 void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
41 void addContributionST(const std::vector< std::map<int,double> >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId);
42 void prepare(const std::vector< std::vector<int> >& procsInInteraction, int nbOfTrgElems);
43 void computeDenoConservativeVolumic(int nbOfTuplesTrg);
44 void computeDenoGlobConstraint();
46 void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput) const;
47 void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput);
49 void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
50 int *countForRecv, int *offsetsForRecv) const;
51 int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
52 int *&bigArrI, double *&bigArrD, int *count, int *offsets,
53 int *countForRecv, int *offsForRecv) const;
54 void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
55 const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
56 void finishToFillFinalMatrixST();
57 void prepareIdsToSendST();
58 void updateZipSourceIdsForFuture();
59 //void printTheMatrix() const;
61 const ProcessorGroup &_group;
63 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _src_ids_st2;//item #1
64 std::vector< int > _src_proc_st2;//item #1
65 std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _trg_ids_st2;//item #0
66 std::vector< int > _trg_proc_st2;//item #0
67 std::vector< int > _nb_of_src_ids_proc_st2;//item #1
68 std::vector< int > _src_ids_proc_st2;//item #1
69 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
70 std::vector< int > _src_ids_zip_proc_st2;
71 //! vector of matrixes the first entry correspond to source proc id in _source_ids_st
72 std::vector< std::vector< std::map<int,double> > > _matrixes_st;
73 std::vector< std::vector<int> > _source_ids_st;
74 std::vector< int > _source_proc_id_st;
75 std::vector< std::vector<int> > _target_ids_st;
76 std::vector< int > _target_proc_id_st;
77 //! 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.
78 std::vector< std::vector< std::map<int,double> > > _the_matrix_st;
79 std::vector< int > _the_matrix_st_source_proc_id;
80 std::vector< std::vector<int> > _the_matrix_st_source_ids;
81 std::vector< std::vector< std::map<int,double> > > _the_deno_st;
82 //! this attribute stores the proc ids that wait for data from this proc ids for matrix-vector computation
83 std::vector< int > _proc_ids_to_send_vector_st;
84 std::vector< int > _proc_ids_to_recv_vector_st;
85 //! this attribute is of size _group.size(); for each procId in _group _source_ids_to_send_st[procId] contains tupleId to send abroad
86 std::vector< std::vector<int> > _source_ids_to_send_st;