/[escript]/branches/domexper/dudley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /branches/domexper/dudley/src/CPPAdapter/MeshAdapter.cpp

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

revision 798 by gross, Fri Aug 4 01:05:36 2006 UTC revision 1343 by ksteube, Wed Nov 14 02:48:02 2007 UTC
# Line 1  Line 1 
 // $Id$  
 /*  
  ******************************************************************************  
  *                                                                            *  
  *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  
  *                                                                            *  
  * This software is the property of ACcESS. No part of this code              *  
  * may be copied in any form or by any means without the expressed written    *  
  * consent of ACcESS.  Copying, use or modification of this software          *  
  * by any unauthorised person is illegal unless that person has a software    *  
  * license agreement with ACcESS.                                             *  
  *                                                                            *  
  ******************************************************************************  
 */  
1    
2  #include "MeshAdapter.h"  /* $Id$ */
3    
4    /*******************************************************
5     *
6     *           Copyright 2003-2007 by ACceSS MNRF
7     *       Copyright 2007 by University of Queensland
8     *
9     *                http://esscc.uq.edu.au
10     *        Primary Business: Queensland, Australia
11     *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16    #include "MeshAdapter.h"
17  #include "escript/Data.h"  #include "escript/Data.h"
18  #include "escript/DataFactory.h"  #include "escript/DataFactory.h"
19    #ifdef USE_NETCDF
20    #include <netcdfcpp.h>
21    #endif
22    extern "C" {
23    #include "escript/blocktimer.h"
24    }
25    #include <vector>
26    
27  using namespace std;  using namespace std;
28  using namespace escript;  using namespace escript;
# Line 29  MeshAdapter::FunctionSpaceNamesMapType M Line 35  MeshAdapter::FunctionSpaceNamesMapType M
35  const int MeshAdapter::DegreesOfFreedom=FINLEY_DEGREES_OF_FREEDOM;  const int MeshAdapter::DegreesOfFreedom=FINLEY_DEGREES_OF_FREEDOM;
36  const int MeshAdapter::ReducedDegreesOfFreedom=FINLEY_REDUCED_DEGREES_OF_FREEDOM;  const int MeshAdapter::ReducedDegreesOfFreedom=FINLEY_REDUCED_DEGREES_OF_FREEDOM;
37  const int MeshAdapter::Nodes=FINLEY_NODES;  const int MeshAdapter::Nodes=FINLEY_NODES;
38    const int MeshAdapter::ReducedNodes=FINLEY_REDUCED_NODES;
39  const int MeshAdapter::Elements=FINLEY_ELEMENTS;  const int MeshAdapter::Elements=FINLEY_ELEMENTS;
40    const int MeshAdapter::ReducedElements=FINLEY_REDUCED_ELEMENTS;
41  const int MeshAdapter::FaceElements=FINLEY_FACE_ELEMENTS;  const int MeshAdapter::FaceElements=FINLEY_FACE_ELEMENTS;
42    const int MeshAdapter::ReducedFaceElements=FINLEY_REDUCED_FACE_ELEMENTS;
43  const int MeshAdapter::Points=FINLEY_POINTS;  const int MeshAdapter::Points=FINLEY_POINTS;
44  const int MeshAdapter::ContactElementsZero=FINLEY_CONTACT_ELEMENTS_1;  const int MeshAdapter::ContactElementsZero=FINLEY_CONTACT_ELEMENTS_1;
45    const int MeshAdapter::ReducedContactElementsZero=FINLEY_REDUCED_CONTACT_ELEMENTS_1;
46  const int MeshAdapter::ContactElementsOne=FINLEY_CONTACT_ELEMENTS_2;  const int MeshAdapter::ContactElementsOne=FINLEY_CONTACT_ELEMENTS_2;
47    const int MeshAdapter::ReducedContactElementsOne=FINLEY_REDUCED_CONTACT_ELEMENTS_2;
48    
49  MeshAdapter::MeshAdapter(Finley_Mesh* finleyMesh)  MeshAdapter::MeshAdapter(Finley_Mesh* finleyMesh)
50  {  {
51    setFunctionSpaceTypeNames();    setFunctionSpaceTypeNames();
52    //    //
53    // need to use a null_deleter as Finley_Mesh_dealloc deletes the pointer    // need to use a null_deleter as Finley_Mesh_free deletes the pointer
54    // for us.    // for us.
55    m_finleyMesh.reset(finleyMesh,null_deleter());    m_finleyMesh.reset(finleyMesh,null_deleter());
56  }  }
# Line 58  MeshAdapter::~MeshAdapter() Line 69  MeshAdapter::~MeshAdapter()
69    // I hope the case for the pointer being zero has been taken care of.    // I hope the case for the pointer being zero has been taken care of.
70    //  cout << "In MeshAdapter destructor." << endl;    //  cout << "In MeshAdapter destructor." << endl;
71    if (m_finleyMesh.unique()) {    if (m_finleyMesh.unique()) {
72      //   cout << "Calling dealloc." << endl;      Finley_Mesh_free(m_finleyMesh.get());
     Finley_Mesh_dealloc(m_finleyMesh.get());  
     //   cout << "Finished dealloc." << endl;  
73    }    }
74  }  }
75    
76    int MeshAdapter::getMPISize() const
77    {
78       return m_finleyMesh.get()->MPIInfo->size;
79    }
80    int MeshAdapter::getMPIRank() const
81    {
82       return m_finleyMesh.get()->MPIInfo->rank;
83    }
84    
85    
86  Finley_Mesh* MeshAdapter::getFinley_Mesh() const {  Finley_Mesh* MeshAdapter::getFinley_Mesh() const {
87     return m_finleyMesh.get();     return m_finleyMesh.get();
88  }  }
# Line 77  void MeshAdapter::write(const std::strin Line 96  void MeshAdapter::write(const std::strin
96    TMPMEMFREE(fName);    TMPMEMFREE(fName);
97  }  }
98    
99    void MeshAdapter::Print_Mesh_Info(const bool full=false) const
100    {
101      Finley_PrintMesh_Info(m_finleyMesh.get(), full);
102    }
103    
104    void MeshAdapter::dump(const std::string& fileName) const
105    {
106    #ifdef USE_NETCDF
107       const NcDim* ncdims[25]; /* ksteube how big should ncdims be? */
108       NcVar *ids, *data;
109       int *int_ptr;
110       Finley_Mesh *mesh = m_finleyMesh.get();
111       int mpi_size             = mesh->MPIInfo->size;
112       int mpi_rank             = mesh->MPIInfo->rank;
113       int numDim               = mesh->Nodes->numDim;
114       int numNodes             = mesh->Nodes->numNodes;
115       int num_Elements         = mesh->Elements->numElements;
116       int num_FaceElements         = mesh->FaceElements->numElements;
117       int num_ContactElements      = mesh->ContactElements->numElements;
118       int num_Points           = mesh->Points->numElements;
119       int num_Elements_numNodes        = mesh->Elements->numNodes;
120       int num_FaceElements_numNodes    = mesh->FaceElements->numNodes;
121       int num_ContactElements_numNodes = mesh->ContactElements->numNodes;
122       char *newFileName = Paso_MPI_appendRankToFileName(strdup(fileName.c_str()), mpi_size, mpi_rank);
123    
124       // NetCDF error handler
125       NcError err(NcError::verbose_nonfatal);
126       // Create the file.
127       NcFile dataFile(newFileName, NcFile::Replace);
128       // check if writing was successful
129       if (!dataFile.is_valid())
130            throw DataException("Error - MeshAdapter::dump: opening of NetCDF file for output failed: " + *newFileName);
131    
132       // Define dimensions (num_Elements and dim_Elements are identical, dim_Elements only appears if > 0)
133       if (! (ncdims[0] = dataFile.add_dim("numNodes", numNodes)) )
134            throw DataException("Error - MeshAdapter::dump: appending dimension numNodes to netCDF file failed: " + *newFileName);
135       if (! (ncdims[1] = dataFile.add_dim("numDim", numDim)) )
136            throw DataException("Error - MeshAdapter::dump: appending dimension numDim to netCDF file failed: " + *newFileName);
137       if (! (ncdims[2] = dataFile.add_dim("mpi_size_plus_1", mpi_size+1)) )
138            throw DataException("Error - MeshAdapter::dump: appending dimension mpi_size to netCDF file failed: " + *newFileName);
139       if (num_Elements>0)
140          if (! (ncdims[3] = dataFile.add_dim("dim_Elements", num_Elements)) )
141            throw DataException("Error - MeshAdapter::dump: appending dimension dim_Elements to netCDF file failed: " + *newFileName);
142       if (num_FaceElements>0)
143          if (! (ncdims[4] = dataFile.add_dim("dim_FaceElements", num_FaceElements)) )
144            throw DataException("Error - MeshAdapter::dump: appending dimension dim_FaceElements to netCDF file failed: " + *newFileName);
145       if (num_ContactElements>0)
146          if (! (ncdims[5] = dataFile.add_dim("dim_ContactElements", num_ContactElements)) )
147            throw DataException("Error - MeshAdapter::dump: appending dimension dim_ContactElements to netCDF file failed: " + *newFileName);
148       if (num_Points>0)
149          if (! (ncdims[6] = dataFile.add_dim("dim_Points", num_Points)) )
150            throw DataException("Error - MeshAdapter::dump: appending dimension dim_Points to netCDF file failed: " + *newFileName);
151       if (num_Elements>0)
152          if (! (ncdims[7] = dataFile.add_dim("dim_Elements_Nodes", num_Elements_numNodes)) )
153            throw DataException("Error - MeshAdapter::dump: appending dimension dim_Elements_Nodes to netCDF file failed: " + *newFileName);
154       if (num_FaceElements>0)
155          if (! (ncdims[8] = dataFile.add_dim("dim_FaceElements_numNodes", num_FaceElements_numNodes)) )
156            throw DataException("Error - MeshAdapter::dump: appending dimension dim_FaceElements_numNodes to netCDF file failed: " + *newFileName);
157       if (num_ContactElements>0)
158          if (! (ncdims[9] = dataFile.add_dim("dim_ContactElements_numNodes", num_ContactElements_numNodes)) )
159            throw DataException("Error - MeshAdapter::dump: appending dimension dim_ContactElements_numNodes to netCDF file failed: " + *newFileName);
160    
161       // MPI size, MPI rank, Name, order, reduced_order
162       if (!dataFile.add_att("mpi_size", mpi_size) )
163            throw DataException("Error - MeshAdapter::dump: appending mpi_size to NetCDF file failed: " + *newFileName);
164       if (!dataFile.add_att("mpi_rank", mpi_rank) )
165            throw DataException("Error - MeshAdapter::dump: appending mpi_rank to NetCDF file failed: " + *newFileName);
166       if (!dataFile.add_att("Name",mesh->Name) )
167            throw DataException("Error - MeshAdapter::dump: appending Name to NetCDF file failed: " + *newFileName);
168       if (!dataFile.add_att("order",mesh->order) )
169            throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
170       if (!dataFile.add_att("reduced_order",mesh->reduced_order) )
171            throw DataException("Error - MeshAdapter::dump: appending reduced_order to NetCDF file failed: " + *newFileName);
172       if (!dataFile.add_att("num_Elements",num_Elements) )
173            throw DataException("Error - MeshAdapter::dump: appending num_Elements to NetCDF file failed: " + *newFileName);
174       if (!dataFile.add_att("num_FaceElements",num_FaceElements) )
175            throw DataException("Error - MeshAdapter::dump: appending num_FaceElements to NetCDF file failed: " + *newFileName);
176       if (!dataFile.add_att("num_ContactElements",num_ContactElements) )
177            throw DataException("Error - MeshAdapter::dump: appending num_ContactElements to NetCDF file failed: " + *newFileName);
178       if (!dataFile.add_att("num_Points",num_Points) )
179            throw DataException("Error - MeshAdapter::dump: appending num_Points to NetCDF file failed: " + *newFileName);
180    
181       // // // // // Nodes // // // // //
182    
183       // Nodes Id
184       if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )
185            throw DataException("Error - MeshAdapter::dump: appending Nodes_Id to netCDF file failed: " + *newFileName);
186       int_ptr = &mesh->Nodes->Id[0];
187       if (! (ids->put(int_ptr, numNodes)) )
188            throw DataException("Error - MeshAdapter::dump: copy Nodes_Id to netCDF buffer failed: " + *newFileName);
189    
190       // Nodes Tag
191       if (! ( ids = dataFile.add_var("Nodes_Tag", ncInt, ncdims[0])) )
192            throw DataException("Error - MeshAdapter::dump: appending Nodes_Tag to netCDF file failed: " + *newFileName);
193       int_ptr = &mesh->Nodes->Tag[0];
194       if (! (ids->put(int_ptr, numNodes)) )
195            throw DataException("Error - MeshAdapter::dump: copy Nodes_Tag to netCDF buffer failed: " + *newFileName);
196    
197       // Nodes gDOF
198       if (! ( ids = dataFile.add_var("Nodes_gDOF", ncInt, ncdims[0])) )
199            throw DataException("Error - MeshAdapter::dump: appending Nodes_gDOF to netCDF file failed: " + *newFileName);
200       int_ptr = &mesh->Nodes->globalDegreesOfFreedom[0];
201       if (! (ids->put(int_ptr, numNodes)) )
202            throw DataException("Error - MeshAdapter::dump: copy Nodes_gDOF to netCDF buffer failed: " + *newFileName);
203    
204       // Nodes global node index
205       if (! ( ids = dataFile.add_var("Nodes_gNI", ncInt, ncdims[0])) )
206            throw DataException("Error - MeshAdapter::dump: appending Nodes_gNI to netCDF file failed: " + *newFileName);
207       int_ptr = &mesh->Nodes->globalNodesIndex[0];
208       if (! (ids->put(int_ptr, numNodes)) )
209            throw DataException("Error - MeshAdapter::dump: copy Nodes_gNI to netCDF buffer failed: " + *newFileName);
210    
211       // Nodes grDof
212       if (! ( ids = dataFile.add_var("Nodes_grDfI", ncInt, ncdims[0])) )
213            throw DataException("Error - MeshAdapter::dump: appending Nodes_grDfI to netCDF file failed: " + *newFileName);
214       int_ptr = &mesh->Nodes->globalReducedDOFIndex[0];
215       if (! (ids->put(int_ptr, numNodes)) )
216            throw DataException("Error - MeshAdapter::dump: copy Nodes_grDfI to netCDF buffer failed: " + *newFileName);
217    
218       // Nodes grNI
219       if (! ( ids = dataFile.add_var("Nodes_grNI", ncInt, ncdims[0])) )
220            throw DataException("Error - MeshAdapter::dump: appending Nodes_grNI to netCDF file failed: " + *newFileName);
221       int_ptr = &mesh->Nodes->globalReducedNodesIndex[0];
222       if (! (ids->put(int_ptr, numNodes)) )
223            throw DataException("Error - MeshAdapter::dump: copy Nodes_grNI to netCDF buffer failed: " + *newFileName);
224    
225       // Nodes Coordinates
226       if (! ( ids = dataFile.add_var("Nodes_Coordinates", ncDouble, ncdims[0], ncdims[1]) ) )
227            throw DataException("Error - MeshAdapter::dump: appending Nodes_Coordinates to netCDF file failed: " + *newFileName);
228       if (! (ids->put(&(mesh->Nodes->Coordinates[INDEX2(0,0,numDim)]), numNodes, numDim)) )
229            throw DataException("Error - MeshAdapter::dump: copy Nodes_Coordinates to netCDF buffer failed: " + *newFileName);
230    
231       // Nodes degreesOfFreedomDistribution
232       if (! ( ids = dataFile.add_var("Nodes_DofDistribution", ncInt, ncdims[2])) )
233            throw DataException("Error - MeshAdapter::dump: appending Nodes_DofDistribution to netCDF file failed: " + *newFileName);
234       int_ptr = &mesh->Nodes->degreesOfFreedomDistribution->first_component[0];
235       if (! (ids->put(int_ptr, mpi_size+1)) )
236            throw DataException("Error - MeshAdapter::dump: copy Nodes_DofDistribution to netCDF buffer failed: " + *newFileName);
237    
238       // // // // // Elements // // // // //
239    
240       // Only write elements if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)
241       if (num_Elements>0) {
242    
243         // Temp storage to gather node IDs
244         int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);
245    
246         // Elements ReferenceElement->ElementTypeId
247         if (!dataFile.add_att("Elements_TypeId", mesh->Elements->ReferenceElement->Type->TypeId) )
248            throw DataException("Error - MeshAdapter::dump: appending Elements_TypeId to NetCDF file failed: " + *newFileName);
249    
250         // Elements_Id
251         if (! ( ids = dataFile.add_var("Elements_Id", ncInt, ncdims[3])) )
252            throw DataException("Error - MeshAdapter::dump: appending Elements_Id to netCDF file failed: " + *newFileName);
253         int_ptr = &mesh->Elements->Id[0];
254         if (! (ids->put(int_ptr, num_Elements)) )
255            throw DataException("Error - MeshAdapter::dump: copy Elements_Id to netCDF buffer failed: " + *newFileName);
256    
257         // Elements_Tag
258         if (! ( ids = dataFile.add_var("Elements_Tag", ncInt, ncdims[3])) )
259            throw DataException("Error - MeshAdapter::dump: appending Elements_Tag to netCDF file failed: " + *newFileName);
260         int_ptr = &mesh->Elements->Tag[0];
261         if (! (ids->put(int_ptr, num_Elements)) )
262            throw DataException("Error - MeshAdapter::dump: copy Elements_Tag to netCDF buffer failed: " + *newFileName);
263    
264         // Elements_Owner
265         if (! ( ids = dataFile.add_var("Elements_Owner", ncInt, ncdims[3])) )
266            throw DataException("Error - MeshAdapter::dump: appending Elements_Owner to netCDF file failed: " + *newFileName);
267         int_ptr = &mesh->Elements->Owner[0];
268         if (! (ids->put(int_ptr, num_Elements)) )
269            throw DataException("Error - MeshAdapter::dump: copy Elements_Owner to netCDF buffer failed: " + *newFileName);
270    
271         // Elements_Color
272         if (! ( ids = dataFile.add_var("Elements_Color", ncInt, ncdims[3])) )
273            throw DataException("Error - MeshAdapter::dump: appending Elements_Color to netCDF file failed: " + *newFileName);
274         int_ptr = &mesh->Elements->Color[0];
275         if (! (ids->put(int_ptr, num_Elements)) )
276            throw DataException("Error - MeshAdapter::dump: copy Elements_Color to netCDF buffer failed: " + *newFileName);
277    
278         // Elements_Nodes
279         for (int i=0; i<num_Elements; i++)
280           for (int j=0; j<num_Elements_numNodes; j++)
281             Elements_Nodes[INDEX2(j,i,num_Elements_numNodes)] = mesh->Nodes->Id[mesh->Elements->Nodes[INDEX2(j,i,num_Elements_numNodes)]];
282         if (! ( ids = dataFile.add_var("Elements_Nodes", ncInt, ncdims[3], ncdims[7]) ) )
283            throw DataException("Error - MeshAdapter::dump: appending Elements_Nodes to netCDF file failed: " + *newFileName);
284         if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )
285            throw DataException("Error - MeshAdapter::dump: copy Elements_Nodes to netCDF buffer failed: " + *newFileName);
286    
287       }
288    
289       // // // // // Face_Elements // // // // //
290    
291       if (num_FaceElements>0) {
292    
293         // Temp storage to gather node IDs
294         int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);
295    
296         // FaceElements ReferenceElement->ElementTypeId
297         if (!dataFile.add_att("FaceElements_TypeId", mesh->FaceElements->ReferenceElement->Type->TypeId) )
298            throw DataException("Error - MeshAdapter::dump: appending FaceElements_TypeId to NetCDF file failed: " + *newFileName);
299    
300         // FaceElements_Id
301         if (! ( ids = dataFile.add_var("FaceElements_Id", ncInt, ncdims[4])) )
302            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Id to netCDF file failed: " + *newFileName);
303         int_ptr = &mesh->FaceElements->Id[0];
304         if (! (ids->put(int_ptr, num_FaceElements)) )
305            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Id to netCDF buffer failed: " + *newFileName);
306    
307         // FaceElements_Tag
308         if (! ( ids = dataFile.add_var("FaceElements_Tag", ncInt, ncdims[4])) )
309            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Tag to netCDF file failed: " + *newFileName);
310         int_ptr = &mesh->FaceElements->Tag[0];
311         if (! (ids->put(int_ptr, num_FaceElements)) )
312            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Tag to netCDF buffer failed: " + *newFileName);
313    
314         // FaceElements_Owner
315         if (! ( ids = dataFile.add_var("FaceElements_Owner", ncInt, ncdims[4])) )
316            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Owner to netCDF file failed: " + *newFileName);
317         int_ptr = &mesh->FaceElements->Owner[0];
318         if (! (ids->put(int_ptr, num_FaceElements)) )
319            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Owner to netCDF buffer failed: " + *newFileName);
320    
321         // FaceElements_Color
322         if (! ( ids = dataFile.add_var("FaceElements_Color", ncInt, ncdims[4])) )
323            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Color to netCDF file failed: " + *newFileName);
324         int_ptr = &mesh->FaceElements->Color[0];
325         if (! (ids->put(int_ptr, num_FaceElements)) )
326            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Color to netCDF buffer failed: " + *newFileName);
327    
328         // FaceElements_Nodes
329         for (int i=0; i<num_FaceElements; i++)
330           for (int j=0; j<num_FaceElements_numNodes; j++)
331             FaceElements_Nodes[INDEX2(j,i,num_FaceElements_numNodes)] = mesh->Nodes->Id[mesh->FaceElements->Nodes[INDEX2(j,i,num_FaceElements_numNodes)]];
332         if (! ( ids = dataFile.add_var("FaceElements_Nodes", ncInt, ncdims[4], ncdims[8]) ) )
333            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Nodes to netCDF file failed: " + *newFileName);
334         if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )
335            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Nodes to netCDF buffer failed: " + *newFileName);
336    
337       }
338    
339       // // // // // Contact_Elements // // // // //
340    
341       if (num_ContactElements>0) {
342    
343         // Temp storage to gather node IDs
344         int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);
345    
346         // ContactElements ReferenceElement->ElementTypeId
347         if (!dataFile.add_att("ContactElements_TypeId", mesh->ContactElements->ReferenceElement->Type->TypeId) )
348            throw DataException("Error - MeshAdapter::dump: appending ContactElements_TypeId to NetCDF file failed: " + *newFileName);
349    
350         // ContactElements_Id
351         if (! ( ids = dataFile.add_var("ContactElements_Id", ncInt, ncdims[5])) )
352            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Id to netCDF file failed: " + *newFileName);
353         int_ptr = &mesh->ContactElements->Id[0];
354         if (! (ids->put(int_ptr, num_ContactElements)) )
355            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Id to netCDF buffer failed: " + *newFileName);
356    
357         // ContactElements_Tag
358         if (! ( ids = dataFile.add_var("ContactElements_Tag", ncInt, ncdims[5])) )
359            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Tag to netCDF file failed: " + *newFileName);
360         int_ptr = &mesh->ContactElements->Tag[0];
361         if (! (ids->put(int_ptr, num_ContactElements)) )
362            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Tag to netCDF buffer failed: " + *newFileName);
363    
364         // ContactElements_Owner
365         if (! ( ids = dataFile.add_var("ContactElements_Owner", ncInt, ncdims[5])) )
366            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Owner to netCDF file failed: " + *newFileName);
367         int_ptr = &mesh->ContactElements->Owner[0];
368         if (! (ids->put(int_ptr, num_ContactElements)) )
369            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Owner to netCDF buffer failed: " + *newFileName);
370    
371         // ContactElements_Color
372         if (! ( ids = dataFile.add_var("ContactElements_Color", ncInt, ncdims[5])) )
373            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Color to netCDF file failed: " + *newFileName);
374         int_ptr = &mesh->ContactElements->Color[0];
375         if (! (ids->put(int_ptr, num_ContactElements)) )
376            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Color to netCDF buffer failed: " + *newFileName);
377    
378         // ContactElements_Nodes
379         for (int i=0; i<num_ContactElements; i++)
380           for (int j=0; j<num_ContactElements_numNodes; j++)
381             ContactElements_Nodes[INDEX2(j,i,num_ContactElements_numNodes)] = mesh->Nodes->Id[mesh->ContactElements->Nodes[INDEX2(j,i,num_ContactElements_numNodes)]];
382         if (! ( ids = dataFile.add_var("ContactElements_Nodes", ncInt, ncdims[5], ncdims[9]) ) )
383            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Nodes to netCDF file failed: " + *newFileName);
384         if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )
385            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Nodes to netCDF buffer failed: " + *newFileName);
386    
387       }
388    
389       // // // // // Points // // // // //
390    
391       if (num_Points>0) {
392    
393         fprintf(stderr, "\n\n\nWARNING: MeshAdapter::dump has not been tested with Point elements\n\n\n");
394    
395         // Temp storage to gather node IDs
396         int *Points_Nodes = TMPMEMALLOC(num_Points,int);
397    
398         // Points ReferenceElement->ElementTypeId
399         if (!dataFile.add_att("Points_TypeId", mesh->Points->ReferenceElement->Type->TypeId) )
400            throw DataException("Error - MeshAdapter::dump: appending Points_TypeId to NetCDF file failed: " + *newFileName);
401    
402         // Points_Id
403         if (! ( ids = dataFile.add_var("Points_Id", ncInt, ncdims[6])) )
404            throw DataException("Error - MeshAdapter::dump: appending Points_Id to netCDF file failed: " + *newFileName);
405         int_ptr = &mesh->Points->Id[0];
406         if (! (ids->put(int_ptr, num_Points)) )
407            throw DataException("Error - MeshAdapter::dump: copy Points_Id to netCDF buffer failed: " + *newFileName);
408    
409         // Points_Tag
410         if (! ( ids = dataFile.add_var("Points_Tag", ncInt, ncdims[6])) )
411            throw DataException("Error - MeshAdapter::dump: appending Points_Tag to netCDF file failed: " + *newFileName);
412         int_ptr = &mesh->Points->Tag[0];
413         if (! (ids->put(int_ptr, num_Points)) )
414            throw DataException("Error - MeshAdapter::dump: copy Points_Tag to netCDF buffer failed: " + *newFileName);
415    
416         // Points_Owner
417         if (! ( ids = dataFile.add_var("Points_Owner", ncInt, ncdims[6])) )
418            throw DataException("Error - MeshAdapter::dump: appending Points_Owner to netCDF file failed: " + *newFileName);
419         int_ptr = &mesh->Points->Owner[0];
420         if (! (ids->put(int_ptr, num_Points)) )
421            throw DataException("Error - MeshAdapter::dump: copy Points_Owner to netCDF buffer failed: " + *newFileName);
422    
423         // Points_Color
424         if (! ( ids = dataFile.add_var("Points_Color", ncInt, ncdims[6])) )
425            throw DataException("Error - MeshAdapter::dump: appending Points_Color to netCDF file failed: " + *newFileName);
426         int_ptr = &mesh->Points->Color[0];
427         if (! (ids->put(int_ptr, num_Points)) )
428            throw DataException("Error - MeshAdapter::dump: copy Points_Color to netCDF buffer failed: " + *newFileName);
429    
430         // Points_Nodes
431         // mesh->Nodes->Id[mesh->Points->Nodes[INDEX2(0,i,1)]]
432         for (int i=0; i<num_Points; i++)
433           Points_Nodes[i] = mesh->Nodes->Id[mesh->Points->Nodes[INDEX2(0,i,1)]];
434         if (! ( ids = dataFile.add_var("Points_Nodes", ncInt, ncdims[6]) ) )
435            throw DataException("Error - MeshAdapter::dump: appending Points_Nodes to netCDF file failed: " + *newFileName);
436         if (! (ids->put(&(Points_Nodes[0]), num_Points)) )
437            throw DataException("Error - MeshAdapter::dump: copy Points_Nodes to netCDF buffer failed: " + *newFileName);
438    
439       }
440    
441       // // // // // TagMap // // // // //
442    
443         fprintf(stderr, "\n\n\nWARNING: MeshAdapter::dump does not save the TagMap yet\n\n\n");
444    
445       // NetCDF file is closed by destructor of NcFile object
446    #else
447       Finley_setError(IO_ERROR, "MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");
448    #endif  /* USE_NETCDF */
449       checkFinleyError();
450    }
451    
452  string MeshAdapter::getDescription() const  string MeshAdapter::getDescription() const
453  {  {
454    return "FinleyMesh";    return "FinleyMesh";
# Line 109  void MeshAdapter::setFunctionSpaceTypeNa Line 481  void MeshAdapter::setFunctionSpaceTypeNa
481    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
482      (FunctionSpaceNamesMapType::value_type(Nodes,"Finley_Nodes"));      (FunctionSpaceNamesMapType::value_type(Nodes,"Finley_Nodes"));
483    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
484        (FunctionSpaceNamesMapType::value_type(ReducedNodes,"Finley_Reduced_Nodes"));
485      m_functionSpaceTypeNames.insert
486      (FunctionSpaceNamesMapType::value_type(Elements,"Finley_Elements"));      (FunctionSpaceNamesMapType::value_type(Elements,"Finley_Elements"));
487    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
488        (FunctionSpaceNamesMapType::value_type(ReducedElements,"Finley_Reduced_Elements"));
489      m_functionSpaceTypeNames.insert
490      (FunctionSpaceNamesMapType::value_type(FaceElements,"Finley_Face_Elements"));      (FunctionSpaceNamesMapType::value_type(FaceElements,"Finley_Face_Elements"));
491    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
492        (FunctionSpaceNamesMapType::value_type(ReducedFaceElements,"Finley_Reduced_Face_Elements"));
493      m_functionSpaceTypeNames.insert
494      (FunctionSpaceNamesMapType::value_type(Points,"Finley_Points"));      (FunctionSpaceNamesMapType::value_type(Points,"Finley_Points"));
495    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
496      (FunctionSpaceNamesMapType::value_type(ContactElementsZero,"Finley_Contact_Elements_0"));      (FunctionSpaceNamesMapType::value_type(ContactElementsZero,"Finley_Contact_Elements_0"));
497    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
498        (FunctionSpaceNamesMapType::value_type(ReducedContactElementsZero,"Finley_Reduced_Contact_Elements_0"));
499      m_functionSpaceTypeNames.insert
500      (FunctionSpaceNamesMapType::value_type(ContactElementsOne,"Finley_Contact_Elements_1"));      (FunctionSpaceNamesMapType::value_type(ContactElementsOne,"Finley_Contact_Elements_1"));
501      m_functionSpaceTypeNames.insert
502        (FunctionSpaceNamesMapType::value_type(ReducedContactElementsOne,"Finley_Reduced_Contact_Elements_1"));
503  }  }
504    
505  int MeshAdapter::getContinuousFunctionCode() const  int MeshAdapter::getContinuousFunctionCode() const
506  {  {
507    return Nodes;    return Nodes;
508  }  }
509    int MeshAdapter::getReducedContinuousFunctionCode() const
510    {
511      return ReducedNodes;
512    }
513    
514  int MeshAdapter::getFunctionCode() const  int MeshAdapter::getFunctionCode() const
515  {  {
516    return Elements;    return Elements;
517  }  }
518    int MeshAdapter::getReducedFunctionCode() const
519    {
520      return ReducedElements;
521    }
522    
523  int MeshAdapter::getFunctionOnBoundaryCode() const  int MeshAdapter::getFunctionOnBoundaryCode() const
524  {  {
525    return FaceElements;    return FaceElements;
526  }  }
527    int MeshAdapter::getReducedFunctionOnBoundaryCode() const
528    {
529      return ReducedFaceElements;
530    }
531    
532  int MeshAdapter::getFunctionOnContactZeroCode() const  int MeshAdapter::getFunctionOnContactZeroCode() const
533  {  {
534    return ContactElementsZero;    return ContactElementsZero;
535  }  }
536    int MeshAdapter::getReducedFunctionOnContactZeroCode() const
537    {
538      return ReducedContactElementsZero;
539    }
540    
541  int MeshAdapter::getFunctionOnContactOneCode() const  int MeshAdapter::getFunctionOnContactOneCode() const
542  {  {
543    return ContactElementsOne;    return ContactElementsOne;
544  }  }
545    int MeshAdapter::getReducedFunctionOnContactOneCode() const
546    {
547      return ReducedContactElementsOne;
548    }
549    
550  int MeshAdapter::getSolutionCode() const  int MeshAdapter::getSolutionCode() const
551  {  {
# Line 182  pair<int,int> MeshAdapter::getDataShape( Line 584  pair<int,int> MeshAdapter::getDataShape(
584     switch (functionSpaceCode) {     switch (functionSpaceCode) {
585        case(Nodes):        case(Nodes):
586             numDataPointsPerSample=1;             numDataPointsPerSample=1;
587             if (mesh->Nodes!=NULL) numSamples=mesh->Nodes->numNodes;             numSamples=Finley_NodeFile_getNumNodes(mesh->Nodes);
588               break;
589          case(ReducedNodes):
590               numDataPointsPerSample=1;
591               numSamples=Finley_NodeFile_getNumReducedNodes(mesh->Nodes);
592             break;             break;
593        case(Elements):        case(Elements):
594             if (mesh->Elements!=NULL) {             if (mesh->Elements!=NULL) {
# Line 190  pair<int,int> MeshAdapter::getDataShape( Line 596  pair<int,int> MeshAdapter::getDataShape(
596               numDataPointsPerSample=mesh->Elements->ReferenceElement->numQuadNodes;               numDataPointsPerSample=mesh->Elements->ReferenceElement->numQuadNodes;
597             }             }
598             break;             break;
599          case(ReducedElements):
600               if (mesh->Elements!=NULL) {
601                 numSamples=mesh->Elements->numElements;
602                 numDataPointsPerSample=mesh->Elements->ReferenceElementReducedOrder->numQuadNodes;
603               }
604               break;
605        case(FaceElements):        case(FaceElements):
606             if (mesh->FaceElements!=NULL) {             if (mesh->FaceElements!=NULL) {
607                  numDataPointsPerSample=mesh->FaceElements->ReferenceElement->numQuadNodes;                  numDataPointsPerSample=mesh->FaceElements->ReferenceElement->numQuadNodes;
608                  numSamples=mesh->FaceElements->numElements;                  numSamples=mesh->FaceElements->numElements;
609             }             }
610             break;             break;
611          case(ReducedFaceElements):
612               if (mesh->FaceElements!=NULL) {
613                    numDataPointsPerSample=mesh->FaceElements->ReferenceElementReducedOrder->numQuadNodes;
614                    numSamples=mesh->FaceElements->numElements;
615               }
616               break;
617        case(Points):        case(Points):
618             if (mesh->Points!=NULL) {             if (mesh->Points!=NULL) {
619               numDataPointsPerSample=1;               numDataPointsPerSample=1;
# Line 208  pair<int,int> MeshAdapter::getDataShape( Line 626  pair<int,int> MeshAdapter::getDataShape(
626               numSamples=mesh->ContactElements->numElements;               numSamples=mesh->ContactElements->numElements;
627             }             }
628             break;             break;
629          case(ReducedContactElementsZero):
630               if (mesh->ContactElements!=NULL) {
631                 numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;
632                 numSamples=mesh->ContactElements->numElements;
633               }
634               break;
635        case(ContactElementsOne):        case(ContactElementsOne):
636             if (mesh->ContactElements!=NULL) {             if (mesh->ContactElements!=NULL) {
637               numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;               numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;
638               numSamples=mesh->ContactElements->numElements;               numSamples=mesh->ContactElements->numElements;
639             }             }
640             break;             break;
641          case(ReducedContactElementsOne):
642               if (mesh->ContactElements!=NULL) {
643                 numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;
644                 numSamples=mesh->ContactElements->numElements;
645               }
646               break;
647        case(DegreesOfFreedom):        case(DegreesOfFreedom):
648             if (mesh->Nodes!=NULL) {             if (mesh->Nodes!=NULL) {
649               numDataPointsPerSample=1;               numDataPointsPerSample=1;
650  #ifndef PASO_MPI               numSamples=Finley_NodeFile_getNumDegreesOfFreedom(mesh->Nodes);
              numSamples=mesh->Nodes->numDegreesOfFreedom;  
 #else  
              numSamples=mesh->Nodes->degreeOfFreedomDistribution->numLocal;  
 #endif  
651             }             }
652             break;             break;
653        case(ReducedDegreesOfFreedom):        case(ReducedDegreesOfFreedom):
654             if (mesh->Nodes!=NULL) {             if (mesh->Nodes!=NULL) {
655               numDataPointsPerSample=1;               numDataPointsPerSample=1;
656  #ifndef PASO_MPI               numSamples=Finley_NodeFile_getNumReducedDegreesOfFreedom(mesh->Nodes);
              numSamples=mesh->Nodes->reducedNumDegreesOfFreedom;  
 #else  
              numSamples=mesh->Nodes->reducedDegreeOfFreedomDistribution->numLocal;  
 #endif  
657             }             }
658             break;             break;
659        default:        default:
# Line 276  void MeshAdapter::addPDEToSystem( Line 698  void MeshAdapter::addPDEToSystem(
698     checkFinleyError();     checkFinleyError();
699  }  }
700    
701    void  MeshAdapter::addPDEToLumpedSystem(
702                         escript::Data& mat,
703                         const escript::Data& D,
704                         const escript::Data& d) const
705    {
706       escriptDataC _mat=mat.getDataC();
707       escriptDataC _D=D.getDataC();
708       escriptDataC _d=d.getDataC();
709    
710       Finley_Mesh* mesh=m_finleyMesh.get();
711    
712       Finley_Assemble_LumpedSystem(mesh->Nodes,mesh->Elements,&_mat, &_D);
713       Finley_Assemble_LumpedSystem(mesh->Nodes,mesh->FaceElements,&_mat, &_d);
714    
715       checkFinleyError();
716    }
717    
718    
719  //  //
720  // adds linear PDE of second order into the right hand side only  // adds linear PDE of second order into the right hand side only
721  //  //
# Line 312  void MeshAdapter::interpolateOnDomain(es Line 752  void MeshAdapter::interpolateOnDomain(es
752      throw FinleyAdapterException("Error - Illegal domain of interpolation target.");      throw FinleyAdapterException("Error - Illegal domain of interpolation target.");
753    
754    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
755      escriptDataC _target=target.getDataC();
756      escriptDataC _in=in.getDataC();
757    switch(in.getFunctionSpace().getTypeCode()) {    switch(in.getFunctionSpace().getTypeCode()) {
758       case(Nodes):       case(Nodes):
759          switch(target.getFunctionSpace().getTypeCode()) {          switch(target.getFunctionSpace().getTypeCode()) {
760             case(Nodes):             case(Nodes):
761               case(ReducedNodes):
762               case(DegreesOfFreedom):
763             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
764                   Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
765                   break;
766               case(Elements):
767               case(ReducedElements):
768                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
769                   break;
770               case(FaceElements):
771               case(ReducedFaceElements):
772                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
773                   break;
774               case(Points):
775                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
776                   break;
777               case(ContactElementsZero):
778               case(ReducedContactElementsZero):
779                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
780                   break;
781               case(ContactElementsOne):
782               case(ReducedContactElementsOne):
783                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
784                   break;
785               default:
786                   stringstream temp;
787                   temp << "Error - Interpolation on Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
788                   throw FinleyAdapterException(temp.str());
789                   break;
790            }
791            break;
792         case(ReducedNodes):
793            switch(target.getFunctionSpace().getTypeCode()) {
794               case(Nodes):
795               case(ReducedNodes):
796             case(DegreesOfFreedom):             case(DegreesOfFreedom):
797                 Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));             case(ReducedDegreesOfFreedom):
798                   Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
799                 break;                 break;
800             case(Elements):             case(Elements):
801                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(in.getDataC()),&(target.getDataC()));             case(ReducedElements):
802                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
803                 break;                 break;
804             case(FaceElements):             case(FaceElements):
805                 Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(in.getDataC()),&(target.getDataC()));             case(ReducedFaceElements):
806                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
807                 break;                 break;
808             case(Points):             case(Points):
809                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(in.getDataC()),&(target.getDataC()));                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
810                 break;                 break;
811             case(ContactElementsZero):             case(ContactElementsZero):
812                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));             case(ReducedContactElementsZero):
813                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
814                 break;                 break;
815             case(ContactElementsOne):             case(ContactElementsOne):
816                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));             case(ReducedContactElementsOne):
817                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
818                 break;                 break;
819             default:             default:
820                 stringstream temp;                 stringstream temp;
# Line 344  void MeshAdapter::interpolateOnDomain(es Line 825  void MeshAdapter::interpolateOnDomain(es
825          break;          break;
826       case(Elements):       case(Elements):
827          if (target.getFunctionSpace().getTypeCode()==Elements) {          if (target.getFunctionSpace().getTypeCode()==Elements) {
828             Finley_Assemble_CopyElementData(mesh->Elements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);
829            } else if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
830               Finley_Assemble_AverageElementData(mesh->Elements,&_target,&_in);
831          } else {          } else {
832             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");
833          }          }
834          break;          break;
835         case(ReducedElements):
836            if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
837               Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);
838            } else {
839               throw FinleyAdapterException("Error - No interpolation with data on elements with reduced integration order possible.");
840            }
841            break;
842       case(FaceElements):       case(FaceElements):
843          if (target.getFunctionSpace().getTypeCode()==FaceElements) {          if (target.getFunctionSpace().getTypeCode()==FaceElements) {
844             Finley_Assemble_CopyElementData(mesh->FaceElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
845            } else if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
846               Finley_Assemble_AverageElementData(mesh->FaceElements,&_target,&_in);
847          } else {          } else {
848             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");
            break;  
849         }         }
850           break;
851         case(ReducedFaceElements):
852            if (target.getFunctionSpace().getTypeCode()==FaceElements) {
853               Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
854            } else {
855               throw FinleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");
856           }
857           break;
858       case(Points):       case(Points):
859          if (target.getFunctionSpace().getTypeCode()==Points) {          if (target.getFunctionSpace().getTypeCode()==Points) {
860             Finley_Assemble_CopyElementData(mesh->Points,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Points,&_target,&_in);
861          } else {          } else {
862             throw FinleyAdapterException("Error - No interpolation with data on points possible.");             throw FinleyAdapterException("Error - No interpolation with data on points possible.");
            break;  
863          }          }
864          break;          break;
865       case(ContactElementsZero):       case(ContactElementsZero):
866       case(ContactElementsOne):       case(ContactElementsOne):
867          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {
868             Finley_Assemble_CopyElementData(mesh->ContactElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
869            } else if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {
870               Finley_Assemble_AverageElementData(mesh->ContactElements,&_target,&_in);
871          } else {          } else {
872             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");
873             break;             break;
874          }          }
875          break;          break;
876         case(ReducedContactElementsZero):
877         case(ReducedContactElementsOne):
878            if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {
879               Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
880            } else {
881               throw FinleyAdapterException("Error - No interpolation with data on contact elements with reduced integration order possible.");
882               break;
883            }
884            break;
885       case(DegreesOfFreedom):             case(DegreesOfFreedom):      
886          switch(target.getFunctionSpace().getTypeCode()) {          switch(target.getFunctionSpace().getTypeCode()) {
887             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
888             case(DegreesOfFreedom):             case(DegreesOfFreedom):
889             case(Nodes):                Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
               Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));  
890                break;                break;
891  #ifndef PASO_MPI  
892             case(Elements):             case(Nodes):
893                Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(in.getDataC()),&(target.getDataC()));             case(ReducedNodes):
894                break;                if (getMPISize()>1) {
895             case(FaceElements):                    escript::Data temp=escript::Data(in);
896                Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(in.getDataC()),&(target.getDataC()));                    temp.expand();
897                break;                    escriptDataC _in2 = temp.getDataC();
898             case(Points):                    Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);
899                Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(in.getDataC()),&(target.getDataC()));                } else {
900                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
901                  }
902                break;                break;
            case(ContactElementsZero):  
            case(ContactElementsOne):  
               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));  
              break;  
 #else  
            /* need to copy Degrees of freedom data to nodal data so that the external values are available */  
903             case(Elements):             case(Elements):
904             {             case(ReducedElements):
905                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );                if (getMPISize()>1) {
906                Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(nodeTemp.getDataC()),&(target.getDataC()));                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
907                     escriptDataC _in2 = temp.getDataC();
908                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);
909                  } else {
910                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
911                  }
912                break;                break;
            }  
913             case(FaceElements):             case(FaceElements):
914             {             case(ReducedFaceElements):
915                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );                if (getMPISize()>1) {
916                Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(nodeTemp.getDataC()),&(target.getDataC()));                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
917                     escriptDataC _in2 = temp.getDataC();
918                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);
919    
920                  } else {
921                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
922                  }
923                break;                break;
            }  
924             case(Points):             case(Points):
925             {                if (getMPISize()>1) {
926                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
927                Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(nodeTemp.getDataC()),&(target.getDataC()));                   escriptDataC _in2 = temp.getDataC();
928                  } else {
929                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
930                  }
931                break;                break;
            }  
932             case(ContactElementsZero):             case(ContactElementsZero):
933             case(ContactElementsOne):             case(ContactElementsOne):
934             {             case(ReducedContactElementsZero):
935                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );             case(ReducedContactElementsOne):
936                Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(nodeTemp.getDataC()),&(target.getDataC()));                if (getMPISize()>1) {
937                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
938                     escriptDataC _in2 = temp.getDataC();
939                     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);
940                  } else {
941                     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
942                  }
943               break;               break;
            }  
 #endif  
944             default:             default:
945               stringstream temp;               stringstream temp;
946               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
# Line 431  void MeshAdapter::interpolateOnDomain(es Line 950  void MeshAdapter::interpolateOnDomain(es
950          break;          break;
951       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
952         switch(target.getFunctionSpace().getTypeCode()) {         switch(target.getFunctionSpace().getTypeCode()) {
953              case(Nodes):
954                 throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");
955                 break;
956              case(ReducedNodes):
957                  if (getMPISize()>1) {
958                      escript::Data temp=escript::Data(in);
959                      temp.expand();
960                      escriptDataC _in2 = temp.getDataC();
961                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);
962                  } else {
963                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
964                  }
965                  break;
966              case(DegreesOfFreedom):
967                 throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");
968                 break;
969            case(ReducedDegreesOfFreedom):            case(ReducedDegreesOfFreedom):
970               Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));               Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
971               break;               break;
972            case(Elements):            case(Elements):
973               Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(in.getDataC()),&(target.getDataC()));            case(ReducedElements):
974                  if (getMPISize()>1) {
975                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
976                     escriptDataC _in2 = temp.getDataC();
977                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);
978                  } else {
979                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
980                 }
981               break;               break;
982            case(FaceElements):            case(FaceElements):
983               Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(in.getDataC()),&(target.getDataC()));            case(ReducedFaceElements):
984                  if (getMPISize()>1) {
985                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
986                     escriptDataC _in2 = temp.getDataC();
987                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);
988                  } else {
989                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
990                  }
991               break;               break;
992            case(Points):            case(Points):
993               Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(in.getDataC()),&(target.getDataC()));                if (getMPISize()>1) {
994                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
995                     escriptDataC _in2 = temp.getDataC();
996                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in2,&_target);
997                  } else {
998                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
999                 }
1000               break;               break;
1001            case(ContactElementsZero):            case(ContactElementsZero):
1002            case(ContactElementsOne):            case(ContactElementsOne):
1003               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));            case(ReducedContactElementsZero):
1004               break;            case(ReducedContactElementsOne):
1005            case(Nodes):                if (getMPISize()>1) {
1006               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1007               break;                   escriptDataC _in2 = temp.getDataC();
1008            case(DegreesOfFreedom):                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);
1009               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");                } else {
1010                     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
1011                 }
1012               break;               break;
1013            default:            default:
1014               stringstream temp;               stringstream temp;
# Line 480  void MeshAdapter::setToX(escript::Data& Line 1037  void MeshAdapter::setToX(escript::Data&
1037    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1038    // in case of values node coordinates we can do the job directly:    // in case of values node coordinates we can do the job directly:
1039    if (arg.getFunctionSpace().getTypeCode()==Nodes) {    if (arg.getFunctionSpace().getTypeCode()==Nodes) {
1040       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(arg.getDataC()));       escriptDataC _arg=arg.getDataC();
1041         Finley_Assemble_NodeCoordinates(mesh->Nodes,&_arg);
1042    } else {    } else {
1043       escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);       escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);
1044       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(tmp_data.getDataC()));       escriptDataC _tmp_data=tmp_data.getDataC();
1045         Finley_Assemble_NodeCoordinates(mesh->Nodes,&_tmp_data);
1046       // this is then interpolated onto arg:       // this is then interpolated onto arg:
1047       interpolateOnDomain(arg,tmp_data);       interpolateOnDomain(arg,tmp_data);
1048    }    }
# Line 499  void MeshAdapter::setToNormal(escript::D Line 1058  void MeshAdapter::setToNormal(escript::D
1058    if (normalDomain!=*this)    if (normalDomain!=*this)
1059       throw FinleyAdapterException("Error - Illegal domain of normal locations");       throw FinleyAdapterException("Error - Illegal domain of normal locations");
1060    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1061      escriptDataC _normal=normal.getDataC();
1062    switch(normal.getFunctionSpace().getTypeCode()) {    switch(normal.getFunctionSpace().getTypeCode()) {
1063      case(Nodes):      case(Nodes):
1064        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");
1065        break;        break;
1066        case(ReducedNodes):
1067          throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced nodes");
1068          break;
1069      case(Elements):      case(Elements):
1070        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");
1071        break;        break;
1072        case(ReducedElements):
1073          throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements with reduced integration order");
1074          break;
1075      case (FaceElements):      case (FaceElements):
1076        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);
1077          break;
1078        case (ReducedFaceElements):
1079          Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);
1080        break;        break;
1081      case(Points):      case(Points):
1082        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for point elements");        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for point elements");
1083        break;        break;
1084      case (ContactElementsOne):      case (ContactElementsOne):
1085      case (ContactElementsZero):      case (ContactElementsZero):
1086        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);
1087          break;
1088        case (ReducedContactElementsOne):
1089        case (ReducedContactElementsZero):
1090          Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);
1091        break;        break;
1092      case(DegreesOfFreedom):      case(DegreesOfFreedom):
1093        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for degrees of freedom.");        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for degrees of freedom.");
# Line 552  void MeshAdapter::setToIntegrals(std::ve Line 1125  void MeshAdapter::setToIntegrals(std::ve
1125    if (argDomain!=*this)    if (argDomain!=*this)
1126       throw FinleyAdapterException("Error - Illegal domain of integration kernel");       throw FinleyAdapterException("Error - Illegal domain of integration kernel");
1127    
1128      double blocktimer_start = blocktimer_time();
1129    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1130      escriptDataC _temp;
1131      escript::Data temp;
1132      escriptDataC _arg=arg.getDataC();
1133    switch(arg.getFunctionSpace().getTypeCode()) {    switch(arg.getFunctionSpace().getTypeCode()) {
1134       case(Nodes):       case(Nodes):
1135          throw FinleyAdapterException("Error - Integral of data on nodes is not supported.");          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1136            _temp=temp.getDataC();
1137            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1138            break;
1139         case(ReducedNodes):
1140            temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1141            _temp=temp.getDataC();
1142            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1143          break;          break;
1144       case(Elements):       case(Elements):
1145          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);
1146            break;
1147         case(ReducedElements):
1148            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);
1149          break;          break;
1150       case(FaceElements):       case(FaceElements):
1151          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);
1152            break;
1153         case(ReducedFaceElements):
1154            Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);
1155          break;          break;
1156       case(Points):       case(Points):
1157          throw FinleyAdapterException("Error - Integral of data on points is not supported.");          throw FinleyAdapterException("Error - Integral of data on points is not supported.");
1158          break;          break;
1159       case(ContactElementsZero):       case(ContactElementsZero):
1160          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1161            break;
1162         case(ReducedContactElementsZero):
1163            Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1164          break;          break;
1165       case(ContactElementsOne):       case(ContactElementsOne):
1166          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1167            break;
1168         case(ReducedContactElementsOne):
1169            Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1170          break;          break;
1171       case(DegreesOfFreedom):       case(DegreesOfFreedom):
1172          throw FinleyAdapterException("Error - Integral of data on degrees of freedom is not supported.");          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1173            _temp=temp.getDataC();
1174            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1175          break;          break;
1176       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
1177          throw FinleyAdapterException("Error - Integral of data on reduced degrees of freedom is not supported.");          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1178            _temp=temp.getDataC();
1179            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1180          break;          break;
1181       default:       default:
1182          stringstream temp;          stringstream temp;
# Line 585  void MeshAdapter::setToIntegrals(std::ve Line 1185  void MeshAdapter::setToIntegrals(std::ve
1185          break;          break;
1186    }    }
1187    checkFinleyError();    checkFinleyError();
1188      blocktimer_increment("integrate()", blocktimer_start);
1189  }  }
1190    
1191  //  //
# Line 600  void MeshAdapter::setToGradient(escript: Line 1201  void MeshAdapter::setToGradient(escript:
1201       throw FinleyAdapterException("Error - Illegal domain of gradient");       throw FinleyAdapterException("Error - Illegal domain of gradient");
1202    
1203    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1204      escriptDataC _grad=grad.getDataC();
1205    escriptDataC nodeDataC;    escriptDataC nodeDataC;
1206  #ifdef PASO_MPI    escript::Data temp;
1207    escript::Data nodeTemp( arg, continuousFunction(asAbstractContinuousDomain()) );    if (getMPISize()>1) {
1208    if( arg.getFunctionSpace().getTypeCode() != Nodes )        if( arg.getFunctionSpace().getTypeCode() == DegreesOfFreedom ) {
1209    {          temp=escript::Data( arg,  continuousFunction(asAbstractContinuousDomain()) );
1210      Finley_Assemble_CopyNodalData(mesh->Nodes,&(nodeTemp.getDataC()),&(arg.getDataC()));          nodeDataC = temp.getDataC();
1211      nodeDataC = nodeTemp.getDataC();        } else if( arg.getFunctionSpace().getTypeCode() == ReducedDegreesOfFreedom ) {
1212            temp=escript::Data( arg,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1213            nodeDataC = temp.getDataC();
1214          } else {
1215            nodeDataC = arg.getDataC();
1216          }
1217      } else {
1218         nodeDataC = arg.getDataC();
1219    }    }
   else  
     nodeDataC = arg.getDataC();  
 #else  
   nodeDataC = arg.getDataC();  
 #endif  
1220    switch(grad.getFunctionSpace().getTypeCode()) {    switch(grad.getFunctionSpace().getTypeCode()) {
1221         case(Nodes):         case(Nodes):
1222            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");
1223            break;            break;
1224           case(ReducedNodes):
1225              throw FinleyAdapterException("Error - Gradient at reduced nodes is not supported.");
1226              break;
1227         case(Elements):         case(Elements):
1228            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);
1229              break;
1230           case(ReducedElements):
1231              Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);
1232            break;            break;
1233         case(FaceElements):         case(FaceElements):
1234            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);
1235              break;
1236           case(ReducedFaceElements):
1237              Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);
1238            break;            break;
1239         case(Points):         case(Points):
1240            throw FinleyAdapterException("Error - Gradient at points is not supported.");            throw FinleyAdapterException("Error - Gradient at points is not supported.");
1241            break;            break;
1242         case(ContactElementsZero):         case(ContactElementsZero):
1243            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1244              break;
1245           case(ReducedContactElementsZero):
1246              Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1247            break;            break;
1248         case(ContactElementsOne):         case(ContactElementsOne):
1249            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1250              break;
1251           case(ReducedContactElementsOne):
1252              Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1253            break;            break;
1254         case(DegreesOfFreedom):         case(DegreesOfFreedom):
1255            throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");            throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");
# Line 658  void MeshAdapter::setToSize(escript::Dat Line 1277  void MeshAdapter::setToSize(escript::Dat
1277         case(Nodes):         case(Nodes):
1278            throw FinleyAdapterException("Error - Size of nodes is not supported.");            throw FinleyAdapterException("Error - Size of nodes is not supported.");
1279            break;            break;
1280           case(ReducedNodes):
1281              throw FinleyAdapterException("Error - Size of reduced nodes is not supported.");
1282              break;
1283         case(Elements):         case(Elements):
1284            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
1285            break;            break;
1286           case(ReducedElements):
1287              Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
1288              break;
1289         case(FaceElements):         case(FaceElements):
1290            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
1291            break;            break;
1292           case(ReducedFaceElements):
1293              Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
1294              break;
1295         case(Points):         case(Points):
1296            throw FinleyAdapterException("Error - Size of point elements is not supported.");            throw FinleyAdapterException("Error - Size of point elements is not supported.");
1297            break;            break;
# Line 671  void MeshAdapter::setToSize(escript::Dat Line 1299  void MeshAdapter::setToSize(escript::Dat
1299         case(ContactElementsOne):         case(ContactElementsOne):
1300            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
1301            break;            break;
1302           case(ReducedContactElementsZero):
1303           case(ReducedContactElementsOne):
1304              Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
1305              break;
1306         case(DegreesOfFreedom):         case(DegreesOfFreedom):
1307            throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");            throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");
1308            break;            break;
# Line 715  void MeshAdapter::saveDX(const std::stri Line 1347  void MeshAdapter::saveDX(const std::stri
1347    escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;    escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;
1348    escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;    escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;
1349    
1350      boost::python::list keys=arg.keys();    boost::python::list keys=arg.keys();
1351      for (int i=0;i<num_data;++i) {    for (int i=0;i<num_data;++i) {
1352             std::string n=boost::python::extract<std::string>(keys[i]);
1353           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1354           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
1355               throw FinleyAdapterException("Error  in saveDX: Data must be defined on same Domain");               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1356           data[i]=d.getDataC();           data[i]=d.getDataC();
1357           ptr_data[i]=&(data[i]);           ptr_data[i]=&(data[i]);
          std::string n=boost::python::extract<std::string>(keys[i]);  
1358           c_names[i]=&(names[i][0]);           c_names[i]=&(names[i][0]);
1359           if (n.length()>MAX_namelength-1) {           if (n.length()>MAX_namelength-1) {
1360              strncpy(c_names[i],n.c_str(),MAX_namelength-1);              strncpy(c_names[i],n.c_str(),MAX_namelength-1);
# Line 765  void MeshAdapter::saveVTK(const std::str Line 1397  void MeshAdapter::saveVTK(const std::str
1397    
1398      boost::python::list keys=arg.keys();      boost::python::list keys=arg.keys();
1399      for (int i=0;i<num_data;++i) {      for (int i=0;i<num_data;++i) {
1400             std::string n=boost::python::extract<std::string>(keys[i]);
1401           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1402           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
1403               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1404           data[i]=d.getDataC();           data[i]=d.getDataC();
1405           ptr_data[i]=&(data[i]);           ptr_data[i]=&(data[i]);
          std::string n=boost::python::extract<std::string>(keys[i]);  
1406           c_names[i]=&(names[i][0]);           c_names[i]=&(names[i][0]);
1407           if (n.length()>MAX_namelength-1) {           if (n.length()>MAX_namelength-1) {
1408              strncpy(c_names[i],n.c_str(),MAX_namelength-1);              strncpy(c_names[i],n.c_str(),MAX_namelength-1);
# Line 779  void MeshAdapter::saveVTK(const std::str Line 1411  void MeshAdapter::saveVTK(const std::str
1411              strcpy(c_names[i],n.c_str());              strcpy(c_names[i],n.c_str());
1412           }           }
1413      }      }
 #ifndef PASO_MPI      
1414      Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);      Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);
 #else  
     Finley_Mesh_saveVTK_MPIO(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);  
 #endif  
1415    
1416  checkFinleyError();    checkFinleyError();
1417    /* win32 refactor */    /* win32 refactor */
1418    TMPMEMFREE(c_names);    TMPMEMFREE(c_names);
1419    TMPMEMFREE(data);    TMPMEMFREE(data);
# Line 836  SystemMatrixAdapter MeshAdapter::newSyst Line 1464  SystemMatrixAdapter MeshAdapter::newSyst
1464            
1465      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);
1466      checkFinleyError();      checkFinleyError();
1467      Paso_SystemMatrix* fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);      Paso_SystemMatrix* fsystemMatrix;
1468        int trilinos = 0;
1469        if (trilinos) {
1470    #ifdef TRILINOS
1471          /* Allocation Epetra_VrbMatrix here */
1472    #endif
1473        }
1474        else {
1475          fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);
1476        }
1477      checkPasoError();      checkPasoError();
1478      Paso_SystemMatrixPattern_dealloc(fsystemMatrixPattern);      Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1479      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
1480  }  }
1481    
# Line 862  bool MeshAdapter::isCellOriented(int fun Line 1499  bool MeshAdapter::isCellOriented(int fun
1499         case(Points):         case(Points):
1500         case(ContactElementsZero):         case(ContactElementsZero):
1501         case(ContactElementsOne):         case(ContactElementsOne):
1502           case(ReducedElements):
1503           case(ReducedFaceElements):
1504           case(ReducedContactElementsZero):
1505           case(ReducedContactElementsOne):
1506            return true;            return true;
1507            break;            break;
1508         default:         default:
# Line 880  bool MeshAdapter::probeInterpolationOnDo Line 1521  bool MeshAdapter::probeInterpolationOnDo
1521       case(Nodes):       case(Nodes):
1522          switch(functionSpaceType_target) {          switch(functionSpaceType_target) {
1523             case(Nodes):             case(Nodes):
1524               case(ReducedNodes):
1525             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
1526             case(DegreesOfFreedom):             case(DegreesOfFreedom):
1527             case(Elements):             case(Elements):
1528               case(ReducedElements):
1529             case(FaceElements):             case(FaceElements):
1530               case(ReducedFaceElements):
1531             case(Points):             case(Points):
1532             case(ContactElementsZero):             case(ContactElementsZero):
1533               case(ReducedContactElementsZero):
1534             case(ContactElementsOne):             case(ContactElementsOne):
1535               case(ReducedContactElementsOne):
1536                 return true;                 return true;
1537             default:             default:
1538                 stringstream temp;                 stringstream temp;
# Line 894  bool MeshAdapter::probeInterpolationOnDo Line 1540  bool MeshAdapter::probeInterpolationOnDo
1540                 throw FinleyAdapterException(temp.str());                 throw FinleyAdapterException(temp.str());
1541          }          }
1542          break;          break;
1543         case(ReducedNodes):
1544            switch(functionSpaceType_target) {
1545               case(ReducedNodes):
1546               case(ReducedDegreesOfFreedom):
1547               case(Elements):
1548               case(ReducedElements):
1549               case(FaceElements):
1550               case(ReducedFaceElements):
1551               case(Points):
1552               case(ContactElementsZero):
1553               case(ReducedContactElementsZero):
1554               case(ContactElementsOne):
1555               case(ReducedContactElementsOne):
1556                   return true;
1557              case(Nodes):
1558              case(DegreesOfFreedom):
1559                 return false;
1560               default:
1561                   stringstream temp;
1562                   temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1563                   throw FinleyAdapterException(temp.str());
1564            }
1565            break;
1566       case(Elements):       case(Elements):
1567          if (functionSpaceType_target==Elements) {          if (functionSpaceType_target==Elements) {
1568             return true;             return true;
1569            } else if (functionSpaceType_target==ReducedElements) {
1570               return true;
1571            } else {
1572               return false;
1573            }
1574         case(ReducedElements):
1575            if (functionSpaceType_target==ReducedElements) {
1576               return true;
1577          } else {          } else {
1578             return false;             return false;
1579          }          }
1580       case(FaceElements):       case(FaceElements):
1581          if (functionSpaceType_target==FaceElements) {          if (functionSpaceType_target==FaceElements) {
1582             return true;             return true;
1583            } else if (functionSpaceType_target==ReducedFaceElements) {
1584               return true;
1585            } else {
1586               return false;
1587            }
1588         case(ReducedFaceElements):
1589            if (functionSpaceType_target==ReducedFaceElements) {
1590               return true;
1591          } else {          } else {
1592             return false;             return false;
1593          }          }
# Line 916  bool MeshAdapter::probeInterpolationOnDo Line 1601  bool MeshAdapter::probeInterpolationOnDo
1601       case(ContactElementsOne):       case(ContactElementsOne):
1602          if (functionSpaceType_target==ContactElementsZero || functionSpaceType_target==ContactElementsOne) {          if (functionSpaceType_target==ContactElementsZero || functionSpaceType_target==ContactElementsOne) {
1603             return true;             return true;
1604            } else if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {
1605               return true;
1606            } else {
1607               return false;
1608            }
1609         case(ReducedContactElementsZero):
1610         case(ReducedContactElementsOne):
1611            if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {
1612               return true;
1613          } else {          } else {
1614             return false;             return false;
1615          }          }
# Line 924  bool MeshAdapter::probeInterpolationOnDo Line 1618  bool MeshAdapter::probeInterpolationOnDo
1618             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
1619             case(DegreesOfFreedom):             case(DegreesOfFreedom):
1620             case(Nodes):             case(Nodes):
1621               case(ReducedNodes):
1622             case(Elements):             case(Elements):
1623             case(FaceElements):             case(ReducedElements):
1624             case(Points):             case(Points):
1625               case(FaceElements):
1626               case(ReducedFaceElements):
1627             case(ContactElementsZero):             case(ContactElementsZero):
1628               case(ReducedContactElementsZero):
1629             case(ContactElementsOne):             case(ContactElementsOne):
1630               case(ReducedContactElementsOne):
1631                return true;                return true;
1632             default:             default:
1633               stringstream temp;               stringstream temp;
# Line 939  bool MeshAdapter::probeInterpolationOnDo Line 1638  bool MeshAdapter::probeInterpolationOnDo
1638       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
1639         switch(functionSpaceType_target) {         switch(functionSpaceType_target) {
1640            case(ReducedDegreesOfFreedom):            case(ReducedDegreesOfFreedom):
1641              case(ReducedNodes):
1642            case(Elements):            case(Elements):
1643              case(ReducedElements):
1644            case(FaceElements):            case(FaceElements):
1645              case(ReducedFaceElements):
1646            case(Points):            case(Points):
1647            case(ContactElementsZero):            case(ContactElementsZero):
1648              case(ReducedContactElementsZero):
1649            case(ContactElementsOne):            case(ContactElementsOne):
1650              case(ReducedContactElementsOne):
1651                return true;                return true;
1652            case(Nodes):            case(Nodes):
1653            case(DegreesOfFreedom):            case(DegreesOfFreedom):
# Line 1006  escript::Data MeshAdapter::getSize() con Line 1710  escript::Data MeshAdapter::getSize() con
1710    return function(asAbstractContinuousDomain()).getSize();    return function(asAbstractContinuousDomain()).getSize();
1711  }  }
1712    
1713    int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const
1714    {
1715      int *out=0,i;
1716      Finley_Mesh* mesh=m_finleyMesh.get();
1717      switch (functionSpaceType) {
1718        case(Nodes):
1719          out=mesh->Nodes->Id;
1720          break;
1721        case(ReducedNodes):
1722          out=mesh->Nodes->reducedNodesId;
1723          break;
1724        case(Elements):
1725          out=mesh->Elements->Id;
1726          break;
1727        case(ReducedElements):
1728          out=mesh->Elements->Id;
1729          break;
1730        case(FaceElements):
1731          out=mesh->FaceElements->Id;
1732          break;
1733        case(ReducedFaceElements):
1734          out=mesh->FaceElements->Id;
1735          break;
1736        case(Points):
1737          out=mesh->Points->Id;
1738          break;
1739        case(ContactElementsZero):
1740          out=mesh->ContactElements->Id;
1741          break;
1742        case(ReducedContactElementsZero):
1743          out=mesh->ContactElements->Id;
1744          break;
1745        case(ContactElementsOne):
1746          out=mesh->ContactElements->Id;
1747          break;
1748        case(ReducedContactElementsOne):
1749          out=mesh->ContactElements->Id;
1750          break;
1751        case(DegreesOfFreedom):
1752          out=mesh->Nodes->degreesOfFreedomId;
1753          break;
1754        case(ReducedDegreesOfFreedom):
1755          out=mesh->Nodes->reducedDegreesOfFreedomId;
1756          break;
1757        default:
1758          stringstream temp;
1759          temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
1760          throw FinleyAdapterException(temp.str());
1761          break;
1762      }
1763      return out;
1764    }
1765  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
1766  {  {
1767    int out=0;    int out=0;
# Line 1014  int MeshAdapter::getTagFromSampleNo(int Line 1770  int MeshAdapter::getTagFromSampleNo(int
1770    case(Nodes):    case(Nodes):
1771      out=mesh->Nodes->Tag[sampleNo];      out=mesh->Nodes->Tag[sampleNo];
1772      break;      break;
1773      case(ReducedNodes):
1774        throw FinleyAdapterException(" Error - ReducedNodes does not support tags.");
1775        break;
1776    case(Elements):    case(Elements):
1777      out=mesh->Elements->Tag[sampleNo];      out=mesh->Elements->Tag[sampleNo];
1778      break;      break;
1779      case(ReducedElements):
1780        out=mesh->Elements->Tag[sampleNo];
1781        break;
1782    case(FaceElements):    case(FaceElements):
1783      out=mesh->FaceElements->Tag[sampleNo];      out=mesh->FaceElements->Tag[sampleNo];
1784      break;      break;
1785      case(ReducedFaceElements):
1786        out=mesh->FaceElements->Tag[sampleNo];
1787        break;
1788    case(Points):    case(Points):
1789      out=mesh->Points->Tag[sampleNo];      out=mesh->Points->Tag[sampleNo];
1790      break;      break;
1791    case(ContactElementsZero):    case(ContactElementsZero):
1792      out=mesh->ContactElements->Tag[sampleNo];      out=mesh->ContactElements->Tag[sampleNo];
1793      break;      break;
1794    case(ContactElementsOne):    case(ReducedContactElementsZero):
1795      out=mesh->ContactElements->Tag[sampleNo];      out=mesh->ContactElements->Tag[sampleNo];
1796      break;      break;
   case(DegreesOfFreedom):  
     break;  
   case(ReducedDegreesOfFreedom):  
     break;  
   default:  
     stringstream temp;  
     temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();  
     throw FinleyAdapterException(temp.str());  
     break;  
   }  
   return out;  
 }  
 int MeshAdapter::getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const  
 {  
   int out=0,i;  
   Finley_Mesh* mesh=m_finleyMesh.get();  
   switch (functionSpaceType) {  
   case(Nodes):  
     if (mesh->Nodes!=NULL) {  
       out=mesh->Nodes->Id[sampleNo];  
       break;  
     }  
   case(Elements):  
     out=mesh->Elements->Id[sampleNo];  
     break;  
   case(FaceElements):  
     out=mesh->FaceElements->Id[sampleNo];  
     break;  
   case(Points):  
     out=mesh->Points->Id[sampleNo];  
     break;  
   case(ContactElementsZero):  
     out=mesh->ContactElements->Id[sampleNo];  
     break;  
1797    case(ContactElementsOne):    case(ContactElementsOne):
1798      out=mesh->ContactElements->Id[sampleNo];      out=mesh->ContactElements->Tag[sampleNo];
1799        break;
1800      case(ReducedContactElementsOne):
1801        out=mesh->ContactElements->Tag[sampleNo];
1802      break;      break;
1803    case(DegreesOfFreedom):    case(DegreesOfFreedom):
1804      for (i=0;i<mesh->Nodes->numNodes; ++i) {      throw FinleyAdapterException(" Error - DegreesOfFreedom does not support tags.");
        if (mesh->Nodes->degreeOfFreedom[i]==sampleNo) {  
           out=mesh->Nodes->Id[i];  
           break;  
        }  
     }  
1805      break;      break;
1806    case(ReducedDegreesOfFreedom):    case(ReducedDegreesOfFreedom):
1807      for (i=0;i<mesh->Nodes->numNodes; ++i) {      throw FinleyAdapterException(" Error - ReducedDegreesOfFreedom does not support tags.");
        if (mesh->Nodes->reducedDegreeOfFreedom[i]==sampleNo) {  
           out=mesh->Nodes->Id[i];  
           break;  
        }  
     }  
1808      break;      break;
1809    default:    default:
1810      stringstream temp;      stringstream temp;
# Line 1091  int MeshAdapter::getReferenceNoFromSampl Line 1815  int MeshAdapter::getReferenceNoFromSampl
1815    return out;    return out;
1816  }  }
1817    
1818    
1819  void MeshAdapter::setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const  void MeshAdapter::setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const
1820  {  {
1821    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
# Line 1099  void MeshAdapter::setTags(const int func Line 1824  void MeshAdapter::setTags(const int func
1824         case(Nodes):         case(Nodes):
1825            Finley_NodeFile_setTags(mesh->Nodes,newTag,&tmp);            Finley_NodeFile_setTags(mesh->Nodes,newTag,&tmp);
1826            break;            break;
1827           case(ReducedNodes):
1828              throw FinleyAdapterException("Error - ReducedNodes does not support tags");
1829              break;
1830         case(DegreesOfFreedom):         case(DegreesOfFreedom):
1831            throw FinleyAdapterException("Error - DegreesOfFreedom does not support tags");            throw FinleyAdapterException("Error - DegreesOfFreedom does not support tags");
1832            break;            break;
# Line 1108  void MeshAdapter::setTags(const int func Line 1836  void MeshAdapter::setTags(const int func
1836         case(Elements):         case(Elements):
1837            Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);
1838            break;            break;
1839           case(ReducedElements):
1840              Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);
1841              break;
1842         case(FaceElements):         case(FaceElements):
1843            Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);
1844            break;            break;
1845           case(ReducedFaceElements):
1846              Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);
1847              break;
1848         case(Points):         case(Points):
1849            Finley_ElementFile_setTags(mesh->Points,newTag,&tmp);            Finley_ElementFile_setTags(mesh->Points,newTag,&tmp);
1850            break;            break;
1851         case(ContactElementsZero):         case(ContactElementsZero):
1852            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1853            break;            break;
1854           case(ReducedContactElementsZero):
1855              Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1856              break;
1857         case(ContactElementsOne):         case(ContactElementsOne):
1858            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1859            break;            break;
1860           case(ReducedContactElementsOne):
1861              Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1862              break;
1863         default:         default:
1864            stringstream temp;            stringstream temp;
1865            temp << "Error - Finley does not know anything about function space type " << functionSpaceType;            temp << "Error - Finley does not know anything about function space type " << functionSpaceType;
# Line 1129  void MeshAdapter::setTags(const int func Line 1869  void MeshAdapter::setTags(const int func
1869    return;    return;
1870  }  }
1871    
1872    void MeshAdapter::setTagMap(const std::string& name,  int tag)
1873    {
1874      Finley_Mesh* mesh=m_finleyMesh.get();
1875      Finley_Mesh_addTagMap(mesh, name.c_str(),tag);
1876      checkPasoError();
1877      // throwStandardException("MeshAdapter::set TagMap is not implemented.");
1878    }
1879    
1880    int MeshAdapter::getTag(const std::string& name) const
1881    {
1882      Finley_Mesh* mesh=m_finleyMesh.get();
1883      int tag=0;
1884      tag=Finley_Mesh_getTag(mesh, name.c_str());
1885      checkPasoError();
1886      // throwStandardException("MeshAdapter::getTag is not implemented.");
1887      return tag;
1888    }
1889    
1890    bool MeshAdapter::isValidTagName(const std::string& name) const
1891    {
1892      Finley_Mesh* mesh=m_finleyMesh.get();
1893      return Finley_Mesh_isValidTagName(mesh,name.c_str());
1894    }
1895    
1896    std::string MeshAdapter::showTagNames() const
1897    {
1898      stringstream temp;
1899      Finley_Mesh* mesh=m_finleyMesh.get();
1900      Finley_TagMap* tag_map=mesh->TagMap;
1901      while (tag_map) {
1902         temp << tag_map->name;
1903         tag_map=tag_map->next;
1904         if (tag_map) temp << ", ";
1905      }
1906      return temp.str();
1907    }
1908    
1909  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.798  
changed lines
  Added in v.1343

  ViewVC Help
Powered by ViewVC 1.1.26