Trilinos based (stochastic) FEM solvers
meshpp.cpp
Go to the documentation of this file.
1 /*
2 Brian Staber (brian.staber@gmail.com)
3 */
4 
5 #include "meshpp.hpp"
6 
8 }
9 
10 mesh::mesh(std::string & fileName_mesh, double scaling){
11  read_gmsh(fileName_mesh, scaling);
12 }
13 
14 mesh::mesh(Epetra_Comm & comm, std::string & fileName_mesh, double scaling){
15  Comm = &comm;
16  int MyPID = Comm->MyPID();
17  int NumProc = Comm->NumProc();
18 
19  read_gmsh(fileName_mesh, scaling);
20 
21  epart = new idx_t[n_cells];
22  npart = new idx_t[n_nodes];
23 
24  Comm->Barrier();
25  if (Comm->NumProc()>1){
26  if (MyPID==0){
27  metis_part_mesh(NumProc);
28  }
29  }
30  else{
31  for (unsigned int e=0; e<n_cells; ++e){
32  epart[e] = 0;
33  }
34  for (unsigned int n=0; n<n_nodes; ++n){
35  npart[n] = 0;
36  }
37  }
38 
39  Comm->Broadcast(epart,n_cells,0);
40  Comm->Broadcast(npart,n_nodes,0);
41  Comm->Barrier();
42  get_local_nodes(MyPID);
43  get_cells_and_ghosts(MyPID);
44 
45  /*if (MyPID==0){
46  std::cout << std::setw(5) << "MyPID" << std::setw(20) << "n_cells" << std::setw(20) << "el_type" << std::setw(20) << "face_type" << std::setw(20) << "n_nodes" << std::setw(20) << "n_faces" << std::setw(20) << "processors\n";
47  std::cout << std::setw(5) << MyPID << std::setw(20) << n_cells << std::setw(20) << el_type << std::setw(20) << face_type << std::setw(20) << n_nodes << std::setw(20) << n_faces << std::setw(20) << Comm->NumProc() << "\n";
48  std::cout << std::setw(5) << "MyPID" << std::setw(20) << "n_local_cells" << std::setw(20) << "n_local_nodes" << std::setw(20) << "n_local_faces" << "\n";
49  }
50  Comm->Barrier();
51  std::cout << std::setw(5) << MyPID << std::setw(20) << n_local_cells << std::setw(20) << n_local_nodes_without_ghosts << std::setw(20) << n_local_faces << "\n";*/
52 
53  if (n_local_faces>0 && (face_type==3 || face_type==4 || face_type==6)){
55  }
57 }
58 
60  delete[] epart;
61  delete[] npart;
62 }
63 
64 int mesh::read_gmsh(std::string & fileName_mesh, double scaling){
65  int error = 0;
66  std::ifstream meshfile;
67  meshfile.open(fileName_mesh.c_str());
68 
69  if (!meshfile){
70  std::cout << "*ERR* Can't open the input file\n ";
71  error = 1;
72  return error;
73  }
74 
75  char buf[100],c;
76  double xyz[3];
77  unsigned int n_total_cells;
78  unsigned int el_info;
79  unsigned int num;
80  unsigned int nbtag;
81  unsigned int tag1;
82  unsigned int tag2;
83  unsigned int n_faces3 = 0;
84  unsigned int n_quad4 = 0;
85  unsigned int n_faces6 = 0;
86  unsigned int n_cells4 = 0;
87  unsigned int n_hexa8 = 0;
88  unsigned int n_cells10 = 0;
89  unsigned int node;
90  unsigned int nodes_faces3[3];
91  unsigned int nodes_quad4[4];
92  unsigned int nodes_faces6[6];
93  unsigned int nodes_cells4[4];
94  unsigned int nodes_hexa8[8];
95  unsigned int nodes_cells10[10];
96 
97  std::vector<int> tri3_nodes;
98  std::vector<int> quad4_nodes;
99  std::vector<int> tri6_nodes;
100  std::vector<int> tetra4_nodes;
101  std::vector<int> hexa8_nodes;
102  std::vector<int> tetra10_nodes;
103 
104  meshfile.getline(buf,100);
105  meshfile.getline(buf,100);
106  meshfile.getline(buf,100);
107  meshfile.getline(buf,100);
108  meshfile >> n_nodes;
109  meshfile.get(c);
110 
111  nodes_coord.reserve(3*n_nodes);
112 
113  for (int i=0; i<n_nodes; ++i){
114  meshfile >> num;
115  meshfile >> xyz[0];
116  meshfile >> xyz[1];
117  meshfile >> xyz[2];
118  nodes_coord[3*i+0] = xyz[0]/scaling;
119  nodes_coord[3*i+1] = xyz[1]/scaling;
120  nodes_coord[3*i+2] = xyz[2]/scaling;
121  }
122 
123  meshfile.getline(buf,100);
124  meshfile.getline(buf,100);
125  meshfile.getline(buf,100);
126  meshfile >> n_total_cells;
127  meshfile.getline(buf,100);
128 
129  for (int i=0; i<n_total_cells; ++i){
130  meshfile >> num;
131  meshfile >> el_info;
132  meshfile >> nbtag;
133  meshfile >> tag1;
134  meshfile >> tag2;
135 
136  switch (el_info) {
137  case 1:
138  for (unsigned int inode=0; inode<2; ++inode){
139  meshfile >> node;
140  }
141  break;
142  case 2:
143  for (unsigned int inode=0; inode<3; ++inode){
144  meshfile >> nodes_faces3[inode];
145  tri3_nodes.push_back(nodes_faces3[inode]-1);
146  }
147  break;
148  case 3:
149  for (unsigned int inode=0; inode<4; ++inode){
150  meshfile >> nodes_quad4[inode];
151  if (tag1==92 || tag1==93){
152  quad4_nodes.push_back(nodes_quad4[inode]-1);
153  }
154  }
155  break;
156  case 4:
157  for (unsigned int inode=0; inode<4; ++inode){
158  meshfile >> nodes_cells4[inode];
159  tetra4_nodes.push_back(nodes_cells4[inode]-1);
160  }
161  break;
162  case 5:
163  for (unsigned int inode=0; inode<8; ++inode){
164  meshfile >> nodes_hexa8[inode];
165  hexa8_nodes.push_back(nodes_hexa8[inode]-1);
166  }
167  break;
168  case 9:
169  for (unsigned int inode=0; inode<6; ++inode){
170  meshfile >> nodes_faces6[inode];
171  if (tag1==1){
172  tri6_nodes.push_back(nodes_faces6[inode]-1);
173  }
174  }
175  break;
176  case 11:
177  for (unsigned int inode=0; inode<10; ++inode){
178  meshfile >> nodes_cells10[inode];
179  tetra10_nodes.push_back(nodes_cells10[inode]-1);
180  }
181  break;
182  case 15:
183  for (unsigned int inode=0; inode<1; ++inode){
184  meshfile >> node;
185  }
186  break;
187  default:
188  std::cout << "Element not supported encountered: el_info = " << el_info << "\n";
189  break;
190  };
191  }
192  meshfile.close();
193 
194  n_faces3 = tri3_nodes.size()/3;
195  n_quad4 = quad4_nodes.size()/4;
196  n_faces6 = tri6_nodes.size()/6;
197  n_cells4 = tetra4_nodes.size()/4;
198  n_hexa8 = hexa8_nodes.size()/8;
199  n_cells10 = tetra10_nodes.size()/10;
200 
201  if (n_cells4==0 && n_cells10==0 && n_hexa8==0){
202  std::cerr << "Your mesh is empty!\n";}
203  if ( (n_cells4>0 && n_cells10>0) || (n_cells4>0 && n_hexa8>0) || (n_cells10>0 && n_hexa8>0) ){
204  std::cerr << "We do not handle mixed meshes that contain tetra4's and/or tetra10's and/or hexa8's.\n";
205  error = 1;
206  return error;
207  }
208  if ( (n_faces3>0 && n_faces6>0) || (n_faces3>0 && n_quad4>0) || (n_faces6>0 && n_quad4>0) ){
209  std::cerr << "We do not handle mixed meshes that contain tri3's and/or tri6's and/or quad4's.\n";
210  error = 1;
211  return error;
212  }
213  if (n_faces3>0){
214  face_type = 3;
215  n_faces = n_faces3;
216  faces_nodes.reserve(tri3_nodes.size());
217  faces_nodes = tri3_nodes;
218 
221  }
222  if (n_faces6>0){
223  face_type = 6;
224  n_faces = n_faces6;
225  faces_nodes.reserve(tri6_nodes.size());
226  faces_nodes = tri6_nodes;
227 
230  }
231  if (n_quad4>0){
232  face_type = 4;
233  n_faces = n_quad4;
234  faces_nodes.reserve(quad4_nodes.size());
235  faces_nodes = quad4_nodes;
236 
239  }
240  if (n_cells4>0){
241  n_cells = n_cells4;
242  el_type = 4;
243  cells_nodes.reserve(tetra4_nodes.size());
244  cells_nodes = tetra4_nodes;
245 
248  }
249  if (n_hexa8>0){
250  n_cells = n_hexa8;
251  el_type = 8;
252  cells_nodes.reserve(hexa8_nodes.size());
253  cells_nodes = hexa8_nodes;
254 
257  }
258  if (n_cells10>0){
259  n_cells = n_cells10;
260  el_type= 10;
261  cells_nodes.reserve(tetra10_nodes.size());
262  cells_nodes = tetra10_nodes;
263 
266  }
267  return error;
268 }
269 
270 int mesh::read_boundary_file(std::string & fileName_bc, unsigned int & number_physical_groups){
271 
272  std::ifstream file_bc;
273  file_bc.open(fileName_bc.c_str());
274  if (!file_bc){
275  std::cout << "*ERR* Can't open the input file called " << fileName_bc.c_str() << "\n";
276  return 1;
277  }
278 
279  Epetra_IntSerialDenseVector input(number_physical_groups*n_nodes);
280  for (unsigned int i=0; i<number_physical_groups*n_nodes; ++i){
281  file_bc >> input(i);
282  }
283 
284  nodes_to_boundaries.Reshape(n_local_nodes_without_ghosts,number_physical_groups);
285  int node;
286  for (unsigned int inode=0; inode<n_local_nodes_without_ghosts; ++inode){
287  node = local_nodes[inode];
288  for (unsigned pg=0; pg<number_physical_groups; ++pg){
289  nodes_to_boundaries(inode,pg) = input(number_physical_groups*node+pg);
290  }
291  }
292  file_bc.close();
293  return 0;
294 
295 }
296 
297 int mesh::metis_part_mesh(int & NumProc){
298  int check_PartMeshDual;
299 
300  idx_t ne = n_cells;
301  idx_t nn = n_nodes;
302  idx_t *eptr, *eind;
303  eptr = new idx_t[n_cells+1];
304  eind = new idx_t[el_type*n_cells];
305 
306  for (unsigned int i=0; i<n_cells; ++i){
307  for (unsigned int inode=0; inode<el_type; ++inode){
308  eind[el_type*i+inode] = cells_nodes[el_type*i+inode];
309  }
310  eptr[i] = el_type*i;
311  }
312  eptr[n_cells] = el_type*n_cells;
313 
314  idx_t *vwgt=NULL;
315  idx_t *vsize=NULL;
316  idx_t common;
317  switch (el_type){
318  case 4:
319  common = 3;
320  break;
321  case 8:
322  common = 4;
323  break;
324  case 10:
325  common = 6;
326  break;
327  };
328  idx_t nparts = NumProc;
329  real_t *tpwgts=NULL;
330  idx_t *options=NULL;
331  idx_t objval;
332  check_PartMeshDual = METIS_PartMeshDual(&ne, &nn, eptr, eind, vwgt, vsize, &common, &nparts, tpwgts, options, &objval, epart, npart);
333 
334  if (check_PartMeshDual==0){
335  std::cout << "*ERR* An error occured with METIS.\n";
336  }
337  delete [] eptr;
338  delete [] eind;
339  delete [] vwgt;
340  delete [] vsize;
341  delete [] tpwgts;
342  delete [] options;
343 
344  return check_PartMeshDual;
345 }
346 
347 void mesh::get_local_nodes(int & MyPID){
348  for (unsigned int j=0; j<n_nodes; ++j){
349  if (npart[j]==MyPID){
350  local_nodes_without_ghosts.push_back(j);
351  local_dof_without_ghosts.push_back(3*j+0);
352  local_dof_without_ghosts.push_back(3*j+1);
353  local_dof_without_ghosts.push_back(3*j+2);
354  }
355  }
357 }
358 
359 void mesh::get_cells_and_ghosts(int & MyPID){
360 
361  Epetra_IntSerialDenseVector mynpart(Copy,npart,n_nodes);
364  int node;
365 
366  for (unsigned int i=0; i<n_cells; ++i){
367  if (epart[i]==MyPID){
368  local_cells.push_back(i);
369  for (unsigned inode=0; inode<el_type; ++inode){
370  node = cells_nodes[el_type*i+inode];
371  if (mynpart[node]!=MyPID){
372  mynpart[node]=MyPID;
373  local_nodes.push_back(node);
374  local_dof.push_back(3*node+0);
375  local_dof.push_back(3*node+1);
376  local_dof.push_back(3*node+2);
377  }
378  }
379  }
380  }
381 
382  n_local_nodes = local_nodes.size();
383  n_local_cells = local_cells.size();
384 
385  if (n_faces>0){
386  int nodes[face_type];
387  for (unsigned int i=0; i<n_faces; ++i){
388  for (unsigned int inode=0; inode<face_type; ++inode){
389  nodes[inode] = faces_nodes[face_type*i+inode];
390  }
391  switch (face_type){
392  case 3:
393  if (mynpart[nodes[0]]==MyPID && mynpart[nodes[1]]==MyPID && mynpart[nodes[2]]==MyPID){
394  local_faces.push_back(i);
395  //break;
396  }
397  break;
398  case 4:
399  if (mynpart[nodes[0]]==MyPID && mynpart[nodes[1]]==MyPID && mynpart[nodes[2]]==MyPID && mynpart[nodes[3]]==MyPID){
400  local_faces.push_back(i);
401  //break;
402  }
403  break;
404  case 6:
405  if (mynpart[nodes[0]]==MyPID && mynpart[nodes[1]]==MyPID && mynpart[nodes[2]]==MyPID && mynpart[nodes[3]]==MyPID && mynpart[nodes[4]]==MyPID && mynpart[nodes[5]]==MyPID){
406  local_faces.push_back(i);
407  //break;
408  }
409  break;
410  }
411  }
412  n_local_faces = local_faces.size();
413  }
414  int check_n_faces;
415  Comm->SumAll(&n_local_faces,&check_n_faces,1);
416  if (check_n_faces!=n_faces){
417  if (Comm->MyPID()==0){
418  std::cout << "\n";
419  std::cout << std::setw(15) << "****************************************************\n";
420  std::cout << std::setw(15) << "ALERT: SOME FACES MAY BELONG TO MULTIPLE PROCESSOR!!\n";
421  std::cout << std::setw(15) << "SOLUTION: LOWER THE NUMBER OF PROCESSORS!!\n";
422  std::cout << std::setw(15) << "****************************************************\n";
423  }
424  }
425 }
426 
427 Epetra_SerialDenseVector mesh::get_cartesian_coordinate(unsigned int & e_gid, unsigned int & gp){
428 
429  int node;
432  double xi, eta, zeta;
433 
434  Epetra_SerialDenseVector vector_x(3);
435  Epetra_SerialDenseVector shape_functions(el_type);
436  Epetra_SerialDenseMatrix matrix_X(3,el_type);
437 
438  for (unsigned inode=0; inode<el_type; ++inode){
439  node = cells_nodes[el_type*e_gid+inode];
440  matrix_X(0,inode) = nodes_coord[3*node+0];
441  matrix_X(1,inode) = nodes_coord[3*node+1];
442  matrix_X(2,inode) = nodes_coord[3*node+2];
443  }
444  xi = xi_cells(gp); eta = eta_cells(gp); zeta = zeta_cells(gp);
445  switch (el_type){
446  case 4:
447  tetra4::shape_functions(shape_functions, xi, eta, zeta);
448  break;
449  case 8:
450  hexa8::shape_functions(shape_functions, xi, eta, zeta);
451  break;
452  case 10:
453  tetra10::shape_functions(shape_functions, xi, eta, zeta);
454  break;
455  }
456  vector_x.Multiply('N','N',1.0,matrix_X,shape_functions,0.0);
457  return vector_x;
458 }
459 
461 
462  int node, eglob;
463  Epetra_SerialDenseVector N(face_type);
464  Epetra_SerialDenseMatrix D(face_type,2);
465 
469 
470  switch (face_type){
471  case 3:
472  for (unsigned int gp=0; gp<n_gauss_faces; ++gp){
474  for (int inode=0; inode<face_type; ++inode){
475  N_faces(gp,inode) = N(inode);
476  }
477  }
478  break;
479  case 4:
480  for (unsigned int gp=0; gp<n_gauss_faces; ++gp){
482  for (int inode=0; inode<face_type; ++inode){
483  N_faces(gp,inode) = N(inode);
484  }
485  }
486  break;
487  case 6:
488  for (unsigned int gp=0; gp<n_gauss_faces; ++gp){
490  for (int inode=0; inode<face_type; ++inode){
491  N_faces(gp,inode) = N(inode);
492  }
493  }
494  break;
495  };
496 
497  for (unsigned int gp=0; gp<n_gauss_faces; ++gp){
498  switch (face_type){
499  case 3:
501  break;
502  case 4:
504  break;
505  case 6:
507  break;
508  };
509  for (unsigned int inode=0; inode<face_type; ++inode){
510  D1_N_faces(gp,inode) = D(inode,0);
511  D2_N_faces(gp,inode) = D(inode,1);
512  }
513  }
514 
515  /*for (unsigned int eloc=0; eloc<n_local_faces; ++eloc){
516  eglob = local_faces[eloc];
517  for (unsigned int inode=0; inode<face_type; inode++){
518  node = faces_nodes[face_type*eglob+inode];
519  X(0,inode) = nodes_coord[3*node+0];
520  X(1,inode) = nodes_coord[3*node+1];
521  }
522 
523  for (unsigned int gp=0; gp<n_gauss_faces; ++gp){
524  switch (face_type){
525  case 3:
526  tri3::d_shape_functions(D, xi_faces[gp], eta_faces[gp]);
527  break;
528  case 4:
529  quad4::d_shape_functions(D, xi_faces[gp], eta_faces[gp]);
530  break;
531  case 6:
532  tri6::d_shape_functions(D, xi_faces[gp], eta_faces[gp]);
533  break;
534  }
535  for (unsigned int inode=0; inode<face_type; ++inode){
536  D1_N_faces(gp,inode) = D(inode,0);
537  D2_N_faces(gp,inode) = D(inode,1);
538  }
539 
540  JacobianMatrix.Multiply('N','N',1.0,X,D,0.0);
541  detJac_faces(eloc,gp) = fabs(JacobianMatrix(0,0)*JacobianMatrix(1,1) - JacobianMatrix(1,0)*JacobianMatrix(0,1));
542  }
543  }*/
544 }
545 
547 
548  int node, eglob;
549  double alpha, beta;
550  Epetra_SerialDenseVector N(el_type);
551  Epetra_SerialDenseMatrix JacobianMatrix(3,3), InverseJacobianMatrix(3,3), X(3,el_type), D(el_type,3), DX(el_type,3);
552 
553  local_rows.Resize(3*el_type*n_local_cells);
554  vol_cells.Resize(n_local_cells);
555  N_cells.Reshape(el_type,n_gauss_cells);
556  detJac_cells.Reshape(n_local_cells,n_gauss_cells);
557  DX_N_cells.Reshape(n_gauss_cells*el_type,n_local_cells);
558  DY_N_cells.Reshape(n_gauss_cells*el_type,n_local_cells);
559  DZ_N_cells.Reshape(n_gauss_cells*el_type,n_local_cells);
560 
561  switch (el_type){
562  case 4:
563  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
565  for (int inode=0; inode<el_type; ++inode){
566  N_cells(inode,gp) = N(inode);
567  }
568  }
569  break;
570  case 8:
571  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
573  for (int inode=0; inode<el_type; ++inode){
574  N_cells(inode,gp) = N(inode);
575  }
576  }
577  break;
578  case 10:
579  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
581  for (int inode=0; inode<el_type; ++inode){
582  N_cells(inode,gp) = N(inode);
583  }
584  }
585  break;
586  };
587  //double volume = 0.0;
588  for (unsigned int eloc=0; eloc<n_local_cells; ++eloc){
589  eglob = local_cells[eloc];
590  for (unsigned int inode=0; inode<el_type; ++inode){
591  node = cells_nodes[el_type*eglob+inode];
592  X(0,inode) = nodes_coord[3*node];
593  X(1,inode) = nodes_coord[3*node+1];
594  X(2,inode) = nodes_coord[3*node+2];
595  local_rows(3*el_type*eloc+3*inode) = 3*node;
596  local_rows(3*el_type*eloc+3*inode+1) = 3*node+1;
597  local_rows(3*el_type*eloc+3*inode+2) = 3*node+2;
598  }
599 
600  vol_cells(eloc) = 0.0;
601  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
602  switch (el_type){
603  case 4:
605  break;
606  case 8:
608  break;
609  case 10:
611  break;
612  }
613  jacobian_matrix(X,D,JacobianMatrix);
614  jacobian_det(JacobianMatrix,detJac_cells(eloc,gp));
615  dX_shape_functions(D,JacobianMatrix,detJac_cells(eloc,gp),DX);
616  vol_cells(eloc) += gauss_weight_cells(gp)*detJac_cells(eloc,gp);
617  for (int inode=0; inode<el_type; ++inode){
618  DX_N_cells(gp+n_gauss_cells*inode,eloc) = DX(inode,0);
619  DY_N_cells(gp+n_gauss_cells*inode,eloc) = DX(inode,1);
620  DZ_N_cells(gp+n_gauss_cells*inode,eloc) = DX(inode,2);
621  }
622  }
623  //volume += vol_cells(eloc);
624  }
625  //std::cout << "VOLUME = " << volume << "\n";
626 }
627 
628 void mesh::update_store_feinterp_cells(Epetra_Vector & u, Epetra_Map & OverlapMap){
629 
630  int node, eglob;
631  double alpha, beta;
632  Epetra_SerialDenseVector N(el_type);
633  Epetra_SerialDenseMatrix JacobianMatrix(3,3), InverseJacobianMatrix(3,3), X(3,el_type), D(el_type,3), DX(el_type,3);
634 
635  switch (el_type){
636  case 4:
637  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
639  for (int inode=0; inode<el_type; ++inode){
640  N_cells(inode,gp) = N(inode);
641  }
642  }
643  break;
644  case 8:
645  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
647  for (int inode=0; inode<el_type; ++inode){
648  N_cells(inode,gp) = N(inode);
649  }
650  }
651  break;
652  case 10:
653  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
655  for (int inode=0; inode<el_type; ++inode){
656  N_cells(inode,gp) = N(inode);
657  }
658  }
659  break;
660  };
661  //double volume = 0.0;
662  for (unsigned int eloc=0; eloc<n_local_cells; ++eloc){
663  eglob = local_cells[eloc];
664  for (unsigned int inode=0; inode<el_type; ++inode){
665  node = cells_nodes[el_type*eglob+inode];
666  X(0,inode) = nodes_coord[3*node+0] + u[OverlapMap.LID(3*node+0)];
667  X(1,inode) = nodes_coord[3*node+1] + u[OverlapMap.LID(3*node+1)];
668  X(2,inode) = nodes_coord[3*node+2] + u[OverlapMap.LID(3*node+2)];
669  local_rows(3*el_type*eloc+3*inode+0) = 3*node+0;
670  local_rows(3*el_type*eloc+3*inode+1) = 3*node+1;
671  local_rows(3*el_type*eloc+3*inode+2) = 3*node+2;
672  }
673 
674  vol_cells(eloc) = 0.0;
675  for (unsigned int gp=0; gp<n_gauss_cells; ++gp){
676  switch (el_type){
677  case 4:
679  break;
680  case 8:
682  break;
683  case 10:
685  break;
686  }
687  jacobian_matrix(X,D,JacobianMatrix);
688  jacobian_det(JacobianMatrix,detJac_cells(eloc,gp));
689  dX_shape_functions(D,JacobianMatrix,detJac_cells(eloc,gp),DX);
690  vol_cells(eloc) += gauss_weight_cells(gp)*detJac_cells(eloc,gp);
691  for (int inode=0; inode<el_type; ++inode){
692  DX_N_cells(gp+n_gauss_cells*inode,eloc) = DX(inode,0);
693  DY_N_cells(gp+n_gauss_cells*inode,eloc) = DX(inode,1);
694  DZ_N_cells(gp+n_gauss_cells*inode,eloc) = DX(inode,2);
695  }
696  }
697  //volume += vol_cells(eloc);
698  }
699  //std::cout << "VOLUME = " << volume << "\n";
700 }
void store_feinterp_cells()
Definition: meshpp.cpp:546
idx_t * epart
Definition: meshpp.hpp:83
for j
Definition: costFunction.m:42
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta)
Definition: fepp.cpp:28
u
Definition: run.m:9
std::vector< int > local_nodes
Definition: meshpp.hpp:80
std::vector< int > local_faces
Definition: meshpp.hpp:81
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:88
int n_local_faces
Definition: meshpp.hpp:95
Epetra_SerialDenseVector DZ_N_cells
Definition: meshpp.hpp:73
std::vector< double > nodes_coord
Definition: meshpp.hpp:77
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta)
Definition: fepp.cpp:34
std::vector< int > local_dof
Definition: meshpp.hpp:80
Epetra_SerialDenseMatrix D2_N_faces
Definition: meshpp.hpp:71
int metis_part_mesh(int &NumProc)
Definition: meshpp.cpp:297
Epetra_SerialDenseVector N_cells
Definition: meshpp.hpp:73
Epetra_Comm * Comm
Definition: meshpp.hpp:69
int n_local_cells
Definition: meshpp.hpp:94
idx_t * npart
Definition: meshpp.hpp:84
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta)
Definition: fepp.cpp:51
void get_local_nodes(int &MyPID)
Definition: meshpp.cpp:347
Epetra_SerialDenseVector eta_cells
Definition: meshpp.hpp:100
Epetra_SerialDenseMatrix N_faces
Definition: meshpp.hpp:71
Epetra_SerialDenseVector vol_cells
Definition: meshpp.hpp:73
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:99
unsigned int n_gauss_faces
Definition: meshpp.hpp:97
Epetra_SerialDenseVector xi_cells
Definition: meshpp.hpp:100
Epetra_SerialDenseVector local_rows
Definition: meshpp.hpp:73
int read_boundary_file(std::string &fileName_bc, unsigned int &number_physical_groups)
Definition: meshpp.cpp:270
int face_type
Definition: meshpp.hpp:91
void dX_shape_functions(Epetra_SerialDenseMatrix &D, Epetra_SerialDenseMatrix JacobianMatrix, double &jac, Epetra_SerialDenseMatrix &DX)
Definition: fepp.cpp:152
void update_store_feinterp_cells(Epetra_Vector &u, Epetra_Map &OverlapMap)
Definition: meshpp.cpp:628
Epetra_SerialDenseVector DX_N_cells
Definition: meshpp.hpp:73
mesh()
Definition: meshpp.cpp:7
Epetra_SerialDenseVector detJac_cells
Definition: meshpp.hpp:73
Epetra_IntSerialDenseMatrix nodes_to_boundaries
Definition: meshpp.hpp:75
std::vector< int > local_cells
Definition: meshpp.hpp:81
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:139
int n_local_nodes_without_ghosts
Definition: meshpp.hpp:92
int n_local_nodes
Definition: meshpp.hpp:93
Epetra_SerialDenseVector xi_faces
Definition: meshpp.hpp:101
void jacobian_det(Epetra_SerialDenseMatrix &JacobianMatrix, double &jac)
Definition: fepp.cpp:175
std::vector< int > faces_nodes
Definition: meshpp.hpp:78
void gauss_points_tri3(Epetra_SerialDenseVector &weight, Epetra_SerialDenseVector &xi, Epetra_SerialDenseVector &eta)
Definition: fepp.cpp:189
int el_type
Definition: meshpp.hpp:90
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:110
Epetra_SerialDenseVector DY_N_cells
Definition: meshpp.hpp:73
std::vector< int > cells_nodes
Definition: meshpp.hpp:78
void get_cells_and_ghosts(int &MyPID)
Definition: meshpp.cpp:359
void gauss_points_tri4(Epetra_SerialDenseVector &weight, Epetra_SerialDenseVector &xi, Epetra_SerialDenseVector &eta)
Definition: fepp.cpp:195
Epetra_SerialDenseMatrix D1_N_faces
Definition: meshpp.hpp:71
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta)
Definition: fepp.cpp:7
void gauss_points_tetra4(Epetra_SerialDenseVector &weight, Epetra_SerialDenseVector &xi, Epetra_SerialDenseVector &eta, Epetra_SerialDenseVector &zeta)
Definition: fepp.cpp:289
unsigned int n_gauss_cells
Definition: meshpp.hpp:98
Epetra_SerialDenseVector get_cartesian_coordinate(unsigned int &e_gid, unsigned int &gp)
Definition: meshpp.cpp:427
void gauss_points_hexa27(Epetra_SerialDenseVector &weight, Epetra_SerialDenseVector &xi, Epetra_SerialDenseVector &eta, Epetra_SerialDenseVector &zeta)
Definition: fepp.cpp:248
int n_cells
Definition: meshpp.hpp:88
Epetra_SerialDenseVector gauss_weight_faces
Definition: meshpp.hpp:99
int read_gmsh(std::string &fileName_mesh, double scaling)
Definition: meshpp.cpp:64
std::vector< int > local_nodes_without_ghosts
Definition: meshpp.hpp:79
std::vector< int > local_dof_without_ghosts
Definition: meshpp.hpp:79
void store_feinterp_faces()
Definition: meshpp.cpp:460
int n_nodes
Definition: meshpp.hpp:87
modelParameters beta
Definition: run_station15.m:10
~mesh()
Definition: meshpp.cpp:59
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:118
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta)
Definition: fepp.cpp:12
for i
Definition: costFunction.m:38
void gauss_points_tetra11(Epetra_SerialDenseVector &weight, Epetra_SerialDenseVector &xi, Epetra_SerialDenseVector &eta, Epetra_SerialDenseVector &zeta)
Definition: fepp.cpp:307
e
Definition: run.m:10
Epetra_SerialDenseVector eta_faces
Definition: meshpp.hpp:101
Epetra_SerialDenseVector zeta_cells
Definition: meshpp.hpp:100
void gauss_points_quad4(Epetra_SerialDenseVector &weight, Epetra_SerialDenseVector &xi, Epetra_SerialDenseVector &eta)
Definition: fepp.cpp:208
Epetra_SerialDenseVector gauss_weight_cells
Definition: meshpp.hpp:99
void jacobian_matrix(Epetra_SerialDenseMatrix &X, Epetra_SerialDenseMatrix &D, Epetra_SerialDenseMatrix &JacobianMatrix)
Definition: fepp.cpp:171
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta)
Definition: fepp.cpp:61
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:125
output eta
Definition: costFunction.m:33
int n_faces
Definition: meshpp.hpp:89