ReexportConnection.F90 Source File


This file depends on

sourcefile~~reexportconnection.f90~~EfferentGraph sourcefile~reexportconnection.f90 ReexportConnection.F90 sourcefile~actualconnectionpt.f90 ActualConnectionPt.F90 sourcefile~reexportconnection.f90->sourcefile~actualconnectionpt.f90 sourcefile~actualptvec_map.f90 ActualPtVec_Map.F90 sourcefile~reexportconnection.f90->sourcefile~actualptvec_map.f90 sourcefile~actualptvector.f90 ActualPtVector.F90 sourcefile~reexportconnection.f90->sourcefile~actualptvector.f90 sourcefile~connection.f90 Connection.F90 sourcefile~reexportconnection.f90->sourcefile~connection.f90 sourcefile~connectionpt.f90 ConnectionPt.F90 sourcefile~reexportconnection.f90->sourcefile~connectionpt.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~reexportconnection.f90->sourcefile~errorhandling.f90 sourcefile~extensionfamily.f90 ExtensionFamily.F90 sourcefile~reexportconnection.f90->sourcefile~extensionfamily.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~reexportconnection.f90->sourcefile~keywordenforcer.f90 sourcefile~stateitemspec.f90 StateItemSpec.F90 sourcefile~reexportconnection.f90->sourcefile~stateitemspec.f90 sourcefile~stateregistry.f90 StateRegistry.F90 sourcefile~reexportconnection.f90->sourcefile~stateregistry.f90 sourcefile~virtualconnectionpt.f90 VirtualConnectionPt.F90 sourcefile~reexportconnection.f90->sourcefile~virtualconnectionpt.f90 sourcefile~actualconnectionpt.f90->sourcefile~keywordenforcer.f90 sourcefile~actualconnectionpt.f90->sourcefile~virtualconnectionpt.f90 sourcefile~actualptvec_map.f90->sourcefile~actualptvector.f90 sourcefile~actualptvec_map.f90->sourcefile~virtualconnectionpt.f90 sourcefile~actualptvector.f90->sourcefile~actualconnectionpt.f90 sourcefile~connectionpt.f90->sourcefile~virtualconnectionpt.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~extensionfamily.f90->sourcefile~errorhandling.f90 sourcefile~extensionfamily.f90->sourcefile~stateitemspec.f90 sourcefile~stateitemextension.f90 StateItemExtension.F90 sourcefile~extensionfamily.f90->sourcefile~stateitemextension.f90 sourcefile~stateitemextensionptrvector.f90 StateItemExtensionPtrVector.F90 sourcefile~extensionfamily.f90->sourcefile~stateitemextensionptrvector.f90 sourcefile~stateitemspec.f90->sourcefile~actualptvector.f90 sourcefile~stateitemspec.f90->sourcefile~errorhandling.f90 sourcefile~stateregistry.f90->sourcefile~actualconnectionpt.f90 sourcefile~stateregistry.f90->sourcefile~connectionpt.f90 sourcefile~stateregistry.f90->sourcefile~errorhandling.f90 sourcefile~stateregistry.f90->sourcefile~extensionfamily.f90 sourcefile~stateregistry.f90->sourcefile~stateitemspec.f90 sourcefile~stateregistry.f90->sourcefile~virtualconnectionpt.f90 sourcefile~abstractregistry.f90 AbstractRegistry.F90 sourcefile~stateregistry.f90->sourcefile~abstractregistry.f90 sourcefile~componentdriver.f90 ComponentDriver.F90 sourcefile~stateregistry.f90->sourcefile~componentdriver.f90 sourcefile~componentdriverptrvector.f90 ComponentDriverPtrVector.F90 sourcefile~stateregistry.f90->sourcefile~componentdriverptrvector.f90 sourcefile~componentdrivervector.f90 ComponentDriverVector.F90 sourcefile~stateregistry.f90->sourcefile~componentdrivervector.f90 sourcefile~griddedcomponentdriver.f90 GriddedComponentDriver.F90 sourcefile~stateregistry.f90->sourcefile~griddedcomponentdriver.f90 sourcefile~multistate.f90 MultiState.F90 sourcefile~stateregistry.f90->sourcefile~multistate.f90 sourcefile~registryptr.f90 RegistryPtr.F90 sourcefile~stateregistry.f90->sourcefile~registryptr.f90 sourcefile~registryptrmap.f90 RegistryPtrMap.F90 sourcefile~stateregistry.f90->sourcefile~registryptrmap.f90 sourcefile~stateregistry.f90->sourcefile~stateitemextension.f90 sourcefile~stateregistry.f90->sourcefile~stateitemextensionptrvector.f90 sourcefile~stateitemextensionvector.f90 StateItemExtensionVector.F90 sourcefile~stateregistry.f90->sourcefile~stateitemextensionvector.f90 sourcefile~stateitemvector.f90 StateItemVector.F90 sourcefile~stateregistry.f90->sourcefile~stateitemvector.f90 sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~stateregistry.f90->sourcefile~verticalgrid.f90 sourcefile~virtualconnectionptvector.f90 VirtualConnectionPtVector.F90 sourcefile~stateregistry.f90->sourcefile~virtualconnectionptvector.f90 sourcefile~virtualptfamilymap.f90 VirtualPtFamilyMap.F90 sourcefile~stateregistry.f90->sourcefile~virtualptfamilymap.f90 sourcefile~virtualconnectionpt.f90->sourcefile~keywordenforcer.f90

Files dependent on this one

sourcefile~~reexportconnection.f90~~AfferentGraph sourcefile~reexportconnection.f90 ReexportConnection.F90 sourcefile~componentspecparser.f90 ComponentSpecParser.F90 sourcefile~componentspecparser.f90->sourcefile~reexportconnection.f90 sourcefile~add_child_by_name.f90 add_child_by_name.F90 sourcefile~add_child_by_name.f90->sourcefile~componentspecparser.f90 sourcefile~parse_child.f90 parse_child.F90 sourcefile~parse_child.f90->sourcefile~componentspecparser.f90 sourcefile~parse_children.f90 parse_children.F90 sourcefile~parse_children.f90->sourcefile~componentspecparser.f90 sourcefile~parse_component_spec.f90 parse_component_spec.F90 sourcefile~parse_component_spec.f90->sourcefile~componentspecparser.f90 sourcefile~parse_connections.f90 parse_connections.F90 sourcefile~parse_connections.f90->sourcefile~componentspecparser.f90 sourcefile~parse_geometry_spec.f90 parse_geometry_spec.F90 sourcefile~parse_geometry_spec.f90->sourcefile~componentspecparser.f90 sourcefile~parse_setservices.f90 parse_setservices.F90 sourcefile~parse_setservices.f90->sourcefile~componentspecparser.f90 sourcefile~parse_var_specs.f90 parse_var_specs.F90 sourcefile~parse_var_specs.f90->sourcefile~componentspecparser.f90 sourcefile~setservices.f90 SetServices.F90 sourcefile~setservices.f90->sourcefile~componentspecparser.f90 sourcefile~test_componentspecparser.pf Test_ComponentSpecParser.pf sourcefile~test_componentspecparser.pf->sourcefile~componentspecparser.f90

Source Code

#include "MAPL_Generic.h"

module mapl3g_ReexportConnection
   use mapl3g_StateItemSpec
   use mapl3g_ExtensionFamily
   use mapl3g_Connection
   use mapl3g_ConnectionPt
   use mapl3g_StateRegistry
   use mapl3g_VirtualConnectionPt
   use mapl3g_ActualConnectionPt
   use mapl3g_ActualPtVec_Map
   use mapl3g_ActualPtVector
   use mapl_KeywordEnforcer
   use mapl_ErrorHandling
   use esmf

   implicit none
   private

   public :: ReexportConnection

   type, extends(Connection) :: ReexportConnection
      private
      type(ConnectionPt) :: source
      type(ConnectionPt) :: destination
   contains

      procedure :: get_source
      procedure :: get_destination
      procedure :: activate
      procedure :: connect
      procedure :: connect_export_to_export
   end type ReexportConnection

   interface ReexportConnection
      module procedure :: new_ReexportConnection
   end interface ReexportConnection

contains

   function new_ReexportConnection(source, destination) result(this)
      type(ReexportConnection) :: this
      type(ConnectionPt), intent(in) :: source
      type(ConnectionPt), intent(in) :: destination

      this%source = source
      this%destination = destination

   end function new_ReexportConnection

   function get_source(this) result(source)
      type(ConnectionPt) :: source
      class(ReexportConnection), intent(in) :: this
      source = this%source
   end function get_source

   function get_destination(this) result(destination)
      type(ConnectionPt) :: destination
      class(ReexportConnection), intent(in) :: this
      destination = this%destination
   end function get_destination

   ! No-op: reexports are always active
   recursive subroutine activate(this, registry, rc)
      class(ReexportConnection), intent(in) :: this
      type(StateRegistry), target, intent(inout) :: registry
      integer, optional, intent(out) :: rc

      integer :: status
      type(StateRegistry), pointer :: src_registry
      type(ConnectionPt) :: src_pt
        
      src_pt = this%get_source()
      src_registry => registry%get_subregistry(src_pt)
      _ASSERT(associated(src_registry), 'Unknown source registry')

      call this%connect_export_to_export(registry, src_registry, _RC)

      _RETURN(_SUCCESS)
   end subroutine activate

   recursive subroutine connect(this, registry, rc)
      class(ReexportConnection), intent(in) :: this
      type(StateRegistry), target, intent(inout) :: registry
      integer, optional, intent(out) :: rc

      ! no-op
        
      _RETURN(_SUCCESS)
      _UNUSED_DUMMY(this)
      _UNUSED_DUMMY(registry)
   end subroutine connect

   ! Non-sibling connection: just propagate pointer "up"
   subroutine connect_export_to_export(this, dst_registry, src_registry, unusable, rc)
      use mapl3g_ExtensionFamily
      class(ReexportConnection), intent(in) :: this
      type(StateRegistry), intent(inout) :: dst_registry
      type(StateRegistry), intent(in) :: src_registry
      class(KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc

      integer :: status
      type(VirtualConnectionPt) :: src_pt, dst_pt
      type(ConnectionPt) :: src, dst
      type(ExtensionFamily), pointer :: family

      src = this%get_source()
      dst = this%get_destination()
      src_pt = src%v_pt
      dst_pt = dst%v_pt

      _ASSERT(.not. dst_registry%has_virtual_pt(dst_pt), 'Specified virtual point already exists in this registry')
      _ASSERT(src_registry%has_virtual_pt(src_pt), 'Specified virtual point does not exist.')

      family => src_registry%get_extension_family(src_pt, _RC)
      call dst_registry%add_family(dst_pt, family, _RC)
    
      _RETURN(_SUCCESS)
      _UNUSED_DUMMY(unusable)

   contains

      function str_replace(buffer, pattern, replacement) result(new_str)
         character(:), allocatable :: new_str
         character(*), intent(in) :: buffer
         character(*), intent(in) :: pattern
         character(*), intent(in) :: replacement

         integer :: idx

         idx = scan(buffer, pattern)
         new_str = buffer(:idx-1) // replacement // buffer(idx+len(pattern):)
      end function str_replace

   end subroutine connect_export_to_export

  end module mapl3g_ReexportConnection