TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
TRUSTTab_parts.h
1/****************************************************************************
2* Copyright (c) 2022, 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#ifndef TRUSTTab_parts_included
17#define TRUSTTab_parts_included
18
19#include <MD_Vector_composite.h>
20#include <TRUSTTabs.h>
21
22/*! @brief This class allows to access the individual sub-parts of DoubleTab objects that have a MD_Vector_composite descriptor.
23 * See const version below.
24 */
25template <typename _TYPE_>
27{
28public:
32 void reset() { parts_.dimensionner_force(0); }
33 int size() const { return parts_.size(); }
34
35 // operator[] est non const sinon on pourrait contourner le l'attribut const d'une classe...
36 TRUSTTab<_TYPE_>& operator[](int i) { return parts_[i]; }
37 // En revanche, on a toujours le doit d'avoir la version const:
38 const TRUSTTab<_TYPE_>& operator[](int i) const { return parts_[i]; }
39
40private:
41 // les operateurs suivants sont interdits !
42 TRUSTTab_parts& operator=(const TRUSTTab_parts&) = delete;
43 TRUSTTab_parts(const TRUSTTab_parts&) = delete;
44 // parts_[i] is initialized by adopter() to point to a sub_part of the source array.
45 TRUST_Vector<TRUSTTab<_TYPE_>> parts_; // Et ouiiiiiiiiiiiiiiii
46};
47
48using DoubleTab_parts = TRUSTTab_parts<double>;
49using IntTab_parts = TRUSTTab_parts<int>;
50
51/*! @brief This class allows to access the individual sub-parts of 'const DoubleTab' objects that have a MD_Vector_composite descriptor.
52 *
53 * It is designed to preserve the const-ness of the object.
54 *
55 */
56template <typename _TYPE_>
58{
59public:
63 void reset() { parts_.dimensionner_force(0); }
64 const TRUSTTab<_TYPE_>& operator[](int i) const { return parts_[i]; }
65 int size() const { return parts_.size(); }
66
67private:
68 // les operateurs suivants sont interdits !
69 ConstTRUSTTab_parts& operator=(const ConstTRUSTTab_parts&) = delete;
71 // parts_[i] is initialized by adopter() to point to a sub_part of the source array.
72 TRUST_Vector<TRUSTTab<_TYPE_>> parts_; // Et ouiiiiiiiiiiiiiiii
73};
74
75using ConstDoubleTab_parts = ConstTRUSTTab_parts<double>;
76using ConstIntTab_parts = ConstTRUSTTab_parts<int>;
77
78#include <TRUSTTab_parts.tpp>
79
80#endif /* TRUSTTab_parts_included */
This class allows to access the individual sub-parts of 'const DoubleTab' objects that have a MD_Vect...
const TRUSTTab< _TYPE_ > & operator[](int i) const
ConstTRUSTTab_parts(const TRUSTVect< _TYPE_ > &)
void initialize(const TRUSTVect< _TYPE_ > &)
This class allows to access the individual sub-parts of DoubleTab objects that have a MD_Vector_compo...
void initialize(TRUSTVect< _TYPE_ > &)
int size() const
TRUSTTab_parts(TRUSTVect< _TYPE_ > &)
TRUSTTab< _TYPE_ > & operator[](int i)
const TRUSTTab< _TYPE_ > & operator[](int i) const
: Tableau a n entrees pour n<= 4.
Definition TRUSTTab.h:31
classe TRUST_Vector