/[escript]/trunk/finley/src/CPPAdapter/MeshAdapterFactory.cpp
ViewVC logotype

Diff of /trunk/finley/src/CPPAdapter/MeshAdapterFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1753 by ksteube, Sun Sep 7 22:01:23 2008 UTC revision 1755 by ksteube, Mon Sep 8 01:34:40 2008 UTC
# Line 64  namespace finley { Line 64  namespace finley {
64    
65      double blocktimer_start = blocktimer_time();      double blocktimer_start = blocktimer_time();
66      Finley_resetError();      Finley_resetError();
67        int *first_DofComponent, *first_NodeComponent;
68    
69      // Open NetCDF file for reading      // Open NetCDF file for reading
70      NcAtt *attr;      NcAtt *attr;
# Line 127  namespace finley { Line 128  namespace finley {
128          if (! ( nc_var_temp = dataFile.get_var("Nodes_Id")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_Id")) )
129            throw DataException("Error - loadMesh:: unable to read Nodes_Id from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_Id from netCDF file: " + *fName);
130          if (! nc_var_temp->get(&mesh_p->Nodes->Id[0], numNodes) ) {          if (! nc_var_temp->get(&mesh_p->Nodes->Id[0], numNodes) ) {
131            free(&mesh_p->Nodes->Id);            TMPMEMFREE(mesh_p->Nodes->Id);
132            throw DataException("Error - loadMesh:: unable to recover Nodes_Id from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_Id from NetCDF file: " + *fName);
133          }          }
134      // Nodes_Tag      // Nodes_Tag
135          if (! ( nc_var_temp = dataFile.get_var("Nodes_Tag")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_Tag")) )
136            throw DataException("Error - loadMesh:: unable to read Nodes_Tag from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_Tag from netCDF file: " + *fName);
137          if (! nc_var_temp->get(&mesh_p->Nodes->Tag[0], numNodes) ) {          if (! nc_var_temp->get(&mesh_p->Nodes->Tag[0], numNodes) ) {
138            free(&mesh_p->Nodes->Tag);            TMPMEMFREE(mesh_p->Nodes->Tag);
139            throw DataException("Error - loadMesh:: unable to recover Nodes_Tag from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_Tag from NetCDF file: " + *fName);
140          }          }
141      // Nodes_gDOF      // Nodes_gDOF
142          if (! ( nc_var_temp = dataFile.get_var("Nodes_gDOF")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_gDOF")) )
143            throw DataException("Error - loadMesh:: unable to read Nodes_gDOF from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_gDOF from netCDF file: " + *fName);
144          if (! nc_var_temp->get(&mesh_p->Nodes->globalDegreesOfFreedom[0], numNodes) ) {          if (! nc_var_temp->get(&mesh_p->Nodes->globalDegreesOfFreedom[0], numNodes) ) {
145            free(&mesh_p->Nodes->globalDegreesOfFreedom);            TMPMEMFREE(mesh_p->Nodes->globalDegreesOfFreedom);
146            throw DataException("Error - loadMesh:: unable to recover Nodes_gDOF from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_gDOF from NetCDF file: " + *fName);
147          }          }
148      // Nodes_gNI      // Nodes_gNI
149          if (! ( nc_var_temp = dataFile.get_var("Nodes_gNI")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_gNI")) )
150            throw DataException("Error - loadMesh:: unable to read Nodes_gNI from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_gNI from netCDF file: " + *fName);
151          if (! nc_var_temp->get(&mesh_p->Nodes->globalNodesIndex[0], numNodes) ) {          if (! nc_var_temp->get(&mesh_p->Nodes->globalNodesIndex[0], numNodes) ) {
152            free(&mesh_p->Nodes->globalNodesIndex);            TMPMEMFREE(mesh_p->Nodes->globalNodesIndex);
153            throw DataException("Error - loadMesh:: unable to recover Nodes_gNI from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_gNI from NetCDF file: " + *fName);
154          }          }
155      // Nodes_grDfI      // Nodes_grDfI
156          if (! ( nc_var_temp = dataFile.get_var("Nodes_grDfI")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_grDfI")) )
157            throw DataException("Error - loadMesh:: unable to read Nodes_grDfI from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_grDfI from netCDF file: " + *fName);
158          if (! nc_var_temp->get(&mesh_p->Nodes->globalReducedDOFIndex[0], numNodes) ) {          if (! nc_var_temp->get(&mesh_p->Nodes->globalReducedDOFIndex[0], numNodes) ) {
159            free(&mesh_p->Nodes->globalReducedDOFIndex);            TMPMEMFREE(mesh_p->Nodes->globalReducedDOFIndex);
160            throw DataException("Error - loadMesh:: unable to recover Nodes_grDfI from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_grDfI from NetCDF file: " + *fName);
161          }          }
162      // Nodes_grNI      // Nodes_grNI
163          if (! ( nc_var_temp = dataFile.get_var("Nodes_grNI")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_grNI")) )
164            throw DataException("Error - loadMesh:: unable to read Nodes_grNI from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_grNI from netCDF file: " + *fName);
165          if (! nc_var_temp->get(&mesh_p->Nodes->globalReducedNodesIndex[0], numNodes) ) {          if (! nc_var_temp->get(&mesh_p->Nodes->globalReducedNodesIndex[0], numNodes) ) {
166            free(&mesh_p->Nodes->globalReducedNodesIndex);            TMPMEMFREE(mesh_p->Nodes->globalReducedNodesIndex);
167            throw DataException("Error - loadMesh:: unable to recover Nodes_grNI from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_grNI from NetCDF file: " + *fName);
168          }          }
169      // Nodes_Coordinates      // Nodes_Coordinates
170          if (!(nc_var_temp = dataFile.get_var("Nodes_Coordinates"))) {          if (!(nc_var_temp = dataFile.get_var("Nodes_Coordinates"))) {
171            free(&mesh_p->Nodes->Coordinates);            TMPMEMFREE(mesh_p->Nodes->Coordinates);
172            throw DataException("Error - loadMesh:: unable to read Nodes_Coordinates from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_Coordinates from netCDF file: " + *fName);
173          }          }
174          if (! nc_var_temp->get(&(mesh_p->Nodes->Coordinates[0]), numNodes, numDim) ) {          if (! nc_var_temp->get(&(mesh_p->Nodes->Coordinates[0]), numNodes, numDim) ) {
175            free(&mesh_p->Nodes->Coordinates);            TMPMEMFREE(mesh_p->Nodes->Coordinates);
176            throw DataException("Error - load:: unable to recover Nodes_Coordinates from netCDF file: " + *fName);            throw DataException("Error - load:: unable to recover Nodes_Coordinates from netCDF file: " + *fName);
177          }          }
178      // Nodes_DofDistribution      // Nodes_DofDistribution
179      int *first_component = TMPMEMALLOC(mpi_size+1,index_t);      first_DofComponent = TMPMEMALLOC(mpi_size+1,index_t);
180          if (! ( nc_var_temp = dataFile.get_var("Nodes_DofDistribution")) )          if (! ( nc_var_temp = dataFile.get_var("Nodes_DofDistribution")) )
181            throw DataException("Error - loadMesh:: unable to read Nodes_DofDistribution from netCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to read Nodes_DofDistribution from netCDF file: " + *fName);
182          if (! nc_var_temp->get(&first_component[0], mpi_size+1) ) {          if (! nc_var_temp->get(&first_DofComponent[0], mpi_size+1) ) {
           free(&first_component);  
183            throw DataException("Error - loadMesh:: unable to recover Nodes_DofDistribution from NetCDF file: " + *fName);            throw DataException("Error - loadMesh:: unable to recover Nodes_DofDistribution from NetCDF file: " + *fName);
184          }          }
185      mesh_p->Nodes->degreesOfFreedomDistribution=Paso_Distribution_alloc(mesh_p->Nodes->MPIInfo,first_component,1,0);  { int i; printf("ksteube read  Nodes_DofDistribution:"); for(i=0; i<mpi_size+1; i++) printf(" %d", first_DofComponent[i]); printf("\n"); }
186      TMPMEMFREE(first_component);  
187        // Nodes_NodeDistribution
188        first_NodeComponent = TMPMEMALLOC(mpi_size+1,index_t);
189            if (! ( nc_var_temp = dataFile.get_var("Nodes_NodeDistribution")) )
190              throw DataException("Error - loadMesh:: unable to read Nodes_NodeDistribution from netCDF file: " + *fName);
191            if (! nc_var_temp->get(&first_NodeComponent[0], mpi_size+1) ) {
192              throw DataException("Error - loadMesh:: unable to recover Nodes_NodeDistribution from NetCDF file: " + *fName);
193            }
194    { int i; printf("ksteube read  Nodes_NodeDistribution:"); for(i=0; i<mpi_size+1; i++) printf(" %d", first_NodeComponent[i]); printf("\n"); }
195    
196          /* read elements */          /* read elements */
197          if (Finley_noError()) {          if (Finley_noError()) {
# Line 197  namespace finley { Line 205  namespace finley {
205                     if (! ( nc_var_temp = dataFile.get_var("Elements_Id")) )                     if (! ( nc_var_temp = dataFile.get_var("Elements_Id")) )
206                       throw DataException("Error - loadMesh:: unable to read Elements_Id from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Elements_Id from netCDF file: " + *fName);
207                     if (! nc_var_temp->get(&mesh_p->Elements->Id[0], num_Elements) ) {                     if (! nc_var_temp->get(&mesh_p->Elements->Id[0], num_Elements) ) {
208                       free(&mesh_p->Elements->Id);                       TMPMEMFREE(mesh_p->Elements->Id);
209                       throw DataException("Error - loadMesh:: unable to recover Elements_Id from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Elements_Id from NetCDF file: " + *fName);
210                     }                     }
211                 // Elements_Tag                 // Elements_Tag
212                     if (! ( nc_var_temp = dataFile.get_var("Elements_Tag")) )                     if (! ( nc_var_temp = dataFile.get_var("Elements_Tag")) )
213                       throw DataException("Error - loadMesh:: unable to read Elements_Tag from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Elements_Tag from netCDF file: " + *fName);
214                     if (! nc_var_temp->get(&mesh_p->Elements->Tag[0], num_Elements) ) {                     if (! nc_var_temp->get(&mesh_p->Elements->Tag[0], num_Elements) ) {
215                       free(&mesh_p->Elements->Tag);                       TMPMEMFREE(mesh_p->Elements->Tag);
216                       throw DataException("Error - loadMesh:: unable to recover Elements_Tag from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Elements_Tag from NetCDF file: " + *fName);
217                     }                     }
218                 // Elements_Owner                 // Elements_Owner
219                     if (! ( nc_var_temp = dataFile.get_var("Elements_Owner")) )                     if (! ( nc_var_temp = dataFile.get_var("Elements_Owner")) )
220                       throw DataException("Error - loadMesh:: unable to read Elements_Owner from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Elements_Owner from netCDF file: " + *fName);
221                     if (! nc_var_temp->get(&mesh_p->Elements->Owner[0], num_Elements) ) {                     if (! nc_var_temp->get(&mesh_p->Elements->Owner[0], num_Elements) ) {
222                       free(&mesh_p->Elements->Owner);                       TMPMEMFREE(mesh_p->Elements->Owner);
223                       throw DataException("Error - loadMesh:: unable to recover Elements_Owner from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Elements_Owner from NetCDF file: " + *fName);
224                     }                     }
225                 // Elements_Color                 // Elements_Color
226                     if (! ( nc_var_temp = dataFile.get_var("Elements_Color")) )                     if (! ( nc_var_temp = dataFile.get_var("Elements_Color")) )
227                       throw DataException("Error - loadMesh:: unable to read Elements_Color from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Elements_Color from netCDF file: " + *fName);
228                     if (! nc_var_temp->get(&mesh_p->Elements->Color[0], num_Elements) ) {                     if (! nc_var_temp->get(&mesh_p->Elements->Color[0], num_Elements) ) {
229                       free(&mesh_p->Elements->Color);                       TMPMEMFREE(mesh_p->Elements->Color);
230                       throw DataException("Error - loadMesh:: unable to recover Elements_Color from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Elements_Color from NetCDF file: " + *fName);
231                     }                     }
232                 // Elements_Nodes                 // Elements_Nodes
233             int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);             int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);
234                     if (!(nc_var_temp = dataFile.get_var("Elements_Nodes"))) {                     if (!(nc_var_temp = dataFile.get_var("Elements_Nodes"))) {
235                       free(&mesh_p->Elements->Nodes);                       TMPMEMFREE(mesh_p->Elements->Nodes);
236                       throw DataException("Error - loadMesh:: unable to read Elements_Nodes from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Elements_Nodes from netCDF file: " + *fName);
237                     }                     }
238                     if (! nc_var_temp->get(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes) ) {                     if (! nc_var_temp->get(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes) ) {
239                       free(&Elements_Nodes);                       TMPMEMFREE(Elements_Nodes);
240                       throw DataException("Error - load:: unable to recover Elements_Nodes from netCDF file: " + *fName);                       throw DataException("Error - load:: unable to recover Elements_Nodes from netCDF file: " + *fName);
241                     }                     }
242             // Copy temp array into mesh_p->Elements->Nodes             // Copy temp array into mesh_p->Elements->Nodes
# Line 255  namespace finley { Line 263  namespace finley {
263                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Id")) )                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Id")) )
264                       throw DataException("Error - loadMesh:: unable to read FaceElements_Id from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read FaceElements_Id from netCDF file: " + *fName);
265                     if (! nc_var_temp->get(&mesh_p->FaceElements->Id[0], num_FaceElements) ) {                     if (! nc_var_temp->get(&mesh_p->FaceElements->Id[0], num_FaceElements) ) {
266                       free(&mesh_p->FaceElements->Id);                       TMPMEMFREE(mesh_p->FaceElements->Id);
267                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Id from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Id from NetCDF file: " + *fName);
268                     }                     }
269                 // FaceElements_Tag                 // FaceElements_Tag
270                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Tag")) )                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Tag")) )
271                       throw DataException("Error - loadMesh:: unable to read FaceElements_Tag from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read FaceElements_Tag from netCDF file: " + *fName);
272                     if (! nc_var_temp->get(&mesh_p->FaceElements->Tag[0], num_FaceElements) ) {                     if (! nc_var_temp->get(&mesh_p->FaceElements->Tag[0], num_FaceElements) ) {
273                       free(&mesh_p->FaceElements->Tag);                       TMPMEMFREE(mesh_p->FaceElements->Tag);
274                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Tag from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Tag from NetCDF file: " + *fName);
275                     }                     }
276                 // FaceElements_Owner                 // FaceElements_Owner
277                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Owner")) )                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Owner")) )
278                       throw DataException("Error - loadMesh:: unable to read FaceElements_Owner from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read FaceElements_Owner from netCDF file: " + *fName);
279                     if (! nc_var_temp->get(&mesh_p->FaceElements->Owner[0], num_FaceElements) ) {                     if (! nc_var_temp->get(&mesh_p->FaceElements->Owner[0], num_FaceElements) ) {
280                       free(&mesh_p->FaceElements->Owner);                       TMPMEMFREE(mesh_p->FaceElements->Owner);
281                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Owner from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Owner from NetCDF file: " + *fName);
282                     }                     }
283                 // FaceElements_Color                 // FaceElements_Color
284                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Color")) )                     if (! ( nc_var_temp = dataFile.get_var("FaceElements_Color")) )
285                       throw DataException("Error - loadMesh:: unable to read FaceElements_Color from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read FaceElements_Color from netCDF file: " + *fName);
286                     if (! nc_var_temp->get(&mesh_p->FaceElements->Color[0], num_FaceElements) ) {                     if (! nc_var_temp->get(&mesh_p->FaceElements->Color[0], num_FaceElements) ) {
287                       free(&mesh_p->FaceElements->Color);                       TMPMEMFREE(mesh_p->FaceElements->Color);
288                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Color from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover FaceElements_Color from NetCDF file: " + *fName);
289                     }                     }
290                 // FaceElements_Nodes                 // FaceElements_Nodes
291             int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);             int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);
292                     if (!(nc_var_temp = dataFile.get_var("FaceElements_Nodes"))) {                     if (!(nc_var_temp = dataFile.get_var("FaceElements_Nodes"))) {
293                       free(&mesh_p->FaceElements->Nodes);                       TMPMEMFREE(mesh_p->FaceElements->Nodes);
294                       throw DataException("Error - loadMesh:: unable to read FaceElements_Nodes from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read FaceElements_Nodes from netCDF file: " + *fName);
295                     }                     }
296                     if (! nc_var_temp->get(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes) ) {                     if (! nc_var_temp->get(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes) ) {
297                       free(&FaceElements_Nodes);                       TMPMEMFREE(FaceElements_Nodes);
298                       throw DataException("Error - load:: unable to recover FaceElements_Nodes from netCDF file: " + *fName);                       throw DataException("Error - load:: unable to recover FaceElements_Nodes from netCDF file: " + *fName);
299                     }                     }
300             // Copy temp array into mesh_p->FaceElements->Nodes             // Copy temp array into mesh_p->FaceElements->Nodes
# Line 313  namespace finley { Line 321  namespace finley {
321                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Id")) )                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Id")) )
322                       throw DataException("Error - loadMesh:: unable to read ContactElements_Id from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read ContactElements_Id from netCDF file: " + *fName);
323                     if (! nc_var_temp->get(&mesh_p->ContactElements->Id[0], num_ContactElements) ) {                     if (! nc_var_temp->get(&mesh_p->ContactElements->Id[0], num_ContactElements) ) {
324                       free(&mesh_p->ContactElements->Id);                       TMPMEMFREE(mesh_p->ContactElements->Id);
325                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Id from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Id from NetCDF file: " + *fName);
326                     }                     }
327                 // ContactElements_Tag                 // ContactElements_Tag
328                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Tag")) )                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Tag")) )
329                       throw DataException("Error - loadMesh:: unable to read ContactElements_Tag from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read ContactElements_Tag from netCDF file: " + *fName);
330                     if (! nc_var_temp->get(&mesh_p->ContactElements->Tag[0], num_ContactElements) ) {                     if (! nc_var_temp->get(&mesh_p->ContactElements->Tag[0], num_ContactElements) ) {
331                       free(&mesh_p->ContactElements->Tag);                       TMPMEMFREE(mesh_p->ContactElements->Tag);
332                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Tag from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Tag from NetCDF file: " + *fName);
333                     }                     }
334                 // ContactElements_Owner                 // ContactElements_Owner
335                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Owner")) )                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Owner")) )
336                       throw DataException("Error - loadMesh:: unable to read ContactElements_Owner from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read ContactElements_Owner from netCDF file: " + *fName);
337                     if (! nc_var_temp->get(&mesh_p->ContactElements->Owner[0], num_ContactElements) ) {                     if (! nc_var_temp->get(&mesh_p->ContactElements->Owner[0], num_ContactElements) ) {
338                       free(&mesh_p->ContactElements->Owner);                       TMPMEMFREE(mesh_p->ContactElements->Owner);
339                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Owner from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Owner from NetCDF file: " + *fName);
340                     }                     }
341                 // ContactElements_Color                 // ContactElements_Color
342                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Color")) )                     if (! ( nc_var_temp = dataFile.get_var("ContactElements_Color")) )
343                       throw DataException("Error - loadMesh:: unable to read ContactElements_Color from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read ContactElements_Color from netCDF file: " + *fName);
344                     if (! nc_var_temp->get(&mesh_p->ContactElements->Color[0], num_ContactElements) ) {                     if (! nc_var_temp->get(&mesh_p->ContactElements->Color[0], num_ContactElements) ) {
345                       free(&mesh_p->ContactElements->Color);                       TMPMEMFREE(mesh_p->ContactElements->Color);
346                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Color from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover ContactElements_Color from NetCDF file: " + *fName);
347                     }                     }
348                 // ContactElements_Nodes                 // ContactElements_Nodes
349             int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);             int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);
350                     if (!(nc_var_temp = dataFile.get_var("ContactElements_Nodes"))) {                     if (!(nc_var_temp = dataFile.get_var("ContactElements_Nodes"))) {
351                       free(&mesh_p->ContactElements->Nodes);                       TMPMEMFREE(mesh_p->ContactElements->Nodes);
352                       throw DataException("Error - loadMesh:: unable to read ContactElements_Nodes from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read ContactElements_Nodes from netCDF file: " + *fName);
353                     }                     }
354                     if (! nc_var_temp->get(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes) ) {                     if (! nc_var_temp->get(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes) ) {
355                       free(&ContactElements_Nodes);                       TMPMEMFREE(ContactElements_Nodes);
356                       throw DataException("Error - load:: unable to recover ContactElements_Nodes from netCDF file: " + *fName);                       throw DataException("Error - load:: unable to recover ContactElements_Nodes from netCDF file: " + *fName);
357                     }                     }
358             // Copy temp array into mesh_p->ContactElements->Nodes             // Copy temp array into mesh_p->ContactElements->Nodes
# Line 371  namespace finley { Line 379  namespace finley {
379                     if (! ( nc_var_temp = dataFile.get_var("Points_Id")) )                     if (! ( nc_var_temp = dataFile.get_var("Points_Id")) )
380                       throw DataException("Error - loadMesh:: unable to read Points_Id from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Points_Id from netCDF file: " + *fName);
381                     if (! nc_var_temp->get(&mesh_p->Points->Id[0], num_Points) ) {                     if (! nc_var_temp->get(&mesh_p->Points->Id[0], num_Points) ) {
382                       free(&mesh_p->Points->Id);                       TMPMEMFREE(mesh_p->Points->Id);
383                       throw DataException("Error - loadMesh:: unable to recover Points_Id from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Points_Id from NetCDF file: " + *fName);
384                     }                     }
385                 // Points_Tag                 // Points_Tag
386                     if (! ( nc_var_temp = dataFile.get_var("Points_Tag")) )                     if (! ( nc_var_temp = dataFile.get_var("Points_Tag")) )
387                       throw DataException("Error - loadMesh:: unable to read Points_Tag from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Points_Tag from netCDF file: " + *fName);
388                     if (! nc_var_temp->get(&mesh_p->Points->Tag[0], num_Points) ) {                     if (! nc_var_temp->get(&mesh_p->Points->Tag[0], num_Points) ) {
389                       free(&mesh_p->Points->Tag);                       TMPMEMFREE(mesh_p->Points->Tag);
390                       throw DataException("Error - loadMesh:: unable to recover Points_Tag from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Points_Tag from NetCDF file: " + *fName);
391                     }                     }
392                 // Points_Owner                 // Points_Owner
393                     if (! ( nc_var_temp = dataFile.get_var("Points_Owner")) )                     if (! ( nc_var_temp = dataFile.get_var("Points_Owner")) )
394                       throw DataException("Error - loadMesh:: unable to read Points_Owner from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Points_Owner from netCDF file: " + *fName);
395                     if (! nc_var_temp->get(&mesh_p->Points->Owner[0], num_Points) ) {                     if (! nc_var_temp->get(&mesh_p->Points->Owner[0], num_Points) ) {
396                       free(&mesh_p->Points->Owner);                       TMPMEMFREE(mesh_p->Points->Owner);
397                       throw DataException("Error - loadMesh:: unable to recover Points_Owner from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Points_Owner from NetCDF file: " + *fName);
398                     }                     }
399                 // Points_Color                 // Points_Color
400                     if (! ( nc_var_temp = dataFile.get_var("Points_Color")) )                     if (! ( nc_var_temp = dataFile.get_var("Points_Color")) )
401                       throw DataException("Error - loadMesh:: unable to read Points_Color from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Points_Color from netCDF file: " + *fName);
402                     if (! nc_var_temp->get(&mesh_p->Points->Color[0], num_Points) ) {                     if (! nc_var_temp->get(&mesh_p->Points->Color[0], num_Points) ) {
403                       free(&mesh_p->Points->Color);                       TMPMEMFREE(mesh_p->Points->Color);
404                       throw DataException("Error - loadMesh:: unable to recover Points_Color from NetCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to recover Points_Color from NetCDF file: " + *fName);
405                     }                     }
406                 // Points_Nodes                 // Points_Nodes
407             int *Points_Nodes = TMPMEMALLOC(num_Points,int);             int *Points_Nodes = TMPMEMALLOC(num_Points,int);
408                     if (!(nc_var_temp = dataFile.get_var("Points_Nodes"))) {                     if (!(nc_var_temp = dataFile.get_var("Points_Nodes"))) {
409                       free(&mesh_p->Points->Nodes);                       TMPMEMFREE(mesh_p->Points->Nodes);
410                       throw DataException("Error - loadMesh:: unable to read Points_Nodes from netCDF file: " + *fName);                       throw DataException("Error - loadMesh:: unable to read Points_Nodes from netCDF file: " + *fName);
411                     }                     }
412                     if (! nc_var_temp->get(&(Points_Nodes[0]), num_Points) ) {                     if (! nc_var_temp->get(&(Points_Nodes[0]), num_Points) ) {
413                       free(&Points_Nodes);                       TMPMEMFREE(Points_Nodes);
414                       throw DataException("Error - load:: unable to recover Points_Nodes from netCDF file: " + *fName);                       throw DataException("Error - load:: unable to recover Points_Nodes from netCDF file: " + *fName);
415                     }                     }
416             // Copy temp array into mesh_p->Points->Nodes             // Copy temp array into mesh_p->Points->Nodes
# Line 426  namespace finley { Line 434  namespace finley {
434              if (! ( nc_var_temp = dataFile.get_var("Tags_keys")) )              if (! ( nc_var_temp = dataFile.get_var("Tags_keys")) )
435                throw DataException("Error - loadMesh:: unable to read Tags_keys from netCDF file: " + *fName);                throw DataException("Error - loadMesh:: unable to read Tags_keys from netCDF file: " + *fName);
436              if (! nc_var_temp->get(&Tags_keys[0], num_Tags) ) {              if (! nc_var_temp->get(&Tags_keys[0], num_Tags) ) {
437                free(&Tags_keys);                TMPMEMFREE(Tags_keys);
438                throw DataException("Error - loadMesh:: unable to recover Tags_keys from NetCDF file: " + *fName);                throw DataException("Error - loadMesh:: unable to recover Tags_keys from NetCDF file: " + *fName);
439              }              }
440          for (i=0; i<num_Tags; i++) {          for (i=0; i<num_Tags; i++) {
# Line 445  namespace finley { Line 453  namespace finley {
453    
454      } /* Finley_noError() after Finley_Mesh_alloc() */      } /* Finley_noError() after Finley_Mesh_alloc() */
455        
456      if (Finley_noError()) Finley_Mesh_createMappings(mesh_p, mesh_p->Nodes->degreesOfFreedomDistribution->first_component, 0);      if (Finley_noError()) Finley_Mesh_createMappings(mesh_p, first_DofComponent, first_NodeComponent);
457        TMPMEMFREE(first_DofComponent);
458        TMPMEMFREE(first_NodeComponent);
459    
460      checkFinleyError();      checkFinleyError();
461      temp=new MeshAdapter(mesh_p);      temp=new MeshAdapter(mesh_p);

Legend:
Removed from v.1753  
changed lines
  Added in v.1755

  ViewVC Help
Powered by ViewVC 1.1.26