/[escript]/trunk/escript/src/DataBlocks2D.cpp
ViewVC logotype

Annotation of /trunk/escript/src/DataBlocks2D.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 682 - (hide annotations)
Mon Mar 27 02:43:09 2006 UTC (13 years, 6 months ago) by robwdcock
File size: 2920 byte(s)
+ NEW BUILD SYSTEM

This commit contains the new build system with cross-platform support.
Most things work are before though you can have more control.

ENVIRONMENT settings have changed:
+ You no longer require LD_LIBRARY_PATH or PYTHONPATH to point to the
esysroot for building and testing performed via scons
+ ACcESS altix users: It is recommended you change your modules to load
the latest intel compiler and other libraries required by boost to match
the setup in svn (you can override). The correct modules are as follows

module load intel_cc.9.0.026
export
MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6
module load boost/1.33.0/python-2.4.1
module load python/2.4.1
module load numarray/1.3.3


1 jgs 82 /*
2 elspeth 615 ************************************************************
3     * Copyright 2006 by ACcESS MNRF *
4     * *
5     * http://www.access.edu.au *
6     * Primary Business: Queensland, Australia *
7     * Licensed under the Open Software License version 3.0 *
8     * http://www.opensource.org/licenses/osl-3.0.php *
9     * *
10     ************************************************************
11 jgs 82 */
12 jgs 117
13 jgs 474 #include "DataBlocks2D.h"
14 jgs 82
15 jgs 478 #include "DataException.h"
16 robwdcock 682 #include "esysUtils/EsysAssert.h"
17 jgs 478
18 jgs 82 using namespace std;
19    
20     namespace escript {
21    
22     DataBlocks2D::DataBlocks2D():
23 jgs 151 m_numRows(0),
24     m_numCols(0),
25     m_blockSize(0)
26     {
27 jgs 117 }
28 jgs 82
29     DataBlocks2D::DataBlocks2D(const DataBlocks2D& other):
30 jgs 151 m_numRows(other.m_numRows),
31     m_numCols(other.m_numCols),
32     m_blockSize(other.m_blockSize)
33 jgs 117 {
34 jgs 82 m_data=other.m_data;
35 jgs 117 }
36 jgs 82
37     DataBlocks2D::DataBlocks2D(int numRows, int numCols, int blockSize):
38 jgs 151 m_numRows(numRows),
39     m_numCols(numCols),
40     m_blockSize(blockSize)
41 jgs 117 {
42 jgs 82 resize(m_numRows,numCols,blockSize);
43 jgs 117 }
44 jgs 82
45     DataBlocks2D::~DataBlocks2D()
46 jgs 151 {
47     m_numRows=-1;
48     m_numCols=-1;
49     m_blockSize=-1;
50 jgs 117 }
51 jgs 82
52     void
53     DataBlocks2D::resize(int numRows, int numCols, int blockSize)
54 jgs 117 {
55 jgs 151 if (numRows < 1 || numCols < 1 || blockSize < 1) {
56     stringstream temp;
57     temp << "DataBlocks2D: Error - Invalid resize parameter. numRows: " << numRows
58 jgs 82 << " numCols: " << numCols << " blockSize: " << blockSize;
59 jgs 151 throw DataException(temp.str());
60 jgs 82 }
61     ValueType::size_type size=numRows*numCols*blockSize;
62 jgs 151 m_data.resize(size, 0.0, numCols*blockSize);
63 jgs 82 m_numRows=numRows;
64     m_numCols=numCols;
65     m_blockSize=blockSize;
66 jgs 117 }
67 jgs 82
68     void
69     DataBlocks2D::Swap(DataBlocks2D& other)
70 jgs 117 {
71 jgs 151 EsysAssert(((m_numRows >= 0) && (m_numCols >= 0) && (m_blockSize >= 0)), "(DataBlocks2D) Invalid object.");
72 jgs 82 swap(m_data,other.m_data);
73     swap(m_blockSize,other.m_blockSize);
74     swap(m_numRows,other.m_numRows);
75     swap(m_numCols,other.m_numCols);
76 jgs 117 }
77 jgs 82
78     DataBlocks2D&
79     DataBlocks2D::operator=(const DataBlocks2D& other)
80 jgs 117 {
81 jgs 151 EsysAssert(((m_numRows >= 0) && (m_numCols >= 0) && (m_blockSize >= 0)), "(DataBlocks2D) Invalid object.");
82 jgs 82 DataBlocks2D temp(other);
83     Swap(temp);
84     return *this;
85 jgs 117 }
86 jgs 123
87     int
88     DataBlocks2D::archiveData(ofstream& archiveFile,
89     const ValueType::size_type noValues) const
90     {
91 jgs 151 EsysAssert(((m_numRows >= 0) && (m_numCols >= 0) && (m_blockSize >= 0)), "(DataBlocks2D) Invalid object.");
92     return (m_data.archiveData(archiveFile, noValues));
93 jgs 123 }
94    
95     int
96     DataBlocks2D::extractData(ifstream& archiveFile,
97     const ValueType::size_type noValues)
98     {
99 jgs 151 EsysAssert(((m_numRows >= 0) && (m_numCols >= 0) && (m_blockSize >= 0)), "(DataBlocks2D) Invalid object.");
100     return (m_data.extractData(archiveFile, noValues));
101 jgs 123 }
102 jgs 117
103 jgs 82 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26