~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to weipa/src/FinleyNodes.cpp

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#ifndef VISIT_PLUGIN
17
17
extern "C" {
 
18
#include <dudley/Mesh.h>
 
19
#include <dudley/NodeFile.h>
18
20
#include <finley/Mesh.h>
19
21
#include <finley/NodeFile.h>
20
22
}
122
124
//
123
125
//
124
126
//
 
127
bool FinleyNodes::initFromDudley(const Dudley_NodeFile* dudleyFile)
 
128
{
 
129
#ifndef VISIT_PLUGIN
 
130
    numDims = dudleyFile->numDim;
 
131
    numNodes = dudleyFile->numNodes;
 
132
 
 
133
    int mpisize = dudleyFile->MPIInfo->size;
 
134
    int* iPtr = dudleyFile->nodesDistribution->first_component;
 
135
    nodeDist.clear();
 
136
    nodeDist.insert(nodeDist.end(), mpisize+1, 0);
 
137
    copy(iPtr, iPtr+mpisize+1, nodeDist.begin());
 
138
 
 
139
    CoordArray::iterator it;
 
140
    for (it = coords.begin(); it != coords.end(); it++)
 
141
        delete[] *it;
 
142
    coords.clear();
 
143
    nodeID.clear();
 
144
    nodeTag.clear();
 
145
    nodeGDOF.clear();
 
146
    nodeGNI.clear();
 
147
    nodeGRDFI.clear();
 
148
    nodeGRNI.clear();
 
149
 
 
150
    if (numNodes > 0) {
 
151
        for (int i=0; i<numDims; i++) {
 
152
            double* srcPtr = dudleyFile->Coordinates + i;
 
153
            float* c = new float[numNodes];
 
154
            coords.push_back(c);
 
155
            for (int j=0; j<numNodes; j++, srcPtr+=numDims) {
 
156
                *c++ = (float) *srcPtr;
 
157
            }
 
158
        }
 
159
 
 
160
        iPtr = dudleyFile->Id;
 
161
        nodeID.insert(nodeID.end(), numNodes, 0);
 
162
        copy(iPtr, iPtr+numNodes, nodeID.begin());
 
163
 
 
164
        iPtr = dudleyFile->Tag;
 
165
        nodeTag.insert(nodeTag.end(), numNodes, 0);
 
166
        copy(iPtr, iPtr+numNodes, nodeTag.begin());
 
167
 
 
168
        iPtr = dudleyFile->globalDegreesOfFreedom;
 
169
        nodeGDOF.insert(nodeGDOF.end(), numNodes, 0);
 
170
        copy(iPtr, iPtr+numNodes, nodeGDOF.begin());
 
171
 
 
172
        iPtr = dudleyFile->globalNodesIndex;
 
173
        nodeGNI.insert(nodeGNI.end(), numNodes, 0);
 
174
        copy(iPtr, iPtr+numNodes, nodeGNI.begin());
 
175
 
 
176
        iPtr = dudleyFile->globalReducedDOFIndex;
 
177
        nodeGRDFI.insert(nodeGRDFI.end(), numNodes, 0);
 
178
        copy(iPtr, iPtr+numNodes, nodeGRDFI.begin());
 
179
 
 
180
        iPtr = dudleyFile->globalReducedNodesIndex;
 
181
        nodeGRNI.insert(nodeGRNI.end(), numNodes, 0);
 
182
        copy(iPtr, iPtr+numNodes, nodeGRNI.begin());
 
183
 
 
184
    }
 
185
    return true;
 
186
#else // VISIT_PLUGIN
 
187
    return false;
 
188
#endif
 
189
}
 
190
 
 
191
//
 
192
//
 
193
//
125
194
bool FinleyNodes::initFromFinley(const Finley_NodeFile* finleyFile)
126
195
{
127
196
#ifndef VISIT_PLUGIN