Skip to content

Commit c2180c3

Browse files
committed
Fixes for contexts.
1 parent fed4da1 commit c2180c3

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/fortran/diffusion_equation.F90

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PROGRAM DIFFUSION_EQUATION
1+
PROGRAM DiffusionEquation
22

33
USE OpenCMISS
44
USE OpenCMISS_Iron
@@ -55,7 +55,8 @@ PROGRAM DIFFUSION_EQUATION
5555
!CMISS variables
5656
TYPE(cmfe_BasisType) :: Basis
5757
TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment
58-
TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem,WorldCoordinateSystem
58+
TYPE(cmfe_ContextType) :: context
59+
TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem
5960
TYPE(cmfe_DecompositionType) :: Decomposition
6061
TYPE(cmfe_EquationsType) :: Equations
6162
TYPE(cmfe_EquationsSetType) :: EquationsSet
@@ -95,12 +96,15 @@ PROGRAM DIFFUSION_EQUATION
9596
#endif
9697

9798
!Intialise OpenCMISS
98-
CALL cmfe_Initialise(WorldCoordinateSystem,WorldRegion,Err)
99-
100-
CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,Err)
99+
CALL cmfe_Context_Initialise(context,err)
100+
CALL cmfe_Initialise(context,err)
101+
CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err)
102+
CALL cmfe_Region_Initialise(worldRegion,err)
103+
CALL cmfe_Context_WorldRegionGet(context,worldRegion,err)
101104

102105
!Get the computational nodes information
103106
CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err)
107+
CALL cmfe_Context_ComputationEnvironmentGet(context,computationEnvironment,err)
104108
CALL cmfe_ComputationEnvironment_NumberOfWorldNodesGet(computationEnvironment,numberOfComputationalNodes,err)
105109
CALL cmfe_ComputationEnvironment_WorldNodeNumberGet(computationEnvironment,computationalNodeNumber,err)
106110

@@ -121,7 +125,7 @@ PROGRAM DIFFUSION_EQUATION
121125

122126
!Start the creation of a new RC coordinate system
123127
CALL cmfe_CoordinateSystem_Initialise(CoordinateSystem,Err)
124-
CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
128+
CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,context,CoordinateSystem,Err)
125129
IF(NUMBER_GLOBAL_Z_ELEMENTS==0) THEN
126130
!Set the coordinate system to be 2D
127131
CALL cmfe_CoordinateSystem_DimensionSet(CoordinateSystem,2,Err)
@@ -151,7 +155,7 @@ PROGRAM DIFFUSION_EQUATION
151155

152156
!Start the creation of a basis (default is trilinear lagrange)
153157
CALL cmfe_Basis_Initialise(Basis,Err)
154-
CALL cmfe_Basis_CreateStart(BasisUserNumber,Basis,Err)
158+
CALL cmfe_Basis_CreateStart(BasisUserNumber,context,Basis,Err)
155159
IF(NUMBER_GLOBAL_Z_ELEMENTS==0) THEN
156160
!Set the basis to be a bilinear Lagrange basis
157161
!CALL cmfe_Basis_TypeSet(Basis,CMFE_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
@@ -265,7 +269,8 @@ PROGRAM DIFFUSION_EQUATION
265269
!Create the equations set analytic field variables
266270
CALL cmfe_Field_Initialise(AnalyticField,Err)
267271
IF(NUMBER_GLOBAL_Z_ELEMENTS==0) THEN
268-
CALL cmfe_EquationsSet_AnalyticCreateStart(EquationsSet,CMFE_EQUATIONS_SET_DIFFUSION_EQUATION_TWO_DIM_1, &
272+
CALL cmfe_EquationsSet_AnalyticCreateStart(EquationsSet, &
273+
& CMFE_EQUATIONS_SET_DIFFUSION_EQUATION_TWO_DIM_1, &
269274
& AnalyticFieldUserNumber, &
270275
& AnalyticField,Err)
271276
ELSE
@@ -337,8 +342,8 @@ PROGRAM DIFFUSION_EQUATION
337342

338343
!Create the problem
339344
CALL cmfe_Problem_Initialise(Problem,Err)
340-
CALL cmfe_Problem_CreateStart(ProblemUserNumber,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS,CMFE_PROBLEM_DIFFUSION_EQUATION_TYPE, &
341-
& CMFE_PROBLEM_NO_SOURCE_DIFFUSION_SUBTYPE],Problem,Err)
345+
CALL cmfe_Problem_CreateStart(ProblemUserNumber,context,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, &
346+
& CMFE_PROBLEM_DIFFUSION_EQUATION_TYPE,CMFE_PROBLEM_NO_SOURCE_DIFFUSION_SUBTYPE],Problem,Err)
342347
!Finish the creation of a problem.
343348
CALL cmfe_Problem_CreateFinish(Problem,Err)
344349

@@ -440,11 +445,10 @@ PROGRAM DIFFUSION_EQUATION
440445
! CALL WRITE_STRING_TWO_VALUE(GENERAL_OUTPUT_TYPE,"User time = ",STOP_USER_TIME(1)-START_USER_TIME(1),", System time = ", &
441446
! & STOP_SYSTEM_TIME(1)-START_SYSTEM_TIME(1),ERR,ERROR,*999)
442447
!
443-
!CALL CMFE_FINALISE(ERR,ERROR,*999)
444-
!CALL cmfe_Finalise(Err)
448+
CALL cmfe_Finalise(context,Err)
445449
WRITE(*,'(A)') "Program successfully completed."
446450

447451

448452
STOP
449453

450-
END PROGRAM DIFFUSION_EQUATION
454+
END PROGRAM DiffusionEquation

0 commit comments

Comments
 (0)