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

Diff of /branches/diaplayground/finley/src/CPPAdapter/MeshAdapter.cpp

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

revision 1339 by ksteube, Wed Nov 7 01:53:12 2007 UTC revision 1628 by phornby, Fri Jul 11 13:12:46 2008 UTC
# Line 16  Line 16 
16  #include "MeshAdapter.h"  #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" {  extern "C" {
23  #include "escript/blocktimer.h"  #include "escript/blocktimer.h"
24  }  }
25  #include <vector>  #include <vector>
26    
27    #define IS_THERE_A_REASON_FOR_THIS_MAGIC_NAME_LENGTH  256
28    
29  using namespace std;  using namespace std;
30  using namespace escript;  using namespace escript;
31    
# Line 45  const int MeshAdapter::ReducedContactEle Line 50  const int MeshAdapter::ReducedContactEle
50    
51  MeshAdapter::MeshAdapter(Finley_Mesh* finleyMesh)  MeshAdapter::MeshAdapter(Finley_Mesh* finleyMesh)
52  {  {
53    setFunctionSpaceTypeNames();     setFunctionSpaceTypeNames();
54    //     //
55    // need to use a null_deleter as Finley_Mesh_free deletes the pointer     // need to use a null_deleter as Finley_Mesh_free deletes the pointer
56    // for us.     // for us.
57    m_finleyMesh.reset(finleyMesh,null_deleter());     m_finleyMesh.reset(finleyMesh,null_deleter());
58  }  }
59    
60  //  //
# Line 57  MeshAdapter::MeshAdapter(Finley_Mesh* fi Line 62  MeshAdapter::MeshAdapter(Finley_Mesh* fi
62  MeshAdapter::MeshAdapter(const MeshAdapter& in):  MeshAdapter::MeshAdapter(const MeshAdapter& in):
63  m_finleyMesh(in.m_finleyMesh)  m_finleyMesh(in.m_finleyMesh)
64  {  {
65    setFunctionSpaceTypeNames();     setFunctionSpaceTypeNames();
66  }  }
67    
68  MeshAdapter::~MeshAdapter()  MeshAdapter::~MeshAdapter()
69  {  {
70    //     //
71    // 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.
72    //  cout << "In MeshAdapter destructor." << endl;     //  cout << "In MeshAdapter destructor." << endl;
73    if (m_finleyMesh.unique()) {     if (m_finleyMesh.unique()) {
74      Finley_Mesh_free(m_finleyMesh.get());        Finley_Mesh_free(m_finleyMesh.get());
75    }     }
76  }  }
77    
78  int MeshAdapter::getMPISize() const  int MeshAdapter::getMPISize() const
# Line 86  Finley_Mesh* MeshAdapter::getFinley_Mesh Line 91  Finley_Mesh* MeshAdapter::getFinley_Mesh
91    
92  void MeshAdapter::write(const std::string& fileName) const  void MeshAdapter::write(const std::string& fileName) const
93  {  {
94    char *fName = (fileName.size()+1>0) ? TMPMEMALLOC(fileName.size()+1,char) : (char*)NULL;     char *fName = (fileName.size()+1>0) ? TMPMEMALLOC(fileName.size()+1,char) : (char*)NULL;
95    strcpy(fName,fileName.c_str());     strcpy(fName,fileName.c_str());
96    Finley_Mesh_write(m_finleyMesh.get(),fName);     Finley_Mesh_write(m_finleyMesh.get(),fName);
97    checkFinleyError();     checkFinleyError();
98    TMPMEMFREE(fName);     TMPMEMFREE(fName);
99  }  }
100    
101  void MeshAdapter::Print_Mesh_Info(const bool full=false) const  void MeshAdapter::Print_Mesh_Info(const bool full=false) const
102  {  {
103    Finley_PrintMesh_Info(m_finleyMesh.get(), full);     Finley_PrintMesh_Info(m_finleyMesh.get(), full);
104  }  }
105    
106  void MeshAdapter::dump(const std::string& fileName) const  void MeshAdapter::dump(const std::string& fileName) const
107  {  {
108    char *fName = (fileName.size()+1>0) ? TMPMEMALLOC(fileName.size()+1,char) : (char*)NULL;  #ifdef USE_NETCDF
109    strcpy(fName,fileName.c_str());     const NcDim* ncdims[12];
110    Finley_Mesh_dump(m_finleyMesh.get(),fName);     NcVar *ids, *data;
111    checkFinleyError();     int *int_ptr;
112    TMPMEMFREE(fName);     Finley_Mesh *mesh = m_finleyMesh.get();
113       Finley_TagMap* tag_map;
114       int num_Tags = 0;
115       int mpi_size             = mesh->MPIInfo->size;
116       int mpi_rank             = mesh->MPIInfo->rank;
117       int numDim               = mesh->Nodes->numDim;
118       int numNodes             = mesh->Nodes->numNodes;
119       int num_Elements         = mesh->Elements->numElements;
120       int num_FaceElements         = mesh->FaceElements->numElements;
121       int num_ContactElements      = mesh->ContactElements->numElements;
122       int num_Points           = mesh->Points->numElements;
123       int num_Elements_numNodes        = mesh->Elements->numNodes;
124       int num_FaceElements_numNodes    = mesh->FaceElements->numNodes;
125       int num_ContactElements_numNodes = mesh->ContactElements->numNodes;
126    
127       // I don't think the strdup is needed since Paso_MPI_appendRankToFileName
128       // does it's own allocation.
129       // char *newFileName = Paso_MPI_appendRankToFileName(strdup(fileName.c_str()), mpi_size, mpi_rank);
130    
131       char *newFileName = Paso_MPI_appendRankToFileName(fileName.c_str(),
132                                                         mpi_size, mpi_rank);
133    
134       /* Figure out how much storage is required for tags */
135       tag_map = mesh->TagMap;
136       if (tag_map) {
137          while (tag_map) {
138             num_Tags++;
139             tag_map=tag_map->next;
140          }
141       }
142    
143       // NetCDF error handler
144       NcError err(NcError::verbose_nonfatal);
145       // Create the file.
146       NcFile dataFile(newFileName, NcFile::Replace);
147       // check if writing was successful
148       if (!dataFile.is_valid())
149          throw DataException("Error - MeshAdapter::dump: opening of NetCDF file for output failed: " + *newFileName);
150    
151       // Define dimensions (num_Elements and dim_Elements are identical, dim_Elements only appears if > 0)
152       if (! (ncdims[0] = dataFile.add_dim("numNodes", numNodes)) )
153          throw DataException("Error - MeshAdapter::dump: appending dimension numNodes to netCDF file failed: " + *newFileName);
154       if (! (ncdims[1] = dataFile.add_dim("numDim", numDim)) )
155          throw DataException("Error - MeshAdapter::dump: appending dimension numDim to netCDF file failed: " + *newFileName);
156       if (! (ncdims[2] = dataFile.add_dim("mpi_size_plus_1", mpi_size+1)) )
157          throw DataException("Error - MeshAdapter::dump: appending dimension mpi_size to netCDF file failed: " + *newFileName);
158       if (num_Elements>0)
159          if (! (ncdims[3] = dataFile.add_dim("dim_Elements", num_Elements)) )
160             throw DataException("Error - MeshAdapter::dump: appending dimension dim_Elements to netCDF file failed: " + *newFileName);
161       if (num_FaceElements>0)
162          if (! (ncdims[4] = dataFile.add_dim("dim_FaceElements", num_FaceElements)) )
163             throw DataException("Error - MeshAdapter::dump: appending dimension dim_FaceElements to netCDF file failed: " + *newFileName);
164       if (num_ContactElements>0)
165          if (! (ncdims[5] = dataFile.add_dim("dim_ContactElements", num_ContactElements)) )
166             throw DataException("Error - MeshAdapter::dump: appending dimension dim_ContactElements to netCDF file failed: " + *newFileName);
167       if (num_Points>0)
168          if (! (ncdims[6] = dataFile.add_dim("dim_Points", num_Points)) )
169             throw DataException("Error - MeshAdapter::dump: appending dimension dim_Points to netCDF file failed: " + *newFileName);
170       if (num_Elements>0)
171          if (! (ncdims[7] = dataFile.add_dim("dim_Elements_Nodes", num_Elements_numNodes)) )
172             throw DataException("Error - MeshAdapter::dump: appending dimension dim_Elements_Nodes to netCDF file failed: " + *newFileName);
173       if (num_FaceElements>0)
174          if (! (ncdims[8] = dataFile.add_dim("dim_FaceElements_numNodes", num_FaceElements_numNodes)) )
175             throw DataException("Error - MeshAdapter::dump: appending dimension dim_FaceElements_numNodes to netCDF file failed: " + *newFileName);
176       if (num_ContactElements>0)
177          if (! (ncdims[9] = dataFile.add_dim("dim_ContactElements_numNodes", num_ContactElements_numNodes)) )
178             throw DataException("Error - MeshAdapter::dump: appending dimension dim_ContactElements_numNodes to netCDF file failed: " + *newFileName);
179       if (num_Tags>0)
180          if (! (ncdims[10] = dataFile.add_dim("dim_Tags", num_Tags)) )
181             throw DataException("Error - MeshAdapter::dump: appending dimension dim_Tags to netCDF file failed: " + *newFileName);
182    
183       // Attributes: MPI size, MPI rank, Name, order, reduced_order
184       if (!dataFile.add_att("mpi_size", mpi_size) )
185          throw DataException("Error - MeshAdapter::dump: appending mpi_size to NetCDF file failed: " + *newFileName);
186       if (!dataFile.add_att("mpi_rank", mpi_rank) )
187          throw DataException("Error - MeshAdapter::dump: appending mpi_rank to NetCDF file failed: " + *newFileName);
188       if (!dataFile.add_att("Name",mesh->Name) )
189          throw DataException("Error - MeshAdapter::dump: appending Name to NetCDF file failed: " + *newFileName);
190       if (!dataFile.add_att("numDim",numDim) )
191          throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
192       if (!dataFile.add_att("order",mesh->order) )
193          throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
194       if (!dataFile.add_att("reduced_order",mesh->reduced_order) )
195          throw DataException("Error - MeshAdapter::dump: appending reduced_order to NetCDF file failed: " + *newFileName);
196       if (!dataFile.add_att("numNodes",numNodes) )
197          throw DataException("Error - MeshAdapter::dump: appending numNodes to NetCDF file failed: " + *newFileName);
198       if (!dataFile.add_att("num_Elements",num_Elements) )
199          throw DataException("Error - MeshAdapter::dump: appending num_Elements to NetCDF file failed: " + *newFileName);
200       if (!dataFile.add_att("num_FaceElements",num_FaceElements) )
201          throw DataException("Error - MeshAdapter::dump: appending num_FaceElements to NetCDF file failed: " + *newFileName);
202       if (!dataFile.add_att("num_ContactElements",num_ContactElements) )
203          throw DataException("Error - MeshAdapter::dump: appending num_ContactElements to NetCDF file failed: " + *newFileName);
204       if (!dataFile.add_att("num_Points",num_Points) )
205          throw DataException("Error - MeshAdapter::dump: appending num_Points to NetCDF file failed: " + *newFileName);
206       if (!dataFile.add_att("num_Elements_numNodes",num_Elements_numNodes) )
207          throw DataException("Error - MeshAdapter::dump: appending num_Elements_numNodes to NetCDF file failed: " + *newFileName);
208       if (!dataFile.add_att("num_FaceElements_numNodes",num_FaceElements_numNodes) )
209          throw DataException("Error - MeshAdapter::dump: appending num_FaceElements_numNodes to NetCDF file failed: " + *newFileName);
210       if (!dataFile.add_att("num_ContactElements_numNodes",num_ContactElements_numNodes) )
211          throw DataException("Error - MeshAdapter::dump: appending num_ContactElements_numNodes to NetCDF file failed: " + *newFileName);
212       if (!dataFile.add_att("Elements_TypeId", mesh->Elements->ReferenceElement->Type->TypeId) )
213          throw DataException("Error - MeshAdapter::dump: appending Elements_TypeId to NetCDF file failed: " + *newFileName);
214       if (!dataFile.add_att("FaceElements_TypeId", mesh->FaceElements->ReferenceElement->Type->TypeId) )
215          throw DataException("Error - MeshAdapter::dump: appending FaceElements_TypeId to NetCDF file failed: " + *newFileName);
216       if (!dataFile.add_att("ContactElements_TypeId", mesh->ContactElements->ReferenceElement->Type->TypeId) )
217          throw DataException("Error - MeshAdapter::dump: appending ContactElements_TypeId to NetCDF file failed: " + *newFileName);
218       if (!dataFile.add_att("Points_TypeId", mesh->Points->ReferenceElement->Type->TypeId) )
219          throw DataException("Error - MeshAdapter::dump: appending Points_TypeId to NetCDF file failed: " + *newFileName);
220       if (!dataFile.add_att("num_Tags", num_Tags) )
221          throw DataException("Error - MeshAdapter::dump: appending num_Tags to NetCDF file failed: " + *newFileName);
222    
223       // // // // // Nodes // // // // //
224    
225       // Only write nodes if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)
226       if (numNodes>0) {
227    
228          // Nodes Id
229          if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )
230             throw DataException("Error - MeshAdapter::dump: appending Nodes_Id to netCDF file failed: " + *newFileName);
231          int_ptr = &mesh->Nodes->Id[0];
232          if (! (ids->put(int_ptr, numNodes)) )
233             throw DataException("Error - MeshAdapter::dump: copy Nodes_Id to netCDF buffer failed: " + *newFileName);
234    
235          // Nodes Tag
236          if (! ( ids = dataFile.add_var("Nodes_Tag", ncInt, ncdims[0])) )
237             throw DataException("Error - MeshAdapter::dump: appending Nodes_Tag to netCDF file failed: " + *newFileName);
238          int_ptr = &mesh->Nodes->Tag[0];
239          if (! (ids->put(int_ptr, numNodes)) )
240             throw DataException("Error - MeshAdapter::dump: copy Nodes_Tag to netCDF buffer failed: " + *newFileName);
241    
242          // Nodes gDOF
243          if (! ( ids = dataFile.add_var("Nodes_gDOF", ncInt, ncdims[0])) )
244             throw DataException("Error - MeshAdapter::dump: appending Nodes_gDOF to netCDF file failed: " + *newFileName);
245          int_ptr = &mesh->Nodes->globalDegreesOfFreedom[0];
246          if (! (ids->put(int_ptr, numNodes)) )
247             throw DataException("Error - MeshAdapter::dump: copy Nodes_gDOF to netCDF buffer failed: " + *newFileName);
248    
249          // Nodes global node index
250          if (! ( ids = dataFile.add_var("Nodes_gNI", ncInt, ncdims[0])) )
251             throw DataException("Error - MeshAdapter::dump: appending Nodes_gNI to netCDF file failed: " + *newFileName);
252          int_ptr = &mesh->Nodes->globalNodesIndex[0];
253          if (! (ids->put(int_ptr, numNodes)) )
254             throw DataException("Error - MeshAdapter::dump: copy Nodes_gNI to netCDF buffer failed: " + *newFileName);
255    
256          // Nodes grDof
257          if (! ( ids = dataFile.add_var("Nodes_grDfI", ncInt, ncdims[0])) )
258             throw DataException("Error - MeshAdapter::dump: appending Nodes_grDfI to netCDF file failed: " + *newFileName);
259          int_ptr = &mesh->Nodes->globalReducedDOFIndex[0];
260          if (! (ids->put(int_ptr, numNodes)) )
261             throw DataException("Error - MeshAdapter::dump: copy Nodes_grDfI to netCDF buffer failed: " + *newFileName);
262    
263          // Nodes grNI
264          if (! ( ids = dataFile.add_var("Nodes_grNI", ncInt, ncdims[0])) )
265             throw DataException("Error - MeshAdapter::dump: appending Nodes_grNI to netCDF file failed: " + *newFileName);
266          int_ptr = &mesh->Nodes->globalReducedNodesIndex[0];
267          if (! (ids->put(int_ptr, numNodes)) )
268             throw DataException("Error - MeshAdapter::dump: copy Nodes_grNI to netCDF buffer failed: " + *newFileName);
269    
270          // Nodes Coordinates
271          if (! ( ids = dataFile.add_var("Nodes_Coordinates", ncDouble, ncdims[0], ncdims[1]) ) )
272             throw DataException("Error - MeshAdapter::dump: appending Nodes_Coordinates to netCDF file failed: " + *newFileName);
273          if (! (ids->put(&(mesh->Nodes->Coordinates[INDEX2(0,0,numDim)]), numNodes, numDim)) )
274             throw DataException("Error - MeshAdapter::dump: copy Nodes_Coordinates to netCDF buffer failed: " + *newFileName);
275    
276          // Nodes degreesOfFreedomDistribution
277          if (! ( ids = dataFile.add_var("Nodes_DofDistribution", ncInt, ncdims[2])) )
278             throw DataException("Error - MeshAdapter::dump: appending Nodes_DofDistribution to netCDF file failed: " + *newFileName);
279          int_ptr = &mesh->Nodes->degreesOfFreedomDistribution->first_component[0];
280          if (! (ids->put(int_ptr, mpi_size+1)) )
281             throw DataException("Error - MeshAdapter::dump: copy Nodes_DofDistribution to netCDF buffer failed: " + *newFileName);
282    
283       }
284    
285       // // // // // Elements // // // // //
286    
287       if (num_Elements>0) {
288    
289          // Temp storage to gather node IDs
290          int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);
291    
292          // Elements_Id
293          if (! ( ids = dataFile.add_var("Elements_Id", ncInt, ncdims[3])) )
294             throw DataException("Error - MeshAdapter::dump: appending Elements_Id to netCDF file failed: " + *newFileName);
295          int_ptr = &mesh->Elements->Id[0];
296          if (! (ids->put(int_ptr, num_Elements)) )
297             throw DataException("Error - MeshAdapter::dump: copy Elements_Id to netCDF buffer failed: " + *newFileName);
298    
299          // Elements_Tag
300          if (! ( ids = dataFile.add_var("Elements_Tag", ncInt, ncdims[3])) )
301             throw DataException("Error - MeshAdapter::dump: appending Elements_Tag to netCDF file failed: " + *newFileName);
302          int_ptr = &mesh->Elements->Tag[0];
303          if (! (ids->put(int_ptr, num_Elements)) )
304             throw DataException("Error - MeshAdapter::dump: copy Elements_Tag to netCDF buffer failed: " + *newFileName);
305    
306          // Elements_Owner
307          if (! ( ids = dataFile.add_var("Elements_Owner", ncInt, ncdims[3])) )
308             throw DataException("Error - MeshAdapter::dump: appending Elements_Owner to netCDF file failed: " + *newFileName);
309          int_ptr = &mesh->Elements->Owner[0];
310          if (! (ids->put(int_ptr, num_Elements)) )
311             throw DataException("Error - MeshAdapter::dump: copy Elements_Owner to netCDF buffer failed: " + *newFileName);
312    
313          // Elements_Color
314          if (! ( ids = dataFile.add_var("Elements_Color", ncInt, ncdims[3])) )
315             throw DataException("Error - MeshAdapter::dump: appending Elements_Color to netCDF file failed: " + *newFileName);
316          int_ptr = &mesh->Elements->Color[0];
317          if (! (ids->put(int_ptr, num_Elements)) )
318             throw DataException("Error - MeshAdapter::dump: copy Elements_Color to netCDF buffer failed: " + *newFileName);
319    
320          // Elements_Nodes
321          for (int i=0; i<num_Elements; i++)
322             for (int j=0; j<num_Elements_numNodes; j++)
323                Elements_Nodes[INDEX2(j,i,num_Elements_numNodes)] = mesh->Nodes->Id[mesh->Elements->Nodes[INDEX2(j,i,num_Elements_numNodes)]];
324          if (! ( ids = dataFile.add_var("Elements_Nodes", ncInt, ncdims[3], ncdims[7]) ) )
325             throw DataException("Error - MeshAdapter::dump: appending Elements_Nodes to netCDF file failed: " + *newFileName);
326          if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )
327             throw DataException("Error - MeshAdapter::dump: copy Elements_Nodes to netCDF buffer failed: " + *newFileName);
328    
329          TMPMEMFREE(Elements_Nodes);
330    
331       }
332    
333       // // // // // Face_Elements // // // // //
334    
335       if (num_FaceElements>0) {
336    
337          // Temp storage to gather node IDs
338          int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);
339    
340          // FaceElements_Id
341          if (! ( ids = dataFile.add_var("FaceElements_Id", ncInt, ncdims[4])) )
342             throw DataException("Error - MeshAdapter::dump: appending FaceElements_Id to netCDF file failed: " + *newFileName);
343          int_ptr = &mesh->FaceElements->Id[0];
344          if (! (ids->put(int_ptr, num_FaceElements)) )
345             throw DataException("Error - MeshAdapter::dump: copy FaceElements_Id to netCDF buffer failed: " + *newFileName);
346    
347          // FaceElements_Tag
348          if (! ( ids = dataFile.add_var("FaceElements_Tag", ncInt, ncdims[4])) )
349             throw DataException("Error - MeshAdapter::dump: appending FaceElements_Tag to netCDF file failed: " + *newFileName);
350          int_ptr = &mesh->FaceElements->Tag[0];
351          if (! (ids->put(int_ptr, num_FaceElements)) )
352             throw DataException("Error - MeshAdapter::dump: copy FaceElements_Tag to netCDF buffer failed: " + *newFileName);
353    
354          // FaceElements_Owner
355          if (! ( ids = dataFile.add_var("FaceElements_Owner", ncInt, ncdims[4])) )
356             throw DataException("Error - MeshAdapter::dump: appending FaceElements_Owner to netCDF file failed: " + *newFileName);
357          int_ptr = &mesh->FaceElements->Owner[0];
358          if (! (ids->put(int_ptr, num_FaceElements)) )
359             throw DataException("Error - MeshAdapter::dump: copy FaceElements_Owner to netCDF buffer failed: " + *newFileName);
360    
361          // FaceElements_Color
362          if (! ( ids = dataFile.add_var("FaceElements_Color", ncInt, ncdims[4])) )
363             throw DataException("Error - MeshAdapter::dump: appending FaceElements_Color to netCDF file failed: " + *newFileName);
364          int_ptr = &mesh->FaceElements->Color[0];
365          if (! (ids->put(int_ptr, num_FaceElements)) )
366             throw DataException("Error - MeshAdapter::dump: copy FaceElements_Color to netCDF buffer failed: " + *newFileName);
367    
368          // FaceElements_Nodes
369          for (int i=0; i<num_FaceElements; i++)
370             for (int j=0; j<num_FaceElements_numNodes; j++)
371                FaceElements_Nodes[INDEX2(j,i,num_FaceElements_numNodes)] = mesh->Nodes->Id[mesh->FaceElements->Nodes[INDEX2(j,i,num_FaceElements_numNodes)]];
372          if (! ( ids = dataFile.add_var("FaceElements_Nodes", ncInt, ncdims[4], ncdims[8]) ) )
373             throw DataException("Error - MeshAdapter::dump: appending FaceElements_Nodes to netCDF file failed: " + *newFileName);
374          if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )
375             throw DataException("Error - MeshAdapter::dump: copy FaceElements_Nodes to netCDF buffer failed: " + *newFileName);
376    
377          TMPMEMFREE(FaceElements_Nodes);
378    
379       }
380    
381       // // // // // Contact_Elements // // // // //
382    
383       if (num_ContactElements>0) {
384    
385          // Temp storage to gather node IDs
386          int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);
387    
388          // ContactElements_Id
389          if (! ( ids = dataFile.add_var("ContactElements_Id", ncInt, ncdims[5])) )
390             throw DataException("Error - MeshAdapter::dump: appending ContactElements_Id to netCDF file failed: " + *newFileName);
391          int_ptr = &mesh->ContactElements->Id[0];
392          if (! (ids->put(int_ptr, num_ContactElements)) )
393             throw DataException("Error - MeshAdapter::dump: copy ContactElements_Id to netCDF buffer failed: " + *newFileName);
394    
395          // ContactElements_Tag
396          if (! ( ids = dataFile.add_var("ContactElements_Tag", ncInt, ncdims[5])) )
397             throw DataException("Error - MeshAdapter::dump: appending ContactElements_Tag to netCDF file failed: " + *newFileName);
398          int_ptr = &mesh->ContactElements->Tag[0];
399          if (! (ids->put(int_ptr, num_ContactElements)) )
400             throw DataException("Error - MeshAdapter::dump: copy ContactElements_Tag to netCDF buffer failed: " + *newFileName);
401    
402          // ContactElements_Owner
403          if (! ( ids = dataFile.add_var("ContactElements_Owner", ncInt, ncdims[5])) )
404             throw DataException("Error - MeshAdapter::dump: appending ContactElements_Owner to netCDF file failed: " + *newFileName);
405          int_ptr = &mesh->ContactElements->Owner[0];
406          if (! (ids->put(int_ptr, num_ContactElements)) )
407             throw DataException("Error - MeshAdapter::dump: copy ContactElements_Owner to netCDF buffer failed: " + *newFileName);
408    
409          // ContactElements_Color
410          if (! ( ids = dataFile.add_var("ContactElements_Color", ncInt, ncdims[5])) )
411             throw DataException("Error - MeshAdapter::dump: appending ContactElements_Color to netCDF file failed: " + *newFileName);
412          int_ptr = &mesh->ContactElements->Color[0];
413          if (! (ids->put(int_ptr, num_ContactElements)) )
414             throw DataException("Error - MeshAdapter::dump: copy ContactElements_Color to netCDF buffer failed: " + *newFileName);
415    
416          // ContactElements_Nodes
417          for (int i=0; i<num_ContactElements; i++)
418             for (int j=0; j<num_ContactElements_numNodes; j++)
419                ContactElements_Nodes[INDEX2(j,i,num_ContactElements_numNodes)] = mesh->Nodes->Id[mesh->ContactElements->Nodes[INDEX2(j,i,num_ContactElements_numNodes)]];
420          if (! ( ids = dataFile.add_var("ContactElements_Nodes", ncInt, ncdims[5], ncdims[9]) ) )
421             throw DataException("Error - MeshAdapter::dump: appending ContactElements_Nodes to netCDF file failed: " + *newFileName);
422          if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )
423             throw DataException("Error - MeshAdapter::dump: copy ContactElements_Nodes to netCDF buffer failed: " + *newFileName);
424    
425          TMPMEMFREE(ContactElements_Nodes);
426    
427       }
428    
429       // // // // // Points // // // // //
430    
431       if (num_Points>0) {
432    
433          fprintf(stderr, "\n\n\nWARNING: MeshAdapter::dump has not been tested with Point elements\n\n\n");
434    
435          // Temp storage to gather node IDs
436          int *Points_Nodes = TMPMEMALLOC(num_Points,int);
437    
438          // Points_Id
439          if (! ( ids = dataFile.add_var("Points_Id", ncInt, ncdims[6])) )
440             throw DataException("Error - MeshAdapter::dump: appending Points_Id to netCDF file failed: " + *newFileName);
441          int_ptr = &mesh->Points->Id[0];
442          if (! (ids->put(int_ptr, num_Points)) )
443             throw DataException("Error - MeshAdapter::dump: copy Points_Id to netCDF buffer failed: " + *newFileName);
444    
445          // Points_Tag
446          if (! ( ids = dataFile.add_var("Points_Tag", ncInt, ncdims[6])) )
447             throw DataException("Error - MeshAdapter::dump: appending Points_Tag to netCDF file failed: " + *newFileName);
448          int_ptr = &mesh->Points->Tag[0];
449          if (! (ids->put(int_ptr, num_Points)) )
450             throw DataException("Error - MeshAdapter::dump: copy Points_Tag to netCDF buffer failed: " + *newFileName);
451    
452          // Points_Owner
453          if (! ( ids = dataFile.add_var("Points_Owner", ncInt, ncdims[6])) )
454             throw DataException("Error - MeshAdapter::dump: appending Points_Owner to netCDF file failed: " + *newFileName);
455          int_ptr = &mesh->Points->Owner[0];
456          if (! (ids->put(int_ptr, num_Points)) )
457             throw DataException("Error - MeshAdapter::dump: copy Points_Owner to netCDF buffer failed: " + *newFileName);
458    
459          // Points_Color
460          if (! ( ids = dataFile.add_var("Points_Color", ncInt, ncdims[6])) )
461             throw DataException("Error - MeshAdapter::dump: appending Points_Color to netCDF file failed: " + *newFileName);
462          int_ptr = &mesh->Points->Color[0];
463          if (! (ids->put(int_ptr, num_Points)) )
464             throw DataException("Error - MeshAdapter::dump: copy Points_Color to netCDF buffer failed: " + *newFileName);
465    
466          // Points_Nodes
467          // mesh->Nodes->Id[mesh->Points->Nodes[INDEX2(0,i,1)]]
468          for (int i=0; i<num_Points; i++)
469             Points_Nodes[i] = mesh->Nodes->Id[mesh->Points->Nodes[INDEX2(0,i,1)]];
470          if (! ( ids = dataFile.add_var("Points_Nodes", ncInt, ncdims[6]) ) )
471             throw DataException("Error - MeshAdapter::dump: appending Points_Nodes to netCDF file failed: " + *newFileName);
472          if (! (ids->put(&(Points_Nodes[0]), num_Points)) )
473             throw DataException("Error - MeshAdapter::dump: copy Points_Nodes to netCDF buffer failed: " + *newFileName);
474    
475          TMPMEMFREE(Points_Nodes);
476    
477       }
478    
479       // // // // // TagMap // // // // //
480    
481       if (num_Tags>0) {
482    
483          // Temp storage to gather node IDs
484          int *Tags_keys = TMPMEMALLOC(num_Tags, int);
485          char name_temp[4096];
486    
487          /* Copy tag data into temp arrays */
488          tag_map = mesh->TagMap;
489          if (tag_map) {
490             int i = 0;
491             while (tag_map) {
492                Tags_keys[i++] = tag_map->tag_key;
493                tag_map=tag_map->next;
494             }
495          }
496    
497          // Tags_keys
498          if (! ( ids = dataFile.add_var("Tags_keys", ncInt, ncdims[10])) )
499             throw DataException("Error - MeshAdapter::dump: appending Tags_keys to netCDF file failed: " + *newFileName);
500          int_ptr = &Tags_keys[0];
501          if (! (ids->put(int_ptr, num_Tags)) )
502             throw DataException("Error - MeshAdapter::dump: copy Tags_keys to netCDF buffer failed: " + *newFileName);
503    
504          // Tags_names_*
505          // This is an array of strings, it should be stored as an array but instead I have hacked in one attribute per string
506          // because the NetCDF manual doesn't tell how to do an array of strings
507          tag_map = mesh->TagMap;
508          if (tag_map) {
509             int i = 0;
510             while (tag_map) {
511                sprintf(name_temp, "Tags_name_%d", i);
512                if (!dataFile.add_att(name_temp, tag_map->name) )
513                   throw DataException("Error - MeshAdapter::dump: appending Tags_names_ to NetCDF file failed: " + *newFileName);
514                tag_map=tag_map->next;
515                i++;
516             }
517          }
518    
519          TMPMEMFREE(Tags_keys);
520    
521       }
522    
523    
524       // NetCDF file is closed by destructor of NcFile object
525    #else
526       Finley_setError(IO_ERROR, "MeshAdapter::dump: not configured with NetCDF. Please contact your installation manager.");
527    #endif  /* USE_NETCDF */
528       checkFinleyError();
529  }  }
530    
531  string MeshAdapter::getDescription() const  string MeshAdapter::getDescription() const
532  {  {
533    return "FinleyMesh";     return "FinleyMesh";
534  }  }
535    
536  string MeshAdapter::functionSpaceTypeAsString(int functionSpaceType) const  string MeshAdapter::functionSpaceTypeAsString(int functionSpaceType) const
537  {  {
538    FunctionSpaceNamesMapType::iterator loc;     FunctionSpaceNamesMapType::iterator loc;
539    loc=m_functionSpaceTypeNames.find(functionSpaceType);     loc=m_functionSpaceTypeNames.find(functionSpaceType);
540    if (loc==m_functionSpaceTypeNames.end()) {     if (loc==m_functionSpaceTypeNames.end()) {
541      return "Invalid function space type code.";        return "Invalid function space type code.";
542    } else {     } else {
543      return loc->second;        return loc->second;
544    }     }
545  }  }
546    
547  bool MeshAdapter::isValidFunctionSpaceType(int functionSpaceType) const  bool MeshAdapter::isValidFunctionSpaceType(int functionSpaceType) const
548  {  {
549    FunctionSpaceNamesMapType::iterator loc;     FunctionSpaceNamesMapType::iterator loc;
550    loc=m_functionSpaceTypeNames.find(functionSpaceType);     loc=m_functionSpaceTypeNames.find(functionSpaceType);
551    return (loc!=m_functionSpaceTypeNames.end());     return (loc!=m_functionSpaceTypeNames.end());
552  }  }
553    
554  void MeshAdapter::setFunctionSpaceTypeNames()  void MeshAdapter::setFunctionSpaceTypeNames()
555  {  {
556    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
557      (FunctionSpaceNamesMapType::value_type(DegreesOfFreedom,"Finley_DegreesOfFreedom"));     (FunctionSpaceNamesMapType::value_type(DegreesOfFreedom,"Finley_DegreesOfFreedom"));
558    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
559      (FunctionSpaceNamesMapType::value_type(ReducedDegreesOfFreedom,"Finley_ReducedDegreesOfFreedom"));     (FunctionSpaceNamesMapType::value_type(ReducedDegreesOfFreedom,"Finley_ReducedDegreesOfFreedom"));
560    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
561      (FunctionSpaceNamesMapType::value_type(Nodes,"Finley_Nodes"));     (FunctionSpaceNamesMapType::value_type(Nodes,"Finley_Nodes"));
562    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
563      (FunctionSpaceNamesMapType::value_type(ReducedNodes,"Finley_Reduced_Nodes"));     (FunctionSpaceNamesMapType::value_type(ReducedNodes,"Finley_Reduced_Nodes"));
564    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
565      (FunctionSpaceNamesMapType::value_type(Elements,"Finley_Elements"));     (FunctionSpaceNamesMapType::value_type(Elements,"Finley_Elements"));
566    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
567      (FunctionSpaceNamesMapType::value_type(ReducedElements,"Finley_Reduced_Elements"));     (FunctionSpaceNamesMapType::value_type(ReducedElements,"Finley_Reduced_Elements"));
568    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
569      (FunctionSpaceNamesMapType::value_type(FaceElements,"Finley_Face_Elements"));     (FunctionSpaceNamesMapType::value_type(FaceElements,"Finley_Face_Elements"));
570    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
571      (FunctionSpaceNamesMapType::value_type(ReducedFaceElements,"Finley_Reduced_Face_Elements"));     (FunctionSpaceNamesMapType::value_type(ReducedFaceElements,"Finley_Reduced_Face_Elements"));
572    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
573      (FunctionSpaceNamesMapType::value_type(Points,"Finley_Points"));     (FunctionSpaceNamesMapType::value_type(Points,"Finley_Points"));
574    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
575      (FunctionSpaceNamesMapType::value_type(ContactElementsZero,"Finley_Contact_Elements_0"));     (FunctionSpaceNamesMapType::value_type(ContactElementsZero,"Finley_Contact_Elements_0"));
576    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
577      (FunctionSpaceNamesMapType::value_type(ReducedContactElementsZero,"Finley_Reduced_Contact_Elements_0"));     (FunctionSpaceNamesMapType::value_type(ReducedContactElementsZero,"Finley_Reduced_Contact_Elements_0"));
578    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
579      (FunctionSpaceNamesMapType::value_type(ContactElementsOne,"Finley_Contact_Elements_1"));     (FunctionSpaceNamesMapType::value_type(ContactElementsOne,"Finley_Contact_Elements_1"));
580    m_functionSpaceTypeNames.insert     m_functionSpaceTypeNames.insert
581      (FunctionSpaceNamesMapType::value_type(ReducedContactElementsOne,"Finley_Reduced_Contact_Elements_1"));     (FunctionSpaceNamesMapType::value_type(ReducedContactElementsOne,"Finley_Reduced_Contact_Elements_1"));
582  }  }
583    
584  int MeshAdapter::getContinuousFunctionCode() const  int MeshAdapter::getContinuousFunctionCode() const
585  {  {
586    return Nodes;     return Nodes;
587  }  }
588  int MeshAdapter::getReducedContinuousFunctionCode() const  int MeshAdapter::getReducedContinuousFunctionCode() const
589  {  {
590    return ReducedNodes;     return ReducedNodes;
591  }  }
592    
593  int MeshAdapter::getFunctionCode() const  int MeshAdapter::getFunctionCode() const
594  {  {
595    return Elements;     return Elements;
596  }  }
597  int MeshAdapter::getReducedFunctionCode() const  int MeshAdapter::getReducedFunctionCode() const
598  {  {
599    return ReducedElements;     return ReducedElements;
600  }  }
601    
602  int MeshAdapter::getFunctionOnBoundaryCode() const  int MeshAdapter::getFunctionOnBoundaryCode() const
603  {  {
604    return FaceElements;     return FaceElements;
605  }  }
606  int MeshAdapter::getReducedFunctionOnBoundaryCode() const  int MeshAdapter::getReducedFunctionOnBoundaryCode() const
607  {  {
608    return ReducedFaceElements;     return ReducedFaceElements;
609  }  }
610    
611  int MeshAdapter::getFunctionOnContactZeroCode() const  int MeshAdapter::getFunctionOnContactZeroCode() const
612  {  {
613    return ContactElementsZero;     return ContactElementsZero;
614  }  }
615  int MeshAdapter::getReducedFunctionOnContactZeroCode() const  int MeshAdapter::getReducedFunctionOnContactZeroCode() const
616  {  {
617    return ReducedContactElementsZero;     return ReducedContactElementsZero;
618  }  }
619    
620  int MeshAdapter::getFunctionOnContactOneCode() const  int MeshAdapter::getFunctionOnContactOneCode() const
621  {  {
622    return ContactElementsOne;     return ContactElementsOne;
623  }  }
624  int MeshAdapter::getReducedFunctionOnContactOneCode() const  int MeshAdapter::getReducedFunctionOnContactOneCode() const
625  {  {
626    return ReducedContactElementsOne;     return ReducedContactElementsOne;
627  }  }
628    
629  int MeshAdapter::getSolutionCode() const  int MeshAdapter::getSolutionCode() const
630  {  {
631    return DegreesOfFreedom;     return DegreesOfFreedom;
632  }  }
633    
634  int MeshAdapter::getReducedSolutionCode() const  int MeshAdapter::getReducedSolutionCode() const
635  {  {
636    return ReducedDegreesOfFreedom;     return ReducedDegreesOfFreedom;
637  }  }
638    
639  int MeshAdapter::getDiracDeltaFunctionCode() const  int MeshAdapter::getDiracDeltaFunctionCode() const
640  {  {
641    return Points;     return Points;
642  }  }
643    
644  //  //
# Line 225  int MeshAdapter::getDiracDeltaFunctionCo Line 646  int MeshAdapter::getDiracDeltaFunctionCo
646  //  //
647  int MeshAdapter::getDim() const  int MeshAdapter::getDim() const
648  {  {
649    int numDim=Finley_Mesh_getDim(m_finleyMesh.get());     int numDim=Finley_Mesh_getDim(m_finleyMesh.get());
650    checkFinleyError();     checkFinleyError();
651    return numDim;     return numDim;
652  }  }
653    
654  //  //
# Line 240  pair<int,int> MeshAdapter::getDataShape( Line 661  pair<int,int> MeshAdapter::getDataShape(
661     int numSamples=0;     int numSamples=0;
662     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
663     switch (functionSpaceCode) {     switch (functionSpaceCode) {
664        case(Nodes):     case(Nodes):
665             numDataPointsPerSample=1;     numDataPointsPerSample=1;
666             numSamples=Finley_NodeFile_getNumNodes(mesh->Nodes);     numSamples=Finley_NodeFile_getNumNodes(mesh->Nodes);
667             break;     break;
668        case(ReducedNodes):     case(ReducedNodes):
669             numDataPointsPerSample=1;     numDataPointsPerSample=1;
670             numSamples=Finley_NodeFile_getNumReducedNodes(mesh->Nodes);     numSamples=Finley_NodeFile_getNumReducedNodes(mesh->Nodes);
671             break;     break;
672        case(Elements):     case(Elements):
673             if (mesh->Elements!=NULL) {     if (mesh->Elements!=NULL) {
674               numSamples=mesh->Elements->numElements;        numSamples=mesh->Elements->numElements;
675               numDataPointsPerSample=mesh->Elements->ReferenceElement->numQuadNodes;        numDataPointsPerSample=mesh->Elements->ReferenceElement->numQuadNodes;
676             }     }
677             break;     break;
678        case(ReducedElements):     case(ReducedElements):
679             if (mesh->Elements!=NULL) {     if (mesh->Elements!=NULL) {
680               numSamples=mesh->Elements->numElements;        numSamples=mesh->Elements->numElements;
681               numDataPointsPerSample=mesh->Elements->ReferenceElementReducedOrder->numQuadNodes;        numDataPointsPerSample=mesh->Elements->ReferenceElementReducedOrder->numQuadNodes;
682             }     }
683             break;     break;
684        case(FaceElements):     case(FaceElements):
685             if (mesh->FaceElements!=NULL) {     if (mesh->FaceElements!=NULL) {
686                  numDataPointsPerSample=mesh->FaceElements->ReferenceElement->numQuadNodes;        numDataPointsPerSample=mesh->FaceElements->ReferenceElement->numQuadNodes;
687                  numSamples=mesh->FaceElements->numElements;        numSamples=mesh->FaceElements->numElements;
688             }     }
689             break;     break;
690        case(ReducedFaceElements):     case(ReducedFaceElements):
691             if (mesh->FaceElements!=NULL) {     if (mesh->FaceElements!=NULL) {
692                  numDataPointsPerSample=mesh->FaceElements->ReferenceElementReducedOrder->numQuadNodes;        numDataPointsPerSample=mesh->FaceElements->ReferenceElementReducedOrder->numQuadNodes;
693                  numSamples=mesh->FaceElements->numElements;        numSamples=mesh->FaceElements->numElements;
694             }     }
695             break;     break;
696        case(Points):     case(Points):
697             if (mesh->Points!=NULL) {     if (mesh->Points!=NULL) {
698               numDataPointsPerSample=1;        numDataPointsPerSample=1;
699               numSamples=mesh->Points->numElements;        numSamples=mesh->Points->numElements;
700             }     }
701             break;     break;
702        case(ContactElementsZero):     case(ContactElementsZero):
703             if (mesh->ContactElements!=NULL) {     if (mesh->ContactElements!=NULL) {
704               numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;        numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;
705               numSamples=mesh->ContactElements->numElements;        numSamples=mesh->ContactElements->numElements;
706             }     }
707             break;     break;
708        case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
709             if (mesh->ContactElements!=NULL) {     if (mesh->ContactElements!=NULL) {
710               numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;        numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;
711               numSamples=mesh->ContactElements->numElements;        numSamples=mesh->ContactElements->numElements;
712             }     }
713             break;     break;
714        case(ContactElementsOne):     case(ContactElementsOne):
715             if (mesh->ContactElements!=NULL) {     if (mesh->ContactElements!=NULL) {
716               numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;        numDataPointsPerSample=mesh->ContactElements->ReferenceElement->numQuadNodes;
717               numSamples=mesh->ContactElements->numElements;        numSamples=mesh->ContactElements->numElements;
718             }     }
719             break;     break;
720        case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
721             if (mesh->ContactElements!=NULL) {     if (mesh->ContactElements!=NULL) {
722               numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;        numDataPointsPerSample=mesh->ContactElements->ReferenceElementReducedOrder->numQuadNodes;
723               numSamples=mesh->ContactElements->numElements;        numSamples=mesh->ContactElements->numElements;
724             }     }
725             break;     break;
726        case(DegreesOfFreedom):     case(DegreesOfFreedom):
727             if (mesh->Nodes!=NULL) {     if (mesh->Nodes!=NULL) {
728               numDataPointsPerSample=1;        numDataPointsPerSample=1;
729               numSamples=Finley_NodeFile_getNumDegreesOfFreedom(mesh->Nodes);        numSamples=Finley_NodeFile_getNumDegreesOfFreedom(mesh->Nodes);
730             }     }
731             break;     break;
732        case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
733             if (mesh->Nodes!=NULL) {     if (mesh->Nodes!=NULL) {
734               numDataPointsPerSample=1;        numDataPointsPerSample=1;
735               numSamples=Finley_NodeFile_getNumReducedDegreesOfFreedom(mesh->Nodes);        numSamples=Finley_NodeFile_getNumReducedDegreesOfFreedom(mesh->Nodes);
736             }     }
737             break;     break;
738        default:     default:
739          stringstream temp;        stringstream temp;
740          temp << "Error - Invalid function space type: " << functionSpaceCode << " for domain: " << getDescription();        temp << "Error - Invalid function space type: " << functionSpaceCode << " for domain: " << getDescription();
741          throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
742          break;        break;
743        }     }
744        return pair<int,int>(numDataPointsPerSample,numSamples);     return pair<int,int>(numDataPointsPerSample,numSamples);
745  }  }
746    
747  //  //
748  // adds linear PDE of second order into a given stiffness matrix and right hand side:  // adds linear PDE of second order into a given stiffness matrix and right hand side:
749  //  //
750  void MeshAdapter::addPDEToSystem(  void MeshAdapter::addPDEToSystem(
751                       SystemMatrixAdapter& mat, escript::Data& rhs,                                   SystemMatrixAdapter& mat, escript::Data& rhs,
752                       const escript::Data& A, const escript::Data& B, const escript::Data& C,const  escript::Data& D,const  escript::Data& X,const  escript::Data& Y,                                   const escript::Data& A, const escript::Data& B, const escript::Data& C,const  escript::Data& D,const  escript::Data& X,const  escript::Data& Y,
753                       const escript::Data& d, const escript::Data& y,                                   const escript::Data& d, const escript::Data& y,
754                       const escript::Data& d_contact,const escript::Data& y_contact) const                                   const escript::Data& d_contact,const escript::Data& y_contact) const
755  {  {
756     escriptDataC _rhs=rhs.getDataC();     escriptDataC _rhs=rhs.getDataC();
757     escriptDataC _A  =A.getDataC();     escriptDataC _A  =A.getDataC();
# Line 357  void MeshAdapter::addPDEToSystem( Line 778  void MeshAdapter::addPDEToSystem(
778  }  }
779    
780  void  MeshAdapter::addPDEToLumpedSystem(  void  MeshAdapter::addPDEToLumpedSystem(
781                       escript::Data& mat,                                          escript::Data& mat,
782                       const escript::Data& D,                                          const escript::Data& D,
783                       const escript::Data& d) const                                          const escript::Data& d) const
784  {  {
785     escriptDataC _mat=mat.getDataC();     escriptDataC _mat=mat.getDataC();
786     escriptDataC _D=D.getDataC();     escriptDataC _D=D.getDataC();
# Line 396  void MeshAdapter::addPDEToRHS( escript:: Line 817  void MeshAdapter::addPDEToRHS( escript::
817     Finley_Assemble_PDE(mesh->Nodes,mesh->ContactElements, 0, &_rhs , 0, 0, 0, 0, 0, &_y_contact );     Finley_Assemble_PDE(mesh->Nodes,mesh->ContactElements, 0, &_rhs , 0, 0, 0, 0, 0, &_y_contact );
818     checkFinleyError();     checkFinleyError();
819  }  }
820    //
821    // adds PDE of second order into a transport problem
822    //
823    void MeshAdapter::addPDEToTransportProblem(
824                                               TransportProblemAdapter& tp, escript::Data& source, const escript::Data& M,
825                                               const escript::Data& A, const escript::Data& B, const escript::Data& C,
826                                               const  escript::Data& D,const  escript::Data& X,const  escript::Data& Y,
827                                               const escript::Data& d, const escript::Data& y,
828                                               const escript::Data& d_contact,const escript::Data& y_contact) const
829    {
830       DataArrayView::ShapeType shape;
831       source.expand();
832       escriptDataC _source=source.getDataC();
833       escriptDataC _M=M.getDataC();
834       escriptDataC _A=A.getDataC();
835       escriptDataC _B=B.getDataC();
836       escriptDataC _C=C.getDataC();
837       escriptDataC _D=D.getDataC();
838       escriptDataC _X=X.getDataC();
839       escriptDataC _Y=Y.getDataC();
840       escriptDataC _d=d.getDataC();
841       escriptDataC _y=y.getDataC();
842       escriptDataC _d_contact=d_contact.getDataC();
843       escriptDataC _y_contact=y_contact.getDataC();
844    
845       Finley_Mesh* mesh=m_finleyMesh.get();
846       Paso_FCTransportProblem* _tp = tp.getPaso_FCTransportProblem();
847    
848       Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,_tp->mass_matrix, &_source, 0, 0, 0, &_M, 0, 0 );
849       checkFinleyError();
850    
851       Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,_tp->transport_matrix, &_source, &_A, &_B, &_C, &_D, &_X, &_Y );
852       checkFinleyError();
853    
854       Finley_Assemble_PDE(mesh->Nodes,mesh->FaceElements, _tp->transport_matrix, &_source, 0, 0, 0, &_d, 0, &_y );
855       checkFinleyError();
856    
857       Finley_Assemble_PDE(mesh->Nodes,mesh->ContactElements, _tp->transport_matrix, &_source , 0, 0, 0, &_d_contact, 0, &_y_contact );
858       checkFinleyError();
859    }
860    
861  //  //
862  // interpolates data between different function spaces:  // interpolates data between different function spaces:
863  //  //
864  void MeshAdapter::interpolateOnDomain(escript::Data& target,const escript::Data& in) const  void MeshAdapter::interpolateOnDomain(escript::Data& target,const escript::Data& in) const
865  {  {
866    const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(in.getFunctionSpace().getDomain());     const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(in.getFunctionSpace().getDomain());
867    const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());
868    if (inDomain!=*this)       if (inDomain!=*this)  
869      throw FinleyAdapterException("Error - Illegal domain of interpolant.");        throw FinleyAdapterException("Error - Illegal domain of interpolant.");
870    if (targetDomain!=*this)     if (targetDomain!=*this)
871      throw FinleyAdapterException("Error - Illegal domain of interpolation target.");        throw FinleyAdapterException("Error - Illegal domain of interpolation target.");
872    
873    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
874    escriptDataC _target=target.getDataC();     escriptDataC _target=target.getDataC();
875    escriptDataC _in=in.getDataC();     escriptDataC _in=in.getDataC();
876    switch(in.getFunctionSpace().getTypeCode()) {     switch(in.getFunctionSpace().getTypeCode()) {
877       case(Nodes):     case(Nodes):
878          switch(target.getFunctionSpace().getTypeCode()) {     switch(target.getFunctionSpace().getTypeCode()) {
879             case(Nodes):     case(Nodes):
880             case(ReducedNodes):     case(ReducedNodes):
881             case(DegreesOfFreedom):     case(DegreesOfFreedom):
882             case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
883                 Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);     Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
884                 break;     break;
885             case(Elements):     case(Elements):
886             case(ReducedElements):     case(ReducedElements):
887                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
888                 break;     break;
889             case(FaceElements):     case(FaceElements):
890             case(ReducedFaceElements):     case(ReducedFaceElements):
891                 Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
892                 break;     break;
893             case(Points):     case(Points):
894                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
895                 break;     break;
896             case(ContactElementsZero):     case(ContactElementsZero):
897             case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
898                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
899                 break;     break;
900             case(ContactElementsOne):     case(ContactElementsOne):
901             case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
902                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
903                 break;     break;
904             default:     default:
905                 stringstream temp;        stringstream temp;
906                 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();
907                 throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
908                 break;        break;
909          }     }
910          break;     break;
911       case(ReducedNodes):     case(ReducedNodes):
912          switch(target.getFunctionSpace().getTypeCode()) {     switch(target.getFunctionSpace().getTypeCode()) {
913             case(Nodes):     case(Nodes):
914             case(ReducedNodes):     case(ReducedNodes):
915             case(DegreesOfFreedom):     case(DegreesOfFreedom):
916             case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
917                 Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);     Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
918                 break;     break;
919             case(Elements):     case(Elements):
920             case(ReducedElements):     case(ReducedElements):
921                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
922                 break;     break;
923             case(FaceElements):     case(FaceElements):
924             case(ReducedFaceElements):     case(ReducedFaceElements):
925                 Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
926                 break;     break;
927             case(Points):     case(Points):
928                 Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
929                 break;     break;
930             case(ContactElementsZero):     case(ContactElementsZero):
931             case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
932                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
933                 break;     break;
934             case(ContactElementsOne):     case(ContactElementsOne):
935             case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
936                 Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);     Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
937                 break;     break;
938             default:     default:
939                 stringstream temp;        stringstream temp;
940                 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();
941                 throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
942                 break;        break;
943          }     }
944          break;     break;
945       case(Elements):     case(Elements):
946          if (target.getFunctionSpace().getTypeCode()==Elements) {     if (target.getFunctionSpace().getTypeCode()==Elements) {
947             Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);        Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);
948          } else if (target.getFunctionSpace().getTypeCode()==ReducedElements) {     } else if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
949             Finley_Assemble_AverageElementData(mesh->Elements,&_target,&_in);        Finley_Assemble_AverageElementData(mesh->Elements,&_target,&_in);
950          } else {     } else {
951             throw FinleyAdapterException("Error - No interpolation with data on elements possible.");        throw FinleyAdapterException("Error - No interpolation with data on elements possible.");
952          }     }
953          break;     break;
954       case(ReducedElements):     case(ReducedElements):
955          if (target.getFunctionSpace().getTypeCode()==ReducedElements) {     if (target.getFunctionSpace().getTypeCode()==ReducedElements) {
956             Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);        Finley_Assemble_CopyElementData(mesh->Elements,&_target,&_in);
957          } else {     } else {
958             throw FinleyAdapterException("Error - No interpolation with data on elements with reduced integration order possible.");        throw FinleyAdapterException("Error - No interpolation with data on elements with reduced integration order possible.");
959          }     }
960          break;     break;
961       case(FaceElements):     case(FaceElements):
962          if (target.getFunctionSpace().getTypeCode()==FaceElements) {     if (target.getFunctionSpace().getTypeCode()==FaceElements) {
963             Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);        Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
964          } else if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {     } else if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
965             Finley_Assemble_AverageElementData(mesh->FaceElements,&_target,&_in);        Finley_Assemble_AverageElementData(mesh->FaceElements,&_target,&_in);
966          } else {     } else {
967             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");        throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");
968         }     }
969         break;     break;
970       case(ReducedFaceElements):     case(ReducedFaceElements):
971          if (target.getFunctionSpace().getTypeCode()==FaceElements) {     if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
972             Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);        Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
973          } else {     } else {
974             throw FinleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");        throw FinleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");
975         }     }
976         break;     break;
977       case(Points):     case(Points):
978          if (target.getFunctionSpace().getTypeCode()==Points) {     if (target.getFunctionSpace().getTypeCode()==Points) {
979             Finley_Assemble_CopyElementData(mesh->Points,&_target,&_in);        Finley_Assemble_CopyElementData(mesh->Points,&_target,&_in);
980          } else {     } else {
981             throw FinleyAdapterException("Error - No interpolation with data on points possible.");        throw FinleyAdapterException("Error - No interpolation with data on points possible.");
982          }     }
983          break;     break;
984       case(ContactElementsZero):     case(ContactElementsZero):
985       case(ContactElementsOne):     case(ContactElementsOne):
986          if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {     if (target.getFunctionSpace().getTypeCode()==ContactElementsZero || target.getFunctionSpace().getTypeCode()==ContactElementsOne) {
987             Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);        Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
988          } else if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {     } else if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {
989             Finley_Assemble_AverageElementData(mesh->ContactElements,&_target,&_in);        Finley_Assemble_AverageElementData(mesh->ContactElements,&_target,&_in);
990          } else {     } else {
991             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");        throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");
992             break;     }
993          }     break;
994          break;     case(ReducedContactElementsZero):
995       case(ReducedContactElementsZero):     case(ReducedContactElementsOne):
996       case(ReducedContactElementsOne):     if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {
997          if (target.getFunctionSpace().getTypeCode()==ReducedContactElementsZero || target.getFunctionSpace().getTypeCode()==ReducedContactElementsOne) {        Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
998             Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);     } else {
999          } else {        throw FinleyAdapterException("Error - No interpolation with data on contact elements with reduced integration order possible.");
1000             throw FinleyAdapterException("Error - No interpolation with data on contact elements with reduced integration order possible.");     }
1001             break;     break;
1002          }     case(DegreesOfFreedom):      
1003          break;     switch(target.getFunctionSpace().getTypeCode()) {
1004       case(DegreesOfFreedom):           case(ReducedDegreesOfFreedom):
1005          switch(target.getFunctionSpace().getTypeCode()) {     case(DegreesOfFreedom):
1006             case(ReducedDegreesOfFreedom):     Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
1007             case(DegreesOfFreedom):     break;
1008                Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);  
1009                break;     case(Nodes):
1010       case(ReducedNodes):
1011             case(Nodes):     if (getMPISize()>1) {
1012             case(ReducedNodes):        escript::Data temp=escript::Data(in);
1013                if (getMPISize()>1) {        temp.expand();
1014                    escript::Data temp=escript::Data(in);        escriptDataC _in2 = temp.getDataC();
1015                    temp.expand();        Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);
1016                    escriptDataC _in2 = temp.getDataC();     } else {
1017                    Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);        Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
1018                } else {     }
1019                    Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);     break;
1020                }     case(Elements):
1021                break;     case(ReducedElements):
1022             case(Elements):     if (getMPISize()>1) {
1023             case(ReducedElements):        escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1024                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1025                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);
1026                   escriptDataC _in2 = temp.getDataC();     } else {
1027                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);        Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
1028                } else {     }
1029                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);     break;
1030                }     case(FaceElements):
1031                break;     case(ReducedFaceElements):
1032             case(FaceElements):     if (getMPISize()>1) {
1033             case(ReducedFaceElements):        escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1034                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1035                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);
1036                   escriptDataC _in2 = temp.getDataC();  
1037                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);     } else {
1038          Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
1039                } else {     }
1040                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);     break;
1041                }     case(Points):
1042                break;     if (getMPISize()>1) {
1043             case(Points):        escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1044                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1045                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );     } else {
1046                   escriptDataC _in2 = temp.getDataC();        Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
1047                } else {     }
1048                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);     break;
1049                }     case(ContactElementsZero):
1050                break;     case(ContactElementsOne):
1051             case(ContactElementsZero):     case(ReducedContactElementsZero):
1052             case(ContactElementsOne):     case(ReducedContactElementsOne):
1053             case(ReducedContactElementsZero):     if (getMPISize()>1) {
1054             case(ReducedContactElementsOne):        escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );
1055                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1056                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);
1057                   escriptDataC _in2 = temp.getDataC();     } else {
1058                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);        Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
1059                } else {     }
1060                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);     break;
1061                }     default:
1062               break;        stringstream temp;
1063             default:        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
1064               stringstream temp;        throw FinleyAdapterException(temp.str());
1065               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();        break;
1066               throw FinleyAdapterException(temp.str());     }
1067               break;     break;
1068          }     case(ReducedDegreesOfFreedom):
1069          break;     switch(target.getFunctionSpace().getTypeCode()) {
1070       case(ReducedDegreesOfFreedom):     case(Nodes):
1071         switch(target.getFunctionSpace().getTypeCode()) {     throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");
1072            case(Nodes):     break;
1073               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to mesh nodes.");     case(ReducedNodes):
1074               break;     if (getMPISize()>1) {
1075            case(ReducedNodes):        escript::Data temp=escript::Data(in);
1076                if (getMPISize()>1) {        temp.expand();
1077                    escript::Data temp=escript::Data(in);        escriptDataC _in2 = temp.getDataC();
1078                    temp.expand();        Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);
1079                    escriptDataC _in2 = temp.getDataC();     } else {
1080                    Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in2);        Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
1081                } else {     }
1082                    Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);     break;
1083                }     case(DegreesOfFreedom):
1084                break;     throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");
1085            case(DegreesOfFreedom):     break;
1086               throw FinleyAdapterException("Error - Finley does not support interpolation from reduced degrees of freedom to degrees of freedom");     case(ReducedDegreesOfFreedom):
1087               break;     Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);
1088            case(ReducedDegreesOfFreedom):     break;
1089               Finley_Assemble_CopyNodalData(mesh->Nodes,&_target,&_in);     case(Elements):
1090               break;     case(ReducedElements):
1091            case(Elements):     if (getMPISize()>1) {
1092            case(ReducedElements):        escript::Data temp=escript::Data( in,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1093                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1094                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);
1095                   escriptDataC _in2 = temp.getDataC();     } else {
1096                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in2,&_target);        Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);
1097                } else {     }
1098                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Elements,&_in,&_target);     break;
1099               }     case(FaceElements):
1100               break;     case(ReducedFaceElements):
1101            case(FaceElements):     if (getMPISize()>1) {
1102            case(ReducedFaceElements):        escript::Data temp=escript::Data( in,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1103                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1104                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);
1105                   escriptDataC _in2 = temp.getDataC();     } else {
1106                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in2,&_target);        Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);
1107                } else {     }
1108                   Finley_Assemble_interpolate(mesh->Nodes,mesh->FaceElements,&_in,&_target);     break;
1109                }     case(Points):
1110               break;     if (getMPISize()>1) {
1111            case(Points):        escript::Data temp=escript::Data( in,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1112                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1113                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in2,&_target);
1114                   escriptDataC _in2 = temp.getDataC();     } else {
1115                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in2,&_target);        Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);
1116                } else {     }
1117                   Finley_Assemble_interpolate(mesh->Nodes,mesh->Points,&_in,&_target);     break;
1118               }     case(ContactElementsZero):
1119               break;     case(ContactElementsOne):
1120            case(ContactElementsZero):     case(ReducedContactElementsZero):
1121            case(ContactElementsOne):     case(ReducedContactElementsOne):
1122            case(ReducedContactElementsZero):     if (getMPISize()>1) {
1123            case(ReducedContactElementsOne):        escript::Data temp=escript::Data( in,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1124                if (getMPISize()>1) {        escriptDataC _in2 = temp.getDataC();
1125                   escript::Data temp=escript::Data( in,  continuousFunction(asAbstractContinuousDomain()) );        Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);
1126                   escriptDataC _in2 = temp.getDataC();     } else {
1127                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in2,&_target);        Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);
1128                } else {     }
1129                   Finley_Assemble_interpolate(mesh->Nodes,mesh->ContactElements,&_in,&_target);     break;
1130               }     default:
1131               break;        stringstream temp;
1132            default:        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();
1133               stringstream temp;        throw FinleyAdapterException(temp.str());
1134               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << target.getFunctionSpace().getTypeCode();        break;
1135               throw FinleyAdapterException(temp.str());     }
1136               break;     break;
1137         }     default:
1138         break;        stringstream temp;
1139       default:        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type %d" << in.getFunctionSpace().getTypeCode();
1140          stringstream temp;        throw FinleyAdapterException(temp.str());
1141          temp << "Error - Interpolation On Domain: Finley does not know anything about function space type %d" << in.getFunctionSpace().getTypeCode();        break;
1142          throw FinleyAdapterException(temp.str());     }
1143          break;     checkFinleyError();
   }  
   checkFinleyError();  
1144  }  }
1145    
1146  //  //
# Line 689  void MeshAdapter::interpolateOnDomain(es Line 1148  void MeshAdapter::interpolateOnDomain(es
1148  //  //
1149  void MeshAdapter::setToX(escript::Data& arg) const  void MeshAdapter::setToX(escript::Data& arg) const
1150  {  {
1151    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());
1152    if (argDomain!=*this)     if (argDomain!=*this)
1153       throw FinleyAdapterException("Error - Illegal domain of data point locations");        throw FinleyAdapterException("Error - Illegal domain of data point locations");
1154    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1155    // in case of values node coordinates we can do the job directly:     // in case of values node coordinates we can do the job directly:
1156    if (arg.getFunctionSpace().getTypeCode()==Nodes) {     if (arg.getFunctionSpace().getTypeCode()==Nodes) {
1157       escriptDataC _arg=arg.getDataC();        escriptDataC _arg=arg.getDataC();
1158       Finley_Assemble_NodeCoordinates(mesh->Nodes,&_arg);        Finley_Assemble_NodeCoordinates(mesh->Nodes,&_arg);
1159    } else {     } else {
1160       escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);        escript::Data tmp_data=Vector(0.0,continuousFunction(asAbstractContinuousDomain()),true);
1161       escriptDataC _tmp_data=tmp_data.getDataC();        escriptDataC _tmp_data=tmp_data.getDataC();
1162       Finley_Assemble_NodeCoordinates(mesh->Nodes,&_tmp_data);        Finley_Assemble_NodeCoordinates(mesh->Nodes,&_tmp_data);
1163       // this is then interpolated onto arg:        // this is then interpolated onto arg:
1164       interpolateOnDomain(arg,tmp_data);        interpolateOnDomain(arg,tmp_data);
1165    }     }
1166    checkFinleyError();     checkFinleyError();
1167  }  }
1168    
1169  //  //
# Line 712  void MeshAdapter::setToX(escript::Data& Line 1171  void MeshAdapter::setToX(escript::Data&
1171  //  //
1172  void MeshAdapter::setToNormal(escript::Data& normal) const  void MeshAdapter::setToNormal(escript::Data& normal) const
1173  {  {
1174    const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());     const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());
1175    if (normalDomain!=*this)     if (normalDomain!=*this)
1176       throw FinleyAdapterException("Error - Illegal domain of normal locations");        throw FinleyAdapterException("Error - Illegal domain of normal locations");
1177    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1178    escriptDataC _normal=normal.getDataC();     escriptDataC _normal=normal.getDataC();
1179    switch(normal.getFunctionSpace().getTypeCode()) {     switch(normal.getFunctionSpace().getTypeCode()) {
1180      case(Nodes):     case(Nodes):
1181        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");     throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");
1182        break;     break;
1183      case(ReducedNodes):     case(ReducedNodes):
1184        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced nodes");     throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced nodes");
1185        break;     break;
1186      case(Elements):     case(Elements):
1187        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");     throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements");
1188        break;     break;
1189      case(ReducedElements):     case(ReducedElements):
1190        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements with reduced integration order");     throw FinleyAdapterException("Error - Finley does not support surface normal vectors for elements with reduced integration order");
1191        break;     break;
1192      case (FaceElements):     case (FaceElements):
1193        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);     Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);
1194        break;     break;
1195      case (ReducedFaceElements):     case (ReducedFaceElements):
1196        Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);     Finley_Assemble_setNormal(mesh->Nodes,mesh->FaceElements,&_normal);
1197        break;     break;
1198      case(Points):     case(Points):
1199        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");
1200        break;     break;
1201      case (ContactElementsOne):     case (ContactElementsOne):
1202      case (ContactElementsZero):     case (ContactElementsZero):
1203        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);     Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);
1204        break;     break;
1205      case (ReducedContactElementsOne):     case (ReducedContactElementsOne):
1206      case (ReducedContactElementsZero):     case (ReducedContactElementsZero):
1207        Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);     Finley_Assemble_setNormal(mesh->Nodes,mesh->ContactElements,&_normal);
1208        break;     break;
1209      case(DegreesOfFreedom):     case(DegreesOfFreedom):
1210        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.");
1211        break;     break;
1212      case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1213        throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced degrees of freedom.");     throw FinleyAdapterException("Error - Finley does not support surface normal vectors for reduced degrees of freedom.");
1214        break;     break;
1215      default:     default:
1216        stringstream temp;        stringstream temp;
1217        temp << "Error - Normal Vectors: Finley does not know anything about function space type " << normal.getFunctionSpace().getTypeCode();        temp << "Error - Normal Vectors: Finley does not know anything about function space type " << normal.getFunctionSpace().getTypeCode();
1218        throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1219        break;        break;
1220    }     }
1221    checkFinleyError();     checkFinleyError();
1222  }  }
1223    
1224  //  //
# Line 767  void MeshAdapter::setToNormal(escript::D Line 1226  void MeshAdapter::setToNormal(escript::D
1226  //  //
1227  void MeshAdapter::interpolateACross(escript::Data& target,const escript::Data& source) const  void MeshAdapter::interpolateACross(escript::Data& target,const escript::Data& source) const
1228  {  {
1229    const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());
1230    if (targetDomain!=*this)     if (targetDomain!=*this)
1231       throw FinleyAdapterException("Error - Illegal domain of interpolation target");        throw FinleyAdapterException("Error - Illegal domain of interpolation target");
1232    
1233    throw FinleyAdapterException("Error - Finley does not allow interpolation across domains yet.");     throw FinleyAdapterException("Error - Finley does not allow interpolation across domains yet.");
1234  }  }
1235    
1236  //  //
# Line 779  void MeshAdapter::interpolateACross(escr Line 1238  void MeshAdapter::interpolateACross(escr
1238  //  //
1239  void MeshAdapter::setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const  void MeshAdapter::setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const
1240  {  {
1241    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());
1242    if (argDomain!=*this)     if (argDomain!=*this)
1243       throw FinleyAdapterException("Error - Illegal domain of integration kernel");        throw FinleyAdapterException("Error - Illegal domain of integration kernel");
1244    
1245    double blocktimer_start = blocktimer_time();     double blocktimer_start = blocktimer_time();
1246    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1247    escriptDataC _temp;     escriptDataC _temp;
1248    escript::Data temp;     escript::Data temp;
1249    escriptDataC _arg=arg.getDataC();     escriptDataC _arg=arg.getDataC();
1250    switch(arg.getFunctionSpace().getTypeCode()) {     switch(arg.getFunctionSpace().getTypeCode()) {
1251       case(Nodes):     case(Nodes):
1252          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1253          _temp=temp.getDataC();     _temp=temp.getDataC();
1254          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1255          break;     break;
1256       case(ReducedNodes):     case(ReducedNodes):
1257          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1258          _temp=temp.getDataC();     _temp=temp.getDataC();
1259          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1260          break;     break;
1261       case(Elements):     case(Elements):
1262          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);
1263          break;     break;
1264       case(ReducedElements):     case(ReducedElements):
1265          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_arg,&integrals[0]);
1266          break;     break;
1267       case(FaceElements):     case(FaceElements):
1268          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);
1269          break;     break;
1270       case(ReducedFaceElements):     case(ReducedFaceElements):
1271          Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->FaceElements,&_arg,&integrals[0]);
1272          break;     break;
1273       case(Points):     case(Points):
1274          throw FinleyAdapterException("Error - Integral of data on points is not supported.");     throw FinleyAdapterException("Error - Integral of data on points is not supported.");
1275          break;     break;
1276       case(ContactElementsZero):     case(ContactElementsZero):
1277          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1278          break;     break;
1279       case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1280          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1281          break;     break;
1282       case(ContactElementsOne):     case(ContactElementsOne):
1283          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1284          break;     break;
1285       case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1286          Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1287          break;     break;
1288       case(DegreesOfFreedom):     case(DegreesOfFreedom):
1289          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1290          _temp=temp.getDataC();     _temp=temp.getDataC();
1291          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1292          break;     break;
1293       case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1294          temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );
1295          _temp=temp.getDataC();     _temp=temp.getDataC();
1296          Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1297          break;     break;
1298       default:     default:
1299          stringstream temp;        stringstream temp;
1300          temp << "Error - Integrals: Finley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();        temp << "Error - Integrals: Finley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();
1301          throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1302          break;        break;
1303    }     }
1304    checkFinleyError();     checkFinleyError();
1305    blocktimer_increment("integrate()", blocktimer_start);     blocktimer_increment("integrate()", blocktimer_start);
1306  }  }
1307    
1308  //  //
# Line 851  void MeshAdapter::setToIntegrals(std::ve Line 1310  void MeshAdapter::setToIntegrals(std::ve
1310  //  //
1311  void MeshAdapter::setToGradient(escript::Data& grad,const escript::Data& arg) const  void MeshAdapter::setToGradient(escript::Data& grad,const escript::Data& arg) const
1312  {  {
1313    const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());
1314    if (argDomain!=*this)     if (argDomain!=*this)
1315      throw FinleyAdapterException("Error - Illegal domain of gradient argument");        throw FinleyAdapterException("Error - Illegal domain of gradient argument");
1316    const MeshAdapter& gradDomain=dynamic_cast<const MeshAdapter&>(grad.getFunctionSpace().getDomain());     const MeshAdapter& gradDomain=dynamic_cast<const MeshAdapter&>(grad.getFunctionSpace().getDomain());
1317    if (gradDomain!=*this)     if (gradDomain!=*this)
1318       throw FinleyAdapterException("Error - Illegal domain of gradient");        throw FinleyAdapterException("Error - Illegal domain of gradient");
1319    
1320    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1321    escriptDataC _grad=grad.getDataC();     escriptDataC _grad=grad.getDataC();
1322    escriptDataC nodeDataC;     escriptDataC nodeDataC;
1323    escript::Data temp;     escript::Data temp;
1324    if (getMPISize()>1) {     if (getMPISize()>1) {
1325        if( arg.getFunctionSpace().getTypeCode() == DegreesOfFreedom ) {        if( arg.getFunctionSpace().getTypeCode() == DegreesOfFreedom ) {
1326          temp=escript::Data( arg,  continuousFunction(asAbstractContinuousDomain()) );           temp=escript::Data( arg,  continuousFunction(asAbstractContinuousDomain()) );
1327          nodeDataC = temp.getDataC();           nodeDataC = temp.getDataC();
1328        } else if( arg.getFunctionSpace().getTypeCode() == ReducedDegreesOfFreedom ) {        } else if( arg.getFunctionSpace().getTypeCode() == ReducedDegreesOfFreedom ) {
1329          temp=escript::Data( arg,  reducedContinuousFunction(asAbstractContinuousDomain()) );           temp=escript::Data( arg,  reducedContinuousFunction(asAbstractContinuousDomain()) );
1330          nodeDataC = temp.getDataC();           nodeDataC = temp.getDataC();
1331        } else {        } else {
1332          nodeDataC = arg.getDataC();           nodeDataC = arg.getDataC();
1333        }        }
1334    } else {     } else {
1335       nodeDataC = arg.getDataC();        nodeDataC = arg.getDataC();
1336    }     }
1337    switch(grad.getFunctionSpace().getTypeCode()) {     switch(grad.getFunctionSpace().getTypeCode()) {
1338         case(Nodes):     case(Nodes):
1339            throw FinleyAdapterException("Error - Gradient at nodes is not supported.");     throw FinleyAdapterException("Error - Gradient at nodes is not supported.");
1340            break;     break;
1341         case(ReducedNodes):     case(ReducedNodes):
1342            throw FinleyAdapterException("Error - Gradient at reduced nodes is not supported.");     throw FinleyAdapterException("Error - Gradient at reduced nodes is not supported.");
1343            break;     break;
1344         case(Elements):     case(Elements):
1345            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);
1346            break;     break;
1347         case(ReducedElements):     case(ReducedElements):
1348            Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->Elements,&_grad,&nodeDataC);
1349            break;     break;
1350         case(FaceElements):     case(FaceElements):
1351            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);
1352            break;     break;
1353         case(ReducedFaceElements):     case(ReducedFaceElements):
1354            Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->FaceElements,&_grad,&nodeDataC);
1355            break;     break;
1356         case(Points):     case(Points):
1357            throw FinleyAdapterException("Error - Gradient at points is not supported.");     throw FinleyAdapterException("Error - Gradient at points is not supported.");
1358            break;     break;
1359         case(ContactElementsZero):     case(ContactElementsZero):
1360            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1361            break;     break;
1362         case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1363            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1364            break;     break;
1365         case(ContactElementsOne):     case(ContactElementsOne):
1366            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1367            break;     break;
1368         case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1369            Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);     Finley_Assemble_gradient(mesh->Nodes,mesh->ContactElements,&_grad,&nodeDataC);
1370            break;     break;
1371         case(DegreesOfFreedom):     case(DegreesOfFreedom):
1372            throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");     throw FinleyAdapterException("Error - Gradient at degrees of freedom is not supported.");
1373            break;     break;
1374         case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1375            throw FinleyAdapterException("Error - Gradient at reduced degrees of freedom is not supported.");     throw FinleyAdapterException("Error - Gradient at reduced degrees of freedom is not supported.");
1376            break;     break;
1377         default:     default:
1378            stringstream temp;        stringstream temp;
1379            temp << "Error - Gradient: Finley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();        temp << "Error - Gradient: Finley does not know anything about function space type " << arg.getFunctionSpace().getTypeCode();
1380            throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1381            break;        break;
1382    }     }
1383    checkFinleyError();     checkFinleyError();
1384  }  }
1385    
1386  //  //
# Line 929  void MeshAdapter::setToGradient(escript: Line 1388  void MeshAdapter::setToGradient(escript:
1388  //  //
1389  void MeshAdapter::setToSize(escript::Data& size) const  void MeshAdapter::setToSize(escript::Data& size) const
1390  {  {
1391    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1392    escriptDataC tmp=size.getDataC();     escriptDataC tmp=size.getDataC();
1393    switch(size.getFunctionSpace().getTypeCode()) {     switch(size.getFunctionSpace().getTypeCode()) {
1394         case(Nodes):     case(Nodes):
1395            throw FinleyAdapterException("Error - Size of nodes is not supported.");     throw FinleyAdapterException("Error - Size of nodes is not supported.");
1396            break;     break;
1397         case(ReducedNodes):     case(ReducedNodes):
1398            throw FinleyAdapterException("Error - Size of reduced nodes is not supported.");     throw FinleyAdapterException("Error - Size of reduced nodes is not supported.");
1399            break;     break;
1400         case(Elements):     case(Elements):
1401            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);     Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
1402            break;     break;
1403         case(ReducedElements):     case(ReducedElements):
1404            Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);     Finley_Assemble_getSize(mesh->Nodes,mesh->Elements,&tmp);
1405            break;     break;
1406         case(FaceElements):     case(FaceElements):
1407            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);     Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
1408            break;     break;
1409         case(ReducedFaceElements):     case(ReducedFaceElements):
1410            Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);     Finley_Assemble_getSize(mesh->Nodes,mesh->FaceElements,&tmp);
1411            break;     break;
1412         case(Points):     case(Points):
1413            throw FinleyAdapterException("Error - Size of point elements is not supported.");     throw FinleyAdapterException("Error - Size of point elements is not supported.");
1414            break;     break;
1415         case(ContactElementsZero):     case(ContactElementsZero):
1416         case(ContactElementsOne):     case(ContactElementsOne):
1417            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);     Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
1418            break;     break;
1419         case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1420         case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1421            Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);     Finley_Assemble_getSize(mesh->Nodes,mesh->ContactElements,&tmp);
1422            break;     break;
1423         case(DegreesOfFreedom):     case(DegreesOfFreedom):
1424            throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");     throw FinleyAdapterException("Error - Size of degrees of freedom is not supported.");
1425            break;     break;
1426         case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1427            throw FinleyAdapterException("Error - Size of reduced degrees of freedom is not supported.");     throw FinleyAdapterException("Error - Size of reduced degrees of freedom is not supported.");
1428            break;     break;
1429         default:     default:
1430            stringstream temp;        stringstream temp;
1431            temp << "Error - Element size: Finley does not know anything about function space type " << size.getFunctionSpace().getTypeCode();        temp << "Error - Element size: Finley does not know anything about function space type " << size.getFunctionSpace().getTypeCode();
1432            throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1433            break;        break;
1434    }     }
1435    checkFinleyError();     checkFinleyError();
1436  }  }
1437    
1438  // sets the location of nodes:  // sets the location of nodes:
1439  void MeshAdapter::setNewX(const escript::Data& new_x)  void MeshAdapter::setNewX(const escript::Data& new_x)
1440  {  {
1441    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1442    escriptDataC tmp;     escriptDataC tmp;
1443    const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(new_x.getFunctionSpace().getDomain());     const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(new_x.getFunctionSpace().getDomain());
1444    if (newDomain!=*this)     if (newDomain!=*this)
1445       throw FinleyAdapterException("Error - Illegal domain of new point locations");        throw FinleyAdapterException("Error - Illegal domain of new point locations");
1446    tmp = new_x.getDataC();     tmp = new_x.getDataC();
1447    Finley_Mesh_setCoordinates(mesh,&tmp);     Finley_Mesh_setCoordinates(mesh,&tmp);
1448    checkFinleyError();     checkFinleyError();
1449  }  }
1450    
1451  // saves a data array in openDX format:  // saves a data array in openDX format:
1452  void MeshAdapter::saveDX(const std::string& filename,const boost::python::dict& arg) const  void MeshAdapter::saveDX(const std::string& filename,const boost::python::dict& arg) const
1453  {  {
1454      int MAX_namelength=256;     unsigned int MAX_namelength=IS_THERE_A_REASON_FOR_THIS_MAGIC_NAME_LENGTH;
1455      const int num_data=boost::python::extract<int>(arg.attr("__len__")());     const int num_data=boost::python::extract<int>(arg.attr("__len__")());
1456    /* win32 refactor */     /* win32 refactor */
1457    char* *names = (num_data>0) ? TMPMEMALLOC(num_data,char*) : (char**)NULL;     char* *names = (num_data>0) ? TMPMEMALLOC(num_data,char*) : (char**)NULL;
1458    for(int i=0;i<num_data;i++)     for(int i=0;i<num_data;i++)
1459    {     {
1460      names[i] = (MAX_namelength>0) ? TMPMEMALLOC(MAX_namelength,char) : (char*)NULL;        names[i] = (MAX_namelength>0) ? TMPMEMALLOC(MAX_namelength,char) : (char*)NULL;
1461    }     }
1462    
1463    char* *c_names = (num_data>0) ? TMPMEMALLOC(num_data,char*) : (char**)NULL;     escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;
1464    escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;     escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;
1465    escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;  
1466       boost::python::list keys=arg.keys();
1467    boost::python::list keys=arg.keys();     for (int i=0;i<num_data;++i) {
1468    for (int i=0;i<num_data;++i) {        std::string n=boost::python::extract<std::string>(keys[i]);
1469           std::string n=boost::python::extract<std::string>(keys[i]);        escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1470           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);        if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
1471           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)           throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1472               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");        data[i]=d.getDataC();
1473           data[i]=d.getDataC();        ptr_data[i]= &(data[i]);
1474           ptr_data[i]=&(data[i]);        if (n.length()>MAX_namelength-1) {
1475           c_names[i]=&(names[i][0]);           strncpy(names[i],n.c_str(),MAX_namelength-1);
1476           if (n.length()>MAX_namelength-1) {           names[i][MAX_namelength-1]='\0';
1477              strncpy(c_names[i],n.c_str(),MAX_namelength-1);        } else {
1478              c_names[i][MAX_namelength-1]='\0';           strcpy(names[i],n.c_str());
1479           } else {        }
1480              strcpy(c_names[i],n.c_str());     }
1481           }     Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),num_data,names,ptr_data);
1482      }     checkFinleyError();
1483      Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);  
1484      checkFinleyError();     /* win32 refactor */
1485           TMPMEMFREE(data);
1486        /* win32 refactor */     TMPMEMFREE(ptr_data);
1487    TMPMEMFREE(c_names);     for(int i=0;i<num_data;i++)
1488    TMPMEMFREE(data);     {
1489    TMPMEMFREE(ptr_data);        TMPMEMFREE(names[i]);
1490    for(int i=0;i<num_data;i++)     }
1491    {     TMPMEMFREE(names);
     TMPMEMFREE(names[i]);  
   }  
   TMPMEMFREE(names);  
1492    
1493      return;     return;
1494  }  }
1495    
1496  // saves a data array in openVTK format:  // saves a data array in openVTK format:
1497  void MeshAdapter::saveVTK(const std::string& filename,const boost::python::dict& arg) const  void MeshAdapter::saveVTK(const std::string& filename,const boost::python::dict& arg) const
1498  {  {
1499      int MAX_namelength=256;     unsigned int MAX_namelength=IS_THERE_A_REASON_FOR_THIS_MAGIC_NAME_LENGTH;
1500      const int num_data=boost::python::extract<int>(arg.attr("__len__")());     const int num_data=boost::python::extract<int>(arg.attr("__len__")());
1501    /* win32 refactor */     /* win32 refactor */
1502    char* *names = (num_data>0) ? TMPMEMALLOC(num_data,char*) : (char**)NULL;     char* *names = (num_data>0) ? TMPMEMALLOC(num_data,char*) : (char**)NULL;
1503    for(int i=0;i<num_data;i++)     for(int i=0;i<num_data;i++)
1504    {     {
1505      names[i] = (MAX_namelength>0) ? TMPMEMALLOC(MAX_namelength,char) : (char*)NULL;        names[i] = (MAX_namelength>0) ? TMPMEMALLOC(MAX_namelength,char) : (char*)NULL;
1506    }     }
1507    
1508    char* *c_names = (num_data>0) ? TMPMEMALLOC(num_data,char*) : (char**)NULL;     escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;
1509    escriptDataC *data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC) : (escriptDataC*)NULL;     escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;
1510    escriptDataC* *ptr_data = (num_data>0) ? TMPMEMALLOC(num_data,escriptDataC*) : (escriptDataC**)NULL;  
1511       boost::python::list keys=arg.keys();
1512      boost::python::list keys=arg.keys();     for (int i=0;i<num_data;++i) {
1513      for (int i=0;i<num_data;++i) {        std::string n=boost::python::extract<std::string>(keys[i]);
1514           std::string n=boost::python::extract<std::string>(keys[i]);        escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1515           escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);        if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)
1516           if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)           throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1517               throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");        data[i]=d.getDataC();
1518           data[i]=d.getDataC();        ptr_data[i]=&(data[i]);
1519           ptr_data[i]=&(data[i]);        if (n.length()>MAX_namelength-1) {
1520           c_names[i]=&(names[i][0]);           strncpy(names[i],n.c_str(),MAX_namelength-1);
1521           if (n.length()>MAX_namelength-1) {           names[i][MAX_namelength-1]='\0';
1522              strncpy(c_names[i],n.c_str(),MAX_namelength-1);        } else {
1523              c_names[i][MAX_namelength-1]='\0';           strcpy(names[i],n.c_str());
1524           } else {        }
1525              strcpy(c_names[i],n.c_str());     }
1526           }     Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),num_data,names,ptr_data);
     }  
     Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),num_data,c_names,ptr_data);  
1527    
1528    checkFinleyError();     checkFinleyError();
1529    /* win32 refactor */     /* win32 refactor */
1530    TMPMEMFREE(c_names);     TMPMEMFREE(data);
1531    TMPMEMFREE(data);     TMPMEMFREE(ptr_data);
1532    TMPMEMFREE(ptr_data);     for(int i=0;i<num_data;i++)
1533    for(int i=0;i<num_data;i++)     {
1534    {        TMPMEMFREE(names[i]);
1535      TMPMEMFREE(names[i]);     }
1536    }     TMPMEMFREE(names);
   TMPMEMFREE(names);  
1537    
1538      return;     return;
1539  }  }
1540                                                                                                                                                                                                                                                                                                                                                
1541                                                                                                                                                                                                                                                                                                                                                
1542  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
1543  SystemMatrixAdapter MeshAdapter::newSystemMatrix(  SystemMatrixAdapter MeshAdapter::newSystemMatrix(
1544                        const int row_blocksize,                                                   const int row_blocksize,
1545                        const escript::FunctionSpace& row_functionspace,                                                   const escript::FunctionSpace& row_functionspace,
1546                        const int column_blocksize,                                                   const int column_blocksize,
1547                        const escript::FunctionSpace& column_functionspace,                                                   const escript::FunctionSpace& column_functionspace,
1548                        const int type) const                                                   const int type) const
1549  {  {
1550      int reduceRowOrder=0;     int reduceRowOrder=0;
1551      int reduceColOrder=0;     int reduceColOrder=0;
1552      // is the domain right?     // is the domain right?
1553      const MeshAdapter& row_domain=dynamic_cast<const MeshAdapter&>(row_functionspace.getDomain());     const MeshAdapter& row_domain=dynamic_cast<const MeshAdapter&>(row_functionspace.getDomain());
1554      if (row_domain!=*this)     if (row_domain!=*this)
1555            throw FinleyAdapterException("Error - domain of row function space does not match the domain of matrix generator.");        throw FinleyAdapterException("Error - domain of row function space does not match the domain of matrix generator.");
1556      const MeshAdapter& col_domain=dynamic_cast<const MeshAdapter&>(column_functionspace.getDomain());     const MeshAdapter& col_domain=dynamic_cast<const MeshAdapter&>(column_functionspace.getDomain());
1557      if (col_domain!=*this)     if (col_domain!=*this)
1558            throw FinleyAdapterException("Error - domain of columnn function space does not match the domain of matrix generator.");        throw FinleyAdapterException("Error - domain of columnn function space does not match the domain of matrix generator.");
1559      // is the function space type right     // is the function space type right
1560      if (row_functionspace.getTypeCode()==DegreesOfFreedom) {     if (row_functionspace.getTypeCode()==DegreesOfFreedom) {
1561          reduceRowOrder=0;        reduceRowOrder=0;
1562      } else if (row_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {     } else if (row_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {
1563          reduceRowOrder=1;        reduceRowOrder=1;
1564      } else {     } else {
1565          throw FinleyAdapterException("Error - illegal function space type for system matrix rows.");        throw FinleyAdapterException("Error - illegal function space type for system matrix rows.");
1566      }     }
1567      if (column_functionspace.getTypeCode()==DegreesOfFreedom) {     if (column_functionspace.getTypeCode()==DegreesOfFreedom) {
1568          reduceColOrder=0;        reduceColOrder=0;
1569      } else if (column_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {     } else if (column_functionspace.getTypeCode()==ReducedDegreesOfFreedom) {
1570          reduceColOrder=1;        reduceColOrder=1;
1571      } else {     } else {
1572          throw FinleyAdapterException("Error - illegal function space type for system matrix columns.");        throw FinleyAdapterException("Error - illegal function space type for system matrix columns.");
1573      }     }
1574      // generate matrix:     // generate matrix:
1575        
1576      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);     Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceRowOrder,reduceColOrder);
1577      checkFinleyError();     checkFinleyError();
1578      Paso_SystemMatrix* fsystemMatrix;     Paso_SystemMatrix* fsystemMatrix;
1579      int trilinos = 0;     int trilinos = 0;
1580      if (trilinos) {     if (trilinos) {
1581  #ifdef TRILINOS  #ifdef TRILINOS
1582        /* Allocation Epetra_VrbMatrix here */        /* Allocation Epetra_VrbMatrix here */
1583  #endif  #endif
1584      }     }
1585      else {     else {
1586        fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);        fsystemMatrix=Paso_SystemMatrix_alloc(type,fsystemMatrixPattern,row_blocksize,column_blocksize);
1587      }     }
1588      checkPasoError();     checkPasoError();
1589      Paso_SystemMatrixPattern_free(fsystemMatrixPattern);     Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1590      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);     return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
1591    }
1592    // creates a TransportProblemAdapter
1593    TransportProblemAdapter MeshAdapter::newTransportProblem(
1594                                                             const double theta,
1595                                                             const int blocksize,
1596                                                             const escript::FunctionSpace& functionspace,
1597                                                             const int type) const
1598    {
1599       int reduceOrder=0;
1600       // is the domain right?
1601       const MeshAdapter& domain=dynamic_cast<const MeshAdapter&>(functionspace.getDomain());
1602       if (domain!=*this)
1603          throw FinleyAdapterException("Error - domain of function space does not match the domain of transport problem generator.");
1604       // is the function space type right
1605       if (functionspace.getTypeCode()==DegreesOfFreedom) {
1606          reduceOrder=0;
1607       } else if (functionspace.getTypeCode()==ReducedDegreesOfFreedom) {
1608          reduceOrder=1;
1609       } else {
1610          throw FinleyAdapterException("Error - illegal function space type for system matrix rows.");
1611       }
1612       // generate matrix:
1613    
1614       Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceOrder,reduceOrder);
1615       checkFinleyError();
1616       Paso_FCTransportProblem* transportProblem;
1617       transportProblem=Paso_FCTransportProblem_alloc(theta,fsystemMatrixPattern,blocksize);
1618       checkPasoError();
1619       Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1620       return TransportProblemAdapter(transportProblem,theta,blocksize,functionspace);
1621  }  }
1622    
1623  //  //
# Line 1146  SystemMatrixAdapter MeshAdapter::newSyst Line 1629  SystemMatrixAdapter MeshAdapter::newSyst
1629  // returns true if data at the atom_type is considered as being cell centered:  // returns true if data at the atom_type is considered as being cell centered:
1630  bool MeshAdapter::isCellOriented(int functionSpaceCode) const  bool MeshAdapter::isCellOriented(int functionSpaceCode) const
1631  {  {
1632    switch(functionSpaceCode) {     switch(functionSpaceCode) {
1633         case(Nodes):     case(Nodes):
1634         case(DegreesOfFreedom):     case(DegreesOfFreedom):
1635         case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1636            return false;     return false;
1637            break;     break;
1638         case(Elements):     case(Elements):
1639         case(FaceElements):     case(FaceElements):
1640         case(Points):     case(Points):
1641         case(ContactElementsZero):     case(ContactElementsZero):
1642         case(ContactElementsOne):     case(ContactElementsOne):
1643         case(ReducedElements):     case(ReducedElements):
1644         case(ReducedFaceElements):     case(ReducedFaceElements):
1645         case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1646         case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1647            return true;     return true;
1648            break;     break;
1649         default:     default:
1650            stringstream temp;        stringstream temp;
1651            temp << "Error - Cell: Finley does not know anything about function space type " << functionSpaceCode;        temp << "Error - Cell: Finley does not know anything about function space type " << functionSpaceCode;
1652            throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1653            break;        break;
1654    }     }
1655    checkFinleyError();     checkFinleyError();
1656    return false;     return false;
1657  }  }
1658    
1659  bool MeshAdapter::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const  bool MeshAdapter::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const
1660  {  {
1661    switch(functionSpaceType_source) {     switch(functionSpaceType_source) {
1662       case(Nodes):     case(Nodes):
1663          switch(functionSpaceType_target) {     switch(functionSpaceType_target) {
1664             case(Nodes):     case(Nodes):
1665             case(ReducedNodes):     case(ReducedNodes):
1666             case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1667             case(DegreesOfFreedom):     case(DegreesOfFreedom):
1668             case(Elements):     case(Elements):
1669             case(ReducedElements):     case(ReducedElements):
1670             case(FaceElements):     case(FaceElements):
1671             case(ReducedFaceElements):     case(ReducedFaceElements):
1672             case(Points):     case(Points):
1673             case(ContactElementsZero):     case(ContactElementsZero):
1674             case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1675             case(ContactElementsOne):     case(ContactElementsOne):
1676             case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1677                 return true;     return true;
1678             default:     default:
1679                 stringstream temp;        stringstream temp;
1680                 temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1681                 throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1682          }     }
1683          break;     break;
1684       case(ReducedNodes):     case(ReducedNodes):
1685          switch(functionSpaceType_target) {     switch(functionSpaceType_target) {
1686             case(ReducedNodes):     case(ReducedNodes):
1687             case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1688             case(Elements):     case(Elements):
1689             case(ReducedElements):     case(ReducedElements):
1690             case(FaceElements):     case(FaceElements):
1691             case(ReducedFaceElements):     case(ReducedFaceElements):
1692             case(Points):     case(Points):
1693             case(ContactElementsZero):     case(ContactElementsZero):
1694             case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1695             case(ContactElementsOne):     case(ContactElementsOne):
1696             case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1697                 return true;     return true;
1698            case(Nodes):     case(Nodes):
1699            case(DegreesOfFreedom):     case(DegreesOfFreedom):
1700               return false;     return false;
1701             default:     default:
1702                 stringstream temp;        stringstream temp;
1703                 temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1704                 throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1705          }     }
1706          break;     break;
1707       case(Elements):     case(Elements):
1708          if (functionSpaceType_target==Elements) {     if (functionSpaceType_target==Elements) {
1709             return true;        return true;
1710          } else if (functionSpaceType_target==ReducedElements) {     } else if (functionSpaceType_target==ReducedElements) {
1711             return true;        return true;
1712          } else {     } else {
1713             return false;        return false;
1714          }     }
1715       case(ReducedElements):     case(ReducedElements):
1716          if (functionSpaceType_target==ReducedElements) {     if (functionSpaceType_target==ReducedElements) {
1717             return true;        return true;
1718          } else {     } else {
1719             return false;        return false;
1720          }     }
1721       case(FaceElements):     case(FaceElements):
1722          if (functionSpaceType_target==FaceElements) {     if (functionSpaceType_target==FaceElements) {
1723             return true;        return true;
1724          } else if (functionSpaceType_target==ReducedFaceElements) {     } else if (functionSpaceType_target==ReducedFaceElements) {
1725             return true;        return true;
1726          } else {     } else {
1727             return false;        return false;
1728          }     }
1729       case(ReducedFaceElements):     case(ReducedFaceElements):
1730          if (functionSpaceType_target==ReducedFaceElements) {     if (functionSpaceType_target==ReducedFaceElements) {
1731             return true;        return true;
1732          } else {     } else {
1733             return false;        return false;
1734          }     }
1735       case(Points):     case(Points):
1736          if (functionSpaceType_target==Points) {     if (functionSpaceType_target==Points) {
1737             return true;        return true;
1738          } else {     } else {
1739             return false;        return false;
1740          }     }
1741       case(ContactElementsZero):     case(ContactElementsZero):
1742       case(ContactElementsOne):     case(ContactElementsOne):
1743          if (functionSpaceType_target==ContactElementsZero || functionSpaceType_target==ContactElementsOne) {     if (functionSpaceType_target==ContactElementsZero || functionSpaceType_target==ContactElementsOne) {
1744             return true;        return true;
1745          } else if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {     } else if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {
1746             return true;        return true;
1747          } else {     } else {
1748             return false;        return false;
1749          }     }
1750       case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1751       case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1752          if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {     if (functionSpaceType_target==ReducedContactElementsZero || functionSpaceType_target==ReducedContactElementsOne) {
1753             return true;        return true;
1754          } else {     } else {
1755             return false;        return false;
1756          }     }
1757       case(DegreesOfFreedom):     case(DegreesOfFreedom):
1758          switch(functionSpaceType_target) {     switch(functionSpaceType_target) {
1759             case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1760             case(DegreesOfFreedom):     case(DegreesOfFreedom):
1761             case(Nodes):     case(Nodes):
1762             case(ReducedNodes):     case(ReducedNodes):
1763             case(Elements):     case(Elements):
1764             case(ReducedElements):     case(ReducedElements):
1765             case(Points):     case(Points):
1766             case(FaceElements):     case(FaceElements):
1767             case(ReducedFaceElements):     case(ReducedFaceElements):
1768             case(ContactElementsZero):     case(ContactElementsZero):
1769             case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1770             case(ContactElementsOne):     case(ContactElementsOne):
1771             case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1772                return true;     return true;
1773             default:     default:
1774               stringstream temp;        stringstream temp;
1775               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1776               throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1777          }     }
1778          break;     break;
1779       case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1780         switch(functionSpaceType_target) {     switch(functionSpaceType_target) {
1781            case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1782            case(ReducedNodes):     case(ReducedNodes):
1783            case(Elements):     case(Elements):
1784            case(ReducedElements):     case(ReducedElements):
1785            case(FaceElements):     case(FaceElements):
1786            case(ReducedFaceElements):     case(ReducedFaceElements):
1787            case(Points):     case(Points):
1788            case(ContactElementsZero):     case(ContactElementsZero):
1789            case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1790            case(ContactElementsOne):     case(ContactElementsOne):
1791            case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1792                return true;     return true;
1793            case(Nodes):     case(Nodes):
1794            case(DegreesOfFreedom):     case(DegreesOfFreedom):
1795               return false;     return false;
1796            default:     default:
1797               stringstream temp;        stringstream temp;
1798               temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_target;
1799               throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1800         }     }
1801         break;     break;
1802       default:     default:
1803          stringstream temp;        stringstream temp;
1804          temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_source;        temp << "Error - Interpolation On Domain: Finley does not know anything about function space type " << functionSpaceType_source;
1805          throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1806          break;        break;
1807    }     }
1808    checkFinleyError();     checkFinleyError();
1809    return false;     return false;
1810  }  }
1811    
1812  bool MeshAdapter::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const  bool MeshAdapter::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
1813  {  {
1814      return false;     return false;
1815  }  }
1816    
1817  bool MeshAdapter::operator==(const AbstractDomain& other) const  bool MeshAdapter::operator==(const AbstractDomain& other) const
1818  {  {
1819    const MeshAdapter* temp=dynamic_cast<const MeshAdapter*>(&other);     const MeshAdapter* temp=dynamic_cast<const MeshAdapter*>(&other);
1820    if (temp!=0) {     if (temp!=0) {
1821      return (m_finleyMesh==temp->m_finleyMesh);        return (m_finleyMesh==temp->m_finleyMesh);
1822    } else {     } else {
1823      return false;        return false;
1824    }     }
1825  }  }
1826    
1827  bool MeshAdapter::operator!=(const AbstractDomain& other) const  bool MeshAdapter::operator!=(const AbstractDomain& other) const
1828  {  {
1829    return !(operator==(other));     return !(operator==(other));
1830  }  }
1831    
1832  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int package, const bool symmetry) const  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int package, const bool symmetry) const
# Line 1355  int MeshAdapter::getSystemMatrixTypeId(c Line 1838  int MeshAdapter::getSystemMatrixTypeId(c
1838    
1839  escript::Data MeshAdapter::getX() const  escript::Data MeshAdapter::getX() const
1840  {  {
1841    return continuousFunction(asAbstractContinuousDomain()).getX();     return continuousFunction(asAbstractContinuousDomain()).getX();
1842  }  }
1843    
1844  escript::Data MeshAdapter::getNormal() const  escript::Data MeshAdapter::getNormal() const
1845  {  {
1846    return functionOnBoundary(asAbstractContinuousDomain()).getNormal();     return functionOnBoundary(asAbstractContinuousDomain()).getNormal();
1847  }  }
1848    
1849  escript::Data MeshAdapter::getSize() const  escript::Data MeshAdapter::getSize() const
1850  {  {
1851    return function(asAbstractContinuousDomain()).getSize();     return function(asAbstractContinuousDomain()).getSize();
1852  }  }
1853    
1854  int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const  int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const
1855  {  {
1856    int *out=0,i;     int *out = NULL;
1857    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1858    switch (functionSpaceType) {     switch (functionSpaceType) {
1859      case(Nodes):     case(Nodes):
1860        out=mesh->Nodes->Id;     out=mesh->Nodes->Id;
1861        break;     break;
1862      case(ReducedNodes):     case(ReducedNodes):
1863        out=mesh->Nodes->reducedNodesId;     out=mesh->Nodes->reducedNodesId;
1864        break;     break;
1865      case(Elements):     case(Elements):
1866        out=mesh->Elements->Id;     out=mesh->Elements->Id;
1867        break;     break;
1868      case(ReducedElements):     case(ReducedElements):
1869        out=mesh->Elements->Id;     out=mesh->Elements->Id;
1870        break;     break;
1871      case(FaceElements):     case(FaceElements):
1872        out=mesh->FaceElements->Id;     out=mesh->FaceElements->Id;
1873        break;     break;
1874      case(ReducedFaceElements):     case(ReducedFaceElements):
1875        out=mesh->FaceElements->Id;     out=mesh->FaceElements->Id;
1876        break;     break;
1877      case(Points):     case(Points):
1878        out=mesh->Points->Id;     out=mesh->Points->Id;
1879        break;     break;
1880      case(ContactElementsZero):     case(ContactElementsZero):
1881        out=mesh->ContactElements->Id;     out=mesh->ContactElements->Id;
1882        break;     break;
1883      case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1884        out=mesh->ContactElements->Id;     out=mesh->ContactElements->Id;
1885        break;     break;
1886      case(ContactElementsOne):     case(ContactElementsOne):
1887        out=mesh->ContactElements->Id;     out=mesh->ContactElements->Id;
1888        break;     break;
1889      case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1890        out=mesh->ContactElements->Id;     out=mesh->ContactElements->Id;
1891        break;     break;
1892      case(DegreesOfFreedom):     case(DegreesOfFreedom):
1893        out=mesh->Nodes->degreesOfFreedomId;     out=mesh->Nodes->degreesOfFreedomId;
1894        break;     break;
1895      case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1896        out=mesh->Nodes->reducedDegreesOfFreedomId;     out=mesh->Nodes->reducedDegreesOfFreedomId;
1897        break;     break;
1898      default:     default:
1899        stringstream temp;        stringstream temp;
1900        temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();        temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
1901        throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1902        break;        break;
1903    }     }
1904    return out;     return out;
1905  }  }
1906  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
1907  {  {
1908    int out=0;     int out=0;
1909    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1910    switch (functionSpaceType) {     switch (functionSpaceType) {
1911    case(Nodes):     case(Nodes):
1912      out=mesh->Nodes->Tag[sampleNo];     out=mesh->Nodes->Tag[sampleNo];
1913      break;     break;
1914    case(ReducedNodes):     case(ReducedNodes):
1915      throw FinleyAdapterException(" Error - ReducedNodes does not support tags.");     throw FinleyAdapterException(" Error - ReducedNodes does not support tags.");
1916      break;     break;
1917    case(Elements):     case(Elements):
1918      out=mesh->Elements->Tag[sampleNo];     out=mesh->Elements->Tag[sampleNo];
1919      break;     break;
1920    case(ReducedElements):     case(ReducedElements):
1921      out=mesh->Elements->Tag[sampleNo];     out=mesh->Elements->Tag[sampleNo];
1922      break;     break;
1923    case(FaceElements):     case(FaceElements):
1924      out=mesh->FaceElements->Tag[sampleNo];     out=mesh->FaceElements->Tag[sampleNo];
1925      break;     break;
1926    case(ReducedFaceElements):     case(ReducedFaceElements):
1927      out=mesh->FaceElements->Tag[sampleNo];     out=mesh->FaceElements->Tag[sampleNo];
1928      break;     break;
1929    case(Points):     case(Points):
1930      out=mesh->Points->Tag[sampleNo];     out=mesh->Points->Tag[sampleNo];
1931      break;     break;
1932    case(ContactElementsZero):     case(ContactElementsZero):
1933      out=mesh->ContactElements->Tag[sampleNo];     out=mesh->ContactElements->Tag[sampleNo];
1934      break;     break;
1935    case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1936      out=mesh->ContactElements->Tag[sampleNo];     out=mesh->ContactElements->Tag[sampleNo];
1937      break;     break;
1938    case(ContactElementsOne):     case(ContactElementsOne):
1939      out=mesh->ContactElements->Tag[sampleNo];     out=mesh->ContactElements->Tag[sampleNo];
1940      break;     break;
1941    case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
1942      out=mesh->ContactElements->Tag[sampleNo];     out=mesh->ContactElements->Tag[sampleNo];
1943      break;     break;
1944    case(DegreesOfFreedom):     case(DegreesOfFreedom):
1945      throw FinleyAdapterException(" Error - DegreesOfFreedom does not support tags.");     throw FinleyAdapterException(" Error - DegreesOfFreedom does not support tags.");
1946      break;     break;
1947    case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1948      throw FinleyAdapterException(" Error - ReducedDegreesOfFreedom does not support tags.");     throw FinleyAdapterException(" Error - ReducedDegreesOfFreedom does not support tags.");
1949      break;     break;
1950    default:     default:
1951      stringstream temp;        stringstream temp;
1952      temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();        temp << "Error - Invalid function space type: " << functionSpaceType << " for domain: " << getDescription();
1953      throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
1954      break;        break;
1955    }     }
1956    return out;     return out;
1957  }  }
1958    
1959    
1960  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
1961  {  {
1962    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1963    escriptDataC tmp=mask.getDataC();     escriptDataC tmp=mask.getDataC();
1964    switch(functionSpaceType) {     switch(functionSpaceType) {
1965         case(Nodes):     case(Nodes):
1966            Finley_NodeFile_setTags(mesh->Nodes,newTag,&tmp);     Finley_NodeFile_setTags(mesh->Nodes,newTag,&tmp);
1967            break;     break;
1968         case(ReducedNodes):     case(ReducedNodes):
1969            throw FinleyAdapterException("Error - ReducedNodes does not support tags");     throw FinleyAdapterException("Error - ReducedNodes does not support tags");
1970            break;     break;
1971         case(DegreesOfFreedom):     case(DegreesOfFreedom):
1972            throw FinleyAdapterException("Error - DegreesOfFreedom does not support tags");     throw FinleyAdapterException("Error - DegreesOfFreedom does not support tags");
1973            break;     break;
1974         case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1975            throw FinleyAdapterException("Error - ReducedDegreesOfFreedom does not support tags");     throw FinleyAdapterException("Error - ReducedDegreesOfFreedom does not support tags");
1976            break;     break;
1977         case(Elements):     case(Elements):
1978            Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);
1979            break;     break;
1980         case(ReducedElements):     case(ReducedElements):
1981            Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->Elements,newTag,&tmp);
1982            break;     break;
1983         case(FaceElements):     case(FaceElements):
1984            Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);
1985            break;     break;
1986         case(ReducedFaceElements):     case(ReducedFaceElements):
1987            Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->FaceElements,newTag,&tmp);
1988            break;     break;
1989         case(Points):     case(Points):
1990            Finley_ElementFile_setTags(mesh->Points,newTag,&tmp);     Finley_ElementFile_setTags(mesh->Points,newTag,&tmp);
1991            break;     break;
1992         case(ContactElementsZero):     case(ContactElementsZero):
1993            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1994            break;     break;
1995         case(ReducedContactElementsZero):     case(ReducedContactElementsZero):
1996            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
1997            break;     break;
1998         case(ContactElementsOne):     case(ContactElementsOne):
1999            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
2000            break;     break;
2001         case(ReducedContactElementsOne):     case(ReducedContactElementsOne):
2002            Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);     Finley_ElementFile_setTags(mesh->ContactElements,newTag,&tmp);
2003            break;     break;
2004         default:     default:
2005            stringstream temp;        stringstream temp;
2006            temp << "Error - Finley does not know anything about function space type " << functionSpaceType;        temp << "Error - Finley does not know anything about function space type " << functionSpaceType;
2007            throw FinleyAdapterException(temp.str());        throw FinleyAdapterException(temp.str());
2008    }     }
2009    checkFinleyError();     checkFinleyError();
2010    return;     return;
2011  }  }
2012    
2013  void MeshAdapter::setTagMap(const std::string& name,  int tag)  void MeshAdapter::setTagMap(const std::string& name,  int tag)
2014  {  {
2015    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2016    Finley_Mesh_addTagMap(mesh, name.c_str(),tag);     Finley_Mesh_addTagMap(mesh, name.c_str(),tag);
2017    checkPasoError();     checkPasoError();
2018    // throwStandardException("MeshAdapter::set TagMap is not implemented.");     // throwStandardException("MeshAdapter::set TagMap is not implemented.");
2019  }  }
2020    
2021  int MeshAdapter::getTag(const std::string& name) const  int MeshAdapter::getTag(const std::string& name) const
2022  {  {
2023    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2024    int tag=0;     int tag=0;
2025    tag=Finley_Mesh_getTag(mesh, name.c_str());     tag=Finley_Mesh_getTag(mesh, name.c_str());
2026    checkPasoError();     checkPasoError();
2027    // throwStandardException("MeshAdapter::getTag is not implemented.");     // throwStandardException("MeshAdapter::getTag is not implemented.");
2028    return tag;     return tag;
2029  }  }
2030    
2031  bool MeshAdapter::isValidTagName(const std::string& name) const  bool MeshAdapter::isValidTagName(const std::string& name) const
2032  {  {
2033    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2034    return Finley_Mesh_isValidTagName(mesh,name.c_str());     return Finley_Mesh_isValidTagName(mesh,name.c_str());
2035  }  }
2036    
2037  std::string MeshAdapter::showTagNames() const  std::string MeshAdapter::showTagNames() const
2038  {  {
2039    stringstream temp;     stringstream temp;
2040    Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
2041    Finley_TagMap* tag_map=mesh->TagMap;     Finley_TagMap* tag_map=mesh->TagMap;
2042    while (tag_map) {     while (tag_map) {
2043       temp << tag_map->name;        temp << tag_map->name;
2044       tag_map=tag_map->next;        tag_map=tag_map->next;
2045       if (tag_map) temp << ", ";        if (tag_map) temp << ", ";
2046    }     }
2047    return temp.str();     return temp.str();
2048  }  }
2049    
2050  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.1339  
changed lines
  Added in v.1628

  ViewVC Help
Powered by ViewVC 1.1.26