Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mesh.H
Go to the documentation of this file.
1 
18 /*
19  Supported Cell Types
20 
21  4 6
22  /|\ 5 8---------7 /|\
23  / | \ / | | \ |\ / | \
24  / | \ / / | \ | \ / | \
25  / | \ / | | 5--------\6 / 3 \
26  1----|----3 4----|-3 4---|-----3 | 4---------5
27  \ | / \ / \ \ | \ | | / \ |
28  \ | / \ | \ \ | \ | | / \ |
29  \ | / \| \ \| \| |/ \|
30  2 1------2 1---------2 1---------2
31 
32 */
33 #ifndef __Mesh_H__
34 #define __Mesh_H__
35 #include <set>
36 #include <limits>
37 #include <cstring>
38 
39 #include "GeoPrimitives.H"
40 #include "primitive_utilities.H"
41 
51 namespace Mesh {
52 
53  const double TOL = 1e-9;
54  const double LTOL = 0.0 - TOL;
55  const double HTOL = 1.0 + TOL;
56 
57  typedef IRAD::Primitive::IndexType IndexType;
58  typedef IRAD::Primitive::ubyte CellEntityIDType;
59  typedef std::pair<IndexType,CellEntityIDType> SubEntityId;
60  typedef std::pair<SubEntityId,SubEntityId> SymbolicFace;
61  typedef std::vector<IndexType> IndexVec;
62  typedef IRAD::Primitive::MultiContainer<IndexType>::VecVec MultiVec;
63  typedef IRAD::Primitive::MultiContainer<IndexType,IndexType>::VecMap VecMap;
64  typedef IRAD::Primitive::ubyte GeoDimType;
65  typedef std::string GeoNameType;
66 
67  template<typename OuterCont,typename OutCont,typename InnerCont,typename MapType>
68  void MapElements(OuterCont &src,OutCont &trg,MapType &m)
69  {
70  trg.resize(src.size());
71  typename OuterCont::iterator sci = src.begin();
72  typename OutCont::iterator oci = trg.begin();
73  while(sci != src.end()){
74  typename InnerCont::iterator ici = sci->begin();
75  while(ici != sci->end())
76  oci->push_back(m[*ici++]);
77  sci++;
78  oci++;
79  }
80  };
81 
83  template<typename ListContainerType, typename ListType>
84  IndexType MaxNodeId(const ListContainerType &fc)
85  {
86  IndexType maxid = 0;
87  typename ListContainerType::const_iterator lci = fc.begin();
88  while(lci != fc.end()){
89  typename ListType::const_iterator li = lci->begin();
90  while(li != lci->end()){
91  if(maxid < *li)
92  maxid = *li;
93  li++;
94  }
95  }
96  return(maxid);
97  };
98 
100  template<typename OuterCont,typename InnerCont,typename OutCont>
101  void Flatten(OuterCont &con,OutCont &ocon){
102  typename OuterCont::iterator cci = con.begin();
103  ocon.resize(0);
104  while(cci != con.end()){
105  typename InnerCont::iterator ccni = cci->begin();
106  while(ccni != cci->end())
107  ocon.push_back(*ccni++);
108  cci++;
109  }
110  };
111 
113  template<typename OuterContType>
114  IndexType GetTotalSize(OuterContType &con)
115  {
116  IndexType total_size = 0;
117  typename OuterContType::iterator ci = con.begin();
118  while(ci != con.end()){
119  total_size += ci->size();
120  ci++;
121  }
122  return(total_size);
123  };
124 
125 
126  template<typename OuterContType,typename InnerContType,typename RetCont,typename idxtype>
127  void Container2CSR(RetCont &xadj,RetCont &adj,
128  OuterContType &source)
129  {
130  IndexType number_of_elements = source.size();
131  xadj.resize(number_of_elements+1);
132  IndexType number_entries = GetTotalSize<OuterContType>(source);
133  adj.reserve(number_entries);
134  typename OuterContType::iterator si = source.begin();
135  IndexType elm = 0;
136  xadj[elm++] = 0;
137  while(si != source.end()){
138  typename InnerContType::iterator ei = si->begin();
139  xadj[elm] = static_cast<idxtype>(si->size() + xadj[elm-1]);
140  elm++;
141  while(ei != si->end())
142  adj.push_back(static_cast<idxtype>(*ei++-1));
143  si++;
144  }
145  };
146 
147 
152  template<typename ListContainerType, typename ListType>
153  void CreateAdjacentNodeList(std::vector<std::list<IndexType> > &anodelist,
154  ListContainerType &fc,IndexType nnodes=0)
155  {
156  if(nnodes == 0)
157  nnodes = MaxNodeId<ListContainerType,ListType>(fc);
158  anodelist.resize(nnodes);
159  typename ListContainerType::iterator lci = fc.begin();
160  while(lci != fc.end())
161  {
162  typename ListType::iterator li = lci->begin();
163  while(li != lci->end()){
164  IndexType this_node = *li++ - 1;
165  IndexType next_node = 0;
166  if(li == lci->end())
167  next_node = *(lci->begin());
168  else
169  next_node = *li++;
170  anodelist[this_node].push_back(next_node);
171  anodelist[next_node-1].push_back(this_node+1);
172  }
173  lci++;
174  }
175  for(IndexType node = 0;node < nnodes;node++)
176  {
177  anodelist[node].sort();
178  anodelist[node].unique();
179  }
180  }
181 
188  template<typename ListContainerType, typename ListType>
189  void AdjEList(std::vector<std::list<IndexType> > &aelist,
190  ListContainerType &dual_con,unsigned long nel=0)
191  {
192  if(nel == 0)
193  nel = MaxNodeId<ListContainerType,ListType>(dual_con);
194  aelist.resize(nel);
195  typename ListContainerType::iterator lci = dual_con.begin();
196  while(lci != dual_con.end())
197  {
198  typename ListType::iterator li = lci->begin();
199  while(li != lci->end()){
200  IndexType this_node = *li++ - 1;
201  typename ListType::iterator li2 = li;
202  while(li2 != lci->end()){
203  IndexType nexnode = *li2++ - 1;
204  aelist[this_node].push_back(nexnode+1);
205  aelist[nexnode].push_back(this_node+1);
206  }
207  }
208  lci++;
209  }
210  for(IndexType node = 0;node < nel;node++)
211  {
212  aelist[node].sort();
213  aelist[node].unique();
214  }
215  }
216 
217  template<typename ConType,typename IConType>
218  IndexType NumberOfEdges(ConType &con)
219  {
220  typename ConType::iterator ci = con.begin();
221  IndexType node = 0;
222  IndexType nedges = 0;
223  while(ci != con.end())
224  {
225  IndexType tnode = ++node;
226  typename IConType::iterator eni = ci->begin();
227  while(eni != ci->end())
228  {
229  IndexType anode = *eni++;
230  if((tnode) < anode)
231  nedges++;
232  }
233  ci++;
234  }
235  return(nedges);
236  }
237 
238  template<typename ContainerType,typename Icont>
239  void FormGraph(const ContainerType &adjlist)
240  {
241  // empty for now
242  };
243 
244  class TestFace : public std::list<IndexType>
245  {
246  public:
247  bool operator<(const TestFace &f);
248  };
249 
251  friend std::ostream &operator<<(std::ostream &oSt,
252  const Mesh::NodalCoordinates &nc);
253  friend std::istream &operator>>(std::istream &iSt,
255  private:
256  bool mydata;
258  std::ostream *Out;
259  std::ostream *Err;
260  protected:
261  double *ncdata;
263  public:
266  NodalCoordinates(IndexType n,double *data);
268  bool good() const;
269  IndexType size() const;
270  IndexType Size() const;
271  void destroy();
272  void init();
273  void init(IndexType n);
274  void init(IndexType n, double *data);
275  void init_node(IndexType n, const GeoPrim::CPoint &);
276  void init_copy(IndexType n, double *data);
277 
278  inline int NNodes( ) const { return nnodes; };
279 
280  inline double &x(IndexType n = 1)
281  {
282  assert(!(n > nnodes || n == 0));
283  return(ncdata[(n-1)*3]);
284  };
285  inline const double &x(IndexType n = 1) const
286  {
287  assert(!(n > nnodes || n == 0));
288  return(ncdata[(n-1)*3]);
289  };
290  inline double &y(IndexType n = 1)
291  {
292  assert(!(n > nnodes || n == 0));
293  return(ncdata[(3*(n-1))+1]);
294  };
295  inline const double &y(IndexType n = 1) const
296  {
297  assert(!(n > nnodes || n == 0));
298  return(ncdata[(3*(n-1))+1]);
299  };
300  inline double &z(IndexType n = 1)
301  {
302  assert(!(n > nnodes || n == 0));
303  return(ncdata[(3*(n-1))+2]);
304  };
305  inline const double &z(IndexType n = 1) const
306  {
307  assert(!(n > nnodes || n == 0));
308  return(ncdata[(3*(n-1))+2]);
309  };
310  inline double *operator[](IndexType n)
311  {
312  assert(!(n > nnodes || n == 0));
313  return(&ncdata[3*(n-1)]);
314  };
315  inline const double *operator[](IndexType n) const
316  {
317  assert(!(n > nnodes || n == 0));
318  return(&ncdata[3*(n-1)]);
319  };
320  const GeoPrim::CPoint closest_point(const GeoPrim::CPoint &p) const;
321  Mesh::IndexType closest_node(const GeoPrim::CPoint &p,double *dist_ptr = NULL) const;
322  };
323 
324  class NeighborHood : public std::vector<std::set<IndexType> >
325  {};
326 
334  class Connectivity : public std::vector<std::vector<IndexType> >
335  {
336  friend std::ostream &operator<<(std::ostream &oSt,const Connectivity &ec);
337  friend std::istream &operator>>(std::istream &iSt,Connectivity &ec);
338  private:
340  std::vector<IndexType> _sizes;
341  public:
342  Connectivity();
343  Connectivity(unsigned int N);
344  void Resize(unsigned int N = 0);
345  ~Connectivity();
346  inline std::vector<IndexType> &Element(IndexType n){
347  assert(n > 0 && n <= _nelem);
348  return((*this)[n-1]);
349  };
350  inline std::vector<IndexType> Element(IndexType n) const {
351  assert(n > 0 && n <= _nelem);
352  return((*this)[n-1]);
353  };
355  assert(e > 0 && e <= _nelem && n > 0);
356  assert(n <= (*this)[e-1].size());
357  return((*this)[e-1][n-1]);
358  };
359  inline IndexType Node(IndexType e,IndexType n) const {
360  assert(e > 0 && e <= _nelem && n > 0);
361  assert(n <= (*this)[e-1].size());
362  return((*this)[e-1][n-1]);
363  };
364  inline IndexType Nelem() const { return _nelem;};
365  inline IndexType Esize(IndexType n) const
366  {
367  assert(n > 0 && n <= _nelem);
368  return (_sizes.empty() ? (*this)[n-1].size() : _sizes[n-1]);
369  };
370  void AddElement(const std::vector<IndexType> &elem);
371  void AddElement();
372  void Sync();
373  void ShrinkWrap();
374  void Truncate();
375  void destroy();
376  void SyncSizes();
377  void DestroySizes();
378  void Inverse(Connectivity &,IndexType nnodes=0) const;
379  void InverseDegenerate(Connectivity &,IndexType nnodes=0) const;
380  void GetNeighborhood(NeighborHood &,const Connectivity &dc,
381  IndexType size = 0);
383  bool exclude_self=true,
384  bool sortit=false);
385  void GetAdjacent(Connectivity &rl,
386  Connectivity &dc,
387  IndexType n = 0,
388  bool sortit=false);
389  void graph_mode(IndexType offset = 0);
390  void matrix_mode(IndexType offset = 0);
392  std::vector<Mesh::SymbolicFace> &sf,Connectivity &dc) const;
393  template<typename T>
394  void Flatten(std::vector<T> &outcon) const
395  {
396  outcon.resize(0);
397  std::vector<std::vector<IndexType> >::const_iterator eci = this->begin();
398  while(eci != this->end()){
399  std::vector<IndexType>::const_iterator eni = eci->begin();
400  while(eni != eci->end())
401  outcon.push_back(*eni++);
402  eci++;
403  }
404  };
405  void BreadthFirstRenumber(std::vector<Mesh::IndexType> &remap);
406  void ElementsOn(std::vector<Mesh::IndexType> &nodes,
407  Connectivity &dc,
408  std::vector<Mesh::IndexType> &subset);
409 
410  };
411 
412 
423 
431  // Could code the index and dimension info into a single byte.
432  // (Assuming we'd never have more than 64 distinct constructs)
433  class GeometricEntity : public std::pair<GeoNameType,GeoDimType>
434  {
435  friend std::ostream &operator<<(std::ostream &oSt,
436  const Mesh::GeometricEntity &ge);
437  friend std::istream &operator>>(std::istream &iSt,
439  public:
440  GeoNameType Name() const { return this->first; };
441  GeoDimType Dim() const { return this->second; };
442  // The Connectivity has size = Dim()+1, and specifies
443  // the mesh entities associated with this geometrical
444  // entity.
446  };
447 
451  };
452 
453 
454 
456  public:
458  protected:
460  std::vector<Connectivity> _connectivities;
461  public:
463  {
464  // std::cout << "Mesh utility constructor" << std::endl;
465  // _nodal_coordinates_ptr = new NodalCoordinates();
466  _connectivities.resize(NCONS);
467  // _connectivities[EN] = new Connectivity();
468  };
469  int NumberOfNodes() const { return(_nodal_coordinates.Size()); };
470  int NumberOfElements() const { return(_connectivities[EN].Nelem()); };
472  {
473  return(_nodal_coordinates);
474  };
475  const NodalCoordinates &NC() const
476  {
477  return(_nodal_coordinates);
478  };
480  {
481  return(_connectivities[EN]);
482  };
483  const Connectivity &ECon() const
484  {
485  return(_connectivities[EN]);
486  };
488  {
489  // if(!_connectivities[type])
490  // FormConnectivity(type);
491  return(_connectivities[type]);
492  };
493  const Connectivity &Con(const MeshConType type) const
494  {
495  // if(!_connectivities[type])
496  // (const_cast<MeshUtilityObject*>(this))->FormConnectivity(type);
497  return(_connectivities[type]);
498 
499  };
501  {
502  if(_connectivities[type].empty())
503  FormConnectivity(type);
504  return(_connectivities[type]);
505  };
506  const Connectivity &GetCon(const MeshConType type) const
507  {
508  if(_connectivities[type].empty())
509  (const_cast<MeshUtilityObject*>(this))->FormConnectivity(type);
510  return(_connectivities[type]);
511 
512  };
514  {
515  switch(type)
516  {
517  case ENDUAL:
518  // if(_connectivities[type]){
519  // _connectivities[type]->destroy();
520  // }
521  // else
522  // _connectivities[type] = new Connectivity();
523  ECon().Inverse(_connectivities[type],NC().Size());
524  break;
525  default:
526  bool connectivity_known_type = false;
527  assert(connectivity_known_type);
528  break;
529  }
530  return(0);
531  };
533  {
534  // if(_connectivities[type]){
535  _connectivities[type].destroy();
536  // delete _connectivities[type];
537  // _connectivities[type] = NULL;
538  // }
539  return(0);
540  };
542  {
543  // std::cout << "destroying mesh util" << std::endl;
545  // delete _nodal_coordinates_ptr;
546  std::vector<Connectivity>::iterator cpi = _connectivities.begin();
547  while(cpi != _connectivities.end())
548  cpi++->destroy();
549  };
550  };
551 
552  int ReadMesh(const std::string &path,Mesh::UnstructuredMesh &mesh);
553 
554  // Class to encapsulate all the element specific methods
555  // Should be renamed to generic cell
557  protected:
558  IndexType _size; // Number of nodes
559  public:
561  void init(IndexType s = 3){_size = s;};
562  IndexType size() const {return(_size);};
564  IndexType nedges() const {return(_size);};
565  IndexType nvert() const {return(_size);};
566  void ReOrient(std::vector<IndexType> &ec);
567  // bool Inverted(std::vector<IndexType> &ec,NodalCoordinates &nc,
568  // const GeoPrim::CPoint &perspective) const;
569  // void ReOrient(std::vector<IndexType> &ec);
570  GeoPrim::C3Point Centroid(std::vector<IndexType> &ec,NodalCoordinates &nc) const;
571  void shape_func(const GeoPrim::CVector &,
572  double []) const;
573  void dshape_func(const GeoPrim::CVector &,
574  double [][2]) const;
575  void jacobian(const GeoPrim::CPoint p[],
576  const GeoPrim::CVector &,
577  GeoPrim::CVector J[]) const;
578  void interpolate(const GeoPrim::CVector f[],
579  const GeoPrim::CVector &nc,
580  GeoPrim::CVector &) const;
581  void GetNormalSet(GeoPrim::CVector ns[],
582  IndexType elnum,
583  const Connectivity &ec,
584  const NodalCoordinates &nc);
585  void GetPointSet(GeoPrim::CPoint ps[],
586  IndexType elnum,
587  const Connectivity &ec,
588  const NodalCoordinates &nc);
589  void shapef_jacobian_at(const GeoPrim::CPoint &p,
590  GeoPrim::CVector &natc, // size 2
591  IndexType elnum,
592  const Connectivity &ec,
593  const NodalCoordinates &nc,
594  GeoPrim::CVector &fvec,
595  GeoPrim::CVector jac[]) const;
596  };
597 
598  // Class to encapsulate all the element specific methods
599  // Should be renamed to generic cell
601  protected:
602  IndexType _size; // Number of nodes
603  public:
605  : _size(s)
606  {};
607  void init(IndexType s = 4)
608  {
609  _size = s;
610  };
611  IndexType size() const
612  {
613  return(_size);
614  };
616  void Centroid(std::vector<IndexType> &ec,NodalCoordinates &nc,GeoPrim::C3Point &centroid) const;
618  {
619  switch(_size){
620  case 4:
621  case 10:
622  // tet
623  return (6);
624  case 8:
625  case 20:
626  // hex
627  return (12);
628  case 5:
629  case 13:
630  // pyr
631  return(8);
632  case 6:
633  case 15:
634  // pris
635  return(9);
636  default:
637  return(0);
638  }
639  return(0);
640  };
642  {
643  switch(_size){
644  case 4:
645  case 10:
646  // tet
647  return(4);
648  case 8:
649  case 20:
650  // hex
651  return(6);
652  case 5:
653  case 13:
654  // pyr
655  return(5);
656  case 6:
657  case 15:
658  // pris
659  return(5);
660  default:
661  return(0);
662  }
663  return(0);
664  };
665 
666  bool Inverted(std::vector<IndexType> &ec,NodalCoordinates &nc) const;
667  bool ShapeOK(std::vector<IndexType> &ec,NodalCoordinates &nc) const;
668  void ReOrient(std::vector<IndexType> &ec);
669  GeoPrim::C3Point Centroid(std::vector<IndexType> &ec,NodalCoordinates &nc) const;
670 
681  const std::vector<IndexType> &) const;
682 
683 // double signed_element_volume(std::vector<IndexType> &sec,
684 // NodalCoordinates &nc) const
685 // {
686 // switch(_size){
687 // case 4:
688 // case 10: // tet
689 
690 // return (6);
691 // case 8:
692 // case 20:
693 // // hex
694 // return (12);
695 // case 5:
696 // case 13:
697 // // pyr
698 // return(8);
699 // case 6:
700 // case 15:
701 // // pris
702 // return(9);
703 // default:
704 // return(0);
705 // }
706 // return(0);
707 
708 // };
709 
710  void shape_func(const GeoPrim::CVector &,
711  double []) const;
712  void dshape_func(const GeoPrim::CVector &,
713  double [][3]) const;
714  void jacobian(const GeoPrim::CPoint p[],
715  const GeoPrim::CVector &nc,
716  GeoPrim::CVector J[]) const;
717  void interpolate(const GeoPrim::CVector f[],
718  const GeoPrim::CVector &nc,
719  GeoPrim::CVector &) const;
720  void shapef_jacobian_at(const GeoPrim::CPoint &p,
721  GeoPrim::CVector &natc,
722  IndexType elnum,
723  const Connectivity &ec,
724  const NodalCoordinates &nc,
725  GeoPrim::CVector &fvec,
726  GeoPrim::CVector fjac[]) const;
727  };
728 
730  Mesh::Connectivity &conn,
731  std::vector<double> &centroids);
732 
734  Mesh::Connectivity &conn,
736  std::vector<Mesh::IndexType> &candidates,
737  std::vector<Mesh::IndexType> &cells);
739  Mesh::Connectivity &conn,
741  std::vector<Mesh::IndexType> &cells);
742 
743  bool
745  IndexType elnum,
746  const GenericElement &el,
747  const Connectivity &ec,
748  const NodalCoordinates &nc,
749  const GeoPrim::CPoint &point);
750 
751  bool
753  IndexType elnum,
754  const GenericCell_2 &el,
755  const Connectivity &ec,
756  const NodalCoordinates &nc,
757  const GeoPrim::CPoint &point);
758 
759  bool
761  int indx[]);
762 
763  void
765  int indx[],
766  GeoPrim::CVector &b);
767 
768  void GetCoordinateBounds(NodalCoordinates &nc,std::vector<double> &);
769 
770  void
771  GetMeshBoxes(const NodalCoordinates &nc,
772  const Connectivity &ec,
773  GeoPrim::CBox &mesh_box,
774  GeoPrim::CBox &small_box,
775  GeoPrim::CBox &large_box);
776  void
778  const NodalCoordinates &nc,
779  const Connectivity &dc, // dual connectivity
780  std::list<IndexType> &elements);
782  FindPointInCells(const GeoPrim::CPoint &p, // Target point
783  const NodalCoordinates &nc, // Source
784  const Connectivity &ec, // Source connectivity
785  const std::vector<Mesh::IndexType> &elements, // candidate cells
786  GeoPrim::CVector &natc); // Returns Targ nat
787 
789  GlobalFindPointInMesh(const GeoPrim::CPoint &p, // Target Mesh point
790  const NodalCoordinates &nc, // Source
791  const Connectivity &ec, // Source
792  const Connectivity &dc, // Source
793  const GeoPrim::CBox &box, // Source
794  GeoPrim::CVector &natc); // Returns Targ nat
796  FindPointInMesh_2(const GeoPrim::CPoint &p, // Target Mesh point
797  const NodalCoordinates &nc, // Source
798  const Connectivity &ec, // Source connectivity
799  const Connectivity &dc, // Source dual connectivity
800  const GeoPrim::CBox &box, // Source
801  GeoPrim::CVector &natc); // Returns Targ nat
802 
804  FindPointInMesh(const GeoPrim::CPoint &p, // Target Mesh point
805  const NodalCoordinates &nc, // Source
806  const Connectivity &ec, // Source connectivity
807  const Connectivity &dc, // Source dual connectivity
808  const GeoPrim::CBox &box, // Source
809  GeoPrim::CVector &natc); // Returns Targ nat
810 
811 
812 
813  class SolnMetaData {
814  public:
815  std::string name;
816  char loc;
817  std::string unit;
818  unsigned int ncomp;
819  };
820 
821 } // Namespace MESH
822 #endif
823 
824 
825 
/brief Cartesian 3 Vector
void Sync()
Definition: Mesh.C:246
IndexType MaxNodeId(const ListContainerType &fc)
Return the maximum of all elements of a multicontainer.
Definition: Mesh.H:84
int GetMeshCentroids(Mesh::NodalCoordinates &nc, Mesh::Connectivity &conn, std::vector< double > &centroids)
Geometric Primitives interface.
Mesh::IndexType closest_node(const GeoPrim::CPoint &p, double *dist_ptr=NULL) const
Definition: Mesh.C:100
const double TOL
Definition: Mesh.H:53
double * operator[](IndexType n)
Definition: Mesh.H:310
friend std::istream & operator>>(std::istream &iSt, Mesh::GeometricEntity &ge)
Definition: Mesh.C:2074
void ShrinkWrap()
Definition: Mesh.C:247
void GetAdjacent(Connectivity &rl, Connectivity &dc, IndexType n=0, bool sortit=false)
Definition: Mesh.C:520
void init_copy(IndexType n, double *data)
Definition: Mesh.C:117
General connectivity object.
Definition: Mesh.H:334
std::vector< IndexType > & Element(IndexType n)
Definition: Mesh.H:346
std::vector< IndexType > _sizes
Definition: Mesh.H:340
GenericCell_2(IndexType s=3)
Definition: Mesh.H:560
void shape_func(const GeoPrim::CVector &, double[]) const
Definition: Mesh.C:906
bool operator<(const TestFace &f)
Definition: Mesh.C:217
Mesh::Connectivity _collections
Definition: Mesh.H:441
IndexType NumberOfEdges(ConType &con)
Definition: Mesh.H:218
const Connectivity & GetCon(const MeshConType type) const
Definition: Mesh.H:506
void dshape_func(const GeoPrim::CVector &, double[][2]) const
Definition: Mesh.C:675
double s
Definition: blastest.C:80
void jacobian(const GeoPrim::CPoint p[], const GeoPrim::CVector &, GeoPrim::CVector J[]) const
Definition: Mesh.C:704
std::string GeoNameType
Definition: Mesh.H:65
Mesh::IndexType GlobalFindPointInMesh(const GeoPrim::CPoint &p, const NodalCoordinates &nc, const Connectivity &ec, const Connectivity &dc, const GeoPrim::CBox &box, GeoPrim::CVector &natc)
KD_tree::Box box
Definition: Overlay_0d.C:47
double * ncdata
Definition: Mesh.H:261
int ReadMesh(const std::string &path, Mesh::UnstructuredMesh &mesh)
int DestroyConnectivity(const MeshConType type)
Definition: Mesh.H:532
const Connectivity & ECon() const
Definition: Mesh.H:483
boolean empty(T_VertexSet s)
GeoPrim::C3Point Centroid()
Class Mesh is the main class that holds all information to describe the current state of the mesh...
Definition: Mesh.hpp:19
IndexType nedges() const
Definition: Mesh.H:617
void dshape_func(const GeoPrim::CVector &, double[][3]) const
Definition: Mesh.C:962
void GetNeighborhood(NeighborHood &, const Connectivity &dc, IndexType size=0)
Definition: Mesh.C:456
bool good() const
Definition: Mesh.C:47
IndexType nedges() const
Definition: Mesh.H:564
bool LUDcmp(GeoPrim::CVector a[], int indx[])
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
void GetPointSet(GeoPrim::CPoint ps[], IndexType elnum, const Connectivity &ec, const NodalCoordinates &nc)
Definition: Mesh.C:773
Connectivity & GetCon(const MeshConType type)
Definition: Mesh.H:500
std::string unit
Definition: Mesh.H:817
Definition: adj.h:150
GeoDimType Dim() const
Definition: Mesh.H:441
std::ostream * Out
Definition: Mesh.H:258
Connectivity & ECon()
Definition: Mesh.H:479
unsigned int ncomp
Definition: Mesh.H:818
void ReOrient(std::vector< IndexType > &ec)
Definition: Mesh.C:856
std::string name
Definition: Mesh.H:815
IndexType size() const
Definition: Mesh.H:562
int FormConnectivity(const MeshConType type)
Definition: Mesh.H:513
void ElementsOn(std::vector< Mesh::IndexType > &nodes, Connectivity &dc, std::vector< Mesh::IndexType > &subset)
Definition: Mesh.C:569
void Resize(unsigned int N=0)
Definition: Mesh.C:233
friend std::istream & operator>>(std::istream &iSt, Mesh::NodalCoordinates &nc)
Definition: Mesh.C:2108
void CreateAdjacentNodeList(std::vector< std::list< IndexType > > &anodelist, ListContainerType &fc, IndexType nnodes=0)
Given an array of adjacent node lists (like an array of face connectivities), this function will loop...
Definition: Mesh.H:153
void GetMeshBoxes(const NodalCoordinates &nc, const Connectivity &ec, GeoPrim::CBox &mesh_box, GeoPrim::CBox &small_box, GeoPrim::CBox &large_box)
Bounding boxes for a mesh.
Mesh::IndexType FindPointInMesh_2(const GeoPrim::CPoint &p, const NodalCoordinates &nc, const Connectivity &ec, const Connectivity &dc, const GeoPrim::CBox &box, GeoPrim::CVector &natc)
Locate element containing given physical point.
std::ostream * Err
Definition: Mesh.H:259
bool ShapeOK(std::vector< IndexType > &ec, NodalCoordinates &nc) const
Definition: Mesh.C:1521
void MapElements(OuterCont &src, OutCont &trg, MapType &m)
Definition: Mesh.H:68
void get_face_connectivities(Connectivity &, const std::vector< IndexType > &) const
Face conn for given element.
Definition: Mesh.C:1714
IRAD::Primitive::MultiContainer< IndexType, IndexType >::VecMap VecMap
Definition: Mesh.H:63
GenericElement(IndexType s=4)
Definition: Mesh.H:604
std::vector< IndexType > IndexVec
Definition: Mesh.H:61
IndexType _size
Definition: Mesh.H:602
IndexType GetTotalSize(OuterContType &con)
Return the total number of entries in a multicontainer.
Definition: Mesh.H:114
void init(IndexType s=4)
Definition: Mesh.H:607
double & z(IndexType n=1)
Definition: Mesh.H:300
IndexType Size() const
Definition: Mesh.C:49
const double & x(IndexType n=1) const
Definition: Mesh.H:285
void DestroySizes()
Definition: Mesh.C:289
std::pair< IndexType, CellEntityIDType > SubEntityId
Definition: Mesh.H:59
void ReOrient(std::vector< IndexType > &ec)
Definition: Mesh.C:1601
void matrix_mode(IndexType offset=0)
Definition: Mesh.C:444
void Container2CSR(RetCont &xadj, RetCont &adj, OuterContType &source)
Definition: Mesh.H:127
void AddElement()
Definition: Mesh.C:240
void Inverse(Connectivity &, IndexType nnodes=0) const
Definition: Mesh.C:312
IndexType & Node(IndexType e, IndexType n)
Definition: Mesh.H:354
bool Inverted(std::vector< IndexType > &ec, NodalCoordinates &nc) const
Definition: Mesh.C:1475
void GetNormalSet(GeoPrim::CVector ns[], IndexType elnum, const Connectivity &ec, const NodalCoordinates &nc)
Definition: Mesh.C:757
IndexType nfaces() const
Definition: Mesh.H:641
IndexType Esize(IndexType n) const
Definition: Mesh.H:365
friend std::ostream & operator<<(std::ostream &oSt, const Mesh::NodalCoordinates &nc)
Definition: Mesh.C:2128
const NodalCoordinates & NC() const
Definition: Mesh.H:475
IndexType nnodes
Definition: Mesh.H:262
void interpolate(const GeoPrim::CVector f[], const GeoPrim::CVector &nc, GeoPrim::CVector &) const
Definition: Mesh.C:810
int NumberOfElements() const
Definition: Mesh.H:470
int CollideCellsWithBox(Mesh::NodalCoordinates &nc, Mesh::Connectivity &conn, GeoPrim::CBox &box, std::vector< Mesh::IndexType > &candidates, std::vector< Mesh::IndexType > &cells)
IndexType _size
Definition: Mesh.H:558
IndexType Nelem() const
Definition: Mesh.H:364
Connects continuous to discrete.
Definition: Mesh.H:433
const double LTOL
Definition: Mesh.H:54
friend std::ostream & operator<<(std::ostream &oSt, const Connectivity &ec)
Definition: Mesh.C:2146
Mesh::IndexType FindPointInMesh(const GeoPrim::CPoint &p, const NodalCoordinates &nc, const Connectivity &ec, const Connectivity &dc, const GeoPrim::CBox &box, GeoPrim::CVector &natc)
Locate element containing given physical point.
void FormGraph(const ContainerType &adjlist)
Definition: Mesh.H:239
const NT & n
int NNodes() const
Definition: Mesh.H:278
friend std::istream & operator>>(std::istream &iSt, Connectivity &ec)
Definition: Mesh.C:2085
void BreadthFirstRenumber(std::vector< Mesh::IndexType > &remap)
Definition: Mesh.C:593
Mesh::IndexType FindPointInCells(const GeoPrim::CPoint &p, const NodalCoordinates &nc, const Connectivity &ec, const std::vector< Mesh::IndexType > &elements, GeoPrim::CVector &natc)
Locate element containing given physical point.
IndexType Node(IndexType e, IndexType n) const
Definition: Mesh.H:359
double & x(IndexType n=1)
Definition: Mesh.H:280
IndexType _nelem
Definition: Mesh.H:339
void BuildFaceConnectivity(Connectivity &fcon, Connectivity &ef, std::vector< Mesh::SymbolicFace > &sf, Connectivity &dc) const
Definition: Mesh.C:337
IndexType size() const
Definition: Mesh.C:48
const GeoPrim::CPoint closest_point(const GeoPrim::CPoint &p) const
Definition: Mesh.C:85
const double HTOL
Definition: Mesh.H:55
void graph_mode(IndexType offset=0)
Definition: Mesh.C:434
IRAD::Primitive::ubyte CellEntityIDType
Definition: Mesh.H:58
void SyncSizes()
Definition: Mesh.C:281
void Flatten(std::vector< T > &outcon) const
Definition: Mesh.H:394
void InverseDegenerate(Connectivity &, IndexType nnodes=0) const
Definition: Mesh.C:293
const double & y(IndexType n=1) const
Definition: Mesh.H:295
Connectivity & Con(const MeshConType type)
Definition: Mesh.H:487
const double & z(IndexType n=1) const
Definition: Mesh.H:305
int NumberOfNodes() const
Definition: Mesh.H:469
void LUBksb(GeoPrim::CVector a[], int indx[], GeoPrim::CVector &b)
void shapef_jacobian_at(const GeoPrim::CPoint &p, GeoPrim::CVector &natc, IndexType elnum, const Connectivity &ec, const NodalCoordinates &nc, GeoPrim::CVector &fvec, GeoPrim::CVector fjac[]) const
Definition: Mesh.C:883
IndexType size() const
Definition: Mesh.H:611
Connectivity con
Definition: Mesh.H:450
int CollideMeshWithBox(Mesh::NodalCoordinates &nc, Mesh::Connectivity &conn, GeoPrim::CBox &box, std::vector< Mesh::IndexType > &cells)
void Flatten(OuterCont &con, OutCont &ocon)
Populate OutCont with a flat list of entries from a multicontainer.
Definition: Mesh.H:101
bool NewtonRaphson(GeoPrim::CVector &natc, IndexType elnum, const GenericElement &el, const Connectivity &ec, const NodalCoordinates &nc, const GeoPrim::CPoint &point)
Newton-Raphson method, customized for using the GeoPrimitives and computational mesh constructs...
std::vector< IndexType > Element(IndexType n) const
Definition: Mesh.H:350
void shapef_jacobian_at(const GeoPrim::CPoint &p, GeoPrim::CVector &natc, IndexType elnum, const Connectivity &ec, const NodalCoordinates &nc, GeoPrim::CVector &fvec, GeoPrim::CVector jac[]) const
Definition: Mesh.C:784
void GetCoordinateBounds(NodalCoordinates &nc, std::vector< double > &)
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57
void jacobian(const GeoPrim::CPoint p[], const GeoPrim::CVector &nc, GeoPrim::CVector J[]) const
Definition: Mesh.C:1016
void AdjEList(std::vector< std::list< IndexType > > &aelist, ListContainerType &dual_con, unsigned long nel=0)
Given an array of adjacent node lists (like an array of face connectivities), this function will loop...
Definition: Mesh.H:189
void init(IndexType s=3)
Definition: Mesh.H:561
void interpolate(const GeoPrim::CVector f[], const GeoPrim::CVector &nc, GeoPrim::CVector &) const
Definition: Mesh.C:1066
NodalCoordinates _nodal_coordinates
Definition: Mesh.H:459
friend std::ostream & operator<<(std::ostream &oSt, const Mesh::GeometricEntity &ge)
Definition: Mesh.C:2166
GeoPrim::C3Point Centroid()
IRAD::Primitive::ubyte GeoDimType
Definition: Mesh.H:64
bool NewtonRaphson_2(GeoPrim::CVector &natc, IndexType elnum, const GenericCell_2 &el, const Connectivity &ec, const NodalCoordinates &nc, const GeoPrim::CPoint &point)
Newton-Raphson method, customized for using the GeoPrimitives and computational mesh constructs...
void init_node(IndexType n, const GeoPrim::CPoint &)
Definition: Mesh.C:78
const Connectivity & Con(const MeshConType type) const
Definition: Mesh.H:493
IRAD::Primitive::MultiContainer< IndexType >::VecVec MultiVec
Definition: Mesh.H:62
void Truncate()
Definition: Mesh.C:257
NodalCoordinates nc
Definition: Mesh.H:449
void shape_func(const GeoPrim::CVector &, double[]) const
Definition: Mesh.C:643
Encapsulates an element-connectivity of a mesh.
Definition: Connectivity.h:41
const double * operator[](IndexType n) const
Definition: Mesh.H:315
std::pair< SubEntityId, SubEntityId > SymbolicFace
Definition: Mesh.H:60
std::vector< Connectivity > _connectivities
Definition: Mesh.H:460
IndexType nvert() const
Definition: Mesh.H:565
NodalCoordinates & NC()
Definition: Mesh.H:471
GeoNameType Name() const
Definition: Mesh.H:440
void destroy()
Definition: Mesh.C:269
double & y(IndexType n=1)
Definition: Mesh.H:290
void FindElementsInBox(const GeoPrim::CBox &box, const NodalCoordinates &nc, const Connectivity &dc, std::list< IndexType > &elements)
Get elements in box.