/[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

revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC revision 113 by jgs, Mon Feb 28 07:06:33 2005 UTC
# Line 44  void Finley_Mesh_saveDX(const char * fil Line 44  void Finley_Mesh_saveDX(const char * fil
44                                                                     nDim, mesh_p->Nodes->reducedNumNodes);                                                                     nDim, mesh_p->Nodes->reducedNumNodes);
45    for (i = 0; i < mesh_p->Nodes->numNodes; i++) {    for (i = 0; i < mesh_p->Nodes->numNodes; i++) {
46      if (mesh_p->Nodes->toReduced[i]>=0) {      if (mesh_p->Nodes->toReduced[i]>=0) {
47         fprintf(fileHandle_p, "%e", mesh_p->Nodes->Coordinates[INDEX2(0, i, nDim)]);         fprintf(fileHandle_p, "%g", mesh_p->Nodes->Coordinates[INDEX2(0, i, nDim)]);
48         for (j = 1; j < nDim; j++) fprintf(fileHandle_p, " %f",mesh_p->Nodes->Coordinates[INDEX2(j, i, nDim)]);         for (j = 1; j < nDim; j++) fprintf(fileHandle_p, " %g",mesh_p->Nodes->Coordinates[INDEX2(j, i, nDim)]);
49         fprintf(fileHandle_p, "\n");         fprintf(fileHandle_p, "\n");
50      }      }
51    }    }
# Line 84  void Finley_Mesh_saveDX(const char * fil Line 84  void Finley_Mesh_saveDX(const char * fil
84         default:         default:
85            Finley_ErrorCode=TYPE_ERROR;            Finley_ErrorCode=TYPE_ERROR;
86            sprintf(Finley_ErrorMsg,"Finley does not know anything about function space type %d",getFunctionSpaceType(data_p));            sprintf(Finley_ErrorMsg,"Finley does not know anything about function space type %d",getFunctionSpaceType(data_p));
87            break;            return;
88       }       }
89    }    }
90    /* if no element table is present jump over the connection table */    /* if no element table is present jump over the connection table */
# Line 131  void Finley_Mesh_saveDX(const char * fil Line 131  void Finley_Mesh_saveDX(const char * fil
131    /* data */    /* data */
132    if (!isEmpty(data_p)) {    if (!isEmpty(data_p)) {
133        int rank=getDataPointRank(data_p);        int rank=getDataPointRank(data_p);
       int* shape=getDataPointShape(data_p);  
134        int nComp=getDataPointSize(data_p);        int nComp=getDataPointSize(data_p);
135        fprintf(fileHandle_p, "object 3 class array type float rank %d ", rank);        fprintf(fileHandle_p, "object 3 class array type float rank %d ", rank);
136        if (0 < rank) {        if (0 < rank) {
137           fprintf(fileHandle_p, "shape ");           fprintf(fileHandle_p, "shape ");
138           for (i = 0; i < rank; i++) fprintf(fileHandle_p, "%d ", shape[i]);           for (i = 0; i < rank; i++) fprintf(fileHandle_p, "%d ", getDataPointShape(data_p,i));
139        }        }
140        if (isCellCentered) {        if (isCellCentered) {
141            int numPointsPerSample=elements->ReferenceElement->numQuadNodes;            int numPointsPerSample=elements->ReferenceElement->numQuadNodes;
142            if (numPointsPerSample) {            if (numPointsPerSample>0) {
143               fprintf(fileHandle_p, "items %d data follows\n", elements->numElements);               fprintf(fileHandle_p, "items %d data follows\n", elements->numElements);
144               for (i=0;i<elements->numElements;i++) {               for (i=0;i<elements->numElements;i++) {
145                   values=getSampleData(data_p,i);                   values=getSampleData(data_p,i);
146                   for (k=0;k<nComp;k++) {                   for (k=0;k<nComp;k++) {
147                       rtmp=0.;                       rtmp=0.;
148                       for (j=0;j<numPointsPerSample;j++) rtmp+=values[INDEX2(k,j,nComp)];                       for (j=0;j<numPointsPerSample;j++) rtmp+=values[INDEX2(k,j,nComp)];
149                       fprintf(fileHandle_p, " %f", rtmp/numPointsPerSample);                       fprintf(fileHandle_p, " %g", rtmp/numPointsPerSample);
150                   }                   }
151               fprintf(fileHandle_p, "\n");               fprintf(fileHandle_p, "\n");
152               }               }
# Line 169  void Finley_Mesh_saveDX(const char * fil Line 168  void Finley_Mesh_saveDX(const char * fil
168                         break;                         break;
169                   }                   }
170                }                }
171                for (k=0;k<nComp;k++) fprintf(fileHandle_p, " %f", values[k]);                for (k=0;k<nComp;k++) fprintf(fileHandle_p, " %g", values[k]);
172            fprintf(fileHandle_p, "\n");            fprintf(fileHandle_p, "\n");
173            }            }
174            fprintf(fileHandle_p, "attribute \"dep\" string \"positions\"\n");            fprintf(fileHandle_p, "attribute \"dep\" string \"positions\"\n");
# Line 189  void Finley_Mesh_saveDX(const char * fil Line 188  void Finley_Mesh_saveDX(const char * fil
188    
189  /*  /*
190   * $Log$   * $Log$
191   * Revision 1.1  2004/10/26 06:53:57  jgs   * Revision 1.2  2005/02/28 07:06:33  jgs
192   * Initial revision   * *** empty log message ***
193     *
194     * Revision 1.1.1.1.2.3  2005/02/17 23:43:06  cochrane
195     * Fixed error throwing bug.  Default case of switch statement should have ended
196     * with return instead of break, hence errors weren't being thrown (but they now
197     * should be).
198     *
199     * Revision 1.1.1.1.2.2  2005/02/17 05:53:26  gross
200     * some bug in saveDX fixed: in fact the bug was in
201     * DataC/getDataPointShape
202     *
203     * Revision 1.1.1.1.2.1  2005/02/17 03:23:01  gross
204     * some performance improvements in MVM
205     *
206     * Revision 1.1.1.1  2004/10/26 06:53:57  jgs
207     * initial import of project esys2
208   *   *
209   * Revision 1.1  2004/07/27 08:27:11  gross   * Revision 1.1  2004/07/27 08:27:11  gross
210   * Finley: saveDX added: now it is possible to write data on boundary and contact elements   * Finley: saveDX added: now it is possible to write data on boundary and contact elements

Legend:
Removed from v.82  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.26