Commit 07de6516 authored by Henderson, Shane's avatar Henderson, Shane
Browse files

Merge branch 'abstract_shape_type' into 'master'

Implements CylinderShellType

See merge request https://code.ornl.gov/futility/Futility/-/merge_requests/419
parents 53704f0c bc863d70
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ TRIBITS_ADD_LIBRARY(Utils
      Geom_Points.f90
      Geom_Line.f90
      Geom_Plane.f90
      Geom_Shape.f90
      Geom_CircCyl.f90
      Geom_Box.f90
      Geom_Graph.f90
+53 −47

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ PUBLIC :: LineType
PUBLIC :: PlaneType
PUBLIC :: CircleType
PUBLIC :: CylinderType
PUBLIC :: CylinderShellType
PUBLIC :: OBBoxType
PUBLIC :: ABBoxType
PUBLIC :: PolygonType
+25 −30
Original line number Diff line number Diff line
@@ -18,10 +18,13 @@
!> clearing the OBBoxType, and intersecting it with a line.
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
MODULE Geom_Box
#include "Futility_DBC.h"
USE Futility_DBC
USE IntrType
USE Geom_Points
USE Geom_Line
USE Geom_Plane
USE Geom_Shape
IMPLICIT NONE

PRIVATE
@@ -62,11 +65,11 @@ TYPE OBBoxType
    PROCEDURE,PASS :: inside => inside_OBBoxType
ENDTYPE OBBoxType

!> @breif Lightweight type for axis-aligned box
!> @brief Lightweight type for axis-aligned box
!>
!> Derived type for storing a simple axis-aligned box. This is used to bound
!> each of the cuboids for the cartesian mesh overlay.
TYPE :: ABBoxType
TYPE,EXTENDS(ShapeType) :: ABBoxType
  !> Minimum x extent of the box
  REAL(SRK) :: xMin=0.0_SRK
  !> Maximum x extent of the box
@@ -79,12 +82,6 @@ TYPE :: ABBoxType
  REAL(SRK) :: zMin=0.0_SRK
  !> Maximum z extent of the box
  REAL(SRK) :: zMax=0.0_SRK
  !> Is the origin of our coordinate system inside of the box
  LOGICAL(SBK) :: isOrigin=.FALSE.
  !> Is the box 3D?
  LOGICAL(SBK) :: is3D=.FALSE.
  !> If the box has been assigned values
  LOGICAL(SBK) :: isSet=.FALSE.
!
!List of type bound procedure for the object
  CONTAINS
@@ -540,44 +537,42 @@ ENDSUBROUTINE set_ABBoxType
!
!-------------------------------------------------------------------------------
!> @brief Clears the attributes of a ABBoxType object
!> @param thisABB the ABBoxType object to be cleared
!> @param this the ABBoxType object to be cleared
!>
ELEMENTAL SUBROUTINE clear_ABBoxType(thisABB)
  CLASS(ABBoxType),INTENT(INOUT) :: thisABB
  thisABB%xMin=0.0_SRK
  thisABB%xMax=0.0_SRK
  thisABB%yMin=0.0_SRK
  thisABB%yMax=0.0_SRK
  thisABB%zMin=0.0_SRK
  thisABB%zMax=0.0_SRK
  thisABB%is3D=.FALSE.
  thisABB%isSet=.FALSE.
  thisABB%isOrigin=.FALSE.
ELEMENTAL SUBROUTINE clear_ABBoxType(this)
  CLASS(ABBoxType),INTENT(INOUT) :: this
  this%xMin=0.0_SRK
  this%xMax=0.0_SRK
  this%yMin=0.0_SRK
  this%yMax=0.0_SRK
  this%zMin=0.0_SRK
  this%zMax=0.0_SRK
  CALL this%clearShape()
ENDSUBROUTINE clear_ABBoxType
!
!-------------------------------------------------------------------------------
!> @brief Tests if a point is inside a box
!> @param thisABB the box
!> @param this the box
!> @param p the point
!> @returns inside .TRUE. if p is inside the box.
!>
ELEMENTAL FUNCTION inside_ABBoxType(thisABB,p) RESULT(inside)
  CLASS(ABBoxType),INTENT(IN) :: thisABB
ELEMENTAL FUNCTION inside_ABBoxType(this,p) RESULT(inside)
  CLASS(ABBoxType),INTENT(IN) :: this
  TYPE(PointType),INTENT(IN) :: p
  REAL(SRK),PARAMETER :: fuzz=1e-6_SRK
  LOGICAL(SBK) :: inside

  inside=.FALSE.
  IF(p%dim > 1) THEN
    inside=((p%coord(1) > thisABB%xMin-fuzz) .AND. &
        (p%coord(1) < thisABB%xMax+fuzz) .AND. &
        (p%coord(2) > thisABB%yMin-fuzz) .AND. &
        (p%coord(2) < thisABB%yMax+fuzz))
    inside=((p%coord(1) > this%xMin-fuzz) .AND. &
        (p%coord(1) < this%xMax+fuzz) .AND. &
        (p%coord(2) > this%yMin-fuzz) .AND. &
        (p%coord(2) < this%yMax+fuzz))
  ENDIF
  IF(p%dim == 3 .AND. thisABB%is3D) THEN
  IF(p%dim == 3 .AND. this%is3D) THEN
    inside=(inside .AND. &
        (p%coord(3) > thisABB%zMin-fuzz) .AND. &
        (p%coord(3) < thisABB%zMax+fuzz))
        (p%coord(3) > this%zMin-fuzz) .AND. &
        (p%coord(3) < this%zMax+fuzz))
  ENDIF

ENDFUNCTION inside_ABBoxType
+198 −12

File changed.

Preview size limit exceeded, changes collapsed.

Loading