amesh.h 2.15 KB
Newer Older
1
2
3
4
5
6
#ifndef _AMESH_H
#define _AMESH_H
#include "inmost.h"

namespace INMOST
{
Kirill Terekhov's avatar
Kirill Terekhov committed
7
	class AdaptiveMesh
8
	{
Kirill Terekhov's avatar
Kirill Terekhov committed
9
		Mesh * m;
10
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
Kirill Terekhov's avatar
Kirill Terekhov committed
11
		Model * model;
12
#endif
13
		ElementSet root; //< Root set that links all the other sets for coarsements
14
		//TagInteger tag_status;
Kirill Terekhov's avatar
Kirill Terekhov committed
15
		TagInteger set_id;
Kirill Terekhov's avatar
Kirill Terekhov committed
16
		//TagInteger tag_an; 
SilverLife's avatar
SilverLife committed
17
18
        int rank;
        int size;
19
20
21
		/// Prepare sets for coarsements.
		/// Do not do this in constructor, since mesh may contain no cells.
		void PrepareSet();
22
		void CheckClosure(std::string file, int line);
23
        //void PrintSetLocal(std::string offset, ElementSet it, std::stringstream& ss);
24
        //void SynchronizeIndicated(TagInteger& indicator);
25
	public:
26
27
		void ReportSets(std::fstream & fout);
		void CheckParentSet(std::string file, int line);//, TagInteger indicator);
28
29
		TagReference parent_set; //<Link to the set that contains an element.
		TagReferenceArray hanging_nodes; //< Link to current hanging nodes of the cell.
SilverLife's avatar
SilverLife committed
30
		TagInteger level; //< Refinement level of the cell
Kirill Terekhov's avatar
Kirill Terekhov committed
31
		//TagReferenceArray ref_tag; //<Link to the set that contains an element.
32
		Storage::integer GetLevel(const Storage & e) {return level[e];}
33
        AdaptiveMesh(Mesh & m);
34
35
36
37
38
39
40
		~AdaptiveMesh();
		/// Indicator must be 1 on cells to be refined
		/// and 0 on all other cells
		bool Refine(TagInteger & indicator);
		bool Coarse(TagInteger & indicator);
		/// Delete all data related to mesh refinement-coarsement.
		void ClearData();
41
		void PrintSet(std::ostream & fout, ElementSet set);
42
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
Kirill Terekhov's avatar
Kirill Terekhov committed
43
		void SetModel(Model * mm) {model = mm;}
44
#endif
45
46
47
48
49
		//the work on each cell is supposed to be proportional to the number of cells refined
		//this number is equal to number of original nodes
		void ComputeWeightRefine(TagInteger indicator, TagReal weight);
		//the work on each cell is supposed to be proportional to the number of cells united
		void ComputeWeightCoarse(TagInteger indicator, TagReal weight);
50
51
52
53
54
        //void Test();
        //void PrintMesh(std::ostream& os, int cell = 0, int face = 0, int edge = 0, int node = 0);
        //void PrintSet();
        //void UpdateStatus();
        //void test_sets();
55
56
57
58
	};
}

#endif //_AMESH_H