fossil_test_resize Program

  • Uses:

  • flap
  • fossil
  • penf
  • vecfor
program~~fossil_test_resize~~UsesGraph program~fossil_test_resize fossil_test_resize flap flap flap->program~fossil_test_resize vecfor vecfor vecfor->program~fossil_test_resize module~fossil_file_stl_object fossil_file_stl_object vecfor->module~fossil_file_stl_object module~fossil_facet_object fossil_facet_object vecfor->module~fossil_facet_object module~fossil_aabb_tree_object fossil_aabb_tree_object vecfor->module~fossil_aabb_tree_object module~fossil_aabb_node_object fossil_aabb_node_object vecfor->module~fossil_aabb_node_object module~fossil_aabb_object fossil_aabb_object vecfor->module~fossil_aabb_object module~fossil fossil module~fossil->program~fossil_test_resize penf penf penf->program~fossil_test_resize penf->module~fossil_file_stl_object penf->module~fossil_facet_object penf->module~fossil_aabb_tree_object module~fossil_utils fossil_utils penf->module~fossil_utils penf->module~fossil_aabb_node_object penf->module~fossil_aabb_object module~fossil_file_stl_object->module~fossil module~fossil_facet_object->module~fossil module~fossil_facet_object->module~fossil_file_stl_object module~fossil_facet_object->module~fossil_aabb_tree_object module~fossil_facet_object->module~fossil_aabb_node_object module~fossil_facet_object->module~fossil_aabb_object module~fossil_aabb_tree_object->module~fossil_file_stl_object module~fossil_utils->module~fossil_file_stl_object module~fossil_utils->module~fossil_facet_object module~fossil_utils->module~fossil_aabb_object iso_fortran_env iso_fortran_env iso_fortran_env->module~fossil_file_stl_object iso_fortran_env->module~fossil_facet_object iso_fortran_env->module~fossil_aabb_tree_object iso_fortran_env->module~fossil_aabb_node_object iso_fortran_env->module~fossil_aabb_object module~fossil_aabb_node_object->module~fossil_aabb_tree_object module~fossil_aabb_object->module~fossil_aabb_tree_object module~fossil_aabb_object->module~fossil_aabb_node_object
Help


FOSSIL, test resize STL.

Calls

program~~fossil_test_resize~~CallsGraph program~fossil_test_resize fossil_test_resize proc~cli_parse~5 cli_parse program~fossil_test_resize->proc~cli_parse~5
Help

Source Code


Variables

Type AttributesNameInitial
type(file_stl_object) :: file_stl

STL file.

character(len=999) :: file_name_stl

Input STL file name.

type(vector_R8P) :: factor

Vectorial factor.

real(kind=R8P) :: x

Scalar factors.

real(kind=R8P) :: y

Scalar factors.

real(kind=R8P) :: z

Scalar factors.

logical :: are_tests_passed(4)

Result of tests check.


Subroutines

subroutine cli_parse()

Build and parse test cli.

Arguments

None

Source Code

program fossil_test_resize
!< FOSSIL, test resize STL.

use flap, only : command_line_interface
use fossil, only : file_stl_object
use penf, only : I4P, R8P
use vecfor, only : ex_R8P, ey_R8P, ez_R8P, vector_R8P

implicit none

type(file_stl_object) :: file_stl            !< STL file.
character(999)        :: file_name_stl       !< Input STL file name.
type(vector_R8P)      :: factor              !< Vectorial factor.
real(R8P)             :: x, y, z             !< Scalar factors.
logical               :: are_tests_passed(4) !< Result of tests check.

are_tests_passed = .false.

call cli_parse
call file_stl%initialize(file_name=trim(adjustl(file_name_stl)))
call file_stl%load_from_file(guess_format=.true.)

call file_stl%resize(factor=factor)
call file_stl%save_into_file(file_name='fossil_test_resize-factor.stl')
are_tests_passed(1) = nint(file_stl%distance(point=2 * ex_R8P + 0 * ey_R8P + 0 * ez_R8P)) == 0
call file_stl%resize(factor=factor/4._R8P)
call file_stl%resize(x=x)
are_tests_passed(2) = nint(file_stl%distance(point=2 * ex_R8P + 0 * ey_R8P + 0 * ez_R8P)) == 0
call file_stl%resize(y=y)
are_tests_passed(3) = nint(file_stl%distance(point=2 * ex_R8P + 2 * ey_R8P + 0 * ez_R8P)) == 0
call file_stl%resize(z=z)
are_tests_passed(4) = nint(file_stl%distance(point=2 * ex_R8P + 2 * ey_R8P + 2 * ez_R8P)) == 0
call file_stl%save_into_file(file_name='fossil_test_resize-xyz.stl')

print '(A,L1)', 'Are all tests passed? ', all(are_tests_passed)
contains
  subroutine cli_parse()
  !< Build and parse test cli.
  type(command_line_interface) :: cli        !< Test command line interface.
  real(R8P)                    :: factor_(3) !< Vectorial factor.
  integer(I4P)                 :: error      !< Error trapping flag.

  call cli%init(progname='fossil_test_resize',                              &
                authors='S. Zaghi',                                         &
                help='Usage: ',                                             &
                examples=["fossil_test_resize --stl src/tests/dragon.stl"], &
                epilog=new_line('a')//"all done")

  call cli%add(switch='--stl',               &
               help='STL (input) file name', &
               required=.false.,             &
               def='src/tests/cube.stl',     &
               act='store')

  call cli%add(switch='--factor',       &
               help='vectorial factor', &
               required=.false.,        &
               nargs='+',               &
               def='2.0 2.0 2.0',       &
               act='store')

  call cli%add(switch='--x',     &
               help='factor x',  &
               required=.false., &
               def='2.0',        &
               act='store')

  call cli%add(switch='--y',     &
               help='factor y',  &
               required=.false., &
               def='2.0',        &
               act='store')

  call cli%add(switch='--z',     &
               help='factor z',  &
               required=.false., &
               def='2.0',        &
               act='store')

  call cli%parse(error=error) ; if (error/=0) stop

  call cli%get(switch='--stl',    val=file_name_stl, error=error) ; if (error/=0) stop
  call cli%get(switch='--factor', val=factor_,       error=error) ; if (error/=0) stop
  call cli%get(switch='--x',      val=x,             error=error) ; if (error/=0) stop
  call cli%get(switch='--y',      val=y,             error=error) ; if (error/=0) stop
  call cli%get(switch='--z',      val=z,             error=error) ; if (error/=0) stop
  factor%x = factor_(1)
  factor%y = factor_(2)
  factor%z = factor_(3)
  endsubroutine cli_parse
endprogram fossil_test_resize