SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Field.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 
29 
30 
31 #ifndef CORE_DATATYPES_LEGACY_FIELD_H
32 #define CORE_DATATYPES_LEGACY_FIELD_H 1
33 
38 
39 namespace SCIRun {
40 
42 {
43  public:
44  Field();
45  Field(const Field& copy);
46  virtual ~Field();
47 
48  /// Clone field will generate a pointer to a new copy
49  virtual Field* clone() const = 0;
50 
51  virtual Field* deep_clone() const = 0;
52 
53  /// Get pointers to associated structures
54  /// mesh -> handle to mesh
55  /// vmesh -> handle to virtual mesh interface
56  /// vfield -> handle to virtual field interface
57  virtual MeshHandle mesh() const = 0;
58 
59  virtual VMesh* vmesh() const = 0;
60  virtual VField* vfield() const = 0;
61 
62 #ifdef SCIRUN4_CODE_TO_BE_ENABLED_LATER
63  /// Detach the mesh from the field, if needed make a new copy of it.
64  virtual void mesh_detach() = 0;
65 #endif
66  /// The order of the field: we could get this one from the type_description
67  virtual int basis_order() const = 0;
68 
69  /// Type Description to retrieve information on the actual type of the field
70  enum td_info_e {
75  FDATA_TD_E
76  };
77 
78  virtual const TypeDescription* get_type_description(td_info_e td = FULL_TD_E) const = 0;
79 
80  /// Persistent I/O.
82  virtual void io(Piostream &stream);
83  virtual std::string type_name() const;
84 };
85 
86 
88  public:
89  // Constructor
90  FieldTypeID(const std::string& type,
91  FieldHandle (*field_maker)(),
92  FieldHandle (*field_maker_mesh)(MeshHandle));
93 
94  std::string type;
95  FieldHandle (*field_maker)();
96  FieldHandle (*field_maker_mesh)(MeshHandle);
97 };
98 
99 SCISHARE FieldHandle CreateField(const std::string& type);
100 SCISHARE FieldHandle CreateField(const std::string& type,MeshHandle mesh);
101 
102 SCISHARE FieldHandle CreateField(const std::string& meshtype, const std::string& basistype, const std::string& datatype);
103 SCISHARE FieldHandle CreateField(const std::string& meshtype, const std::string& meshbasistype, const std::string& databasistype, const std::string& datatype);
104 
106  meshbasis_info_type meshbasis,
107  databasis_info_type databasis,
109 
111  databasis_info_type databasis,
113 
116 
117 class SCISHARE NullField : public Field
118 {
119 public:
120  explicit NullField(const std::string& name = "null") : Field() {}
121  virtual Field* clone() const { return 0; }
122  virtual Field* deep_clone() const { return 0; }
123  virtual MeshHandle mesh() const { return MeshHandle(); }
124  virtual VMesh* vmesh() const { return 0; }
125  virtual VField* vfield() const { return 0; }
126  virtual int basis_order() const { return 0; }
127  virtual const TypeDescription* get_type_description(td_info_e td) const { return 0; }
128 };
129 
130 }
131 
132 #endif
133 
Definition: Field.h:73
static PersistentTypeID type_id
Persistent I/O.
Definition: Field.h:81
SCISHARE FieldHandle CreateField(const std::string &type)
Definition: Field.cc:189
virtual VMesh * vmesh() const
Definition: Field.h:124
Definition: Persistent.h:89
NullField(const std::string &name="null")
Definition: Field.h:120
std::string type
Definition: Field.h:94
FieldHandle mesh()
Definition: BuildTDCSMatrixTests.cc:56
Definition: TypeDescription.h:45
#define SCISHARE
Definition: share.h:39
boost::shared_ptr< Mesh > MeshHandle
Definition: DatatypeFwd.h:67
Definition: Datatype.h:41
databasis_info_type
Definition: Types.h:67
meshbasis_info_type
Definition: Types.h:76
virtual const TypeDescription * get_type_description(td_info_e td) const
Definition: Field.h:127
const char * name[]
Definition: BoostGraphExampleTests.cc:87
mesh_info_type
Definition: Types.h:50
Definition: Field.h:117
dictionary data
Definition: eabLatVolData.py:11
Definition: Field.h:41
data_info_type
Definition: Types.h:83
Definition: Field.h:71
Definition: Field.h:74
virtual int basis_order() const
The order of the field: we could get this one from the type_description.
Definition: Field.h:126
virtual Field * deep_clone() const
Definition: Field.h:122
boost::shared_ptr< Field > FieldHandle
Definition: DatatypeFwd.h:65
virtual VField * vfield() const
Definition: Field.h:125
Definition: Field.h:87
Definition: Persistent.h:64
Definition: VField.h:46
Definition: Field.h:72
Definition: PropertyManagerExtensions.h:43
Definition: VMesh.h:53
virtual Field * clone() const
Clone field will generate a pointer to a new copy.
Definition: Field.h:121
virtual MeshHandle mesh() const
Definition: Field.h:123
Definition: FieldInformation.h:150
td_info_e
Type Description to retrieve information on the actual type of the field.
Definition: Field.h:70
const TypeDescription * get_type_description(Core::Basis::ConstantBasis< T > *)
Definition: Constant.h:209