TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
MD_Vector_mono.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <MD_Vector_mono.h>
17#include <Param.h>
18
19Implemente_base(MD_Vector_mono,"MD_Vector_mono",MD_Vector_base);
20
22{
24
25 Param p("MD_Vector_mono");
26 p.ajouter("blocs_items_to_sum", &blocs_items_to_sum_);
27 p.ajouter("blocs_items_to_compute", &blocs_items_to_compute_);
28 p.lire_avec_accolades(is);
29
30 return is;
31}
32
34{
36
37 os << "{" << finl;
38 os << "blocs_items_to_sum" << tspace << blocs_items_to_sum_;
39 os << "blocs_items_to_compute" << tspace << blocs_items_to_compute_;
40 os << "}" << finl;
41
42 return os;
43}
44
45void flatten(const ArrOfInt& blocs_items, ArrOfInt& items)
46{
47 // Build from blocs_items_to_sum_
48 //const ArrOfInt& blocs_items_to_sum = get_blocs_items_to_sum();
49 const int nblocs = blocs_items.size_array() >> 1;
50 const int *bloc_itr = blocs_items.addr();
51 int size = 0;
52 for (int bloc=0; bloc<nblocs; bloc++)
53 {
54 const int begin_bloc = (*(bloc_itr++));
55 const int end_bloc = (*(bloc_itr++));
56 size += end_bloc - begin_bloc;
57 }
58 items.resize(size);
59 int item = 0;
60 bloc_itr = blocs_items.addr();
61 for (int bloc=0; bloc<nblocs; bloc++)
62 {
63 const int begin_bloc = (*(bloc_itr++));
64 const int end_bloc = (*(bloc_itr++));
65 for (int i=begin_bloc; i<end_bloc; i++)
66 {
67 items(item) = i;
68 item++;
69 }
70 }
71}
72
73const ArrOfInt& MD_Vector_mono::get_items_to_sum() const
74{
75 if (items_to_sum_.size_array()==0)
77 return items_to_sum_;
78}
79
81{
82 if (items_to_compute_.size_array()==0)
84 return items_to_compute_;
85}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Base class for distributed vectors parallel descriptors.
Generic class for all mono-block MD_Vectors (i.e. non compoosite).
ArrOfInt items_to_sum_
const ArrOfInt & get_items_to_compute() const override
ArrOfInt items_to_compute_
ArrOfInt blocs_items_to_sum_
const ArrOfInt & get_items_to_sum() const override
const ArrOfInt & get_blocs_items_to_sum() const override
const ArrOfInt & get_blocs_items_to_compute() const override
ArrOfInt blocs_items_to_compute_
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const
_TYPE_ * addr()
void resize(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTArray.h:156