Loading...
Searching...
No Matches
VTK.tpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25namespace bitpit{
26
33template<class T>
34VTKField& VTK::addData( const std::string &name, std::vector<T> &data ){
35
36 VTKField& field= addData( name, &m_nativeStreamer) ;
37 field.setDataType( VTKTypes::whichType<T>()) ;
38
39 m_nativeStreamer.addData(name,data) ;
40
41 return field;
42
43}
44
54template<class T>
55VTKField& VTK::addData(const std::string &name, VTKFieldType comp, VTKLocation loc, std::vector<T> &data ){
56
57 VTKField& field = addData( name, data ) ;
58
59 field.setFieldType(comp) ;
60 field.setLocation(loc) ;
61
62 return field ;
63
64}
65
75template<class T>
76VTKField& VTK::addData( const std::string &name, VTKFieldType comp, VTKLocation loc, VTKBaseStreamer *streamer ){
77
78 VTKField& field = addData( name, streamer ) ;
79
80 field.setFieldType(comp) ;
81 field.setLocation(loc) ;
82 field.setDataType( VTKTypes::whichType<T>() ) ;
83
84 return field ;
85}
86
93template<class T>
94void VTKUnstructuredGrid::setGeomData( VTKUnstructuredField fieldEnum, std::vector<T> &data ){
95
96 int index = static_cast<int>(fieldEnum) ;
97 VTKField& field = m_geometry[index] ;
98 std::string name = field.getName() ;
99
100 m_nativeStreamer.addData(name,data) ;
101
103 field.setDataType( VTKTypes::whichType<T>()) ;
104
105}
106
113template<class T>
115
116 int index = static_cast<int>(fieldEnum) ;
117 VTKField& field = m_geometry[index] ;
118
119 field.setDataType( VTKTypes::whichType<T>() ) ;
120 field.setStreamer( *streamer ) ;
121
122}
123
130template<class T>
131void VTKRectilinearGrid::setGeomData( VTKRectilinearField fieldEnum, std::vector<T> &data ){
132
133 int index = static_cast<int>(fieldEnum) ;
134 VTKField& field = m_geometry[index] ;
135 std::string name = field.getName() ;
136
137 m_nativeStreamer.addData(name,data) ;
138
140 field.setDataType( VTKTypes::whichType<T>()) ;
141
142}
143
150template<class T>
152
153 int index = static_cast<int>(fieldEnum) ;
154 VTKField& field = m_geometry[index] ;
155
156 field.setDataType( VTKTypes::whichType<T>() ) ;
157 field.setStreamer( *streamer ) ;
158
159}
160
161}
The base class to be used to derive VTK streamers form.
Definition VTK.hpp:209
VTKField handles geometry and data field information for the VTK format.
Definition VTK.hpp:247
const std::string & getName() const
Definition VTKField.cpp:167
void setDataType(VTKDataType)
Definition VTKField.cpp:97
void setStreamer(VTKBaseStreamer &)
Definition VTKField.cpp:145
void setFieldType(VTKFieldType)
Definition VTKField.cpp:121
void setLocation(VTKLocation)
Definition VTKField.cpp:105
void addData(const std::string &, std::vector< T > &)
void setGeomData(VTKRectilinearField, std::vector< T > &)
Definition VTK.tpp:131
void setGeomData(VTKUnstructuredField, std::vector< T > &)
Definition VTK.tpp:94
VTKField & addData(VTKField &&field)
Definition VTK.cpp:281
std::vector< VTKField > m_geometry
Definition VTK.hpp:309
VTKNativeStreamer m_nativeStreamer
Definition VTK.hpp:315
VTKFieldType
Definition VTK.hpp:63
VTKLocation
Definition VTK.hpp:102
VTKUnstructuredField
Definition VTK.hpp:137
VTKRectilinearField
Definition VTK.hpp:150
--- layout: doxygen_footer ---