Skip to content
Browse files

Updates to Python examples following code review.

no tracker item
  • Loading branch information...
1 parent 5b03d3e commit 188710c20cb7ce64f2bd3c5e8c625b18dcab0186 @PrasadBabarendaGamage PrasadBabarendaGamage committed Feb 22, 2012
View
10 ClassicalField/Laplace/LaplacePy/LaplaceExample.py
@@ -138,10 +138,10 @@
# Create standard Laplace equations set
equationsSetField = CMISS.Field()
equationsSet = CMISS.EquationsSet()
-equationsSet.CreateStart(equationsSetUserNumber,region,geometricField, \
+equationsSet.CreateStart(equationsSetUserNumber,region,geometricField,
CMISS.EquationsSetClasses.CLASSICAL_FIELD,
- CMISS.EquationsSetTypes.LAPLACE_EQUATION, \
- CMISS.EquationsSetSubtypes.STANDARD_LAPLACE, \
+ CMISS.EquationsSetTypes.LAPLACE_EQUATION,
+ CMISS.EquationsSetSubtypes.STANDARD_LAPLACE,
equationsSetFieldUserNumber, equationsSetField)
equationsSet.CreateFinish()
@@ -165,8 +165,8 @@
# Create Laplace problem
problem = CMISS.Problem()
problem.CreateStart(problemUserNumber)
-problem.SpecificationSet(CMISS.ProblemClasses.CLASSICAL_FIELD, \
- CMISS.ProblemTypes.LAPLACE_EQUATION, \
+problem.SpecificationSet(CMISS.ProblemClasses.CLASSICAL_FIELD,
+ CMISS.ProblemTypes.LAPLACE_EQUATION,
CMISS.ProblemSubTypes.STANDARD_LAPLACE)
problem.CreateFinish()
View
38 FiniteElasticity/Cantilever/src/CantileverExample.py
@@ -84,8 +84,6 @@
equationsSetUserNumber = 1
problemUserNumber = 1
-CMISS.ErrorHandlingModeSet(CMISS.ErrorHandlingModes.TRAP_ERROR)
-
# Set all diganostic levels on for testing
#CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.All,[1,2,3,4,5],"Diagnostics",["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])
@@ -198,10 +196,10 @@
# Create the equations_set
equationsSetField = CMISS.Field()
equationsSet = CMISS.EquationsSet()
-equationsSet.CreateStart(equationsSetUserNumber,region,fibreField, \
+equationsSet.CreateStart(equationsSetUserNumber,region,fibreField,
CMISS.EquationsSetClasses.ELASTICITY,
- CMISS.EquationsSetTypes.FINITE_ELASTICITY, \
- CMISS.EquationsSetSubtypes.MOONEY_RIVLIN, \
+ CMISS.EquationsSetTypes.FINITE_ELASTICITY,
+ CMISS.EquationsSetSubtypes.MOONEY_RIVLIN,
equationsSetFieldUserNumber, equationsSetField)
equationsSet.CreateFinish()
@@ -224,16 +222,16 @@
# Initialise dependent field from undeformed geometry and displacement bcs and set hydrostatic pressure
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1)
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2)
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3)
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,4,-8.0)
# Create the material field
@@ -244,11 +242,11 @@
equationsSet.MaterialsCreateFinish()
# Set Mooney-Rivlin constants c10 and c01 respectively.
-materialField.ComponentValuesInitialiseDP( \
+materialField.ComponentValuesInitialiseDP(
CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,2.0)
-materialField.ComponentValuesInitialiseDP( \
+materialField.ComponentValuesInitialiseDP(
CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,2.0)
-materialField.ComponentValuesInitialiseDP( \
+materialField.ComponentValuesInitialiseDP(
CMISS.FieldVariableTypes.V,CMISS.FieldParameterSetTypes.VALUES,1,density)
#Create the source field with the gravity vector
@@ -262,11 +260,11 @@
equationsSet.SourceCreateFinish()
#Set the gravity vector component values
-sourceField.ComponentValuesInitialiseDP( \
+sourceField.ComponentValuesInitialiseDP(
CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,gravity[0])
-sourceField.ComponentValuesInitialiseDP( \
+sourceField.ComponentValuesInitialiseDP(
CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,gravity[1])
-sourceField.ComponentValuesInitialiseDP( \
+sourceField.ComponentValuesInitialiseDP(
CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3,gravity[2])
# Create equations
@@ -279,8 +277,8 @@
# Define the problem
problem = CMISS.Problem()
problem.CreateStart(problemUserNumber)
-problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY, \
- CMISS.ProblemTypes.FINITE_ELASTICITY, \
+problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY,
+ CMISS.ProblemTypes.FINITE_ELASTICITY,
CMISS.ProblemSubTypes.NONE)
problem.CreateFinish()
View
4 FiniteElasticity/LargeUniAxialExtension/src/LargeUniAxialExtensionExample.f90
@@ -156,7 +156,7 @@ PROGRAM LARGEUNIAXIALEXTENSIONEXAMPLE
CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem,Err)
!Create a region and assign the coordinate system to the region
- CALL CMISSRegion_TypeInitialise(Region,Err)
+ CALL CMISSRegion_Initialise(Region,Err)
CALL CMISSRegion_CreateStart(RegionUserNumber,WorldRegion,Region,Err)
CALL CMISSRegion_LabelSet(Region,"Region",Err)
CALL CMISSRegion_CoordinateSystemSet(Region,CoordinateSystem,Err)
@@ -227,7 +227,7 @@ PROGRAM LARGEUNIAXIALEXTENSIONEXAMPLE
!Define the mesh on the region
IF(NumberGlobalXElements==0) THEN
CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,[WIDTH,HEIGHT],Err)
- CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,[NumberGlobalXElements,NumberGlobalYElement]),Err)
+ CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,[NumberGlobalXElements,NumberGlobalYElements],Err)
ELSE
CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,[WIDTH,HEIGHT,LENGTH],Err)
CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,[NumberGlobalXElements,NumberGlobalYElements, &
View
30 FiniteElasticity/LargeUniAxialExtension/src/LargeUniAxialExtensionExample.py
@@ -80,8 +80,6 @@
equationsSetFieldUserNumber = 5
problemUserNumber = 1
-CMISS.ErrorHandlingModeSet(CMISS.ErrorHandlingModes.TRAP_ERROR)
-
# Set all diganostic levels on for testing
#CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.All,[1,2,3,4,5],"Diagnostics",["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])
@@ -194,10 +192,10 @@
# Create the equations_set
equationsSetField = CMISS.Field()
equationsSet = CMISS.EquationsSet()
-equationsSet.CreateStart(equationsSetUserNumber,region,fibreField, \
+equationsSet.CreateStart(equationsSetUserNumber,region,fibreField,
CMISS.EquationsSetClasses.ELASTICITY,
- CMISS.EquationsSetTypes.FINITE_ELASTICITY, \
- CMISS.EquationsSetSubtypes.MOONEY_RIVLIN, \
+ CMISS.EquationsSetTypes.FINITE_ELASTICITY,
+ CMISS.EquationsSetSubtypes.MOONEY_RIVLIN,
equationsSetFieldUserNumber, equationsSetField)
equationsSet.CreateFinish()
@@ -219,16 +217,16 @@
equationsSet.DependentCreateFinish()
# Initialise dependent field from undeformed geometry and displacement bcs and set hydrostatic pressure
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1)
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2)
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3)
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,4,-14.0)
# Create the material field
@@ -238,9 +236,9 @@
equationsSet.MaterialsCreateFinish()
# Set Mooney-Rivlin constants c10 and c01 respectively.
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
materialField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,2.0)
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
materialField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,6.0)
# Create equations
@@ -253,8 +251,8 @@
# Define the problem
problem = CMISS.Problem()
problem.CreateStart(problemUserNumber)
-problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY, \
- CMISS.ProblemTypes.FINITE_ELASTICITY, \
+problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY,
+ CMISS.ProblemTypes.FINITE_ELASTICITY,
CMISS.ProblemSubTypes.NONE)
problem.CreateFinish()
View
30 FiniteElasticity/UniAxialExtension/src/UniAxialExtensionExample.py
@@ -80,8 +80,6 @@
equationsSetFieldUserNumber = 5
problemUserNumber = 1
-CMISS.ErrorHandlingModeSet(CMISS.ErrorHandlingModes.TRAP_ERROR)
-
# Set all diganostic levels on for testing
CMISS.DiagnosticsSetOn(CMISS.DiagnosticTypes.ALL,[1,2,3,4,5],"Diagnostics",["DOMAIN_MAPPINGS_LOCAL_FROM_GLOBAL_CALCULATE"])
@@ -233,10 +231,10 @@
# Create the equations_set
equationsSetField = CMISS.Field()
equationsSet = CMISS.EquationsSet()
-equationsSet.CreateStart(equationsSetUserNumber,region,fibreField, \
+equationsSet.CreateStart(equationsSetUserNumber,region,fibreField,
CMISS.EquationsSetClasses.ELASTICITY,
- CMISS.EquationsSetTypes.FINITE_ELASTICITY, \
- CMISS.EquationsSetSubtypes.MOONEY_RIVLIN, \
+ CMISS.EquationsSetTypes.FINITE_ELASTICITY,
+ CMISS.EquationsSetSubtypes.MOONEY_RIVLIN,
equationsSetFieldUserNumber, equationsSetField)
equationsSet.CreateFinish()
@@ -259,16 +257,16 @@
# Initialise dependent field from undeformed geometry and displacement bcs and set hydrostatic pressure
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1)
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2)
-CMISS.Field.ParametersToFieldParametersComponentCopy( \
- geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3, \
+CMISS.Field.ParametersToFieldParametersComponentCopy(
+ geometricField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3,
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,3)
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
dependentField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,4,-8.0)
# Create the material field
@@ -278,9 +276,9 @@
equationsSet.MaterialsCreateFinish()
# Set Mooney-Rivlin constants c10 and c01 respectively.
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
materialField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,1,2.0)
-CMISS.Field.ComponentValuesInitialiseDP( \
+CMISS.Field.ComponentValuesInitialiseDP(
materialField,CMISS.FieldVariableTypes.U,CMISS.FieldParameterSetTypes.VALUES,2,6.0)
# Create equations
@@ -293,8 +291,8 @@
# Define the problem
problem = CMISS.Problem()
problem.CreateStart(problemUserNumber)
-problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY, \
- CMISS.ProblemTypes.FINITE_ELASTICITY, \
+problem.SpecificationSet(CMISS.ProblemClasses.ELASTICITY,
+ CMISS.ProblemTypes.FINITE_ELASTICITY,
CMISS.ProblemSubTypes.NONE)
problem.CreateFinish()

0 comments on commit 188710c

Please sign in to comment.
Something went wrong with that request. Please try again.