/[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 6078 by caltinay, Wed Mar 2 04:13:26 2016 UTC revision 6079 by caltinay, Mon Mar 21 12:22:38 2016 UTC
# Line 18  Line 18 
18    
19  namespace dudley {  namespace dudley {
20    
21  /*  prints the mesh to the standard output: */  /// prints the mesh details to standard output
22  void Dudley_Mesh_print(Dudley_Mesh* in)  void Mesh::print()
23  {  {
24      dim_t NN, i, j, numDim, NN2;      // write header
25        std::cout << "Mesh name: " << m_name << std::endl;
26    
27      /* write header */      // write nodes
28        if (Nodes) {
29      printf("Mesh name: %s\n", in->Name);          const index_t* dofs = Nodes->borrowTargetDegreesOfFreedom();
30            const index_t* nodes = Nodes->borrowTargetNodes();
31      /*  write nodes: */          const int numDim = Nodes->numDim;
32      if (in->Nodes != NULL)          printf("=== %1dD-Nodes:\nnumber of nodes=%d\n", numDim, Nodes->getNumNodes());
33      {          std::cout << "Id,Tag,globalDegreesOfFreedom,degreesOfFreedom,reducedDegreesOfFeedom,node,reducedNode,Coordinates\n";
34          numDim = in->Nodes->numDim;          for (index_t i = 0; i < Nodes->getNumNodes(); i++) {
         printf("=== %1dD-Nodes:\nnumber of nodes=%d\n", numDim, in->Nodes->numNodes);  
         printf("Id,Tag,globalDegreesOfFreedom,degreesOfFreedom,reducedDegreesOfFeedom,node,reducedNode,Coordinates\n");  
         for (i = 0; i < in->Nodes->numNodes; i++)  
         {  
35              printf("%d,%d,%d,%d,%d,%d,%d ",              printf("%d,%d,%d,%d,%d,%d,%d ",
36                     in->Nodes->Id[i], in->Nodes->Tag[i], in->Nodes->globalDegreesOfFreedom[i],                     Nodes->Id[i], Nodes->Tag[i], Nodes->globalDegreesOfFreedom[i],
37                     in->Nodes->degreesOfFreedomMapping->target[i],                     dofs[i], dofs[i], nodes[i], nodes[i]);
38                     in->Nodes->reducedDegreesOfFreedomMapping->target[i],              for (int j = 0; j < numDim; j++)
39                     in->Nodes->nodesMapping->target[i], in->Nodes->reducedNodesMapping->target[i]);                  printf(" %20.15e", Nodes->Coordinates[INDEX2(j, i, numDim)]);
40              for (j = 0; j < numDim; j++)              std::cout << std::endl;
                 printf(" %20.15e", in->Nodes->Coordinates[INDEX2(j, i, numDim)]);  
             printf("\n");  
41          }          }
42      }      }
43    
44      /*  write elements: */      // write elements
45        if (Elements) {
46      if (in->Elements != NULL)          std::cout << "=== "
47      {                   << Elements->ename << ":\nnumber of elements="
48          printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",                   << Elements->numElements << "\ncolor range=["
49                 in->Elements->ename, in->Elements->numElements, in->Elements->minColor, in->Elements->maxColor);                   << Elements->minColor << "," << Elements->maxColor << "]\n";
50          NN = in->Elements->numNodes;  
51          NN2 = in->Elements->numNodes;          if (Elements->numElements > 0) {
52          if (in->Elements->numElements > 0)              const int NN = Elements->numNodes;
53          {              std::cout << "Id,Tag,Owner,Color,Nodes" << std::endl;
54              printf("Id,Tag,Owner,Color,Nodes\n");              for (index_t i = 0; i < Elements->numElements; i++) {
55              for (i = 0; i < in->Elements->numElements; i++)                  std::cout << Elements->Id[i] << "," << Elements->Tag[i] << ","
56              {                      << Elements->Owner[i] << "," << Elements->Color[i] << ",";
57                  printf("%d,%d,%d,%d,", in->Elements->Id[i], in->Elements->Tag[i], in->Elements->Owner[i],                  for (int j = 0; j < NN; j++)
58                         in->Elements->Color[i]);                      std::cout << " " << Nodes->Id[Elements->Nodes[INDEX2(j, i, NN)]];
59                  for (j = 0; j < NN; j++)                  std::cout << std::endl;
                     printf(" %d", in->Nodes->Id[in->Elements->Nodes[INDEX2(j, i, NN2)]]);  
                 printf("\n");  
60              }              }
61          }          }
62      }      }
63    
64      /*  write face elements: */      // write face elements
65        if (FaceElements) {
66      if (in->FaceElements != NULL)          std::cout << "=== "
67      {                   << FaceElements->ename << ":\nnumber of elements="
68          printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",                   << FaceElements->numElements << "\ncolor range=["
69                 in->FaceElements->ename, in->FaceElements->numElements, in->FaceElements->minColor,                   << FaceElements->minColor << "," << FaceElements->maxColor
70                 in->FaceElements->maxColor);                   << "]\n";
71          NN = in->FaceElements->numNodes;  
72          NN2 = in->FaceElements->numNodes;          if (FaceElements->numElements > 0) {
73          if (in->FaceElements->numElements > 0)              const int NN = FaceElements->numNodes;
74          {              std::cout << "Id,Tag,Owner,Color,Nodes" << std::endl;
75              printf("Id,Tag,Owner,Color,Nodes\n");              for (index_t i = 0; i < FaceElements->numElements; i++) {
76              for (i = 0; i < in->FaceElements->numElements; i++)                  std::cout << FaceElements->Id[i] << "," << FaceElements->Tag[i]
77              {                      << "," << FaceElements->Owner[i] << ","
78                  printf("%d,%d,%d,%d,", in->FaceElements->Id[i], in->FaceElements->Tag[i], in->Elements->Owner[i],                      << FaceElements->Color[i] << ",";
79                         in->FaceElements->Color[i]);                  for (int j=0; j<NN; j++)
80                  for (j = 0; j < NN; j++)                      std::cout << " " << Nodes->Id[FaceElements->Nodes[INDEX2(j,i,NN)]];
81                      printf(" %d", in->Nodes->Id[in->FaceElements->Nodes[INDEX2(j, i, NN2)]]);                  std::cout << std::endl;
                 printf("\n");  
82              }              }
83          }          }
84      }      }
85    
86      /*  write points: */      // write points
87      if (in->Points != NULL)      if (Points) {
88      {          std::cout << "=== "
89          printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",                   << Points->ename << ":\nnumber of elements="
90                 in->Points->ename, in->Points->numElements, in->Points->minColor, in->Points->maxColor);                   << Points->numElements << "\ncolor range=["
91          NN = in->Points->numNodes;                   << Points->minColor << "," << Points->maxColor << "]\n";
92          NN2 = in->Points->numNodes;  
93          if (in->Points->numElements > 0)          if (Points->numElements > 0) {
94          {              const int NN = Points->numNodes;
95              printf("Id,Tag,Owner,Color,Nodes\n");              std::cout << "Id,Tag,Owner,Color,Nodes" << std::endl;
96              for (i = 0; i < in->Points->numElements; i++)              for (index_t i=0; i<Points->numElements; i++) {
97              {                  std::cout << Points->Id[i] << "," << Points->Tag[i] << ","
98                  printf("%d,%d,%d,%d,", in->Points->Id[i], in->Points->Tag[i], in->Elements->Owner[i],                      << Points->Owner[i] << "," << Points->Color[i] << ",";
99                         in->Points->Color[i]);                  for (int j=0; j<NN; j++)
100                  for (j = 0; j < NN; j++)                      std::cout << " " << Nodes->Id[Points->Nodes[INDEX2(j,i,NN)]];
101                      printf(" %d", in->Nodes->Id[in->Points->Nodes[INDEX2(j, i, NN2)]]);                  std::cout << std::endl;
                 printf("\n");  
102              }              }
103          }          }
104      }      }

Legend:
Removed from v.6078  
changed lines
  Added in v.6079

  ViewVC Help
Powered by ViewVC 1.1.26