MacroWriter.h 3.75 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file MacroWriter.h */

#ifndef AMDIS_MACROWRITER_H
#define AMDIS_MACROWRITER_H

#include <list>
#include <vector>
Thomas Witkowski's avatar
Thomas Witkowski committed
27
#include "AMDiS_fwd.h"
28
29
30
31
32
33
34
35
36
37
38
#include "VertexInfo.h"
#include "ElementInfo.h"
#include "DataCollector.h"
#include "FixVec.h"
#include "Boundary.h"
#include "Projection.h"
#include "Flag.h"
#include "Mesh.h"

namespace AMDiS {

39
40
41
42
43
44
45
46
47
48
49
50
51
  /** 
   * \ingroup Output
   *
   * \brief
   * Writes the current leaf elements of a mesh as macro triangulation to
   * a text file. Pure static class.
   */
  class MacroWriter
  {
  public:
    /** \brief
     * Stores a list of vertex infos for each dof.
     */
52
    static DOFVector< std::list<VertexInfo> > *vertexInfos;
53
54
55
56

    /** \brief
     * List that stores an ElementInfo for each element.
     */
57
    static std::list<ElementInfo> elements;
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

  public:
    /** \brief
     * Writes the leaf elements of a Mesh as a macro triangulation to a file.
     */
    static int writeMacro(DataCollector *dc,
			  const char *name, 		       
			  double time = 0.0,
			  int level = -1,
			  Flag traverseFlag = Mesh::CALL_LEAF_EL,
			  bool (*writeElem)(ElInfo*) = NULL);

    /** \brief
     * Init \ref periodicFile for the next macro to be written.
     */
    static void writePeriodicFile(DataCollector *dc,
74
				  const std::string filename);
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

 
  protected:
    /** \brief
     * Mesh that should be written
     */
    static Mesh *mesh;

    /** \brief
     * File to which the mesh should be written
     */
    static FILE *macroFile;

    /** \brief
     * File in which the periodic infos are stored.
     */
    static FILE *periodicFile;

    /** \brief
     * vertex pre-dofs
     */
    static int n0;

    /** \brief
     * Number of vertices.
     */
    static int nv;

    /** \brief
     * Number of elements.
     */
    static int ne;

    /** \brief
     * Number of connections.
     */
    static int nc;

    /** \brief
     * Dimension of \ref mesh
     */
    static int dim;

    /** \brief
     * Maps internal element indices to global output indices.
     */
121
    static std::map<int, int> outputIndices;
122
123
124
125
126

    /** \brief
     * periodicConnections[i][j] stores whether the connection at side j of 
     * the element with output index i has already been written.
     */
127
    static std::vector<DimVec<bool> > periodicConnections;
128
129
130
131
132
133

    /** \brief
     *
     */
    static bool (*writeElement)(ElInfo*);
  };
134
135
136
137

}

#endif