SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FieldInformation.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2009 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 /// @todo Documentation Core/Datatypes/Legacy/Field/FieldInformation.h
29 
30 #ifndef CORE_DATATYPES_FIELDINFORMATION
31 #define CORE_DATATYPES_FIELDINFORMATION 1
32 
33 #include <string>
34 #include <vector>
35 #include <Core/Utils/Exception.h>
38 
40 
41 namespace SCIRun {
42 
44 {
45 
46  public:
47 
48  bool is_isomorphic();
49  bool is_nonlinear();
50  bool is_linear();
51 
52  bool is_nodata();
53  bool is_constantdata();
54  bool is_lineardata();
55  bool is_nonlineardata();
56  bool is_quadraticdata();
57  bool is_cubicdata();
58  int field_basis_order();
59 
60  bool is_constantmesh();
61  bool is_linearmesh();
62  bool is_nonlinearmesh();
63  bool is_quadraticmesh();
64  bool is_cubicmesh();
65  int mesh_basis_order();
66 
67  bool is_tensor();
68  bool is_vector();
69  bool is_scalar();
70  bool is_integer();
71  bool is_double();
72  bool is_float();
73  bool is_longlong();
74  bool is_long();
75  bool is_int();
76  bool is_short();
77  bool is_char();
78  bool is_unsigned_longlong();
79  bool is_unsigned_long();
80  bool is_unsigned_int();
81  bool is_unsigned_short();
82  bool is_unsigned_char();
83  bool is_dvt(); // double vector tensor
84  bool is_svt(); // scalar vector tensor
85 
86  bool is_regularmesh();
87  bool is_irregularmesh();
88  bool is_structuredmesh();
89  bool is_unstructuredmesh();
90 
91  // These should go...
92  inline bool is_pointcloud() { return(is_pointcloudmesh()); }
93  inline bool is_scanline() { return(is_scanlinemesh()); }
94  inline bool is_image() { return(is_imagemesh()); }
95  inline bool is_latvol() { return(is_latvolmesh()); }
96  inline bool is_curve() { return(is_curvemesh()); }
97  inline bool is_trisurf() { return(is_trisurfmesh()); }
98  inline bool is_quadsurf() { return(is_quadsurfmesh()); }
99  inline bool is_tetvol() { return(is_tetvolmesh()); }
100  inline bool is_prismvol() { return(is_prismvolmesh()); }
101  inline bool is_hexvol() { return(is_hexvolmesh()); }
102  inline bool is_structcurve() { return(is_structcurvemesh()); }
103  inline bool is_structquadsurf() { return(is_structquadsurfmesh()); }
104  inline bool is_structhexvol() { return(is_structhexvolmesh()); }
105 
106  // Naming that is more systematic
107  bool is_pointcloudmesh();
108  bool is_scanlinemesh();
109  bool is_imagemesh();
110  bool is_latvolmesh();
111  bool is_curvemesh();
112  bool is_trisurfmesh();
113  bool is_quadsurfmesh();
114  bool is_tetvolmesh();
115  bool is_prismvolmesh();
116  bool is_hexvolmesh();
117  bool is_structcurvemesh();
118  bool is_structquadsurfmesh();
119  bool is_structhexvolmesh();
120 
121 
122  bool is_point();
123  bool is_line();
124  bool is_surface();
125  bool is_volume();
126 
127  bool is_pnt_element();
128  bool is_crv_element();
129  bool is_tri_element();
130  bool is_quad_element();
131  bool is_tet_element();
132  bool is_prism_element();
133  bool is_hex_element();
134 
135  void insert_field_type_information(Field* field);
136  protected:
137 
138  // type names
139  std::string field_type;
140  std::string mesh_type;
141  std::string mesh_basis_type;
142  std::string point_type;
143  std::string basis_type;
144  std::string data_type;
145  std::string container_type;
146 
147 };
148 
149 
151 
152  public:
153 
154  FieldInformation(const std::string& meshtype,const std::string& meshbasis,
155  const std::string& databasis, const std::string& datatype);
156  FieldInformation(const std::string& meshtype,const std::string& basis, const std::string& datatype);
157 
158  FieldInformation(const std::string& meshtype,int,int, const std::string& datatype);
159  FieldInformation(const std::string& meshtype,int, const std::string& datatype);
160 
164  data_info_type data);
165 
167  FieldInformation(Field* field);
168 
169 
170  std::string get_field_type();
171  void set_field_type(const std::string&);
172 
173  std::string get_mesh_type();
174  std::string get_mesh_type_id();
175  void set_mesh_type(const std::string&);
176  void set_mesh_type(mesh_info_type);
177 
178  std::string get_mesh_basis_type();
179  void set_mesh_basis_type(const std::string&);
180  void set_mesh_basis_type(int);
181 
182  std::string get_point_type();
183  void set_point_type(const std::string&);
184 
185  std::string get_basis_type();
186  void set_basis_type(const std::string&);
187  void set_basis_type(int);
188 
189  // alternative way of setting data_basis
190  std::string get_data_basis_type() { return (get_basis_type()); }
191  void set_data_basis_type(const std::string& s) { set_basis_type(s); }
192  void set_data_basis_type(int s) { set_basis_type(s); }
193 
194  std::string get_data_type();
195  void set_data_type(const std::string&);
196  void set_data_type(data_info_type);
197 
198  std::string get_container_type();
199  void set_container_type(const std::string&);
200 
201  std::string get_field_name();
202  std::string get_field_type_id();
203  std::string get_field_filename();
204 
205  bool make_nodata();
206  bool make_constantdata();
207  bool make_lineardata();
208  bool make_quadraticdata();
209  bool make_cubicdata();
210 
211  bool make_constantmesh(); // for pointcloud only
212  bool make_linearmesh();
213  bool make_quadraticmesh();
214  bool make_cubicmesh();
215 
216  bool make_char();
217  bool make_unsigned_char();
218  bool make_short();
219  bool make_unsigned_short();
220  bool make_int();
221  bool make_unsigned_int();
222  bool make_long();
223  bool make_unsigned_long();
224  bool make_long_long();
225  bool make_unsigned_long_long();
226  bool make_float();
227  bool make_scalar();
228  bool make_double();
229  bool make_vector();
230  bool make_tensor();
231 
232  bool make_pointcloudmesh();
233  bool make_scanlinemesh();
234  bool make_imagemesh();
235  bool make_latvolmesh();
236  bool make_structcurvemesh();
237  bool make_structquadsurfmesh();
238  bool make_structhexvolmesh();
239  bool make_curvemesh();
240  bool make_trisurfmesh();
241  bool make_quadsurfmesh();
242  bool make_tetvolmesh();
243  bool make_prismvolmesh();
244  bool make_hexvolmesh();
245 
246  bool make_unstructuredmesh();
247  bool make_irregularmesh();
248 
249  bool operator==(const FieldInformation&) const;
250  bool operator!=(const FieldInformation&) const;
251 
252  // testing for the data type
253 
254  inline bool is_data_typeT(char* ) { return (is_char()); }
255  inline bool is_data_typeT(unsigned char* ) { return (is_unsigned_char()); }
256  inline bool is_data_typeT(short* ) { return (is_short()); }
257  inline bool is_data_typeT(unsigned short* ) { return (is_unsigned_short()); }
258  inline bool is_data_typeT(int* ) { return (is_int()); }
259  inline bool is_data_typeT(unsigned int* ) { return (is_unsigned_int()); }
260  inline bool is_data_typeT(long* ) { return (is_long()); }
261  inline bool is_data_typeT(unsigned long* ) { return (is_unsigned_long()); }
262  inline bool is_data_typeT(long long* ) { return (is_longlong()); }
263  inline bool is_data_typeT(unsigned long long* ) { return (is_unsigned_longlong()); }
264  inline bool is_data_typeT(double* ) { return (is_double()); }
265  inline bool is_data_typeT(float* ) { return (is_float()); }
266  inline bool is_data_typeT(Core::Geometry::Vector* ) { return (is_vector()); }
267  inline bool is_data_typeT(Core::Geometry::Tensor* ) { return (is_tensor()); }
268  template<class T> bool is_data_typeT(T*) { return (false); }
269 
270  inline void set_data_typeT(char*) { make_char(); }
271  inline void set_data_typeT(unsigned char*) { make_unsigned_char(); }
272  inline void set_data_typeT(short*) { make_short(); }
273  inline void set_data_typeT(unsigned short*) { make_unsigned_short(); }
274  inline void set_data_typeT(int*) { make_int(); }
275  inline void set_data_typeT(unsigned int*) { make_unsigned_int(); }
276  inline void set_data_typeT(long*) { make_long(); }
277  inline void set_data_typeT(unsigned long*) { make_unsigned_long(); }
278  inline void set_data_typeT(long long*) { make_long_long(); }
279  inline void set_data_typeT(unsigned long long*) { make_unsigned_long_long(); }
280  inline void set_data_typeT(float*) { make_float(); }
281  inline void set_data_typeT(double*) { make_double(); }
282  inline void set_data_typeT(Core::Geometry::Vector*) { make_vector(); }
283  inline void set_data_typeT(Core::Geometry::Tensor*) { make_tensor(); }
284 };
285 
287 
289 
291 { return(info.is_integer()); }
292 
294 { return(info.is_integer()&info2.is_integer()); }
295 
297 { return(info.is_integer()&info2.is_integer()&info3.is_integer()); }
298 
300  FieldInformation &info4)
301 { return(info.is_integer()&info2.is_integer()&info3.is_integer()&info4.is_integer()); }
302 
304  FieldInformation &info4, FieldInformation &info5)
305 { return(info.is_integer()&info2.is_integer()&info3.is_integer()&info4.is_integer()&info5.is_integer()); }
306 
308 { return(info.is_scalar()); }
309 
311 { return(info.is_scalar()&info2.is_scalar()); }
312 
314 { return(info.is_scalar()&info2.is_scalar()&info3.is_scalar()); }
315 
317  FieldInformation &info4)
318 { return(info.is_scalar()&info2.is_scalar()&info3.is_scalar()&info4.is_scalar()); }
319 
321  FieldInformation &info4, FieldInformation &info5)
322 { return(info.is_scalar()&info2.is_scalar()&info3.is_scalar()&info4.is_scalar()&info5.is_scalar()); }
323 
324 
326 { return(info.is_vector()); }
327 
329 { return(info.is_vector()&info2.is_vector()); }
330 
332 { return(info.is_vector()&info2.is_vector()&info3.is_vector()); }
333 
335  FieldInformation &info4)
336 { return(info.is_vector()&info2.is_vector()&info3.is_vector()&info4.is_vector()); }
337 
339  FieldInformation &info4, FieldInformation &info5)
340 { return(info.is_vector()&info2.is_vector()&info3.is_vector()&info4.is_vector()&info5.is_vector()); }
341 
342 
344 { return(info.is_tensor()); }
345 
347 { return(info.is_tensor()&info2.is_tensor()); }
348 
350 { return(info.is_tensor()&info2.is_tensor()&info3.is_tensor()); }
351 
353  FieldInformation &info4)
354 { return(info.is_tensor()&info2.is_tensor()&info3.is_tensor()&info4.is_tensor()); }
355 
357  FieldInformation &info4, FieldInformation &info5)
358 { return(info.is_tensor()&info2.is_tensor()&info3.is_tensor()&info4.is_tensor()&info5.is_tensor()); }
359 
360 } // end namespace
361 
362 #endif
363 
void set_data_typeT(double *)
Definition: FieldInformation.h:281
bool is_data_typeT(unsigned long long *)
Definition: FieldInformation.h:263
bool is_data_typeT(Core::Geometry::Tensor *)
Definition: FieldInformation.h:267
bool UseTensorInterface(FieldInformation &info)
Definition: FieldInformation.h:343
bool is_data_typeT(T *)
Definition: FieldInformation.h:268
Definition: FieldInformation.h:288
std::string field_type
Definition: FieldInformation.h:139
void set_data_typeT(unsigned char *)
Definition: FieldInformation.h:271
bool is_scanline()
Definition: FieldInformation.h:93
std::string mesh_basis_type
Definition: FieldInformation.h:141
void set_data_typeT(long *)
Definition: FieldInformation.h:276
bool is_latvol()
Definition: FieldInformation.h:95
bool is_curve()
Definition: FieldInformation.h:96
void set_data_typeT(unsigned long long *)
Definition: FieldInformation.h:279
std::string data_type
Definition: FieldInformation.h:144
std::string mesh_type
Definition: FieldInformation.h:140
FieldHandle mesh()
Definition: BuildTDCSMatrixTests.cc:56
bool is_integer()
Definition: FieldInformation.cc:780
#define SCISHARE
Definition: share.h:39
bool is_data_typeT(long long *)
Definition: FieldInformation.h:262
void set_data_typeT(unsigned int *)
Definition: FieldInformation.h:275
bool UseVectorInterface(FieldInformation &info)
Definition: FieldInformation.h:325
std::string get_data_basis_type()
Definition: FieldInformation.h:190
bool is_data_typeT(unsigned int *)
Definition: FieldInformation.h:259
void set_data_typeT(short *)
Definition: FieldInformation.h:272
bool UseScalarInterface(FieldInformation &info)
Definition: FieldInformation.h:307
void set_data_typeT(char *)
Definition: FieldInformation.h:270
std::string point_type
Definition: FieldInformation.h:142
void set_data_typeT(unsigned short *)
Definition: FieldInformation.h:273
void set_data_typeT(Core::Geometry::Vector *)
Definition: FieldInformation.h:282
bool is_data_typeT(unsigned short *)
Definition: FieldInformation.h:257
bool is_hexvol()
Definition: FieldInformation.h:101
bool is_data_typeT(long *)
Definition: FieldInformation.h:260
Definition: Vector.h:63
bool is_trisurf()
Definition: FieldInformation.h:97
databasis_info_type
Definition: Types.h:67
meshbasis_info_type
Definition: Types.h:76
void set_data_basis_type(int s)
Definition: FieldInformation.h:192
void set_data_typeT(int *)
Definition: FieldInformation.h:274
bool operator==(const SparseSparseElement &s1, const SparseSparseElement &s2)
Definition: SparseMatrixFunctions.cc:104
Definition: Exception.h:46
bool is_tensor()
Definition: FieldInformation.cc:762
mesh_info_type
Definition: Types.h:50
bool operator!=(const GenericIEPluginInterface< Data > &lhs, const GenericIEPluginInterface< Data > &rhs)
Definition: GenericIEPlugin.h:65
bool is_data_typeT(double *)
Definition: FieldInformation.h:264
dictionary data
Definition: eabLatVolData.py:11
bool is_data_typeT(unsigned char *)
Definition: FieldInformation.h:255
bool is_data_typeT(int *)
Definition: FieldInformation.h:258
Definition: Tensor.h:65
Definition: Field.h:41
data_info_type
Definition: Types.h:83
bool is_prismvol()
Definition: FieldInformation.h:100
bool is_structcurve()
Definition: FieldInformation.h:102
Definition: FieldInformation.h:43
bool is_image()
Definition: FieldInformation.h:94
bool UseIntegerInterface(FieldInformation &info)
Definition: FieldInformation.h:290
void set_data_typeT(Core::Geometry::Tensor *)
Definition: FieldInformation.h:283
bool is_structhexvol()
Definition: FieldInformation.h:104
void set_data_basis_type(const std::string &s)
Definition: FieldInformation.h:191
Definition: FieldInformation.h:286
void set_data_typeT(long long *)
Definition: FieldInformation.h:278
bool is_data_typeT(short *)
Definition: FieldInformation.h:256
bool is_pointcloud()
Definition: FieldInformation.h:92
bool is_structquadsurf()
Definition: FieldInformation.h:103
boost::shared_ptr< Field > FieldHandle
Definition: DatatypeFwd.h:65
bool is_data_typeT(unsigned long *)
Definition: FieldInformation.h:261
bool is_tetvol()
Definition: FieldInformation.h:99
bool is_scalar()
Definition: FieldInformation.cc:774
bool is_data_typeT(float *)
Definition: FieldInformation.h:265
bool is_vector()
Definition: FieldInformation.cc:768
bool is_data_typeT(Core::Geometry::Vector *)
Definition: FieldInformation.h:266
void set_data_typeT(unsigned long *)
Definition: FieldInformation.h:277
bool is_scalar()
Definition: builtin.h:105
std::string basis_type
Definition: FieldInformation.h:143
Definition: FieldInformation.h:150
std::string container_type
Definition: FieldInformation.h:145
bool is_data_typeT(char *)
Definition: FieldInformation.h:254
bool is_quadsurf()
Definition: FieldInformation.h:98
void set_data_typeT(float *)
Definition: FieldInformation.h:280