Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8f25339
Merge branch 'dladd_phd' of https://github.com/dladd/iron into develop
chrispbradley Jul 4, 2017
73f4477
Merge branch 'develop' of https://github.com/OpenCMISS/iron into develop
chrispbradley Jul 5, 2017
857b2a4
Merge branch 'develop' of https://github.com/OpenCMISS/iron into develop
chrispbradley Jul 23, 2017
7e147e5
Change Computational to Computation to avoid symbol length problems. …
chrispbradley Sep 24, 2017
4e8040f
Tidy up computation routines. Make mpiCommunicator mpiWorldCommunicat…
chrispbradley Sep 24, 2017
9c25f68
Initial code for work groups.
chrispbradley Sep 26, 2017
107492b
Fixes for workgroups.
chrispbradley Sep 27, 2017
cea17d4
More work group tidy ups. Allow decompositions and problem to have th…
chrispbradley Sep 27, 2017
fb60fb0
Updating
chrispbradley Apr 9, 2018
b2c5f29
Updating to prime develop
chrispbradley Apr 9, 2018
c5c2114
Merging from old Workgroups branch.
chrispbradley Apr 10, 2018
d4bded0
Tidy up
chrispbradley Apr 11, 2018
4ead17b
Backup for contexts change.
chrispbradley Apr 17, 2018
a2a81a2
Adjust node routines for new code style.
chrispbradley Apr 17, 2018
aaabd63
Most changes made. Start of debugging.
chrispbradley Apr 24, 2018
0513f9b
Bug fixes.
chrispbradley Apr 26, 2018
bdce89b
More bug fixes. Examples now pass.
chrispbradley Apr 27, 2018
3daee81
Merge develop
chrispbradley Apr 27, 2018
f7299d2
Fix bug in backsubstitution for sparse equations matrices.
chrispbradley Apr 27, 2018
e8830c4
Add in context files.
chrispbradley May 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions bindings/c/tests/complex_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,22 @@

int main()
{
/* int WorldCoordinateSystemUserNumber;
/* int ContextUserNumber;
int WorldRegionUserNumber; */
cmfe_CoordinateSystemType WorldCoordinateSystem=(cmfe_CoordinateSystemType)NULL;
cmfe_ContextType Context=(cmfe_ContextType)NULL;
cmfe_RegionType WorldRegion=(cmfe_RegionType)NULL,Region=(cmfe_RegionType)NULL;
char Label[STRING_SIZE];
int Err;

Err = cmfe_CoordinateSystem_Initialise(&WorldCoordinateSystem);
CHECK_ERROR("Initialising world coordinate system");
Err = cmfe_Region_Initialise(&WorldRegion);
CHECK_ERROR("Initialising world region");
if(cmfe_Initialise(WorldCoordinateSystem,WorldRegion) == CMFE_NO_ERROR)
Err = cmfe_Context_Initialise(&Context);
CHECK_ERROR("Initialising context");
if(cmfe_Initialise(Context) == CMFE_NO_ERROR)
{

Err = cmfe_Region_Initialise(&WorldRegion);
CHECK_ERROR("Initialising world region");
Err = cmfe_Context_WorldRegionGet(Context,WorldRegion);
CHECK_ERROR("Get world region");
Err = cmfe_Region_LabelGet(WorldRegion,STRING_SIZE,Label);
printf("The world region label is '%s'.\n",Label);

Expand All @@ -95,7 +97,7 @@ int main()

Err = cmfe_Region_Finalise(&Region);

Err = cmfe_Finalise();
Err = cmfe_Finalise(Context);
}

return Err;
Expand Down
37 changes: 21 additions & 16 deletions bindings/c/tests/laplace.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,21 @@ int main()
{
cmfe_BasisType Basis = (cmfe_BasisType)NULL;
cmfe_BoundaryConditionsType BoundaryConditions=(cmfe_BoundaryConditionsType)NULL;
cmfe_CoordinateSystemType CoordinateSystem=(cmfe_CoordinateSystemType)NULL,WorldCoordinateSystem=(cmfe_CoordinateSystemType)NULL;
cmfe_ComputationEnvironmentType ComputationEnvironment = (cmfe_ComputationEnvironmentType)NULL;
cmfe_ContextType Context = (cmfe_ContextType)NULL;
cmfe_CoordinateSystemType CoordinateSystem=(cmfe_CoordinateSystemType)NULL;
cmfe_DecompositionType Decomposition=(cmfe_DecompositionType)NULL;
cmfe_EquationsType Equations=(cmfe_EquationsType)NULL;
cmfe_EquationsSetType EquationsSet=(cmfe_EquationsSetType)NULL;
cmfe_FieldType GeometricField=(cmfe_FieldType)NULL,DependentField=(cmfe_FieldType)NULL,EquationsSetField=(cmfe_FieldType)NULL;
cmfe_FieldsType Fields=(cmfe_FieldsType)NULL;
cmfe_GeneratedMeshType GeneratedMesh=(cmfe_GeneratedMeshType)NULL;
cmfe_MeshType Mesh=(cmfe_MeshType)NULL;
cmfe_ProblemType Problem=(cmfe_ProblemType)NULL;
cmfe_RegionType Region=(cmfe_RegionType)NULL,WorldRegion=(cmfe_RegionType)NULL;
cmfe_SolverType Solver=(cmfe_SolverType)NULL;
cmfe_SolverEquationsType SolverEquations=(cmfe_SolverEquationsType)NULL;

int NumberOfComputationalNodes,ComputationalNodeNumber;
int NumberOfComputationNodes,ComputationNodeNumber;
int EquationsSetIndex;
int FirstNodeNumber,LastNodeNumber;
int FirstNodeDomain,LastNodeDomain;
Expand All @@ -119,20 +120,24 @@ int main()

ControlLoopIdentifier[0]=CMFE_CONTROL_LOOP_NODE;

Err = cmfe_CoordinateSystem_Initialise(&WorldCoordinateSystem);
CHECK_ERROR("Initialising world coordinate system");
Err = cmfe_Context_Initialise(&Context);
CHECK_ERROR("Initialising context");
Err = cmfe_Initialise(Context);
CHECK_ERROR("Initialising OpenCMISS-Iron");
Err = cmfe_Region_Initialise(&WorldRegion);
CHECK_ERROR("Initialising world region");
Err = cmfe_Initialise(WorldCoordinateSystem,WorldRegion);
CHECK_ERROR("Initialising OpenCMISS-Iron");
Err = cmfe_Context_WorldRegionGet(Context,WorldRegion);
CHECK_ERROR("Get world region");
Err = cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR);

Err = cmfe_ComputationalNumberOfNodesGet(&NumberOfComputationalNodes);
Err = cmfe_ComputationalNodeNumberGet(&ComputationalNodeNumber);
Err = cmfe_ComputationEnvironment_Initialise(&ComputationEnvironment);
Err = cmfe_Context_ComputationEnvironmentGet(Context,ComputationEnvironment);
Err = cmfe_ComputationEnvironment_NumberOfWorldNodesGet(ComputationEnvironment,&NumberOfComputationNodes);
Err = cmfe_ComputationEnvironment_WorldNodeNumberGet(ComputationEnvironment,&ComputationNodeNumber);

/* Start the creation of a new RC coordinate system */
Err = cmfe_CoordinateSystem_Initialise(&CoordinateSystem);
Err = cmfe_CoordinateSystem_CreateStart(COORDINATE_SYSTEM_USER_NUMBER,CoordinateSystem);
Err = cmfe_CoordinateSystem_CreateStart(COORDINATE_SYSTEM_USER_NUMBER,Context,CoordinateSystem);
if(NUMBER_GLOBAL_Z_ELEMENTS==0)
{
/* Set the coordinate system to be 2D */
Expand All @@ -156,7 +161,7 @@ int main()

/* Start the creation of a basis (default is trilinear lagrange) */
Err = cmfe_Basis_Initialise(&Basis);
Err = cmfe_Basis_CreateStart(BASIS_USER_NUMBER,Basis);
Err = cmfe_Basis_CreateStart(BASIS_USER_NUMBER,Context,Basis);
if(NUMBER_GLOBAL_Z_ELEMENTS==0)
{
/* Set the basis to be a bilinear Lagrange basis */
Expand Down Expand Up @@ -200,7 +205,7 @@ int main()
Err = cmfe_Decomposition_CreateStart(DECOMPOSITION_USER_NUMBER,Mesh,Decomposition);
/* Set the decomposition to be a general decomposition with the specified number of domains */
Err = cmfe_Decomposition_TypeSet(Decomposition,CMFE_DECOMPOSITION_CALCULATED_TYPE);
Err = cmfe_Decomposition_NumberOfDomainsSet(Decomposition,NumberOfComputationalNodes);
Err = cmfe_Decomposition_NumberOfDomainsSet(Decomposition,NumberOfComputationNodes);
/* Finish the decomposition */
Err = cmfe_Decomposition_CreateFinish(Decomposition);

Expand Down Expand Up @@ -259,7 +264,7 @@ int main()
ProblemSpecification[0] = CMFE_PROBLEM_CLASSICAL_FIELD_CLASS;
ProblemSpecification[1] = CMFE_PROBLEM_LAPLACE_EQUATION_TYPE;
ProblemSpecification[2] = CMFE_PROBLEM_STANDARD_LAPLACE_SUBTYPE;
Err = cmfe_Problem_CreateStart(PROBLEM_USER_NUMBER,3,ProblemSpecification,Problem);
Err = cmfe_Problem_CreateStart(PROBLEM_USER_NUMBER,Context,3,ProblemSpecification,Problem);
/* Finish the creation of a problem. */
Err = cmfe_Problem_CreateFinish(Problem);

Expand Down Expand Up @@ -313,12 +318,12 @@ int main()
}
Err = cmfe_Decomposition_NodeDomainGet(Decomposition,FirstNodeNumber,1,&FirstNodeDomain);
Err = cmfe_Decomposition_NodeDomainGet(Decomposition,LastNodeNumber,1,&LastNodeDomain);
if(FirstNodeDomain==ComputationalNodeNumber)
if(FirstNodeDomain==ComputationNodeNumber)
{
Err = cmfe_BoundaryConditions_SetNode(BoundaryConditions,DependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,1,FirstNodeNumber,1, \
CMFE_BOUNDARY_CONDITION_FIXED,0.0);
}
if(LastNodeDomain==ComputationalNodeNumber)
if(LastNodeDomain==ComputationNodeNumber)
{
Err = cmfe_BoundaryConditions_SetNode(BoundaryConditions,DependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,1,LastNodeNumber,1, \
CMFE_BOUNDARY_CONDITION_FIXED,1.0);
Expand All @@ -329,7 +334,7 @@ int main()
/* Solve the problem */
Err = cmfe_Problem_Solve(Problem);

Err = cmfe_Finalise();
Err = cmfe_Finalise(Context);

return Err;
}
7 changes: 3 additions & 4 deletions bindings/generate_bindings/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
#ErrorHandlingModeSet(ErrorHandlingModes.RETURN_ERROR_CODE)
#"""

INITIALISE = """WorldCoordinateSystem = CoordinateSystem()
WorldRegion = Region()
Initialise(WorldCoordinateSystem, WorldRegion)
# Don't output errors, we'll include trace in exception
INITIALISE = """Context = Context()
Initialise(Context)
# Output errors
ErrorHandlingModeSet(ErrorHandlingModes.OUTPUT_ERROR)
"""

Expand Down
6 changes: 5 additions & 1 deletion cmake/Sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(IRON_Fortran_SRC
bioelectric_routines.f90
blas.f90
boundary_condition_routines.f90
boundary_condition_access_routines.f90
Burgers_equation_routines.f90
cellml_access_routines.f90
characteristic_equation_routines.f90
Expand All @@ -36,8 +37,11 @@ set(IRON_Fortran_SRC
cmiss_petsc_types.f90
cmiss_petsc.f90
cmiss.f90
computational_environment.f90
computation_routines.f90
computation_access_routines.f90
constants.f90
context_routines.f90
context_access_routines.f90
control_loop_routines.f90
control_loop_access_routines.f90
coordinate_routines.f90
Expand Down
14 changes: 9 additions & 5 deletions src/Darcy_equations_routines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ MODULE DARCY_EQUATIONS_ROUTINES
USE Constants
USE CONTROL_LOOP_ROUTINES
USE ControlLoopAccessRoutines
USE ComputationEnvironment
USE ComputationRoutines
USE ComputationAccessRoutines
USE COORDINATE_ROUTINES
USE DistributedMatrixVector
USE DOMAIN_MAPPINGS
Expand All @@ -28,7 +29,6 @@ MODULE DARCY_EQUATIONS_ROUTINES
USE Maths
USE MatrixVector
USE MESH_ROUTINES
USE NODE_ROUTINES
USE PROBLEM_CONSTANTS
USE Strings
USE SOLVER_ROUTINES
Expand Down Expand Up @@ -7204,6 +7204,7 @@ SUBROUTINE DARCY_EQUATION_MONITOR_CONVERGENCE(CONTROL_LOOP,SOLVER,err,error,*)
TYPE(VARYING_STRING) :: localError
CHARACTER(25) :: FILENAME
TYPE(VARYING_STRING) :: FILEPATH
TYPE(WorkGroupType), POINTER :: workGroup

REAL(DP), POINTER :: ITERATION_VALUES_N(:),ITERATION_VALUES_N1(:)
REAL(DP) :: RESIDUAL_NORM
Expand All @@ -7213,7 +7214,7 @@ SUBROUTINE DARCY_EQUATION_MONITOR_CONVERGENCE(CONTROL_LOOP,SOLVER,err,error,*)

INTEGER(INTG) :: FIELD_VAR_TYPE
INTEGER(INTG) :: dof_number,NUMBER_OF_DOFS,equations_set_idx
INTEGER(INTG) :: COMPUTATIONAL_NODE_NUMBER
INTEGER(INTG) :: COMPUTATION_NODE_NUMBER
INTEGER(INTG) :: FILEUNIT_N, FILEUNIT_N1

ENTERS("DARCY_EQUATION_MONITOR_CONVERGENCE",err,error,*999)
Expand All @@ -7226,8 +7227,11 @@ SUBROUTINE DARCY_EQUATION_MONITOR_CONVERGENCE(CONTROL_LOOP,SOLVER,err,error,*)
NULLIFY(vectorMapping)
NULLIFY(FIELD_VARIABLE)

COMPUTATIONAL_NODE_NUMBER=ComputationalEnvironment_NodeNumberGet(err,error)
WRITE(FILENAME,'("Darcy_",I3.3,".conv")') COMPUTATIONAL_NODE_NUMBER
NULLIFY(workGroup)
CALL Solver_WorkGroupGet(solver,workGroup,err,error,*999)

CALL WorkGroup_GroupNodeNumberGet(workGroup,COMPUTATION_NODE_NUMBER,err,error,*999)
WRITE(FILENAME,'("Darcy_",I3.3,".conv")') COMPUTATION_NODE_NUMBER
FILEPATH = "./output/"//FILENAME
OPEN(UNIT=23, FILE=CHAR(FILEPATH),STATUS='unknown',ACCESS='append')

Expand Down
1 change: 0 additions & 1 deletion src/Darcy_pressure_equations_routines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ MODULE DARCY_PRESSURE_EQUATIONS_ROUTINES
USE Kinds
USE Maths
USE MatrixVector
USE NODE_ROUTINES
USE PROBLEM_CONSTANTS
USE Strings
USE SOLVER_ROUTINES
Expand Down
1 change: 0 additions & 1 deletion src/Hamilton_Jacobi_equations_routines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ MODULE HAMILTON_JACOBI_EQUATIONS_ROUTINES
USE Kinds
USE MatrixVector
USE Maths
USE NODE_ROUTINES
USE PROBLEM_CONSTANTS
USE Strings
USE SOLVER_ROUTINES
Expand Down
1 change: 0 additions & 1 deletion src/Helmholtz_equations_routines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ MODULE HELMHOLTZ_EQUATIONS_ROUTINES
USE ISO_VARYING_STRING
USE Kinds
USE MatrixVector
USE NODE_ROUTINES
USE PROBLEM_CONSTANTS
USE Strings
USE SOLVER_ROUTINES
Expand Down
1 change: 0 additions & 1 deletion src/Laplace_equations_routines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ MODULE LAPLACE_EQUATIONS_ROUTINES
USE Kinds
USE Maths
USE MatrixVector
USE NODE_ROUTINES
USE PROBLEM_CONSTANTS
USE Strings
USE SOLVER_ROUTINES
Expand Down
Loading