TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Solv_tools.cpp
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Solv_tools.h>
17#include <Objet_U.h>
18
19void Solv_tools::construit_renum(const DoubleVect& b)
20{
21 // Initialisation du tableau items_to_keep_ si ce n'est pas deja fait
23
24 // Compute important value:
29 //Journal()<<"nb_rows_=" << nb_rows_ << " nb_rows_tot_=" << nb_rows_tot_ << " decalage_local_global_=" << decalage_local_global_ << finl;
30
31 /**********************/
32 /* Build renum_ array */
33 /**********************/
34 //if (MatricePetsc_==nullptr)
35 {
36 const MD_Vector& md = b.get_md_vector();
37 renum_.reset();
38 renum_.resize(0, b.line_size());
39 MD_Vector_tools::creer_tableau_distribue(md, renum_, RESIZE_OPTIONS::NOCOPY_NOINIT);
40 }
41 int cpt=0;
42 int size=items_to_keep_.size_array();
43 renum_ = INT_MAX; //pour crasher si le MD_Vector est incoherent
44 ArrOfTID& renum_array = renum_; // tableau vu comme lineaire
45 for(int i=0; i<size; i++)
46 if(items_to_keep_[i])
47 {
48 renum_array[i]=cpt+decalage_local_global_;
49 cpt++;
50 }
51
52 renum_.echange_espace_virtuel();
53 // Construction de index_
54 index_.resize(size);
55 int index = 0;
56 // ToDo OpenMP factoriser avec ix car index_=ix-decalage_local_global_
57 for (int i=0; i<size; i++)
58 {
59 if (items_to_keep_[i])
60 {
61 index_[i] = index;
62 index++;
63 }
64 else
65 index_[i] = -1;
66 }
67 // Construction de ix
68 size=b.size_array();
69 auto colonne_globale=decalage_local_global_;
70 ix.resize(size);
71 for (int i=0; i<size; i++)
72 if (items_to_keep_[i])
73 {
74 ix[i] = colonne_globale;
75 colonne_globale++;
76 }
77 else
78 ix[i] = -1;
79}
80
int get_sequential_items_flags(ArrOfBit &flags, int line_size=1) const
static void creer_tableau_distribue(const MD_Vector &, Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
transforme v en un tableau parallele ayant la structure md.
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
Definition MD_Vector.h:48
static trustIdType mppartial_sum(trustIdType i)
Calul de la somme partielle de i sur les processeurs 0 a me()-1 (renvoie 0 sur le processeur 0).
Definition Process.cpp:396
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
Definition Process.cpp:146
ArrOfBit items_to_keep_
Definition Solv_tools.h:31
int secmem_sz_
Definition Solv_tools.h:37
int nb_items_to_keep_
Definition Solv_tools.h:33
ArrOfTID ix
Definition Solv_tools.h:32
trustIdType nb_rows_tot_
Definition Solv_tools.h:35
TIDTab renum_
Definition Solv_tools.h:29
IntTab index_
Definition Solv_tools.h:30
trustIdType decalage_local_global_
Definition Solv_tools.h:36
void construit_renum(const DoubleVect &)
_SIZE_ size_array() const
_SIZE_ size_totale() const
Definition TRUSTVect.tpp:61
int line_size() const
Definition TRUSTVect.tpp:67
virtual const MD_Vector & get_md_vector() const
Definition TRUSTVect.h:123