~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to dudley/src/Mesh_print.c

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*******************************************************
 
3
*
 
4
* Copyright (c) 2003-2010 by University of Queensland
 
5
* Earth Systems Science Computational Center (ESSCC)
 
6
* http://www.uq.edu.au/esscc
 
7
*
 
8
* Primary Business: Queensland, Australia
 
9
* Licensed under the Open Software License version 3.0
 
10
* http://www.opensource.org/licenses/osl-3.0.php
 
11
*
 
12
*******************************************************/
 
13
 
 
14
/**************************************************************/
 
15
 
 
16
/*   Dudley: prints Mesh */
 
17
 
 
18
/**************************************************************/
 
19
 
 
20
#include "Mesh.h"
 
21
 
 
22
/**************************************************************/
 
23
 
 
24
/*  prints the mesh to the standarts output: */
 
25
 
 
26
void Dudley_Mesh_print(Dudley_Mesh * in)
 
27
{
 
28
    dim_t NN, i, j, numDim, NN2;
 
29
 
 
30
    /* write header */
 
31
 
 
32
    printf("Mesh name: %s\n", in->Name);
 
33
 
 
34
    /*  write nodes: */
 
35
 
 
36
    if (in->Nodes != NULL)
 
37
    {
 
38
        numDim = in->Nodes->numDim;
 
39
        printf("=== %1dD-Nodes:\nnumber of nodes=%d\n", numDim, in->Nodes->numNodes);
 
40
        printf("Id,Tag,globalDegreesOfFreedom,degreesOfFreedom,reducedDegreesOfFeedom,node,reducedNode,Coordinates\n");
 
41
        for (i = 0; i < in->Nodes->numNodes; i++)
 
42
        {
 
43
            printf("%d,%d,%d,%d,%d,%d,%d ",
 
44
                   in->Nodes->Id[i], in->Nodes->Tag[i], in->Nodes->globalDegreesOfFreedom[i],
 
45
                   in->Nodes->degreesOfFreedomMapping->target[i],
 
46
                   in->Nodes->reducedDegreesOfFreedomMapping->target[i],
 
47
                   in->Nodes->nodesMapping->target[i], in->Nodes->reducedNodesMapping->target[i]);
 
48
            for (j = 0; j < numDim; j++)
 
49
                printf(" %20.15e", in->Nodes->Coordinates[INDEX2(j, i, numDim)]);
 
50
            printf("\n");
 
51
        }
 
52
    }
 
53
 
 
54
    /*  write elements: */
 
55
 
 
56
    if (in->Elements != NULL)
 
57
    {
 
58
        printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",
 
59
               in->Elements->ename, in->Elements->numElements, in->Elements->minColor, in->Elements->maxColor);
 
60
        NN = in->Elements->numNodes;
 
61
        NN2 = in->Elements->numNodes;
 
62
        if (in->Elements->numElements > 0)
 
63
        {
 
64
            printf("Id,Tag,Owner,Color,Nodes\n");
 
65
            for (i = 0; i < in->Elements->numElements; i++)
 
66
            {
 
67
                printf("%d,%d,%d,%d,", in->Elements->Id[i], in->Elements->Tag[i], in->Elements->Owner[i],
 
68
                       in->Elements->Color[i]);
 
69
                for (j = 0; j < NN; j++)
 
70
                    printf(" %d", in->Nodes->Id[in->Elements->Nodes[INDEX2(j, i, NN2)]]);
 
71
                printf("\n");
 
72
            }
 
73
        }
 
74
    }
 
75
 
 
76
    /*  write face elements: */
 
77
 
 
78
    if (in->FaceElements != NULL)
 
79
    {
 
80
        printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",
 
81
               in->FaceElements->ename, in->FaceElements->numElements, in->FaceElements->minColor,
 
82
               in->FaceElements->maxColor);
 
83
        NN = in->FaceElements->numNodes;
 
84
        NN2 = in->FaceElements->numNodes;
 
85
        if (in->FaceElements->numElements > 0)
 
86
        {
 
87
            printf("Id,Tag,Owner,Color,Nodes\n");
 
88
            for (i = 0; i < in->FaceElements->numElements; i++)
 
89
            {
 
90
                printf("%d,%d,%d,%d,", in->FaceElements->Id[i], in->FaceElements->Tag[i], in->Elements->Owner[i],
 
91
                       in->FaceElements->Color[i]);
 
92
                for (j = 0; j < NN; j++)
 
93
                    printf(" %d", in->Nodes->Id[in->FaceElements->Nodes[INDEX2(j, i, NN2)]]);
 
94
                printf("\n");
 
95
            }
 
96
        }
 
97
    }
 
98
 
 
99
    /*  write points: */
 
100
    if (in->Points != NULL)
 
101
    {
 
102
        printf("=== %s:\nnumber of elements=%d\ncolor range=[%d,%d]\n",
 
103
               in->Points->ename, in->Points->numElements, in->Points->minColor, in->Points->maxColor);
 
104
        NN = in->Points->numNodes;
 
105
        NN2 = in->Points->numNodes;
 
106
        if (in->Points->numElements > 0)
 
107
        {
 
108
            printf("Id,Tag,Owner,Color,Nodes\n");
 
109
            for (i = 0; i < in->Points->numElements; i++)
 
110
            {
 
111
                printf("%d,%d,%d,%d,", in->Points->Id[i], in->Points->Tag[i], in->Elements->Owner[i],
 
112
                       in->Points->Color[i]);
 
113
                for (j = 0; j < NN; j++)
 
114
                    printf(" %d", in->Nodes->Id[in->Points->Nodes[INDEX2(j, i, NN2)]]);
 
115
                printf("\n");
 
116
            }
 
117
        }
 
118
    }
 
119
}