dune-composites (unstable)

definePG.hh
1#ifndef DEFINE_PG__HH
2#define DEFINE_PG__HH
3
4namespace Dune{
5 namespace Composites
6
8 template<typename GV, typename MODEL>
9 std::vector<int> setPG(const GV& gv, const MODEL& model, int Nelem){
10 std::vector<int> elemIndx2PG(Nelem);
11 for (const auto& eit : elements(gv)){
12 int id = gv.indexSet().index(eit);
13 auto point = eit.geometry().center();
14 double layer_cnt=0, inc=0;
15 int layer_switch=0;
16 for(int i = 0; i < model.num_layers; i++){
17 layer_switch = (i+1)/2 - i/2;
18 inc = model.lay_res_h*layer_switch+(1-layer_switch)*model.lay_com_h;
19 if(point[2] > layer_cnt + 1e-06 && point[2] < layer_cnt + inc + 1.e-06){
20 elemIndx2PG[id] = 1000+i;
21 }
22 layer_cnt += inc;
23 }
24 }
25 return elemIndx2PG;
26}
27
28}
29}
30
31#endif
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Apr 3, 22:46, 2025)