/[escript]/trunk/escript/src/DataFactory.h
ViewVC logotype

Contents of /trunk/escript/src/DataFactory.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3981 - (show annotations)
Fri Sep 21 02:47:54 2012 UTC (6 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 3957 byte(s)
First pass of updating copyright notices
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2012 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 #if !defined escript_DataFactory_20040721_H
18 #define escript_DataFactory_20040721_H
19
20 #ifdef BADPYTHONMACROS
21 // This hack is required for BSD/OSX builds with python 2.7
22 // (and possibly others). It must be the first include.
23 // From bug reports online it seems that python redefines
24 // some c macros that are functions in c++.
25 // c++ doesn't like that!
26 #include <Python.h>
27 #undef BADPYTHONMACROS
28 #endif
29
30
31 #include "system_dep.h"
32
33 #include "AbstractDomain.h"
34 #include "FunctionSpace.h"
35 #include "Data.h"
36
37 #include <boost/python/object.hpp>
38
39 namespace escript {
40
41 /**
42 \brief
43 A collection of factory functions for creating Data objects which contain
44 data points of various shapes.
45 */
46
47 /**
48 \brief
49 Return a Data object containing scalar data-points.
50 ie: rank 0 data-points.
51 \param value - Input - Single value applied to all Data.
52 \param what - Input - A description of what this data represents.
53 \param expanded - Input - if true fill the entire container with
54 the value. Otherwise a more efficient storage
55 mechanism will be used.
56 */
57 ESCRIPT_DLL_API Data
58 Scalar(double value,
59 const FunctionSpace& what=FunctionSpace(),
60 bool expanded=false);
61
62 /**
63 \brief
64 Return a Data object containing vector data-points.
65 ie: rank 1 data-points.
66 */
67 ESCRIPT_DLL_API Data
68 Vector(double value,
69 const FunctionSpace& what=FunctionSpace(),
70 bool expanded=false);
71
72 ESCRIPT_DLL_API
73 Data
74 VectorFromObj(boost::python::object o,
75 const FunctionSpace& what=FunctionSpace(),
76 bool expanded=false);
77
78 /**
79 \brief
80 Return a Data object containing tensor datapoints.
81 ie: rank 2 data-points.
82 */
83 ESCRIPT_DLL_API Data
84 Tensor(double value,
85 const FunctionSpace& what=FunctionSpace(),
86 bool expanded=false);
87
88 ESCRIPT_DLL_API
89 Data
90 TensorFromObj(boost::python::object o,
91 const FunctionSpace& what=FunctionSpace(),
92 bool expanded=false);
93 /**
94 \brief
95 Return a Data object containing tensor3 datapoints.
96 ie: rank 3 data-points.
97 */
98 ESCRIPT_DLL_API Data
99 Tensor3(double value,
100 const FunctionSpace& what=FunctionSpace(),
101 bool expanded=false);
102
103 ESCRIPT_DLL_API
104 Data
105 Tensor3FromObj(boost::python::object o,
106 const FunctionSpace& what=FunctionSpace(),
107 bool expanded=false);
108
109 /**
110 \brief
111 Return a Data object containing tensor4 datapoints.
112 ie: rank 4 data-points.
113 */
114 ESCRIPT_DLL_API Data
115 Tensor4(double value,
116 const FunctionSpace& what=FunctionSpace(),
117 bool expanded=false);
118
119 ESCRIPT_DLL_API
120 Data
121 Tensor4FromObj(boost::python::object o,
122 const FunctionSpace& what=FunctionSpace(),
123 bool expanded=false);
124
125 /**
126 \brief
127 reads Data on domain from file in netCDF format
128 */
129 ESCRIPT_DLL_API Data
130 load(const std::string fileName,
131 const AbstractDomain& domain);
132 /**
133 \brief
134 returns true if the load funtion is configured.
135 */
136 ESCRIPT_DLL_API bool
137 loadConfigured();
138
139 /**
140 \brief
141 Tries to convert value into a Data object on FunctionSpace what.
142 If value is already a Data object, the object is returned if it is defined on what otherwise
143 interpolated data of values are returned. If value is not a data object it is tried to generate
144 the corresponding data object. escript::DataEmpty() is returned if value is identified as empty.
145 */
146 ESCRIPT_DLL_API Data
147 convertToData(const boost::python::object& value,
148 const FunctionSpace& what=FunctionSpace());
149
150
151 } // end of namespace
152
153 #endif

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26