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

Annotation of /trunk/escript/src/DataConstant.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (14 years, 11 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataConstant.h
File MIME type: text/plain
File size: 4600 byte(s)
Initial revision

1 jgs 82 /*
2     ******************************************************************************
3     * *
4     * COPYRIGHT ACcESS 2004 - All Rights Reserved *
5     * *
6     * This software is the property of ACcESS. No part of this code *
7     * may be copied in any form or by any means without the expressed written *
8     * consent of ACcESS. Copying, use or modification of this software *
9     * by any unauthorised person is illegal unless that person has a software *
10     * license agreement with ACcESS. *
11     * *
12     ******************************************************************************
13     */
14    
15     #if !defined escript_DataConstant_20040323_H
16     #define escript_DataConstant_20040323_H
17    
18     #include "escript/Data/DataAbstract.h"
19     #include "escript/Data/DataArray.h"
20     #include "escript/Data/DataArrayView.h"
21    
22     #include <boost/python/numeric.hpp>
23    
24     namespace escript {
25     /**
26     \brief
27     DataConstant stores single data point which represents the entire
28     function space.
29    
30     Description:
31     DataConstant stores single data point which represents the entire
32     function space.
33     */
34     class DataConstant:public DataAbstract {
35    
36     public:
37    
38     /**
39     \brief
40     Default constructor for DataConstant
41    
42     Description:
43     Default constructor for DataConstant
44    
45     \param value Input - Data value for a single point.
46     \param noSamples Input - number of samples.
47     \param noDataPointsPerSample Input - Input.
48     \param what Input - A description of what this data represents.
49    
50     */
51     DataConstant(const boost::python::numeric::array& value, const FunctionSpace& what);
52     /**
53     \brief
54     Copy constructor. Performs a deep copy.
55     */
56     DataConstant(const DataConstant& other);
57     /**
58     \brief
59     Alternative constructor for DataConstant
60    
61     Description:
62     Alternative Constructor for DataConstant
63     \param value Input - Data value for a single point.
64     \param noSamples Input - number of samples.
65     \param noDataPointsPerSample Input - Input.
66     \param what Input - A description of what this data represents.
67     */
68     DataConstant(const DataArrayView& value, const FunctionSpace& what);
69     /**
70     \brief
71     Alternative constructor for DataConstant
72    
73     Description:
74     Alternative Constructor for DataConstant
75     \param other Input - Other DataConstant
76     \param region Input - region to copy
77     */
78     DataConstant(const DataConstant& other, const DataArrayView::RegionType& region);
79     /**
80     \brief
81     Write the data as a string.
82     */
83     std::string toString() const;
84     /**
85     \brief
86     Return the offset for the given sample. This is somewhat artificial notion
87     but returns the offset in bytes for the given point into the container
88     holding the point data. Only really necessary to avoid many DataArrayView
89     objects.
90     \param sampleNo - Input, sample number.
91     \param dataPointNo - Input, data point number for the sample.
92     */
93     virtual DataArrayView::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const;
94     /**
95     \brief
96     Return a view into the data for the data point specified.
97     NOTE: Construction of the DataArrayView is a relatively expensive
98     operation
99     \param sampleNo Input
100     \param dataPointNo Input
101     */
102     virtual DataArrayView getDataPoint(int sampleNo, int dataPointNo);
103     /**
104     \brief
105     Return the number of doubles stored for the Data
106     */
107     virtual ValueType::size_type getLength() const;
108     /**
109     \brief
110     Factory method that returns a newly created DataConstant.
111     The caller is reponsible for managing the object created.
112     */
113     virtual DataAbstract* getSlice(const DataArrayView::RegionType& region) const; /**
114     \brief
115     Copy the specified region from the given value.
116     \param value Input - Data to copy from
117     \param region Input - Region to copy.
118     */
119     virtual void setSlice(const DataAbstract* value, const DataArrayView::RegionType& region);
120     /**
121     \brief
122     Reshape the data point if the data point is currently rank 0.
123     The original data point value is used for all values of the new
124     data point.
125     */
126     void reshapeDataPoint(const DataArrayView::ShapeType& shape);
127     protected:
128    
129     private:
130     //
131     // data
132     DataArrayView::ValueType m_data;
133     };
134    
135     } // end of namespace
136     #endif
137    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26