MacroWriter.h 3.44 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
  /** 
   * \ingroup Output
   *
   * \brief
   * Writes the current leaf elements of a mesh as macro triangulation to
   * a text file. Pure static class.
   */
  class MacroWriter
  {
  public:
49
    /// Stores a list of vertex infos for each dof.
50
    static DOFVector< std::list<VertexInfo> > *vertexInfos;
51

52
    /// List that stores an ElementInfo for each element.
53
    static std::list<ElementInfo> elements;
54
55

  public:
56
    /// Writes the leaf elements of a Mesh as a macro triangulation to a file.
57
58
59
60
61
62
63
    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);

64
65
    /// Init \ref periodicFile for the next macro to be written.
    static void writePeriodicFile(DataCollector *dc, const std::string filename);
66
67
68

 
  protected:
69
    /// Mesh that should be written
70
71
    static Mesh *mesh;

72
    /// File to which the mesh should be written
73
74
    static FILE *macroFile;

75
    /// File in which the periodic infos are stored.
76
77
    static FILE *periodicFile;

78
    /// vertex pre-dofs
79
80
    static int n0;

81
    /// Number of vertices.
82
83
    static int nv;

84
    /// Number of elements.
85
86
    static int ne;

87
    /// Number of connections.
88
89
    static int nc;

90
    /// Dimension of \ref mesh
91
92
    static int dim;

93
    /// Maps internal element indices to global output indices.
94
    static std::map<int, int> outputIndices;
95
96
97
98
99

    /** \brief
     * periodicConnections[i][j] stores whether the connection at side j of 
     * the element with output index i has already been written.
     */
100
    static std::vector<DimVec<bool> > periodicConnections;
101

102
    ///
103
104
    static bool (*writeElement)(ElInfo*);
  };
105
106
107
108

}

#endif