/[escript]/branches/trilinos_from_5897/dudley/src/Mesh_print.cpp
ViewVC logotype

Diff of /branches/trilinos_from_5897/dudley/src/Mesh_print.cpp

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

revision 6008 by caltinay, Fri Feb 5 03:37:49 2016 UTC revision 6009 by caltinay, Wed Mar 2 04:13:26 2016 UTC
# Line 14  Line 14 
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
 /************************************************************************************/  
   
 /*   Dudley: prints Mesh */  
   
 /************************************************************************************/  
   
 #define ESNEEDPYTHON  
 #include "esysUtils/first.h"  
   
17  #include "Mesh.h"  #include "Mesh.h"
18    
19  /************************************************************************************/  namespace dudley {
20    
21  /*  prints the mesh to the standard output: */  /*  prints the mesh to the standard output: */
22    void Dudley_Mesh_print(Dudley_Mesh* in)
 void Dudley_Mesh_print(Dudley_Mesh * in)  
23  {  {
24      dim_t NN, i, j, numDim, NN2;      dim_t NN, i, j, numDim, NN2;
25    
# Line 38  void Dudley_Mesh_print(Dudley_Mesh * in) Line 28  void Dudley_Mesh_print(Dudley_Mesh * in)
28      printf("Mesh name: %s\n", in->Name);      printf("Mesh name: %s\n", in->Name);
29    
30      /*  write nodes: */      /*  write nodes: */
   
31      if (in->Nodes != NULL)      if (in->Nodes != NULL)
32      {      {
33      numDim = in->Nodes->numDim;          numDim = in->Nodes->numDim;
34      printf("=== %1dD-Nodes:\nnumber of nodes=%d\n", numDim, in->Nodes->numNodes);          printf("=== %1dD-Nodes:\nnumber of nodes=%d\n", numDim, in->Nodes->numNodes);
35      printf("Id,Tag,globalDegreesOfFreedom,degreesOfFreedom,reducedDegreesOfFeedom,node,reducedNode,Coordinates\n");          printf("Id,Tag,globalDegreesOfFreedom,degreesOfFreedom,reducedDegreesOfFeedom,node,reducedNode,Coordinates\n");
36      for (i = 0; i < in->Nodes->numNodes; i++)          for (i = 0; i < in->Nodes->numNodes; i++)
37      {          {
38          printf("%d,%d,%d,%d,%d,%d,%d ",              printf("%d,%d,%d,%d,%d,%d,%d ",
39             in->Nodes->Id[i], in->Nodes->Tag[i], in->Nodes->globalDegreesOfFreedom[i],                     in->Nodes->Id[i], in->Nodes->Tag[i], in->Nodes->globalDegreesOfFreedom[i],
40             in->Nodes->degreesOfFreedomMapping->target[i],                     in->Nodes->degreesOfFreedomMapping->target[i],
41             in->Nodes->reducedDegreesOfFreedomMapping->target[i],                     in->Nodes->reducedDegreesOfFreedomMapping->target[i],
42             in->Nodes->nodesMapping->target[i], in->Nodes->reducedNodesMapping->target[i]);                     in->Nodes->nodesMapping->target[i], in->Nodes->reducedNodesMapping->target[i]);
43          for (j = 0; j < numDim; j++)              for (j = 0; j < numDim; j++)
44          printf(" %20.15e", in->Nodes->Coordinates[INDEX2(j, i, numDim)]);                  printf(" %20.15e", in->Nodes->Coordinates[INDEX2(j, i, numDim)]);
45          printf("\n");              printf("\n");
46      }          }
47      }      }
48    
49      /*  write elements: */      /*  write elements: */
50    
51      if (in->Elements != NULL)      if (in->Elements != NULL)
52      {      {
53      printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",          printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",
54             in->Elements->ename, in->Elements->numElements, in->Elements->minColor, in->Elements->maxColor);                 in->Elements->ename, in->Elements->numElements, in->Elements->minColor, in->Elements->maxColor);
55      NN = in->Elements->numNodes;          NN = in->Elements->numNodes;
56      NN2 = in->Elements->numNodes;          NN2 = in->Elements->numNodes;
57      if (in->Elements->numElements > 0)          if (in->Elements->numElements > 0)
58      {          {
59          printf("Id,Tag,Owner,Color,Nodes\n");              printf("Id,Tag,Owner,Color,Nodes\n");
60          for (i = 0; i < in->Elements->numElements; i++)              for (i = 0; i < in->Elements->numElements; i++)
61          {              {
62          printf("%d,%d,%d,%d,", in->Elements->Id[i], in->Elements->Tag[i], in->Elements->Owner[i],                  printf("%d,%d,%d,%d,", in->Elements->Id[i], in->Elements->Tag[i], in->Elements->Owner[i],
63                 in->Elements->Color[i]);                         in->Elements->Color[i]);
64          for (j = 0; j < NN; j++)                  for (j = 0; j < NN; j++)
65              printf(" %d", in->Nodes->Id[in->Elements->Nodes[INDEX2(j, i, NN2)]]);                      printf(" %d", in->Nodes->Id[in->Elements->Nodes[INDEX2(j, i, NN2)]]);
66          printf("\n");                  printf("\n");
67          }              }
68      }          }
69      }      }
70    
71      /*  write face elements: */      /*  write face elements: */
72    
73      if (in->FaceElements != NULL)      if (in->FaceElements != NULL)
74      {      {
75      printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",          printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",
76             in->FaceElements->ename, in->FaceElements->numElements, in->FaceElements->minColor,                 in->FaceElements->ename, in->FaceElements->numElements, in->FaceElements->minColor,
77             in->FaceElements->maxColor);                 in->FaceElements->maxColor);
78      NN = in->FaceElements->numNodes;          NN = in->FaceElements->numNodes;
79      NN2 = in->FaceElements->numNodes;          NN2 = in->FaceElements->numNodes;
80      if (in->FaceElements->numElements > 0)          if (in->FaceElements->numElements > 0)
81      {          {
82          printf("Id,Tag,Owner,Color,Nodes\n");              printf("Id,Tag,Owner,Color,Nodes\n");
83          for (i = 0; i < in->FaceElements->numElements; i++)              for (i = 0; i < in->FaceElements->numElements; i++)
84          {              {
85          printf("%d,%d,%d,%d,", in->FaceElements->Id[i], in->FaceElements->Tag[i], in->Elements->Owner[i],                  printf("%d,%d,%d,%d,", in->FaceElements->Id[i], in->FaceElements->Tag[i], in->Elements->Owner[i],
86                 in->FaceElements->Color[i]);                         in->FaceElements->Color[i]);
87          for (j = 0; j < NN; j++)                  for (j = 0; j < NN; j++)
88              printf(" %d", in->Nodes->Id[in->FaceElements->Nodes[INDEX2(j, i, NN2)]]);                      printf(" %d", in->Nodes->Id[in->FaceElements->Nodes[INDEX2(j, i, NN2)]]);
89          printf("\n");                  printf("\n");
90          }              }
91      }          }
92      }      }
93    
94      /*  write points: */      /*  write points: */
95      if (in->Points != NULL)      if (in->Points != NULL)
96      {      {
97      printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",          printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",
98             in->Points->ename, in->Points->numElements, in->Points->minColor, in->Points->maxColor);                 in->Points->ename, in->Points->numElements, in->Points->minColor, in->Points->maxColor);
99      NN = in->Points->numNodes;          NN = in->Points->numNodes;
100      NN2 = in->Points->numNodes;          NN2 = in->Points->numNodes;
101      if (in->Points->numElements > 0)          if (in->Points->numElements > 0)
102      {          {
103          printf("Id,Tag,Owner,Color,Nodes\n");              printf("Id,Tag,Owner,Color,Nodes\n");
104          for (i = 0; i < in->Points->numElements; i++)              for (i = 0; i < in->Points->numElements; i++)
105          {              {
106          printf("%d,%d,%d,%d,", in->Points->Id[i], in->Points->Tag[i], in->Elements->Owner[i],                  printf("%d,%d,%d,%d,", in->Points->Id[i], in->Points->Tag[i], in->Elements->Owner[i],
107                 in->Points->Color[i]);                         in->Points->Color[i]);
108          for (j = 0; j < NN; j++)                  for (j = 0; j < NN; j++)
109              printf(" %d", in->Nodes->Id[in->Points->Nodes[INDEX2(j, i, NN2)]]);                      printf(" %d", in->Nodes->Id[in->Points->Nodes[INDEX2(j, i, NN2)]]);
110          printf("\n");                  printf("\n");
111          }              }
112      }          }
113      }      }
114  }  }
115    
116    } // namespace dudley
117    

Legend:
Removed from v.6008  
changed lines
  Added in v.6009

  ViewVC Help
Powered by ViewVC 1.1.26