Skip to content

Commit 4dba25e

Browse files
committed
Fixes for contexts.
1 parent 4c50677 commit 4dba25e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/fortran/diffusion_equation_with_linear_source.F90

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ PROGRAM DiffusionEquationWithLinearSource
4343
TYPE(cmfe_BasisType) :: basis
4444
TYPE(cmfe_BoundaryConditionsType) :: boundaryConditions
4545
TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment
46-
TYPE(cmfe_CoordinateSystemType) :: coordinateSystem,worldCoordinateSystem
46+
TYPE(cmfe_ContextType) :: context
47+
TYPE(cmfe_CoordinateSystemType) :: coordinateSystem
4748
TYPE(cmfe_DecompositionType) :: decomposition
4849
TYPE(cmfe_EquationsType) :: equations
4950
TYPE(cmfe_EquationsSetType) :: equationsSet
@@ -78,13 +79,18 @@ PROGRAM DiffusionEquationWithLinearSource
7879
!-----------------------------------------------------------------------------------------------------------
7980

8081
!Intialise OpenCMISS
81-
CALL cmfe_Initialise(worldCoordinateSystem,worldRegion,err)
82+
CALL cmfe_Context_Initialise(context,err)
83+
CALL cmfe_Initialise(context,err)
84+
CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err)
85+
CALL cmfe_Region_Initialise(worldRegion,err)
86+
CALL cmfe_Context_WorldRegionGet(context,worldRegion,err)
8287

8388
!Set the random seeds so we can test multi process
84-
CALL cmfe_RandomSeedsSet(9999,err)
89+
CALL cmfe_Context_RandomSeedsSet(context,9999,err)
8590

8691
!Get the computational nodes information
8792
CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err)
93+
CALL cmfe_Context_ComputationEnvironmentGet(context,computationEnvironment,err)
8894
CALL cmfe_ComputationEnvironment_NumberOfWorldNodesGet(computationEnvironment,numberOfComputationalNodes,err)
8995
CALL cmfe_ComputationEnvironment_WorldNodeNumberGet(computationEnvironment,computationalNodeNumber,err)
9096

@@ -101,7 +107,7 @@ PROGRAM DiffusionEquationWithLinearSource
101107

102108
!Start the creation of a new RC coordinate system
103109
CALL cmfe_CoordinateSystem_Initialise(coordinateSystem,err)
104-
CALL cmfe_CoordinateSystem_CreateStart(coordinateSystemUserNumber,coordinateSystem,err)
110+
CALL cmfe_CoordinateSystem_CreateStart(coordinateSystemUserNumber,context,coordinateSystem,err)
105111
IF(numberOfGlobalZElements==0) THEN
106112
!Set the coordinate system to be 2D
107113
CALL cmfe_CoordinateSystem_DimensionSet(coordinateSystem,2,err)
@@ -131,7 +137,7 @@ PROGRAM DiffusionEquationWithLinearSource
131137

132138
!Start the creation of a basis (default is trilinear lagrange)
133139
CALL cmfe_Basis_Initialise(basis,err)
134-
CALL cmfe_Basis_CreateStart(basisUserNumber,basis,err)
140+
CALL cmfe_Basis_CreateStart(basisUserNumber,context,basis,err)
135141
IF(numberOfGlobalZElements==0) THEN
136142
!Set the basis to be a biquadratic Lagrange basis
137143
CALL cmfe_Basis_NumberOfXiSet(basis,2,err)
@@ -284,8 +290,8 @@ PROGRAM DiffusionEquationWithLinearSource
284290

285291
!Create the problem
286292
CALL cmfe_Problem_Initialise(problem,err)
287-
CALL cmfe_Problem_CreateStart(problemUserNumber,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS,CMFE_PROBLEM_DIFFUSION_EQUATION_TYPE, &
288-
& CMFE_PROBLEM_LINEAR_SOURCE_DIFFUSION_SUBTYPE],problem,err)
293+
CALL cmfe_Problem_CreateStart(problemUserNumber,context,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, &
294+
& CMFE_PROBLEM_DIFFUSION_EQUATION_TYPE,CMFE_PROBLEM_LINEAR_SOURCE_DIFFUSION_SUBTYPE],problem,err)
289295
!Finish the creation of a problem.
290296
CALL cmfe_Problem_CreateFinish(problem,err)
291297

@@ -371,7 +377,7 @@ PROGRAM DiffusionEquationWithLinearSource
371377
CALL cmfe_Fields_ElementsExport(fields,"diffusion_equation_linear_source","FORTRAN",err)
372378
CALL cmfe_Fields_Finalise(fields,err)
373379

374-
CALL cmfe_Finalise(err)
380+
CALL cmfe_Finalise(context,err)
375381
WRITE(*,'(A)') "Program successfully completed."
376382

377383
STOP

0 commit comments

Comments
 (0)