Newer
Older
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==

Thomas Witkowski
committed
// == http://www.amdis-fem.org ==
// == ==
// ============================================================================

Thomas Witkowski
committed
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.
/** \file MacroReader.h */
#ifndef AMDIS_MACROREADER_H
#define AMDIS_MACROREADER_H
#include <deque>
#include "Global.h"
#include "FixVec.h"
#include "Boundary.h"
namespace AMDiS {
/** \defgroup Input Input module */
/** \ingroup Input
*
* \brief
* Static class which reads a macro triangulation file and creates
* the corresponding macro mesh.
*/
class MacroReader
{
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
// Is used to read periodic macros
class PeriodicMap
{
public:
void setEntry(DegreeOfFreedom key, DegreeOfFreedom entry)
{
// no trivial entries!
if (key == entry)
return;
// if a key equal to entry exists ...
if (getEntry(entry) >= 0) {
if (getEntry(entry) == key)
return;
// ... let it be equal entries
setEntry(key, getEntry(entry));
return;
}
// replace entries equal to key
for (map<DegreeOfFreedom, DegreeOfFreedom>::iterator it =
periodicMap.begin(); it != periodicMap.end(); ++it)
if (it->second == key)
it->second = entry;
// if key exists already, insert new entry with old entry as key
if (getEntry(key) >= 0)
setEntry(getEntry(key), entry);
// set entry
periodicMap[key] = entry;
}
DegreeOfFreedom getEntry(DegreeOfFreedom key)
{
map<DegreeOfFreedom, DegreeOfFreedom>::iterator it = periodicMap.find(key);
if (it != periodicMap.end())
return it->second;
return -1;
}
protected:
map<DegreeOfFreedom, DegreeOfFreedom> periodicMap;
};
/// Creates a Mesh by reading the macro file with the given filename.

Thomas Witkowski
committed
static MacroInfo* readMacro(std::string filename,

Thomas Witkowski
committed
std::string periodicFile,
int check);
protected:
static void computeNeighbours(Mesh *mesh);
static void boundaryDOFs(Mesh *mesh);
static void umb(int *ele, Mesh *mesh,
void (*umbvk)(Mesh *mesh, MacroElement*,int k, int *el));
static int macrotest(Mesh *mesh);
static void macroTest(Mesh *mesh, const char *nameneu);
static bool newEdge(Mesh *mesh, MacroElement *mel,
int mel_edge_no, int *n_neigh);
static void fillMelBoundary(Mesh *, MacroElement *mel,
FixVec<BoundaryType ,NEIGH>);
static void fillMelNeigh(MacroElement *mel,
std::deque<MacroElement*>& macro_elements,
FixVec<int,NEIGH> ind);
static void umbVkantMacro(Mesh *mesh,
MacroElement *,
int ka,
int *ele);
static void recumb(Mesh *mesh,
MacroElement *mel, MacroElement *macroalt,
int *test, double lg, int ka, int *ele,
void (*umbvk)(Mesh *mesh, MacroElement*,int k, int *el));
static void laengstekante(FixVec<WorldVector<double>,VERTEX> coord,
double *l, int *v);
static void checkMesh(Mesh *mesh);
static int basicCheckFct(ElInfo* elInfo, Mesh *mesh);
static void basicDOFCheckFct(ElInfo* elInfo, Mesh *mesh, int iadmin);
static void basicNodeFct(ElInfo* elInfo, Mesh *mesh);
friend class MacroInfo;
};
}
#endif