/[escript]/trunk/finley/src/Mesh_write.cpp
ViewVC logotype

Diff of /trunk/finley/src/Mesh_write.cpp

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

revision 1311 by gross, Mon Mar 19 07:29:31 2007 UTC revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
 /*  
  ************************************************************  
  *          Copyright 2006 by ACcESS MNRF                   *  
  *                                                          *  
  *              http://www.access.edu.au                    *  
  *       Primary Business: Queensland, Australia            *  
  *  Licensed under the Open Software License version 3.0    *  
  *     http://www.opensource.org/licenses/osl-3.0.php       *  
  *                                                          *  
  ************************************************************  
 */  
1    
2  /**************************************************************/  /* $Id$ */
3    
4  /*   Finley: write Mesh */  /*******************************************************
5     *
6     *           Copyright 2003-2007 by ACceSS MNRF
7     *       Copyright 2007 by University of Queensland
8     *
9     *                http://esscc.uq.edu.au
10     *        Primary Business: Queensland, Australia
11     *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  /**************************************************************/  /**************************************************************/
17    
18  /*   Author: gross@access.edu.au */  /*   Finley: write Mesh */
 /*   Version: $Id$ */  
19    
20  /**************************************************************/  /**************************************************************/
21    
# Line 33  void Finley_Mesh_write(Finley_Mesh *in,c Line 31  void Finley_Mesh_write(Finley_Mesh *in,c
31    int NN,i,j,numDim;    int NN,i,j,numDim;
32    Finley_TagMap* tag_map=in->TagMap;    Finley_TagMap* tag_map=in->TagMap;
33    
34      if (in->MPIInfo->size >1 ) {
35        Finley_setError(IO_ERROR,"Mesh_write: only single processor runs are supported.");
36        return;
37    
38      }
39    /* open file */    /* open file */
40    f=fopen(fname,"w");    f=fopen(fname,"w");
41    if (f==NULL) {    if (f==NULL) {
42      sprintf(error_msg,"__FILE__: Opening file %s for writing failed.",fname);      sprintf(error_msg,"Mesh_write: Opening file %s for writing failed.",fname);
43      Finley_setError(IO_ERROR,error_msg);      Finley_setError(IO_ERROR,error_msg);
44      return;      return;
45    }    }
# Line 51  void Finley_Mesh_write(Finley_Mesh *in,c Line 54  void Finley_Mesh_write(Finley_Mesh *in,c
54      numDim=Finley_Mesh_getDim(in);      numDim=Finley_Mesh_getDim(in);
55      fprintf(f,"%1dD-Nodes %d\n", numDim, in->Nodes->numNodes);      fprintf(f,"%1dD-Nodes %d\n", numDim, in->Nodes->numNodes);
56      for (i=0;i<in->Nodes->numNodes;i++) {      for (i=0;i<in->Nodes->numNodes;i++) {
57        fprintf(f,"%d %d %d",in->Nodes->Id[i],in->Nodes->degreeOfFreedom[i],in->Nodes->Tag[i]);        fprintf(f,"%d %d %d",in->Nodes->Id[i],in->Nodes->globalDegreesOfFreedom[i],in->Nodes->Tag[i]);
58        for (j=0;j<numDim;j++) fprintf(f," %20.15e",in->Nodes->Coordinates[INDEX2(j,i,numDim)]);        for (j=0;j<numDim;j++) fprintf(f," %20.15e",in->Nodes->Coordinates[INDEX2(j,i,numDim)]);
59        fprintf(f,"\n");        fprintf(f,"\n");
60      }      }
# Line 63  void Finley_Mesh_write(Finley_Mesh *in,c Line 66  void Finley_Mesh_write(Finley_Mesh *in,c
66    
67    if (in->Elements!=NULL) {    if (in->Elements!=NULL) {
68      fprintf(f, "%s %d\n",in->Elements->ReferenceElement->Type->Name,in->Elements->numElements);      fprintf(f, "%s %d\n",in->Elements->ReferenceElement->Type->Name,in->Elements->numElements);
69      NN=in->Elements->ReferenceElement->Type->numNodes;      NN=in->Elements->numNodes;
70      for (i=0;i<in->Elements->numElements;i++) {      for (i=0;i<in->Elements->numElements;i++) {
71        fprintf(f,"%d %d",in->Elements->Id[i],in->Elements->Tag[i]);        fprintf(f,"%d %d",in->Elements->Id[i],in->Elements->Tag[i]);
72        for (j=0;j<NN;j++) fprintf(f," %d",in->Nodes->Id[in->Elements->Nodes[INDEX2(j,i,NN)]]);        for (j=0;j<NN;j++) fprintf(f," %d",in->Nodes->Id[in->Elements->Nodes[INDEX2(j,i,NN)]]);
# Line 76  void Finley_Mesh_write(Finley_Mesh *in,c Line 79  void Finley_Mesh_write(Finley_Mesh *in,c
79    /*  write face elements: */    /*  write face elements: */
80    if (in->FaceElements!=NULL) {    if (in->FaceElements!=NULL) {
81      fprintf(f, "%s %d\n", in->FaceElements->ReferenceElement->Type->Name,in->FaceElements->numElements);      fprintf(f, "%s %d\n", in->FaceElements->ReferenceElement->Type->Name,in->FaceElements->numElements);
82      NN=in->FaceElements->ReferenceElement->Type->numNodes;      NN=in->FaceElements->numNodes;
83      for (i=0;i<in->FaceElements->numElements;i++) {      for (i=0;i<in->FaceElements->numElements;i++) {
84        fprintf(f,"%d %d",in->FaceElements->Id[i],in->FaceElements->Tag[i]);        fprintf(f,"%d %d",in->FaceElements->Id[i],in->FaceElements->Tag[i]);
85        for (j=0;j<NN;j++) fprintf(f," %d",in->Nodes->Id[in->FaceElements->Nodes[INDEX2(j,i,NN)]]);        for (j=0;j<NN;j++) fprintf(f," %d",in->Nodes->Id[in->FaceElements->Nodes[INDEX2(j,i,NN)]]);
# Line 89  void Finley_Mesh_write(Finley_Mesh *in,c Line 92  void Finley_Mesh_write(Finley_Mesh *in,c
92    /*  write Contact elements : */    /*  write Contact elements : */
93    if (in->ContactElements!=NULL) {    if (in->ContactElements!=NULL) {
94      fprintf(f, "%s %d\n",in->ContactElements->ReferenceElement->Type->Name,in->ContactElements->numElements);      fprintf(f, "%s %d\n",in->ContactElements->ReferenceElement->Type->Name,in->ContactElements->numElements);
95      NN=in->ContactElements->ReferenceElement->Type->numNodes;      NN=in->ContactElements->numNodes;
96      for (i=0;i<in->ContactElements->numElements;i++) {      for (i=0;i<in->ContactElements->numElements;i++) {
97        fprintf(f,"%d %d",in->ContactElements->Id[i],in->ContactElements->Tag[i]);        fprintf(f,"%d %d",in->ContactElements->Id[i],in->ContactElements->Tag[i]);
98        for (j=0;j<NN;j++) fprintf(f," %d",in->Nodes->Id[in->ContactElements->Nodes[INDEX2(j,i,NN)]]);        for (j=0;j<NN;j++) fprintf(f," %d",in->Nodes->Id[in->ContactElements->Nodes[INDEX2(j,i,NN)]]);

Legend:
Removed from v.1311  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26