Skip to content

Commit 9b0646e

Browse files
committed
Fixes for contexts.
1 parent 43eb1a6 commit 9b0646e

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

src/fortran/cantilever.F90

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!> Main program
2-
PROGRAM CANTILEVEREXAMPLE
2+
PROGRAM CantileverExample
33

44
USE OpenCMISS
55
USE OpenCMISS_Iron
@@ -61,7 +61,8 @@ PROGRAM CANTILEVEREXAMPLE
6161
TYPE(cmfe_BasisType) :: DisplacementBasis,PressureBasis
6262
TYPE(cmfe_BoundaryConditionsType) :: BoundaryConditions
6363
TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment
64-
TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem, WorldCoordinateSystem
64+
TYPE(cmfe_ContextType) :: context
65+
TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem
6566
TYPE(cmfe_MeshType) :: Mesh
6667
TYPE(cmfe_DecompositionType) :: Decomposition
6768
TYPE(cmfe_EquationsType) :: Equations
@@ -95,8 +96,11 @@ PROGRAM CANTILEVEREXAMPLE
9596
#endif
9697

9798
!Intialise cmiss
98-
CALL cmfe_Initialise(WorldCoordinateSystem,WorldRegion,Err)
99-
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)
100104
CALL cmfe_OutputSetOn("Cantilever",Err)
101105

102106
!Read in arguments and overwrite default values
@@ -165,14 +169,15 @@ PROGRAM CANTILEVEREXAMPLE
165169

166170
!Get the number of computational nodes and this computational node number
167171
CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err)
172+
CALL cmfe_Context_ComputationEnvironmentGet(context,computationEnvironment,err)
168173
CALL cmfe_ComputationEnvironment_NumberOfWorldNodesGet(computationEnvironment,numberOfComputationalNodes,err)
169174
CALL cmfe_ComputationEnvironment_WorldNodeNumberGet(computationEnvironment,computationalNodeNumber,err)
170175

171176
NumberOfDomains=NumberOfComputationalNodes
172177

173178
!Create a 3D rectangular cartesian coordinate system
174179
CALL cmfe_CoordinateSystem_Initialise(CoordinateSystem,Err)
175-
CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
180+
CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,context,CoordinateSystem,Err)
176181
CALL cmfe_CoordinateSystem_CreateFinish(CoordinateSystem,Err)
177182

178183
!Create a region and assign the coordinate system to the region
@@ -184,7 +189,7 @@ PROGRAM CANTILEVEREXAMPLE
184189

185190
!Define basis function for displacement
186191
CALL cmfe_Basis_Initialise(DisplacementBasis,Err)
187-
CALL cmfe_Basis_CreateStart(DisplacementBasisUserNumber,DisplacementBasis,Err)
192+
CALL cmfe_Basis_CreateStart(DisplacementBasisUserNumber,context,DisplacementBasis,Err)
188193
SELECT CASE(DisplacementInterpolationType)
189194
CASE(1,2,3,4)
190195
CALL cmfe_Basis_TypeSet(DisplacementBasis,CMFE_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
@@ -202,7 +207,7 @@ PROGRAM CANTILEVEREXAMPLE
202207
IF(PressureMeshComponent/=1) THEN
203208
!Basis for pressure
204209
CALL cmfe_Basis_Initialise(PressureBasis,Err)
205-
CALL cmfe_Basis_CreateStart(PressureBasisUserNumber,PressureBasis,Err)
210+
CALL cmfe_Basis_CreateStart(PressureBasisUserNumber,context,PressureBasis,Err)
206211
SELECT CASE(PressureInterpolationType)
207212
CASE(1,2,3,4)
208213
CALL cmfe_Basis_TypeSet(PressureBasis,CMFE_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
@@ -344,7 +349,7 @@ PROGRAM CANTILEVEREXAMPLE
344349

345350
!Define the problem
346351
CALL cmfe_Problem_Initialise(Problem,Err)
347-
CALL cmfe_Problem_CreateStart(ProblemUserNumber,[CMFE_PROBLEM_ELASTICITY_CLASS,CMFE_PROBLEM_FINITE_ELASTICITY_TYPE, &
352+
CALL cmfe_Problem_CreateStart(ProblemUserNumber,context,[CMFE_PROBLEM_ELASTICITY_CLASS,CMFE_PROBLEM_FINITE_ELASTICITY_TYPE, &
348353
& CMFE_PROBLEM_NO_SUBTYPE],Problem,Err)
349354
CALL cmfe_Problem_CreateFinish(Problem,Err)
350355

@@ -421,7 +426,7 @@ PROGRAM CANTILEVEREXAMPLE
421426
CALL cmfe_Fields_ElementsExport(Fields,"./results/Cantilever","FORTRAN",Err)
422427
CALL cmfe_Fields_Finalise(Fields,Err)
423428

424-
CALL cmfe_Finalise(Err)
429+
CALL cmfe_Finalise(context,Err)
425430

426431
WRITE(*,'(A)') "Program successfully completed."
427432

@@ -436,5 +441,5 @@ SUBROUTINE HANDLE_ERROR(ERROR_STRING)
436441
STOP
437442
END SUBROUTINE HANDLE_ERROR
438443

439-
END PROGRAM CANTILEVEREXAMPLE
444+
END PROGRAM CantileverExample
440445

src/python/cantilever.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
equationsSetUserNumber = 1
3232
problemUserNumber = 1
3333

34+
worldRegion = iron.Region()
35+
iron.Context.WorldRegionGet(worldRegion)
36+
3437
# Set all diganostic levels on for testing
3538
#iron.DiagnosticsSetOn(iron.DiagnosticTypes.All,[1,2,3,4,5],"Diagnostics",["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])
3639

@@ -46,12 +49,13 @@
4649

4750
# Get the number of computational nodes and this computational node number
4851
computationEnvironment = iron.ComputationEnvironment()
52+
iron.Context.ComputationEnvironmentGet(computationEnvironment)
4953
numberOfComputationalNodes = computationEnvironment.NumberOfWorldNodesGet()
5054
computationalNodeNumber = computationEnvironment.WorldNodeNumberGet()
5155

5256
# Create a 3D rectangular cartesian coordinate system
5357
coordinateSystem = iron.CoordinateSystem()
54-
coordinateSystem.CreateStart(coordinateSystemUserNumber)
58+
coordinateSystem.CreateStart(coordinateSystemUserNumber,iron.Context)
5559
coordinateSystem.DimensionSet(3)
5660
coordinateSystem.CreateFinish()
5761

@@ -64,7 +68,7 @@
6468

6569
# Define basis
6670
basis = iron.Basis()
67-
basis.CreateStart(basisUserNumber)
71+
basis.CreateStart(basisUserNumber,iron.Context)
6872
if InterpolationType in (1,2,3,4):
6973
basis.type = iron.BasisTypes.LAGRANGE_HERMITE_TP
7074
elif InterpolationType in (7,8,9):
@@ -78,7 +82,7 @@
7882
if(usePressureBasis):
7983
# Define pressure basis
8084
pressureBasis = iron.Basis()
81-
pressureBasis.CreateStart(pressureBasisUserNumber)
85+
pressureBasis.CreateStart(pressureBasisUserNumber,iron.Context)
8286
if InterpolationType in (1,2,3,4):
8387
pressureBasis.type = iron.BasisTypes.LAGRANGE_HERMITE_TP
8488
elif InterpolationType in (7,8,9):
@@ -226,7 +230,7 @@
226230
problemSpecification = [iron.ProblemClasses.ELASTICITY,
227231
iron.ProblemTypes.FINITE_ELASTICITY,
228232
iron.ProblemSubtypes.NONE]
229-
problem.CreateStart(problemUserNumber, problemSpecification)
233+
problem.CreateStart(problemUserNumber,iron.Context,problemSpecification)
230234
problem.CreateFinish()
231235

232236
# Create the problem control loop

0 commit comments

Comments
 (0)