24 #ifndef ASLDATAWITHGHOSTNODES_H
25 #define ASLDATAWITHGHOSTNODES_H
38 class AbstractDataWithGhostNodes:
public AbstractData
43 unsigned int ghostBorder;
45 bool bordersDataAcces;
46 inline AbstractDataWithGhostNodes();
47 inline AbstractDataWithGhostNodes(
const Block & b,
int nGN = 1,
bool bDA =
true);
49 inline int getSubContainerOffset()
const;
50 inline unsigned int getSubContainerSize()
const;
51 inline const Block & getInternalBlock()
const;
52 inline const unsigned int getGhostBorder()
const;
57 template <
typename V>
class DataWithGhostNodes:
public AbstractDataWithGhostNodes
62 inline DataWithGhostNodes();
63 inline DataWithGhostNodes(
const Block & b,
int nGN = 1,
bool bDA =
true);
64 inline DataWithGhostNodes(DataWrapper<V> & d,
int nGN = 1);
68 inline void setContainer(
const V & cont);
69 inline V & getContainer();
88 template <
typename V>
inline std::shared_ptr<DataWithGhostNodes<V>>
89 resizeGhostNodes(std::shared_ptr<DataWithGhostNodes<V>> d,
unsigned int newGN);
93 AbstractDataWithGhostNodes::AbstractDataWithGhostNodes()
97 AbstractDataWithGhostNodes::AbstractDataWithGhostNodes(
const Block & b,
int nGN,
bool bDA):
98 AbstractData (
offset(b, nGN)),
101 bordersDataAcces(bDA)
106 template <
typename V> DataWithGhostNodes<V>::DataWithGhostNodes()
110 template <
typename V> DataWithGhostNodes<V>::DataWithGhostNodes(
const Block & b,
int nGN,
bool bDA):
111 AbstractDataWithGhostNodes (b,nGN,bDA),
116 template <
typename V> DataWithGhostNodes<V>::DataWithGhostNodes(DataWrapper<V> & d,
int nGN):
117 AbstractDataWithGhostNodes (
offset(d.getBlock(), -nGN), nGN, true),
122 const Block & AbstractDataWithGhostNodes::getInternalBlock()
const
124 return internalBlock;
127 const unsigned int AbstractDataWithGhostNodes::getGhostBorder()
const
132 inline int AbstractDataWithGhostNodes::getSubContainerOffset()
const
134 Block b(
offset(internalBlock, ghostBorder));
135 int nD(b.getSize().getSize());
136 return b.c2i(AVec<int>(
nD,ghostBorder));
139 inline unsigned int AbstractDataWithGhostNodes::getSubContainerSize()
const
141 const Block b(
offset(internalBlock, ghostBorder));
142 int nD(b.getSize().getSize());
143 int s(b.c2i(b.getSize()-AVec<int>(
nD,ghostBorder+1)) - b.c2i(AVec<int>(
nD,ghostBorder))+1);
147 template <
class V >
inline void DataWithGhostNodes<V>::setContainer(
const V & cont)
149 dw.setContainer (cont);
152 template <
class V >
inline V & DataWithGhostNodes<V>::getContainer()
154 return dw.getContainer();
157 template <
typename V>
inline std::shared_ptr<DataWithGhostNodes<V>>
158 resizeGhostNodes(std::shared_ptr<DataWithGhostNodes<V>> d,
unsigned int newGN)
160 Block b(
offset(d->getBlock(),newGN));
161 std::shared_ptr<DataWithGhostNodes<V>>
162 nd(
new DataWithGhostNodes<V>(b, 0));
163 nd->setContainer(d->getContainer());
170 #endif // ASLDATAWITHGHOSTNODES_H