<commit_before>PROGRAM Test_TestMeshMapping

   USE NWTC_Library
   IMPLICIT NONE   

   TYPE(meshtype) :: mesh1_I, mesh1_O
   TYPE(meshtype) :: mesh2_I, mesh2_O 
   TYPE(meshtype) :: mesh_Motion_1PT, mesh1_I_1PT, mesh2_O_1PT

#ifdef MESH_DEBUG     
   TYPE(meshtype)    :: mesh2_O_1PT_augmented, mesh2_O_1PT_lumped, mesh1_I_1PT_lumped
   TYPE(MeshMapType) :: Map_Mod2_O_1PT_augmented, Map_Mod2_O_1PT_lumped, Map_Mod1_I_1PT_lumped
#endif      
   
   TYPE(MeshMapType) :: Map_Mod1_Mod2        ! Data for mapping meshes from mod1 to mod2
   TYPE(MeshMapType) :: Map_Mod2_Mod1        ! Data for mapping meshes from mod1 to mod2
   TYPE(MeshMapType) :: Map_Mod2_O_1PT, Map_Mod1_I_1PT
   
   REAL(ReKi)     :: Orientation(3,3)
   REAL(ReKi)     :: position(3)
   REAL(ReKi)     :: Angle
   !REAL(DbKi)     :: AngleD
   !
   INTEGER :: NNodes, I,J, n1, n2
   
   INTEGER :: un_out        ! UNITS for File I/O
   
   INTEGER :: Mesh1Type
   INTEGER :: Mesh2Type
   
   INTEGER(IntKi) :: ErrStat
   CHARACTER(1024) :: ErrMsg   
   CHARACTER(256) :: PrintWarnF, PrintWarnM
   
   INTEGER :: TestNumber 
   CHARACTER(256) :: BinOutputName 
  TYPE(ProgDesc) :: Ver
  
   real(reki) :: testAry(4) 
   real(reKi) :: TmpR4
   real(DbKi) :: TmpR8
   
   CHARACTER(7) :: TESTME(2)
   CHARACTER(1024)                       :: CheckpointRoot                          ! Rootname of the checkpoint file
   CHARACTER(20)                         :: FlagArg                                 ! flag argument from command line
logical :: LtestAry(3,2) = .false.
LOGICAL :: LPary(6), mask2(3,2)
integer :: IPary(6), itestary(3,2)

LtestAry(2:3,2) = .TRUE. 
mask2=.true.


   CALL NWTC_Init()
   
   TESTME(1) = "TRY THIS"
   tESTME(2) = "NaN"
   
   PRINT *, SIZE(TESTME), LEN(TESTME), LEN(TestMe(1))

   PRINT *, testmE
   
   read(TestME(2),*), tmpR4
   print *, 'real number = ', tmpR4
   
   do j=1,2
   do i=1,len(TestMe)
      print *, TestMe(j)(i:i)
   end do   
   end do
   
   Ver    = ProgDesc( 'Test Program', 'v8.11.00a-bjj', '15-Apr-2015' ) ! The version number of this module

   call DispCopyrightLicense( Ver, "This is another comment. I'm going to see that it's really long, hopefuly more than 98 chraacters, so it prints on two lines." )
   
   PRINT *,'-------------'   
   PRINT *, PACK(LtestAry,.true.)
   LPARY = PACK(LtestAry,.true.)
   PRINT *, PACK(LPARY,.true.)
   IPary = transfer(lpary,ipary)
   PRINT *, PACK(IPary,.true.)
   
   
   ltestary = unpack( TRANSFER( iPary, LPary ), mask2, .true. )
  print *, ltestary
  
   itestary = UNPACK( IPary, mask2, 0 )
   PRINT *, PACK(itestary,.true.)
   !LtestAry = TRANSFER( iary, LtestAry)
   
   PRINT *, LtestAry

   
   
   PRINT *,'-------------'   
   ProgName = 'FAST'
   CheckpointRoot = ""
   CALL CheckArgs( CheckpointRoot, ErrStat, Flag=FlagArg )  ! if ErrStat /= ErrID_None, we'll ignore and deal with the problem when we try to read the input file
   print *, 'FlagArg       =', TRIM(FlagArg)
   print *, 'CheckpointRoot=', TRIM(CheckpointRoot)
   PRINT *,'-------------'
   
   
   STOP
   
   !angle=0.001_ReKi;    print *, angle, equalrealnos(angle, 0.0_ReKi)
   !angle=0.0001_ReKi;   print *, angle, equalrealnos(angle, 0.0_ReKi)
   !angle=0.00001_ReKi;  print *, angle, equalrealnos(angle, 0.0_ReKi)
   !angle=0.000001_ReKi; print *, angle, equalrealnos(angle, 0.0_ReKi)
   !print *, epsilon(angle), sqrt(epsilon(angle))
   !
   !angleD=0.001_DbKi;    print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !angleD=0.0001_DbKi;   print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !angleD=0.00001_DbKi;  print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !angleD=0.000001_DbKi; print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !print *, epsilon(angleD), sqrt(epsilon(angleD))
   !
   testAry = (/5431999., 274118.281250000, -5431999., -274118.281250000/)
   
   print *, sum(testAry)<commit_msg>+ updated DCM_logMap routines to use a different equation near theta == pi; new equation works for more than just pi. In double precision, this removed the spikes I was seeing in AD15's theta; in single precision, the spikes are 0.02 degrees (~1E-4 radians) + modified check on mesh mapping with points projected onto line2 element. If we are numerically equal within single-precision of 0 or 1, we will consider it "on" the element. Sri was getting error saying it couldn't map, even though it was 1E-14<commit_after>PROGRAM Test_TestMeshMapping

   USE NWTC_Library
   IMPLICIT NONE   

   TYPE(meshtype) :: mesh1_I, mesh1_O
   TYPE(meshtype) :: mesh2_I, mesh2_O 
   TYPE(meshtype) :: mesh_Motion_1PT, mesh1_I_1PT, mesh2_O_1PT

#ifdef MESH_DEBUG     
   TYPE(meshtype)    :: mesh2_O_1PT_augmented, mesh2_O_1PT_lumped, mesh1_I_1PT_lumped
   TYPE(MeshMapType) :: Map_Mod2_O_1PT_augmented, Map_Mod2_O_1PT_lumped, Map_Mod1_I_1PT_lumped
#endif      
   
   TYPE(MeshMapType) :: Map_Mod1_Mod2        ! Data for mapping meshes from mod1 to mod2
   TYPE(MeshMapType) :: Map_Mod2_Mod1        ! Data for mapping meshes from mod1 to mod2
   TYPE(MeshMapType) :: Map_Mod2_O_1PT, Map_Mod1_I_1PT
   
   REAL(ReKi)     :: Orientation(3,3), dcm(3,3)
   REAL(ReKi)     :: position(3)
   REAL(ReKi)     :: Angle
   !REAL(DbKi)     :: AngleD
   !
   INTEGER :: NNodes, I,J,k, n1, n2
   
   INTEGER :: un_out        ! UNITS for File I/O
   
   INTEGER :: Mesh1Type
   INTEGER :: Mesh2Type
   
   INTEGER(IntKi) :: ErrStat
   CHARACTER(1024) :: ErrMsg   
   CHARACTER(256) :: PrintWarnF, PrintWarnM
   
   INTEGER :: TestNumber 
   CHARACTER(256) :: BinOutputName 
  TYPE(ProgDesc) :: Ver
  
   real(reki) :: testAry(4) 
   real(reKi) :: TmpR4
   real(DbKi) :: TmpR8
   
   CHARACTER(7) :: TESTME(2)
   CHARACTER(1024)                       :: CheckpointRoot                          ! Rootname of the checkpoint file
   CHARACTER(20)                         :: FlagArg                                 ! flag argument from command line
   
   
   real(reki) :: angles(9) = (/ -180.0, -150.0, -120.0, -45.0, 0.0, 15.0, 75.0, 90.0, 180.0/)
   real(reki) :: theta(3), theta2(3)
   
   
logical :: LtestAry(3,2) = .false.
LOGICAL :: LPary(6), mask2(3,2)
integer :: IPary(6), itestary(3,2)

LtestAry(2:3,2) = .TRUE. 
mask2=.true.


   CALL NWTC_Init()
   
   
   Ver    = ProgDesc( 'Test Program', 'v8.11.00a-bjj', '15-Apr-2015' ) ! The version number of this module

!.......................................
   dcm(1,1)= 0.9612699
   dcm(2,1)=-0.2755210
   dcm(3,1)=-0.0069816
   dcm(1,2)=-0.2755206
   dcm(2,2)=-0.9612947
   dcm(3,2)= 0.0010476
   dcm(1,3)=-0.0070000	
   dcm(2,3)= 0.0009166
   dcm(3,3)=-0.9999752
   
do i=1,2

   print *, '-----------------------------'
   call wrmatrix(dcm,cu,'F15.6','DCM')
   call DCM_LogMap(dcm, theta, ErrStat,ErrMsg)

   print *, ''
   print *,'log map of DCM:'
   print *, theta
   
   print *, ''
   dcm = DCM_exp(theta)
   call wrmatrix(dcm,cu,'F15.6','DCM of log map:')


!dcm = reshape( (/ 0.96127,-0.27552,-0.00683,-0.27552,-0.96129,0.00161,-0.00701,0.00033,-0.99998/), (/3,3/) )   
dcm = reshape( (/ 0.96128  ,-0.27552  ,-0.00465  ,-0.27551  ,-0.96130  ,0.00221  ,-0.00508  ,-0.00085  ,-0.99999  /), (/3,3/) )   
dcm = reshape( (/ 0.9612845,-0.2755184,-0.0046458,-0.2755108,-0.9612955,0.0022143,-0.0050761,-0.0008486,-0.9999868/), (/3,3/) )

   !dcm(1,1)=  0.9613009
   !dcm(2,1)= -0.2754988
   !dcm(3,1)= -0.0010420
   !dcm(1,2)= -0.2754033
   !dcm(2,2)= -0.9610544
   !dcm(3,2)=  0.0229664
   !dcm(1,3)= -0.0073287
   !dcm(2,3)= -0.0217907
   !dcm(3,3)= -0.9997358

end do
!.......................................


stop
   
   
   do i=1,size(angles)
      theta(1) = angles(i)*D2R
      do j=1,size(angles)
         theta(2) = angles(j)*D2R
         do k=1,size(angles)
            theta(3) = angles(k)*D2R
            print *, ''
            print *, 'orig theta = ', theta*R2D
            Orientation = EulerConstruct(theta)
            call wrmatrix(Orientation,cu,'f10.5')
            theta2      = EulerExtract(Orientation)
            Orientation = EulerConstruct(theta2)
            print *, ' new theta = ', theta2*R2D
            call wrmatrix(Orientation,cu,'f10.5')
         end do
      end do
   end do
   
            
   
   STOP
   
   !angle=0.001_ReKi;    print *, angle, equalrealnos(angle, 0.0_ReKi)
   !angle=0.0001_ReKi;   print *, angle, equalrealnos(angle, 0.0_ReKi)
   !angle=0.00001_ReKi;  print *, angle, equalrealnos(angle, 0.0_ReKi)
   !angle=0.000001_ReKi; print *, angle, equalrealnos(angle, 0.0_ReKi)
   !print *, epsilon(angle), sqrt(epsilon(angle))
   !
   !angleD=0.001_DbKi;    print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !angleD=0.0001_DbKi;   print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !angleD=0.00001_DbKi;  print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !angleD=0.000001_DbKi; print *, angleD, equalrealnos(angleD, 0.0_DbKi)
   !print *, epsilon(angleD), sqrt(epsilon(angleD))
   !
   testAry = (/5431999., 274118.281250000, -5431999., -274118.281250000/)
   
   print *, sum(testAry)
{'fraction_non_alphanumeric': 0.15306236703616616, 'fraction_numerical': 0.09349456947710223, 'mean_word_length': 2.58714859437751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5554050', 'n_tokens_mistral': 4110, 'n_tokens_neox': 3540, 'n_words': 709}