Skip to content
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FC ?= gfortran
FFLAGS ?= -Wall

all: precice

precice: precice.f90
$(FC) -std=f2003 -c $^
$(FC) $(FFLAGS) -c $^

clean:
rm -f precice.mod precice.o
3 changes: 2 additions & 1 deletion examples/solverdummy/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FC ?= gfortran
FFLAGS ?= -Wall

all: solverdummy

solverdummy: solverdummy.f90
$(FC) -std=f2003 -g $^ -o $@ -I../.. $(shell pkg-config --libs libprecice)
$(FC) $(FFLAGS) -g $^ -o $@ -I../.. $(shell pkg-config --libs libprecice)

clean:
rm -f solverdummy
14 changes: 7 additions & 7 deletions examples/solverdummy/solverdummy.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ PROGRAM main
REAL(DP) :: dt
REAL(DP), DIMENSION(:), ALLOCATABLE :: vertices, writeData, readData
INTEGER, DIMENSION(:), ALLOCATABLE :: vertexIDs
integer(kind=c_int) :: c_participantNameLength = 50
integer(kind=c_int) :: c_configFileNameLength = 50

WRITE (*,*) 'DUMMY: Starting Fortran solver dummy...'
CALL get_command_argument(1, config)
CALL get_command_argument(2, participantName)

IF(participantName .eq. 'SolverOne') THEN
SELECT CASE(participantName)
CASE("SolverOne")
write(*,*) "SolverOne"
writeDataName = 'Data-One'
readDataName = 'Data-Two'
meshName = 'SolverOne-Mesh'
ENDIF
IF(participantName .eq. 'SolverTwo') THEN
CASE("SolverTwo")
write(*,*) "SolverTwo"
writeDataName = 'Data-Two'
readDataName = 'Data-One'
meshName = 'SolverTwo-Mesh'
ENDIF
CASE DEFAULT
STOP "The provided participant name is not correct. Valid names: SolverOne or SolverTwo."
ENDSELECT

rank = 0
commsize = 1
dt = 1
numberOfVertices = 3
CALL precicef_create(participantName, config, rank, commsize, 50, 50)
CALL precicef_create(participantName, config, rank, commsize)

! Allocate dummy mesh with only one vertex
CALL precicef_get_mesh_dimensions(meshName, dimensions, 50)
Expand Down
12 changes: 4 additions & 8 deletions precice.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ module precice
interface

subroutine precicef_create(participantName, configFileName, &
& solverProcessIndex, solverProcessSize, &
& participantNameLength, configFileNameLength) &
& bind(c, name='precicef_create_')
& solverProcessIndex, solverProcessSize)

import :: c_int, c_char
character(kind=c_char), dimension(*), intent(in) :: participantName
character(kind=c_char), dimension(*), intent(in) :: configFileName
character(len=*,kind=c_char), intent(in) :: participantName
character(len=*,kind=c_char), intent(in) :: configFileName
integer(kind=c_int), intent(in) :: solverProcessIndex
integer(kind=c_int), intent(in) :: solverProcessSize
integer(kind=c_int), value, intent(in) :: participantNameLength
integer(kind=c_int), value, intent(in) :: configFileNameLength
end subroutine precicef_create

subroutine precicef_create_with_communicator(participantName, configFileName, &
Expand Down Expand Up @@ -378,5 +374,5 @@ subroutine precicef_get_version_information(versionInfo, lengthVersionInfo) &
end subroutine precicef_get_version_information

end interface

end module precice