/[escript]/trunk/dudley/src/Mesh_saveDX.c
ViewVC logotype

Diff of /trunk/dudley/src/Mesh_saveDX.c

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

temp/finley/src/Mesh_saveDX.c revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC trunk/finley/src/Mesh_saveDX.c revision 2748 by gross, Tue Nov 17 07:32:59 2009 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2009 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 38  void Finley_Mesh_saveDX(const char * fil Line 37  void Finley_Mesh_saveDX(const char * fil
37    FILE * fileHandle_p = NULL;    FILE * fileHandle_p = NULL;
38    int i,j,k,i_data, elementtype, numPoints = 0, nDim, *resortIndex=NULL, p,    int i,j,k,i_data, elementtype, numPoints = 0, nDim, *resortIndex=NULL, p,
39        numDXNodesPerElement=0, numCells, NN, object_count, rank, nComp, numPointsPerSample;        numDXNodesPerElement=0, numCells, NN, object_count, rank, nComp, numPointsPerSample;
40    double* values,rtmp;    __const double* values;
41      double rtmp;
42    bool_t *isCellCentered=NULL;    bool_t *isCellCentered=NULL;
43    Finley_ElementFile* elements=NULL;    Finley_ElementFile* elements=NULL;
44    ElementTypeId TypeId;    ElementTypeId TypeId;
# Line 170  void Finley_Mesh_saveDX(const char * fil Line 170  void Finley_Mesh_saveDX(const char * fil
170    }    }
171    
172    /* map finley element type to DX element type */    /* map finley element type to DX element type */
173    TypeId = elements->ReferenceElement->Type->TypeId;    TypeId = elements->referenceElementSet->referenceElement->Type->TypeId;
174    numDXNodesPerElement=0;    numDXNodesPerElement=0;
175    numCells = elements->numElements;    numCells = elements->numElements;
176    if (TypeId==Line2 || TypeId==Line3 || TypeId==Line4 ) {    if (TypeId==Line2 || TypeId==Line3 || TypeId==Line4 || TypeId==Line3Macro ) {
177       numDXNodesPerElement=2;       numDXNodesPerElement=2;
178       resortIndex=resort[0];       resortIndex=resort[0];
179       strcpy(elemTypeStr, "lines");       strcpy(elemTypeStr, "lines");
# Line 181  void Finley_Mesh_saveDX(const char * fil Line 181  void Finley_Mesh_saveDX(const char * fil
181       numDXNodesPerElement = 3;       numDXNodesPerElement = 3;
182       resortIndex=resort[1];       resortIndex=resort[1];
183       strcpy(elemTypeStr, "triangles");       strcpy(elemTypeStr, "triangles");
184     } else if (TypeId==Rec4 || TypeId==Rec8 || TypeId==Rec9 || TypeId==Rec12 || TypeId==Rec16 ) {     } else if (TypeId==Rec4 || TypeId==Rec8 || TypeId==Rec9 || TypeId==Rec12 || TypeId==Rec16 || TypeId==Rec9Macro ) {
185       numDXNodesPerElement = 4;       numDXNodesPerElement = 4;
186       resortIndex=resort[3];       resortIndex=resort[3];
187       strcpy(elemTypeStr, "quads");       strcpy(elemTypeStr, "quads");
188     } else if (TypeId==Tet4 || TypeId==Tet10 || TypeId==Tet16 ) {     } else if (TypeId==Tet4 || TypeId==Tet10 || TypeId==Tet16 || TypeId==Tet10Macro ) {
189       numDXNodesPerElement = 4;       numDXNodesPerElement = 4;
190       resortIndex=resort[2];       resortIndex=resort[2];
191       strcpy(elemTypeStr, "tetrahedra");       strcpy(elemTypeStr, "tetrahedra");
# Line 194  void Finley_Mesh_saveDX(const char * fil Line 194  void Finley_Mesh_saveDX(const char * fil
194       resortIndex=resort[4];       resortIndex=resort[4];
195       strcpy(elemTypeStr, "cubes");       strcpy(elemTypeStr, "cubes");
196     } else {     } else {
197       sprintf(error_msg,"saveDX: Element type %s is not supported by DX",elements->ReferenceElement->Type->Name);       sprintf(error_msg,"saveDX: Element type %s is not supported by DX",elements->referenceElementSet->referenceElement->Type->Name);
198       Finley_setError(VALUE_ERROR,error_msg);       Finley_setError(VALUE_ERROR,error_msg);
199       MEMFREE(isCellCentered);       MEMFREE(isCellCentered);
200       fclose(fileHandle_p);       fclose(fileHandle_p);
# Line 233  void Finley_Mesh_saveDX(const char * fil Line 233  void Finley_Mesh_saveDX(const char * fil
233           }           }
234           if (isCellCentered[i_data]) {           if (isCellCentered[i_data]) {
235               if (Finley_Assemble_reducedIntegrationOrder(data_pp[i_data])) {               if (Finley_Assemble_reducedIntegrationOrder(data_pp[i_data])) {
236                  numPointsPerSample=elements->ReferenceElementReducedOrder->numQuadNodes;                  numPointsPerSample=elements->referenceElementSet->referenceElementReducedQuadrature->Parametrization->numQuadNodes;
237               } else {               } else {
238                  numPointsPerSample=elements->ReferenceElement->numQuadNodes;                  numPointsPerSample=elements->referenceElementSet->referenceElement->Parametrization->numQuadNodes;
239               }               }
240               if (numPointsPerSample>0) {               if (numPointsPerSample>0) {
241                    void* buffer=allocSampleBuffer(data_pp[i_data]);
242                  fprintf(fileHandle_p, "items %d data follows\n", numCells);                  fprintf(fileHandle_p, "items %d data follows\n", numCells);
243                  for (i=0;i<elements->numElements;i++) {                  for (i=0;i<elements->numElements;i++) {
244                      values=getSampleData(data_pp[i_data],i);                      values=getSampleDataRO(data_pp[i_data],i,buffer);
245                      for (k=0;k<nComp;k++) {                      for (k=0;k<nComp;k++) {
246                          if ( isExpanded(data_pp[i_data]) ) {                          if ( isExpanded(data_pp[i_data]) ) {
247                              rtmp=0.;                              rtmp=0.;
# Line 252  void Finley_Mesh_saveDX(const char * fil Line 253  void Finley_Mesh_saveDX(const char * fil
253                      }                      }
254                  fprintf(fileHandle_p, "\n");                  fprintf(fileHandle_p, "\n");
255                  }                  }
256            freeSampleBuffer(buffer);
257                  fprintf(fileHandle_p, "attribute \"dep\" string \"connections\"\n");                  fprintf(fileHandle_p, "attribute \"dep\" string \"connections\"\n");
258              }              }
259           } else {           } else {
260             void* buffer=allocSampleBuffer(data_pp[i_data]);
261               fprintf(fileHandle_p, "items %d data follows\n", numPoints);               fprintf(fileHandle_p, "items %d data follows\n", numPoints);
262               for (i=0;i<numPoints;i++) {               for (i=0;i<numPoints;i++) {
263                     values=getSampleData(data_pp[i_data],i);                     values=getSampleDataRO(data_pp[i_data],i,buffer);
264                     for (k=0;k<nComp;k++) fprintf(fileHandle_p, " %g", values[k]);                     for (k=0;k<nComp;k++) fprintf(fileHandle_p, " %g", values[k]);
265                 fprintf(fileHandle_p, "\n");                 fprintf(fileHandle_p, "\n");
266               }               }
267             freeSampleBuffer(buffer);
268               fprintf(fileHandle_p, "attribute \"dep\" string \"positions\"\n");               fprintf(fileHandle_p, "attribute \"dep\" string \"positions\"\n");
269           }           }
270       }       }

Legend:
Removed from v.1387  
changed lines
  Added in v.2748

  ViewVC Help
Powered by ViewVC 1.1.26