Mesh.h 24.6 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file Mesh.h */

/** \defgroup Triangulation Triangulation module
 * @{ <img src="triangulation.png"> @}
 *
 * Example:
 *
 * @{ <img src="hierarchicalMesh.png"> @}
 *
 * \brief
 * Contains all triangulation classes.
 */

#ifndef AMDIS_MESH_H
#define AMDIS_MESH_H

// ============================================================================
// ===== includes =============================================================
// ============================================================================

#include "DOFAdmin.h"
#include "Line.h"
#include "Triangle.h"
#include "Tetrahedron.h"
#include "Element.h"
#include "ElInfo.h"
#include "FixVec.h"
#include "MemoryManager.h"
#include "Serializable.h"
#include "BoundaryCondition.h"
#include <deque>
#include <set>
#include <stdio.h>

namespace AMDiS {

  // ============================================================================
  // ===== forward declarations =================================================
  // ============================================================================

  template <typename T> class DimVec; 
  template <typename T> class VectorOfFixVecs;
  class Boundary;
  class Projection;
  class ElInfo;
  class Element;
  class MacroElement;
  class DOFAdmin;
  class MacroInfo;
  template<typename T> class WorldVector;
  class Quadrature;
  class Parametric;
  class PeriodicBC;
  class DOFVectorDOF;
  class VertexVector;

  // ============================================================================
  // ===== class Mesh ===========================================================
  // ============================================================================

  /** \ingroup Triangulation 
   * \brief
   * A Mesh holds all information about a triangulation. 
   */
  class Mesh : public Serializable
  {
  public:
    MEMORY_MANAGED(Mesh);

    /** \brief
     * Creates a mesh with the given name of dimension dim
     */
92
    Mesh(const std::string& name, int dim);
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

    /** \brief
     * Destructor
     */
    virtual ~Mesh();

    /** \brief
     * Reads macro triangulation.
     */
    void initialize();

    /** \brief
     * Assignment operator
     */
    Mesh& operator=(const Mesh&);

    /** \name static methods used while mesh traversal 
     * \{
     */

    /** \brief
     * Used while dof compress
     */
    static int newDOFFct1(ElInfo* e);

    /** \brief
     * Used while dof compress
     */
    static int newDOFFct2(ElInfo* e);
    /** \} */


    // ==========================================================================
    /** \name getting methods
     * \{
     */

    /** \brief
     * Returns geometric information about this mesh. With GeoIndex p it is 
     * specifiedm which information is requested.
     */
    inline int getGeo(GeoIndex p) const { 
      return Global::getGeo(p, dim); 
136
    }
137
138
139
140

    /** \brief
     * Returns \ref name of the mesh
     */
141
    inline const std::string& getName() const { 
142
      return name; 
143
    }
144
145
146
147
148
149

    /** \brief
     * Returns \ref dim of the mesh
     */
    inline int getDim() const { 
      return dim; 
150
    }
151
152
153
154
155
156

    /** \brief
     * Returns \ref nDOFEl of the mesh
     */
    inline const int getNumberOfAllDOFs() const { 
      return nDOFEl; 
157
    }
158
159
160
161
162
163

    /** \brief
     * Returns \ref nNodeEl of the mesh
     */
    inline const int getNumberOfNodes() const { 
      return nNodeEl; 
164
    }
165
166
167
168
169
170

    /** \brief
     * Returns \ref nVertices of the mesh
     */
    inline const int getNumberOfVertices() const { 
      return nVertices; 
171
    }
172
173
174
175
176
177

    /** \brief
     * Returns \ref nEdges of the mesh 
     */
    inline const int getNumberOfEdges() const { 
      return nEdges; 
178
    }
179
180
181
182
183
184

    /** \brief
     * Returns \ref nFaces of the mesh 
     */
    inline const int getNumberOfFaces() const { 
      return nFaces; 
185
    }
186
187
188
189
190
191

    /** \brief
     * Returns \ref nLeaves of the mesh 
     */
    inline const int getNumberOfLeaves() const { 
      return nLeaves; 
192
    }
193
194
195
196
197
198

    /** \brief
     * Returns \ref nElements of the mesh
     */
    inline const int getNumberOfElements() const { 
      return nElements; 
199
    }
200
201
202
203
204
205

    /** \brief
     * Returns \ref maxEdgeNeigh of the mesh
     */
    inline const int getMaxEdgeNeigh() const { 
      return maxEdgeNeigh; 
206
    }
207
208
209
210
211
212

    /** \brief
     * Returns \ref parametric of the mesh
     */
    inline Parametric *getParametric() const { 
      return parametric; 
213
    }
214
215
216
217
218
219

    /** \brief
     * Returns \ref diam of the mesh
     */
    inline const WorldVector<double>& getDiameter() const { 
      return diam; 
220
    }
221
222
223
224
225
226

    /** \brief
     * Returns nDOF[i] of the mesh
     */
    inline const int getNumberOfDOFs(int i) const { 
      return nDOF[i]; 
227
    }
228
229
230
231
232
233

    /** \brief
     * Returns \ref elementPrototype of the mesh
     */
    inline Element* getElementPrototype() { 
      return elementPrototype; 
234
    }
235
236
237
238
239
240

    /** \brief
     * Returns \ref leafDataPrototype of the mesh
     */
    inline ElementData* getElementDataPrototype() { 
      return elementDataPrototype; 
241
    }
242
243
244
245
246
247

    /** \brief
     * Returns node[i] of the mesh 
     */
    inline int getNode(int i) const { 
      return node[i]; 
248
    }
249
250
251
252
253
254
255
256
257
258
259
260
261
262

    /** \brief
     * Allocates the number of DOFs needed at position and registers the DOFs
     * at the DOFAdmins. The number of needed DOFs is the sum over the needed
     * DOFs of all DOFAdmin objects belonging to this mesh. 
     * The return value is a pointer to the first allocated DOF. 
     */
    DegreeOfFreedom *getDOF(GeoIndex position);

    /** \brief
     * Returns *(\ref admin[i]) of the mesh
     */
    inline const DOFAdmin& getDOFAdmin(int i) const {
      return *(admin[i]);
263
    }
264
265
266
267
268
269

    /** \brief
     * Creates a DOFAdmin with name lname. nDOF specifies how many DOFs 
     * are needed at the different positions (see \ref DOFAdmin::nrDOF).
     * A pointer to the created DOFAdmin is returned.
     */
270
    const DOFAdmin* createDOFAdmin(const std::string& lname, DimVec<int> nDOF);
271
272
273
274
275

    /** \brief
     * Returns the size of \ref admin which is the number of the DOFAdmins
     * belonging to this mesh
     */
276
277
    const int getNumberOfDOFAdmin() const {
      return admin.size();
278
    }
279
280
281
282
283

    /** \brief
     * Returns the size of \ref macroElements which is the number of
     * of macro elements of this mesh
     */
284
285
    const int getNumberOfMacros() const {
      return macroElements.size();
286
    }
287
288
289
290
291
292
293
294
295
296

    /** \brief
     * Returns a DOFAdmin which at least manages vertex DOFs
     */
    const DOFAdmin* getVertexAdmin() const;

    /** \brief
     * Allocates a array of DOF pointers. The array holds one pointer for
     * each node.
     */
297
    DegreeOfFreedom **createDOFPtrs();
298
299
300
301
302
303

    /** \brief
     * Returns \ref preserveCoarseDOFs of the mesh
     */
    inline bool queryCoarseDOFs() const { 
      return preserveCoarseDOFs;
304
    }
305
306
307
308

    /** \brief
     * Returns an iterator to the begin of \ref macroElements
     */
309
    inline std::deque<MacroElement*>::iterator firstMacroElement() {
310
      return macroElements.begin();
311
    }
312
313
314
315
316
317

    /** \brief
     * Returns macroElements[i].
     */
    inline MacroElement *getMacroElement(int i) { 
      return macroElements[i]; 
318
    }
319
320
321
322

    /** \brief
     * Returns an iterator to the end of \ref macroElements
     */
323
    inline std::deque<MacroElement*>::iterator endOfMacroElements() {
324
      return macroElements.end();
325
    }
326
327
328
329
330
331
332
333
334
335
336

    /** \} */

    // ==========================================================================
    /** \name setting methods
     * \{
     */

    /** \brief
     * Sets \ref name of the mesh
     */
337
    inline void setName(const std::string& aName) { 
338
      name = aName;
339
    }
340
341
342
343

    /** \brief
     * Sets \ref nVertices of the mesh
     */
344
345
    inline void setNumberOfVertices(int n) { 
      nVertices = n; 
346
    }
347
348
349
350

    /** \brief
     * Sets \ref nFaces of the mesh
     */
351
352
    inline void setNumberOfFaces(int n) { 
      nFaces = n; 
353
    }
354
355
356
357

    /** \brief
     * Increments \ref nVertices by inc
     */
358
359
    inline void incrementNumberOfVertices(int inc) { 
      nVertices += inc; 
360
    }
361
362
363
364
 
    /** \brief
     * Sets \ref nEdges of the mesh
     */
365
366
    inline void setNumberOfEdges(int n) { 
      nEdges = n; 
367
    }
368
369
370
371

    /** \brief
     * Increments \ref nEdges by inc
     */
372
373
    inline void incrementNumberOfEdges(int inc) { 
      nEdges += inc; 
374
    }
375
376
377
378

    /** \brief
     * Increments \ref nFaces by inc
     */
379
380
    inline void incrementNumberOfFaces(int inc) { 
      nFaces += inc; 
381
    }
382
383
384
385

    /** \brief
     * Sets \ref nLeaves of the mesh
     */
386
387
    inline void setNumberOfLeaves(int n) { 
      nLeaves = n; 
388
    }
389
390
391
392
393
394

    /** \brief
     * Increments \ref nLeaves by inc
     */
    inline void incrementNumberOfLeaves(int inc) { 
      nLeaves += inc; 
395
    }
396
397
398
399

    /** \brief
     * Sets \ref nElements of the mesh
     */
400
401
    inline void setNumberOfElements(int n) { 
      nElements = n; 
402
    }
403
404
405
406

    /** \brief
     * Increments \ref nElements by inc
     */
407
408
    inline void incrementNumberOfElements(int inc) { 
      nElements += inc; 
409
    }
410
411
412
413
414
415
416
417
418
419
420
421
422
423

    /** \brief
     * Sets *\ref diam to w
     */
    void setDiameter(const WorldVector<double>& w);

    /** \brief
     * Sets (*\ref diam)[i] to d
     */
    void setDiameter(int i, double d);

    /** \brief
     * Sets \ref preserveCoarseDOFs = true
     */
424
425
    inline void retainCoarseDOFs() {
      preserveCoarseDOFs = true;
426
    }
427
428
429
430

    /** \brief
     * Sets \ref preserveCoarseDOFs = b
     */
431
432
    inline void setPreserveCoarseDOFs(bool b) {
      preserveCoarseDOFs = b;
433
    }
434
435
436
437

    /** \brief
     * Sets \ref preserveCoarseDOFs = false
     */
438
439
    inline void noCoarseDOFs() {
      preserveCoarseDOFs = false;
440
    }
441
442
443
444
445
446

    /** \brief
     * Sets \ref elementPrototype of the mesh
     */
    inline void setElementPrototype(Element* prototype) {
      elementPrototype = prototype;
447
448
    }
    
449
450
451
452
453
    /** \brief
     * Sets \ref elementDataPrototype of the mesh
     */
    inline void setElementDataPrototype(ElementData* prototype) {
      elementDataPrototype = prototype;
454
    }
455
456
457

    inline void setParametric(Parametric *param) {
      parametric = param;
458
    }
459

460
461
    inline void setMaxEdgeNeigh(int m) { 
      maxEdgeNeigh = m; 
462
    }
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
  
    /** \} */
    // ==========================================================================

    /** \brief
     * Creates a new Element by cloning \ref elementPrototype
     */
    Element* createNewElement(Element *parent = NULL);

    /** \brief
     * Creates a new ElInfo dependent of \ref dim of the mesh
     */
    ElInfo* createNewElInfo();

    /** \brief
     * Frees DOFs at the given position pointed by dof 
     */
    void freeDOF(DegreeOfFreedom* dof, GeoIndex position);

    /** \brief
     * Frees memory for the given element el
     */ 
    void freeElement(Element* el);

    /** \brief
     * Performs DOF compression for all DOFAdmins (see \ref DOFAdmin::compress)
     */
    void dofCompress();

    /** \brief
     * Adds a DOFAdmin to the mesh
     */
495
    virtual void addDOFAdmin(DOFAdmin *admin);
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
   
    /** \brief
     * Traverses the mesh. The argument level specifies the element level if 
     * CALL_EL_LEVEL or CALL_LEAF_EL_LEVEL, or the multigrid level if 
     * CALL_MG_LEVEL is set. Otherwise this variable is ignored. By the argument
     * fillFlag the elements to be traversed and data to be filled into ElInfo is
     * selected, using bitwise or of one CALL_... flag and several FILL_... 
     * flags. The argument elFct is a pointer to a function which is called on 
     * every element selected by the CALL_... part of fillFlag.
     * It is possible to use the recursive mesh traversal recursively, by calling
     * traverse() from elFct.
     */
    int traverse(int level, 
		 const Flag fillFlag,
		 int (*elFct)(ElInfo*));

    /** \brief
     * Clears \ref macroElements
     */
515
516
    inline void clearMacroElements() { 
      macroElements.clear();
517
    }
518
519
520
521
522
523
524
525
526
527
528
529
530
531
  
    /** \brief
     * Adds a macro element to the mesh
     */
    void addMacroElement(MacroElement* me);

    /** \brief
     * Frees the array of DOF pointers (see \ref createDOFPtrs)
     */
    void freeDOFPtrs(DegreeOfFreedom **ptrs);

    /** \brief
     * Used by \ref findElementAtPoint. 
     */
532
533
534
    bool findElInfoAtPoint(const WorldVector<double>& xy,
			   ElInfo *el_info,
			   DimVec<double>& bary,
535
			   const MacroElement *start_mel,
536
537
			   const WorldVector<double> *xy0,
			   double *sp);
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573

    /** \brief
     * Access to an element at world coordinates xy. Some applications need the 
     * access to elements at a special location in world coordinates. Examples 
     * are characteristic methods for convection problems, or the implementation
     * of a special right hand side like point evaluations or curve integrals.
     * For such purposes, a routine is available which returns an element pointer
     * and corresponding barycentric coordinates.
     *
     * \param xy world coordinates of point
     * \param elp return address for a pointer to the element at xy
     * \param pary returns barycentric coordinates of xy
     * \param start_mel initial guess for the macro element containing xy or NULL
     * \param xy0 start point from a characteristic method, see below, or NULL
     * \param sp return address for relative distance to domain boundary in a 
     *        characteristic method, see below, or NULL
     * \return true is xy is inside the domain , false otherwise
     * 
     * For a characteristic method, where \f$ xy = xy_0 - V\tau \f$, it may be 
     * convenient to know the point on the domain's boundary which lies on the 
     * line segment between the old point xy0 and the new point xy, in case that 
     * xy is outside the domain. Such information is returned when xy0 and a 
     * pointer sp!=NULL are supplied: *sp is set to the value s such that 
     * \f$ xy_0 +s (xy -xy_0) \in \partial Domain \f$, and the element and local 
     * coordinates corresponding to that boundary point will be returned via elp 
     * and bary.
     *
     * The implementation of findElementAtPoint() is based on the transformation 
     * from world to local coordinates, available via the routine worldToCoord(),
     * At the moment, findElementAtPoint() works correctly only for domains with 
     * non-curved boundary. This is due to the fact that the implementation first
     * looks for the macro-element containing xy and then finds its path through 
     * the corresponding element tree based on the macro barycentric coordinates.
     * For non-convex domains, it is possible that in some cases a point inside
     * the domain is considered as external.
     */
574
575
576
    bool findElementAtPoint(const WorldVector<double>& xy,
			    Element **elp, 
			    DimVec<double>& bary,
577
			    const MacroElement *start_mel,
578
579
			    const WorldVector<double> *xy0,
			    double *sp);
580
581
582
583
584
585


    /** \brief
     * Returns FILL_ANY_?D
     */
    inline static const Flag& getFillAnyFlag(int dim) {
586
      switch (dim) {
587
588
589
590
591
592
593
594
595
596
597
598
599
      case 1:
	return FILL_ANY_1D;
	break;
      case 2:
	return FILL_ANY_2D;
	break;
      case 3:
	return FILL_ANY_3D;
	break;
      default:
	ERROR_EXIT("invalid dim\n");
	return FILL_ANY_1D;
      }
600
    }
601
602
603

    // ===== Serializable implementation =====
  
604
    void serialize(std::ostream &out);
605

606
    void deserialize(std::istream &in);
607
608
609
610
611
612

    /** \brief
     * Returns \ref elementIndex and increments it by 1.
     */
    inline int getNextElementIndex() { 
      return elementIndex++; 
613
    }
614
615
616
617

    /** \brief
     * Returns \ref initialized.
     */
618
619
620
    inline bool isInitialized() {
      return initialized; 
    }
621
  
622
    inline std::map<BoundaryType, VertexVector*>& getPeriodicAssociations() {
623
      return periodicAssociations;
624
    }
625
626
627
628
629
630

    bool associated(DegreeOfFreedom dof1, DegreeOfFreedom dof2);

    bool indirectlyAssociated(DegreeOfFreedom dof1, DegreeOfFreedom dof2);

    inline MacroInfo* getMacroFileInfo() { 
631
      return macroFileInfo;
632
    }
633
634
635

    void clearMacroFileInfo();

636
637
    int calcMemoryUsage();

638
639
640
641
642
643
644
645
646
  public:
    /** \brief
     * 
     */
    static const Flag FILL_NOTHING;

    /** \brief
     * 
     */
647
    static const Flag FILL_COORDS; 
648
649
650
651

    /** \brief
     * 
     */
652
    static const Flag FILL_BOUND; 
653
654
655
656

    /** \brief
     * 
     */
657
    static const Flag FILL_NEIGH; 
658
659
660
661

    /** \brief
     * 
     */
662
    static const Flag FILL_OPP_COORDS; 
663
664
665
666
667
668
669
670
671

    /** \brief
     * 
     */
    static const Flag FILL_ORIENTATION; 

    /** \brief
     * 
     */
672
    static const Flag FILL_ADD_ALL; 
673
674
675
676
  
    /** \brief
     * 
     */
677
    static const Flag FILL_ANY_1D; 
678
679
680
681

    /** \brief
     * 
     */
682
    static const Flag FILL_ANY_2D; 
683
684
685
686

    /** \brief
     * 
     */
687
    static const Flag FILL_ANY_3D; 
688

689
690
691
    /** \brief
     * 
     */
692
    static const Flag FILL_DET;
693
694
695
696

    /** \brief
     * 
     */
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
    static const Flag FILL_GRD_LAMBDA;

    //**************************************************************************
    //  flags for Mesh traversal                                                
    //**************************************************************************

    /** \brief
     * 
     */
    static const Flag CALL_EVERY_EL_PREORDER;      

    /** \brief
     * 
     */
    static const Flag CALL_EVERY_EL_INORDER;     

    /** \brief
     * 
     */
    static const Flag CALL_EVERY_EL_POSTORDER;    

    /** \brief
     * 
     */
    static const Flag CALL_LEAF_EL;   

    /** \brief
     * 
     */
    static const Flag CALL_LEAF_EL_LEVEL;  

    /** \brief
     * 
     */
    static const Flag CALL_EL_LEVEL; 

    /** \brief
     * 
     */
    static const Flag CALL_MG_LEVEL;

  protected:
739
    bool findElementAtPointRecursive(ElInfo *elinfo,
740
				     const DimVec<double>& lambda,
741
				     int outside,
742
743
744
745
746
747
748
749
750
751
752
				     ElInfo *final_el_info);

  protected:
    /** \brief
     * maximal number of DOFs at one position
     */
    static const int MAX_DOF;

    /** \brief
     * Name of this Mesh
     */
753
    std::string name;
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860

    /** \brief
     * Dimension of this Mesh. Doesn't have to be equal to dimension of world.
     */
    int dim;

    /** \brief
     * Number of vertices in this Mesh
     */
    int nVertices;

    /** \brief
     * Number of Edges in this Mesh
     */
    int nEdges;

    /** \brief
     * Number of leaf elements in this Mesh
     */
    int nLeaves;

    /** \brief
     * Total number of elements in this Mesh
     */
    int nElements;

    /** \brief
     * Number of faces in this Mesh
     */
    int nFaces;

    /** \brief
     * Maximal number of elements that share one edge; used to allocate memory 
     * to store pointers to the neighbour at the refinement/coarsening edge 
     * (only 3d);
     */
    int maxEdgeNeigh;

    /** \brief
     * Diameter of the mesh in the DIM_OF_WORLD directions
     */
    WorldVector<double> diam;

    /** \brief
     * Is pointer to NULL if mesh contains no parametric elements else pointer 
     * to a Parametric object containing coefficients of the parameterization 
     * and related information
     */
    Parametric *parametric;

    /** \brief
     * If the value is non zero then preserve all DOFs on all levels (can
     * be used for multigrid, e.g.); otherwise all DOFs on the parent that are 
     * not handed over to a child are removed during refinement and added again 
     * on the parent during coarsening.
     */
    bool preserveCoarseDOFs;

    /** \brief
     * Number of all DOFs on a single element
     */
    int nDOFEl;

    /** \brief
     * Number of DOFs at the different positions VERTEX, EDGE, (FACE,) CENTER on
     * an element:
     *
     * - nDOF[VERTEX]: number of DOFs at a vertex (>= 1)
     *
     * - nDOF[EDGE]: number of DOFs at an edge; if no DOFs are associated to
     *   edges, then this value is 0
     *
     * - nDOF[FACE]: number of DOFs at a face; if no DOFs are associated to
     *   faces, then this value is 0 (only 3d)
     *
     * - nDOF[CENTER]: number of DOFs at the barycenter; if no DOFs are 
     *   associated to the barycenter, then this value is 0
     */
    DimVec<int> nDOF;

    /** \brief
     * Number of nodes on a single element where DOFs are located; needed for 
     * the (de-) allocation of the dof-vector on the element (\ref Element::dof);
     */
    int nNodeEl;

    /** \brief
     * Gives the index of the first node at vertex, edge, face (only 3d), and 
     * barycenter:
     *
     * - node[VERTEX]: has always value 0; dof[0],...,dof[N_VERTICES-1] are 
     *   always DOFs at the vertices;
     *
     * - node[EDGE]: dof[node[EDGE]],..., dof[node[EDGE]+N_EDGES-1] are the DOFs
     *   at the N_EDGES edges, if DOFs are located at edges;
     *
     * - node[FACE]: dof[node[FACE]],..., dof[node[FACE]+N_FACES-1] are the DOFs
     *   at the N_FACES faces, if DOFs are located at faces (only 3d);
     *
     * - node[CENTER]: dof[node[CENTER]] are the DOFs at the barycenter, if DOFs
     *   are located at the barycenter;
     */
    DimVec<int> node;

    /** \brief
     * list of all DOFAdmins
     */
861
    std::vector<DOFAdmin*> admin;
862
863
864
865

    /** \brief
     * List of all MacroElements of this Mesh
     */
866
    std::deque<MacroElement*> macroElements;
867
868
869
870

    /** \brief
     * Needed during DOF compression (\ref DOFAdmin::compress).
     */
871
    std::vector<DegreeOfFreedom> newDOF;
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892

    /** \brief
     * Needed during DOF compression (\ref DOFAdmin::compress).
     */
    static DOFAdmin *compressAdmin;

    /** \brief
     * Used for recursive mesh traversal. Static pointer to the mesh
     * that should be traversed. This allows access to the mesh even
     * from the static traverse routines
     */
    static Mesh* traversePtr;

    /** \brief
     * Used by compress- and check functions. Number of the current DOFAdmin
     */
    static int iadmin;

    /** \brief
     * Used by check functions
     */
893
    static std::vector<DegreeOfFreedom> dof_used;
894

895
896
897
    /** \brief
     *      
     */
898
    static std::map<DegreeOfFreedom, DegreeOfFreedom*> serializedDOFs;
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926

    /** \brief
     * Used while mesh refinement. To create new elements 
     * elementPrototype->clone() is called, which returns a Element of the
     * same type as elementPrototype. So e.g. Elements of the different
     * dimensions can be created in a uniform way. 
     */
    Element* elementPrototype;

    /** \brief
     * Prototype for leaf data. Used for creation of new leaf data while
     * refinement.
     */
    ElementData* elementDataPrototype;

    /** \brief
     * Used for enumeration of all mesh elements
     */
    int elementIndex;

    /** \brief
     * True if the mesh is already initialized, false otherwise.
     */
    bool initialized;

    /** \brief
     * Map of managed periodic vertex associations.
     */
927
    std::map<BoundaryType, VertexVector*> periodicAssociations;
928
929
930
931
932

    /** \brief
     * If the mesh has been created by reading a macro file, here 
     * the information are stored about the content of the file.
     */
933
    MacroInfo *macroFileInfo;
934
935

  protected:
936
937
938
    /** \brief
     * for findElement-Fcts
     */
939
    DimVec<double> final_lambda;
940
941

    /** \brief
942
943
     * Temporary variables that are used in functions \ref fineElInfoatPoint and
     * \ref fineElementAtPointRecursive.
944
     */
945
    const WorldVector<double> *g_xy0, *g_xy;
946
947

    /** \brief
948
949
     * Temporary variable that is used in functions \ref fineElInfoatPoint and
     * \ref fineElementAtPointRecursive.
950
951
     */    
    double *g_sp;
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
   
    friend class MacroInfo;
    friend class MacroReader;
    friend class MacroWriter;
    friend class MacroElement;
    friend class Element;
    friend void Element::newDOFFct1(const DOFAdmin*);
    friend void Element::newDOFFct2(const DOFAdmin*);
  };

}

#endif  // AMDIS_MESH_H