ASL 0.1.7
Advanced Simulation Library
Loading...
Searching...
No Matches
aslDataWrapper.h
Go to the documentation of this file.
1/*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24#ifndef ASLDATAWRAPPER_H
25#define ASLDATAWRAPPER_H
26
27#include "aslBlocks.h"
29#include <iostream>
30#include <fstream>
31
37namespace acl
38{
39 void copy(const vector<Element> & source,
40 VectorOfElements & destination);
41 void copy(const VectorOfElementsData & source,
42 VectorOfElementsData & destination);
43}
44
45
46using namespace std;
47
48namespace asl
49{
50
53 {
54 protected:
56 inline AbstractData();
57 inline explicit AbstractData(const Block & b);
58 public:
60 virtual const acl::VectorOfElementsData getDContainer() const = 0;
61 inline const Block & getBlock() const;
62 inline void setBlock(const Block & b);
63 };
64
65 typedef shared_ptr<AbstractData> SPAbstractData;
66
67
69
76 template <typename V> class DataWrapper: public AbstractData
77 {
78 protected:
80 virtual bool checkConsistency() const;
81 public:
82 inline DataWrapper();
83 inline explicit DataWrapper(const Block & b);
84 inline DataWrapper(DataWrapper & d);
87 inline V & getContainer();
88 inline void setContainer(const V & cont);
89 };
90
93
94 typedef shared_ptr<DataWrapperACL> SPDataWrapperACL;
95 typedef shared_ptr<DataWrapperACLData> SPDataWrapperACLData;
96
97
98// ---------------------------- Implementation ---------------------------
99
103
105 block(b)
106 {
107 }
108
109 template <typename V> DataWrapper<V>::DataWrapper():
111 {
112 }
113
114 template <typename V> DataWrapper<V>::DataWrapper(const Block & b):
115 AbstractData(b)
116 {
117 }
118
119 template <typename V> DataWrapper<V>::DataWrapper(DataWrapper & d):
120 AbstractData(d.block),
121 container(d.container)
122 {
123 }
124
125 template <typename V> inline V & DataWrapper<V>::getContainer()
126 {
127 return container;
128 }
129
130 template <typename V> inline void DataWrapper<V>::setContainer(const V & cont)
131 {
132 copy(cont, container);
133 }
134
135 inline const Block & AbstractData::getBlock() const
136 {
137 return block;
138 }
139
140 inline void AbstractData::setBlock(const Block & b)
141 {
142 block=b;
143 }
144
145}
146#endif
147
The class represents several ElementData.
The class represents several Element.
void setBlock(const Block &b)
virtual const acl::VectorOfElementsData getDContainer() const =0
const Block & getBlock() const
virtual const acl::VectorOfElements getEContainer()=0
Class defines a folding rule into a 1D/2D/3D bulk.
virtual bool checkConsistency() const
virtual const acl::VectorOfElements getEContainer()
virtual const acl::VectorOfElementsData getDContainer() const
void setContainer(const V &cont)
SPDataWrapperACLData generateDataContainerACL_SP(const Block &b, unsigned int n=1)
generates pointer to ACL Data field with n components
Advanced Computational Language.
Definition acl.h:41
void copy(MemBlock &source, T *destination)
Advanced Simulation Library.
Definition aslDataInc.h:31
std::shared_ptr< DataWrapperACLData > SPDataWrapperACLData
shared_ptr< AbstractData > SPAbstractData
std::shared_ptr< DataWrapperACL > SPDataWrapperACL
DataWrapper< acl::VectorOfElementsData > DataWrapperACLData
DataWrapper< acl::VectorOfElements > DataWrapperACL
STL namespace.