Flow123d  release_2.2.0-33-g759111d
reader_internal_transpose.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file reader_internal_transpose.hh
15  * @brief
16  */
17 
18 #ifndef READER_INTERNAL_TRANSPOSE_HH_
19 #define READER_INTERNAL_TRANSPOSE_HH_
20 
21 
22 //#include "input/input_type_forward.hh"
23 
24 //#include "input/storage.hh"
25 //#include "input/path_base.hh"
27 
28 
29 namespace Input {
30 
31 using namespace std;
32 
33 /**
34  * @brief Creates storage of transposed subtree defined on input.
35  *
36  * We use this class if input tree contains another type at position where Array
37  * is expected. This type must correspond with type_of_value of Array.
38  *
39  * @ingroup input
40  */
42 public:
43  /// Constructor
45 
46  /**
47  * @brief Create storage of transposed subtree of given @p Array.
48  *
49  * Processing of subtree with transposition:
50  * 1. We set @p transpose_index_ to value '0' (transposition of first Array item).
51  * 2. We retrieve whole subtree and find Array types that are located at position
52  * where other type is expected (type_of_value of found Array must corresponds
53  * with excepted type).
54  * We create storage corresponding with subtree (unexpected Arrays are replaced
55  * by item at position given by @p transpose_index_.
56  * 3. Together with paragraph 2 we store sizes of found Arrays to
57  * @p transpose_array_sizes_.
58  * 4. We check sizes stored in transpose_array_sizes_ (all must be in equal
59  * and may not be equal to zero). This size determines size of transposed Array
60  * type.
61  * 5. We repeat paragraph 2 for all items of transposed Array (gradual increase of
62  * @p transpose_index_).
63  */
64  StorageBase * read_storage(PathBase &p, const Type::Array *array);
65 
66 protected:
67  StorageBase * make_sub_storage(PathBase &p, const Type::Array *array) override; ///< Create storage of Type::Array type
68  StorageBase * make_sub_storage(PathBase &p, const Type::Selection *selection) override; ///< Create storage of Type::Selection type
69  StorageBase * make_sub_storage(PathBase &p, const Type::Bool *bool_type) override; ///< Create storage of Type::Bool type
70  StorageBase * make_sub_storage(PathBase &p, const Type::Integer *int_type) override; ///< Create storage of Type::Integer type
71  StorageBase * make_sub_storage(PathBase &p, const Type::Double *double_type) override; ///< Create storage of Type::Double type
72  StorageBase * make_sub_storage(PathBase &p, const Type::String *string_type) override; ///< Create storage of Type::String type
73 
74  /// Apply transposition and create storage of Type::Array type
75  StorageBase * make_transposed_storage(PathBase &p, const Type::TypeBase *type);
76 
77  /// Apply conversion to one element storage of Type::Array type
78  StorageBase * make_autoconversion_array_storage(PathBase &p, const Type::Array *array, StorageBase *item);
79 
80  /// Index of processed item in transposed part of input tree.
81  unsigned int transpose_index_;
82 
83  /// Helper vector what allows check sizes of all transposed Arrays.
85 
86 };
87 
88 
89 
90 } // namespace Input
91 
92 #endif /* READER_INTERNAL_TRANSPOSE_HH_ */
Base of classes for declaring structure of the input data.
Definition: type_base.hh:99
Base class for nodes of a data storage tree.
Definition: storage.hh:68
Class for declaration of the input of type Bool.
Definition: type_base.hh:458
Base abstract class used by ReaderToStorage class to iterate over the input tree. ...
Definition: path_base.hh:41
Class for declaration of the integral input data.
Definition: type_base.hh:489
Class for declaration of inputs sequences.
Definition: type_base.hh:345
Class for declaration of the input data that are floating point numbers.
Definition: type_base.hh:540
Creates storage of transposed subtree defined on input.
unsigned int transpose_index_
Index of processed item in transposed part of input tree.
vector< unsigned int > transpose_array_sizes_
Helper vector what allows check sizes of all transposed Arrays.
Internal part of IST reader.
Class for declaration of the input data that are in string format.
Definition: type_base.hh:588
Template for classes storing finite set of named values.