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 person has a software * |
* * |
11 |
* license agreement with ACcESS. * |
************************************************************ |
12 |
* * |
|
|
****************************************************************************** |
|
13 |
*/ |
*/ |
14 |
|
|
15 |
#if !defined escript_DataAbstract_20040315_H |
#if !defined escript_DataAbstract_20040315_H |
16 |
#define escript_DataAbstract_20040315_H |
#define escript_DataAbstract_20040315_H |
17 |
|
|
18 |
#include "escript/Data/DataException.h" |
#include "DataArrayView.h" |
19 |
#include "escript/Data/DataArrayView.h" |
#include "DataArray.h" |
20 |
#include "escript/Data/DataArray.h" |
#include "FunctionSpace.h" |
|
#include "escript/Data/FunctionSpace.h" |
|
21 |
|
|
|
#include <iostream> |
|
22 |
#include <boost/scoped_ptr.hpp> |
#include <boost/scoped_ptr.hpp> |
23 |
#include <functional> |
#include <boost/python/numeric.hpp> |
24 |
|
|
25 |
#include <string> |
#include <string> |
26 |
|
#include <fstream> |
27 |
|
|
28 |
namespace escript { |
namespace escript { |
29 |
|
|
268 |
setTaggedValue(int tagKey, |
setTaggedValue(int tagKey, |
269 |
const DataArrayView& value); |
const DataArrayView& value); |
270 |
|
|
271 |
|
/** |
272 |
|
\brief |
273 |
|
Archive the underlying data values to the file referenced |
274 |
|
by ofstream. A count of the number of values expected to be written |
275 |
|
is provided as a cross-check. |
276 |
|
|
277 |
|
The return value indicates success (0) or otherwise (1). |
278 |
|
*/ |
279 |
|
virtual |
280 |
|
int |
281 |
|
archiveData(std::ofstream& archiveFile, |
282 |
|
const ValueType::size_type noValues) const; |
283 |
|
|
284 |
|
/** |
285 |
|
\brief |
286 |
|
Extract the number of values specified by noValues from the file |
287 |
|
referenced by ifstream to the underlying data structure. |
288 |
|
|
289 |
|
The return value indicates success (0) or otherwise (1). |
290 |
|
*/ |
291 |
|
virtual |
292 |
|
int |
293 |
|
extractData(std::ifstream& archiveFile, |
294 |
|
const ValueType::size_type noValues); |
295 |
|
|
296 |
|
/** |
297 |
|
\brief |
298 |
|
Copy the numarray object to the data points in this object. |
299 |
|
|
300 |
|
Description: |
301 |
|
Copy the numarray object to the data points in this object. |
302 |
|
|
303 |
|
\param value Input - new values for the data points |
304 |
|
*/ |
305 |
|
virtual void |
306 |
|
copyAll(const boost::python::numeric::array& value); |
307 |
|
|
308 |
|
/** |
309 |
|
\brief |
310 |
|
Return the tag number associated with the given data-point number. |
311 |
|
|
312 |
|
If the object cannot be referenced by tag numbers, an exception |
313 |
|
will be thrown. |
314 |
|
*/ |
315 |
|
virtual |
316 |
|
int |
317 |
|
getTagNumber(int dpno); |
318 |
|
|
319 |
|
/** |
320 |
|
\brief |
321 |
|
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev |
322 |
|
|
323 |
|
\param ev - Output - eigenvalues in increasing order at each data point |
324 |
|
|
325 |
|
*/ |
326 |
|
virtual void |
327 |
|
eigenvalues(DataAbstract* ev); |
328 |
|
|
329 |
|
/** |
330 |
|
\brief |
331 |
|
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V |
332 |
|
|
333 |
|
\param ev - Output - eigenvalues in increasing order at each data point |
334 |
|
\param V - Output - corresponding eigenvectors. They are normalized such that their length is one |
335 |
|
and the first nonzero component is positive. |
336 |
|
\param tol - Input - eigenvalue with relative distance tol are treated as equal. |
337 |
|
|
338 |
|
*/ |
339 |
|
|
340 |
|
virtual void |
341 |
|
eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13); |
342 |
|
|
343 |
protected: |
protected: |
344 |
|
|
345 |
/** |
/** |
346 |
\brief |
\brief |
347 |
Set the pointDataView DataArrayView associated with this object. |
Set the pointDataView DataArrayView associated with this object. |
348 |
|
|
349 |
\param right - Input - The point data view. DataAbstract takes ownership |
\param input - Input - The point data view. DataAbstract takes ownership |
350 |
of the DataArrayView provided. It will delete it when it is destructed. |
of the DataArrayView provided. It will delete it when it is destructed. |
351 |
*/ |
*/ |
352 |
void |
void |
353 |
setPointDataView(const DataArrayView& input); |
setPointDataView(const DataArrayView& input); |
354 |
|
|
355 |
|
void |
356 |
|
resetPointDataView(); |
357 |
|
|
358 |
private: |
private: |
359 |
|
|
360 |
// |
// |
437 |
{ |
{ |
438 |
return *(m_pointDataView.get()); |
return *(m_pointDataView.get()); |
439 |
} |
} |
|
|
|
440 |
} // end of namespace |
} // end of namespace |
441 |
|
|
442 |
#endif |
#endif |