1 |
// $Id$ |
// $Id$ |
2 |
/* |
/* |
3 |
****************************************************************************** |
************************************************************ |
4 |
* * |
* Copyright 2006 by ACcESS MNRF * |
5 |
* COPYRIGHT ACcESS 2004 - All Rights Reserved * |
* * |
6 |
* * |
* http://www.access.edu.au * |
7 |
* This software is the property of ACcESS. No part of this code * |
* Primary Business: Queensland, Australia * |
8 |
* may be copied in any form or by any means without the expressed written * |
* Licensed under the Open Software License version 3.0 * |
9 |
* consent of ACcESS. Copying, use or modification of this software * |
* http://www.opensource.org/licenses/osl-3.0.php * |
10 |
* by any unauthorised person is illegal unless that * |
* * |
11 |
* person has a software license agreement with ACcESS. * |
************************************************************ |
|
* * |
|
|
****************************************************************************** |
|
12 |
*/ |
*/ |
13 |
|
|
14 |
/** \file Data.h */ |
/** \file Data.h */ |
15 |
|
|
16 |
#ifndef DATA_H |
#ifndef DATA_H |
17 |
#define DATA_H |
#define DATA_H |
18 |
|
#include "system_dep.h" |
19 |
|
|
20 |
#include "escript/Data/DataAbstract.h" |
#include "DataAbstract.h" |
21 |
#include "escript/Data/DataTagged.h" |
#include "DataAlgorithm.h" |
22 |
#include "escript/Data/DataAlgorithm.h" |
#include "FunctionSpace.h" |
23 |
#include "escript/Data/FunctionSpace.h" |
#include "BinaryOp.h" |
24 |
#include "escript/Data/BinaryOp.h" |
#include "UnaryOp.h" |
25 |
#include "escript/Data/UnaryOp.h" |
#include "DataException.h" |
|
#include "escript/Data/DataException.h" |
|
26 |
|
|
27 |
extern "C" { |
extern "C" { |
28 |
#include "escript/Data/DataC.h" |
#include "DataC.h" |
29 |
|
#include "paso/Paso.h" |
30 |
} |
} |
31 |
|
|
|
#include <iostream> |
|
32 |
#include <string> |
#include <string> |
|
#include <memory> |
|
33 |
#include <algorithm> |
#include <algorithm> |
34 |
|
|
35 |
#include <boost/shared_ptr.hpp> |
#include <boost/shared_ptr.hpp> |
36 |
#include <boost/python/object.hpp> |
#include <boost/python/object.hpp> |
|
#include <boost/python/list.hpp> |
|
37 |
#include <boost/python/tuple.hpp> |
#include <boost/python/tuple.hpp> |
38 |
#include <boost/python/numeric.hpp> |
#include <boost/python/numeric.hpp> |
39 |
|
|
41 |
|
|
42 |
// |
// |
43 |
// Forward declaration for various implementations of Data. |
// Forward declaration for various implementations of Data. |
|
class DataEmpty; |
|
44 |
class DataConstant; |
class DataConstant; |
45 |
class DataTagged; |
class DataTagged; |
46 |
class DataExpanded; |
class DataExpanded; |
75 |
Default constructor. |
Default constructor. |
76 |
Creates a DataEmpty object. |
Creates a DataEmpty object. |
77 |
*/ |
*/ |
78 |
|
ESCRIPT_DLL_API |
79 |
Data(); |
Data(); |
80 |
|
|
81 |
/** |
/** |
83 |
Copy constructor. |
Copy constructor. |
84 |
WARNING: Only performs a shallow copy. |
WARNING: Only performs a shallow copy. |
85 |
*/ |
*/ |
86 |
|
ESCRIPT_DLL_API |
87 |
Data(const Data& inData); |
Data(const Data& inData); |
88 |
|
|
89 |
/** |
/** |
92 |
function space of inData the inData are tried to be interpolated to what, |
function space of inData the inData are tried to be interpolated to what, |
93 |
otherwise a shallow copy of inData is returned. |
otherwise a shallow copy of inData is returned. |
94 |
*/ |
*/ |
95 |
|
ESCRIPT_DLL_API |
96 |
Data(const Data& inData, |
Data(const Data& inData, |
97 |
const FunctionSpace& what); |
const FunctionSpace& what); |
98 |
|
|
106 |
the value. Otherwise a more efficient storage |
the value. Otherwise a more efficient storage |
107 |
mechanism will be used. |
mechanism will be used. |
108 |
*/ |
*/ |
109 |
|
ESCRIPT_DLL_API |
110 |
Data(const DataArrayView& value, |
Data(const DataArrayView& value, |
111 |
const FunctionSpace& what=FunctionSpace(), |
const FunctionSpace& what=FunctionSpace(), |
112 |
bool expanded=false); |
bool expanded=false); |
122 |
the given value. Otherwise a more efficient storage |
the given value. Otherwise a more efficient storage |
123 |
mechanism will be used. |
mechanism will be used. |
124 |
*/ |
*/ |
125 |
|
ESCRIPT_DLL_API |
126 |
Data(double value, |
Data(double value, |
127 |
const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(), |
const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(), |
128 |
const FunctionSpace& what=FunctionSpace(), |
const FunctionSpace& what=FunctionSpace(), |
135 |
\param inData - Input - Input Data object. |
\param inData - Input - Input Data object. |
136 |
\param region - Input - Region to copy. |
\param region - Input - Region to copy. |
137 |
*/ |
*/ |
138 |
|
ESCRIPT_DLL_API |
139 |
Data(const Data& inData, |
Data(const Data& inData, |
140 |
const DataArrayView::RegionType& region); |
const DataArrayView::RegionType& region); |
141 |
|
|
151 |
\param what - Input - A description of what this data represents. |
\param what - Input - A description of what this data represents. |
152 |
\param expanded - Input - Flag, if true fill the entire container with |
\param expanded - Input - Flag, if true fill the entire container with |
153 |
the appropriate values. |
the appropriate values. |
154 |
|
==>* |
155 |
*/ |
*/ |
156 |
|
ESCRIPT_DLL_API |
157 |
Data(const DataTagged::TagListType& tagKeys, |
Data(const DataTagged::TagListType& tagKeys, |
158 |
const DataTagged::ValueListType& values, |
const DataTagged::ValueListType& values, |
159 |
const DataArrayView& defaultValue, |
const DataArrayView& defaultValue, |
170 |
the value. Otherwise a more efficient storage |
the value. Otherwise a more efficient storage |
171 |
mechanism will be used. |
mechanism will be used. |
172 |
*/ |
*/ |
173 |
|
ESCRIPT_DLL_API |
174 |
Data(const boost::python::numeric::array& value, |
Data(const boost::python::numeric::array& value, |
175 |
const FunctionSpace& what=FunctionSpace(), |
const FunctionSpace& what=FunctionSpace(), |
176 |
bool expanded=false); |
bool expanded=false); |
186 |
the value. Otherwise a more efficient storage |
the value. Otherwise a more efficient storage |
187 |
mechanism will be used. |
mechanism will be used. |
188 |
*/ |
*/ |
189 |
|
ESCRIPT_DLL_API |
190 |
Data(const boost::python::object& value, |
Data(const boost::python::object& value, |
191 |
const FunctionSpace& what=FunctionSpace(), |
const FunctionSpace& what=FunctionSpace(), |
192 |
bool expanded=false); |
bool expanded=false); |
200 |
\param value - Input - Input data. |
\param value - Input - Input data. |
201 |
\param other - Input - contains all other parameters. |
\param other - Input - contains all other parameters. |
202 |
*/ |
*/ |
203 |
|
ESCRIPT_DLL_API |
204 |
Data(const boost::python::object& value, |
Data(const boost::python::object& value, |
205 |
const Data& other); |
const Data& other); |
206 |
|
|
208 |
\brief |
\brief |
209 |
Constructor which creates a DataConstant of "shape" with constant value. |
Constructor which creates a DataConstant of "shape" with constant value. |
210 |
*/ |
*/ |
211 |
|
ESCRIPT_DLL_API |
212 |
Data(double value, |
Data(double value, |
213 |
const boost::python::tuple& shape=boost::python::make_tuple(), |
const boost::python::tuple& shape=boost::python::make_tuple(), |
214 |
const FunctionSpace& what=FunctionSpace(), |
const FunctionSpace& what=FunctionSpace(), |
215 |
bool expanded=false); |
bool expanded=false); |
216 |
|
/** |
217 |
|
\brief |
218 |
|
Destructor |
219 |
|
*/ |
220 |
|
ESCRIPT_DLL_API |
221 |
|
~Data(); |
222 |
|
|
223 |
/** |
/** |
224 |
\brief |
\brief |
225 |
Perform a deep copy. |
Perform a deep copy. |
226 |
*/ |
*/ |
227 |
|
ESCRIPT_DLL_API |
228 |
void |
void |
229 |
copy(const Data& other); |
copy(const Data& other); |
230 |
|
|
236 |
\brief |
\brief |
237 |
Return the values of all data-points as a single python numarray object. |
Return the values of all data-points as a single python numarray object. |
238 |
*/ |
*/ |
239 |
|
ESCRIPT_DLL_API |
240 |
const boost::python::numeric::array |
const boost::python::numeric::array |
241 |
convertToNumArray(); |
convertToNumArray(); |
242 |
|
|
244 |
\brief |
\brief |
245 |
Return the values of all data-points for the given sample as a single python numarray object. |
Return the values of all data-points for the given sample as a single python numarray object. |
246 |
*/ |
*/ |
247 |
|
ESCRIPT_DLL_API |
248 |
const boost::python::numeric::array |
const boost::python::numeric::array |
249 |
convertToNumArrayFromSampleNo(int sampleNo); |
convertToNumArrayFromSampleNo(int sampleNo); |
250 |
|
|
252 |
\brief |
\brief |
253 |
Return the value of the specified data-point as a single python numarray object. |
Return the value of the specified data-point as a single python numarray object. |
254 |
*/ |
*/ |
255 |
|
ESCRIPT_DLL_API |
256 |
const boost::python::numeric::array |
const boost::python::numeric::array |
257 |
convertToNumArrayFromDPNo(int sampleNo, |
convertToNumArrayFromDPNo(int sampleNo, |
258 |
int dataPointNo); |
int dataPointNo); |
261 |
\brief |
\brief |
262 |
Fills the expanded Data object from values of a python numarray object. |
Fills the expanded Data object from values of a python numarray object. |
263 |
*/ |
*/ |
264 |
|
ESCRIPT_DLL_API |
265 |
void |
void |
266 |
fillFromNumArray(const boost::python::numeric::array); |
fillFromNumArray(const boost::python::numeric::array); |
267 |
|
|
272 |
The data-point number here corresponds to the data-point number in the |
The data-point number here corresponds to the data-point number in the |
273 |
numarray returned by convertToNumArray. |
numarray returned by convertToNumArray. |
274 |
*/ |
*/ |
275 |
|
ESCRIPT_DLL_API |
276 |
int |
int |
277 |
getTagNumber(int dpno); |
getTagNumber(int dpno); |
278 |
|
|
280 |
\brief |
\brief |
281 |
Return the C wrapper for the Data object. |
Return the C wrapper for the Data object. |
282 |
*/ |
*/ |
283 |
|
ESCRIPT_DLL_API |
284 |
escriptDataC |
escriptDataC |
285 |
getDataC(); |
getDataC(); |
286 |
|
|
288 |
\brief |
\brief |
289 |
Return the C wrapper for the Data object - const version. |
Return the C wrapper for the Data object - const version. |
290 |
*/ |
*/ |
291 |
|
ESCRIPT_DLL_API |
292 |
escriptDataC |
escriptDataC |
293 |
getDataC() const; |
getDataC() const; |
294 |
|
|
296 |
\brief |
\brief |
297 |
Write the data as a string. |
Write the data as a string. |
298 |
*/ |
*/ |
299 |
|
ESCRIPT_DLL_API |
300 |
inline |
inline |
301 |
std::string |
std::string |
302 |
toString() const |
toString() const |
310 |
the shape information for each data point although it also may be used |
the shape information for each data point although it also may be used |
311 |
to manipulate the point data. |
to manipulate the point data. |
312 |
*/ |
*/ |
313 |
|
ESCRIPT_DLL_API |
314 |
inline |
inline |
315 |
const DataArrayView& |
const DataArrayView& |
316 |
getPointDataView() const |
getPointDataView() const |
322 |
\brief |
\brief |
323 |
Whatever the current Data type make this into a DataExpanded. |
Whatever the current Data type make this into a DataExpanded. |
324 |
*/ |
*/ |
325 |
|
ESCRIPT_DLL_API |
326 |
void |
void |
327 |
expand(); |
expand(); |
328 |
|
|
331 |
If possible convert this Data to DataTagged. This will only allow |
If possible convert this Data to DataTagged. This will only allow |
332 |
Constant data to be converted to tagged. An attempt to convert |
Constant data to be converted to tagged. An attempt to convert |
333 |
Expanded data to tagged will throw an exception. |
Expanded data to tagged will throw an exception. |
334 |
|
==>* |
335 |
*/ |
*/ |
336 |
|
ESCRIPT_DLL_API |
337 |
void |
void |
338 |
tag(); |
tag(); |
339 |
|
|
341 |
\brief |
\brief |
342 |
Return true if this Data is expanded. |
Return true if this Data is expanded. |
343 |
*/ |
*/ |
344 |
|
ESCRIPT_DLL_API |
345 |
bool |
bool |
346 |
isExpanded() const; |
isExpanded() const; |
347 |
|
|
349 |
\brief |
\brief |
350 |
Return true if this Data is tagged. |
Return true if this Data is tagged. |
351 |
*/ |
*/ |
352 |
|
ESCRIPT_DLL_API |
353 |
bool |
bool |
354 |
isTagged() const; |
isTagged() const; |
355 |
|
|
357 |
\brief |
\brief |
358 |
Return true if this Data is constant. |
Return true if this Data is constant. |
359 |
*/ |
*/ |
360 |
|
ESCRIPT_DLL_API |
361 |
bool |
bool |
362 |
isConstant() const; |
isConstant() const; |
363 |
|
|
365 |
\brief |
\brief |
366 |
Return true if this Data is empty. |
Return true if this Data is empty. |
367 |
*/ |
*/ |
368 |
|
ESCRIPT_DLL_API |
369 |
bool |
bool |
370 |
isEmpty() const; |
isEmpty() const; |
371 |
|
|
373 |
\brief |
\brief |
374 |
Return the function space. |
Return the function space. |
375 |
*/ |
*/ |
376 |
|
ESCRIPT_DLL_API |
377 |
inline |
inline |
378 |
const FunctionSpace& |
const FunctionSpace& |
379 |
getFunctionSpace() const |
getFunctionSpace() const |
385 |
\brief |
\brief |
386 |
Return a copy of the function space. |
Return a copy of the function space. |
387 |
*/ |
*/ |
388 |
|
ESCRIPT_DLL_API |
389 |
const FunctionSpace |
const FunctionSpace |
390 |
getCopyOfFunctionSpace() const; |
getCopyOfFunctionSpace() const; |
391 |
|
|
393 |
\brief |
\brief |
394 |
Return the domain. |
Return the domain. |
395 |
*/ |
*/ |
396 |
|
ESCRIPT_DLL_API |
397 |
inline |
inline |
398 |
const AbstractDomain& |
const AbstractDomain& |
399 |
getDomain() const |
getDomain() const |
405 |
\brief |
\brief |
406 |
Return a copy of the domain. |
Return a copy of the domain. |
407 |
*/ |
*/ |
408 |
|
ESCRIPT_DLL_API |
409 |
const AbstractDomain |
const AbstractDomain |
410 |
getCopyOfDomain() const; |
getCopyOfDomain() const; |
411 |
|
|
413 |
\brief |
\brief |
414 |
Return the rank of the point data. |
Return the rank of the point data. |
415 |
*/ |
*/ |
416 |
|
ESCRIPT_DLL_API |
417 |
inline |
inline |
418 |
int |
int |
419 |
getDataPointRank() const |
getDataPointRank() const |
425 |
\brief |
\brief |
426 |
Return the number of samples. |
Return the number of samples. |
427 |
*/ |
*/ |
428 |
|
ESCRIPT_DLL_API |
429 |
inline |
inline |
430 |
int |
int |
431 |
getNumSamples() const |
getNumSamples() const |
437 |
\brief |
\brief |
438 |
Return the number of data points per sample. |
Return the number of data points per sample. |
439 |
*/ |
*/ |
440 |
|
ESCRIPT_DLL_API |
441 |
inline |
inline |
442 |
int |
int |
443 |
getNumDataPointsPerSample() const |
getNumDataPointsPerSample() const |
451 |
preferred interface but is provided for use by C code. |
preferred interface but is provided for use by C code. |
452 |
\param sampleNo - Input - the given sample no. |
\param sampleNo - Input - the given sample no. |
453 |
*/ |
*/ |
454 |
|
ESCRIPT_DLL_API |
455 |
inline |
inline |
456 |
DataAbstract::ValueType::value_type* |
DataAbstract::ValueType::value_type* |
457 |
getSampleData(DataAbstract::ValueType::size_type sampleNo) |
getSampleData(DataAbstract::ValueType::size_type sampleNo) |
465 |
access data that isn't tagged an exception will be thrown. |
access data that isn't tagged an exception will be thrown. |
466 |
\param tag - Input - the tag key. |
\param tag - Input - the tag key. |
467 |
*/ |
*/ |
468 |
|
ESCRIPT_DLL_API |
469 |
inline |
inline |
470 |
DataAbstract::ValueType::value_type* |
DataAbstract::ValueType::value_type* |
471 |
getSampleDataByTag(int tag) |
getSampleDataByTag(int tag) |
489 |
\param value - Input - value to assign to data-points associated with |
\param value - Input - value to assign to data-points associated with |
490 |
the given reference number. |
the given reference number. |
491 |
*/ |
*/ |
492 |
|
ESCRIPT_DLL_API |
493 |
void |
void |
494 |
setRefValue(int ref, |
setRefValue(int ref, |
495 |
const boost::python::numeric::array& value); |
const boost::python::numeric::array& value); |
509 |
\param value - Output - object to receive values from data-points |
\param value - Output - object to receive values from data-points |
510 |
associated with the given reference number. |
associated with the given reference number. |
511 |
*/ |
*/ |
512 |
|
ESCRIPT_DLL_API |
513 |
void |
void |
514 |
getRefValue(int ref, |
getRefValue(int ref, |
515 |
boost::python::numeric::array& value); |
boost::python::numeric::array& value); |
522 |
\param sampleNo - Input - |
\param sampleNo - Input - |
523 |
\param dataPointNo - Input - |
\param dataPointNo - Input - |
524 |
*/ |
*/ |
525 |
|
ESCRIPT_DLL_API |
526 |
inline |
inline |
527 |
DataArrayView |
DataArrayView |
528 |
getDataPoint(int sampleNo, |
getDataPoint(int sampleNo, |
535 |
\brief |
\brief |
536 |
Return a reference to the data point shape. |
Return a reference to the data point shape. |
537 |
*/ |
*/ |
538 |
|
ESCRIPT_DLL_API |
539 |
const DataArrayView::ShapeType& |
const DataArrayView::ShapeType& |
540 |
getDataPointShape() const; |
getDataPointShape() const; |
541 |
|
|
543 |
\brief |
\brief |
544 |
Return the data point shape as a tuple of integers. |
Return the data point shape as a tuple of integers. |
545 |
*/ |
*/ |
546 |
|
ESCRIPT_DLL_API |
547 |
const boost::python::tuple |
const boost::python::tuple |
548 |
getShapeTuple() const; |
getShapeTuple() const; |
549 |
|
|
552 |
Return the size of the data point. It is the product of the |
Return the size of the data point. It is the product of the |
553 |
data point shape dimensions. |
data point shape dimensions. |
554 |
*/ |
*/ |
555 |
|
ESCRIPT_DLL_API |
556 |
int |
int |
557 |
getDataPointSize() const; |
getDataPointSize() const; |
558 |
|
|
560 |
\brief |
\brief |
561 |
Return the number of doubles stored for this Data. |
Return the number of doubles stored for this Data. |
562 |
*/ |
*/ |
563 |
|
ESCRIPT_DLL_API |
564 |
DataArrayView::ValueType::size_type |
DataArrayView::ValueType::size_type |
565 |
getLength() const; |
getLength() const; |
566 |
|
|
571 |
cannot be converted to a DataTagged object. |
cannot be converted to a DataTagged object. |
572 |
\param tagKey - Input - Integer key. |
\param tagKey - Input - Integer key. |
573 |
\param value - Input - Value to associate with given key. |
\param value - Input - Value to associate with given key. |
574 |
|
==>* |
575 |
*/ |
*/ |
576 |
|
ESCRIPT_DLL_API |
577 |
void |
void |
578 |
setTaggedValue(int tagKey, |
setTaggedValue(int tagKey, |
579 |
const boost::python::object& value); |
const boost::python::object& value); |
585 |
cannot be converted to a DataTagged object. |
cannot be converted to a DataTagged object. |
586 |
\param tagKey - Input - Integer key. |
\param tagKey - Input - Integer key. |
587 |
\param value - Input - Value to associate with given key. |
\param value - Input - Value to associate with given key. |
588 |
|
==>* |
589 |
*/ |
*/ |
590 |
|
ESCRIPT_DLL_API |
591 |
void |
void |
592 |
setTaggedValueFromCPP(int tagKey, |
setTaggedValueFromCPP(int tagKey, |
593 |
const DataArrayView& value); |
const DataArrayView& value); |
596 |
\brief |
\brief |
597 |
Copy other Data object into this Data object where mask is positive. |
Copy other Data object into this Data object where mask is positive. |
598 |
*/ |
*/ |
599 |
|
ESCRIPT_DLL_API |
600 |
void |
void |
601 |
copyWithMask(const Data& other, |
copyWithMask(const Data& other, |
602 |
const Data& mask); |
const Data& mask); |
611 |
the result as a Data object. |
the result as a Data object. |
612 |
* |
* |
613 |
*/ |
*/ |
614 |
|
ESCRIPT_DLL_API |
615 |
Data |
Data |
616 |
interpolate(const FunctionSpace& functionspace) const; |
interpolate(const FunctionSpace& functionspace) const; |
617 |
|
|
621 |
If functionspace is not present the function space of Function(getDomain()) is used. |
If functionspace is not present the function space of Function(getDomain()) is used. |
622 |
* |
* |
623 |
*/ |
*/ |
624 |
|
ESCRIPT_DLL_API |
625 |
Data |
Data |
626 |
gradOn(const FunctionSpace& functionspace) const; |
gradOn(const FunctionSpace& functionspace) const; |
627 |
|
|
628 |
|
ESCRIPT_DLL_API |
629 |
Data |
Data |
630 |
grad() const; |
grad() const; |
631 |
|
|
634 |
Calculate the integral over the function space domain. |
Calculate the integral over the function space domain. |
635 |
* |
* |
636 |
*/ |
*/ |
637 |
|
ESCRIPT_DLL_API |
638 |
boost::python::numeric::array |
boost::python::numeric::array |
639 |
integrate() const; |
integrate() const; |
640 |
|
|
643 |
Return a Data with a 1 for +ive values and a 0 for 0 or -ive values. |
Return a Data with a 1 for +ive values and a 0 for 0 or -ive values. |
644 |
* |
* |
645 |
*/ |
*/ |
646 |
|
ESCRIPT_DLL_API |
647 |
Data |
Data |
648 |
wherePositive() const; |
wherePositive() const; |
649 |
|
|
652 |
Return a Data with a 1 for -ive values and a 0 for +ive or 0 values. |
Return a Data with a 1 for -ive values and a 0 for +ive or 0 values. |
653 |
* |
* |
654 |
*/ |
*/ |
655 |
|
ESCRIPT_DLL_API |
656 |
Data |
Data |
657 |
whereNegative() const; |
whereNegative() const; |
658 |
|
|
661 |
Return a Data with a 1 for +ive or 0 values and a 0 for -ive values. |
Return a Data with a 1 for +ive or 0 values and a 0 for -ive values. |
662 |
* |
* |
663 |
*/ |
*/ |
664 |
|
ESCRIPT_DLL_API |
665 |
Data |
Data |
666 |
whereNonNegative() const; |
whereNonNegative() const; |
667 |
|
|
670 |
Return a Data with a 1 for -ive or 0 values and a 0 for +ive values. |
Return a Data with a 1 for -ive or 0 values and a 0 for +ive values. |
671 |
* |
* |
672 |
*/ |
*/ |
673 |
|
ESCRIPT_DLL_API |
674 |
Data |
Data |
675 |
whereNonPositive() const; |
whereNonPositive() const; |
676 |
|
|
679 |
Return a Data with a 1 for 0 values and a 0 for +ive or -ive values. |
Return a Data with a 1 for 0 values and a 0 for +ive or -ive values. |
680 |
* |
* |
681 |
*/ |
*/ |
682 |
|
ESCRIPT_DLL_API |
683 |
Data |
Data |
684 |
whereZero() const; |
whereZero(double tol=0.0) const; |
685 |
|
|
686 |
/** |
/** |
687 |
\brief |
\brief |
688 |
Return a Data with a 0 for 0 values and a 1 for +ive or -ive values. |
Return a Data with a 0 for 0 values and a 1 for +ive or -ive values. |
689 |
* |
* |
690 |
*/ |
*/ |
691 |
|
ESCRIPT_DLL_API |
692 |
Data |
Data |
693 |
whereNonZero() const; |
whereNonZero(double tol=0.0) const; |
694 |
|
|
695 |
/** |
/** |
696 |
\brief |
\brief |
697 |
Return the maximum absolute value of this Data object. |
Return the maximum absolute value of this Data object. |
698 |
* |
* |
699 |
*/ |
*/ |
700 |
|
ESCRIPT_DLL_API |
701 |
double |
double |
702 |
Lsup() const; |
Lsup() const; |
703 |
|
|
706 |
Return the minimum absolute value of this Data object. |
Return the minimum absolute value of this Data object. |
707 |
* |
* |
708 |
*/ |
*/ |
709 |
|
ESCRIPT_DLL_API |
710 |
double |
double |
711 |
Linf() const; |
Linf() const; |
712 |
|
|
715 |
Return the maximum value of this Data object. |
Return the maximum value of this Data object. |
716 |
* |
* |
717 |
*/ |
*/ |
718 |
|
ESCRIPT_DLL_API |
719 |
double |
double |
720 |
sup() const; |
sup() const; |
721 |
|
|
724 |
Return the minimum value of this Data object. |
Return the minimum value of this Data object. |
725 |
* |
* |
726 |
*/ |
*/ |
727 |
|
ESCRIPT_DLL_API |
728 |
double |
double |
729 |
inf() const; |
inf() const; |
730 |
|
|
733 |
Return the absolute value of each data point of this Data object. |
Return the absolute value of each data point of this Data object. |
734 |
* |
* |
735 |
*/ |
*/ |
736 |
|
ESCRIPT_DLL_API |
737 |
Data |
Data |
738 |
abs() const; |
abs() const; |
739 |
|
|
742 |
Return the maximum value of each data point of this Data object. |
Return the maximum value of each data point of this Data object. |
743 |
* |
* |
744 |
*/ |
*/ |
745 |
|
ESCRIPT_DLL_API |
746 |
Data |
Data |
747 |
maxval() const; |
maxval() const; |
748 |
|
|
751 |
Return the minimum value of each data point of this Data object. |
Return the minimum value of each data point of this Data object. |
752 |
* |
* |
753 |
*/ |
*/ |
754 |
|
ESCRIPT_DLL_API |
755 |
Data |
Data |
756 |
minval() const; |
minval() const; |
757 |
|
|
760 |
Return the (sample number, data-point number) of the data point with |
Return the (sample number, data-point number) of the data point with |
761 |
the minimum value in this Data object. |
the minimum value in this Data object. |
762 |
*/ |
*/ |
763 |
|
ESCRIPT_DLL_API |
764 |
const boost::python::tuple |
const boost::python::tuple |
765 |
mindp() const; |
mindp() const; |
766 |
|
|
767 |
|
ESCRIPT_DLL_API |
768 |
void |
void |
769 |
|
#ifndef PASO_MPI |
770 |
calc_mindp(int& SampleNo, |
calc_mindp(int& SampleNo, |
771 |
int& DataPointNo) const; |
int& DataPointNo) const; |
772 |
|
#else |
773 |
|
calc_mindp(int& ProcNo, |
774 |
|
int& SampleNo, |
775 |
|
int& DataPointNo) const; |
776 |
|
#endif |
777 |
|
/** |
778 |
|
\brief |
779 |
|
Return the sign of each data point of this Data object. |
780 |
|
-1 for negative values, zero for zero values, 1 for positive values. |
781 |
|
* |
782 |
|
*/ |
783 |
|
ESCRIPT_DLL_API |
784 |
|
Data |
785 |
|
sign() const; |
786 |
|
|
787 |
/** |
/** |
788 |
\brief |
\brief |
789 |
Return the length of each data point of this Data object. |
Return the symmetric part of a matrix which is half the matrix plus its transpose. |
|
sqrt(sum(A[i,j,k,l]^2)) |
|
790 |
* |
* |
791 |
*/ |
*/ |
792 |
|
ESCRIPT_DLL_API |
793 |
Data |
Data |
794 |
length() const; |
symmetric() const; |
795 |
|
|
796 |
/** |
/** |
797 |
\brief |
\brief |
798 |
Return the sign of each data point of this Data object. |
Return the nonsymmetric part of a matrix which is half the matrix minus its transpose. |
|
-1 for negative values, zero for zero values, 1 for positive values. |
|
799 |
* |
* |
800 |
*/ |
*/ |
801 |
|
ESCRIPT_DLL_API |
802 |
Data |
Data |
803 |
sign() const; |
nonsymmetric() const; |
804 |
|
|
805 |
|
/** |
806 |
|
\brief |
807 |
|
Return the trace of a matrix |
808 |
|
* |
809 |
|
*/ |
810 |
|
ESCRIPT_DLL_API |
811 |
|
Data |
812 |
|
matrixtrace(int axis_offset) const; |
813 |
|
|
814 |
/** |
/** |
815 |
\brief |
\brief |
816 |
Transpose each data point of this Data object around the given axis. |
Transpose each data point of this Data object around the given axis. |
|
--* not implemented yet *-- |
|
817 |
* |
* |
818 |
*/ |
*/ |
819 |
|
ESCRIPT_DLL_API |
820 |
Data |
Data |
821 |
transpose(int axis) const; |
transpose(int axis_offset) const; |
822 |
|
|
823 |
|
/** |
824 |
|
\brief |
825 |
|
Return the eigenvalues of the symmetric part at each data point of this Data object in increasing values. |
826 |
|
Currently this function is restricted to rank 2, square shape, and dimension 3. |
827 |
|
* |
828 |
|
*/ |
829 |
|
ESCRIPT_DLL_API |
830 |
|
Data |
831 |
|
eigenvalues() const; |
832 |
|
|
833 |
|
/** |
834 |
|
\brief |
835 |
|
Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of this Data object. |
836 |
|
the eigenvalues are ordered in increasing size where eigenvalues with relative difference less than |
837 |
|
tol are treated as equal. The eigenvectors are orthogonal, normalized and the sclaed such that the |
838 |
|
first non-zero entry is positive. |
839 |
|
Currently this function is restricted to rank 2, square shape, and dimension 3 |
840 |
|
* |
841 |
|
*/ |
842 |
|
ESCRIPT_DLL_API |
843 |
|
const boost::python::tuple |
844 |
|
eigenvalues_and_eigenvectors(const double tol=1.e-12) const; |
845 |
|
|
846 |
/** |
/** |
847 |
\brief |
\brief |
848 |
Calculate the trace of each data point of this Data object. |
Calculate the trace of each data point of this Data object. |
|
sum(A[i,i,i,i]) |
|
849 |
* |
* |
850 |
*/ |
*/ |
851 |
|
ESCRIPT_DLL_API |
852 |
Data |
Data |
853 |
trace() const; |
trace() const; |
854 |
|
|
857 |
Return the sin of each data point of this Data object. |
Return the sin of each data point of this Data object. |
858 |
* |
* |
859 |
*/ |
*/ |
860 |
|
ESCRIPT_DLL_API |
861 |
Data |
Data |
862 |
sin() const; |
sin() const; |
863 |
|
|
866 |
Return the cos of each data point of this Data object. |
Return the cos of each data point of this Data object. |
867 |
* |
* |
868 |
*/ |
*/ |
869 |
|
ESCRIPT_DLL_API |
870 |
Data |
Data |
871 |
cos() const; |
cos() const; |
872 |
|
|
875 |
Return the tan of each data point of this Data object. |
Return the tan of each data point of this Data object. |
876 |
* |
* |
877 |
*/ |
*/ |
878 |
|
ESCRIPT_DLL_API |
879 |
Data |
Data |
880 |
tan() const; |
tan() const; |
881 |
|
|
884 |
Return the asin of each data point of this Data object. |
Return the asin of each data point of this Data object. |
885 |
* |
* |
886 |
*/ |
*/ |
887 |
|
ESCRIPT_DLL_API |
888 |
Data |
Data |
889 |
asin() const; |
asin() const; |
890 |
|
|
893 |
Return the acos of each data point of this Data object. |
Return the acos of each data point of this Data object. |
894 |
* |
* |
895 |
*/ |
*/ |
896 |
|
ESCRIPT_DLL_API |
897 |
Data |
Data |
898 |
acos() const; |
acos() const; |
899 |
|
|
902 |
Return the atan of each data point of this Data object. |
Return the atan of each data point of this Data object. |
903 |
* |
* |
904 |
*/ |
*/ |
905 |
|
ESCRIPT_DLL_API |
906 |
Data |
Data |
907 |
atan() const; |
atan() const; |
908 |
|
|
911 |
Return the sinh of each data point of this Data object. |
Return the sinh of each data point of this Data object. |
912 |
* |
* |
913 |
*/ |
*/ |
914 |
|
ESCRIPT_DLL_API |
915 |
Data |
Data |
916 |
sinh() const; |
sinh() const; |
917 |
|
|
920 |
Return the cosh of each data point of this Data object. |
Return the cosh of each data point of this Data object. |
921 |
* |
* |
922 |
*/ |
*/ |
923 |
|
ESCRIPT_DLL_API |
924 |
Data |
Data |
925 |
cosh() const; |
cosh() const; |
926 |
|
|
929 |
Return the tanh of each data point of this Data object. |
Return the tanh of each data point of this Data object. |
930 |
* |
* |
931 |
*/ |
*/ |
932 |
|
ESCRIPT_DLL_API |
933 |
Data |
Data |
934 |
tanh() const; |
tanh() const; |
935 |
|
|
938 |
Return the asinh of each data point of this Data object. |
Return the asinh of each data point of this Data object. |
939 |
* |
* |
940 |
*/ |
*/ |
941 |
|
ESCRIPT_DLL_API |
942 |
Data |
Data |
943 |
asinh() const; |
asinh() const; |
944 |
|
|
947 |
Return the acosh of each data point of this Data object. |
Return the acosh of each data point of this Data object. |
948 |
* |
* |
949 |
*/ |
*/ |
950 |
|
ESCRIPT_DLL_API |
951 |
Data |
Data |
952 |
acosh() const; |
acosh() const; |
953 |
|
|
956 |
Return the atanh of each data point of this Data object. |
Return the atanh of each data point of this Data object. |
957 |
* |
* |
958 |
*/ |
*/ |
959 |
|
ESCRIPT_DLL_API |
960 |
Data |
Data |
961 |
atanh() const; |
atanh() const; |
962 |
|
|
965 |
Return the log to base 10 of each data point of this Data object. |
Return the log to base 10 of each data point of this Data object. |
966 |
* |
* |
967 |
*/ |
*/ |
968 |
|
ESCRIPT_DLL_API |
969 |
Data |
Data |
970 |
log() const; |
log10() const; |
971 |
|
|
972 |
/** |
/** |
973 |
\brief |
\brief |
974 |
Return the natural log of each data point of this Data object. |
Return the natural log of each data point of this Data object. |
975 |
* |
* |
976 |
*/ |
*/ |
977 |
|
ESCRIPT_DLL_API |
978 |
Data |
Data |
979 |
ln() const; |
log() const; |
980 |
|
|
981 |
/** |
/** |
982 |
\brief |
\brief |
983 |
Return the exponential function of each data point of this Data object. |
Return the exponential function of each data point of this Data object. |
984 |
* |
* |
985 |
*/ |
*/ |
986 |
|
ESCRIPT_DLL_API |
987 |
Data |
Data |
988 |
exp() const; |
exp() const; |
989 |
|
|
992 |
Return the square root of each data point of this Data object. |
Return the square root of each data point of this Data object. |
993 |
* |
* |
994 |
*/ |
*/ |
995 |
|
ESCRIPT_DLL_API |
996 |
Data |
Data |
997 |
sqrt() const; |
sqrt() const; |
998 |
|
|
1001 |
Return the negation of each data point of this Data object. |
Return the negation of each data point of this Data object. |
1002 |
* |
* |
1003 |
*/ |
*/ |
1004 |
|
ESCRIPT_DLL_API |
1005 |
Data |
Data |
1006 |
neg() const; |
neg() const; |
1007 |
|
|
1011 |
Simply returns this object unmodified. |
Simply returns this object unmodified. |
1012 |
* |
* |
1013 |
*/ |
*/ |
1014 |
|
ESCRIPT_DLL_API |
1015 |
Data |
Data |
1016 |
pos() const; |
pos() const; |
1017 |
|
|
1022 |
\param right Input - the power to raise the object to. |
\param right Input - the power to raise the object to. |
1023 |
* |
* |
1024 |
*/ |
*/ |
1025 |
|
ESCRIPT_DLL_API |
1026 |
Data |
Data |
1027 |
powD(const Data& right) const; |
powD(const Data& right) const; |
1028 |
|
|
1033 |
\param right Input - the power to raise the object to. |
\param right Input - the power to raise the object to. |
1034 |
* |
* |
1035 |
*/ |
*/ |
1036 |
|
ESCRIPT_DLL_API |
1037 |
Data |
Data |
1038 |
powO(const boost::python::object& right) const; |
powO(const boost::python::object& right) const; |
1039 |
|
|
1040 |
/** |
/** |
1041 |
\brief |
\brief |
1042 |
|
Return the given power of each data point of this boost python object. |
1043 |
|
|
1044 |
|
\param left Input - the bases |
1045 |
|
* |
1046 |
|
*/ |
1047 |
|
|
1048 |
|
ESCRIPT_DLL_API |
1049 |
|
Data |
1050 |
|
rpowO(const boost::python::object& left) const; |
1051 |
|
|
1052 |
|
/** |
1053 |
|
\brief |
1054 |
writes the object to a file in the DX file format |
writes the object to a file in the DX file format |
1055 |
*/ |
*/ |
1056 |
|
ESCRIPT_DLL_API |
1057 |
void |
void |
1058 |
saveDX(std::string fileName) const; |
saveDX(std::string fileName) const; |
1059 |
|
|
1061 |
\brief |
\brief |
1062 |
writes the object to a file in the VTK file format |
writes the object to a file in the VTK file format |
1063 |
*/ |
*/ |
1064 |
|
ESCRIPT_DLL_API |
1065 |
void |
void |
1066 |
saveVTK(std::string fileName) const; |
saveVTK(std::string fileName) const; |
1067 |
|
|
1071 |
\param right - Input - The right hand side. |
\param right - Input - The right hand side. |
1072 |
* |
* |
1073 |
*/ |
*/ |
1074 |
|
ESCRIPT_DLL_API |
1075 |
Data& operator+=(const Data& right); |
Data& operator+=(const Data& right); |
1076 |
|
ESCRIPT_DLL_API |
1077 |
Data& operator+=(const boost::python::object& right); |
Data& operator+=(const boost::python::object& right); |
1078 |
|
|
1079 |
/** |
/** |
1082 |
\param right - Input - The right hand side. |
\param right - Input - The right hand side. |
1083 |
* |
* |
1084 |
*/ |
*/ |
1085 |
|
ESCRIPT_DLL_API |
1086 |
Data& operator-=(const Data& right); |
Data& operator-=(const Data& right); |
1087 |
|
ESCRIPT_DLL_API |
1088 |
Data& operator-=(const boost::python::object& right); |
Data& operator-=(const boost::python::object& right); |
1089 |
|
|
1090 |
/** |
/** |
1093 |
\param right - Input - The right hand side. |
\param right - Input - The right hand side. |
1094 |
* |
* |
1095 |
*/ |
*/ |
1096 |
|
ESCRIPT_DLL_API |
1097 |
Data& operator*=(const Data& right); |
Data& operator*=(const Data& right); |
1098 |
|
ESCRIPT_DLL_API |
1099 |
Data& operator*=(const boost::python::object& right); |
Data& operator*=(const boost::python::object& right); |
1100 |
|
|
1101 |
/** |
/** |
1104 |
\param right - Input - The right hand side. |
\param right - Input - The right hand side. |
1105 |
* |
* |
1106 |
*/ |
*/ |
1107 |
|
ESCRIPT_DLL_API |
1108 |
Data& operator/=(const Data& right); |
Data& operator/=(const Data& right); |
1109 |
|
ESCRIPT_DLL_API |
1110 |
Data& operator/=(const boost::python::object& right); |
Data& operator/=(const boost::python::object& right); |
1111 |
|
|
1112 |
/** |
/** |
1113 |
\brief |
\brief |
1114 |
Returns true if this can be interpolated to functionspace. |
Returns true if this can be interpolated to functionspace. |
1115 |
*/ |
*/ |
1116 |
|
ESCRIPT_DLL_API |
1117 |
bool |
bool |
1118 |
probeInterpolation(const FunctionSpace& functionspace) const; |
probeInterpolation(const FunctionSpace& functionspace) const; |
1119 |
|
|
1132 |
\param key - Input - python slice tuple specifying |
\param key - Input - python slice tuple specifying |
1133 |
slice to return. |
slice to return. |
1134 |
*/ |
*/ |
1135 |
|
ESCRIPT_DLL_API |
1136 |
Data |
Data |
1137 |
getItem(const boost::python::object& key) const; |
getItem(const boost::python::object& key) const; |
1138 |
|
|
1147 |
slice to copy from value. |
slice to copy from value. |
1148 |
\param value - Input - Data object to copy from. |
\param value - Input - Data object to copy from. |
1149 |
*/ |
*/ |
1150 |
|
ESCRIPT_DLL_API |
1151 |
void |
void |
1152 |
setItemD(const boost::python::object& key, |
setItemD(const boost::python::object& key, |
1153 |
const Data& value); |
const Data& value); |
1154 |
|
|
1155 |
|
ESCRIPT_DLL_API |
1156 |
void |
void |
1157 |
setItemO(const boost::python::object& key, |
setItemO(const boost::python::object& key, |
1158 |
const boost::python::object& value); |
const boost::python::object& value); |
1165 |
this Data object. |
this Data object. |
1166 |
*/ |
*/ |
1167 |
template <class UnaryFunction> |
template <class UnaryFunction> |
1168 |
|
ESCRIPT_DLL_API |
1169 |
inline |
inline |
1170 |
void |
void |
1171 |
unaryOp(UnaryFunction operation); |
unaryOp(UnaryFunction operation); |
1177 |
\param region - Input - Region to copy. |
\param region - Input - Region to copy. |
1178 |
* |
* |
1179 |
*/ |
*/ |
1180 |
|
ESCRIPT_DLL_API |
1181 |
Data |
Data |
1182 |
getSlice(const DataArrayView::RegionType& region) const; |
getSlice(const DataArrayView::RegionType& region) const; |
1183 |
|
|
1189 |
\param region - Input - Region to copy. |
\param region - Input - Region to copy. |
1190 |
* |
* |
1191 |
*/ |
*/ |
1192 |
|
ESCRIPT_DLL_API |
1193 |
void |
void |
1194 |
setSlice(const Data& value, |
setSlice(const Data& value, |
1195 |
const DataArrayView::RegionType& region); |
const DataArrayView::RegionType& region); |
1199 |
Archive the current Data object to the given file. |
Archive the current Data object to the given file. |
1200 |
\param fileName - Input - file to archive to. |
\param fileName - Input - file to archive to. |
1201 |
*/ |
*/ |
1202 |
|
ESCRIPT_DLL_API |
1203 |
void |
void |
1204 |
archiveData(const std::string fileName); |
archiveData(const std::string fileName); |
1205 |
|
|
1211 |
\param fileName - Input - file to extract from. |
\param fileName - Input - file to extract from. |
1212 |
\param fspace - Input - a suitable FunctionSpace descibing the data. |
\param fspace - Input - a suitable FunctionSpace descibing the data. |
1213 |
*/ |
*/ |
1214 |
|
ESCRIPT_DLL_API |
1215 |
void |
void |
1216 |
extractData(const std::string fileName, |
extractData(const std::string fileName, |
1217 |
const FunctionSpace& fspace); |
const FunctionSpace& fspace); |
1218 |
|
|
1219 |
|
|
1220 |
|
#ifdef PASO_MPI |
1221 |
|
/** |
1222 |
|
\brief |
1223 |
|
print the data values to stdout. Used for debugging |
1224 |
|
*/ |
1225 |
|
ESCRIPT_DLL_API |
1226 |
|
void |
1227 |
|
print(void); |
1228 |
|
|
1229 |
|
/** |
1230 |
|
\brief |
1231 |
|
return the MPI rank number of the local data |
1232 |
|
MPI_COMM_WORLD is assumed and the result of MPI_Comm_size() |
1233 |
|
is returned |
1234 |
|
*/ |
1235 |
|
ESCRIPT_DLL_API |
1236 |
|
int |
1237 |
|
get_MPIRank(void) const; |
1238 |
|
|
1239 |
|
/** |
1240 |
|
\brief |
1241 |
|
return the MPI rank number of the local data |
1242 |
|
MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank() |
1243 |
|
is returned |
1244 |
|
*/ |
1245 |
|
ESCRIPT_DLL_API |
1246 |
|
int |
1247 |
|
get_MPISize(void) const; |
1248 |
|
|
1249 |
|
/** |
1250 |
|
\brief |
1251 |
|
return the MPI rank number of the local data |
1252 |
|
MPI_COMM_WORLD is assumed and returned. |
1253 |
|
*/ |
1254 |
|
ESCRIPT_DLL_API |
1255 |
|
MPI_Comm |
1256 |
|
get_MPIComm(void) const; |
1257 |
|
#endif |
1258 |
|
|
1259 |
protected: |
protected: |
1260 |
|
|
1261 |
private: |
private: |
1399 |
Operator+ |
Operator+ |
1400 |
Takes two Data objects. |
Takes two Data objects. |
1401 |
*/ |
*/ |
1402 |
Data operator+(const Data& left, const Data& right); |
ESCRIPT_DLL_API Data operator+(const Data& left, const Data& right); |
1403 |
|
|
1404 |
/** |
/** |
1405 |
\brief |
\brief |
1406 |
Operator- |
Operator- |
1407 |
Takes two Data objects. |
Takes two Data objects. |
1408 |
*/ |
*/ |
1409 |
Data operator-(const Data& left, const Data& right); |
ESCRIPT_DLL_API Data operator-(const Data& left, const Data& right); |
1410 |
|
|
1411 |
/** |
/** |
1412 |
\brief |
\brief |
1413 |
Operator* |
Operator* |
1414 |
Takes two Data objects. |
Takes two Data objects. |
1415 |
*/ |
*/ |
1416 |
Data operator*(const Data& left, const Data& right); |
ESCRIPT_DLL_API Data operator*(const Data& left, const Data& right); |
1417 |
|
|
1418 |
/** |
/** |
1419 |
\brief |
\brief |
1420 |
Operator/ |
Operator/ |
1421 |
Takes two Data objects. |
Takes two Data objects. |
1422 |
*/ |
*/ |
1423 |
Data operator/(const Data& left, const Data& right); |
ESCRIPT_DLL_API Data operator/(const Data& left, const Data& right); |
1424 |
|
|
1425 |
/** |
/** |
1426 |
\brief |
\brief |
1428 |
Takes LHS Data object and RHS python::object. |
Takes LHS Data object and RHS python::object. |
1429 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1430 |
*/ |
*/ |
1431 |
Data operator+(const Data& left, const boost::python::object& right); |
ESCRIPT_DLL_API Data operator+(const Data& left, const boost::python::object& right); |
1432 |
|
|
1433 |
/** |
/** |
1434 |
\brief |
\brief |
1436 |
Takes LHS Data object and RHS python::object. |
Takes LHS Data object and RHS python::object. |
1437 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1438 |
*/ |
*/ |
1439 |
Data operator-(const Data& left, const boost::python::object& right); |
ESCRIPT_DLL_API Data operator-(const Data& left, const boost::python::object& right); |
1440 |
|
|
1441 |
/** |
/** |
1442 |
\brief |
\brief |
1444 |
Takes LHS Data object and RHS python::object. |
Takes LHS Data object and RHS python::object. |
1445 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1446 |
*/ |
*/ |
1447 |
Data operator*(const Data& left, const boost::python::object& right); |
ESCRIPT_DLL_API Data operator*(const Data& left, const boost::python::object& right); |
1448 |
|
|
1449 |
/** |
/** |
1450 |
\brief |
\brief |
1452 |
Takes LHS Data object and RHS python::object. |
Takes LHS Data object and RHS python::object. |
1453 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1454 |
*/ |
*/ |
1455 |
Data operator/(const Data& left, const boost::python::object& right); |
ESCRIPT_DLL_API Data operator/(const Data& left, const boost::python::object& right); |
1456 |
|
|
1457 |
/** |
/** |
1458 |
\brief |
\brief |
1460 |
Takes LHS python::object and RHS Data object. |
Takes LHS python::object and RHS Data object. |
1461 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1462 |
*/ |
*/ |
1463 |
Data operator+(const boost::python::object& left, const Data& right); |
ESCRIPT_DLL_API Data operator+(const boost::python::object& left, const Data& right); |
1464 |
|
|
1465 |
/** |
/** |
1466 |
\brief |
\brief |
1468 |
Takes LHS python::object and RHS Data object. |
Takes LHS python::object and RHS Data object. |
1469 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1470 |
*/ |
*/ |
1471 |
Data operator-(const boost::python::object& left, const Data& right); |
ESCRIPT_DLL_API Data operator-(const boost::python::object& left, const Data& right); |
1472 |
|
|
1473 |
/** |
/** |
1474 |
\brief |
\brief |
1476 |
Takes LHS python::object and RHS Data object. |
Takes LHS python::object and RHS Data object. |
1477 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1478 |
*/ |
*/ |
1479 |
Data operator*(const boost::python::object& left, const Data& right); |
ESCRIPT_DLL_API Data operator*(const boost::python::object& left, const Data& right); |
1480 |
|
|
1481 |
/** |
/** |
1482 |
\brief |
\brief |
1484 |
Takes LHS python::object and RHS Data object. |
Takes LHS python::object and RHS Data object. |
1485 |
python::object must be convertable to Data type. |
python::object must be convertable to Data type. |
1486 |
*/ |
*/ |
1487 |
Data operator/(const boost::python::object& left, const Data& right); |
ESCRIPT_DLL_API Data operator/(const boost::python::object& left, const Data& right); |
1488 |
|
|
1489 |
/** |
/** |
1490 |
\brief |
\brief |
1491 |
Output operator |
Output operator |
1492 |
*/ |
*/ |
1493 |
std::ostream& operator<<(std::ostream& o, const Data& data); |
ESCRIPT_DLL_API std::ostream& operator<<(std::ostream& o, const Data& data); |
1494 |
|
|
1495 |
/** |
/** |
1496 |
\brief |
\brief |
1498 |
NB: this operator does very little at this point, and isn't to |
NB: this operator does very little at this point, and isn't to |
1499 |
be relied on. Requires further implementation. |
be relied on. Requires further implementation. |
1500 |
*/ |
*/ |
1501 |
//bool operator==(const Data& left, const Data& right); |
//ESCRIPT_DLL_API bool operator==(const Data& left, const Data& right); |
1502 |
|
|
1503 |
/** |
/** |
1504 |
\brief |
\brief |
1695 |
Data |
Data |
1696 |
Data::dp_algorithm(BinaryFunction operation, double initial_value) const |
Data::dp_algorithm(BinaryFunction operation, double initial_value) const |
1697 |
{ |
{ |
|
Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded()); |
|
1698 |
if (isExpanded()) { |
if (isExpanded()) { |
1699 |
|
Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded()); |
1700 |
DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get()); |
DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get()); |
1701 |
DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get()); |
DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get()); |
1702 |
EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded."); |
EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded."); |
1703 |
EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded."); |
EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded."); |
1704 |
escript::dp_algorithm(*dataE,*resultE,operation,initial_value); |
escript::dp_algorithm(*dataE,*resultE,operation,initial_value); |
1705 |
|
return result; |
1706 |
} else if (isTagged()) { |
} else if (isTagged()) { |
1707 |
DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get()); |
DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get()); |
1708 |
|
DataArrayView::ShapeType viewShape; |
1709 |
|
DataArrayView::ValueType viewData(1); |
1710 |
|
viewData[0]=0; |
1711 |
|
DataArrayView defaultValue(viewData,viewShape); |
1712 |
|
DataTagged::TagListType keys; |
1713 |
|
DataTagged::ValueListType values; |
1714 |
|
DataTagged::DataMapType::const_iterator i; |
1715 |
|
for (i=dataT->getTagLookup().begin();i!=dataT->getTagLookup().end();i++) { |
1716 |
|
keys.push_back(i->first); |
1717 |
|
values.push_back(defaultValue); |
1718 |
|
} |
1719 |
|
Data result(keys,values,defaultValue,getFunctionSpace()); |
1720 |
DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get()); |
DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get()); |
1721 |
EsysAssert((dataT!=0), "Programming error - casting data to DataTagged."); |
EsysAssert((dataT!=0), "Programming error - casting data to DataTagged."); |
1722 |
EsysAssert((resultT!=0), "Programming error - casting result to DataTagged."); |
EsysAssert((resultT!=0), "Programming error - casting result to DataTagged."); |
1723 |
escript::dp_algorithm(*dataT,*resultT,operation,initial_value); |
escript::dp_algorithm(*dataT,*resultT,operation,initial_value); |
1724 |
|
return result; |
1725 |
} else if (isConstant()) { |
} else if (isConstant()) { |
1726 |
|
Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded()); |
1727 |
DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get()); |
DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get()); |
1728 |
DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get()); |
DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get()); |
1729 |
EsysAssert((dataC!=0), "Programming error - casting data to DataConstant."); |
EsysAssert((dataC!=0), "Programming error - casting data to DataConstant."); |
1730 |
EsysAssert((resultC!=0), "Programming error - casting result to DataConstant."); |
EsysAssert((resultC!=0), "Programming error - casting result to DataConstant."); |
1731 |
escript::dp_algorithm(*dataC,*resultC,operation,initial_value); |
escript::dp_algorithm(*dataC,*resultC,operation,initial_value); |
1732 |
|
return result; |
1733 |
} |
} |
1734 |
return result; |
Data falseRetVal; // to keep compiler quiet |
1735 |
|
return falseRetVal; |
1736 |
} |
} |
1737 |
|
|
1738 |
} |
} |