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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 950 - (show annotations)
Tue Feb 6 07:01:11 2007 UTC (12 years, 9 months ago) by gross
File MIME type: text/plain
File size: 3139 byte(s)
escript data objects can now be saved to netCDF files, see http://www.unidata.ucar.edu/software/netcdf/.
Currently only constant data are implemented with expanded and tagged data to follow.
There are two new functions to dump a data object

   s=Data(...)
   s.dump(<filename>)

and to recover it

   s=load(<filename>, domain)

Notice that the function space of s is recovered but domain is still need. 

dump and load will replace archive and extract.

The installation needs now the netCDF installed. 


1 // $Id$
2 /*
3 ************************************************************
4 * Copyright 2006 by ACcESS MNRF *
5 * *
6 * http://www.access.edu.au *
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 ************************************************************
12 */
13
14 #if !defined escript_DataFactory_20040721_H
15 #define escript_DataFactory_20040721_H
16 #include "system_dep.h"
17
18 #include "AbstractDomain.h"
19 #include "FunctionSpace.h"
20 #include "Data.h"
21
22 #include <boost/python/object.hpp>
23
24 namespace escript {
25
26 /**
27 \brief
28 A collection of factory functions for creating Data objects which contain
29 data points of various shapes.
30 */
31
32 /**
33 \brief
34 Return a Data object containing scalar data-points.
35 ie: rank 0 data-points.
36 \param value - Input - Single value applied to all Data.
37 \param what - Input - A description of what this data represents.
38 \param expanded - Input - if true fill the entire container with
39 the value. Otherwise a more efficient storage
40 mechanism will be used.
41 */
42 ESCRIPT_DLL_API Data
43 Scalar(double value,
44 const FunctionSpace& what=FunctionSpace(),
45 bool expanded=false);
46
47 /**
48 \brief
49 Return a Data object containing vector data-points.
50 ie: rank 1 data-points.
51 */
52 ESCRIPT_DLL_API Data
53 Vector(double value,
54 const FunctionSpace& what=FunctionSpace(),
55 bool expanded=false);
56
57 /**
58 \brief
59 Return a Data object containing tensor datapoints.
60 ie: rank 2 data-points.
61 */
62 ESCRIPT_DLL_API Data
63 Tensor(double value,
64 const FunctionSpace& what=FunctionSpace(),
65 bool expanded=false);
66
67 /**
68 \brief
69 Return a Data object containing tensor3 datapoints.
70 ie: rank 3 data-points.
71 */
72 ESCRIPT_DLL_API Data
73 Tensor3(double value,
74 const FunctionSpace& what=FunctionSpace(),
75 bool expanded=false);
76
77 /**
78 \brief
79 Return a Data object containing tensor4 datapoints.
80 ie: rank 4 data-points.
81 */
82 ESCRIPT_DLL_API Data
83 Tensor4(double value,
84 const FunctionSpace& what=FunctionSpace(),
85 bool expanded=false);
86 /**
87 \brief
88 reads Data on domain from file in netCDF format
89 */
90 ESCRIPT_DLL_API Data
91 load(const std::string fileName,
92 const AbstractDomain& domain);
93
94 /**
95 \brief
96 Tries to convert value into a Data object on FunctionSpace what.
97 If value is already a Data object, the object is returned if it is defined on what otherwise
98 interpolated data of values are returned. If value is not a data object it is tried to generate
99 the corresponding data object. escript::DataEmpty() is returned if value is identified as empty.
100 */
101 ESCRIPT_DLL_API Data
102 convertToData(const boost::python::object& value,
103 const FunctionSpace& what=FunctionSpace());
104
105 } // end of namespace
106
107 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26