ASL 0.1.7
Advanced Simulation Library
Loading...
Searching...
No Matches
aslVTKCasters.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 ASLVTKCASTERS_H
25#define ASLVTKCASTERS_H
26
27#include <memory>
28#include <string>
29#include <vector>
30#include <vtkSmartPointer.h>
31#include <acl/aclHardware.h>
32#include <aslGenerators.h>
33#include <math/aslVectors.h>
34
40class vtkDataArray;
41class vtkImageData;
42class vtkIdTypeArray;
43
44namespace acl
45{
46 class ElementBase;
47 typedef std::shared_ptr<ElementBase> Element;
48}
49
50namespace asl
51{
52 class Block;
53 class AbstractData;
54
55
58
61 unsigned int np,
62 unsigned int save = 0,
63 const std::string &name = "");
64
67 T *d2,
68 unsigned int np,
69 const std::string &name = "");
70
73 T *d2,
74 T *d3,
75 unsigned int np,
76 const std::string &name = "");
77
80 unsigned int np,
81 const std::string &name);
82
83
86 unsigned int *d1,
87 unsigned int *d2,
88 unsigned int *d3,
89 unsigned int np,
90 const std::string &name = "");
91
93 const std::string &name = "");
94
97
99 const std::string &name,
101
103
105 const Block & b,
106 unsigned int save = 0,
107 const std::string &name = "");
108
110 double *d2,
111 const Block & b,
112 const std::string &name = "");
113
115 double *d2,
116 double *d3,
117 const Block & b,
118 const std::string &name = "");
119
122 void putToVTKData(double *d1, double *d2, double *d3, vtkSmartPointer<vtkImageData> target);
123
124
126 const std::vector<std::string> &names = std::vector<std::string>(0));
127
129 unsigned int arrayNum = 0,
130 acl::CommandQueue queue = acl::hardware.defaultQueue);
131
133
134 template<typename T> inline vtkSmartPointer<vtkDataArray> castVTKDataArray(std::shared_ptr<T> d,
135 unsigned int np,
136 const std::string &name = "")
137 {
138 return castVTKDataArray(d.get(), np, 1, name);
139 }
140
141 vtkSmartPointer<vtkImageData> inline castVTKData(std::shared_ptr<double> d,
142 const Block & b,
143 const std::string &name = "")
144 {
145 return castVTKData(d.get(), b, 1, name);
146 }
147
148
149 template<typename T> inline vtkSmartPointer<vtkDataArray> castVTKDataArray(std::vector<T> & d,
150 unsigned int np,
151 const std::string &name = "")
152 {
153 return castVTKDataArray(&d.front(), np, 1, name);
154 }
155
156
157 vtkSmartPointer<vtkImageData> inline castVTKData(std::vector<double> & d,
158 const Block & b,
159 const std::string &name = "")
160 {
161 return castVTKData(&d.front(), b, 1, name);
162 }
163
164
165 template <typename T> AVec<T> castVTKVector(AVec<T> a, T fill = 0);
166
167
168/* template <typename T> void combineArrays(T* d1,
169 T* d2,
170 T* d3,
171 unsigned int size,
172 T* dTarget,
173 unsigned int nComponents = 3);*/
175
176} //namespace acl
177
178//--------------------------------Implementation------------------------
179
180
181#endif // ASLVTKCASTERS_H
definition of class АVec<T>
SPDataWrapperACLData generateDataContainerACL_SP(const Block &b, unsigned int n=1)
generates pointer to ACL Data field with n components
vtkSmartPointer< vtkImageData > castVTKData(const Block &b)
void putToVTKData(double *d, vtkSmartPointer< vtkImageData > target)
vtkSmartPointer< vtkDataArray > castVTKDataArray2in3(T *d1, T *d2, unsigned int np, const std::string &name)
creates VTKDataArray with 3 component d2, d1 and 0 and length np and name
AVec< T > castVTKVector(AVec< T > a, T fill=0)
vtkSmartPointer< vtkDataArray > castVTKDataArray(T *d, unsigned int np, unsigned int save=0, const std::string &name="")
creates VTKDataArray with 1 component d and length np and name
std::shared_ptr< Block > makeBlock(vtkSmartPointer< vtkImageData > image)
void updateVTKDataArray(acl::Element source, vtkSmartPointer< vtkDataArray > vtkData)
vtkSmartPointer< vtkIdTypeArray > castVTKIdTypeArray(unsigned int *d0, unsigned int *d1, unsigned int *d2, unsigned int *d3, unsigned int np, const std::string &name="")
creates VTKDataArray with 3 component d1, d2 and d3 and length np and name
SPDataWithGhostNodesACLData makeData(vtkSmartPointer< vtkImageData > image, unsigned int arrayNum=0, acl::CommandQueue queue=acl::hardware.defaultQueue)
Advanced Computational Language.
Definition acl.h:41
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition acl.h:51
Hardware hardware
std::shared_ptr< ElementBase > Element
Definition acl.h:49
Advanced Simulation Library.
Definition aslDataInc.h:31
std::shared_ptr< DataWithGhostNodesACLData > SPDataWithGhostNodesACLData