TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
MD_Vector_seq.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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_seq.h>
17#include <TRUSTTabs.h>
18#include <ArrOfBit.h>
19#include <Param.h>
20
21Implemente_instanciable_sans_constructeur(MD_Vector_seq,"MD_Vector_seq",MD_Vector_mono);
22
24{
26 Param p(que_suis_je());
27 p.ajouter("nb_items", &nb_items_);
28 p.lire_avec_accolades(is);
29
30 return is;
31}
32
34{
36 os << "{" << finl;
37 os << "nb_items" << tspace << nb_items_ << finl;
38 os << "}" << finl;
39
40 return os;
41}
42
43
45{
46 assert(nb_items_ < std::numeric_limits<int>::max());
47 return (int)nb_items_;
48}
49
51{
52 assert(nb_items_ < std::numeric_limits<int>::max());
53 return (int)nb_items_;
54}
55
57{
58 assert(nb_items_ < std::numeric_limits<int>::max());
59 return (int)nb_items_;
60}
61
62
63int MD_Vector_seq::get_seq_flags_impl(ArrOfBit& flags, int line_size) const
64{
65 assert(nb_items_*line_size < std::numeric_limits<int>::max());
66
67 const int sz = (int)nb_items_ * line_size;
68 flags.resize_array(sz);
69 flags = 1; // everything is present and must be included in sequential
70 return sz;
71}
72
73void MD_Vector_seq::append_from_other_seq(const MD_Vector_seq& src, int offset, int multiplier)
74{
75 // Just increase the total size:
76 nb_items_ += src.nb_items_*multiplier;
77}
78
79void MD_Vector_seq::fill_md_vect_renum(const IntVect& renum, MD_Vector& md_vect) const
80{
81 // Count non -1 entries to have proper number of items in the dest descriptor:
82 assert(nb_items_ < std::numeric_limits<int>::max());
83 const int src_size = (int)nb_items_;
84 int cnt=0;
85 for (int i = 0; i < src_size; i++)
86 if (renum[i] >= 0)
87 cnt++;
88 MD_Vector_seq dest(cnt);
89 md_vect.copy(dest);
90}
ArrOfBit_32_64 & resize_array(int_t n)
Change la taille du tableau et copie les donnees existantes.
Definition ArrOfBit.cpp:71
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
friend class MD_Vector
Generic class for all mono-block MD_Vectors (i.e. non compoosite).
Dummy parallel descriptor used for sequential computations.
int get_seq_flags_impl(ArrOfBit &flags, int line_size) const override
void fill_md_vect_renum(const IntVect &renum, MD_Vector &md_vect) const override
int get_nb_items_tot() const override
int get_nb_items_reels() const override
void append_from_other_seq(const MD_Vector_seq &src, int offset, int multiplier) override
int nb_items_seq_local() const override
void copy(const MD_Vector_base &)
construction d'un objet MD_Vector par copie d'un objet existant.
Definition MD_Vector.cpp:26
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
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