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

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

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

revision 967 by gross, Tue Feb 13 09:40:12 2007 UTC revision 1345 by ksteube, Wed Nov 14 07:53:34 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  #ifdef PASO_MPI  /* $Id$ */
3  #include <mpi.h>  
4  #endif  /*******************************************************
5  #include "MeshAdapter.h"   *
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 32  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 61  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 80  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       // Attributes: 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("numDim",numDim) )
169            throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
170       if (!dataFile.add_att("order",mesh->order) )
171            throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
172       if (!dataFile.add_att("reduced_order",mesh->reduced_order) )
173            throw DataException("Error - MeshAdapter::dump: appending reduced_order to NetCDF file failed: " + *newFileName);
174       if (!dataFile.add_att("numNodes",numNodes) )
175            throw DataException("Error - MeshAdapter::dump: appending numNodes to NetCDF file failed: " + *newFileName);
176       if (!dataFile.add_att("num_Elements",num_Elements) )
177            throw DataException("Error - MeshAdapter::dump: appending num_Elements to NetCDF file failed: " + *newFileName);
178       if (!dataFile.add_att("num_FaceElements",num_FaceElements) )
179            throw DataException("Error - MeshAdapter::dump: appending num_FaceElements to NetCDF file failed: " + *newFileName);
180       if (!dataFile.add_att("num_ContactElements",num_ContactElements) )
181            throw DataException("Error - MeshAdapter::dump: appending num_ContactElements to NetCDF file failed: " + *newFileName);
182       if (!dataFile.add_att("num_Points",num_Points) )
183            throw DataException("Error - MeshAdapter::dump: appending num_Points to NetCDF file failed: " + *newFileName);
184    
185       // // // // // Nodes // // // // //
186    
187       // Only write nodes if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)
188       if (numNodes>0) {
189    
190       // Nodes Id
191       if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )
192            throw DataException("Error - MeshAdapter::dump: appending Nodes_Id to netCDF file failed: " + *newFileName);
193       int_ptr = &mesh->Nodes->Id[0];
194       if (! (ids->put(int_ptr, numNodes)) )
195            throw DataException("Error - MeshAdapter::dump: copy Nodes_Id to netCDF buffer failed: " + *newFileName);
196    
197       // Nodes Tag
198       if (! ( ids = dataFile.add_var("Nodes_Tag", ncInt, ncdims[0])) )
199            throw DataException("Error - MeshAdapter::dump: appending Nodes_Tag to netCDF file failed: " + *newFileName);
200       int_ptr = &mesh->Nodes->Tag[0];
201       if (! (ids->put(int_ptr, numNodes)) )
202            throw DataException("Error - MeshAdapter::dump: copy Nodes_Tag to netCDF buffer failed: " + *newFileName);
203    
204       // Nodes gDOF
205       if (! ( ids = dataFile.add_var("Nodes_gDOF", ncInt, ncdims[0])) )
206            throw DataException("Error - MeshAdapter::dump: appending Nodes_gDOF to netCDF file failed: " + *newFileName);
207       int_ptr = &mesh->Nodes->globalDegreesOfFreedom[0];
208       if (! (ids->put(int_ptr, numNodes)) )
209            throw DataException("Error - MeshAdapter::dump: copy Nodes_gDOF to netCDF buffer failed: " + *newFileName);
210    
211       // Nodes global node index
212       if (! ( ids = dataFile.add_var("Nodes_gNI", ncInt, ncdims[0])) )
213            throw DataException("Error - MeshAdapter::dump: appending Nodes_gNI to netCDF file failed: " + *newFileName);
214       int_ptr = &mesh->Nodes->globalNodesIndex[0];
215       if (! (ids->put(int_ptr, numNodes)) )
216            throw DataException("Error - MeshAdapter::dump: copy Nodes_gNI to netCDF buffer failed: " + *newFileName);
217    
218       // Nodes grDof
219       if (! ( ids = dataFile.add_var("Nodes_grDfI", ncInt, ncdims[0])) )
220            throw DataException("Error - MeshAdapter::dump: appending Nodes_grDfI to netCDF file failed: " + *newFileName);
221       int_ptr = &mesh->Nodes->globalReducedDOFIndex[0];
222       if (! (ids->put(int_ptr, numNodes)) )
223            throw DataException("Error - MeshAdapter::dump: copy Nodes_grDfI to netCDF buffer failed: " + *newFileName);
224    
225       // Nodes grNI
226       if (! ( ids = dataFile.add_var("Nodes_grNI", ncInt, ncdims[0])) )
227            throw DataException("Error - MeshAdapter::dump: appending Nodes_grNI to netCDF file failed: " + *newFileName);
228       int_ptr = &mesh->Nodes->globalReducedNodesIndex[0];
229       if (! (ids->put(int_ptr, numNodes)) )
230            throw DataException("Error - MeshAdapter::dump: copy Nodes_grNI to netCDF buffer failed: " + *newFileName);
231    
232       // Nodes Coordinates
233       if (! ( ids = dataFile.add_var("Nodes_Coordinates", ncDouble, ncdims[0], ncdims[1]) ) )
234            throw DataException("Error - MeshAdapter::dump: appending Nodes_Coordinates to netCDF file failed: " + *newFileName);
235       if (! (ids->put(&(mesh->Nodes->Coordinates[INDEX2(0,0,numDim)]), numNodes, numDim)) )
236            throw DataException("Error - MeshAdapter::dump: copy Nodes_Coordinates to netCDF buffer failed: " + *newFileName);
237    
238       // Nodes degreesOfFreedomDistribution
239       if (! ( ids = dataFile.add_var("Nodes_DofDistribution", ncInt, ncdims[2])) )
240            throw DataException("Error - MeshAdapter::dump: appending Nodes_DofDistribution to netCDF file failed: " + *newFileName);
241       int_ptr = &mesh->Nodes->degreesOfFreedomDistribution->first_component[0];
242       if (! (ids->put(int_ptr, mpi_size+1)) )
243            throw DataException("Error - MeshAdapter::dump: copy Nodes_DofDistribution to netCDF buffer failed: " + *newFileName);
244    
245       }
246    
247       // // // // // Elements // // // // //
248    
249       if (num_Elements>0) {
250    
251         // Temp storage to gather node IDs
252         int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);
253    
254         // Elements ReferenceElement->ElementTypeId
255         if (!dataFile.add_att("Elements_TypeId", mesh->Elements->ReferenceElement->Type->TypeId) )
256            throw DataException("Error - MeshAdapter::dump: appending Elements_TypeId to NetCDF file failed: " + *newFileName);
257    
258         // Elements_Id
259         if (! ( ids = dataFile.add_var("Elements_Id", ncInt, ncdims[3])) )
260            throw DataException("Error - MeshAdapter::dump: appending Elements_Id to netCDF file failed: " + *newFileName);
261         int_ptr = &mesh->Elements->Id[0];
262         if (! (ids->put(int_ptr, num_Elements)) )
263            throw DataException("Error - MeshAdapter::dump: copy Elements_Id to netCDF buffer failed: " + *newFileName);
264    
265         // Elements_Tag
266         if (! ( ids = dataFile.add_var("Elements_Tag", ncInt, ncdims[3])) )
267            throw DataException("Error - MeshAdapter::dump: appending Elements_Tag to netCDF file failed: " + *newFileName);
268         int_ptr = &mesh->Elements->Tag[0];
269         if (! (ids->put(int_ptr, num_Elements)) )
270            throw DataException("Error - MeshAdapter::dump: copy Elements_Tag to netCDF buffer failed: " + *newFileName);
271    
272         // Elements_Owner
273         if (! ( ids = dataFile.add_var("Elements_Owner", ncInt, ncdims[3])) )
274            throw DataException("Error - MeshAdapter::dump: appending Elements_Owner to netCDF file failed: " + *newFileName);
275         int_ptr = &mesh->Elements->Owner[0];
276         if (! (ids->put(int_ptr, num_Elements)) )
277            throw DataException("Error - MeshAdapter::dump: copy Elements_Owner to netCDF buffer failed: " + *newFileName);
278    
279         // Elements_Color
280         if (! ( ids = dataFile.add_var("Elements_Color", ncInt, ncdims[3])) )
281            throw DataException("Error - MeshAdapter::dump: appending Elements_Color to netCDF file failed: " + *newFileName);
282         int_ptr = &mesh->Elements->Color[0];
283         if (! (ids->put(int_ptr, num_Elements)) )
284            throw DataException("Error - MeshAdapter::dump: copy Elements_Color to netCDF buffer failed: " + *newFileName);
285    
286         // Elements_Nodes
287         for (int i=0; i<num_Elements; i++)
288           for (int j=0; j<num_Elements_numNodes; j++)
289             Elements_Nodes[INDEX2(j,i,num_Elements_numNodes)] = mesh->Nodes->Id[mesh->Elements->Nodes[INDEX2(j,i,num_Elements_numNodes)]];
290         if (! ( ids = dataFile.add_var("Elements_Nodes", ncInt, ncdims[3], ncdims[7]) ) )
291            throw DataException("Error - MeshAdapter::dump: appending Elements_Nodes to netCDF file failed: " + *newFileName);
292         if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )
293            throw DataException("Error - MeshAdapter::dump: copy Elements_Nodes to netCDF buffer failed: " + *newFileName);
294    
295         TMPMEMFREE(Elements_Nodes);
296    
297       }
298    
299       // // // // // Face_Elements // // // // //
300    
301       if (num_FaceElements>0) {
302    
303         // Temp storage to gather node IDs
304         int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);
305    
306         // FaceElements ReferenceElement->ElementTypeId
307         if (!dataFile.add_att("FaceElements_TypeId", mesh->FaceElements->ReferenceElement->Type->TypeId) )
308            throw DataException("Error - MeshAdapter::dump: appending FaceElements_TypeId to NetCDF file failed: " + *newFileName);
309    
310         // FaceElements_Id
311         if (! ( ids = dataFile.add_var("FaceElements_Id", ncInt, ncdims[4])) )
312            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Id to netCDF file failed: " + *newFileName);
313         int_ptr = &mesh->FaceElements->Id[0];
314         if (! (ids->put(int_ptr, num_FaceElements)) )
315            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Id to netCDF buffer failed: " + *newFileName);
316    
317         // FaceElements_Tag
318         if (! ( ids = dataFile.add_var("FaceElements_Tag", ncInt, ncdims[4])) )
319            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Tag to netCDF file failed: " + *newFileName);
320         int_ptr = &mesh->FaceElements->Tag[0];
321         if (! (ids->put(int_ptr, num_FaceElements)) )
322            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Tag to netCDF buffer failed: " + *newFileName);
323    
324         // FaceElements_Owner
325         if (! ( ids = dataFile.add_var("FaceElements_Owner", ncInt, ncdims[4])) )
326            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Owner to netCDF file failed: " + *newFileName);
327         int_ptr = &mesh->FaceElements->Owner[0];
328         if (! (ids->put(int_ptr, num_FaceElements)) )
329            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Owner to netCDF buffer failed: " + *newFileName);
330    
331         // FaceElements_Color
332         if (! ( ids = dataFile.add_var("FaceElements_Color", ncInt, ncdims[4])) )
333            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Color to netCDF file failed: " + *newFileName);
334         int_ptr = &mesh->FaceElements->Color[0];
335         if (! (ids->put(int_ptr, num_FaceElements)) )
336            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Color to netCDF buffer failed: " + *newFileName);
337    
338         // FaceElements_Nodes
339         for (int i=0; i<num_FaceElements; i++)
340           for (int j=0; j<num_FaceElements_numNodes; j++)
341             FaceElements_Nodes[INDEX2(j,i,num_FaceElements_numNodes)] = mesh->Nodes->Id[mesh->FaceElements->Nodes[INDEX2(j,i,num_FaceElements_numNodes)]];
342         if (! ( ids = dataFile.add_var("FaceElements_Nodes", ncInt, ncdims[4], ncdims[8]) ) )
343            throw DataException("Error - MeshAdapter::dump: appending FaceElements_Nodes to netCDF file failed: " + *newFileName);
344         if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )
345            throw DataException("Error - MeshAdapter::dump: copy FaceElements_Nodes to netCDF buffer failed: " + *newFileName);
346    
347         TMPMEMFREE(FaceElements_Nodes);
348    
349       }
350    
351       // // // // // Contact_Elements // // // // //
352    
353       if (num_ContactElements>0) {
354    
355         // Temp storage to gather node IDs
356         int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);
357    
358         // ContactElements ReferenceElement->ElementTypeId
359         if (!dataFile.add_att("ContactElements_TypeId", mesh->ContactElements->ReferenceElement->Type->TypeId) )
360            throw DataException("Error - MeshAdapter::dump: appending ContactElements_TypeId to NetCDF file failed: " + *newFileName);
361    
362         // ContactElements_Id
363         if (! ( ids = dataFile.add_var("ContactElements_Id", ncInt, ncdims[5])) )
364            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Id to netCDF file failed: " + *newFileName);
365         int_ptr = &mesh->ContactElements->Id[0];
366         if (! (ids->put(int_ptr, num_ContactElements)) )
367            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Id to netCDF buffer failed: " + *newFileName);
368    
369         // ContactElements_Tag
370         if (! ( ids = dataFile.add_var("ContactElements_Tag", ncInt, ncdims[5])) )
371            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Tag to netCDF file failed: " + *newFileName);
372         int_ptr = &mesh->ContactElements->Tag[0];
373         if (! (ids->put(int_ptr, num_ContactElements)) )
374            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Tag to netCDF buffer failed: " + *newFileName);
375    
376         // ContactElements_Owner
377         if (! ( ids = dataFile.add_var("ContactElements_Owner", ncInt, ncdims[5])) )
378            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Owner to netCDF file failed: " + *newFileName);
379         int_ptr = &mesh->ContactElements->Owner[0];
380         if (! (ids->put(int_ptr, num_ContactElements)) )
381            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Owner to netCDF buffer failed: " + *newFileName);
382    
383         // ContactElements_Color
384         if (! ( ids = dataFile.add_var("ContactElements_Color", ncInt, ncdims[5])) )
385            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Color to netCDF file failed: " + *newFileName);
386         int_ptr = &mesh->ContactElements->Color[0];
387         if (! (ids->put(int_ptr, num_ContactElements)) )
388            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Color to netCDF buffer failed: " + *newFileName);
389    
390         // ContactElements_Nodes
391         for (int i=0; i<num_ContactElements; i++)
392           for (int j=0; j<num_ContactElements_numNodes; j++)
393             ContactElements_Nodes[INDEX2(j,i,num_ContactElements_numNodes)] = mesh->Nodes->Id[mesh->ContactElements->Nodes[INDEX2(j,i,num_ContactElements_numNodes)]];
394         if (! ( ids = dataFile.add_var("ContactElements_Nodes", ncInt, ncdims[5], ncdims[9]) ) )
395            throw DataException("Error - MeshAdapter::dump: appending ContactElements_Nodes to netCDF file failed: " + *newFileName);
396         if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )
397            throw DataException("Error - MeshAdapter::dump: copy ContactElements_Nodes to netCDF buffer failed: " + *newFileName);
398    
399         TMPMEMFREE(ContactElements_Nodes);
400    
401       }
402    
403       // // // // // Points // // // // //
404    
405       if (num_Points>0) {
406    
407         fprintf(stderr, "\n\n\nWARNING: MeshAdapter::dump has not been tested with Point elements\n\n\n");
408    
409         // Temp storage to gather node IDs
410         int *Points_Nodes = TMPMEMALLOC(num_Points,int);
411    
412         // Points ReferenceElement->ElementTypeId
413         if (!dataFile.add_att("Points_TypeId", mesh->Points->ReferenceElement->Type->TypeId) )
414            throw DataException("Error - MeshAdapter::dump: appending Points_TypeId to NetCDF file failed: " + *newFileName);
415    
416         // Points_Id
417         if (! ( ids = dataFile.add_var("Points_Id", ncInt, ncdims[6])) )
418            throw DataException("Error - MeshAdapter::dump: appending Points_Id to netCDF file failed: " + *newFileName);
419         int_ptr = &mesh->Points->Id[0];
420         if (! (ids->put(int_ptr, num_Points)) )
421            throw DataException("Error - MeshAdapter::dump: copy Points_Id to netCDF buffer failed: " + *newFileName);
422    
423         // Points_Tag
424         if (! ( ids = dataFile.add_var("Points_Tag", ncInt, ncdims[6])) )
425            throw DataException("Error - MeshAdapter::dump: appending Points_Tag to netCDF file failed: " + *newFileName);
426         int_ptr = &mesh->Points->Tag[0];
427         if (! (ids->put(int_ptr, num_Points)) )
428            throw DataException("Error - MeshAdapter::dump: copy Points_Tag to netCDF buffer failed: " + *newFileName);
429    
430         // Points_Owner
431         if (! ( ids = dataFile.add_var("Points_Owner", ncInt, ncdims[6])) )
432            throw DataException("Error - MeshAdapter::dump: appending Points_Owner to netCDF file failed: " + *newFileName);
433         int_ptr = &mesh->Points->Owner[0];
434         if (! (ids->put(int_ptr, num_Points)) )
435            throw DataException("Error - MeshAdapter::dump: copy Points_Owner to netCDF buffer failed: " + *newFileName);
436    
437         // Points_Color
438         if (! ( ids = dataFile.add_var("Points_Color", ncInt, ncdims[6])) )
439            throw DataException("Error - MeshAdapter::dump: appending Points_Color to netCDF file failed: " + *newFileName);
440         int_ptr = &mesh->Points->Color[0];
441         if (! (ids->put(int_ptr, num_Points)) )
442            throw DataException("Error - MeshAdapter::dump: copy Points_Color to netCDF buffer failed: " + *newFileName);
443    
444         // Points_Nodes
445         // mesh->Nodes->Id[mesh->Points->Nodes[INDEX2(0,i,1)]]
446         for (int i=0; i<num_Points; i++)
447           Points_Nodes[i] = mesh->Nodes->Id[mesh->Points->Nodes[INDEX2(0,i,1)]];
448         if (! ( ids = dataFile.add_var("Points_Nodes", ncInt, ncdims[6]) ) )
449            throw DataException("Error - MeshAdapter::dump: appending Points_Nodes to netCDF file failed: " + *newFileName);
450         if (! (ids->put(&(Points_Nodes[0]), num_Points)) )
451            throw DataException("Error - MeshAdapter::dump: copy Points_Nodes to netCDF buffer failed: " + *newFileName);
452    
453         TMPMEMFREE(Points_Nodes);
454    
455       }
456    
457       // // // // // TagMap // // // // //
458    
459         fprintf(stderr, "\n\n\nWARNING: MeshAdapter::dump does not save the TagMap yet\n\n\n");
460    
461       // NetCDF file is closed by destructor of NcFile object
462    #else
463       Finley_setError(IO_ERROR, "MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");
464    #endif  /* USE_NETCDF */
465       checkFinleyError();
466    }
467    
468  string MeshAdapter::getDescription() const  string MeshAdapter::getDescription() const
469  {  {
470    return "FinleyMesh";    return "FinleyMesh";
# Line 112  void MeshAdapter::setFunctionSpaceTypeNa Line 497  void MeshAdapter::setFunctionSpaceTypeNa
497    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
498      (FunctionSpaceNamesMapType::value_type(Nodes,"Finley_Nodes"));      (FunctionSpaceNamesMapType::value_type(Nodes,"Finley_Nodes"));
499    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
500        (FunctionSpaceNamesMapType::value_type(ReducedNodes,"Finley_Reduced_Nodes"));
501      m_functionSpaceTypeNames.insert
502      (FunctionSpaceNamesMapType::value_type(Elements,"Finley_Elements"));      (FunctionSpaceNamesMapType::value_type(Elements,"Finley_Elements"));
503    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
504        (FunctionSpaceNamesMapType::value_type(ReducedElements,"Finley_Reduced_Elements"));
505      m_functionSpaceTypeNames.insert
506      (FunctionSpaceNamesMapType::value_type(FaceElements,"Finley_Face_Elements"));      (FunctionSpaceNamesMapType::value_type(FaceElements,"Finley_Face_Elements"));
507    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
508        (FunctionSpaceNamesMapType::value_type(ReducedFaceElements,"Finley_Reduced_Face_Elements"));
509      m_functionSpaceTypeNames.insert
510      (FunctionSpaceNamesMapType::value_type(Points,"Finley_Points"));      (FunctionSpaceNamesMapType::value_type(Points,"Finley_Points"));
511    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
512      (FunctionSpaceNamesMapType::value_type(ContactElementsZero,"Finley_Contact_Elements_0"));      (FunctionSpaceNamesMapType::value_type(ContactElementsZero,"Finley_Contact_Elements_0"));
513    m_functionSpaceTypeNames.insert    m_functionSpaceTypeNames.insert
514        (FunctionSpaceNamesMapType::value_type(ReducedContactElementsZero,"Finley_Reduced_Contact_Elements_0"));
515      m_functionSpaceTypeNames.insert
516      (FunctionSpaceNamesMapType::value_type(ContactElementsOne,"Finley_Contact_Elements_1"));      (FunctionSpaceNamesMapType::value_type(ContactElementsOne,"Finley_Contact_Elements_1"));
517      m_functionSpaceTypeNames.insert
518        (FunctionSpaceNamesMapType::value_type(ReducedContactElementsOne,"Finley_Reduced_Contact_Elements_1"));
519  }  }
520    
521  int MeshAdapter::getContinuousFunctionCode() const  int MeshAdapter::getContinuousFunctionCode() const
522  {  {
523    return Nodes;    return Nodes;
524  }  }
525    int MeshAdapter::getReducedContinuousFunctionCode() const
526    {
527      return ReducedNodes;
528    }
529    
530  int MeshAdapter::getFunctionCode() const  int MeshAdapter::getFunctionCode() const
531  {  {
532    return Elements;    return Elements;
533  }  }
534    int MeshAdapter::getReducedFunctionCode() const
535    {
536      return ReducedElements;
537    }
538    
539  int MeshAdapter::getFunctionOnBoundaryCode() const  int MeshAdapter::getFunctionOnBoundaryCode() const
540  {  {
541    return FaceElements;    return FaceElements;
542  }  }
543    int MeshAdapter::getReducedFunctionOnBoundaryCode() const
544    {
545      return ReducedFaceElements;
546    }
547    
548  int MeshAdapter::getFunctionOnContactZeroCode() const  int MeshAdapter::getFunctionOnContactZeroCode() const
549  {  {
550    return ContactElementsZero;    return ContactElementsZero;
551  }  }
552    int MeshAdapter::getReducedFunctionOnContactZeroCode() const
553    {
554      return ReducedContactElementsZero;
555    }
556    
557  int MeshAdapter::getFunctionOnContactOneCode() const  int MeshAdapter::getFunctionOnContactOneCode() const
558  {  {
559    return ContactElementsOne;    return ContactElementsOne;
560  }  }
561    int MeshAdapter::getReducedFunctionOnContactOneCode() const
562    {
563      return ReducedContactElementsOne;
564    }
565    
566  int MeshAdapter::getSolutionCode() const  int MeshAdapter::getSolutionCode() const
567  {  {
# Line 185  pair<int,int> MeshAdapter::getDataShape( Line 600  pair<int,int> MeshAdapter::getDataShape(
600     switch (functionSpaceCode) {     switch (functionSpaceCode) {
601        case(Nodes):        case(Nodes):
602             numDataPointsPerSample=1;             numDataPointsPerSample=1;
603             if (mesh->Nodes!=NULL) numSamples=mesh->Nodes->numNodes;             numSamples=Finley_NodeFile_getNumNodes(mesh->Nodes);
604               break;
605          case(ReducedNodes):
606               numDataPointsPerSample=1;
607               numSamples=Finley_NodeFile_getNumReducedNodes(mesh->Nodes);
608             break;             break;
609        case(Elements):        case(Elements):
610             if (mesh->Elements!=NULL) {             if (mesh->Elements!=NULL) {
# Line 193  pair<int,int> MeshAdapter::getDataShape( Line 612  pair<int,int> MeshAdapter::getDataShape(
612               numDataPointsPerSample=mesh->Elements->ReferenceElement->numQuadNodes;               numDataPointsPerSample=mesh->Elements->ReferenceElement->numQuadNodes;
613             }             }
614             break;             break;
615          case(ReducedElements):
616               if (mesh->Elements!=NULL) {
617                 numSamples=mesh->Elements->numElements;
618                 numDataPointsPerSample=mesh->Elements->ReferenceElementReducedOrder->numQuadNodes;
619               }
620               break;
621        case(FaceElements):        case(FaceElements):
622             if (mesh->FaceElements!=NULL) {             if (mesh->FaceElements!=NULL) {
623                  numDataPointsPerSample=mesh->FaceElements->ReferenceElement->numQuadNodes;                  numDataPointsPerSample=mesh->FaceElements->ReferenceElement->numQuadNodes;
624                  numSamples=mesh->FaceElements->numElements;                  numSamples=mesh->FaceElements->numElements;
625             }             }
626             break;             break;
627          case(ReducedFaceElements):
628               if (mesh->FaceElements!=NULL) {
629                    numDataPointsPerSample=mesh->FaceElements->ReferenceElementReducedOrder->numQuadNodes;
630                    numSamples=mesh->FaceElements->numElements;
631               }
632               break;
633        case(Points):        case(Points):
634             if (mesh->Points!=NULL) {             if (mesh->Points!=NULL) {
635               numDataPointsPerSample=1;               numDataPointsPerSample=1;
# Line 211  pair<int,int> MeshAdapter::getDataShape( Line 642  pair<int,int> MeshAdapter::getDataShape(
642               numSamples=mesh->ContactElements->numElements;               numSamples=mesh->ContactElements->numElements;
643             }             }
644             break;             break;
645          case(ReducedContactElementsZero):
646               if (mesh->ContactElements!=NULL) {
647                 numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;
648                 numSamples=mesh->ContactElements->numElements;
649               }
650               break;
651        case(ContactElementsOne):        case(ContactElementsOne):
652             if (mesh->ContactElements!=NULL) {             if (mesh->ContactElements!=NULL) {
653               numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;               numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;
654               numSamples=mesh->ContactElements->numElements;               numSamples=mesh->ContactElements->numElements;
655             }             }
656             break;             break;
657          case(ReducedContactElementsOne):
658               if (mesh->ContactElements!=NULL) {
659                 numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;
660                 numSamples=mesh->ContactElements->numElements;
661               }
662               break;
663        case(DegreesOfFreedom):        case(DegreesOfFreedom):
664             if (mesh->Nodes!=NULL) {             if (mesh->Nodes!=NULL) {
665               numDataPointsPerSample=1;               numDataPointsPerSample=1;
666  #ifndef PASO_MPI               numSamples=Finley_NodeFile_getNumDegreesOfFreedom(mesh->Nodes);
              numSamples=mesh->Nodes->numDegreesOfFreedom;  
 #else  
              numSamples=mesh->Nodes->degreeOfFreedomDistribution->numLocal;  
 #endif  
667             }             }
668             break;             break;
669        case(ReducedDegreesOfFreedom):        case(ReducedDegreesOfFreedom):
670             if (mesh->Nodes!=NULL) {             if (mesh->Nodes!=NULL) {
671               numDataPointsPerSample=1;               numDataPointsPerSample=1;
672  #ifndef PASO_MPI               numSamples=Finley_NodeFile_getNumReducedDegreesOfFreedom(mesh->Nodes);
              numSamples=mesh->Nodes->reducedNumDegreesOfFreedom;  
 #else  
              numSamples=mesh->Nodes->reducedDegreeOfFreedomDistribution->numLocal;  
 #endif  
673             }             }
674             break;             break;
675        default:        default:
# Line 279  void MeshAdapter::addPDEToSystem( Line 714  void MeshAdapter::addPDEToSystem(
714     checkFinleyError();     checkFinleyError();
715  }  }
716    
717    void  MeshAdapter::addPDEToLumpedSystem(
718                         escript::Data& mat,
719                         const escript::Data& D,
720                         const escript::Data& d) const
721    {
722       escriptDataC _mat=mat.getDataC();
723       escriptDataC _D=D.getDataC();
724       escriptDataC _d=d.getDataC();
725    
726       Finley_Mesh* mesh=m_finleyMesh.get();
727    
728       Finley_Assemble_LumpedSystem(mesh->Nodes,mesh->Elements,&_mat, &_D);
729       Finley_Assemble_LumpedSystem(mesh->Nodes,mesh->FaceElements,&_mat, &_d);
730    
731       checkFinleyError();
732    }
733    
734    
735  //  //
736  // adds linear PDE of second order into the right hand side only  // adds linear PDE of second order into the right hand side only
737  //  //
# Line 315  void MeshAdapter::interpolateOnDomain(es Line 768  void MeshAdapter::interpolateOnDomain(es
768      throw FinleyAdapterException("Error - Illegal domain of interpolation target.");      throw FinleyAdapterException("Error - Illegal domain of interpolation target.");
769    
770    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
771      escriptDataC _target=target.getDataC();
772      escriptDataC _in=in.getDataC();
773    switch(in.getFunctionSpace().getTypeCode()) {    switch(in.getFunctionSpace().getTypeCode()) {
774       case(Nodes):       case(Nodes):
775          switch(target.getFunctionSpace().getTypeCode()) {          switch(target.getFunctionSpace().getTypeCode()) {
776             case(Nodes):             case(Nodes):
777               case(ReducedNodes):
778               case(DegreesOfFreedom):
779             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
780                   Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
781                   break;
782               case(Elements):
783               case(ReducedElements):
784                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
785                   break;
786               case(FaceElements):
787               case(ReducedFaceElements):
788                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
789                   break;
790               case(Points):
791                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
792                   break;
793               case(ContactElementsZero):
794               case(ReducedContactElementsZero):
795                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
796                   break;
797               case(ContactElementsOne):
798               case(ReducedContactElementsOne):
799                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
800                   break;
801               default:
802                   stringstream temp;
803                   temp << "Error - Interpolation on Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
804                   throw FinleyAdapterException(temp.str());
805                   break;
806            }
807            break;
808         case(ReducedNodes):
809            switch(target.getFunctionSpace().getTypeCode()) {
810               case(Nodes):
811               case(ReducedNodes):
812             case(DegreesOfFreedom):             case(DegreesOfFreedom):
813                 Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));             case(ReducedDegreesOfFreedom):
814                   Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
815                 break;                 break;
816             case(Elements):             case(Elements):
817                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(in.getDataC()),&(target.getDataC()));             case(ReducedElements):
818                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
819                 break;                 break;
820             case(FaceElements):             case(FaceElements):
821                 Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(in.getDataC()),&(target.getDataC()));             case(ReducedFaceElements):
822                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
823                 break;                 break;
824             case(Points):             case(Points):
825                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(in.getDataC()),&(target.getDataC()));                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
826                 break;                 break;
827             case(ContactElementsZero):             case(ContactElementsZero):
828                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));             case(ReducedContactElementsZero):
829                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
830                 break;                 break;
831             case(ContactElementsOne):             case(ContactElementsOne):
832                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));             case(ReducedContactElementsOne):
833                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
834                 break;                 break;
835             default:             default:
836                 stringstream temp;                 stringstream temp;
# Line 347  void MeshAdapter::interpolateOnDomain(es Line 841  void MeshAdapter::interpolateOnDomain(es
841          break;          break;
842       case(Elements):       case(Elements):
843          if (target.getFunctionSpace().getTypeCode()==Elements) {          if (target.getFunctionSpace().getTypeCode()==Elements) {
844             Finley_Assemble_CopyElementData(mesh->Elements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);
845            } else if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
846               Finley_Assemble_AverageElementData(mesh->Elements,&_target,&_in);
847          } else {          } else {
848             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");
849          }          }
850          break;          break;
851         case(ReducedElements):
852            if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
853               Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);
854            } else {
855               throw FinleyAdapterException("Error - No interpolation with data on elements with reduced integration order possible.");
856            }
857            break;
858       case(FaceElements):       case(FaceElements):
859          if (target.getFunctionSpace().getTypeCode()==FaceElements) {          if (target.getFunctionSpace().getTypeCode()==FaceElements) {
860             Finley_Assemble_CopyElementData(mesh->FaceElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
861            } else if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
862               Finley_Assemble_AverageElementData(mesh->FaceElements,&_target,&_in);
863          } else {          } else {
864             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");
            break;  
865         }         }
866           break;
867         case(ReducedFaceElements):
868            if (target.getFunctionSpace().getTypeCode()==FaceElements) {
869               Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
870            } else {
871               throw FinleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");
872           }
873           break;
874       case(Points):       case(Points):
875          if (target.getFunctionSpace().getTypeCode()==Points) {          if (target.getFunctionSpace().getTypeCode()==Points) {
876             Finley_Assemble_CopyElementData(mesh->Points,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->Points,&_target,&_in);
877          } else {          } else {
878             throw FinleyAdapterException("Error - No interpolation with data on points possible.");             throw FinleyAdapterException("Error - No interpolation with data on points possible.");
            break;  
879          }          }
880          break;          break;
881       case(ContactElementsZero):       case(ContactElementsZero):
882       case(ContactElementsOne):       case(ContactElementsOne):
883          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {
884             Finley_Assemble_CopyElementData(mesh->ContactElements,&(target.getDataC()),&(in.getDataC()));             Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
885            } else if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {
886               Finley_Assemble_AverageElementData(mesh->ContactElements,&_target,&_in);
887          } else {          } else {
888             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");
889             break;             break;
890          }          }
891          break;          break;
892         case(ReducedContactElementsZero):
893         case(ReducedContactElementsOne):
894            if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {
895               Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
896            } else {
897               throw FinleyAdapterException("Error - No interpolation with data on contact elements with reduced integration order possible.");
898               break;
899            }
900            break;
901       case(DegreesOfFreedom):             case(DegreesOfFreedom):      
902          switch(target.getFunctionSpace().getTypeCode()) {          switch(target.getFunctionSpace().getTypeCode()) {
903             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
904             case(DegreesOfFreedom):             case(DegreesOfFreedom):
905             case(Nodes):                Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
               Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));  
               break;  
 #ifndef PASO_MPI  
            case(Elements):  
               Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(in.getDataC()),&(target.getDataC()));  
906                break;                break;
907             case(FaceElements):  
908                Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(in.getDataC()),&(target.getDataC()));             case(Nodes):
909                break;             case(ReducedNodes):
910             case(Points):                if (getMPISize()>1) {
911                Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(in.getDataC()),&(target.getDataC()));                    escript::Data temp=escript::Data(in);
912                      temp.expand();
913                      escriptDataC _in2 = temp.getDataC();
914                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);
915                  } else {
916                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
917                  }
918                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 */  
919             case(Elements):             case(Elements):
920             {             case(ReducedElements):
921                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );                if (getMPISize()>1) {
922                Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(nodeTemp.getDataC()),&(target.getDataC()));                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
923                     escriptDataC _in2 = temp.getDataC();
924                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);
925                  } else {
926                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
927                  }
928                break;                break;
            }  
929             case(FaceElements):             case(FaceElements):
930             {             case(ReducedFaceElements):
931                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );                if (getMPISize()>1) {
932                Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(nodeTemp.getDataC()),&(target.getDataC()));                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
933                     escriptDataC _in2 = temp.getDataC();
934                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);
935    
936                  } else {
937                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
938                  }
939                break;                break;
            }  
940             case(Points):             case(Points):
941             {                if (getMPISize()>1) {
942                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
943                Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(nodeTemp.getDataC()),&(target.getDataC()));                   escriptDataC _in2 = temp.getDataC();
944                  } else {
945                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
946                  }
947                break;                break;
            }  
948             case(ContactElementsZero):             case(ContactElementsZero):
949             case(ContactElementsOne):             case(ContactElementsOne):
950             {             case(ReducedContactElementsZero):
951                escript::Data nodeTemp( in, continuousFunction(asAbstractContinuousDomain()) );             case(ReducedContactElementsOne):
952                Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(nodeTemp.getDataC()),&(target.getDataC()));                if (getMPISize()>1) {
953                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
954                     escriptDataC _in2 = temp.getDataC();
955                     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);
956                  } else {
957                     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
958                  }
959               break;               break;
            }  
 #endif  
960             default:             default:
961               stringstream temp;               stringstream temp;
962               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 434  void MeshAdapter::interpolateOnDomain(es Line 966  void MeshAdapter::interpolateOnDomain(es
966          break;          break;
967       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
968         switch(target.getFunctionSpace().getTypeCode()) {         switch(target.getFunctionSpace().getTypeCode()) {
969              case(Nodes):
970                 throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");
971                 break;
972              case(ReducedNodes):
973                  if (getMPISize()>1) {
974                      escript::Data temp=escript::Data(in);
975                      temp.expand();
976                      escriptDataC _in2 = temp.getDataC();
977                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);
978                  } else {
979                      Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
980                  }
981                  break;
982              case(DegreesOfFreedom):
983                 throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");
984                 break;
985            case(ReducedDegreesOfFreedom):            case(ReducedDegreesOfFreedom):
986               Finley_Assemble_CopyNodalData(mesh->Nodes,&(target.getDataC()),&(in.getDataC()));               Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
987               break;               break;
988            case(Elements):            case(Elements):
989               Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&(in.getDataC()),&(target.getDataC()));            case(ReducedElements):
990                  if (getMPISize()>1) {
991                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
992                     escriptDataC _in2 = temp.getDataC();
993                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);
994                  } else {
995                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
996                 }
997               break;               break;
998            case(FaceElements):            case(FaceElements):
999               Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&(in.getDataC()),&(target.getDataC()));            case(ReducedFaceElements):
1000                  if (getMPISize()>1) {
1001                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1002                     escriptDataC _in2 = temp.getDataC();
1003                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);
1004                  } else {
1005                     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
1006                  }
1007               break;               break;
1008            case(Points):            case(Points):
1009               Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&(in.getDataC()),&(target.getDataC()));                if (getMPISize()>1) {
1010                     escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1011                     escriptDataC _in2 = temp.getDataC();
1012                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in2,&_target);
1013                  } else {
1014                     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
1015                 }
1016               break;               break;
1017            case(ContactElementsZero):            case(ContactElementsZero):
1018            case(ContactElementsOne):            case(ContactElementsOne):
1019               Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&(in.getDataC()),&(target.getDataC()));            case(ReducedContactElementsZero):
1020               break;            case(ReducedContactElementsOne):
1021            case(Nodes):                if (getMPISize()>1) {
1022               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1023               break;                   escriptDataC _in2 = temp.getDataC();
1024            case(DegreesOfFreedom):                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);
1025               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");                } else {
1026                     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
1027                 }
1028               break;               break;
1029            default:            default:
1030               stringstream temp;               stringstream temp;
# Line 483  void MeshAdapter::setToX(escript::Data& Line 1053  void MeshAdapter::setToX(escript::Data&
1053    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1054    // in case of values node coordinates we can do the job directly:    // in case of values node coordinates we can do the job directly:
1055    if (arg.getFunctionSpace().getTypeCode()==Nodes) {    if (arg.getFunctionSpace().getTypeCode()==Nodes) {
1056       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(arg.getDataC()));       escriptDataC _arg=arg.getDataC();
1057         Finley_Assemble_NodeCoordinates(mesh->Nodes,&_arg);
1058    } else {    } else {
1059       escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);       escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);
1060       Finley_Assemble_NodeCoordinates(mesh->Nodes,&(tmp_data.getDataC()));       escriptDataC _tmp_data=tmp_data.getDataC();
1061         Finley_Assemble_NodeCoordinates(mesh->Nodes,&_tmp_data);
1062       // this is then interpolated onto arg:       // this is then interpolated onto arg:
1063       interpolateOnDomain(arg,tmp_data);       interpolateOnDomain(arg,tmp_data);
1064    }    }
# Line 502  void MeshAdapter::setToNormal(escript::D Line 1074  void MeshAdapter::setToNormal(escript::D
1074    if (normalDomain!=*this)    if (normalDomain!=*this)
1075       throw FinleyAdapterException("Error - Illegal domain of normal locations");       throw FinleyAdapterException("Error - Illegal domain of normal locations");
1076    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1077      escriptDataC _normal=normal.getDataC();
1078    switch(normal.getFunctionSpace().getTypeCode()) {    switch(normal.getFunctionSpace().getTypeCode()) {
1079      case(Nodes):      case(Nodes):
1080        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");
1081        break;        break;
1082        case(ReducedNodes):
1083          throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced nodes");
1084          break;
1085      case(Elements):      case(Elements):
1086        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");
1087        break;        break;
1088        case(ReducedElements):
1089          throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements with reduced integration order");
1090          break;
1091      case (FaceElements):      case (FaceElements):
1092        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);
1093          break;
1094        case (ReducedFaceElements):
1095          Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);
1096        break;        break;
1097      case(Points):      case(Points):
1098        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");
1099        break;        break;
1100      case (ContactElementsOne):      case (ContactElementsOne):
1101      case (ContactElementsZero):      case (ContactElementsZero):
1102        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&(normal.getDataC()));        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);
1103          break;
1104        case (ReducedContactElementsOne):
1105        case (ReducedContactElementsZero):
1106          Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);
1107        break;        break;
1108      case(DegreesOfFreedom):      case(DegreesOfFreedom):
1109        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 555  void MeshAdapter::setToIntegrals(std::ve Line 1141  void MeshAdapter::setToIntegrals(std::ve
1141    if (argDomain!=*this)    if (argDomain!=*this)
1142       throw FinleyAdapterException("Error - Illegal domain of integration kernel");       throw FinleyAdapterException("Error - Illegal domain of integration kernel");
1143    
1144      double blocktimer_start = blocktimer_time();
1145    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1146      escriptDataC _temp;
1147      escript::Data temp;
1148      escriptDataC _arg=arg.getDataC();
1149    switch(arg.getFunctionSpace().getTypeCode()) {    switch(arg.getFunctionSpace().getTypeCode()) {
1150       case(Nodes):       case(Nodes):
1151          throw FinleyAdapterException("Error - Integral of data on nodes is not supported.");          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1152            _temp=temp.getDataC();
1153            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1154            break;
1155         case(ReducedNodes):
1156            temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1157            _temp=temp.getDataC();
1158            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1159          break;          break;
1160       case(Elements):       case(Elements):
1161          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);
1162            break;
1163         case(ReducedElements):
1164            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);
1165          break;          break;
1166       case(FaceElements):       case(FaceElements):
1167          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);
1168            break;
1169         case(ReducedFaceElements):
1170            Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);
1171          break;          break;
1172       case(Points):       case(Points):
1173          throw FinleyAdapterException("Error - Integral of data on points is not supported.");          throw FinleyAdapterException("Error - Integral of data on points is not supported.");
1174          break;          break;
1175       case(ContactElementsZero):       case(ContactElementsZero):
1176          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1177            break;
1178         case(ReducedContactElementsZero):
1179            Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1180          break;          break;
1181       case(ContactElementsOne):       case(ContactElementsOne):
1182          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&(arg.getDataC()),&integrals[0]);          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1183            break;
1184         case(ReducedContactElementsOne):
1185            Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1186          break;          break;
1187       case(DegreesOfFreedom):       case(DegreesOfFreedom):
1188          throw FinleyAdapterException("Error - Integral of data on degrees of freedom is not supported.");          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1189            _temp=temp.getDataC();
1190            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1191          break;          break;
1192       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
1193          throw FinleyAdapterException("Error - Integral of data on reduced degrees of freedom is not supported.");          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1194            _temp=temp.getDataC();
1195            Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1196          break;          break;
1197       default:       default:
1198          stringstream temp;          stringstream temp;
# Line 588  void MeshAdapter::setToIntegrals(std::ve Line 1201  void MeshAdapter::setToIntegrals(std::ve
1201          break;          break;
1202    }    }
1203    checkFinleyError();    checkFinleyError();
1204      blocktimer_increment("integrate()", blocktimer_start);
1205  }  }
1206    
1207  //  //
# Line 603  void MeshAdapter::setToGradient(escript: Line 1217  void MeshAdapter::setToGradient(escript:
1217       throw FinleyAdapterException("Error - Illegal domain of gradient");       throw FinleyAdapterException("Error - Illegal domain of gradient");
1218    
1219    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
1220      escriptDataC _grad=grad.getDataC();
1221    escriptDataC nodeDataC;    escriptDataC nodeDataC;
1222  #ifdef PASO_MPI    escript::Data temp;
1223    escript::Data nodeTemp( arg, continuousFunction(asAbstractContinuousDomain()) );    if (getMPISize()>1) {
1224    if( arg.getFunctionSpace().getTypeCode() != Nodes )        if( arg.getFunctionSpace().getTypeCode() == DegreesOfFreedom ) {
1225    {          temp=escript::Data( arg,  continuousFunction(asAbstractContinuousDomain()) );
1226      Finley_Assemble_CopyNodalData(mesh->Nodes,&(nodeTemp.getDataC()),&(arg.getDataC()));          nodeDataC = temp.getDataC();
1227      nodeDataC = nodeTemp.getDataC();        } else if( arg.getFunctionSpace().getTypeCode() == ReducedDegreesOfFreedom ) {
1228            temp=escript::Data( arg,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1229            nodeDataC = temp.getDataC();
1230          } else {
1231            nodeDataC = arg.getDataC();
1232          }
1233      } else {
1234         nodeDataC = arg.getDataC();
1235    }    }
   else  
     nodeDataC = arg.getDataC();  
 #else  
   nodeDataC = arg.getDataC();  
 #endif  
1236    switch(grad.getFunctionSpace().getTypeCode()) {    switch(grad.getFunctionSpace().getTypeCode()) {
1237         case(Nodes):         case(Nodes):
1238            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");
1239            break;            break;
1240           case(ReducedNodes):
1241              throw FinleyAdapterException("Error - Gradient at reduced nodes is not supported.");
1242              break;
1243         case(Elements):         case(Elements):
1244            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);
1245              break;
1246           case(ReducedElements):
1247              Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);
1248            break;            break;
1249         case(FaceElements):         case(FaceElements):
1250            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);
1251              break;
1252           case(ReducedFaceElements):
1253              Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);
1254            break;            break;
1255         case(Points):         case(Points):
1256            throw FinleyAdapterException("Error - Gradient at points is not supported.");            throw FinleyAdapterException("Error - Gradient at points is not supported.");
1257            break;            break;
1258         case(ContactElementsZero):         case(ContactElementsZero):
1259            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1260              break;
1261           case(ReducedContactElementsZero):
1262              Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1263            break;            break;
1264         case(ContactElementsOne):         case(ContactElementsOne):
1265            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&(grad.getDataC()),&nodeDataC);            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1266              break;
1267           case(ReducedContactElementsOne):
1268              Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1269            break;            break;
1270         case(DegreesOfFreedom):         case(DegreesOfFreedom):
1271            throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");            throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");
# Line 661  void MeshAdapter::setToSize(escript::Dat Line 1293  void MeshAdapter::setToSize(escript::Dat
1293         case(Nodes):         case(Nodes):
1294            throw FinleyAdapterException("Error - Size of nodes is not supported.");            throw FinleyAdapterException("Error - Size of nodes is not supported.");
1295            break;            break;
1296           case(ReducedNodes):
1297              throw FinleyAdapterException("Error - Size of reduced nodes is not supported.");
1298              break;
1299         case(Elements):         case(Elements):
1300            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
1301            break;            break;
1302           case(ReducedElements):
1303              Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
1304              break;
1305         case(FaceElements):         case(FaceElements):
1306            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
1307            break;            break;
1308           case(ReducedFaceElements):
1309              Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
1310              break;
1311         case(Points):         case(Points):
1312            throw FinleyAdapterException("Error - Size of point elements is not supported.");            throw FinleyAdapterException("Error - Size of point elements is not supported.");
1313            break;            break;
# Line 674  void MeshAdapter::setToSize(escript::Dat Line 1315  void MeshAdapter::setToSize(escript::Dat
1315         case(ContactElementsOne):         case(ContactElementsOne):
1316            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
1317            break;            break;
1318           case(ReducedContactElementsZero):
1319           case(ReducedContactElementsOne):
1320              Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
1321              break;
1322         case(DegreesOfFreedom):         case(DegreesOfFreedom):
1323            throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");            throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");
1324            break;            break;
# Line 718  void MeshAdapter::saveDX(const std::stri Line 1363  void MeshAdapter::saveDX(const std::stri
1363    escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;    escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;
1364    escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;    escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;
1365    
1366      boost::python::list keys=arg.keys();    boost::python::list keys=arg.keys();
1367      for (int i=0;i<num_data;++i) {    for (int i=0;i<num_data;++i) {
1368             std::string n=boost::python::extract<std::string>(keys[i]);
1369           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1370           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
1371               throw FinleyAdapterException("Error  in saveDX: Data must be defined on same Domain");               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1372           data[i]=d.getDataC();           data[i]=d.getDataC();
1373           ptr_data[i]=&(data[i]);           ptr_data[i]=&(data[i]);
          std::string n=boost::python::extract<std::string>(keys[i]);  
1374           c_names[i]=&(names[i][0]);           c_names[i]=&(names[i][0]);
1375           if (n.length()>MAX_namelength-1) {           if (n.length()>MAX_namelength-1) {
1376              strncpy(c_names[i],n.c_str(),MAX_namelength-1);              strncpy(c_names[i],n.c_str(),MAX_namelength-1);
# Line 768  void MeshAdapter::saveVTK(const std::str Line 1413  void MeshAdapter::saveVTK(const std::str
1413    
1414      boost::python::list keys=arg.keys();      boost::python::list keys=arg.keys();
1415      for (int i=0;i<num_data;++i) {      for (int i=0;i<num_data;++i) {
1416             std::string n=boost::python::extract<std::string>(keys[i]);
1417           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1418           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
1419               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1420           data[i]=d.getDataC();           data[i]=d.getDataC();
1421           ptr_data[i]=&(data[i]);           ptr_data[i]=&(data[i]);
          std::string n=boost::python::extract<std::string>(keys[i]);  
1422           c_names[i]=&(names[i][0]);           c_names[i]=&(names[i][0]);
1423           if (n.length()>MAX_namelength-1) {           if (n.length()>MAX_namelength-1) {
1424              strncpy(c_names[i],n.c_str(),MAX_namelength-1);              strncpy(c_names[i],n.c_str(),MAX_namelength-1);
# Line 782  void MeshAdapter::saveVTK(const std::str Line 1427  void MeshAdapter::saveVTK(const std::str
1427              strcpy(c_names[i],n.c_str());              strcpy(c_names[i],n.c_str());
1428           }           }
1429      }      }
 #ifndef PASO_MPI      
1430      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  
1431    
1432  checkFinleyError();    checkFinleyError();
1433    /* win32 refactor */    /* win32 refactor */
1434    TMPMEMFREE(c_names);    TMPMEMFREE(c_names);
1435    TMPMEMFREE(data);    TMPMEMFREE(data);
# Line 839  SystemMatrixAdapter MeshAdapter::newSyst Line 1480  SystemMatrixAdapter MeshAdapter::newSyst
1480            
1481      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);
1482      checkFinleyError();      checkFinleyError();
1483      Paso_SystemMatrix* fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);      Paso_SystemMatrix* fsystemMatrix;
1484        int trilinos = 0;
1485        if (trilinos) {
1486    #ifdef TRILINOS
1487          /* Allocation Epetra_VrbMatrix here */
1488    #endif
1489        }
1490        else {
1491          fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);
1492        }
1493      checkPasoError();      checkPasoError();
1494      Paso_SystemMatrixPattern_dealloc(fsystemMatrixPattern);      Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1495      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
1496  }  }
1497    
# Line 865  bool MeshAdapter::isCellOriented(int fun Line 1515  bool MeshAdapter::isCellOriented(int fun
1515         case(Points):         case(Points):
1516         case(ContactElementsZero):         case(ContactElementsZero):
1517         case(ContactElementsOne):         case(ContactElementsOne):
1518           case(ReducedElements):
1519           case(ReducedFaceElements):
1520           case(ReducedContactElementsZero):
1521           case(ReducedContactElementsOne):
1522            return true;            return true;
1523            break;            break;
1524         default:         default:
# Line 883  bool MeshAdapter::probeInterpolationOnDo Line 1537  bool MeshAdapter::probeInterpolationOnDo
1537       case(Nodes):       case(Nodes):
1538          switch(functionSpaceType_target) {          switch(functionSpaceType_target) {
1539             case(Nodes):             case(Nodes):
1540               case(ReducedNodes):
1541             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
1542             case(DegreesOfFreedom):             case(DegreesOfFreedom):
1543             case(Elements):             case(Elements):
1544               case(ReducedElements):
1545             case(FaceElements):             case(FaceElements):
1546               case(ReducedFaceElements):
1547             case(Points):             case(Points):
1548             case(ContactElementsZero):             case(ContactElementsZero):
1549               case(ReducedContactElementsZero):
1550             case(ContactElementsOne):             case(ContactElementsOne):
1551               case(ReducedContactElementsOne):
1552                 return true;                 return true;
1553             default:             default:
1554                 stringstream temp;                 stringstream temp;
# Line 897  bool MeshAdapter::probeInterpolationOnDo Line 1556  bool MeshAdapter::probeInterpolationOnDo
1556                 throw FinleyAdapterException(temp.str());                 throw FinleyAdapterException(temp.str());
1557          }          }
1558          break;          break;
1559         case(ReducedNodes):
1560            switch(functionSpaceType_target) {
1561               case(ReducedNodes):
1562               case(ReducedDegreesOfFreedom):
1563               case(Elements):
1564               case(ReducedElements):
1565               case(FaceElements):
1566               case(ReducedFaceElements):
1567               case(Points):
1568               case(ContactElementsZero):
1569               case(ReducedContactElementsZero):
1570               case(ContactElementsOne):
1571               case(ReducedContactElementsOne):
1572                   return true;
1573              case(Nodes):
1574              case(DegreesOfFreedom):
1575                 return false;
1576               default:
1577                   stringstream temp;
1578                   temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1579                   throw FinleyAdapterException(temp.str());
1580            }
1581            break;
1582       case(Elements):       case(Elements):
1583          if (functionSpaceType_target==Elements) {          if (functionSpaceType_target==Elements) {
1584             return true;             return true;
1585            } else if (functionSpaceType_target==ReducedElements) {
1586               return true;
1587            } else {
1588               return false;
1589            }
1590         case(ReducedElements):
1591            if (functionSpaceType_target==ReducedElements) {
1592               return true;
1593          } else {          } else {
1594             return false;             return false;
1595          }          }
1596       case(FaceElements):       case(FaceElements):
1597          if (functionSpaceType_target==FaceElements) {          if (functionSpaceType_target==FaceElements) {
1598             return true;             return true;
1599            } else if (functionSpaceType_target==ReducedFaceElements) {
1600               return true;
1601            } else {
1602               return false;
1603            }
1604         case(ReducedFaceElements):
1605            if (functionSpaceType_target==ReducedFaceElements) {
1606               return true;
1607          } else {          } else {
1608             return false;             return false;
1609          }          }
# Line 919  bool MeshAdapter::probeInterpolationOnDo Line 1617  bool MeshAdapter::probeInterpolationOnDo
1617       case(ContactElementsOne):       case(ContactElementsOne):
1618          if (functionSpaceType_target==ContactElementsZero || functionSpaceType_target==ContactElementsOne) {          if (functionSpaceType_target==ContactElementsZero || functionSpaceType_target==ContactElementsOne) {
1619             return true;             return true;
1620            } else if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {
1621               return true;
1622            } else {
1623               return false;
1624            }
1625         case(ReducedContactElementsZero):
1626         case(ReducedContactElementsOne):
1627            if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {
1628               return true;
1629          } else {          } else {
1630             return false;             return false;
1631          }          }
# Line 927  bool MeshAdapter::probeInterpolationOnDo Line 1634  bool MeshAdapter::probeInterpolationOnDo
1634             case(ReducedDegreesOfFreedom):             case(ReducedDegreesOfFreedom):
1635             case(DegreesOfFreedom):             case(DegreesOfFreedom):
1636             case(Nodes):             case(Nodes):
1637               case(ReducedNodes):
1638             case(Elements):             case(Elements):
1639             case(FaceElements):             case(ReducedElements):
1640             case(Points):             case(Points):
1641               case(FaceElements):
1642               case(ReducedFaceElements):
1643             case(ContactElementsZero):             case(ContactElementsZero):
1644               case(ReducedContactElementsZero):
1645             case(ContactElementsOne):             case(ContactElementsOne):
1646               case(ReducedContactElementsOne):
1647                return true;                return true;
1648             default:             default:
1649               stringstream temp;               stringstream temp;
# Line 942  bool MeshAdapter::probeInterpolationOnDo Line 1654  bool MeshAdapter::probeInterpolationOnDo
1654       case(ReducedDegreesOfFreedom):       case(ReducedDegreesOfFreedom):
1655         switch(functionSpaceType_target) {         switch(functionSpaceType_target) {
1656            case(ReducedDegreesOfFreedom):            case(ReducedDegreesOfFreedom):
1657              case(ReducedNodes):
1658            case(Elements):            case(Elements):
1659              case(ReducedElements):
1660            case(FaceElements):            case(FaceElements):
1661              case(ReducedFaceElements):
1662            case(Points):            case(Points):
1663            case(ContactElementsZero):            case(ContactElementsZero):
1664              case(ReducedContactElementsZero):
1665            case(ContactElementsOne):            case(ContactElementsOne):
1666              case(ReducedContactElementsOne):
1667                return true;                return true;
1668            case(Nodes):            case(Nodes):
1669            case(DegreesOfFreedom):            case(DegreesOfFreedom):
# Line 1009  escript::Data MeshAdapter::getSize() con Line 1726  escript::Data MeshAdapter::getSize() con
1726    return function(asAbstractContinuousDomain()).getSize();    return function(asAbstractContinuousDomain()).getSize();
1727  }  }
1728    
1729    int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const
1730    {
1731      int *out=0,i;
1732      Finley_Mesh* mesh=m_finleyMesh.get();
1733      switch (functionSpaceType) {
1734        case(Nodes):
1735          out=mesh->Nodes->Id;
1736          break;
1737        case(ReducedNodes):
1738          out=mesh->Nodes->reducedNodesId;
1739          break;
1740        case(Elements):
1741          out=mesh->Elements->Id;
1742          break;
1743        case(ReducedElements):
1744          out=mesh->Elements->Id;
1745          break;
1746        case(FaceElements):
1747          out=mesh->FaceElements->Id;
1748          break;
1749        case(ReducedFaceElements):
1750          out=mesh->FaceElements->Id;
1751          break;
1752        case(Points):
1753          out=mesh->Points->Id;
1754          break;
1755        case(ContactElementsZero):
1756          out=mesh->ContactElements->Id;
1757          break;
1758        case(ReducedContactElementsZero):
1759          out=mesh->ContactElements->Id;
1760          break;
1761        case(ContactElementsOne):
1762          out=mesh->ContactElements->Id;
1763          break;
1764        case(ReducedContactElementsOne):
1765          out=mesh->ContactElements->Id;
1766          break;
1767        case(DegreesOfFreedom):
1768          out=mesh->Nodes->degreesOfFreedomId;
1769          break;
1770        case(ReducedDegreesOfFreedom):
1771          out=mesh->Nodes->reducedDegreesOfFreedomId;
1772          break;
1773        default:
1774          stringstream temp;
1775          temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
1776          throw FinleyAdapterException(temp.str());
1777          break;
1778      }
1779      return out;
1780    }
1781  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
1782  {  {
1783    int out=0;    int out=0;
# Line 1017  int MeshAdapter::getTagFromSampleNo(int Line 1786  int MeshAdapter::getTagFromSampleNo(int
1786    case(Nodes):    case(Nodes):
1787      out=mesh->Nodes->Tag[sampleNo];      out=mesh->Nodes->Tag[sampleNo];
1788      break;      break;
1789      case(ReducedNodes):
1790        throw FinleyAdapterException(" Error - ReducedNodes does not support tags.");
1791        break;
1792    case(Elements):    case(Elements):
1793      out=mesh->Elements->Tag[sampleNo];      out=mesh->Elements->Tag[sampleNo];
1794      break;      break;
1795      case(ReducedElements):
1796        out=mesh->Elements->Tag[sampleNo];
1797        break;
1798    case(FaceElements):    case(FaceElements):
1799      out=mesh->FaceElements->Tag[sampleNo];      out=mesh->FaceElements->Tag[sampleNo];
1800      break;      break;
1801      case(ReducedFaceElements):
1802        out=mesh->FaceElements->Tag[sampleNo];
1803        break;
1804    case(Points):    case(Points):
1805      out=mesh->Points->Tag[sampleNo];      out=mesh->Points->Tag[sampleNo];
1806      break;      break;
1807    case(ContactElementsZero):    case(ContactElementsZero):
1808      out=mesh->ContactElements->Tag[sampleNo];      out=mesh->ContactElements->Tag[sampleNo];
1809      break;      break;
1810    case(ContactElementsOne):    case(ReducedContactElementsZero):
1811      out=mesh->ContactElements->Tag[sampleNo];      out=mesh->ContactElements->Tag[sampleNo];
1812      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::borrowSampleReferenceIDs(int functionSpaceType) const  
 {  
   int *out=0,i;  
   Finley_Mesh* mesh=m_finleyMesh.get();  
   switch (functionSpaceType) {  
   case(Nodes):  
     if (mesh->Nodes!=NULL) {  
       out=mesh->Nodes->Id;  
       break;  
     }  
   case(Elements):  
     out=mesh->Elements->Id;  
     break;  
   case(FaceElements):  
     out=mesh->FaceElements->Id;  
     break;  
   case(Points):  
     out=mesh->Points->Id;  
     break;  
   case(ContactElementsZero):  
     out=mesh->ContactElements->Id;  
     break;  
1813    case(ContactElementsOne):    case(ContactElementsOne):
1814      out=mesh->ContactElements->Id;      out=mesh->ContactElements->Tag[sampleNo];
1815        break;
1816      case(ReducedContactElementsOne):
1817        out=mesh->ContactElements->Tag[sampleNo];
1818      break;      break;
1819    case(DegreesOfFreedom):    case(DegreesOfFreedom):
1820      out=mesh->Nodes->degreeOfFreedomId;      throw FinleyAdapterException(" Error - DegreesOfFreedom does not support tags.");
1821      break;      break;
1822    case(ReducedDegreesOfFreedom):    case(ReducedDegreesOfFreedom):
1823      out=mesh->Nodes->reducedDegreeOfFreedomId;      throw FinleyAdapterException(" Error - ReducedDegreesOfFreedom does not support tags.");
1824      break;      break;
1825    default:    default:
1826      stringstream temp;      stringstream temp;
# Line 1084  int* MeshAdapter::borrowSampleReferenceI Line 1831  int* MeshAdapter::borrowSampleReferenceI
1831    return out;    return out;
1832  }  }
1833    
1834    
1835  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
1836  {  {
1837    Finley_Mesh* mesh=m_finleyMesh.get();    Finley_Mesh* mesh=m_finleyMesh.get();
# Line 1092  void MeshAdapter::setTags(const int func Line 1840  void MeshAdapter::setTags(const int func
1840         case(Nodes):         case(Nodes):
1841            Finley_NodeFile_setTags(mesh->Nodes,newTag,&tmp);            Finley_NodeFile_setTags(mesh->Nodes,newTag,&tmp);
1842            break;            break;
1843           case(ReducedNodes):
1844              throw FinleyAdapterException("Error - ReducedNodes does not support tags");
1845              break;
1846         case(DegreesOfFreedom):         case(DegreesOfFreedom):
1847            throw FinleyAdapterException("Error - DegreesOfFreedom does not support tags");            throw FinleyAdapterException("Error - DegreesOfFreedom does not support tags");
1848            break;            break;
# Line 1101  void MeshAdapter::setTags(const int func Line 1852  void MeshAdapter::setTags(const int func
1852         case(Elements):         case(Elements):
1853            Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);
1854            break;            break;
1855           case(ReducedElements):
1856              Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);
1857              break;
1858         case(FaceElements):         case(FaceElements):
1859            Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);
1860            break;            break;
1861           case(ReducedFaceElements):
1862              Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);
1863              break;
1864         case(Points):         case(Points):
1865            Finley_ElementFile_setTags(mesh->Points,newTag,&tmp);            Finley_ElementFile_setTags(mesh->Points,newTag,&tmp);
1866            break;            break;
1867         case(ContactElementsZero):         case(ContactElementsZero):
1868            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1869            break;            break;
1870           case(ReducedContactElementsZero):
1871              Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1872              break;
1873         case(ContactElementsOne):         case(ContactElementsOne):
1874            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1875            break;            break;
1876           case(ReducedContactElementsOne):
1877              Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1878              break;
1879         default:         default:
1880            stringstream temp;            stringstream temp;
1881            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 1122  void MeshAdapter::setTags(const int func Line 1885  void MeshAdapter::setTags(const int func
1885    return;    return;
1886  }  }
1887    
1888    void MeshAdapter::setTagMap(const std::string& name,  int tag)
1889    {
1890      Finley_Mesh* mesh=m_finleyMesh.get();
1891      Finley_Mesh_addTagMap(mesh, name.c_str(),tag);
1892      checkPasoError();
1893      // throwStandardException("MeshAdapter::set TagMap is not implemented.");
1894    }
1895    
1896    int MeshAdapter::getTag(const std::string& name) const
1897    {
1898      Finley_Mesh* mesh=m_finleyMesh.get();
1899      int tag=0;
1900      tag=Finley_Mesh_getTag(mesh, name.c_str());
1901      checkPasoError();
1902      // throwStandardException("MeshAdapter::getTag is not implemented.");
1903      return tag;
1904    }
1905    
1906    bool MeshAdapter::isValidTagName(const std::string& name) const
1907    {
1908      Finley_Mesh* mesh=m_finleyMesh.get();
1909      return Finley_Mesh_isValidTagName(mesh,name.c_str());
1910    }
1911    
1912    std::string MeshAdapter::showTagNames() const
1913    {
1914      stringstream temp;
1915      Finley_Mesh* mesh=m_finleyMesh.get();
1916      Finley_TagMap* tag_map=mesh->TagMap;
1917      while (tag_map) {
1918         temp << tag_map->name;
1919         tag_map=tag_map->next;
1920         if (tag_map) temp << ", ";
1921      }
1922      return temp.str();
1923    }
1924    
1925  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.967  
changed lines
  Added in v.1345

  ViewVC Help
Powered by ViewVC 1.1.26