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

Contents of /trunk/escript/src/DataProf.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 782 - (show annotations)
Tue Jul 18 00:47:47 2006 UTC (13 years, 4 months ago) by bcumming
File size: 4200 byte(s)
Large number of changes to Finley for meshing in MPI.

- optimisation and neatening up of rectcanglular mesh generation code
- first and second order 1D, 2D and 3D rectangular meshes are now
  available in finley and escript using MPI.
- reduced meshes now generated in MPI, and interpolation to and from 
  reduced data types now supported.  

1 /*
2 ************************************************************
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 */
12
13 #include "DataProf.h"
14
15 #include <iostream>
16 #include <sstream>
17
18 using namespace std;
19
20 namespace escript {
21
22 DataProf::DataProf() {
23 profDataTable_Root = 0;
24 totalDataObjects = 0;
25 }
26
27 DataProf::~DataProf() {
28
29 profDataTable* tempTable = profDataTable_Root;
30 profDataTable* lastTable;
31
32 cout << compProf() << endl;
33
34 while (tempTable != 0) {
35 lastTable = tempTable;
36 tempTable = tempTable->next;
37 delete lastTable->data;
38 delete lastTable;
39 }
40
41 totalDataObjects = -1;
42
43 }
44
45 profDataEntry*
46 DataProf::newData(){
47
48 profDataTable* tempTable;
49 profDataEntry* tempEntry;
50
51 // create the new table and entry
52 tempTable = new profDataTable;
53 tempEntry = new profDataEntry;
54
55 // add the new table to the beginning of the list
56 tempTable->next = profDataTable_Root;
57 profDataTable_Root = tempTable;
58
59 // add the new entry to the new table
60 tempTable->data = tempEntry;
61
62 // initialise the new entry
63 tempEntry->interpolate = 0;
64 tempEntry->grad = 0;
65 tempEntry->integrate = 0;
66 tempEntry->where = 0;
67 tempEntry->unary = 0;
68 tempEntry->binary = 0;
69 tempEntry->reduction1 = 0;
70 tempEntry->reduction2 = 0;
71 tempEntry->slicing = 0;
72
73 // increment the Data objects counter
74 totalDataObjects++;
75
76 // return the pointer to the new entry
77 return tempEntry;
78
79 }
80
81 std::string
82 DataProf::dumpProf(profDataEntry* entry) {
83
84 stringstream temp_str;
85
86 temp_str << "=============================\n";
87 temp_str << "interpolate: " << entry->interpolate << "\n";
88 temp_str << "grad : " << entry->grad << "\n";
89 temp_str << "integrate : " << entry->integrate << "\n";
90 temp_str << "where : " << entry->where << "\n";
91 temp_str << "unary : " << entry->unary << "\n";
92 temp_str << "binary : " << entry->binary << "\n";
93 temp_str << "reduction1 : " << entry->reduction1 << "\n";
94 temp_str << "reduction2 : " << entry->reduction2 << "\n";
95 temp_str << "slicing : " << entry->slicing << "\n";
96 temp_str << "=============================\n ";
97 temp_str << endl;
98
99 return temp_str.str();
100
101 }
102
103 string
104 DataProf::compProf() {
105
106 int comp_interpolate = 0;
107 int comp_grad = 0;
108 int comp_integrate = 0;
109 int comp_where = 0;
110 int comp_unary = 0;
111 int comp_binary = 0;
112 int comp_reduction1 = 0;
113 int comp_reduction2 = 0;
114 int comp_slicing = 0;
115
116 profDataTable* tempTable = profDataTable_Root;
117
118 while (tempTable != 0) {
119 comp_interpolate += tempTable->data->interpolate;
120 comp_grad += tempTable->data->grad;
121 comp_integrate += tempTable->data->integrate;
122 comp_where += tempTable->data->where;
123 comp_unary += tempTable->data->unary;
124 comp_binary += tempTable->data->binary;
125 comp_reduction1 += tempTable->data->reduction1;
126 comp_reduction2 += tempTable->data->reduction2;
127 comp_slicing += tempTable->data->slicing;
128 tempTable = tempTable->next;
129 }
130
131 stringstream temp_str;
132
133 #ifndef PASO_MPI
134 temp_str << "========== Op Stats ===================\n";
135 temp_str << "Total objects: " << totalDataObjects << "\n";
136 temp_str << "interpolate : " << comp_interpolate << "\n";
137 temp_str << "grad : " << comp_grad << "\n";
138 temp_str << "integrate : " << comp_integrate << "\n";
139 temp_str << "where : " << comp_where << "\n";
140 temp_str << "unary : " << comp_unary << "\n";
141 temp_str << "binary : " << comp_binary << "\n";
142 temp_str << "reduction1 : " << comp_reduction1 << "\n";
143 temp_str << "reduction2 : " << comp_reduction2 << "\n";
144 temp_str << "slicing : " << comp_slicing << "\n";
145 temp_str << "======================================= ";
146 temp_str << endl;
147 #endif
148
149 return temp_str.str();
150
151 }
152
153 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26