v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
TorusRigidBody Struct Reference

#include <users_modules/multifield_plasticity/src/RigidBodies.hpp>

Inheritance diagram for TorusRigidBody:
[legend]
Collaboration diagram for TorusRigidBody:
[legend]

Public Member Functions

 TorusRigidBody (VectorDouble c_coords, VectorDouble roller_disp, int id)
 
MoFEMErrorCode getRollerDataForTag ()
 
Tensor1< double, 3 > getNormal (Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_disp)
 
Tensor1< double, 3 > getNormal (Tensor1< TPack3, 3 > &t_coords, Tensor1< double, 3 > &t_disp)
 
Tensor1< double, 3 > getNormal (Tensor1< double, 3 > &t_coords, Tensor1< double, 3 > &t_disp)
 
Tensor2< double, 3, 3 > getDiffNormal (Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_disp, Tensor1< TPack1, 3 > &t_normal)
 
double getGap (Tensor1< TPack3, 3 > &t_coords)
 
Tensor1< double, 3 > getdGap (Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_normal)
 
template<typename T1 , typename T2 >
Tensor1< double, 3 > & getNormalImpl (Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp)
 
template<typename T1 >
double getGapImpl (Tensor1< T1, 3 > &t_coords)
 
template<typename T1 , typename T2 , typename T3 >
Tensor2< double, 3, 3 > getDiffNormalImpl (Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp, Tensor1< T3, 3 > &t_normal)
 
template<typename T1 , typename T2 >
Tensor1< double, 3 > getdGapImpl (Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_normal)
 
virtual MoFEMErrorCode getBodyOptions ()
 
- Public Member Functions inherited from RigidBodyData
 RigidBodyData (VectorDouble c_coords, VectorDouble roller_disp, int id)
 
 RigidBodyData ()=delete
 
virtual ~RigidBodyData ()
 
virtual Tensor1< double, 3 > getNormal (Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_disp)=0
 
virtual Tensor1< double, 3 > getNormal (Tensor1< TPack3, 3 > &t_coords, Tensor1< double, 3 > &t_disp)=0
 
virtual Tensor1< double, 3 > getNormal (Tensor1< double, 3 > &t_coords, Tensor1< double, 3 > &t_disp)=0
 
virtual Tensor2< double, 3, 3 > getDiffNormal (Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_disp, Tensor1< TPack1, 3 > &t_normal)=0
 
virtual double getGap (Tensor1< TPack3, 3 > &t_coords)=0
 
virtual Tensor1< double, 3 > getdGap (Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_normal)=0
 
virtual MoFEMErrorCode getBodyOptions ()=0
 
MoFEMErrorCode computeRotationMatrix ()
 
Tensor1< double, 3 > getBodyOffset ()
 
template<typename T1 , typename T2 >
Tensor1< double, 3 > & getPointCoords (Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp)
 
MoFEMErrorCode saveBasicDataOnTag (moab::Interface &moab_debug, EntityHandle &vertex)
 
virtual MoFEMErrorCode getRollerDataForTag ()=0
 

Public Attributes

double rAdius
 
double innerRadius
 
- Public Attributes inherited from RigidBodyData
const int iD
 
Index< 'i', 3 > i
 
Index< 'j', 3 > j
 
Index< 'k', 3 > k
 
VectorDouble originCoords
 
VectorDouble rollerDisp
 
VectorDouble BodyDispScaled
 
VectorDouble BodyDirectionScaled
 
double gAp
 
Tensor1< double, 3 > tNormal
 
Tensor1< double, 3 > dGap
 
Tensor1< double, 3 > pointCoords
 
Tensor1< double, 3 > closestPoint
 
Tensor1< double, 3 > defaultOrientation
 
Tensor1< double, 3 > oRientation
 
Tensor2< double, 3, 3 > rotationMat
 
Tensor2< double, 3, 3 > diffNormal
 
boost::shared_ptr< TimeAccelerogrammethodOpForRollerPosition
 
boost::shared_ptr< TimeAccelerogrammethodOpForRollerDirection
 
int bodyType
 
array< double, 9 > dataForTags
 

Additional Inherited Members

- Public Types inherited from RigidBodyData
using TPack3 = PackPtr< double *, 3 >
 
using TPack1 = PackPtr< double *, 1 >
 

Detailed Description

Definition at line 594 of file RigidBodies.hpp.

Constructor & Destructor Documentation

◆ TorusRigidBody()

TorusRigidBody::TorusRigidBody ( VectorDouble  c_coords,
VectorDouble  roller_disp,
int  id 
)
inline

Definition at line 598 of file RigidBodies.hpp.

599 : RigidBodyData(c_coords, roller_disp, id), rAdius(1), innerRadius(0.5) {
600 // , cP(R, r, 1)
601 // compute rotation matrix here
602 }
RigidBodyData()=delete

Member Function Documentation

◆ getBodyOptions()

virtual MoFEMErrorCode TorusRigidBody::getBodyOptions ( )
inlinevirtual

Implements RigidBodyData.

Definition at line 715 of file RigidBodies.hpp.

715 {
717 PetscBool rflg;
718 int nb_dirs = 3;
719 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "", "", "");
720 string param = "-inner_radius" + to_string(iD);
721 CHKERR PetscOptionsScalar(param.c_str(), "set torus small radius", "", innerRadius,
722 &innerRadius, PETSC_NULL);
723 param = "-radius" + to_string(iD);
724 CHKERR PetscOptionsScalar(param.c_str(), "set torus large Radius", "", rAdius,
725 &rAdius, PETSC_NULL);
726 param = "-direction" + to_string(iD);
727 CHKERR PetscOptionsGetRealArray(NULL, NULL, param.c_str(), &oRientation(0),
728 &nb_dirs, &rflg);
729 ierr = PetscOptionsEnd();
730 CHKERRG(ierr);
731
732 if (rflg)
734
735 // cP = make_shared<ArbitrarySurfaceData>(R, r);
736
738 }
static PetscErrorCode ierr
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
Tensor1< double, 3 > oRientation
Definition: RigidBodies.hpp:44
MoFEMErrorCode computeRotationMatrix()
Definition: RigidBodies.hpp:91
const int iD
Definition: RigidBodies.hpp:30

◆ getdGap()

Tensor1< double, 3 > TorusRigidBody::getdGap ( Tensor1< TPack3, 3 > &  t_coords,
Tensor1< TPack1, 3 > &  t_normal 
)
inlinevirtual

Implements RigidBodyData.

Definition at line 634 of file RigidBodies.hpp.

635 {
636 return getdGapImpl(t_coords, t_normal);
637 }
Tensor1< double, 3 > getdGapImpl(Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_normal)

◆ getdGapImpl()

template<typename T1 , typename T2 >
Tensor1< double, 3 > TorusRigidBody::getdGapImpl ( Tensor1< T1, 3 > &  t_coords,
Tensor1< T2, 3 > &  t_normal 
)
inline

Definition at line 710 of file RigidBodies.hpp.

711 {
712 return dGap;
713 };
Tensor1< double, 3 > dGap
Definition: RigidBodies.hpp:40

◆ getDiffNormal()

Tensor2< double, 3, 3 > TorusRigidBody::getDiffNormal ( Tensor1< TPack3, 3 > &  t_coords,
Tensor1< TPack1, 3 > &  t_disp,
Tensor1< TPack1, 3 > &  t_normal 
)
inlinevirtual

Implements RigidBodyData.

Definition at line 625 of file RigidBodies.hpp.

627 {
628 return getDiffNormalImpl(t_coords, t_disp, t_normal);
629 }
Tensor2< double, 3, 3 > getDiffNormalImpl(Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp, Tensor1< T3, 3 > &t_normal)

◆ getDiffNormalImpl()

template<typename T1 , typename T2 , typename T3 >
Tensor2< double, 3, 3 > TorusRigidBody::getDiffNormalImpl ( Tensor1< T1, 3 > &  t_coords,
Tensor1< T2, 3 > &  t_disp,
Tensor1< T3, 3 > &  t_normal 
)
inline

Definition at line 688 of file RigidBodies.hpp.

690 {
691 Tensor2<double, 3, 3> diff_normal;
692 Tensor1<double, 3> norm_diff;
693 const double clean_gap = gAp;
694 const double eps = 1e-8;
695 for (int ii = 0; ii != 3; ++ii) {
696 Tensor1<double, 3> pert_disp{t_disp(0), t_disp(1), t_disp(2)};
697 pert_disp(ii) += eps;
698 auto pert_normal = getNormal(t_coords, pert_disp);
699 norm_diff(i) = (pert_normal(i) - t_normal(i)) / eps;
700 dGap(ii) = (gAp - clean_gap) / eps;
701
702 for (int jj = 0; jj != 3; ++jj) {
703 diff_normal(jj, ii) = norm_diff(jj);
704 }
705 }
706 return diff_normal;
707 };
static const double eps
Index< 'i', 3 > i
Definition: RigidBodies.hpp:31
Tensor1< double, 3 > getNormal(Tensor1< TPack3, 3 > &t_coords, Tensor1< TPack1, 3 > &t_disp)

◆ getGap()

double TorusRigidBody::getGap ( Tensor1< TPack3, 3 > &  t_coords)
inlinevirtual

Implements RigidBodyData.

Definition at line 631 of file RigidBodies.hpp.

631 {
632 return getGapImpl(t_coords);
633 }
double getGapImpl(Tensor1< T1, 3 > &t_coords)

◆ getGapImpl()

template<typename T1 >
double TorusRigidBody::getGapImpl ( Tensor1< T1, 3 > &  t_coords)
inline

Definition at line 683 of file RigidBodies.hpp.

683 {
684 return gAp;
685 };

◆ getNormal() [1/3]

Tensor1< double, 3 > TorusRigidBody::getNormal ( Tensor1< double, 3 > &  t_coords,
Tensor1< double, 3 > &  t_disp 
)
inlinevirtual

Implements RigidBodyData.

Definition at line 620 of file RigidBodies.hpp.

621 {
622 return getNormalImpl(t_coords, t_disp);
623 }
Tensor1< double, 3 > & getNormalImpl(Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp)

◆ getNormal() [2/3]

Tensor1< double, 3 > TorusRigidBody::getNormal ( Tensor1< TPack3, 3 > &  t_coords,
Tensor1< double, 3 > &  t_disp 
)
inlinevirtual

Implements RigidBodyData.

Definition at line 616 of file RigidBodies.hpp.

617 {
618 return getNormalImpl(t_coords, t_disp);
619 }

◆ getNormal() [3/3]

Tensor1< double, 3 > TorusRigidBody::getNormal ( Tensor1< TPack3, 3 > &  t_coords,
Tensor1< TPack1, 3 > &  t_disp 
)
inlinevirtual

Implements RigidBodyData.

Definition at line 612 of file RigidBodies.hpp.

613 {
614 return getNormalImpl(t_coords, t_disp);
615 }

◆ getNormalImpl()

template<typename T1 , typename T2 >
Tensor1< double, 3 > & TorusRigidBody::getNormalImpl ( Tensor1< T1, 3 > &  t_coords,
Tensor1< T2, 3 > &  t_disp 
)
inline

Definition at line 640 of file RigidBodies.hpp.

641 {
642
643 auto t_d = getPointCoords(t_coords, t_disp);
645 pointCoords(i) = rotationMat(i, j) * t_d(j);
646 t_d(i) = pointCoords(i);
647
648 // cP->tt = 1;
649 // cP->rr = 1.;
650 // cP->R1 = 0;
651 // cP->PrintTorusDebug();
652 // cP->PrintTorusAnimDebug();
653
654 // auto closest_pt_toroid = cP->getClosestPointToToroid(t_d);
655 // closestPoint(i) = closest_pt_toroid(i);
656
657 // tNormal(j) = t_d(j) - closestPoint(j);
658 // if (cP->isPointInsideTorus(t_d))
659 // tNormal(i) *= -1;
660 // tNormal.normalize();
661
662 // gAp = tNormal(i) * (t_d(i) - closestPoint(i));
663
664 // https: // iquilezles.org/www/articles/distfunctions/distfunctions.htm
665 const double x = t_d(0);
666 const double y = t_d(1);
667 const double z = t_d(2);
668 const double RR = rAdius - innerRadius;
669 const double prod = sqrt(pow(x, 2) + pow(y, 2));
670 const double prod2 = sqrt(pow(-RR + prod, 2) + pow(z, 2));
671 gAp = -innerRadius + prod2;
672 tNormal(0) = (x * (-RR + prod)) / (prod * prod2);
673 tNormal(1) = (y * (-RR + prod)) / (prod * prod2);
674 tNormal(2) = z / prod2;
676
677 auto normal_copy = tNormal;
678 tNormal(i) = rotationMat(j, i) * normal_copy(j);
679
680 return tNormal;
681 };
Tensor1< T, Tensor_Dim > normalize()
Tensor1< double, 3 > pointCoords
Definition: RigidBodies.hpp:41
Tensor1< double, 3 > tNormal
Definition: RigidBodies.hpp:39
Tensor1< double, 3 > & getPointCoords(Tensor1< T1, 3 > &t_coords, Tensor1< T2, 3 > &t_disp)
Tensor2< double, 3, 3 > rotationMat
Definition: RigidBodies.hpp:45
Index< 'j', 3 > j
Definition: RigidBodies.hpp:32

◆ getRollerDataForTag()

MoFEMErrorCode TorusRigidBody::getRollerDataForTag ( )
inlinevirtual

Implements RigidBodyData.

Definition at line 604 of file RigidBodies.hpp.

604 {
606 bodyType = TORUS;
607 dataForTags[0] = rAdius;
610 }
@ TORUS
Definition: RigidBodies.hpp:22
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
array< double, 9 > dataForTags
Definition: RigidBodies.hpp:55

Member Data Documentation

◆ innerRadius

double TorusRigidBody::innerRadius

Definition at line 597 of file RigidBodies.hpp.

◆ rAdius

double TorusRigidBody::rAdius

Definition at line 596 of file RigidBodies.hpp.


The documentation for this struct was generated from the following file: