Back to index

salome-med  6.5.0
OverlapMapping.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __OVERLAPMAPPING_HXX__
00021 #define __OVERLAPMAPPING_HXX__
00022 
00023 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
00024 
00025 #include <vector>
00026 #include <map>
00027 
00028 namespace ParaMEDMEM
00029 {
00030   class ProcessorGroup;
00031   class DataArrayInt;
00032   class MEDCouplingFieldDouble;
00033 
00034   class OverlapMapping
00035   {
00036   public:
00037     OverlapMapping(const ProcessorGroup& group);
00038     void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
00039     void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
00040     void addContributionST(const std::vector< std::map<int,double> >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId);
00041     void prepare(const std::vector< std::vector<int> >& procsInInteraction, int nbOfTrgElems);
00042     void computeDenoConservativeVolumic(int nbOfTuplesTrg);
00043     void computeDenoGlobConstraint();
00044     //
00045     void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput) const;
00046     void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput);
00047   private:
00048     void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets,
00049                                 int *countForRecv, int *offsetsForRecv) const;
00050     int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0,
00051                                int *&bigArrI, double *&bigArrD, int *count, int *offsets,
00052                                int *countForRecv, int *offsForRecv) const;
00053     void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,
00054                            const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs);
00055     void finishToFillFinalMatrixST();
00056     void prepareIdsToSendST();
00057     void updateZipSourceIdsForFuture();
00058     //void printTheMatrix() const;
00059   private:
00060     const ProcessorGroup &_group;
00062     std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _src_ids_st2;//item #1
00063     std::vector< int > _src_proc_st2;//item #1
00064     std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _trg_ids_st2;//item #0
00065     std::vector< int > _trg_proc_st2;//item #0
00066     std::vector< int > _nb_of_src_ids_proc_st2;//item #1
00067     std::vector< int > _src_ids_proc_st2;//item #1
00068     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
00069     std::vector< int > _src_ids_zip_proc_st2;
00071     std::vector< std::vector< std::map<int,double> > > _matrixes_st;
00072     std::vector< std::vector<int> > _source_ids_st;
00073     std::vector< int > _source_proc_id_st;
00074     std::vector< std::vector<int> > _target_ids_st;
00075     std::vector< int > _target_proc_id_st;
00077     std::vector< std::vector< std::map<int,double> > > _the_matrix_st;
00078     std::vector< int > _the_matrix_st_source_proc_id;
00079     std::vector< std::vector<int> > _the_matrix_st_source_ids;
00080     std::vector< std::vector< std::map<int,double> > > _the_deno_st;
00082     std::vector< int > _proc_ids_to_send_vector_st;
00083     std::vector< int > _proc_ids_to_recv_vector_st;
00085     std::vector< std::vector<int> > _source_ids_to_send_st;
00086   };
00087 }
00088 
00089 #endif