Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mesh::GenericCell_2 Class Reference

#include <Mesh.H>

Public Member Functions

 GenericCell_2 (IndexType s=3)
 
void init (IndexType s=3)
 
IndexType size () const
 
GeoPrim::C3Point Centroid ()
 
IndexType nedges () const
 
IndexType nvert () const
 
void ReOrient (std::vector< IndexType > &ec)
 
GeoPrim::C3Point Centroid (std::vector< IndexType > &ec, NodalCoordinates &nc) const
 
void shape_func (const GeoPrim::CVector &, double[]) const
 
void dshape_func (const GeoPrim::CVector &, double[][2]) const
 
void jacobian (const GeoPrim::CPoint p[], const GeoPrim::CVector &, GeoPrim::CVector J[]) const
 
void interpolate (const GeoPrim::CVector f[], const GeoPrim::CVector &nc, GeoPrim::CVector &) const
 
void GetNormalSet (GeoPrim::CVector ns[], IndexType elnum, const Connectivity &ec, const NodalCoordinates &nc)
 
void GetPointSet (GeoPrim::CPoint ps[], IndexType elnum, const Connectivity &ec, const NodalCoordinates &nc)
 
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
 

Protected Attributes

IndexType _size
 

Detailed Description

Definition at line 556 of file Mesh.H.

Constructor & Destructor Documentation

GenericCell_2 ( IndexType  s = 3)
inline

Definition at line 560 of file Mesh.H.

560 : _size(s){};
double s
Definition: blastest.C:80
IndexType _size
Definition: Mesh.H:558

Member Function Documentation

GeoPrim::C3Point Centroid ( )
GeoPrim::C3Point Centroid ( std::vector< IndexType > &  ec,
NodalCoordinates nc 
) const

Definition at line 630 of file Mesh.C.

References i.

631  {
632  GeoPrim::C3Point centroid(0,0,0);
633  IndexType i = 0;
634  IndexType esize = ec.size();
635  while(i < esize)
636  centroid += GeoPrim::C3Point(nc[ec[i++]]);
637  double scal = 1.0/(static_cast<double>(esize));
638  return(centroid *= scal);
639  };
/brief Cartesian 3 Vector
blockLoc i
Definition: read.cpp:79
C3Vector C3Point
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57
void dshape_func ( const GeoPrim::CVector natc,
double  Np[][2] 
) const

Definition at line 675 of file Mesh.C.

References _size.

675  {
676  switch ( _size) {
677  case 3: {
678  Np[0][0] = -1; Np[0][1] = -1;
679  Np[1][0] = 1; Np[1][1] = 0;
680  Np[2][0] = 0; Np[2][1] = 1;
681  return;
682  }
683  case 4: {
684  const double xi = natc[0];
685  const double xi_minus = 1. - xi;
686  const double eta = natc[1];
687  const double eta_minus = 1. - eta;
688 
689  Np[0][0] = -eta_minus; Np[0][1] = -xi_minus;
690  Np[1][0] = eta_minus; Np[1][1] = -xi;
691  Np[2][0] = eta; Np[2][1] = xi;
692  Np[3][0] = -eta; Np[3][1] = xi_minus;
693 
694  return;
695  }
696  default:
697  std::cerr << "GenericCell_2::dshape_func:error: Unknown element type."
698  << std::endl;
699  exit(1);
700  }
701  };
IndexType _size
Definition: Mesh.H:558
void GetNormalSet ( GeoPrim::CVector  ns[],
IndexType  elnum,
const Connectivity ec,
const NodalCoordinates nc 
)

Definition at line 757 of file Mesh.C.

References _size, i, and Mesh::Connectivity::Node().

761  {
762  GeoPrim::CPoint P[3];
763  for(IndexType i = 0;i < _size;i++){
764  IndexType i_minus = (i==0 ? _size -1 : i - 1);
765  P[i_minus] = nc[ec.Node(elnum,i_minus+1)];
766  P[i] = nc[ec.Node(elnum,i+1)];
767  IndexType i_plus = (i == (_size-1) ? 0 : i+1);
768  P[i_plus] = nc[ec.Node(elnum,i_plus+1)];
769  ns[i] = GeoPrim::CVector(P[i] - P[i_minus])%GeoPrim::CVector(P[i_plus] - P[i]);
770  }
771  };
blockLoc i
Definition: read.cpp:79
IndexType _size
Definition: Mesh.H:558
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57

Here is the call graph for this function:

void GetPointSet ( GeoPrim::CPoint  ps[],
IndexType  elnum,
const Connectivity ec,
const NodalCoordinates nc 
)

Definition at line 773 of file Mesh.C.

References _size, i, init(), and Mesh::Connectivity::Node().

777  {
778  for(IndexType i = 0;i < _size;i++)
779  P[i].init(nc[ec.Node(elnum,i+1)]);
780  };
blockLoc i
Definition: read.cpp:79
IndexType _size
Definition: Mesh.H:558
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57
void init(IndexType s=3)
Definition: Mesh.H:561

Here is the call graph for this function:

void init ( IndexType  s = 3)
inline

Definition at line 561 of file Mesh.H.

References _size, and s.

Referenced by GetPointSet().

561 {_size = s;};
double s
Definition: blastest.C:80
IndexType _size
Definition: Mesh.H:558

Here is the caller graph for this function:

void interpolate ( const GeoPrim::CVector  f[],
const GeoPrim::CVector nc,
GeoPrim::CVector v 
) const

Definition at line 810 of file Mesh.C.

References _size, CVector::x(), and CVector::y().

Referenced by main().

813  {
814  const double xi = nc.x();
815  const double eta = nc.y();
816  v = f[0];
817  switch(_size) {
818  case 3: {
819  v += ((f[1]-f[0])*=xi) += ((f[2]-f[0])*=eta);
820  return;
821  }
822  case 4: {
823  v += ((f[1]-f[0]) *= (xi * (1.-eta)))
824  += ((f[3]-f[0]) *= eta)
825  += ((f[2]-f[3]) *= xi*eta);
826  return;
827  }
828  case 6: {
829  const double zeta=1.-xi-eta;
830 
831  v += ((f[1]-f[0]) *= xi * (2.*xi-1.))
832  += ((f[3]-f[0]) *= 4.* xi * zeta)
833  += ((f[2]-f[0]) *= eta * (2.*eta-1.))
834  += ((f[5]-f[0]) *= 4. * eta * zeta)
835  += ((f[4]-f[0]) *= 4.*xi*eta);
836  return;
837  }
838  case 8: {
839  const double xi_minus = 1. - xi;
840  const double eta_minus = 1. - eta;
841  v += ((f[1]-f[0]) *= eta * (2.*eta-1.))
842  += ((f[3]-f[0]) *= eta)
843  += ((f[2]-f[3]) *= xi * eta)
844  -= ((((f[0]-f[4])+=(f[1]-f[4])) *= 2.*xi*xi_minus*eta_minus)
845  += (((f[2]-f[6])+=(f[3]-f[6])) *= 2.*xi*xi_minus*eta)
846  += (((f[1]-f[5])+=(f[2]-f[5])) *= 2.*xi*eta*eta_minus)
847  += (((f[0]-f[7])+=(f[3]-f[7])) *= 2.*xi_minus*eta*eta_minus));
848  return;
849  }
850  default:
851  assert(false);
852  }
853  return;
854  }
IndexType _size
Definition: Mesh.H:558

Here is the call graph for this function:

Here is the caller graph for this function:

void jacobian ( const GeoPrim::CPoint  p[],
const GeoPrim::CVector nc,
GeoPrim::CVector  J[] 
) const

Definition at line 704 of file Mesh.C.

References _size.

Referenced by cal_shdx().

706  {
707  switch (_size) {
708  case 3:
709  J[0] = p[1]-p[0]; J[1] = p[2]-p[0];
710  return;
711  case 4: {
712  const double xi = nc[0];
713  const double xi_minus = 1. - xi;
714  const double eta = nc[1];
715  const double eta_minus = 1. - eta;
716  J[0] = ((p[1]-p[0]) *= eta_minus) += (( p[2]-p[3]) *= eta );
717  J[1] = ((p[3]-p[0]) *= xi_minus) += (( p[2]-p[1]) *= xi);
718  return;
719  }
720  case 6: {
721  const double xi = nc[0];
722  const double eta = nc[1];
723  const double zeta = 1.-xi-eta;
724 
725  J[0] = ((p[1]-p[0]) *= 4.*xi -1.)
726  += ((p[3]-p[0]) *= 4.*zeta-4*xi)
727  += ((p[4]-p[5]) *= 4.*eta);
728  J[1] = ((p[2]-p[0]) *= 4.*eta -1.)
729  += ((p[5]-p[0]) *= 4*zeta-4*eta)
730  += ((p[4]-p[3]) *= 4.*xi);
731  return;
732  }
733  case 8: {
734  const double xi = nc[0];
735  const double xi_minus = 1. - xi;
736  const double eta = nc[1];
737  const double eta_minus = 1. - eta;
738 
739  J[0] = ((p[1]-p[0]) *= eta_minus) += ((p[2]-p[3]) *= eta)
740  -= ((((p[0]-p[4])+=(p[1]-p[4])) *= 2.*eta_minus*(xi_minus-xi))
741  += (((p[2]-p[6])+=(p[3]-p[6])) *= 2.*eta*(xi_minus-xi))
742  += (((p[1]-p[5])+=(p[2]-p[5])-=((p[0]-p[7])+=(p[3]-p[7])))
743  *= 2.*eta*eta_minus));
744 
745  ((J[1] = p[3]-p[0]) *= xi_minus) += ((p[2]-p[1]) *= xi)
746  -= ((((p[1]-p[5])+=(p[2]-p[5])) *= 2.*xi*(eta_minus-eta))
747  += (((p[0]-p[7])+=(p[3]-p[7])) *= 2.*xi_minus*(eta_minus-eta))
748  += (((p[2]-p[6])+=(p[1]-p[4])-=((p[3]-p[6])+=(p[0]-p[4])))
749  *= 2.*xi*xi_minus));
750  return;
751  }
752  default:
753  abort(); // Should never reach here
754  }
755  };
IndexType _size
Definition: Mesh.H:558

Here is the caller graph for this function:

void ReOrient ( std::vector< IndexType > &  ec)

Definition at line 856 of file Mesh.C.

References _size.

Referenced by TRAIL_FD2FE_WinCreate2().

857  {
858  switch(_size) {
859  case 3: {
860  Mesh::IndexType temp = ec[0];
861  ec[0] = ec[1];
862  ec[1] = temp;
863  return;
864  }
865  case 4: {
866  Mesh::IndexType temp = ec[0];
867  ec[0] = ec[1];
868  ec[1] = temp;
869  temp = ec[2];
870  ec[2] = ec[3];
871  ec[3] = temp;
872  return;
873  }
874  default:
875  assert(false);
876  }
877  return;
878 
879  }
IndexType _size
Definition: Mesh.H:558
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57

Here is the caller graph for this function:

void shape_func ( const GeoPrim::CVector natc,
double  SF[] 
) const

Definition at line 643 of file Mesh.C.

References _size.

644  {
645  switch (_size) {
646  case 3: {
647  SF[0] = 1. - natc[0] - natc[1];
648  SF[1] = natc[0];
649  SF[2] = natc[1];
650  return;
651  }
652  case 4: {
653  const double xi = natc[0];
654  const double xi_minus = 1. - xi;
655  const double eta = natc[1];
656  const double eta_minus = 1. - eta;
657 
658  SF[0] = xi_minus * eta_minus;
659  SF[1] = xi * eta_minus;
660  SF[2] = xi * eta;
661  SF[3] = xi_minus * eta;
662  return;
663  }
664  default:
665  std::cerr << "GenericCell_2::shape_func:Error: unkown element type."
666  << std::endl;
667  exit(1);
668  }
669  };
IndexType _size
Definition: Mesh.H:558
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 at line 784 of file Mesh.C.

References i, CVector::normalize(), and GeoPrim::Transpose().

791  {
792  GeoPrim::CPoint P[(const IndexType)_size];
793  double SF[(const IndexType)_size];
794  this->shape_func(natc,SF);
795  fvec.init(-1.0*p);
796  for(IndexType i = 0;i < _size;i++){
797  P[i].init(nc[ec.Node(elnum,i+1)]);
798  fvec += SF[i]*P[i];
799  }
800  GeoPrim::CVector v1(P[0],P[1]);
801  GeoPrim::CVector v2(P[0],P[2]);
802  this->jacobian(P,natc,jac);
803  jac[2] = v1%v2;
804  jac[2].normalize();
805  Transpose(jac);
806  }
void jacobian(const GeoPrim::CPoint p[], const GeoPrim::CVector &, GeoPrim::CVector J[]) const
Definition: Mesh.C:704
CVector & init(const CPoint &p)
blockLoc i
Definition: read.cpp:79
IndexType _size
Definition: Mesh.H:558
void Transpose(CVector matrix[])
Definition: GeoPrimitives.C:11
CVector & normalize()
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57
void shape_func(const GeoPrim::CVector &, double[]) const
Definition: Mesh.C:643

Here is the call graph for this function:

IndexType size ( ) const
inline

Definition at line 562 of file Mesh.H.

References _size.

562 {return(_size);};
IndexType _size
Definition: Mesh.H:558

Member Data Documentation

IndexType _size
protected

The documentation for this class was generated from the following files: