Changeset 12706
- Timestamp:
- 07/24/12 10:36:19 (13 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 11 deleted
- 666 edited
- 82 copied
-
ad/todo (modified) (1 diff)
-
android/ISSM_App (copied) (copied from issm/trunk-jpl/src/android/ISSM_App )
-
android/ISSM_App/.classpath (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/.classpath )
-
android/ISSM_App/.project (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/.project )
-
android/ISSM_App/AndroidManifest.xml (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/AndroidManifest.xml )
-
android/ISSM_App/assets (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/assets )
-
android/ISSM_App/bin (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin )
-
android/ISSM_App/bin/classes (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/classes )
-
android/ISSM_App/bin/classes/issm (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/classes/issm )
-
android/ISSM_App/bin/classes/issm/app (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/classes/issm/app )
-
android/ISSM_App/bin/res (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res )
-
android/ISSM_App/bin/res/drawable-hdpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-hdpi )
-
android/ISSM_App/bin/res/drawable-hdpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-hdpi/ic_launcher.png )
-
android/ISSM_App/bin/res/drawable-ldpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-ldpi )
-
android/ISSM_App/bin/res/drawable-ldpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-ldpi/ic_launcher.png )
-
android/ISSM_App/bin/res/drawable-mdpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-mdpi )
-
android/ISSM_App/bin/res/drawable-mdpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-mdpi/ic_launcher.png )
-
android/ISSM_App/bin/res/drawable-xhdpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-xhdpi )
-
android/ISSM_App/bin/res/drawable-xhdpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/bin/res/drawable-xhdpi/ic_launcher.png )
-
android/ISSM_App/gen (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/gen )
-
android/ISSM_App/gen/issm (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/gen/issm )
-
android/ISSM_App/gen/issm/app (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/gen/issm/app )
-
android/ISSM_App/gen/issm/app/BuildConfig.java (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/gen/issm/app/BuildConfig.java )
-
android/ISSM_App/gen/issm/app/R.java (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/gen/issm/app/R.java )
-
android/ISSM_App/proguard-project.txt (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/proguard-project.txt )
-
android/ISSM_App/project.properties (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/project.properties )
-
android/ISSM_App/res (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res )
-
android/ISSM_App/res/drawable-hdpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-hdpi )
-
android/ISSM_App/res/drawable-hdpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-hdpi/ic_launcher.png )
-
android/ISSM_App/res/drawable-ldpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-ldpi )
-
android/ISSM_App/res/drawable-ldpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-ldpi/ic_launcher.png )
-
android/ISSM_App/res/drawable-mdpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-mdpi )
-
android/ISSM_App/res/drawable-mdpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-mdpi/ic_launcher.png )
-
android/ISSM_App/res/drawable-xhdpi (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-xhdpi )
-
android/ISSM_App/res/drawable-xhdpi/ic_launcher.png (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/drawable-xhdpi/ic_launcher.png )
-
android/ISSM_App/res/layout (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/layout )
-
android/ISSM_App/res/layout/main.xml (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/layout/main.xml )
-
android/ISSM_App/res/values (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/values )
-
android/ISSM_App/res/values/strings.xml (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/res/values/strings.xml )
-
android/ISSM_App/src (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/src )
-
android/ISSM_App/src/issm (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/src/issm )
-
android/ISSM_App/src/issm/app (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/src/issm/app )
-
android/ISSM_App/src/issm/app/ISSM_AppActivity.java (copied) (copied from issm/trunk-jpl/src/android/ISSM_App/src/issm/app/ISSM_AppActivity.java )
-
c/Container/Constraints.cpp (modified) (4 diffs)
-
c/Container/Constraints.h (modified) (1 diff)
-
c/Container/Container.h (modified) (2 diffs)
-
c/Container/DataSet.cpp (modified) (20 diffs)
-
c/Container/DataSet.h (modified) (1 diff)
-
c/Container/Elements.cpp (modified) (16 diffs)
-
c/Container/Elements.h (modified) (1 diff)
-
c/Container/Inputs.cpp (modified) (31 diffs)
-
c/Container/Inputs.h (modified) (1 diff)
-
c/Container/Loads.cpp (modified) (6 diffs)
-
c/Container/Loads.h (modified) (1 diff)
-
c/Container/Materials.cpp (modified) (4 diffs)
-
c/Container/Materials.h (modified) (1 diff)
-
c/Container/Nodes.cpp (modified) (15 diffs)
-
c/Container/Nodes.h (modified) (1 diff)
-
c/Container/Observations.cpp (modified) (11 diffs)
-
c/Container/Observations.h (modified) (2 diffs)
-
c/Container/Options.cpp (modified) (19 diffs)
-
c/Container/Options.h (modified) (2 diffs)
-
c/Container/Parameters.cpp (modified) (27 diffs)
-
c/Container/Parameters.h (modified) (2 diffs)
-
c/Container/Results.cpp (modified) (5 diffs)
-
c/Container/Results.h (modified) (1 diff)
-
c/Container/Vertices.cpp (modified) (10 diffs)
-
c/Container/Vertices.h (modified) (1 diff)
-
c/EnumDefinitions/EnumDefinitions.h (modified) (2 diffs)
-
c/EnumDefinitions/Synchronize.sh (modified) (7 diffs)
-
c/Makefile.am (modified) (28 diffs)
-
c/include/include.h (modified) (1 diff)
-
c/include/macros.h (modified) (4 diffs)
-
c/include/typedefs.h (modified) (2 diffs)
-
c/include/types.h (modified) (1 diff)
-
c/io/Disk/diskio.h (modified) (1 diff)
-
c/io/Disk/pfclose.cpp (modified) (1 diff)
-
c/io/Disk/pfopen.cpp (modified) (1 diff)
-
c/io/PrintfFunction.cpp (modified) (2 diffs)
-
c/io/io.h (modified) (1 diff)
-
c/issm.h (modified) (1 diff)
-
c/matlab/include/matlab_macros.h (modified) (3 diffs)
-
c/matlab/io/CheckNumMatlabArguments.cpp (modified) (1 diff)
-
c/matlab/io/FetchMatlabData.cpp (modified) (42 diffs)
-
c/matlab/io/MatlabMatrixToDoubleMatrix.cpp (modified) (9 diffs)
-
c/matlab/io/MatlabMatrixToMatrix.cpp (modified) (1 diff)
-
c/matlab/io/MatlabMatrixToPetscMatrix.cpp (modified) (8 diffs)
-
c/matlab/io/MatlabMatrixToSeqMat.cpp (modified) (1 diff)
-
c/matlab/io/MatlabNArrayToNArray.cpp (modified) (16 diffs)
-
c/matlab/io/MatlabVectorToDoubleVector.cpp (modified) (2 diffs)
-
c/matlab/io/MatlabVectorToPetscVector.cpp (modified) (1 diff)
-
c/matlab/io/MatlabVectorToSeqVec.cpp (modified) (1 diff)
-
c/matlab/io/MatlabVectorToVector.cpp (modified) (1 diff)
-
c/matlab/io/OptionParse.cpp (modified) (10 diffs)
-
c/matlab/io/PrintfFunction.cpp (modified) (2 diffs)
-
c/matlab/io/WriteMatlabData.cpp (modified) (13 diffs)
-
c/modules/AverageFilterx/AverageFilterx.cpp (modified) (1 diff)
-
c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp (modified) (1 diff)
-
c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp (modified) (1 diff)
-
c/modules/BamgConvertMeshx/BamgConvertMeshx.h (modified) (1 diff)
-
c/modules/Bamgx/Bamgx.cpp (modified) (13 diffs)
-
c/modules/Chacox/Chacox.cpp (modified) (3 diffs)
-
c/modules/Chacox/input_parse.cpp (modified) (13 diffs)
-
c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp (modified) (2 diffs)
-
c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp (modified) (3 diffs)
-
c/modules/ConstraintsStatex/ConstraintsStatex.cpp (modified) (1 diff)
-
c/modules/ConstraintsStatex/RiftConstraintsState.cpp (modified) (13 diffs)
-
c/modules/ContourToMeshx/ContourToMeshx.cpp (modified) (1 diff)
-
c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp (modified) (1 diff)
-
c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp (modified) (1 diff)
-
c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp (modified) (2 diffs)
-
c/modules/CostFunctionx/CostFunctionx.cpp (modified) (1 diff)
-
c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp (modified) (1 diff)
-
c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h (modified) (1 diff)
-
c/modules/DakotaResponsesx/DakotaResponsesx.cpp (modified) (5 diffs)
-
c/modules/Dakotax/DakotaFree.cpp (modified) (4 diffs)
-
c/modules/Dakotax/DakotaMPI_Bcast.cpp (modified) (2 diffs)
-
c/modules/Dakotax/Dakotax.cpp (modified) (1 diff)
-
c/modules/Dakotax/DescriptorIndex.cpp (modified) (3 diffs)
-
c/modules/Dakotax/SpawnCoreParallel.cpp (modified) (3 diffs)
-
c/modules/ElementConnectivityx/ElementConnectivityx.cpp (modified) (1 diff)
-
c/modules/ElementResponsex/ElementResponsex.cpp (modified) (1 diff)
-
c/modules/EnumToStringx/EnumToStringx.cpp (modified) (3 diffs)
-
c/modules/Exp2Kmlx/Exp2Kmlx.cpp (modified) (11 diffs)
-
c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp (modified) (1 diff)
-
c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp (modified) (1 diff)
-
c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp (modified) (2 diffs)
-
c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h (modified) (1 diff)
-
c/modules/Gradjx/Gradjx.cpp (modified) (4 diffs)
-
c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp (modified) (8 diffs)
-
c/modules/HoleFillerx/HoleFillerx.cpp (modified) (10 diffs)
-
c/modules/InputArtificialNoisex/InputArtificialNoisex.cpp (modified) (1 diff)
-
c/modules/InputArtificialNoisex/InputArtificialNoisex.h (modified) (1 diff)
-
c/modules/InputConvergencex/InputConvergencex.cpp (modified) (2 diffs)
-
c/modules/InputConvergencex/InputConvergencex.h (modified) (1 diff)
-
c/modules/InputScalex/InputScalex.cpp (modified) (1 diff)
-
c/modules/InputScalex/InputScalex.h (modified) (1 diff)
-
c/modules/InputToResultx/InputToResultx.cpp (modified) (1 diff)
-
c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp (modified) (1 diff)
-
c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h (modified) (1 diff)
-
c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp (modified) (4 diffs)
-
c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp (modified) (3 diffs)
-
c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h (modified) (1 diff)
-
c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp (modified) (1 diff)
-
c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp (modified) (2 diffs)
-
c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h (modified) (1 diff)
-
c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp (modified) (13 diffs)
-
c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp (modified) (4 diffs)
-
c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp (modified) (5 diffs)
-
c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp (modified) (5 diffs)
-
c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp (modified) (4 diffs)
-
c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h (modified) (1 diff)
-
c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp (modified) (5 diffs)
-
c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp (modified) (7 diffs)
-
c/modules/KMLFileReadx/KMLFileReadx.cpp (modified) (2 diffs)
-
c/modules/KMLMeshWritex/KMLMeshWritex.cpp (modified) (12 diffs)
-
c/modules/KMLOverlayx/KMLOverlayx.cpp (modified) (2 diffs)
-
c/modules/Kml2Expx/Kml2Expx.cpp (modified) (2 diffs)
-
c/modules/Krigingx/Krigingx.cpp (modified) (8 diffs)
-
c/modules/Krigingx/Krigingx.h (modified) (2 diffs)
-
c/modules/Krigingx/pKrigingx.cpp (copied) (copied from issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp )
-
c/modules/Ll2xyx/Ll2xyx.cpp (modified) (2 diffs)
-
c/modules/MassFluxx/MassFluxx.cpp (modified) (1 diff)
-
c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp (modified) (1 diff)
-
c/modules/MeshPartitionx/MeshPartitionx.cpp (modified) (7 diffs)
-
c/modules/MeshPartitionx/MeshPartitionx.h (modified) (1 diff)
-
c/modules/MeshProfileIntersectionx/ElementSegment.cpp (modified) (1 diff)
-
c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp (modified) (3 diffs)
-
c/modules/MeshProfileIntersectionx/MeshSegmentsIntersection.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/Control/CreateParametersControl.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/CreateDataSets.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp (modified) (3 diffs)
-
c/modules/ModelProcessorx/CreateParameters.cpp (modified) (4 diffs)
-
c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp (modified) (3 diffs)
-
c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp (modified) (10 diffs)
-
c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp (modified) (21 diffs)
-
c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp (modified) (3 diffs)
-
c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/DistributeNumDofs.cpp (modified) (7 diffs)
-
c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp (modified) (5 diffs)
-
c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp (modified) (3 diffs)
-
c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/ModelProcessorx.cpp (modified) (1 diff)
-
c/modules/ModelProcessorx/ModelProcessorx.h (modified) (1 diff)
-
c/modules/ModelProcessorx/NodesPartitioning.cpp (modified) (9 diffs)
-
c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp (modified) (4 diffs)
-
c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp (modified) (2 diffs)
-
c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp (modified) (3 diffs)
-
c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp (modified) (2 diffs)
-
c/modules/NodalValuex/NodalValuex.cpp (modified) (3 diffs)
-
c/modules/NodalValuex/NodalValuex.h (modified) (1 diff)
-
c/modules/NodeConnectivityx/NodeConnectivityx.cpp (modified) (2 diffs)
-
c/modules/OutputResultsx/OutputResultsx.cpp (modified) (3 diffs)
-
c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp (modified) (7 diffs)
-
c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp (modified) (3 diffs)
-
c/modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp (modified) (4 diffs)
-
c/modules/Reduceloadx/Reduceloadx.cpp (modified) (1 diff)
-
c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp (modified) (2 diffs)
-
c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp (modified) (1 diff)
-
c/modules/RequestedOutputsx/RequestedOutputsx.cpp (modified) (1 diff)
-
c/modules/ResetConstraintsx/ResetConstraintsx.cpp (modified) (2 diffs)
-
c/modules/Responsex/Responsex.cpp (modified) (2 diffs)
-
c/modules/Responsex/Responsex.h (modified) (1 diff)
-
c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp (modified) (2 diffs)
-
c/modules/Shp2Kmlx/Shp2Kmlx.cpp (modified) (19 diffs)
-
c/modules/SmbGradientsx (copied) (copied from issm/trunk-jpl/src/c/modules/SmbGradientsx )
-
c/modules/SmbGradientsx/SmbGradientsx.cpp (copied) (copied from issm/trunk-jpl/src/c/modules/SmbGradientsx/SmbGradientsx.cpp )
-
c/modules/SmbGradientsx/SmbGradientsx.h (copied) (copied from issm/trunk-jpl/src/c/modules/SmbGradientsx/SmbGradientsx.h )
-
c/modules/Solverx/DofTypesToIndexSet.cpp (modified) (3 diffs)
-
c/modules/Solverx/Solverx.cpp (modified) (1 diff)
-
c/modules/Solverx/Solverx.h (modified) (1 diff)
-
c/modules/Solverx/SolverxGsl.cpp (modified) (2 diffs)
-
c/modules/Solverx/SolverxPetsc.cpp (modified) (4 diffs)
-
c/modules/StringToEnumx/StringToEnumx.cpp (modified) (7 diffs)
-
c/modules/SurfaceAreax/SurfaceAreax.cpp (modified) (2 diffs)
-
c/modules/SurfaceAreax/SurfaceAreax.h (modified) (1 diff)
-
c/modules/SystemMatricesx/SystemMatricesx.cpp (modified) (3 diffs)
-
c/modules/SystemMatricesx/SystemMatricesx.h (modified) (1 diff)
-
c/modules/TimeAdaptx/TimeAdaptx.cpp (modified) (1 diff)
-
c/modules/TimeAdaptx/TimeAdaptx.h (modified) (1 diff)
-
c/modules/TriMeshx/TriMeshx.cpp (modified) (5 diffs)
-
c/modules/TriaSearchx/TriaSearchx.cpp (modified) (3 diffs)
-
c/modules/TriaSearchx/TriaSearchx.h (modified) (1 diff)
-
c/modules/UpdateConstraintsx/UpdateConstraintsx.cpp (modified) (2 diffs)
-
c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp (modified) (2 diffs)
-
c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp (modified) (2 diffs)
-
c/modules/VecMergex/VecMergex.cpp (modified) (2 diffs)
-
c/modules/Xy2llx/Xy2llx.cpp (modified) (2 diffs)
-
c/modules/modules.h (modified) (1 diff)
-
c/objects/Bamg/AdjacentTriangle.cpp (modified) (2 diffs)
-
c/objects/Bamg/BamgGeom.cpp (modified) (2 diffs)
-
c/objects/Bamg/BamgMesh.cpp (modified) (2 diffs)
-
c/objects/Bamg/BamgOpts.cpp (modified) (3 diffs)
-
c/objects/Bamg/BamgQuadtree.cpp (modified) (10 diffs)
-
c/objects/Bamg/BamgQuadtree.h (modified) (1 diff)
-
c/objects/Bamg/BamgVertex.cpp (modified) (9 diffs)
-
c/objects/Bamg/CrackedEdge.cpp (modified) (1 diff)
-
c/objects/Bamg/Curve.cpp (modified) (3 diffs)
-
c/objects/Bamg/Direction.cpp (modified) (2 diffs)
-
c/objects/Bamg/Edge.cpp (modified) (3 diffs)
-
c/objects/Bamg/EigenMetric.cpp (modified) (3 diffs)
-
c/objects/Bamg/GeomEdge.cpp (modified) (4 diffs)
-
c/objects/Bamg/GeomSubDomain.cpp (modified) (1 diff)
-
c/objects/Bamg/GeomVertex.cpp (modified) (2 diffs)
-
c/objects/Bamg/Geometry.cpp (modified) (37 diffs)
-
c/objects/Bamg/ListofIntersectionTriangles.cpp (modified) (18 diffs)
-
c/objects/Bamg/ListofIntersectionTriangles.h (modified) (1 diff)
-
c/objects/Bamg/Mesh.cpp (modified) (224 diffs)
-
c/objects/Bamg/Mesh.h (modified) (2 diffs)
-
c/objects/Bamg/Metric.cpp (modified) (8 diffs)
-
c/objects/Bamg/SetOfE4.cpp (modified) (5 diffs)
-
c/objects/Bamg/SubDomain.cpp (modified) (1 diff)
-
c/objects/Bamg/Triangle.cpp (modified) (24 diffs)
-
c/objects/Bamg/VertexOnEdge.cpp (modified) (2 diffs)
-
c/objects/Bamg/VertexOnGeom.cpp (modified) (5 diffs)
-
c/objects/Bamg/VertexOnVertex.cpp (modified) (3 diffs)
-
c/objects/Constraints/Constraint.h (modified) (1 diff)
-
c/objects/Constraints/SpcDynamic.cpp (modified) (7 diffs)
-
c/objects/Constraints/SpcDynamic.h (modified) (4 diffs)
-
c/objects/Constraints/SpcStatic.cpp (modified) (5 diffs)
-
c/objects/Constraints/SpcStatic.h (modified) (3 diffs)
-
c/objects/Constraints/SpcTransient.cpp (modified) (7 diffs)
-
c/objects/Constraints/SpcTransient.h (modified) (4 diffs)
-
c/objects/Contour.cpp (modified) (6 diffs)
-
c/objects/Contour.h (modified) (2 diffs)
-
c/objects/DakotaPlugin.cpp (modified) (4 diffs)
-
c/objects/DakotaPlugin.h (modified) (1 diff)
-
c/objects/DofIndexing.cpp (modified) (9 diffs)
-
c/objects/DofIndexing.h (modified) (2 diffs)
-
c/objects/ElementResults/BoolElementResult.cpp (modified) (9 diffs)
-
c/objects/ElementResults/BoolElementResult.h (modified) (4 diffs)
-
c/objects/ElementResults/DoubleElementResult.cpp (modified) (9 diffs)
-
c/objects/ElementResults/DoubleElementResult.h (modified) (5 diffs)
-
c/objects/ElementResults/ElementResult.h (modified) (2 diffs)
-
c/objects/ElementResults/PentaP1ElementResult.cpp (modified) (10 diffs)
-
c/objects/ElementResults/PentaP1ElementResult.h (modified) (4 diffs)
-
c/objects/ElementResults/TriaP1ElementResult.cpp (modified) (10 diffs)
-
c/objects/ElementResults/TriaP1ElementResult.h (modified) (4 diffs)
-
c/objects/Elements/Element.h (modified) (3 diffs)
-
c/objects/Elements/Penta.cpp (modified) (363 diffs)
-
c/objects/Elements/Penta.h (modified) (10 diffs)
-
c/objects/Elements/PentaHook.cpp (modified) (7 diffs)
-
c/objects/Elements/PentaHook.h (modified) (1 diff)
-
c/objects/Elements/PentaRef.cpp (modified) (56 diffs)
-
c/objects/Elements/PentaRef.h (modified) (1 diff)
-
c/objects/Elements/Tria.cpp (modified) (257 diffs)
-
c/objects/Elements/Tria.h (modified) (10 diffs)
-
c/objects/Elements/TriaHook.cpp (modified) (5 diffs)
-
c/objects/Elements/TriaHook.h (modified) (1 diff)
-
c/objects/Elements/TriaRef.cpp (modified) (33 diffs)
-
c/objects/Elements/TriaRef.h (modified) (1 diff)
-
c/objects/ExternalResults/BoolExternalResult.cpp (modified) (9 diffs)
-
c/objects/ExternalResults/BoolExternalResult.h (modified) (3 diffs)
-
c/objects/ExternalResults/DoubleExternalResult.cpp (modified) (9 diffs)
-
c/objects/ExternalResults/DoubleExternalResult.h (modified) (3 diffs)
-
c/objects/ExternalResults/DoubleMatExternalResult.cpp (modified) (12 diffs)
-
c/objects/ExternalResults/DoubleMatExternalResult.h (modified) (3 diffs)
-
c/objects/ExternalResults/DoubleVecExternalResult.cpp (modified) (10 diffs)
-
c/objects/ExternalResults/DoubleVecExternalResult.h (modified) (3 diffs)
-
c/objects/ExternalResults/ExternalResult.h (modified) (2 diffs)
-
c/objects/ExternalResults/IntExternalResult.cpp (modified) (9 diffs)
-
c/objects/ExternalResults/IntExternalResult.h (modified) (3 diffs)
-
c/objects/ExternalResults/PetscVecExternalResult.cpp (modified) (9 diffs)
-
c/objects/ExternalResults/PetscVecExternalResult.h (modified) (3 diffs)
-
c/objects/ExternalResults/StringExternalResult.cpp (modified) (9 diffs)
-
c/objects/ExternalResults/StringExternalResult.h (modified) (3 diffs)
-
c/objects/FemModel.cpp (modified) (10 diffs)
-
c/objects/FemModel.h (modified) (1 diff)
-
c/objects/Gauss/GaussPenta.cpp (modified) (17 diffs)
-
c/objects/Gauss/GaussPenta.h (modified) (1 diff)
-
c/objects/Gauss/GaussTria.cpp (modified) (13 diffs)
-
c/objects/Gauss/GaussTria.h (modified) (3 diffs)
-
c/objects/Hook.cpp (modified) (10 diffs)
-
c/objects/Hook.h (modified) (2 diffs)
-
c/objects/Inputs/BoolInput.cpp (modified) (11 diffs)
-
c/objects/Inputs/BoolInput.h (modified) (3 diffs)
-
c/objects/Inputs/ControlInput.cpp (modified) (15 diffs)
-
c/objects/Inputs/ControlInput.h (modified) (3 diffs)
-
c/objects/Inputs/DatasetInput.cpp (modified) (10 diffs)
-
c/objects/Inputs/DatasetInput.h (modified) (3 diffs)
-
c/objects/Inputs/DoubleInput.cpp (modified) (18 diffs)
-
c/objects/Inputs/DoubleInput.h (modified) (4 diffs)
-
c/objects/Inputs/Input.h (modified) (3 diffs)
-
c/objects/Inputs/IntInput.cpp (modified) (10 diffs)
-
c/objects/Inputs/IntInput.h (modified) (3 diffs)
-
c/objects/Inputs/PentaP1Input.cpp (modified) (37 diffs)
-
c/objects/Inputs/PentaP1Input.h (modified) (4 diffs)
-
c/objects/Inputs/TransientInput.cpp (modified) (22 diffs)
-
c/objects/Inputs/TransientInput.h (modified) (3 diffs)
-
c/objects/Inputs/TriaP1Input.cpp (modified) (29 diffs)
-
c/objects/Inputs/TriaP1Input.h (modified) (3 diffs)
-
c/objects/IoModel.cpp (modified) (85 diffs)
-
c/objects/IoModel.h (modified) (2 diffs)
-
c/objects/KML/KMLFileReadUtils.cpp (modified) (39 diffs)
-
c/objects/KML/KMLFileReadUtils.h (modified) (1 diff)
-
c/objects/KML/KML_Attribute.cpp (modified) (11 diffs)
-
c/objects/KML/KML_Attribute.h (modified) (2 diffs)
-
c/objects/KML/KML_ColorStyle.cpp (modified) (9 diffs)
-
c/objects/KML/KML_ColorStyle.h (modified) (3 diffs)
-
c/objects/KML/KML_Comment.cpp (modified) (9 diffs)
-
c/objects/KML/KML_Comment.h (modified) (2 diffs)
-
c/objects/KML/KML_Container.cpp (modified) (10 diffs)
-
c/objects/KML/KML_Container.h (modified) (3 diffs)
-
c/objects/KML/KML_Document.cpp (modified) (9 diffs)
-
c/objects/KML/KML_Document.h (modified) (3 diffs)
-
c/objects/KML/KML_Feature.cpp (modified) (12 diffs)
-
c/objects/KML/KML_Feature.h (modified) (3 diffs)
-
c/objects/KML/KML_File.cpp (modified) (10 diffs)
-
c/objects/KML/KML_File.h (modified) (3 diffs)
-
c/objects/KML/KML_Folder.cpp (modified) (9 diffs)
-
c/objects/KML/KML_Folder.h (modified) (3 diffs)
-
c/objects/KML/KML_Geometry.cpp (modified) (9 diffs)
-
c/objects/KML/KML_Geometry.h (modified) (3 diffs)
-
c/objects/KML/KML_GroundOverlay.cpp (modified) (9 diffs)
-
c/objects/KML/KML_GroundOverlay.h (modified) (3 diffs)
-
c/objects/KML/KML_Icon.cpp (modified) (8 diffs)
-
c/objects/KML/KML_Icon.h (modified) (3 diffs)
-
c/objects/KML/KML_LatLonBox.cpp (modified) (8 diffs)
-
c/objects/KML/KML_LatLonBox.h (modified) (3 diffs)
-
c/objects/KML/KML_LineString.cpp (modified) (11 diffs)
-
c/objects/KML/KML_LineString.h (modified) (3 diffs)
-
c/objects/KML/KML_LineStyle.cpp (modified) (9 diffs)
-
c/objects/KML/KML_LineStyle.h (modified) (3 diffs)
-
c/objects/KML/KML_LinearRing.cpp (modified) (10 diffs)
-
c/objects/KML/KML_LinearRing.h (modified) (3 diffs)
-
c/objects/KML/KML_MultiGeometry.cpp (modified) (11 diffs)
-
c/objects/KML/KML_MultiGeometry.h (modified) (3 diffs)
-
c/objects/KML/KML_Object.cpp (modified) (19 diffs)
-
c/objects/KML/KML_Object.h (modified) (2 diffs)
-
c/objects/KML/KML_Overlay.cpp (modified) (9 diffs)
-
c/objects/KML/KML_Overlay.h (modified) (3 diffs)
-
c/objects/KML/KML_Placemark.cpp (modified) (10 diffs)
-
c/objects/KML/KML_Placemark.h (modified) (3 diffs)
-
c/objects/KML/KML_Point.cpp (modified) (8 diffs)
-
c/objects/KML/KML_Point.h (modified) (3 diffs)
-
c/objects/KML/KML_PolyStyle.cpp (modified) (9 diffs)
-
c/objects/KML/KML_PolyStyle.h (modified) (3 diffs)
-
c/objects/KML/KML_Polygon.cpp (modified) (12 diffs)
-
c/objects/KML/KML_Polygon.h (modified) (3 diffs)
-
c/objects/KML/KML_Style.cpp (modified) (10 diffs)
-
c/objects/KML/KML_Style.h (modified) (3 diffs)
-
c/objects/KML/KML_StyleSelector.cpp (modified) (9 diffs)
-
c/objects/KML/KML_StyleSelector.h (modified) (3 diffs)
-
c/objects/KML/KML_SubStyle.cpp (modified) (9 diffs)
-
c/objects/KML/KML_SubStyle.h (modified) (3 diffs)
-
c/objects/KML/KML_Unknown.cpp (modified) (10 diffs)
-
c/objects/KML/KML_Unknown.h (modified) (3 diffs)
-
c/objects/Kriging/ExponentialVariogram.cpp (modified) (6 diffs)
-
c/objects/Kriging/ExponentialVariogram.h (modified) (1 diff)
-
c/objects/Kriging/GaussianVariogram.cpp (modified) (6 diffs)
-
c/objects/Kriging/GaussianVariogram.h (modified) (1 diff)
-
c/objects/Kriging/Observation.cpp (modified) (3 diffs)
-
c/objects/Kriging/Observation.h (modified) (1 diff)
-
c/objects/Kriging/PowerVariogram.cpp (modified) (6 diffs)
-
c/objects/Kriging/PowerVariogram.h (modified) (1 diff)
-
c/objects/Kriging/Quadtree.cpp (modified) (19 diffs)
-
c/objects/Kriging/Quadtree.h (modified) (2 diffs)
-
c/objects/Kriging/SphericalVariogram.cpp (modified) (5 diffs)
-
c/objects/Kriging/SphericalVariogram.h (modified) (1 diff)
-
c/objects/Loads/Friction.cpp (modified) (15 diffs)
-
c/objects/Loads/Friction.h (modified) (2 diffs)
-
c/objects/Loads/Icefront.cpp (modified) (33 diffs)
-
c/objects/Loads/Icefront.h (modified) (4 diffs)
-
c/objects/Loads/Load.h (modified) (3 diffs)
-
c/objects/Loads/Numericalflux.cpp (modified) (40 diffs)
-
c/objects/Loads/Numericalflux.h (modified) (3 diffs)
-
c/objects/Loads/Pengrid.cpp (modified) (28 diffs)
-
c/objects/Loads/Pengrid.h (modified) (3 diffs)
-
c/objects/Loads/Penpair.cpp (modified) (19 diffs)
-
c/objects/Loads/Penpair.h (modified) (4 diffs)
-
c/objects/Loads/Riftfront.cpp (modified) (44 diffs)
-
c/objects/Loads/Riftfront.h (modified) (5 diffs)
-
c/objects/Materials/Material.h (modified) (1 diff)
-
c/objects/Materials/Matice.cpp (modified) (44 diffs)
-
c/objects/Materials/Matice.h (modified) (3 diffs)
-
c/objects/Materials/Matpar.cpp (modified) (9 diffs)
-
c/objects/Materials/Matpar.h (modified) (4 diffs)
-
c/objects/Node.cpp (modified) (61 diffs)
-
c/objects/Node.h (modified) (5 diffs)
-
c/objects/Numerics/ElementMatrix.cpp (modified) (27 diffs)
-
c/objects/Numerics/ElementMatrix.h (modified) (5 diffs)
-
c/objects/Numerics/ElementVector.cpp (modified) (16 diffs)
-
c/objects/Numerics/ElementVector.h (modified) (5 diffs)
-
c/objects/Numerics/Matrix.cpp (modified) (19 diffs)
-
c/objects/Numerics/Matrix.h (modified) (3 diffs)
-
c/objects/Numerics/Vector.cpp (modified) (26 diffs)
-
c/objects/Numerics/Vector.h (modified) (4 diffs)
-
c/objects/Options/Option.cpp (modified) (11 diffs)
-
c/objects/Options/Option.h (modified) (3 diffs)
-
c/objects/Options/OptionCell.cpp (modified) (11 diffs)
-
c/objects/Options/OptionCell.h (modified) (3 diffs)
-
c/objects/Options/OptionChar.cpp (modified) (16 diffs)
-
c/objects/Options/OptionChar.h (modified) (3 diffs)
-
c/objects/Options/OptionDouble.cpp (modified) (12 diffs)
-
c/objects/Options/OptionDouble.h (modified) (4 diffs)
-
c/objects/Options/OptionLogical.cpp (modified) (11 diffs)
-
c/objects/Options/OptionLogical.h (modified) (3 diffs)
-
c/objects/Options/OptionStruct.cpp (modified) (13 diffs)
-
c/objects/Options/OptionStruct.h (modified) (3 diffs)
-
c/objects/Options/OptionUtilities.cpp (modified) (11 diffs)
-
c/objects/Options/OptionUtilities.h (modified) (1 diff)
-
c/objects/Params/BoolParam.cpp (modified) (7 diffs)
-
c/objects/Params/BoolParam.h (modified) (3 diffs)
-
c/objects/Params/DoubleMatArrayParam.cpp (modified) (15 diffs)
-
c/objects/Params/DoubleMatArrayParam.h (modified) (4 diffs)
-
c/objects/Params/DoubleMatParam.cpp (modified) (9 diffs)
-
c/objects/Params/DoubleMatParam.h (modified) (3 diffs)
-
c/objects/Params/DoubleParam.cpp (modified) (6 diffs)
-
c/objects/Params/DoubleParam.h (modified) (4 diffs)
-
c/objects/Params/DoubleTransientMatParam.cpp (modified) (2 diffs)
-
c/objects/Params/DoubleTransientMatParam.h (modified) (2 diffs)
-
c/objects/Params/DoubleVecParam.cpp (modified) (7 diffs)
-
c/objects/Params/DoubleVecParam.h (modified) (3 diffs)
-
c/objects/Params/FileParam.cpp (modified) (7 diffs)
-
c/objects/Params/FileParam.h (modified) (3 diffs)
-
c/objects/Params/IntMatParam.cpp (modified) (9 diffs)
-
c/objects/Params/IntMatParam.h (modified) (3 diffs)
-
c/objects/Params/IntParam.cpp (modified) (7 diffs)
-
c/objects/Params/IntParam.h (modified) (3 diffs)
-
c/objects/Params/IntVecParam.cpp (modified) (10 diffs)
-
c/objects/Params/IntVecParam.h (modified) (3 diffs)
-
c/objects/Params/MatrixParam.cpp (modified) (9 diffs)
-
c/objects/Params/MatrixParam.h (modified) (3 diffs)
-
c/objects/Params/Param.h (modified) (4 diffs)
-
c/objects/Params/StringArrayParam.cpp (modified) (14 diffs)
-
c/objects/Params/StringArrayParam.h (modified) (3 diffs)
-
c/objects/Params/StringParam.cpp (modified) (8 diffs)
-
c/objects/Params/StringParam.h (modified) (3 diffs)
-
c/objects/Params/VectorParam.cpp (modified) (9 diffs)
-
c/objects/Params/VectorParam.h (modified) (3 diffs)
-
c/objects/Patch.cpp (modified) (12 diffs)
-
c/objects/Segment.cpp (modified) (7 diffs)
-
c/objects/Segment.h (modified) (2 diffs)
-
c/objects/Update.h (modified) (1 diff)
-
c/objects/Vertex.cpp (modified) (12 diffs)
-
c/objects/Vertex.h (modified) (5 diffs)
-
c/python/include/python_macros.h (modified) (5 diffs)
-
c/python/io/CheckNumPythonArguments.cpp (modified) (1 diff)
-
c/python/io/FetchPythonData.cpp (modified) (10 diffs)
-
c/python/io/WritePythonData.cpp (modified) (4 diffs)
-
c/shared/Alloc/alloc.cpp (modified) (3 diffs)
-
c/shared/Alloc/xNewDelete.h (modified) (1 diff)
-
c/shared/Dofs (deleted)
-
c/shared/Elements/Arrhenius.cpp (modified) (2 diffs)
-
c/shared/Elements/CoordinateSystemTransform.cpp (modified) (3 diffs)
-
c/shared/Elements/GetGlobalDofList.cpp (modified) (3 diffs)
-
c/shared/Elements/GetLocalDofList.cpp (modified) (3 diffs)
-
c/shared/Elements/GetVerticesCoordinates.cpp (modified) (1 diff)
-
c/shared/Elements/Paterson.cpp (modified) (2 diffs)
-
c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp (modified) (5 diffs)
-
c/shared/Elements/TransformLoadVectorCoord.cpp (modified) (5 diffs)
-
c/shared/Elements/TransformSolutionCoord.cpp (modified) (4 diffs)
-
c/shared/Elements/TransformStiffnessMatrixCoord.cpp (modified) (5 diffs)
-
c/shared/Elements/elements.h (modified) (2 diffs)
-
c/shared/Exceptions/Exceptions.cpp (modified) (2 diffs)
-
c/shared/Exceptions/exceptions.h (modified) (1 diff)
-
c/shared/Exceptions/exprintf.cpp (modified) (2 diffs)
-
c/shared/Exp/DomainOutlineRead.cpp (modified) (4 diffs)
-
c/shared/Exp/DomainOutlineWrite.cpp (modified) (1 diff)
-
c/shared/Exp/IsInPoly.cpp (modified) (3 diffs)
-
c/shared/Matrix/MatrixUtils.cpp (modified) (20 diffs)
-
c/shared/Matrix/matrix.h (modified) (1 diff)
-
c/shared/MemOps (copied) (copied from issm/trunk-jpl/src/c/shared/MemOps )
-
c/shared/MemOps/xMemCpy.h (copied) (copied from issm/trunk-jpl/src/c/shared/MemOps/xMemCpy.h )
-
c/shared/Numerics/BrentSearch.cpp (modified) (8 diffs)
-
c/shared/Numerics/GaussPoints.cpp (modified) (90 diffs)
-
c/shared/Numerics/GaussPoints.h (modified) (1 diff)
-
c/shared/Numerics/IsInputConverged.cpp (modified) (2 diffs)
-
c/shared/Numerics/OptimalSearch.cpp (modified) (3 diffs)
-
c/shared/Numerics/OptionsFromAnalysis.cpp (modified) (2 diffs)
-
c/shared/Numerics/PetscOptionsFromAnalysis.cpp (modified) (1 diff)
-
c/shared/Numerics/Synchronize.sh (modified) (4 diffs)
-
c/shared/Numerics/UnitConversion.cpp (modified) (5 diffs)
-
c/shared/Numerics/Verbosity.cpp (modified) (1 diff)
-
c/shared/Numerics/XZvectorsToCoordinateSystem.cpp (modified) (1 diff)
-
c/shared/Numerics/cross.cpp (modified) (1 diff)
-
c/shared/Numerics/extrema.cpp (modified) (2 diffs)
-
c/shared/Numerics/isnan.cpp (modified) (1 diff)
-
c/shared/Numerics/isnan.h (modified) (1 diff)
-
c/shared/Numerics/numerics.h (modified) (2 diffs)
-
c/shared/Numerics/recast.h (copied) (copied from issm/trunk-jpl/src/c/shared/Numerics/recast.h )
-
c/shared/String/DescriptorIndex.cpp (modified) (3 diffs)
-
c/shared/Sys (copied) (copied from issm/trunk-jpl/src/c/shared/Sys )
-
c/shared/Sys/ProfilingEnd.cpp (copied) (copied from issm/trunk-jpl/src/c/shared/Sys/ProfilingEnd.cpp )
-
c/shared/Sys/ProfilingStart.cpp (copied) (copied from issm/trunk-jpl/src/c/shared/Sys/ProfilingStart.cpp )
-
c/shared/Sys/sys.h (copied) (copied from issm/trunk-jpl/src/c/shared/Sys/sys.h )
-
c/shared/Threads/LaunchThread.cpp (modified) (3 diffs)
-
c/shared/TriMesh/SplitMeshForRifts.cpp (modified) (2 diffs)
-
c/shared/TriMesh/TriMeshUtils.cpp (modified) (32 diffs)
-
c/shared/shared.h (modified) (1 diff)
-
c/solutions/AdjointCorePointerFromSolutionEnum.cpp (modified) (1 diff)
-
c/solutions/AnalysisConfiguration.cpp (modified) (12 diffs)
-
c/solutions/CorePointerFromSolutionEnum.cpp (modified) (10 diffs)
-
c/solutions/ProcessArguments.cpp (modified) (1 diff)
-
c/solutions/ResetBoundaryConditions.cpp (modified) (1 diff)
-
c/solutions/WriteLockFile.cpp (modified) (1 diff)
-
c/solutions/adjointbalancethickness_core.cpp (modified) (3 diffs)
-
c/solutions/adjointdiagnostic_core.cpp (modified) (3 diffs)
-
c/solutions/balancethickness_core.cpp (modified) (1 diff)
-
c/solutions/bedslope_core.cpp (modified) (2 diffs)
-
c/solutions/control_core.cpp (modified) (9 diffs)
-
c/solutions/controlconvergence.cpp (modified) (2 diffs)
-
c/solutions/controlrestart.cpp (modified) (2 diffs)
-
c/solutions/controltao_core.cpp (modified) (13 diffs)
-
c/solutions/convergence.cpp (modified) (7 diffs)
-
c/solutions/diagnostic_core.cpp (modified) (6 diffs)
-
c/solutions/enthalpy_core.cpp (modified) (2 diffs)
-
c/solutions/gradient_core.cpp (modified) (4 diffs)
-
c/solutions/hydrology_core.cpp (modified) (4 diffs)
-
c/solutions/hydrology_core_step.cpp (modified) (1 diff)
-
c/solutions/issm.cpp (modified) (10 diffs)
-
c/solutions/kriging.cpp (copied) (copied from issm/trunk-jpl/src/c/solutions/kriging.cpp )
-
c/solutions/objectivefunction.cpp (modified) (4 diffs)
-
c/solutions/prognostic_core.cpp (modified) (2 diffs)
-
c/solutions/solutions.h (modified) (2 diffs)
-
c/solutions/steadystate_core.cpp (modified) (6 diffs)
-
c/solutions/steadystateconvergence.cpp (modified) (1 diff)
-
c/solutions/surfaceslope_core.cpp (modified) (2 diffs)
-
c/solutions/thermal_core.cpp (modified) (2 diffs)
-
c/solutions/transient_core.cpp (modified) (8 diffs)
-
c/solvers/solver_newton.cpp (modified) (3 diffs)
-
c/solvers/solver_nonlinear.cpp (modified) (4 diffs)
-
c/solvers/solver_stokescoupling_nonlinear.cpp (modified) (1 diff)
-
c/solvers/solver_thermal_nonlinear.cpp (modified) (3 diffs)
-
c/toolkits/issm/SeqMat.cpp (modified) (15 diffs)
-
c/toolkits/issm/SeqMat.h (modified) (3 diffs)
-
c/toolkits/issm/SeqVec.cpp (modified) (20 diffs)
-
c/toolkits/issm/SeqVec.h (modified) (3 diffs)
-
c/toolkits/issm/issmtoolkit.h (modified) (1 diff)
-
c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp (modified) (4 diffs)
-
c/toolkits/mpi/patches/DetermineLocalSize.cpp (modified) (3 diffs)
-
c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp (modified) (2 diffs)
-
c/toolkits/petsc/patches/GetOwnershipBoundariesFromRange.cpp (modified) (2 diffs)
-
c/toolkits/petsc/patches/ISSMToPetscInsertMode.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/ISSMToPetscNormMode.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/MatInvert.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/MatMultPatch.cpp (modified) (3 diffs)
-
c/toolkits/petsc/patches/MatPartition.cpp (modified) (4 diffs)
-
c/toolkits/petsc/patches/MatToSerial.cpp (modified) (3 diffs)
-
c/toolkits/petsc/patches/NewMat.cpp (modified) (3 diffs)
-
c/toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/PetscVectorToDoubleVector.cpp (modified) (1 diff)
-
c/toolkits/petsc/patches/SerialToVec.cpp (modified) (2 diffs)
-
c/toolkits/petsc/patches/VecMerge.cpp (modified) (3 diffs)
-
c/toolkits/petsc/patches/VecPartition.cpp (modified) (3 diffs)
-
c/toolkits/petsc/patches/VecToMPISerial.cpp (modified) (3 diffs)
-
c/toolkits/petsc/patches/VecTranspose.cpp (modified) (2 diffs)
-
c/toolkits/plapack/patches/CyclicalFactorization.cpp (modified) (2 diffs)
-
c/toolkits/plapack/patches/PlapackInvertMatrix.cpp (modified) (5 diffs)
-
c/toolkits/plapack/patches/PlapackToPetsc.cpp (modified) (4 diffs)
-
dox/issm.dox (modified) (4 diffs)
-
m/classes/autodiff.m (modified) (1 diff)
-
m/classes/balancethickness.m (modified) (1 diff)
-
m/classes/bamggeom.m (modified) (3 diffs)
-
m/classes/bamgmesh.m (modified) (3 diffs)
-
m/classes/basalforcings.m (modified) (1 diff)
-
m/classes/clusters/acenet.m (modified) (6 diffs)
-
m/classes/clusters/castor.m (modified) (5 diffs)
-
m/classes/clusters/cosmos.m (modified) (5 diffs)
-
m/classes/clusters/discover.m (copied) (copied from issm/trunk-jpl/src/m/classes/clusters/discover.m )
-
m/classes/clusters/gemini.m (modified) (5 diffs)
-
m/classes/clusters/generic.m (modified) (6 diffs)
-
m/classes/clusters/generic.py (modified) (1 diff)
-
m/classes/clusters/greenplanet.m (modified) (8 diffs)
-
m/classes/clusters/none.m (deleted)
-
m/classes/clusters/none.py (deleted)
-
m/classes/clusters/pfe.m (modified) (9 diffs)
-
m/classes/clusters/pollux.m (modified) (5 diffs)
-
m/classes/constants.m (modified) (1 diff)
-
m/classes/debug.m (modified) (2 diffs)
-
m/classes/diagnostic.m (modified) (4 diffs)
-
m/classes/flaim.m (modified) (1 diff)
-
m/classes/flowequation.m (modified) (1 diff)
-
m/classes/friction.m (modified) (1 diff)
-
m/classes/geometry.m (modified) (1 diff)
-
m/classes/groundingline.m (modified) (1 diff)
-
m/classes/hydrology.m (modified) (1 diff)
-
m/classes/initialization.m (modified) (1 diff)
-
m/classes/inversion.m (modified) (2 diffs)
-
m/classes/mask.m (modified) (1 diff)
-
m/classes/materials.m (modified) (2 diffs)
-
m/classes/mesh.m (modified) (2 diffs)
-
m/classes/miscellaneous.m (modified) (1 diff)
-
m/classes/model.py (deleted)
-
m/classes/model/model.m (modified) (5 diffs)
-
m/classes/model/model.py (copied) (copied from issm/trunk-jpl/src/m/classes/model/model.py )
-
m/classes/model/planet.m (modified) (2 diffs)
-
m/classes/organizer.m (modified) (8 diffs)
-
m/classes/pairoptions.m (modified) (1 diff)
-
m/classes/pairoptions.py (modified) (1 diff)
-
m/classes/plotoptions.m (modified) (3 diffs)
-
m/classes/private.m (modified) (3 diffs)
-
m/classes/prognostic.m (modified) (1 diff)
-
m/classes/qmu.m (modified) (3 diffs)
-
m/classes/rifts.m (modified) (2 diffs)
-
m/classes/settings.m (modified) (1 diff)
-
m/classes/solver.m (modified) (2 diffs)
-
m/classes/steadystate.m (modified) (2 diffs)
-
m/classes/surfaceforcings.m (modified) (4 diffs)
-
m/classes/thermal.m (modified) (1 diff)
-
m/classes/timestepping.m (modified) (1 diff)
-
m/classes/transient.m (modified) (1 diff)
-
m/classes/verbose.m (modified) (5 diffs)
-
m/enum/DebugPetscProfilingEnum.m (deleted)
-
m/enum/DebugProfilingEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/DebugProfilingEnum.m )
-
m/enum/EnumDefinitions.py (copied) (copied from issm/trunk-jpl/src/m/enum/EnumDefinitions.py )
-
m/enum/MaximumNumberOfEnums.m (modified) (1 diff)
-
m/enum/PetscProfilingCurrentFlopsEnum.m (deleted)
-
m/enum/PetscProfilingCurrentMemEnum.m (deleted)
-
m/enum/PetscProfilingSolutionTimeEnum.m (deleted)
-
m/enum/ProfilingCurrentFlopsEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/ProfilingCurrentFlopsEnum.m )
-
m/enum/ProfilingCurrentMemEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/ProfilingCurrentMemEnum.m )
-
m/enum/ProfilingSolutionTimeEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/ProfilingSolutionTimeEnum.m )
-
m/enum/SurfaceforcingsANegEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsANegEnum.m )
-
m/enum/SurfaceforcingsAPosEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsAPosEnum.m )
-
m/enum/SurfaceforcingsBNegEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsBNegEnum.m )
-
m/enum/SurfaceforcingsBPosEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsBPosEnum.m )
-
m/enum/SurfaceforcingsHcEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsHcEnum.m )
-
m/enum/SurfaceforcingsIssmbgradientsEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsIssmbgradientsEnum.m )
-
m/enum/SurfaceforcingsSmbPosMaxEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsSmbPosMaxEnum.m )
-
m/enum/SurfaceforcingsSmbPosMinEnum.m (copied) (copied from issm/trunk-jpl/src/m/enum/SurfaceforcingsSmbPosMinEnum.m )
-
m/model/MatlabFuncs.py (copied) (copied from issm/trunk-jpl/src/m/model/MatlabFuncs.py )
-
m/model/ProfileValues.m (copied) (copied from issm/trunk-jpl/src/m/model/ProfileValues.m )
-
m/model/SectionValues.m (modified) (1 diff)
-
m/model/WriteData.m (modified) (3 diffs)
-
m/model/WriteData.py (copied) (copied from issm/trunk-jpl/src/m/model/WriteData.py )
-
m/model/averaging.m (modified) (2 diffs)
-
m/model/collapse.m (modified) (2 diffs)
-
m/model/contourenvelope.m (modified) (5 diffs)
-
m/model/ismodelselfconsistent.m (modified) (2 diffs)
-
m/model/loadresultsfromcluster.m (modified) (1 diff)
-
m/model/loadresultsfromdisk.m (modified) (1 diff)
-
m/model/marshall.m (modified) (1 diff)
-
m/model/marshall.py (copied) (copied from issm/trunk-jpl/src/m/model/marshall.py )
-
m/model/mesh/bamg.m (modified) (3 diffs)
-
m/model/modelextract.m (modified) (3 diffs)
-
m/model/plot/applyoptions.m (modified) (6 diffs)
-
m/model/plot/colormaps (copied) (copied from issm/trunk-jpl/src/m/model/plot/colormaps )
-
m/model/plot/colormaps/getcolormap.m (copied) (copied from issm/trunk-jpl/src/m/model/plot/colormaps/getcolormap.m )
-
m/model/plot/colormaps/haxby.m (copied) (copied from issm/trunk-jpl/src/m/model/plot/colormaps/haxby.m )
-
m/model/plot/colormaps/lbmap.m (copied) (copied from issm/trunk-jpl/src/m/model/plot/colormaps/lbmap.m )
-
m/model/plot/plot_gridded.m (modified) (4 diffs)
-
m/model/plot/plot_manager.m (modified) (1 diff)
-
m/model/plot/plot_overlay.m (modified) (4 diffs)
-
m/model/plot/plot_profile.m (copied) (copied from issm/trunk-jpl/src/m/model/plot/plot_profile.m )
-
m/model/plot/plotdoc.m (modified) (1 diff)
-
m/model/plot/plotmodel.m (modified) (1 diff)
-
m/model/plot/subplotmodel.m (modified) (1 diff)
-
m/model/process_solve_options.py (copied) (copied from issm/trunk-jpl/src/m/model/process_solve_options.py )
-
m/model/radarpower.m (modified) (2 diffs)
-
m/model/regionaltransient2d.m (modified) (1 diff)
-
m/model/setmask.m (modified) (1 diff)
-
m/model/setmask.py (modified) (1 diff)
-
m/model/solve.m (modified) (3 diffs)
-
m/model/solveparallel.m (deleted)
-
m/model/solvers/stokesoptions.m (modified) (1 diff)
-
m/model/waitonlock.py (copied) (copied from issm/trunk-jpl/src/m/model/waitonlock.py )
-
m/qmu/preqmu.m (modified) (2 diffs)
-
m/utils/Basins/basinzoom.m (modified) (1 diff)
-
m/utils/Basins/isbasin.m (modified) (1 diff)
-
m/utils/Basins/showbasins.m (modified) (1 diff)
-
m/utils/Cluster/parallelrange.py (copied) (copied from issm/trunk-jpl/src/m/utils/Cluster/parallelrange.py )
-
m/utils/DataProcessing/pkriging.m (copied) (copied from issm/trunk-jpl/src/m/utils/DataProcessing/pkriging.m )
-
m/utils/Exp/expcoarsen.m (modified) (1 diff)
-
m/utils/Exp/expcontract.m (modified) (1 diff)
-
m/utils/Exp/expll2xy.m (modified) (1 diff)
-
m/utils/Exp/expxy2ll.m (modified) (1 diff)
-
m/utils/Exp/manipulation/cutarea.m (modified) (3 diffs)
-
m/utils/Geometry/find_point.m (modified) (1 diff)
-
m/utils/Kml/exp2kml.m (modified) (1 diff)
-
m/utils/Miscellaneous/issmdoc.m (modified) (1 diff)
-
m/utils/Model/loadmodel.m (modified) (1 diff)
-
m/utils/Numerics/cfl_step.m (modified) (1 diff)
-
m/utils/consistency/checkfield.m (modified) (15 diffs)
-
m/utils/consistency/checkmessage.m (deleted)
-
m/utils/consistency/modelconsistency.m (deleted)
-
modules/AverageFilter/AverageFilter.cpp (modified) (1 diff)
-
modules/BamgConvertMesh/BamgConvertMesh.cpp (modified) (3 diffs)
-
modules/BamgMesher/BamgMesher.cpp (modified) (1 diff)
-
modules/BamgTriangulate/BamgTriangulate.cpp (modified) (2 diffs)
-
modules/Chaco/Chaco.cpp (modified) (3 diffs)
-
modules/ContourToMesh/ContourToMesh.cpp (modified) (4 diffs)
-
modules/ContourToNodes/ContourToNodes.cpp (modified) (2 diffs)
-
modules/ElementConnectivity/ElementConnectivity.cpp (modified) (1 diff)
-
modules/EnumToString/EnumToString.cpp (modified) (2 diffs)
-
modules/Exp2Kml/Exp2Kml.cpp (modified) (3 diffs)
-
modules/HoleFiller/HoleFiller.cpp (modified) (1 diff)
-
modules/InternalFront/InternalFront.cpp (modified) (2 diffs)
-
modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp (modified) (2 diffs)
-
modules/InterpFromMesh2d/InterpFromMesh2d.cpp (modified) (4 diffs)
-
modules/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp (modified) (1 diff)
-
modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp (modified) (3 diffs)
-
modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h (modified) (5 diffs)
-
modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp (modified) (2 diffs)
-
modules/KMLFileRead/KMLFileRead.cpp (modified) (4 diffs)
-
modules/KMLMeshWrite/KMLMeshWrite.cpp (modified) (3 diffs)
-
modules/KMLOverlay/KMLOverlay.cpp (modified) (5 diffs)
-
modules/Kml2Exp/Kml2Exp.cpp (modified) (3 diffs)
-
modules/Kriging/Kriging.cpp (modified) (2 diffs)
-
modules/Ll2xy/Ll2xy.cpp (modified) (3 diffs)
-
modules/MeshPartition/MeshPartition.cpp (modified) (1 diff)
-
modules/MeshProfileIntersection/MeshProfileIntersection.cpp (modified) (3 diffs)
-
modules/NodeConnectivity/NodeConnectivity.cpp (modified) (1 diff)
-
modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp (modified) (1 diff)
-
modules/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp (modified) (1 diff)
-
modules/Scotch/Scotch.cpp (modified) (1 diff)
-
modules/Shp2Kml/Shp2Kml.cpp (modified) (4 diffs)
-
modules/StringToEnum/StringToEnum.cpp (modified) (2 diffs)
-
modules/TriMesh/TriMesh.cpp (modified) (1 diff)
-
modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp (modified) (7 diffs)
-
modules/TriaSearch/TriaSearch.cpp (modified) (3 diffs)
-
modules/Xy2ll/Xy2ll.cpp (modified) (4 diffs)
-
modules/matlab/Makefile.am (modified) (3 diffs)
-
modules/python/Makefile.am (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/ad/todo
r12331 r12706 41 41 Create an alloc layer with template functions for new and delete. 42 42 Check that the new code is modular --without-kml, options are up to date. 43 44 Replace memcpy, realloc with x layers. Replace all calls to malloc and free in the code. -
issm/trunk/src/c/Container/Constraints.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Constraints::Constraints(){{{ 1*/27 /*FUNCTION Constraints::Constraints(){{{*/ 28 28 Constraints::Constraints(){ 29 29 enum_type=ConstraintsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Constraints::~Constraints(){{{ 1*/33 /*FUNCTION Constraints::~Constraints(){{{*/ 34 34 Constraints::~Constraints(){ 35 35 return; … … 38 38 39 39 /*Numerics: */ 40 /*FUNCTION Constraints::NumberOfConstraints{{{ 1*/40 /*FUNCTION Constraints::NumberOfConstraints{{{*/ 41 41 int Constraints::NumberOfConstraints(void){ 42 42 -
issm/trunk/src/c/Container/Constraints.h
r10522 r12706 21 21 public: 22 22 23 /*constructors, destructors: {{{ 1*/23 /*constructors, destructors: {{{*/ 24 24 Constraints(); 25 25 ~Constraints(); 26 26 /*}}}*/ 27 /*numerics: {{{ 1*/27 /*numerics: {{{*/ 28 28 int NumberOfConstraints(void); 29 29 /*}}}*/ -
issm/trunk/src/c/Container/Container.h
r7737 r12706 6 6 #define _CONTAINER_CONTAINER_H_ 7 7 8 #include "../include/include.h" 8 9 #include "./DataSet.h" 9 10 #include "./Constraints.h" … … 17 18 #include "./Results.h" 18 19 #include "./Vertices.h" 20 #include "./Observations.h" 19 21 20 22 #endif //ifndef _CONTAINER_H_ -
issm/trunk/src/c/Container/DataSet.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 28 28 29 29 /*Constructors/Destructors*/ 30 /*FUNCTION DataSet::DataSet(){{{ 1*/30 /*FUNCTION DataSet::DataSet(){{{*/ 31 31 DataSet::DataSet(){ 32 32 … … 37 37 } 38 38 /*}}}*/ 39 /*FUNCTION DataSet::DataSet(int dataset_enum){{{ 1*/39 /*FUNCTION DataSet::DataSet(int dataset_enum){{{*/ 40 40 DataSet::DataSet(int dataset_enum){ 41 41 enum_type=dataset_enum; … … 47 47 } 48 48 /*}}}*/ 49 /*FUNCTION DataSet::Copy{{{ 1*/49 /*FUNCTION DataSet::Copy{{{*/ 50 50 DataSet* DataSet::Copy(void){ 51 51 … … 59 59 copy->presorted=presorted; 60 60 if(sorted_ids){ 61 copy->sorted_ids= (int*)xmalloc(objects.size()*sizeof(int));62 memcpy(copy->sorted_ids,sorted_ids,objects.size()*sizeof(int));61 copy->sorted_ids=xNew<int>(objects.size()); 62 xMemCpy<int>(copy->sorted_ids,sorted_ids,objects.size()); 63 63 } 64 64 if(id_offsets){ 65 copy->id_offsets= (int*)xmalloc(objects.size()*sizeof(int));66 memcpy(copy->id_offsets,id_offsets,objects.size()*sizeof(int));65 copy->id_offsets=xNew<int>(objects.size()); 66 xMemCpy<int>(copy->id_offsets,id_offsets,objects.size()); 67 67 } 68 68 … … 77 77 } 78 78 /*}}}*/ 79 /*FUNCTION DataSet::~DataSet{{{ 1*/79 /*FUNCTION DataSet::~DataSet{{{*/ 80 80 DataSet::~DataSet(){ 81 81 clear(); 82 x free((void**)&sorted_ids);83 x free((void**)&id_offsets);82 xDelete<int>(sorted_ids); 83 xDelete<int>(id_offsets); 84 84 } 85 85 /*}}}*/ 86 86 87 87 /*Specific methods*/ 88 /*FUNCTION DataSet::AddObject{{{ 1*/88 /*FUNCTION DataSet::AddObject{{{*/ 89 89 int DataSet::AddObject(Object* object){ 90 90 … … 94 94 } 95 95 /*}}}*/ 96 /*FUNCTION DataSet::clear{{{ 1*/96 /*FUNCTION DataSet::clear{{{*/ 97 97 void DataSet::clear(){ 98 98 … … 112 112 } 113 113 /*}}}*/ 114 /*FUNCTION DataSet::DeleteObject{{{ 1*/114 /*FUNCTION DataSet::DeleteObject{{{*/ 115 115 int DataSet::DeleteObject(Object* object){ 116 116 … … 127 127 } 128 128 /*}}}*/ 129 /*FUNCTION DataSet::DeepEcho{{{ 1*/129 /*FUNCTION DataSet::DeepEcho{{{*/ 130 130 void DataSet::DeepEcho(){ 131 131 … … 133 133 vector<Object*>::iterator object; 134 134 135 if(this==NULL)_error _("trying to echo a NULL dataset");136 137 _p rintf_(true,"DataSet echo: %i objects\n",objects.size());135 if(this==NULL)_error2_("trying to echo a NULL dataset"); 136 137 _pprintLine_("DataSet echo: " << objects.size() << " objects"); 138 138 139 139 for ( object=objects.begin() ; object < objects.end(); object++ ){ … … 145 145 } 146 146 /*}}}*/ 147 /*FUNCTION DataSet::Echo{{{ 1*/147 /*FUNCTION DataSet::Echo{{{*/ 148 148 void DataSet::Echo(){ 149 149 150 150 vector<Object*>::iterator object; 151 151 152 if(this==NULL)_error _("trying to echo a NULL dataset");153 154 _p rintf_(true,"DataSet echo: %i objects\n",objects.size());152 if(this==NULL)_error2_("trying to echo a NULL dataset"); 153 154 _pprintLine_("DataSet echo: " << objects.size() << " objects"); 155 155 156 156 for ( object=objects.begin() ; object < objects.end(); object++ ){ … … 163 163 } 164 164 /*}}}*/ 165 /*FUNCTION DataSet::GetEnum(){{{ 1*/165 /*FUNCTION DataSet::GetEnum(){{{*/ 166 166 int DataSet::GetEnum(){ 167 167 return enum_type; 168 168 } 169 169 /*}}}*/ 170 /*FUNCTION DataSet::GetEnum(int offset){{{ 1*/170 /*FUNCTION DataSet::GetEnum(int offset){{{*/ 171 171 int DataSet::GetEnum(int offset){ 172 172 … … 175 175 } 176 176 /*}}}*/ 177 /*FUNCTION DataSet::GetObjectByOffset{{{ 1*/177 /*FUNCTION DataSet::GetObjectByOffset{{{*/ 178 178 Object* DataSet::GetObjectByOffset(int offset){ 179 179 … … 186 186 } 187 187 /*}}}*/ 188 /*FUNCTION DataSet::GetObjectById{{{ 1*/188 /*FUNCTION DataSet::GetObjectById{{{*/ 189 189 Object* DataSet::GetObjectById(int* poffset,int eid){ 190 190 … … 194 194 195 195 _assert_(this); 196 if(!sorted)_error _("trying to binary search on a non-sorted dataset!");196 if(!sorted)_error2_("trying to binary search on a non-sorted dataset!"); 197 197 198 198 /*Carry out a binary search on the sorted_ids: */ 199 199 if(!binary_search(&id_offset,eid, sorted_ids,objects.size())){ 200 _error _("could not find object with id %i in DataSet %s",eid,EnumToStringx(enum_type));200 _error2_("could not find object with id " << eid << " in DataSet " << EnumToStringx(enum_type)); 201 201 } 202 202 … … 211 211 } 212 212 /*}}}*/ 213 /*FUNCTION DataSet::Presort{{{ 1*/213 /*FUNCTION DataSet::Presort{{{*/ 214 214 void DataSet::Presort(){ 215 215 … … 221 221 222 222 /*Delete existing ids*/ 223 x free((void**)&sorted_ids);224 x free((void**)&id_offsets);223 xDelete<int>(sorted_ids); 224 xDelete<int>(id_offsets); 225 225 226 226 /*Allocate new ids*/ 227 sorted_ids= (int*)xmalloc(objects.size()*sizeof(int));228 id_offsets= (int*)xmalloc(objects.size()*sizeof(int));227 sorted_ids=xNew<int>(objects.size()); 228 id_offsets=xNew<int>(objects.size()); 229 229 230 230 /*Build id_offsets and sorted_ids*/ … … 239 239 } 240 240 /*}}}*/ 241 /*FUNCTION DataSet::SetSorting{{{ 1*/241 /*FUNCTION DataSet::SetSorting{{{*/ 242 242 void DataSet::SetSorting(int* in_sorted_ids,int* in_id_offsets){ 243 243 … … 247 247 } 248 248 /*}}}*/ 249 /*FUNCTION DataSet::Size{{{ 1*/249 /*FUNCTION DataSet::Size{{{*/ 250 250 int DataSet::Size(void){ 251 251 _assert_(this!=NULL); … … 254 254 } 255 255 /*}}}*/ 256 /*FUNCTION DataSet::Sort{{{ 1*/256 /*FUNCTION DataSet::Sort{{{*/ 257 257 void DataSet::Sort(){ 258 258 259 259 /*Only sort if we are not already sorted: */ 260 260 if(!sorted){ 261 _error _("not implemented yet!");262 } 263 } 264 /*}}}*/ 261 _error2_("not implemented yet!"); 262 } 263 } 264 /*}}}*/ -
issm/trunk/src/c/Container/DataSet.h
r12330 r12706 39 39 int* id_offsets; 40 40 41 /*constructors, destructors: {{{ 1*/41 /*constructors, destructors: {{{*/ 42 42 DataSet(); 43 43 DataSet(int enum_type); 44 44 ~DataSet(); 45 45 /*}}}*/ 46 /*management: {{{ 1*/46 /*management: {{{*/ 47 47 int GetEnum(); 48 48 int GetEnum(int offset); -
issm/trunk/src/c/Container/Elements.cpp
r12630 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Elements::Elements(){{{ 1*/27 /*FUNCTION Elements::Elements(){{{*/ 28 28 Elements::Elements(){ 29 29 enum_type=MeshElementsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Elements::~Elements(){{{ 1*/33 /*FUNCTION Elements::~Elements(){{{*/ 34 34 Elements::~Elements(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Elements::Configure{{{ 1*/40 /*FUNCTION Elements::Configure{{{*/ 41 41 void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 … … 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION Elements::ProcessResultsUnits{{{ 1*/55 /*FUNCTION Elements::ProcessResultsUnits{{{*/ 56 56 void Elements::ProcessResultsUnits(void){ 57 57 … … 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION Elements::DeleteResults{{{ 1*/65 /*FUNCTION Elements::DeleteResults{{{*/ 66 66 void Elements::DeleteResults(void){ 67 67 … … 72 72 } 73 73 /*}}}*/ 74 /*FUNCTION Elements::ResultsToPatch{{{ 1*/74 /*FUNCTION Elements::ResultsToPatch{{{*/ 75 75 Patch* Elements::ResultsToPatch(void){ 76 76 … … 148 148 } 149 149 /*}}}*/ 150 /*FUNCTION Elements::SetCurrentConfiguration{{{ 1*/150 /*FUNCTION Elements::SetCurrentConfiguration{{{*/ 151 151 void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 152 152 … … 163 163 } 164 164 /*}}}*/ 165 /*FUNCTION Elements::ToResults{{{ 1*/165 /*FUNCTION Elements::ToResults{{{*/ 166 166 void Elements::ToResults(Results* results,Parameters* parameters){ 167 167 … … 173 173 int *resultssizes = NULL; 174 174 int *resultssteps = NULL; 175 double *resultstimes = NULL;176 double *vector_serial= NULL;175 IssmDouble *resultstimes = NULL; 176 IssmDouble *vector_serial= NULL; 177 177 Vector* vector = NULL; 178 178 bool io_gather; … … 203 203 /*see what the first element of this partition has in stock (this is common to all partitions)*/ 204 204 if(my_rank==minrank){ 205 if(this->Size()==0) _error _("Cannot write results because there is no element??");205 if(this->Size()==0) _error2_("Cannot write results because there is no element??"); 206 206 Element* element=(Element*)this->GetObjectByOffset(0); 207 207 element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults); … … 215 215 #ifdef _HAVE_MPI_ 216 216 if(my_rank!=minrank){ 217 resultsenums= (int*)xmalloc(numberofresults*sizeof(int));218 resultssizes= (int*)xmalloc(numberofresults*sizeof(int));219 resultstimes= (double*)xmalloc(numberofresults*sizeof(double));220 resultssteps= (int*)xmalloc(numberofresults*sizeof(int));217 resultsenums=xNew<int>(numberofresults); 218 resultssizes=xNew<int>(numberofresults); 219 resultstimes=xNew<IssmDouble>(numberofresults); 220 resultssteps=xNew<int>(numberofresults); 221 221 } 222 222 MPI_Bcast(resultsenums,numberofresults,MPI_INT,minrank,MPI_COMM_WORLD); … … 232 232 if(resultssizes[i]==P1Enum) vectorsize=numberofvertices; 233 233 else if(resultssizes[i]==P0Enum) vectorsize=numberofelements; 234 else _error _("Unkown result size: %s",EnumToStringx(resultssizes[i]));234 else _error2_("Unkown result size: " << EnumToStringx(resultssizes[i])); 235 235 vector=new Vector(vectorsize); 236 236 … … 250 250 /*clean up*/ 251 251 xdelete(&vector); 252 x free((void**)&vector_serial);252 xDelete<IssmDouble>(vector_serial); 253 253 } 254 254 } … … 269 269 270 270 /*Free ressources:*/ 271 x free((void**)&resultsenums);272 x free((void**)&resultssizes);273 x free((void**)&resultstimes);274 x free((void**)&resultssteps);271 xDelete<int>(resultsenums); 272 xDelete<int>(resultssizes); 273 xDelete<int>(resultssteps); 274 xDelete<IssmDouble>(resultstimes); 275 275 delete patch; 276 276 } 277 277 /*}}}*/ 278 /*FUNCTION Elements::NumberOfElements{{{ 1*/278 /*FUNCTION Elements::NumberOfElements{{{*/ 279 279 int Elements::NumberOfElements(void){ 280 280 … … 292 292 } 293 293 /*}}}*/ 294 /*FUNCTION Elements::InputCopy{{{ 1*/294 /*FUNCTION Elements::InputCopy{{{*/ 295 295 void Elements::InputDuplicate(int input_enum,int output_enum){ 296 296 -
issm/trunk/src/c/Container/Elements.h
r11027 r12706 16 16 class Inputs; 17 17 18 19 18 class Elements: public DataSet{ 20 19 21 20 public: 22 21 23 /*constructors, destructors: {{{ 1*/22 /*constructors, destructors: {{{*/ 24 23 Elements(); 25 24 ~Elements(); 26 25 /*}}}*/ 27 /*numerics: {{{ 1*/26 /*numerics: {{{*/ 28 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 29 28 void DeleteResults(void); -
issm/trunk/src/c/Container/Inputs.cpp
r10522 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Inputs::Inputs(){{{ 1*/27 /*FUNCTION Inputs::Inputs(){{{*/ 28 28 Inputs::Inputs(){ 29 29 return; 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION Inputs::~Inputs(){{{ 1*/32 /*FUNCTION Inputs::~Inputs(){{{*/ 33 33 Inputs::~Inputs(){ 34 34 return; … … 37 37 38 38 /*Object management*/ 39 /*FUNCTION Inputs::GetInputValue(bool* pvalue,int enum-type){{{ 1*/39 /*FUNCTION Inputs::GetInputValue(bool* pvalue,int enum-type){{{*/ 40 40 void Inputs::GetInputValue(bool* pvalue,int enum_type){ 41 41 … … 57 57 /*we could not find an input with the correct enum type. No defaults values were provided, 58 58 * error out: */ 59 _error _("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));59 _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")"); 60 60 } 61 61 … … 65 65 } 66 66 /*}}}*/ 67 /*FUNCTION Inputs::GetInputValue(int* pvalue,int enum-type){{{ 1*/67 /*FUNCTION Inputs::GetInputValue(int* pvalue,int enum-type){{{*/ 68 68 void Inputs::GetInputValue(int* pvalue,int enum_type){ 69 69 … … 85 85 /*we could not find an input with the correct enum type. No defaults values were provided, 86 86 * error out: */ 87 _error _("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));87 _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")"); 88 88 } 89 89 … … 93 93 } 94 94 /*}}}*/ 95 /*FUNCTION Inputs::GetInputValue( double* pvalue,int enum-type){{{1*/96 void Inputs::GetInputValue( double* pvalue,int enum_type){95 /*FUNCTION Inputs::GetInputValue(IssmDouble* pvalue,int enum-type){{{*/ 96 void Inputs::GetInputValue(IssmDouble* pvalue,int enum_type){ 97 97 98 98 vector<Object*>::iterator object; … … 113 113 /*we could not find an input with the correct enum type. No defaults values were provided, 114 114 * error out: */ 115 _error _("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));115 _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")"); 116 116 } 117 117 … … 121 121 } 122 122 /*}}}*/ 123 /*FUNCTION Inputs::GetInputAverage{{{ 1*/124 void Inputs::GetInputAverage( double* pvalue,int enum_type){123 /*FUNCTION Inputs::GetInputAverage{{{*/ 124 void Inputs::GetInputAverage(IssmDouble* pvalue,int enum_type){ 125 125 126 126 vector<Object*>::iterator object; … … 141 141 /*we could not find an input with the correct enum type. No defaults values were provided, 142 142 * error out: */ 143 _error _("could not find input with enum type %i (%s)",enum_type,EnumToStringx(enum_type));143 _error2_("could not find input with enum type " << enum_type << " (" << EnumToStringx(enum_type) << ")"); 144 144 } 145 145 … … 149 149 } 150 150 /*}}}*/ 151 /*FUNCTION Inputs::AddInput{{{ 1*/151 /*FUNCTION Inputs::AddInput{{{*/ 152 152 int Inputs::AddInput(Input* in_input){ 153 153 … … 175 175 } 176 176 /*}}}*/ 177 /*FUNCTION Inputs::ChangeEnum{{{ 1*/177 /*FUNCTION Inputs::ChangeEnum{{{*/ 178 178 void Inputs::ChangeEnum(int oldenumtype,int newenumtype){ 179 179 … … 205 205 } 206 206 /*}}}*/ 207 /*FUNCTION Inputs::ConstrainMin{{{ 1*/208 void Inputs::ConstrainMin(int constrain_enum, double minimum){207 /*FUNCTION Inputs::ConstrainMin{{{*/ 208 void Inputs::ConstrainMin(int constrain_enum, IssmDouble minimum){ 209 209 210 210 Input* constrain_input=NULL; … … 213 213 214 214 /*some checks: */ 215 if(!constrain_input) _error _(" input %s could not be found!",EnumToStringx(constrain_enum));215 if(!constrain_input) _error2_("input " << EnumToStringx(constrain_enum) << " could not be found!"); 216 216 217 217 /*Apply ContrainMin: */ … … 219 219 } 220 220 /*}}}*/ 221 /*FUNCTION Inputs::InfinityNorm{{{ 1*/222 double Inputs::InfinityNorm(int enumtype){223 224 /*Output*/ 225 double norm;221 /*FUNCTION Inputs::InfinityNorm{{{*/ 222 IssmDouble Inputs::InfinityNorm(int enumtype){ 223 224 /*Output*/ 225 IssmDouble norm; 226 226 227 227 /*Get input*/ … … 240 240 } 241 241 /*}}}*/ 242 /*FUNCTION Inputs::Max{{{ 1*/243 double Inputs::Max(int enumtype){244 245 /*Output*/ 246 double max;242 /*FUNCTION Inputs::Max{{{*/ 243 IssmDouble Inputs::Max(int enumtype){ 244 245 /*Output*/ 246 IssmDouble max; 247 247 248 248 /*Get input*/ … … 254 254 } 255 255 else{ 256 _error _("Input %s not found",EnumToStringx(enumtype));256 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 257 257 } 258 258 … … 261 261 } 262 262 /*}}}*/ 263 /*FUNCTION Inputs::MaxAbs{{{ 1*/264 double Inputs::MaxAbs(int enumtype){265 266 /*Output*/ 267 double max;263 /*FUNCTION Inputs::MaxAbs{{{*/ 264 IssmDouble Inputs::MaxAbs(int enumtype){ 265 266 /*Output*/ 267 IssmDouble max; 268 268 269 269 /*Get input*/ … … 275 275 } 276 276 else{ 277 _error _("Input %s not found",EnumToStringx(enumtype));277 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 278 278 } 279 279 … … 282 282 } 283 283 /*}}}*/ 284 /*FUNCTION Inputs::Min{{{ 1*/285 double Inputs::Min(int enumtype){286 287 /*Output*/ 288 double min;284 /*FUNCTION Inputs::Min{{{*/ 285 IssmDouble Inputs::Min(int enumtype){ 286 287 /*Output*/ 288 IssmDouble min; 289 289 290 290 /*Get input*/ … … 296 296 } 297 297 else{ 298 _error _("Input %s not found",EnumToStringx(enumtype));298 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 299 299 } 300 300 … … 303 303 } 304 304 /*}}}*/ 305 /*FUNCTION Inputs::MinAbs{{{ 1*/306 double Inputs::MinAbs(int enumtype){307 308 /*Output*/ 309 double min;305 /*FUNCTION Inputs::MinAbs{{{*/ 306 IssmDouble Inputs::MinAbs(int enumtype){ 307 308 /*Output*/ 309 IssmDouble min; 310 310 311 311 /*Get input*/ … … 317 317 } 318 318 else{ 319 _error _("Input %s not found",EnumToStringx(enumtype));319 _error2_("Input " << EnumToStringx(enumtype) << " not found"); 320 320 } 321 321 … … 324 324 } 325 325 /*}}}*/ 326 /*FUNCTION Inputs::GetInput{{{ 1*/326 /*FUNCTION Inputs::GetInput{{{*/ 327 327 Input* Inputs::GetInput(int enum_name){ 328 328 … … 341 341 } 342 342 /*}}}*/ 343 /*FUNCTION Inputs::DeleteInput{{{ 1*/343 /*FUNCTION Inputs::DeleteInput{{{*/ 344 344 int Inputs::DeleteInput(int enum_type){ 345 345 … … 361 361 } 362 362 /*}}}*/ 363 /*FUNCTION Inputs::DuplicateInput{{{ 1*/363 /*FUNCTION Inputs::DuplicateInput{{{*/ 364 364 void Inputs::DuplicateInput(int original_enum,int new_enum){ 365 365 … … 369 369 /*Make a copy of the original input: */ 370 370 original=(Input*)this->GetInput(original_enum); 371 if(!original)_error _("could not find input with enum: %s",EnumToStringx(original_enum));371 if(!original)_error2_("could not find input with enum: " << EnumToStringx(original_enum)); 372 372 copy=(Input*)original->copy(); 373 373 … … 379 379 } 380 380 /*}}}*/ 381 /*FUNCTION Inputs::SpawnTriaInputs{{{ 1*/381 /*FUNCTION Inputs::SpawnTriaInputs{{{*/ 382 382 Inputs* Inputs::SpawnTriaInputs(int* indices){ 383 383 … … 405 405 } 406 406 /*}}}*/ 407 /*FUNCTION Inputs::AXPY{{{ 1*/408 void Inputs::AXPY(int MeshYEnum, double scalar, int MeshXEnum){407 /*FUNCTION Inputs::AXPY{{{*/ 408 void Inputs::AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum){ 409 409 410 410 Input* xinput=NULL; … … 416 416 417 417 /*some checks: */ 418 if(!xinput) _error _(" input %s could not be found!",EnumToStringx(MeshXEnum));419 if(!yinput) _error _(" input %s could not be found!",EnumToStringx(MeshYEnum));418 if(!xinput) _error2_("input " << EnumToStringx(MeshXEnum) << " could not be found!"); 419 if(!yinput) _error2_("input " << EnumToStringx(MeshYEnum) << " could not be found!"); 420 420 421 421 /*Apply AXPY: */ … … 423 423 } 424 424 /*}}}*/ 425 /*FUNCTION Inputs::Configure{{{ 1*/425 /*FUNCTION Inputs::Configure{{{*/ 426 426 void Inputs::Configure(Parameters* parameters){ 427 427 -
issm/trunk/src/c/Container/Inputs.h
r10522 r12706 23 23 public: 24 24 25 /*constructors, destructors: {{{ 1*/25 /*constructors, destructors: {{{*/ 26 26 Inputs(); 27 27 ~Inputs(); 28 28 29 29 /*}}}*/ 30 /*numerics: {{{ 1*/30 /*numerics: {{{*/ 31 31 int AddInput(Input* in_input); 32 32 void ChangeEnum(int enumtype,int new_enumtype); 33 void ConstrainMin(int constrain_enum, double minimum);33 void ConstrainMin(int constrain_enum, IssmDouble minimum); 34 34 int DeleteInput(int enum_type); 35 35 void DuplicateInput(int original_enum,int new_enum); 36 36 Input* GetInput(int enum_name); 37 37 Inputs* SpawnTriaInputs(int* indices); 38 void AXPY(int MeshYEnum, double scalar, int MeshXEnum);39 double InfinityNorm(int enumtype);40 double Max(int enumtype);41 double MaxAbs(int enumtype);42 double Min(int enumtype);43 double MinAbs(int enumtype);38 void AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum); 39 IssmDouble InfinityNorm(int enumtype); 40 IssmDouble Max(int enumtype); 41 IssmDouble MaxAbs(int enumtype); 42 IssmDouble Min(int enumtype); 43 IssmDouble MinAbs(int enumtype); 44 44 45 void GetInputAverage( double* pvalue, int enum_type);45 void GetInputAverage(IssmDouble* pvalue, int enum_type); 46 46 void GetInputValue(bool* pvalue,int enum_type); 47 47 void GetInputValue(int* pvalue,int enum_type); 48 void GetInputValue( double* pvalue,int enum_type);48 void GetInputValue(IssmDouble* pvalue,int enum_type); 49 49 50 50 void Configure(Parameters* parameters); -
issm/trunk/src/c/Container/Loads.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Loads::Loads(){{{ 1*/27 /*FUNCTION Loads::Loads(){{{*/ 28 28 Loads::Loads(){ 29 29 enum_type=LoadsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Loads::~Loads(){{{ 1*/33 /*FUNCTION Loads::~Loads(){{{*/ 34 34 Loads::~Loads(){ 35 35 return; … … 38 38 39 39 /*Numerics:*/ 40 /*FUNCTION Loads::Configure{{{ 1*/40 /*FUNCTION Loads::Configure{{{*/ 41 41 void Loads::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 … … 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION Loads::NumberOfLoads{{{ 1*/55 /*FUNCTION Loads::NumberOfLoads{{{*/ 56 56 int Loads::NumberOfLoads(void){ 57 57 … … 74 74 } 75 75 /*}}}*/ 76 /*FUNCTION Loads::SetCurrentConfiguration{{{ 1*/76 /*FUNCTION Loads::SetCurrentConfiguration{{{*/ 77 77 void Loads::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 78 78 -
issm/trunk/src/c/Container/Loads.h
r10522 r12706 20 20 public: 21 21 22 /*constructors, destructors: {{{ 1*/22 /*constructors, destructors: {{{*/ 23 23 Loads(); 24 24 ~Loads(); 25 25 /*}}}*/ 26 /*numerics: {{{ 1*/26 /*numerics: {{{*/ 27 27 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 28 28 int NumberOfLoads(void); -
issm/trunk/src/c/Container/Materials.cpp
r10522 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Materials::Materials(){{{ 1*/27 /*FUNCTION Materials::Materials(){{{*/ 28 28 Materials::Materials(){ 29 29 enum_type=MaterialsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Materials::~Materials(){{{ 1*/33 /*FUNCTION Materials::~Materials(){{{*/ 34 34 Materials::~Materials(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Materials::Configure{{{ 1*/40 /*FUNCTION Materials::Configure{{{*/ 41 41 void Materials::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 -
issm/trunk/src/c/Container/Materials.h
r10522 r12706 19 19 public: 20 20 21 /*constructors, destructors: {{{ 1*/21 /*constructors, destructors: {{{*/ 22 22 Materials(); 23 23 ~Materials(); 24 24 /*}}}*/ 25 /*numerics: {{{ 1*/25 /*numerics: {{{*/ 26 26 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 27 27 /*}}}*/ -
issm/trunk/src/c/Container/Nodes.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Nodes::Nodes(){{{ 1*/27 /*FUNCTION Nodes::Nodes(){{{*/ 28 28 Nodes::Nodes(){ 29 29 enum_type=NodesEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Nodes::~Nodes(){{{ 1*/33 /*FUNCTION Nodes::~Nodes(){{{*/ 34 34 Nodes::~Nodes(){ 35 35 return; … … 38 38 39 39 /*Numerics*/ 40 /*FUNCTION Nodes::Configure{{{ 1*/40 /*FUNCTION Nodes::Configure{{{*/ 41 41 void Nodes::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 42 42 … … 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION Nodes::DistributeDofs{{{ 1*/55 /*FUNCTION Nodes::DistributeDofs{{{*/ 56 56 void Nodes::DistributeDofs(int analysis_type,int setenum){ 57 57 … … 84 84 * cpus by the total last dofs of the previus cpu, starting from 0. 85 85 * First: get number of dofs for each cpu*/ 86 alldofcount= (int*)xmalloc(num_procs*sizeof(int));86 alldofcount=xNew<int>(num_procs); 87 87 #ifdef _HAVE_MPI_ 88 88 MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD); … … 113 113 numnodes=this->NumberOfNodes(analysis_type); 114 114 if(numnodes*maxdofspernode){ 115 truedofs= (int*)xcalloc(numnodes*maxdofspernode,sizeof(int)); //initialize to 0, so that we can pick up the max116 alltruedofs= (int*)xcalloc(numnodes*maxdofspernode,sizeof(int));115 truedofs= xNewZeroInit<int>(numnodes*maxdofspernode); //initialize to 0, so that we can pick up the max 116 alltruedofs=xNewZeroInit<int>(numnodes*maxdofspernode); 117 117 } 118 118 … … 139 139 140 140 /* Free ressources: */ 141 x free((void**)&alldofcount);142 x free((void**)&truedofs);143 x free((void**)&alltruedofs);144 } 145 /*}}}*/ 146 /*FUNCTION Nodes::FlagClones{{{ 1*/141 xDelete<int>(alldofcount); 142 xDelete<int>(truedofs); 143 xDelete<int>(alltruedofs); 144 } 145 /*}}}*/ 146 /*FUNCTION Nodes::FlagClones{{{*/ 147 147 void Nodes::FlagClones(int analysis_type){ 148 148 … … 158 158 159 159 /*Allocate ranks: */ 160 ranks= (int*)xmalloc(numnodes*sizeof(int));161 minranks= (int*)xmalloc(numnodes*sizeof(int));160 ranks=xNew<int>(numnodes); 161 minranks=xNew<int>(numnodes); 162 162 163 163 for(i=0;i<numnodes;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit. … … 190 190 191 191 /*Free ressources: */ 192 x free((void**)&ranks);193 x free((void**)&minranks);194 195 } 196 /*}}}*/ 197 /*FUNCTION Nodes::MaxNumDofs{{{ 1*/192 xDelete<int>(ranks); 193 xDelete<int>(minranks); 194 195 } 196 /*}}}*/ 197 /*FUNCTION Nodes::MaxNumDofs{{{*/ 198 198 int Nodes::MaxNumDofs(int analysis_type,int setenum){ 199 199 … … 225 225 } 226 226 /*}}}*/ 227 /*FUNCTION Nodes::NumberOfDofs{{{ 1*/227 /*FUNCTION Nodes::NumberOfDofs{{{*/ 228 228 int Nodes::NumberOfDofs(int analysis_type,int setenum){ 229 229 … … 259 259 } 260 260 /*}}}*/ 261 /*FUNCTION Nodes::NumberOfNodes(){{{ 1*/261 /*FUNCTION Nodes::NumberOfNodes(){{{*/ 262 262 int Nodes::NumberOfNodes(void){ 263 263 … … 287 287 } 288 288 /*}}}*/ 289 /*FUNCTION Nodes::NumberOfNodes(analysis){{{ 1*/289 /*FUNCTION Nodes::NumberOfNodes(analysis){{{*/ 290 290 int Nodes::NumberOfNodes(int analysis_type){ 291 291 … … 326 326 } 327 327 /*}}}*/ 328 /*FUNCTION Nodes::Ranks{{{ 1*/328 /*FUNCTION Nodes::Ranks{{{*/ 329 329 void Nodes::Ranks(int* ranks,int analysis_type){ 330 330 … … 352 352 } 353 353 /*}}}*/ 354 /*FUNCTION Nodes::SetCurrentConfiguration{{{ 1*/354 /*FUNCTION Nodes::SetCurrentConfiguration{{{*/ 355 355 void Nodes::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ 356 356 -
issm/trunk/src/c/Container/Nodes.h
r10522 r12706 13 13 public: 14 14 15 /*constructors, destructors: {{{ 1*/15 /*constructors, destructors: {{{*/ 16 16 Nodes(); 17 17 ~Nodes(); 18 18 /*}}}*/ 19 /*numerics: {{{ 1*/19 /*numerics: {{{*/ 20 20 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 21 21 void DistributeDofs(int analysis_type,int SETENUM); -
issm/trunk/src/c/Container/Observations.cpp
r12330 r12706 20 20 #include "../shared/shared.h" 21 21 #include "../include/include.h" 22 #include "../modules/modules.h" 22 23 #include "../EnumDefinitions/EnumDefinitions.h" 24 #include "../io/io.h" 23 25 24 26 using namespace std; … … 32 34 } 33 35 /*}}}*/ 34 /*FUNCTION Observations::Observations( double* observations_list,double* x,double* y,int n,Options* options){{{*/35 Observations::Observations( double* observations_list,double* x,double* y,int n,Options* options){36 /*FUNCTION Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){{{*/ 37 Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){ 36 38 37 39 /*Intermediaries*/ 38 40 int i,j,maxdepth,level,counter,index; 39 41 int xi,yi; 40 double xmin,xmax,ymin,ymax;41 double offset,minlength,minspacing,mintrimming,maxtrimming;42 IssmDouble xmin,xmax,ymin,ymax; 43 IssmDouble offset,minlength,minspacing,mintrimming,maxtrimming; 42 44 int *indices = NULL; 43 45 Observation *observation = NULL; … … 57 59 options->Get(&maxtrimming,"maxtrimming",+1.e+21); 58 60 options->Get(&minspacing,"minspacing",0.01); 59 if(minspacing<=0) _error _("minspacing must > 0");61 if(minspacing<=0) _error2_("minspacing must > 0"); 60 62 61 63 /*Get Minimum box size*/ 62 64 if(options->GetOption("boxlength")){ 63 65 options->Get(&minlength,"boxlength"); 64 if(minlength<=0)_error _("boxlength should be a positive number");66 if(minlength<=0)_error2_("boxlength should be a positive number"); 65 67 maxdepth=int(log(max(xmax-xmin,ymax-ymin)/minlength +1)/log(2.0)); 66 68 } 67 69 else{ 68 70 maxdepth = 30; 69 minlength=max(xmax-xmin,ymax-ymin)/ double((1L<<maxdepth)-1);71 minlength=max(xmax-xmin,ymax-ymin)/IssmDouble((1L<<maxdepth)-1); 70 72 } 71 73 72 74 /*Initialize Quadtree*/ 73 printf("Generating quadtree with a maximum box size %g (depth=%i)... ",minlength,maxdepth);75 _pprintString_("Generating quadtree with a maximum box size " << minlength << " (depth=" << maxdepth << ")... "); 74 76 this->quadtree = new Quadtree(xmin,xmax,ymin,ymax,maxdepth); 75 77 … … 101 103 } 102 104 } 103 printf("done\n");104 printf("Initial number of observations: %i\n",n);105 printf(" Final number of observations: %i\n",this->quadtree->NbObs);105 _pprintLine_("done"); 106 _pprintLine_("Initial number of observations: " << n); 107 _pprintLine_(" Final number of observations: " << this->quadtree->NbObs); 106 108 } 107 109 /*}}}*/ … … 114 116 115 117 /*Methods*/ 116 /*FUNCTION Observations::ObservationList{{{*/ 117 void Observations::ObservationList(double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata){ 118 /*FUNCTION Observations::ClosestObservation{{{*/ 119 void Observations::ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){ 120 121 /*Output and Intermediaries*/ 122 bool stop; 123 int nobs,i,index; 124 IssmDouble h2,hmin2,radius2; 125 int *indices = NULL; 126 Observation *observation = NULL; 127 128 /*If radius is not provided or is 0, return all observations*/ 129 if(radius==0) radius=this->quadtree->root->length; 130 131 /*Compute radius square*/ 132 radius2 = radius*radius; 133 134 /*Find all observations that are in radius*/ 135 this->quadtree->RangeSearch(&indices,&nobs,x_interp,y_interp,radius); 136 for (i=0;i<nobs;i++){ 137 observation=(Observation*)this->GetObjectByOffset(indices[i]); 138 h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp); 139 140 if(i==0){ 141 hmin2 = h2; 142 index = i; 143 } 144 else{ 145 if(h2<hmin2){ 146 hmin2 = h2; 147 index = i; 148 } 149 } 150 } 151 152 /*Assign output pointer*/ 153 if(!nobs){ 154 *px=UNDEF; 155 *py=UNDEF; 156 *pobs=UNDEF; 157 } 158 else{ 159 observation=(Observation*)this->GetObjectByOffset(indices[index]); 160 *px=observation->x; 161 *py=observation->y; 162 *pobs=observation->value; 163 } 164 xDelete<int>(indices); 165 166 }/*}}}*/ 167 /*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata){{{*/ 168 void Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata){ 118 169 119 170 /*Output and Intermediaries*/ 120 171 bool stop; 121 172 int nobs,tempnobs,i,j,k,n,counter; 122 double h2,radius2;173 IssmDouble h2,radius2; 123 174 int *indices = NULL; 124 175 int *tempindices = NULL; 125 double *dists = NULL;126 double *x = NULL;127 double *y = NULL;128 double *obs = NULL;176 IssmDouble *dists = NULL; 177 IssmDouble *x = NULL; 178 IssmDouble *y = NULL; 179 IssmDouble *obs = NULL; 129 180 Observation *observation = NULL; 130 181 182 /*If radius is not provided or is 0, return all observations*/ 183 if(radius==0) radius=this->quadtree->root->length; 184 131 185 /*Compute radius square*/ 132 if(radius==0) radius=this->quadtree->root->length;133 186 radius2 = radius*radius; 134 187 … … 136 189 this->quadtree->RangeSearch(&tempindices,&tempnobs,x_interp,y_interp,radius); 137 190 if(tempnobs){ 138 indices = (int*)xmalloc(tempnobs*sizeof(int));139 dists = (double*)xmalloc(tempnobs*sizeof(double));191 indices = xNew<int>(tempnobs); 192 dists = xNew<IssmDouble>(tempnobs); 140 193 } 141 194 nobs = 0; … … 172 225 } 173 226 } 174 x free((void**)&dists);175 x free((void**)&tempindices);227 xDelete<IssmDouble>(dists); 228 xDelete<int>(tempindices); 176 229 177 230 if(nobs){ 178 231 /*Allocate vectors*/ 179 x = (double*)xmalloc(nobs*sizeof(double));180 y = (double*)xmalloc(nobs*sizeof(double));181 obs = (double*)xmalloc(nobs*sizeof(double));232 x = xNew<IssmDouble>(nobs); 233 y = xNew<IssmDouble>(nobs); 234 obs = xNew<IssmDouble>(nobs); 182 235 183 236 /*Loop over all observations and fill in x, y and obs*/ … … 189 242 190 243 /*Assign output pointer*/ 191 x free((void**)&indices);244 xDelete<int>(indices); 192 245 *px=x; 193 246 *py=y; … … 195 248 *pnobs=nobs; 196 249 }/*}}}*/ 250 /*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){{{*/ 251 void Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){ 252 253 /*Output and Intermediaries*/ 254 int nobs; 255 IssmDouble *x = NULL; 256 IssmDouble *y = NULL; 257 IssmDouble *obs = NULL; 258 Observation *observation = NULL; 259 260 nobs = this->Size(); 261 262 if(nobs){ 263 x = xNew<IssmDouble>(nobs); 264 y = xNew<IssmDouble>(nobs); 265 obs = xNew<IssmDouble>(nobs); 266 for(int i=0;i<this->Size();i++){ 267 observation=(Observation*)this->GetObjectByOffset(i); 268 observation->WriteXYObs(&x[i],&y[i],&obs[i]); 269 } 270 } 271 272 /*Assign output pointer*/ 273 *px=x; 274 *py=y; 275 *pobs=obs; 276 *pnobs=nobs; 277 }/*}}}*/ 278 /*FUNCTION Observations::InterpolationIDW{{{*/ 279 void Observations::InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power){ 280 281 /*Intermediaries*/ 282 int i,n_obs; 283 IssmDouble prediction; 284 IssmDouble numerator,denominator,h,weight; 285 IssmDouble *x = NULL; 286 IssmDouble *y = NULL; 287 IssmDouble *obs = NULL; 288 289 /*Some checks*/ 290 _assert_(maxdata>0); 291 _assert_(pprediction); 292 _assert_(power>0); 293 294 /*If radius is not provided or is 0, return all observations*/ 295 if(radius==0) radius=this->quadtree->root->length; 296 297 /*Get list of observations for current point*/ 298 this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata); 299 300 /*If we have less observations than mindata, return UNDEF*/ 301 if(n_obs<mindata){ 302 prediction = UNDEF; 303 } 304 else{ 305 numerator = 0.; 306 denominator = 0.; 307 for(i=0;i<n_obs;i++){ 308 h = sqrt( (x[i]-x_interp)*(x[i]-x_interp) + (y[i]-y_interp)*(y[i]-y_interp)); 309 if (h<0.0000001){ 310 numerator = obs[i]; 311 denominator = 1.; 312 break; 313 } 314 weight = 1./pow(h,power); 315 numerator += weight*obs[i]; 316 denominator += weight; 317 } 318 prediction = numerator/denominator; 319 } 320 321 /*clean-up*/ 322 *pprediction = prediction; 323 xDelete<IssmDouble>(x); 324 xDelete<IssmDouble>(y); 325 xDelete<IssmDouble>(obs); 326 }/*}}}*/ 327 /*FUNCTION Observations::InterpolationKriging{{{*/ 328 void Observations::InterpolationKriging(IssmDouble *pprediction,IssmDouble *perror,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,Variogram* variogram){ 329 330 /*Intermediaries*/ 331 int i,j,n_obs; 332 IssmDouble prediction,error; 333 IssmDouble numerator,denominator,ratio; 334 IssmDouble *x = NULL; 335 IssmDouble *y = NULL; 336 IssmDouble *obs = NULL; 337 IssmDouble *Gamma = NULL; 338 IssmDouble *GinvG0 = NULL; 339 IssmDouble *Ginv1 = NULL; 340 IssmDouble *GinvZ = NULL; 341 IssmDouble *gamma0 = NULL; 342 IssmDouble *ones = NULL; 343 344 /*Some checks*/ 345 _assert_(mindata>0 && maxdata>0); 346 _assert_(pprediction && perror); 347 348 /*If radius is not provided or is 0, return all observations*/ 349 if(radius==0) radius=this->quadtree->root->length; 350 351 /*Get list of observations for current point*/ 352 this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata); 353 354 /*If we have less observations than mindata, return UNDEF*/ 355 if(n_obs<mindata){ 356 *pprediction = -999.0; 357 *perror = -999.0; 358 return; 359 } 360 361 /*Allocate intermediary matrix and vectors*/ 362 Gamma = xNew<IssmDouble>(n_obs*n_obs); 363 gamma0 = xNew<IssmDouble>(n_obs); 364 ones = xNew<IssmDouble>(n_obs); 365 366 /*First: Create semivariogram matrix for observations*/ 367 for(i=0;i<n_obs;i++){ 368 for(j=0;j<=i;j++){ 369 //Gamma[i*n_obs+j] = variogram->SemiVariogram(x[i]-x[j],y[i]-y[j]); 370 Gamma[i*n_obs+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]); 371 Gamma[j*n_obs+i] = Gamma[i*n_obs+j]; 372 } 373 } 374 for(i=0;i<n_obs;i++) ones[i]=1; 375 376 /*Get semivariogram vector associated to this location*/ 377 //for(i=0;i<n_obs;i++) gamma0[i] = variogram->SemiVariogram(x[i]-x_interp,y[i]-y_interp); 378 for(i=0;i<n_obs;i++) gamma0[i] = variogram->Covariance(x[i]-x_interp,y[i]-y_interp); 379 380 /*Solve the three linear systems*/ 381 #if _HAVE_GSL_ 382 SolverxGsl(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0 383 SolverxGsl(&Ginv1, Gamma,ones,n_obs); // Gamma^-1 ones 384 SolverxGsl(&GinvZ, Gamma,obs,n_obs); // Gamma^-1 Z 385 #else 386 _error2_("GSL is required"); 387 #endif 388 389 /*Prepare predictor*/ 390 numerator=-1.; denominator=0.; 391 for(i=0;i<n_obs;i++) numerator +=GinvG0[i]; 392 for(i=0;i<n_obs;i++) denominator+=Ginv1[i]; 393 ratio=numerator/denominator; 394 395 prediction = 0.; 396 error = - numerator*numerator/denominator; 397 for(i=0;i<n_obs;i++) prediction += (gamma0[i]-ratio)*GinvZ[i]; 398 for(i=0;i<n_obs;i++) error += gamma0[i]*GinvG0[i]; 399 400 /*clean-up*/ 401 *pprediction = prediction; 402 *perror = error; 403 xDelete<IssmDouble>(x); 404 xDelete<IssmDouble>(y); 405 xDelete<IssmDouble>(obs); 406 xDelete<IssmDouble>(Gamma); 407 xDelete<IssmDouble>(gamma0); 408 xDelete<IssmDouble>(ones); 409 xDelete<IssmDouble>(GinvG0); 410 xDelete<IssmDouble>(Ginv1); 411 xDelete<IssmDouble>(GinvZ); 412 413 }/*}}}*/ 414 /*FUNCTION Observations::InterpolationNearestNeighbor{{{*/ 415 void Observations::InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){ 416 417 /*Intermediaries*/ 418 IssmDouble x,y,obs; 419 420 /*Get clostest observation*/ 421 this->ClosestObservation(&x,&y,&obs,x_interp,y_interp,radius); 422 423 /*Assign output pointer*/ 424 *pprediction = obs; 425 }/*}}}*/ 197 426 /*FUNCTION Observations::QuadtreeColoring{{{*/ 198 void Observations::QuadtreeColoring( double* A,double *x,double *y,int n){427 void Observations::QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n){ 199 428 200 429 int xi,yi,level; … … 203 432 this->quadtree->IntergerCoordinates(&xi,&yi,x[i],y[i]); 204 433 this->quadtree->QuadtreeDepth(&level,xi,yi); 205 A[i]=( double)level;434 A[i]=(IssmDouble)level; 206 435 } 207 436 208 437 }/*}}}*/ 209 438 /*FUNCTION Observations::Variomap{{{*/ 210 void Observations::Variomap( double* gamma,double *x,int n){439 void Observations::Variomap(IssmDouble* gamma,IssmDouble *x,int n){ 211 440 212 441 /*Output and Intermediaries*/ 213 442 int i,j,k; 214 double distance;443 IssmDouble distance; 215 444 Observation *observation1 = NULL; 216 445 Observation *observation2 = NULL; 217 446 218 int *counter= (int*)xmalloc(n*sizeof(int));219 for(j=0;j<n;j++) counter[j] = 0 ;447 IssmDouble *counter = xNew<IssmDouble>(n); 448 for(j=0;j<n;j++) counter[j] = 0.0; 220 449 for(j=0;j<n;j++) gamma[j] = 0.0; 221 450 … … 234 463 235 464 gamma[index] += 1./2.*pow(observation1->value - observation2->value,2.); 236 counter[index] += 1 ;465 counter[index] += 1.; 237 466 } 238 467 } 239 468 240 469 /*Normalize semivariogram*/ 241 gamma[0]=0 ;470 gamma[0]=0.; 242 471 for(k=0;k<n;k++){ 243 if(counter[k]) gamma[k] = gamma[k]/ double(counter[k]);472 if(counter[k]) gamma[k] = gamma[k]/counter[k]; 244 473 } 245 474 246 475 /*Assign output pointer*/ 247 x free((void**)&counter);248 }/*}}}*/ 476 xDelete<IssmDouble>(counter); 477 }/*}}}*/ -
issm/trunk/src/c/Container/Observations.h
r12330 r12706 6 6 #define _CONTAINER_OBSERVATIONS_H_ 7 7 8 class Obsevration; 8 #include "../include/include.h" 9 9 10 class Quadtree; 11 class Variogram; 10 12 class Options; 11 13 … … 19 21 /*constructors, destructors*/ 20 22 Observations(); 21 Observations( double* observations_list,double* x,double* y,int n,Options* options);23 Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options); 22 24 ~Observations(); 23 25 24 26 /*Methods*/ 25 void ObservationList(double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata); 26 void QuadtreeColoring(double* A,double *x,double *y,int n); 27 void Variomap(double* gamma,double *x,int n); 27 void ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius); 28 void InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power); 29 void InterpolationKriging(IssmDouble *pprediction,IssmDouble *perror,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,Variogram* variogram); 30 void InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius); 31 void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs); 32 void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata); 33 void QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n); 34 void Variomap(IssmDouble* gamma,IssmDouble *x,int n); 28 35 29 36 }; -
issm/trunk/src/c/Container/Options.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Options::Options(){{{ 1*/27 /*FUNCTION Options::Options(){{{*/ 28 28 Options::Options(){ 29 29 return; 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION Options::~Options(){{{ 1*/32 /*FUNCTION Options::~Options(){{{*/ 33 33 Options::~Options(){ 34 34 return; … … 37 37 38 38 /*Object management*/ 39 /*FUNCTION Options::AddOption{{{ 1*/39 /*FUNCTION Options::AddOption{{{*/ 40 40 int Options::AddOption(Option* in_option){ 41 41 … … 47 47 48 48 /*Also, check the option name*/ 49 if(!in_option->name) _error _("input option has an empty name");50 if(strchr(in_option->name,'.')) _error _("Option \"%s\" has a protected character \".\"",in_option->name);51 if(strchr(in_option->name,'[')) _error _("Option \"%s\" has a protected character \"[\"",in_option->name);52 if(strchr(in_option->name,']')) _error _("Option \"%s\" has a protected character \"]\"",in_option->name);49 if(!in_option->name) _error2_("input option has an empty name"); 50 if(strchr(in_option->name,'.')) _error2_("Option \"" << in_option->name << "\" has a protected character \".\""); 51 if(strchr(in_option->name,'[')) _error2_("Option \"" << in_option->name << "\" has a protected character \"[\""); 52 if(strchr(in_option->name,']')) _error2_("Option \"" << in_option->name << "\" has a protected character \"]\""); 53 53 54 54 /*Finally, check that no option of the same name already exists in the dataset*/ … … 57 57 option=(Option*)(*object); 58 58 if (!strcmp(option->name,in_option->name)){ 59 _error _("Options \"%s\" found multiple times",in_option->name);59 _error2_("Options \"" << in_option->name << "\" found multiple times"); 60 60 break; 61 61 } … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION Options::Get(int* pvalue, char* name){{{ 1*/70 /*FUNCTION Options::Get(int* pvalue, char* name){{{*/ 71 71 void Options::Get(int* pvalue,const char* name){ 72 72 … … 83 83 /*Else, the Option does not exist, no default provided*/ 84 84 else{ 85 _error _("option of name \"%s\" not found, and no default value has been provided",name);86 } 87 } 88 /*}}}*/ 89 /*FUNCTION Options::Get(int* pvalue, char* name,int default_value){{{ 1*/85 _error2_("option of name \"" << name << "\" not found, and no default value has been provided"); 86 } 87 } 88 /*}}}*/ 89 /*FUNCTION Options::Get(int* pvalue, char* name,int default_value){{{*/ 90 90 void Options::Get(int* pvalue,const char* name,int default_value){ 91 91 … … 106 106 } 107 107 /*}}}*/ 108 /*FUNCTION Options::Get( double* pvalue, char* name){{{1*/109 void Options::Get( double* pvalue,const char* name){110 111 vector<Object*>::iterator object; 112 Option* option=NULL; 113 114 /*Get option*/ 115 option=GetOption(name); 116 117 /*If the pointer is not NULL, the option has been found*/ 118 if(option){ 119 option->Get(pvalue); 120 } 121 /*Else, the Option does not exist, no default provided*/ 122 else{ 123 _error _("option of name \"%s\" not found, and no default value has been provided",name);124 } 125 } 126 /*}}}*/ 127 /*FUNCTION Options::Get( double* pvalue, char* name,double default_value){{{1*/128 void Options::Get( double* pvalue,const char* name,double default_value){108 /*FUNCTION Options::Get(IssmDouble* pvalue, char* name){{{*/ 109 void Options::Get(IssmDouble* pvalue,const char* name){ 110 111 vector<Object*>::iterator object; 112 Option* option=NULL; 113 114 /*Get option*/ 115 option=GetOption(name); 116 117 /*If the pointer is not NULL, the option has been found*/ 118 if(option){ 119 option->Get(pvalue); 120 } 121 /*Else, the Option does not exist, no default provided*/ 122 else{ 123 _error2_("option of name \"" << name << "\" not found, and no default value has been provided"); 124 } 125 } 126 /*}}}*/ 127 /*FUNCTION Options::Get(IssmDouble* pvalue, char* name,IssmDouble default_value){{{*/ 128 void Options::Get(IssmDouble* pvalue,const char* name,IssmDouble default_value){ 129 129 130 130 vector<Object*>::iterator object; … … 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION Options::Get(bool* pvalue, char* name){{{ 1*/146 /*FUNCTION Options::Get(bool* pvalue, char* name){{{*/ 147 147 void Options::Get(bool* pvalue,const char* name){ 148 148 … … 159 159 /*Else, the Option does not exist, no default provided*/ 160 160 else{ 161 _error _("option of name \"%s\" not found, and no default value has been provided",name);162 } 163 } 164 /*}}}*/ 165 /*FUNCTION Options::Get(bool* pvalue, char* name,bool default_value){{{ 1*/161 _error2_("option of name \"" << name << "\" not found, and no default value has been provided"); 162 } 163 } 164 /*}}}*/ 165 /*FUNCTION Options::Get(bool* pvalue, char* name,bool default_value){{{*/ 166 166 void Options::Get(bool* pvalue,const char* name,bool default_value){ 167 167 … … 182 182 } 183 183 /*}}}*/ 184 /*FUNCTION Options::Get(char** pvalue, char* name){{{ 1*/184 /*FUNCTION Options::Get(char** pvalue, char* name){{{*/ 185 185 void Options::Get(char** pvalue,const char* name){ 186 186 … … 199 199 /*Else, the Option does not exist, no default provided*/ 200 200 else{ 201 _error _("option of name \"%s\" not found, and no default value has been provided",name);202 } 203 204 } 205 /*}}}*/ 206 /*FUNCTION Options::Get(char** pvalue, char* name,char* default_value){{{ 1*/201 _error2_("option of name \"" << name << "\" not found, and no default value has been provided"); 202 } 203 204 } 205 /*}}}*/ 206 /*FUNCTION Options::Get(char** pvalue, char* name,char* default_value){{{*/ 207 207 void Options::Get(char** pvalue,const char* name,const char* default_value){ 208 208 … … 222 222 else{ 223 223 stringsize=strlen(default_value)+1; 224 outstring= (char*)xmalloc(stringsize*sizeof(char));225 memcpy(outstring,default_value,stringsize*sizeof(char));224 outstring=xNew<char>(stringsize); 225 xMemCpy<char>(outstring,default_value,stringsize); 226 226 *pvalue=outstring; 227 227 } … … 229 229 } 230 230 /*}}}*/ 231 /*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{ 1*/231 /*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{*/ 232 232 void Options::Get(char*** ppvalue,int* numel,const char* name){ 233 233 … … 246 246 if(option->ObjectEnum()==OptionCellEnum){ 247 247 if (option->NumEl()) { 248 *ppvalue= (char **) xmalloc(option->NumEl()*sizeof(char *));248 *ppvalue=xNew<char*>(option->NumEl()); 249 249 if (numel) *numel=option->NumEl(); 250 250 option->Get(&options); … … 264 264 /*Else: not supported*/ 265 265 else{ 266 _error _("Cannot recover field \"%s\" for an option of type %s",name,EnumToStringx(option->ObjectEnum()));266 _error2_("Cannot recover field \"" << name << "\" for an option of type " << EnumToStringx(option->ObjectEnum())); 267 267 } 268 268 } … … 275 275 } 276 276 /*}}}*/ 277 /*FUNCTION Options::Get( double** pvalue,int* numel,const char* name){{{1*/278 void Options::Get( double** pvalue,int* numel,const char* name){277 /*FUNCTION Options::Get(IssmDouble** pvalue,int* numel,const char* name){{{*/ 278 void Options::Get(IssmDouble** pvalue,int* numel,const char* name){ 279 279 280 280 vector<Object*>::iterator object; … … 290 290 /*Else, the Option does not exist, no default provided*/ 291 291 else{ 292 _error _("option of name \"%s\" not found, and no default value has been provided",name);293 } 294 } 295 /*}}}*/ 296 /*FUNCTION Options::GetOption{{{ 1*/292 _error2_("option of name \"" << name << "\" not found, and no default value has been provided"); 293 } 294 } 295 /*}}}*/ 296 /*FUNCTION Options::GetOption{{{*/ 297 297 Option* Options::GetOption(const char* name){ 298 298 … … 324 324 /*Else: not supported*/ 325 325 else{ 326 _error _("Cannot recover field \"%s\" for an option of type %s",name,EnumToStringx(option->ObjectEnum()));326 _error2_("Cannot recover field \"" << name << "\" for an option of type " << EnumToStringx(option->ObjectEnum())); 327 327 } 328 328 } -
issm/trunk/src/c/Container/Options.h
r12330 r12706 20 20 int AddOption(Option* in_oobject); 21 21 Option* GetOption(const char* name); 22 void Get( double* pvalue,const char* name);23 void Get( double* pvalue,const char* name,double default_value);22 void Get(IssmDouble* pvalue,const char* name); 23 void Get(IssmDouble* pvalue,const char* name,IssmDouble default_value); 24 24 void Get(int* pvalue,const char* name); 25 25 void Get(int* pvalue,const char* name,int default_value); … … 29 29 void Get(char** pvalue,const char* name,const char* default_value); 30 30 void Get(char*** pvalue,int* numel,const char* name); 31 void Get( double** pvalue,int* numel,const char* name);31 void Get(IssmDouble** pvalue,int* numel,const char* name); 32 32 }; 33 33 -
issm/trunk/src/c/Container/Parameters.cpp
r11995 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Parameters::Parameters(){{{ 1*/27 /*FUNCTION Parameters::Parameters(){{{*/ 28 28 Parameters::Parameters(){ 29 29 enum_type=ParametersEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Parameters::~Parameters(){{{ 1*/33 /*FUNCTION Parameters::~Parameters(){{{*/ 34 34 Parameters::~Parameters(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Parameters::Exist{{{ 1*/40 /*FUNCTION Parameters::Exist{{{*/ 41 41 bool Parameters::Exist(int enum_type){ 42 42 … … 51 51 } 52 52 /*}}}*/ 53 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{ 1*/53 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{*/ 54 54 void Parameters::FindParam(bool* pbool,int enum_type){ _assert_(this); 55 55 … … 65 65 } 66 66 } 67 _error _("could not find parameter %s",EnumToStringx(enum_type));68 } 69 /*}}}*/ 70 /*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{ 1*/67 _error2_("could not find parameter " << EnumToStringx(enum_type)); 68 } 69 /*}}}*/ 70 /*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{*/ 71 71 void Parameters::FindParam(int* pinteger,int enum_type){ _assert_(this); 72 72 … … 82 82 } 83 83 } 84 _error _("could not find parameter %s",EnumToStringx(enum_type));85 } 86 /*}}}*/ 87 /*FUNCTION Parameters::FindParam( double* pscalar, int enum_type){{{1*/88 void Parameters::FindParam( double* pscalar, int enum_type){ _assert_(this);84 _error2_("could not find parameter " << EnumToStringx(enum_type)); 85 } 86 /*}}}*/ 87 /*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type){{{*/ 88 void Parameters::FindParam(IssmDouble* pscalar, int enum_type){ _assert_(this); 89 89 90 90 vector<Object*>::iterator object; … … 99 99 } 100 100 } 101 _error _("could not find parameter %s",EnumToStringx(enum_type));102 } 103 /*}}}*/ 104 /*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{ 1*/101 _error2_("could not find parameter " << EnumToStringx(enum_type)); 102 } 103 /*}}}*/ 104 /*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{*/ 105 105 void Parameters::FindParam(char** pstring,int enum_type){ _assert_(this); 106 106 … … 116 116 } 117 117 } 118 _error _("could not find parameter %s",EnumToStringx(enum_type));119 120 } 121 /*}}}*/ 122 /*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{ 1*/118 _error2_("could not find parameter " << EnumToStringx(enum_type)); 119 120 } 121 /*}}}*/ 122 /*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{*/ 123 123 void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ _assert_(this); 124 124 … … 134 134 } 135 135 } 136 _error _("could not find parameter %s",EnumToStringx(enum_type));137 138 } 139 /*}}}*/ 140 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{ 1*/136 _error2_("could not find parameter " << EnumToStringx(enum_type)); 137 138 } 139 /*}}}*/ 140 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{*/ 141 141 void Parameters::FindParam(int** pintarray,int* pM, int enum_type){ _assert_(this); 142 142 … … 152 152 } 153 153 } 154 _error _("could not find parameter %s",EnumToStringx(enum_type));155 156 } 157 /*}}}*/ 158 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int* pN,int enum_type){{{ 1*/154 _error2_("could not find parameter " << EnumToStringx(enum_type)); 155 156 } 157 /*}}}*/ 158 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int* pN,int enum_type){{{*/ 159 159 void Parameters::FindParam(int** pintarray,int* pM,int *pN,int enum_type){ _assert_(this); 160 160 … … 170 170 } 171 171 } 172 _error _("could not find parameter %s",EnumToStringx(enum_type));173 174 } 175 /*}}}*/ 176 /*FUNCTION Parameters::FindParam( double** pdoublearray,int* pM,int enum_type){{{1*/177 void Parameters::FindParam( double** pdoublearray,int* pM, int enum_type){ _assert_(this);178 179 vector<Object*>::iterator object; 180 Param* param=NULL; 181 182 for ( object=objects.begin() ; object < objects.end(); object++ ){ 183 184 param=(Param*)(*object); 185 if(param->InstanceEnum()==enum_type){ 186 param->GetParameterValue(p doublearray,pM);187 return; 188 } 189 } 190 _error _("could not find parameter %s",EnumToStringx(enum_type));191 192 } 193 /*}}}*/ 194 /*FUNCTION Parameters::FindParam( double** pdoublearray,int* pM, int* pN,int enum_type){{{1*/195 void Parameters::FindParam( double** pdoublearray,int* pM, int* pN,int enum_type){ _assert_(this);196 197 vector<Object*>::iterator object; 198 Param* param=NULL; 199 200 for ( object=objects.begin() ; object < objects.end(); object++ ){ 201 202 param=(Param*)(*object); 203 if(param->InstanceEnum()==enum_type){ 204 param->GetParameterValue(p doublearray,pM,pN);205 return; 206 } 207 } 208 _error _("could not find parameter %s",EnumToStringx(enum_type));209 210 } 211 /*}}}*/ 212 /*FUNCTION Parameters::FindParam( double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{1*/213 void Parameters::FindParam( double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this);172 _error2_("could not find parameter " << EnumToStringx(enum_type)); 173 174 } 175 /*}}}*/ 176 /*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type){{{*/ 177 void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int enum_type){ _assert_(this); 178 179 vector<Object*>::iterator object; 180 Param* param=NULL; 181 182 for ( object=objects.begin() ; object < objects.end(); object++ ){ 183 184 param=(Param*)(*object); 185 if(param->InstanceEnum()==enum_type){ 186 param->GetParameterValue(pIssmDoublearray,pM); 187 return; 188 } 189 } 190 _error2_("could not find parameter " << EnumToStringx(enum_type)); 191 192 } 193 /*}}}*/ 194 /*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){{{*/ 195 void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){ _assert_(this); 196 197 vector<Object*>::iterator object; 198 Param* param=NULL; 199 200 for ( object=objects.begin() ; object < objects.end(); object++ ){ 201 202 param=(Param*)(*object); 203 if(param->InstanceEnum()==enum_type){ 204 param->GetParameterValue(pIssmDoublearray,pM,pN); 205 return; 206 } 207 } 208 _error2_("could not find parameter " << EnumToStringx(enum_type)); 209 210 } 211 /*}}}*/ 212 /*FUNCTION Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{*/ 213 void Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this); 214 214 215 215 vector<Object*>::iterator object; … … 224 224 } 225 225 } 226 _error _("could not find parameter %s",EnumToStringx(enum_type));227 } 228 /*}}}*/ 229 /*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{ 1*/226 _error2_("could not find parameter " << EnumToStringx(enum_type)); 227 } 228 /*}}}*/ 229 /*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{*/ 230 230 void Parameters::FindParam(Vector** pvec,int enum_type){ _assert_(this); 231 231 … … 241 241 } 242 242 } 243 _error _("could not find parameter %s",EnumToStringx(enum_type));244 245 } 246 /*}}}*/ 247 /*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{ 1*/243 _error2_("could not find parameter " << EnumToStringx(enum_type)); 244 245 } 246 /*}}}*/ 247 /*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{*/ 248 248 void Parameters::FindParam(Matrix** pmat,int enum_type){ _assert_(this); 249 249 … … 259 259 } 260 260 } 261 _error _("could not find parameter %s",EnumToStringx(enum_type));262 263 } 264 /*}}}*/ 265 /*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{ 1*/261 _error2_("could not find parameter " << EnumToStringx(enum_type)); 262 263 } 264 /*}}}*/ 265 /*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{*/ 266 266 void Parameters::FindParam(FILE** pfid,int enum_type){ _assert_(this); 267 267 … … 277 277 } 278 278 } 279 _error _("could not find parameter %s",EnumToStringx(enum_type));280 } 281 /*}}}*/ 282 283 /*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{ 1*/279 _error2_("could not find parameter " << EnumToStringx(enum_type)); 280 } 281 /*}}}*/ 282 283 /*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{*/ 284 284 void Parameters::SetParam(bool boolean,int enum_type){ 285 285 … … 293 293 } 294 294 /*}}}*/ 295 /*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{ 1*/295 /*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{*/ 296 296 void Parameters::SetParam(int integer,int enum_type){ 297 297 … … 305 305 } 306 306 /*}}}*/ 307 /*FUNCTION Parameters::SetParam( double scalar,int enum_type);{{{1*/308 void Parameters::SetParam( double scalar,int enum_type){307 /*FUNCTION Parameters::SetParam(IssmDouble scalar,int enum_type);{{{*/ 308 void Parameters::SetParam(IssmDouble scalar,int enum_type){ 309 309 310 310 Param* param=NULL; … … 317 317 } 318 318 /*}}}*/ 319 /*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{ 1*/319 /*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{*/ 320 320 void Parameters::SetParam(char* string,int enum_type){ 321 321 … … 329 329 } 330 330 /*}}}*/ 331 /*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{ 1*/331 /*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{*/ 332 332 void Parameters::SetParam(char** stringarray,int M, int enum_type){ 333 333 … … 341 341 } 342 342 /*}}}*/ 343 /*FUNCTION Parameters::SetParam( double* doublearray,int M,int enum_type);{{{1*/344 void Parameters::SetParam( double* doublearray,int M, int enum_type){345 346 Param* param=NULL; 347 348 /*first, figure out if the param has already been created: */ 349 param=(Param*)this->FindParamObject(enum_type); 350 351 if(param) param->SetValue( doublearray,M); //already exists, just set it.352 else this->AddObject(new DoubleVecParam(enum_type, doublearray,M)); //just add the new parameter.353 } 354 /*}}}*/ 355 /*FUNCTION Parameters::SetParam( double* doublearray,int M,int N, int enum_type);{{{1*/356 void Parameters::SetParam( double* doublearray,int M, int N, int enum_type){357 358 Param* param=NULL; 359 360 /*first, figure out if the param has already been created: */ 361 param=(Param*)this->FindParamObject(enum_type); 362 363 if(param) param->SetValue( doublearray,M,N); //already exists, just set it.364 else this->AddObject(new DoubleMatParam(enum_type, doublearray,M,N)); //just add the new parameter.365 } 366 /*}}}*/ 367 /*FUNCTION Parameters::SetParam(int* intarray,int M,int enum_type);{{{ 1*/343 /*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int enum_type);{{{*/ 344 void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int enum_type){ 345 346 Param* param=NULL; 347 348 /*first, figure out if the param has already been created: */ 349 param=(Param*)this->FindParamObject(enum_type); 350 351 if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it. 352 else this->AddObject(new DoubleVecParam(enum_type,IssmDoublearray,M)); //just add the new parameter. 353 } 354 /*}}}*/ 355 /*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int N, int enum_type);{{{*/ 356 void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int N, int enum_type){ 357 358 Param* param=NULL; 359 360 /*first, figure out if the param has already been created: */ 361 param=(Param*)this->FindParamObject(enum_type); 362 363 if(param) param->SetValue(IssmDoublearray,M,N); //already exists, just set it. 364 else this->AddObject(new DoubleMatParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter. 365 } 366 /*}}}*/ 367 /*FUNCTION Parameters::SetParam(int* intarray,int M,int enum_type);{{{*/ 368 368 void Parameters::SetParam(int* intarray,int M, int enum_type){ 369 369 … … 377 377 } 378 378 /*}}}*/ 379 /*FUNCTION Parameters::SetParam(int* intarray,int M,int N, int enum_type);{{{ 1*/379 /*FUNCTION Parameters::SetParam(int* intarray,int M,int N, int enum_type);{{{*/ 380 380 void Parameters::SetParam(int* intarray,int M, int N, int enum_type){ 381 381 … … 389 389 } 390 390 /*}}}*/ 391 /*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{ 1*/391 /*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{*/ 392 392 void Parameters::SetParam(Vector* vector,int enum_type){ 393 393 … … 401 401 } 402 402 /*}}}*/ 403 /*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{ 1*/403 /*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{*/ 404 404 void Parameters::SetParam(Matrix* matrix,int enum_type){ 405 405 … … 413 413 } 414 414 /*}}}*/ 415 /*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{ 1*/415 /*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{*/ 416 416 void Parameters::SetParam(FILE* fid,int enum_type){ 417 417 … … 425 425 } 426 426 /*}}}*/ 427 /*FUNCTION Parameters::UnitConversion(int direction_enum);{{{ 1*/427 /*FUNCTION Parameters::UnitConversion(int direction_enum);{{{*/ 428 428 void Parameters::UnitConversion(int direction_enum){ 429 429 … … 439 439 /*}}}*/ 440 440 441 /*FUNCTION Parameters::FindParamObject{{{ 1*/441 /*FUNCTION Parameters::FindParamObject{{{*/ 442 442 Object* Parameters::FindParamObject(int enum_type){ 443 443 -
issm/trunk/src/c/Container/Parameters.h
r12330 r12706 23 23 public: 24 24 25 /*constructors, destructors: {{{ 1*/25 /*constructors, destructors: {{{*/ 26 26 Parameters(); 27 27 ~Parameters(); 28 28 /*}}}*/ 29 /*numerics: {{{ 1*/29 /*numerics: {{{*/ 30 30 bool Exist(int enum_type); 31 31 32 32 void FindParam(bool* pinteger,int enum_type); 33 33 void FindParam(int* pinteger,int enum_type); 34 void FindParam( double* pscalar, int enum_type);34 void FindParam(IssmDouble* pscalar, int enum_type); 35 35 void FindParam(char** pstring,int enum_type); 36 36 void FindParam(char*** pstringarray,int* pM,int enum_type); 37 37 void FindParam(int** pintarray,int* pM,int enum_type); 38 38 void FindParam(int** pintarray,int* pM,int* PN,int enum_type); 39 void FindParam( double** pdoublearray,int* pM,int enum_type);40 void FindParam( double** pdoublearray,int* pM,int* pN,int enum_type);41 void FindParam( double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);39 void FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type); 40 void FindParam(IssmDouble** pIssmDoublearray,int* pM,int* pN,int enum_type); 41 void FindParam(IssmDouble*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type); 42 42 void FindParam(Vector** pvec,int enum_type); 43 43 void FindParam(Matrix** pmat,int enum_type); … … 46 46 void SetParam(bool boolean,int enum_type); 47 47 void SetParam(int integer,int enum_type); 48 void SetParam( double scalar, int enum_type);48 void SetParam(IssmDouble scalar, int enum_type); 49 49 void SetParam(char* string,int enum_type); 50 50 void SetParam(char** stringarray,int M,int enum_type); 51 void SetParam( double* doublearray,int M,int enum_type);52 void SetParam( double* doublearray,int M,int N,int enum_type);51 void SetParam(IssmDouble* IssmDoublearray,int M,int enum_type); 52 void SetParam(IssmDouble* IssmDoublearray,int M,int N,int enum_type); 53 53 void SetParam(int* intarray,int M,int enum_type); 54 54 void SetParam(int* intarray,int M,int N,int enum_type); -
issm/trunk/src/c/Container/Results.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Results::Results(){{{ 1*/27 /*FUNCTION Results::Results(){{{*/ 28 28 Results::Results(){ 29 29 enum_type=ResultsEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Results::~Results(){{{ 1*/33 /*FUNCTION Results::~Results(){{{*/ 34 34 Results::~Results(){ 35 35 return; … … 38 38 39 39 /*Object management*/ 40 /*FUNCTION Results::SpawnTriaResults{{{ 1*/40 /*FUNCTION Results::SpawnTriaResults{{{*/ 41 41 Results* Results::SpawnTriaResults(int* indices){ 42 42 … … 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION Results::Write{{{ 1*/66 /*FUNCTION Results::Write{{{*/ 67 67 void Results::Write(Parameters* parameters){ 68 68 -
issm/trunk/src/c/Container/Results.h
r12330 r12706 20 20 public: 21 21 22 /*constructors, destructors: {{{ 1*/22 /*constructors, destructors: {{{*/ 23 23 Results(); 24 24 ~Results(); 25 25 /*}}}*/ 26 /*numerics: {{{ 1*/26 /*numerics: {{{*/ 27 27 Results* SpawnTriaResults(int* indices); 28 28 void Write(Parameters* parameters); -
issm/trunk/src/c/Container/Vertices.cpp
r12330 r12706 4 4 */ 5 5 6 /*Headers: {{{ 1*/6 /*Headers: {{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 25 25 26 26 /*Object constructors and destructor*/ 27 /*FUNCTION Vertices::Vertices(){{{ 1*/27 /*FUNCTION Vertices::Vertices(){{{*/ 28 28 Vertices::Vertices(){ 29 29 enum_type=VerticesEnum; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Vertices::~Vertices(){{{ 1*/33 /*FUNCTION Vertices::~Vertices(){{{*/ 34 34 Vertices::~Vertices(){ 35 35 return; … … 38 38 39 39 /*Numerics management*/ 40 /*FUNCTION Vertices::DistributeDofs{{{ 1*/40 /*FUNCTION Vertices::DistributeDofs{{{*/ 41 41 void Vertices::DistributeDofs(int numberofobjects,int numberofdofsperobject){ 42 42 … … 60 60 * cpus by the total last dofs of the previus cpu, starting from 0. 61 61 * First: bet number of dofs for each cpu*/ 62 alldofcount= (int*)xmalloc(num_procs*sizeof(int));62 alldofcount=xNew<int>(num_procs); 63 63 #ifdef _HAVE_MPI_ 64 64 MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD); … … 83 83 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked 84 84 * up by their clones: */ 85 truedofs = (int*)xcalloc(numberofobjects*numberofdofsperobject,sizeof(int));86 alltruedofs= (int*)xcalloc(numberofobjects*numberofdofsperobject,sizeof(int));85 truedofs =xNewZeroInit<int>(numberofobjects*numberofdofsperobject); 86 alltruedofs=xNewZeroInit<int>(numberofobjects*numberofdofsperobject); 87 87 for (i=0;i<this->Size();i++){ 88 88 Vertex* vertex=(Vertex*)this->GetObjectByOffset(i); … … 102 102 103 103 /* Free ressources: */ 104 x free((void**)&alldofcount);105 x free((void**)&truedofs);106 x free((void**)&alltruedofs);104 xDelete<int>(alldofcount); 105 xDelete<int>(truedofs); 106 xDelete<int>(alltruedofs); 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION Vertices::FlagClones{{{ 1*/109 /*FUNCTION Vertices::FlagClones{{{*/ 110 110 void Vertices::FlagClones(int numberofobjects){ 111 111 … … 117 117 118 118 /*Allocate ranks: */ 119 ranks= (int*)xmalloc(numberofobjects*sizeof(int));120 minranks= (int*)xmalloc(numberofobjects*sizeof(int));119 ranks=xNew<int>(numberofobjects); 120 minranks=xNew<int>(numberofobjects); 121 121 122 122 for(i=0;i<numberofobjects;i++)ranks[i]=num_procs; //no cpu can have rank num_procs. This is the maximum limit. … … 143 143 144 144 /*Free ressources: */ 145 x free((void**)&ranks);146 x free((void**)&minranks);145 xDelete<int>(ranks); 146 xDelete<int>(minranks); 147 147 148 148 } 149 149 /*}}}*/ 150 /*FUNCTION Vertices::NumberOfVertices{{{ 1*/150 /*FUNCTION Vertices::NumberOfVertices{{{*/ 151 151 int Vertices::NumberOfVertices(void){ 152 152 … … 174 174 } 175 175 /*}}}*/ 176 /*FUNCTION Vertices::Ranks{{{ 1*/176 /*FUNCTION Vertices::Ranks{{{*/ 177 177 void Vertices::Ranks(int* ranks){ 178 178 -
issm/trunk/src/c/Container/Vertices.h
r12330 r12706 19 19 public: 20 20 21 /*constructors, destructors: {{{ 1*/21 /*constructors, destructors: {{{*/ 22 22 Vertices(); 23 23 ~Vertices(); 24 24 /*}}}*/ 25 /*numerics: {{{ 1*/25 /*numerics: {{{*/ 26 26 void DistributeDofs(int numberofnodes,int numdofspernode); 27 27 void FlagClones(int numberofnodes); -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r12330 r12706 149 149 SettingsResultsAsPatchesEnum, 150 150 SettingsWaitonlockEnum, 151 DebugP etscProfilingEnum,152 P etscProfilingCurrentMemEnum,153 P etscProfilingCurrentFlopsEnum,154 P etscProfilingSolutionTimeEnum,151 DebugProfilingEnum, 152 ProfilingCurrentMemEnum, 153 ProfilingCurrentFlopsEnum, 154 ProfilingSolutionTimeEnum, 155 155 MaxIterationConvergenceFlagEnum, 156 156 SteadystateMaxiterEnum, … … 162 162 SurfaceforcingsMassBalanceEnum, 163 163 SurfaceforcingsIspddEnum, 164 SurfaceforcingsIssmbgradientsEnum, 164 165 SurfaceforcingsMonthlytemperaturesEnum, 166 SurfaceforcingsHcEnum, 167 SurfaceforcingsSmbPosMaxEnum, 168 SurfaceforcingsSmbPosMinEnum, 169 SurfaceforcingsAPosEnum, 170 SurfaceforcingsBPosEnum, 171 SurfaceforcingsANegEnum, 172 SurfaceforcingsBNegEnum, 165 173 ThermalMaxiterEnum, 166 174 ThermalPenaltyFactorEnum, -
issm/trunk/src/c/EnumDefinitions/Synchronize.sh
r12347 r12706 2 2 #Synchronize EnumToStringx.cpp and StringToEnumx.cpp and matlab Enums 3 3 4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all com as > put everything in file temp4 #Get all lines of EnumDefinitions2.h which hold Enum | remove all commas > put everything in file temp 5 5 cat EnumDefinitions.h | grep -e "[0-9]Enum," -e "[a-zA-Z]Enum," | grep -v include | sed -e "s/,/ /g" | awk '{print $1}' > temp 6 6 7 7 #Removed existing files 8 8 rm $ISSM_DIR/src/m/enum/*.m 9 rm $ISSM_DIR/src/m/enum/*.py 9 10 rm $ISSM_DIR/src/c/modules/EnumToStringx/EnumToStringx.cpp 10 11 rm $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp … … 48 49 49 50 len=strlen(EnumToStringx(enum_in)); 50 string= (char*)xmalloc((len+1)*sizeof(char));51 string=xNew<char>(len+1); 51 52 memcpy(string,EnumToStringx(enum_in),(len+1)*sizeof(char)); 52 53 … … 56 57 END 57 58 #}}} 58 #Build StringToEnumx.cpp {{{ 159 #Build StringToEnumx.cpp {{{ 59 60 #Header 60 61 cat <<END > $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp … … 97 98 cat <<END >> $ISSM_DIR/src/c/modules/StringToEnumx/StringToEnumx.cpp 98 99 /*If we reach this point, the string provided has not been found*/ 99 _error_("Enum %s not found",name);100 _error2_("Enum " << name << " not found"); 100 101 } 101 102 END … … 104 105 # go through the lines of temp 105 106 ENUM=0; 107 #Add header to pythonenum file{{{ 108 cat <<END > $ISSM_DIR/src/m/enum/EnumDefinitions.py 109 """ 110 111 WARNING: DO NOT MODIFY THIS FILE 112 this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh 113 Please read src/c/EnumDefinitions/README for more information 114 115 """ 116 117 END 118 #}}} 119 106 120 for NAMEENUM in $(cat temp); do 107 121 … … 142 156 END 143 157 #}}} 158 #Add case to pythonenum file{{{ 159 cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py 160 def $(echo $NAMEENUM)(): 161 """ 162 $(echo $NAMEENUM | awk {'print toupper($1)'}) - Enum of $(echo $NAME) 163 164 Usage: 165 macro=$NAMEENUM() 166 """ 167 168 return StringToEnum('$NAME') 169 170 END 171 #}}} 144 172 145 173 done 146 #MaximumNumberOfEnums {{{174 #MaximumNumberOfEnums (matlab){{{ 147 175 cat <<END > $ISSM_DIR/src/m/enum/MaximumNumberOfEnums.m 148 176 function macro=MaximumNumberOfEnums() … … 161 189 END 162 190 #}}} 191 #MaximumNumberOfEnums (python){{{ 192 cat <<END >> $ISSM_DIR/src/m/enum/EnumDefinitions.py 193 def MaximumNumberOfEnums(): 194 """ 195 $(echo "MaximumNumberOfEnums" | awk {'print toupper($1)'}) - Enum of MaximumNumberOfEnums 196 197 Usage: 198 macro=MaximumNumberOfEnums() 199 """ 200 201 return $(cat EnumDefinitions.h | grep -e "[0-9]Enum" -e "[a-zA-Z]Enum" | grep -v include \ 202 | awk '{ printf "%s %s\n", NR-1, $0 }' \ 203 | grep "MaximumNumberOfEnums" | awk '{print $1}') 204 205 END 206 #}}} 163 207 164 208 #clean up{{{ -
issm/trunk/src/c/Makefile.am
r12640 r12706 1 INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @ HYPREINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@1 INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ 2 2 3 3 EXEEXT=$(ISSMEXT) 4 4 5 #Library declaration {{{ 15 #Library declaration {{{ 6 6 lib_LIBRARIES = libISSMCore.a libISSMOverload.a 7 7 if PYTHON … … 17 17 18 18 #sources 19 #Core sources{{{ 119 #Core sources{{{ 20 20 core_sources = ./issm.h\ 21 21 ./issm-binding.h\ … … 176 176 ./shared/Alloc/alloc.h\ 177 177 ./shared/Alloc/alloc.cpp\ 178 ./shared/Alloc/xNewDelete.h\ 179 ./shared/MemOps/xMemCpy.h\ 178 180 ./shared/Matrix/matrix.h\ 179 181 ./shared/Matrix/MatrixUtils.cpp\ 180 ./shared/Dofs/dofs.h\181 ./shared/Dofs/dofsetgen.cpp\182 182 ./shared/Numerics/numerics.h\ 183 183 ./shared/Numerics/Verbosity.h\ … … 210 210 ./shared/Wrapper/ModuleBoot.cpp\ 211 211 ./shared/Wrapper/ModuleEnd.cpp\ 212 ./shared/Sys/sys.h\ 213 ./shared/Sys/ProfilingStart.cpp\ 214 ./shared/Sys/ProfilingEnd.cpp\ 212 215 ./toolkits/metis/metisincludes.h\ 213 216 ./toolkits/issm/issmtoolkit.h\ … … 285 288 ./modules/PositiveDegreeDayx/PositiveDegreeDayx.h\ 286 289 ./modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp\ 290 ./modules/SmbGradientsx/SmbGradientsx.h\ 291 ./modules/SmbGradientsx/SmbGradientsx.cpp\ 287 292 ./modules/UpdateConstraintsx/UpdateConstraintsx.h\ 288 293 ./modules/UpdateConstraintsx/UpdateConstraintsx.cpp\ … … 330 335 ./solvers/solver_linear.cpp\ 331 336 ./solvers/solver_nonlinear.cpp\ 332 ./solvers/solver_newton.cpp 333 #}}} 334 #DAKOTA sources {{{1 337 ./solvers/solver_newton.cpp\ 338 ./objects/Options/Option.cpp\ 339 ./objects/Options/Option.h\ 340 ./objects/Options/OptionDouble.cpp\ 341 ./objects/Options/OptionDouble.h\ 342 ./objects/Options/OptionChar.cpp\ 343 ./objects/Options/OptionChar.h\ 344 ./objects/Options/OptionUtilities.cpp\ 345 ./objects/Options/OptionUtilities.h 346 347 #}}} 348 #DAKOTA sources {{{ 335 349 dakota_sources = ./objects/DakotaPlugin.h\ 336 350 ./objects/DakotaPlugin.cpp\ … … 356 370 ./modules/Dakotax/SpawnCoreParallel.cpp 357 371 #}}} 358 #Transient sources {{{ 1372 #Transient sources {{{ 359 373 transient_sources = ./modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp \ 360 374 ./solutions/transient_core.cpp 361 375 #}}} 362 #Steadystate sources {{{ 1376 #Steadystate sources {{{ 363 377 steadystate_sources = ./solutions/steadystate_core.cpp\ 364 378 ./solutions/steadystateconvergence.cpp 365 379 #}}} 366 #Prognostic sources {{{ 1380 #Prognostic sources {{{ 367 381 prognostic_sources = ./modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp\ 368 382 ./modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp\ … … 371 385 ./solutions/prognostic_core.cpp 372 386 #}}} 373 #Thermal sources {{{ 1387 #Thermal sources {{{ 374 388 thermal_sources = ./modules/ModelProcessorx/Thermal/UpdateElementsThermal.cpp\ 375 389 ./modules/ModelProcessorx/Thermal/CreateNodesThermal.cpp\ … … 391 405 ./solvers/solver_thermal_nonlinear.cpp 392 406 #}}} 393 #Control sources {{{ 1407 #Control sources {{{ 394 408 control_sources= ./modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp\ 395 409 ./modules/ControlInputGetGradientx/ControlInputGetGradientx.h\ … … 446 460 447 461 #}}} 448 #Hydrology sources {{{ 1462 #Hydrology sources {{{ 449 463 hydrology_sources = ./modules/ModelProcessorx/Hydrology/UpdateElementsHydrology.cpp\ 450 464 ./modules/ModelProcessorx/Hydrology/CreateNodesHydrology.cpp\ … … 454 468 ./solutions/hydrology_core_step.cpp 455 469 #}}} 456 #Diagnostic sources {{{ 1470 #Diagnostic sources {{{ 457 471 diagnostic_sources = ./modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp\ 458 472 ./modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp \ … … 475 489 ./solvers/solver_stokescoupling_nonlinear.cpp 476 490 #}}} 477 #Balanced sources {{{ 1491 #Balanced sources {{{ 478 492 balanced_sources = ./modules/ModelProcessorx/Balancethickness/UpdateElementsBalancethickness.cpp\ 479 493 ./modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp\ … … 482 496 ./solutions/balancethickness_core.cpp 483 497 #}}} 484 #Responses sources {{{ 1498 #Responses sources {{{ 485 499 responses_sources = ./modules/MinVelx/MinVelx.h\ 486 500 ./modules/MinVelx/MinVelx.cpp\ … … 512 526 ./modules/MassFluxx/MassFluxx.h 513 527 #}}} 514 #Slope sources {{{ 1528 #Slope sources {{{ 515 529 slope_sources = ./modules/ModelProcessorx/BedSlope/UpdateElementsBedSlope.cpp\ 516 530 ./modules/ModelProcessorx/BedSlope/CreateNodesBedSlope.cpp \ … … 524 538 ./solutions/bedslope_core.cpp 525 539 #}}} 526 #Groundingline sources {{{ 1540 #Groundingline sources {{{ 527 541 groundingline_sources= ./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\ 528 542 ./modules/GroundinglineMigrationx/GroundinglineMigrationx.h 529 543 #}}} 530 #Rifts sources {{{ 1544 #Rifts sources {{{ 531 545 rifts_sources = ./objects/Loads/Riftfront.cpp\ 532 546 ./objects/Loads/Riftfront.h\ 533 547 ./modules/ConstraintsStatex/RiftConstraintsState.cpp 534 548 #}}} 535 #3D sources {{{ 1549 #3D sources {{{ 536 550 threed_sources = ./objects/Gauss/GaussPenta.h\ 537 551 ./objects/Gauss/GaussPenta.cpp\ … … 547 561 ./objects/Elements/PentaRef.cpp 548 562 #}}} 549 #Bamg sources {{{ 1563 #Bamg sources {{{ 550 564 bamg_sources = ./objects/Bamg/BamgGeom.h\ 551 565 ./objects/Bamg/BamgGeom.cpp\ … … 613 627 ./modules/BamgTriangulatex/BamgTriangulatex.h 614 628 #}}} 615 #Kriging sources {{{ 1629 #Kriging sources {{{ 616 630 kriging_sources = ./Container/Observations.h\ 617 631 ./Container/Observations.cpp\ … … 632 646 ./modules/Krigingx/Krigingx.h 633 647 634 #}}} 635 #Kml sources {{{1 648 #For parallel kriging, only difference is ./modules/Krigingx/pKrigingx.cpp with no multithreading 649 pkriging_sources = ./Container/Observations.h\ 650 ./Container/Observations.cpp\ 651 ./objects/Kriging/Variogram.h \ 652 ./objects/Kriging/GaussianVariogram.h\ 653 ./objects/Kriging/GaussianVariogram.cpp\ 654 ./objects/Kriging/ExponentialVariogram.h\ 655 ./objects/Kriging/ExponentialVariogram.cpp\ 656 ./objects/Kriging/SphericalVariogram.h\ 657 ./objects/Kriging/SphericalVariogram.cpp\ 658 ./objects/Kriging/PowerVariogram.h\ 659 ./objects/Kriging/PowerVariogram.cpp\ 660 ./objects/Kriging/Quadtree.h\ 661 ./objects/Kriging/Quadtree.cpp\ 662 ./objects/Kriging/Observation.h\ 663 ./objects/Kriging/Observation.cpp\ 664 ./modules/Krigingx/pKrigingx.cpp\ 665 ./modules/Krigingx/Krigingx.h 666 667 #}}} 668 #Kml sources {{{ 636 669 kml_sources = ./modules/Exp2Kmlx/Exp2Kmlx.h\ 637 670 ./modules/Exp2Kmlx/Exp2Kmlx.cpp\ … … 701 734 ./objects/KML/KMLFileReadUtils.h 702 735 #}}} 703 #Petsc sources {{{ 1736 #Petsc sources {{{ 704 737 petsc_sources= ./toolkits/petsc\ 705 738 ./toolkits/petsc/patches\ … … 736 769 737 770 #}}} 738 #Gsl sources {{{ 1771 #Gsl sources {{{ 739 772 gsl_sources= ./modules/Solverx/SolverxGsl.cpp 740 741 #}}} 742 #Mpi sources {{{1 773 #}}} 774 #Mpi sources {{{ 743 775 mpi_sources= ./toolkits/mpi/mpiincludes.h\ 744 776 ./toolkits/mpi/patches/mpipatches.h\ … … 748 780 ./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp 749 781 #}}} 750 #Metis sources {{{ 1782 #Metis sources {{{ 751 783 metis_sources= ./toolkits/metis/patches/metispatches.h\ 752 784 ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp 753 785 #}}} 754 #Python sources {{{ 1786 #Python sources {{{ 755 787 python_sources= ./python/io/pythonio.h\ 756 788 ./python/python-binding.h\ … … 760 792 761 793 #}}} 762 #Matlab sources {{{ 1794 #Matlab sources {{{ 763 795 matlab_sources= ./toolkits/matlab/matlabincludes.h\ 764 796 ./matlab/matlab-binding.h\ … … 777 809 ./matlab/io/MatlabVectorToSeqVec.cpp 778 810 #}}} 779 #Matlab and Petsc sources {{{ 1811 #Matlab and Petsc sources {{{ 780 812 matlabpetsc_sources= ./matlab/io/MatlabMatrixToPetscMatrix.cpp\ 781 813 ./matlab/io/MatlabVectorToPetscVector.cpp 782 814 783 815 #}}} 784 #Modules sources{{{ 1816 #Modules sources{{{ 785 817 module_sources= ./objects/Options/Option.cpp\ 786 818 ./objects/Options/Option.h\ … … 870 902 #}}} 871 903 872 #{{{ 1Conditional build-up of sources904 #{{{ Conditional build-up of sources 873 905 #ISSM sources are a combination of core sources and sources related to specific capabilities (which can 874 906 #be activated by autotools conditionals 875 876 907 877 908 #First the core … … 957 988 endif 958 989 959 960 #}}} 961 #Library flags and sources {{{1 990 if KRIGING 991 issm_sources += $(pkriging_sources) 992 endif 993 #}}} 994 #Library flags and sources {{{ 962 995 ALLCXXFLAGS= -fPIC -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_ $(CXXFLAGS) $(CXXOPTFLAGS) 963 996 … … 984 1017 985 1018 #}}} 986 #Overload library, to overload any non-standard symbols. {{{ 11019 #Overload library, to overload any non-standard symbols. {{{ 987 1020 libISSMOverload_a_SOURCES = ./shared/String/stricmp.c 988 1021 libISSMOverload_a_CFLAGS = -fPIC -D_C_ $(COPTFLAGS) $(CFLAGS) 989 1022 #}}} 990 1023 991 #Executable {{{ 11024 #Executable {{{ 992 1025 bin_PROGRAMS = issm 993 1026 … … 996 1029 997 1030 #External packages 998 LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(S CALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)1031 LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(ADOLCLIB) 999 1032 1000 1033 if FORTRAN … … 1004 1037 issm_SOURCES = solutions/issm.cpp 1005 1038 issm_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 1039 1040 if KRIGING 1041 bin_PROGRAMS += kriging 1042 kriging_SOURCES = solutions/kriging.cpp 1043 kriging_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 1044 endif 1006 1045 #}}} 1007 1046 #Automatic differentiation: append this fold to the end of the src/c/Makefile.am to get this Makefile.am {{{ -
issm/trunk/src/c/include/include.h
r9761 r12706 10 10 #include "./types.h" 11 11 12 13 12 #endif //ifndef _INCLUDE_H_ 14 -
issm/trunk/src/c/include/macros.h
r12330 r12706 3 3 */ 4 4 5 /*Header {{{ 1*/5 /*Header {{{*/ 6 6 #ifndef _MACROS_H_ 7 7 #define _MACROS_H_ 8 8 9 #include <iostream> 10 #include <sstream> 11 #include <iomanip> 9 12 #include "./typedefs.h" 10 13 … … 16 19 /*}}}*/ 17 20 18 /* _printf_ {{{ 1*/21 /* _printf_ {{{*/ 19 22 /*Printing macro: only cpu number 0 */ 20 #define _printf_(flag,...) do { if(flag) PrintfFunction(__VA_ARGS__); }while(0)23 #define _printf_(flag,...) do{if(flag) PrintfFunction(__VA_ARGS__);}while(0) 21 24 /*}}}*/ 22 /* _error_ {{{ 1*/25 /* _error_ {{{*/ 23 26 /*Error exception macro*/ 24 27 #ifdef _INTEL_WIN_ … … 30 33 #endif 31 34 /*}}}*/ 32 /* _assert_ {{{1*/ 35 /* _error2_ {{{*/ 36 /*new Error exception macro*/ 37 #ifdef _INTEL_WIN_ 38 #define _error2_(StreamArgs)\ 39 do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \ 40 aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \ 41 throw ErrorException(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0) 42 #else 43 #define _error2_(StreamArgs)\ 44 do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \ 45 aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \ 46 throw ErrorException(__FILE__,__func__,__LINE__,aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0) 47 #endif 48 /*}}}*/ 49 /* _printLine_ {{{*/ 50 /* macro to print a line, adds std::endl */ 51 #define _printLine_(StreamArgs)\ 52 do{std::cout << StreamArgs << std::endl;}while(0) 53 /*}}}*/ 54 /* _printString_ {{{*/ 55 /* macro to print some string, adds std::ends */ 56 #define _printString_(StreamArgs)\ 57 do{std::cout << StreamArgs;}while(0) 58 /*}}}*/ 59 /* _pprintLine_ {{{*/ 60 /* macro to print a line, adds std::endl */ 61 #define _pprintLine_(StreamArgs)\ 62 do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \ 63 aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \ 64 PrintfFunction(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0) 65 /*}}}*/ 66 /* _pprintString_ {{{*/ 67 /* macro to print some string, adds std::ends */ 68 #define _pprintString_(StreamArgs)\ 69 do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \ 70 aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \ 71 PrintfFunction2(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0) 72 /*}}}*/ 73 /* _assert_ {{{*/ 33 74 /*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/ 34 75 #ifdef _ISSM_DEBUG_ … … 40 81 #endif 41 82 /*}}}*/ 42 /* ISSMBOOT/ISSMEND {{{ 1*/83 /* ISSMBOOT/ISSMEND {{{*/ 43 84 44 85 /*The following macros hide the error exception handling in a matlab module. Just put -
issm/trunk/src/c/include/typedefs.h
r11527 r12706 16 16 #define NDOF3 3 17 17 #define NDOF4 4 18 19 18 20 19 #define DIM2 2 … … 40 39 #endif 41 40 42 43 44 45 41 #endif //ifndef _ISSMTYPEDEFS_H_ -
issm/trunk/src/c/include/types.h
r12330 r12706 28 28 29 29 #ifdef _HAVE_ADOLC_ 30 #include "adolc/adolc.h" 31 // for active variables 30 32 typedef adouble IssmDouble; 33 // for passive variables 34 typedef double IssmPDouble; 31 35 #else 36 // see above 32 37 typedef double IssmDouble; 38 // see above 39 typedef IssmDouble IssmPDouble; 33 40 #endif 34 41 35 42 typedef bool IssmBool; 36 43 37 38 44 #endif //ifndef _TYPES_H_ -
issm/trunk/src/c/io/Disk/diskio.h
r11237 r12706 10 10 #include "../../include/include.h" 11 11 12 class DataSet;13 class Parameters;14 15 12 FILE* pfopen(char* filename,const char* format); 16 13 void pfclose(FILE* fid,char* filename); -
issm/trunk/src/c/io/Disk/pfclose.cpp
r9320 r12706 18 18 extern int my_rank; 19 19 _assert_(fid); 20 if(fclose(fid)!=0)_error _("%s%s","could not close file ",filename);20 if(fclose(fid)!=0)_error2_("could not close file " << filename); 21 21 } -
issm/trunk/src/c/io/Disk/pfopen.cpp
r11237 r12706 20 20 /*Open handle to data on disk: */ 21 21 fid=fopen(filename,format); 22 if(fid==NULL) _error _("%s%s%s","could not open file ",filename," for binary reading or writing");22 if(fid==NULL) _error2_("could not open file " << filename << " for binary reading or writing"); 23 23 24 24 return fid; -
issm/trunk/src/c/io/PrintfFunction.cpp
r12330 r12706 25 25 26 26 /*allocate buffer for given string size*/ 27 buffer= (char*)xmalloc(size*sizeof(char));27 buffer=xNew<char>(size); 28 28 29 29 /* Try to print in the allocated space. */ 30 30 va_start(args, format); 31 #ifndef WIN3232 31 n=vsnprintf(buffer,size,format,args); 33 #else34 n=vsnprintf(buffer,size,format,args);35 #endif36 32 va_end(args); 37 33 … … 45 41 size*=2; /* twice the old size */ 46 42 47 x free((void**)&buffer);43 xDelete<char>(buffer); 48 44 } 49 45 50 46 /*Ok, if we are running in parallel, get node 0 to print*/ 51 if(my_rank==0) printf(buffer);47 if(my_rank==0)_printString_(buffer); 52 48 53 49 /*Clean up and return*/ 54 x free((void**)&buffer);50 xDelete<char>(buffer); 55 51 return 1; 56 52 } 53 int PrintfFunction(const string & message){ 54 extern int my_rank; 55 if(my_rank==0){ 56 printf("%s\n",message.c_str()); 57 } 58 return 1; 59 } 60 int PrintfFunction2(const string & message){ 61 extern int my_rank; 62 if(my_rank==0){ 63 printf("%s",message.c_str()); 64 } 65 return 1; 66 } -
issm/trunk/src/c/io/io.h
r12330 r12706 6 6 #define _ISSM_IO_H_ 7 7 8 #ifdef HAVE_CONFIG_H //config.h {{{18 #ifdef HAVE_CONFIG_H 9 9 #include <config.h> 10 10 #else 11 11 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 12 12 #endif 13 //}}}14 15 13 #include "./Disk/diskio.h" 16 14 17 15 /*printf: */ 18 16 int PrintfFunction(const char* format,...); 17 int PrintfFunction(const string & message); 18 int PrintfFunction2(const string & message); 19 19 20 20 #endif /* _IO_H_ */ -
issm/trunk/src/c/issm.h
r9761 r12706 22 22 #include "./modules/modules.h" 23 23 24 25 24 #endif //ifndef _ISSM_H_ -
issm/trunk/src/c/matlab/include/matlab_macros.h
r12330 r12706 3 3 */ 4 4 5 /*Header {{{ 1*/5 /*Header {{{*/ 6 6 #ifndef _MATLAB_MACROS_H_ 7 7 #define _MATLAB_MACROS_H_ … … 15 15 16 16 #ifdef _HAVE_MATLAB_ 17 /* MODULEBOOT/MODULEEND {{{ 1*/17 /* MODULEBOOT/MODULEEND {{{*/ 18 18 19 19 /*The following macros hide the error exception handling in a matlab module. Just put … … 36 36 } 37 37 //}}} 38 /* WRAPPER {{{ 1*/38 /* WRAPPER {{{*/ 39 39 #define WRAPPER(modulename,...) void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) 40 40 41 41 /*}}}*/ 42 /* CHECKARGUMENTS {{{ 1*/42 /* CHECKARGUMENTS {{{*/ 43 43 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,functionpointer) 44 44 /*}}}*/ -
issm/trunk/src/c/matlab/io/CheckNumMatlabArguments.cpp
r12330 r12706 22 22 /* special case: */ 23 23 function(); 24 _error _("usage: see above");24 _error2_("usage: see above"); 25 25 } 26 26 else if (nlhs!=NLHS || nrhs!=NRHS ) { 27 27 function(); 28 _error _("usage error.");28 _error2_("usage error."); 29 29 } 30 30 return 1; -
issm/trunk/src/c/matlab/io/FetchMatlabData.cpp
r12330 r12706 15 15 16 16 /*Primitive data types*/ 17 /*FUNCTION FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{ 1*/17 /*FUNCTION FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/ 18 18 void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){ 19 19 … … 27 27 outmatrix=NULL; 28 28 } 29 else if(mxIsClass(dataref,"double") || mxIsClass(dataref,"single")){ 29 else if( mxIsClass(dataref,"double") || 30 mxIsClass(dataref,"single") || 31 mxIsClass(dataref,"int16") || 32 mxIsClass(dataref,"int8") || 33 mxIsClass(dataref,"uint8")){ 30 34 /*Check dataref is not pointing to NaN: */ 31 35 if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){ … … 35 39 } 36 40 else{ 41 if(!mxIsClass(dataref,"double") && !mxIsClass(dataref,"single")){ 42 _printLine_("Warning: converting matlab data from '" << mxGetClassName(dataref) << "' to 'double'"); 43 } 37 44 /*Convert matlab matrix to double* matrix: */ 38 45 MatlabMatrixToDoubleMatrix(&outmatrix,&outmatrix_rows,&outmatrix_cols,dataref); … … 41 48 else{ 42 49 /*This is an error: we don't have the correct input!: */ 43 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));50 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 44 51 } 45 52 … … 51 58 } 52 59 /*}}}*/ 53 /*FUNCTION FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{ 1*/60 /*FUNCTION FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/ 54 61 void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){ 55 62 … … 82 89 else{ 83 90 /*This is an error: we don't have the correct input!: */ 84 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));91 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 85 92 } 86 93 … … 90 97 if (pndims)*pndims=outmatrix_ndims; 91 98 if (psize )*psize =outmatrix_size; 92 else x free((void**)&outmatrix_size);93 94 } 95 /*}}}*/ 96 /*FUNCTION FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{ 1*/99 else xDelete<int>(outmatrix_size); 100 101 } 102 /*}}}*/ 103 /*FUNCTION FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/ 97 104 void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){ 98 105 … … 121 128 122 129 /*Convert double matrix into integer matrix: */ 123 outmatrix= (int*)xmalloc(outmatrix_rows*outmatrix_cols*sizeof(int));130 outmatrix=xNew<int>(outmatrix_rows*outmatrix_cols); 124 131 for(i=0;i<outmatrix_rows*outmatrix_cols;i++)outmatrix[i]=(int)doublematrix[i]; 125 132 } … … 127 134 else{ 128 135 /*This is an error: we don't have the correct input!: */ 129 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));136 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 130 137 } 131 138 … … 136 143 } 137 144 /*}}}*/ 138 /*FUNCTION FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{ 1*/145 /*FUNCTION FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/ 139 146 void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){ 140 147 … … 163 170 164 171 /*Convert double matrix into integer matrix: */ 165 outmatrix= (bool*)xmalloc(outmatrix_rows*outmatrix_cols*sizeof(bool));172 outmatrix=xNew<bool>(outmatrix_rows*outmatrix_cols); 166 173 for(i=0;i<outmatrix_rows;i++)outmatrix[i]=(bool)doublematrix[i]; 167 174 } … … 169 176 else{ 170 177 /*This is an error: we don't have the correct input!: */ 171 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));178 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 172 179 } 173 180 … … 178 185 } 179 186 /*}}}*/ 180 /*FUNCTION FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{ 1*/187 /*FUNCTION FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/ 181 188 void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){ 182 189 … … 224 231 225 232 /*Convert double matrix into bool matrix: */ 226 outmatrix= (bool*)xmalloc(outmatrix_numel*sizeof(bool));233 outmatrix=xNew<bool>(outmatrix_numel); 227 234 for(i=0;i<outmatrix_numel;i++)outmatrix[i]=(bool)doublematrix[i]; 228 x free((void**)&doublematrix);229 } 230 } 231 else{ 232 /*This is an error: we don't have the correct input!: */ 233 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));235 xDelete<double>(doublematrix); 236 } 237 } 238 else{ 239 /*This is an error: we don't have the correct input!: */ 240 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 234 241 } 235 242 … … 239 246 if (pndims)*pndims=outmatrix_ndims; 240 247 if (psize )*psize =outmatrix_size; 241 else x free((void**)&outmatrix_size);242 243 } 244 /*}}}*/ 245 /*FUNCTION FetchData(double** pvector,int* pM,const mxArray* dataref){{{ 1*/248 else xDelete<int>(outmatrix_size); 249 250 } 251 /*}}}*/ 252 /*FUNCTION FetchData(double** pvector,int* pM,const mxArray* dataref){{{*/ 246 253 void FetchData(double** pvector,int* pM,const mxArray* dataref){ 247 254 … … 262 269 else{ 263 270 /*This is an error: we don't have the correct input!: */ 264 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));271 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 265 272 } 266 273 … … 270 277 } 271 278 /*}}}*/ 272 /*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{ 1*/279 /*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{*/ 273 280 void FetchData(int** pvector,int* pM,const mxArray* dataref){ 274 281 … … 289 296 290 297 /*Convert double vector into integer vector: */ 291 outvector= (int*)xmalloc(outvector_rows*sizeof(int));298 outvector=xNew<int>(outvector_rows); 292 299 for(i=0;i<outvector_rows;i++)outvector[i]=(int)doublevector[i]; 293 300 } 294 301 else{ 295 302 /*This is an error: we don't have the correct input!: */ 296 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));303 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 297 304 } 298 305 … … 302 309 } 303 310 /*}}}*/ 304 /*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{ 1*/311 /*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{*/ 305 312 void FetchData(bool** pvector,int* pM,const mxArray* dataref){ 306 313 … … 321 328 322 329 /*Convert double vector into integer vector: */ 323 outvector= (bool*)xmalloc(outvector_rows*sizeof(bool));330 outvector=xNew<bool>(outvector_rows); 324 331 for(i=0;i<outvector_rows;i++)outvector[i]=(bool)doublevector[i]; 325 332 } 326 333 else{ 327 334 /*This is an error: we don't have the correct input!: */ 328 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));335 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 329 336 } 330 337 … … 334 341 } 335 342 /*}}}*/ 336 /*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{ 1*/343 /*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{*/ 337 344 void FetchData(float** pvector,int* pM,const mxArray* dataref){ 338 345 … … 353 360 354 361 /*Convert double vector into float vector: */ 355 outvector= (float*)xmalloc(outvector_rows*sizeof(float));362 outvector=xNew<float>(outvector_rows); 356 363 for(i=0;i<outvector_rows;i++)outvector[i]=(float)doublevector[i]; 357 364 } 358 365 else{ 359 366 /*This is an error: we don't have the correct input!: */ 360 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));367 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 361 368 } 362 369 … … 366 373 } 367 374 /*}}}*/ 368 /*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{ 1*/375 /*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{*/ 369 376 void FetchData(char** pstring,const mxArray* dataref){ 370 377 … … 374 381 /*Ok, the string should be coming directly from the matlab workspace: */ 375 382 if (!mxIsClass(dataref,"char")){ 376 _error _("input data_type is not a string!");383 _error2_("input data_type is not a string!"); 377 384 } 378 385 else{ … … 381 388 382 389 stringlen = mxGetM(dataref)*mxGetN(dataref)+1; 383 outstring = (char*)xmalloc(sizeof(mxChar)*stringlen);390 outstring =xNew<char>(stringlen); 384 391 mxGetString(dataref,outstring,stringlen); 385 392 } … … 387 394 /*Assign output pointers:*/ 388 395 *pstring=outstring; 389 } 390 /*FUNCTION FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{ 1*/396 }/*}}}*/ 397 /*FUNCTION FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/ 391 398 void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){ 392 399 … … 409 416 else{ 410 417 /*This is an error: we don't have the correct input!: */ 411 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));418 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 412 419 } 413 420 … … 417 424 if (pndims)*pndims=outmatrix_ndims; 418 425 if (psize )*psize =outmatrix_size; 419 else x free((void**)&outmatrix_size);420 421 } 422 /*}}}*/ 423 /*FUNCTION FetchData(double* pscalar,const mxArray* dataref){{{ 1*/426 else xDelete<int>(outmatrix_size); 427 428 } 429 /*}}}*/ 430 /*FUNCTION FetchData(double* pscalar,const mxArray* dataref){{{*/ 424 431 void FetchData(double* pscalar,const mxArray* dataref){ 425 432 … … 427 434 428 435 if (!mxIsClass(dataref,"double")){ 429 _error _("input data_type is not a double!");436 _error2_("input data_type is not a double!"); 430 437 } 431 438 else{ … … 438 445 } 439 446 /*}}}*/ 440 /*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{ 1*/447 /*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{*/ 441 448 void FetchData(int* pinteger,const mxArray* dataref){ 442 449 … … 444 451 445 452 if (!mxIsClass(dataref,"double")){ 446 _error _("input data_type is not a scalar!");453 _error2_("input data_type is not a scalar!"); 447 454 } 448 455 else{ … … 455 462 } 456 463 /*}}}*/ 457 /*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{ 1*/464 /*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{*/ 458 465 void FetchData(bool* pboolean,const mxArray* dataref){ 459 466 … … 461 468 462 469 if (mxIsClass(dataref,"logical")){ 463 if(mxGetM(dataref)!=1) _error _("input data is not of size 1x1");464 if(mxGetN(dataref)!=1) _error _("input data is not of size 1x1");470 if(mxGetM(dataref)!=1) _error2_("input data is not of size 1x1"); 471 if(mxGetN(dataref)!=1) _error2_("input data is not of size 1x1"); 465 472 mxbool_ptr=mxGetLogicals(dataref); 466 473 } 467 474 else{ 468 _error _("input data_type is not a bool!");475 _error2_("input data_type is not a bool!"); 469 476 } 470 477 … … 474 481 475 482 /*ISSM objects*/ 476 /*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{ 1*/483 /*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{*/ 477 484 void FetchData(Matrix** pmatrix,const mxArray* dataref){ 478 485 … … 488 495 else{ 489 496 /*This is an error: we don't have the correct input!: */ 490 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));497 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 491 498 } 492 499 … … 495 502 } 496 503 /*}}}*/ 497 /*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{ 1*/504 /*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{*/ 498 505 void FetchData(Vector** pvector,const mxArray* dataref){ 499 506 … … 512 519 else{ 513 520 /*This is an error: we don't have the correct input!: */ 514 _error _("Input parameter of class %s not supported yet",mxGetClassName(dataref));521 _error2_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet"); 515 522 } 516 523 … … 519 526 } 520 527 /*}}}*/ 521 /*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{ 1*/528 /*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{*/ 522 529 void FetchData(BamgGeom** pbamggeom,const mxArray* dataref){ 523 530 … … 538 545 } 539 546 /*}}}*/ 540 /*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{ 1*/547 /*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{*/ 541 548 void FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){ 542 549 … … 558 565 } 559 566 /*}}}*/ 560 /*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{ 1*/567 /*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{*/ 561 568 void FetchData(BamgOpts** pbamgopts,const mxArray* dataref){ 562 569 … … 602 609 } 603 610 /*}}}*/ 604 /*FUNCTION FetchData(Options** poptions,const mxArray* dataref){{{ 1*/611 /*FUNCTION FetchData(Options** poptions,const mxArray* dataref){{{*/ 605 612 void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref){ 606 613 … … 613 620 /*Fetch all options*/ 614 621 for (int i=istart; i<nrhs; i=i+2){ 615 if (!mxIsClass(pdataref[i],"char")) _error _("Argument %d must be name of option",i+1);622 if (!mxIsClass(pdataref[i],"char")) _error2_("Argument " << i+1 << " must be name of option"); 616 623 617 624 FetchData(&name,pdataref[i]); 618 if(i+1 == nrhs) _error _("Argument %d must exist and be value of option \"%s\".",i+2,name);625 if(i+1 == nrhs) _error2_("Argument " << i+2 << " must exist and be value of option \"" << name << "\"."); 619 626 620 627 option=(Option*)OptionParse(name,&pdataref[i+1]); -
issm/trunk/src/c/matlab/io/MatlabMatrixToDoubleMatrix.cpp
r12330 r12706 2 2 * \brief: convert a sparse or dense matlab matrix to a double* pointer 3 3 */ 4 5 4 6 5 #ifdef HAVE_CONFIG_H … … 10 9 #endif 11 10 12 13 11 /*Matlab includes: */ 14 12 #include "mex.h" 15 16 13 #include "../../shared/shared.h" 17 14 18 15 int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){ 19 16 20 int i,j,count,rows,cols; 21 double *pmxdoublematrix = NULL; 22 float *pmxsinglematrix = NULL; 17 int i,j,count,rows,cols; 23 18 24 19 /*output: */ … … 33 28 34 29 /*Dealing with sparse matrix: recover size first: */ 35 pmxdoublematrix=(double*)mxGetPr(mxmatrix);30 double* pmxmatrix=(double*)mxGetPr(mxmatrix); 36 31 rows=mxGetM(mxmatrix); 37 32 cols=mxGetN(mxmatrix); 38 33 39 34 if(rows*cols){ 40 matrix= (double*)xcalloc(rows*cols,sizeof(double));35 matrix=xNewZeroInit<double>(rows*cols); 41 36 42 37 /*Now, get ir,jc and pr: */ … … 48 43 for(i=0;i<cols;i++){ 49 44 for(j=0;j<(jc[i+1]-jc[i]);j++){ 50 matrix[rows*ir[count]+i]=pmx doublematrix[count];45 matrix[rows*ir[count]+i]=pmxmatrix[count]; 51 46 count++; 52 47 } … … 57 52 else if(mxIsClass(mxmatrix,"double")){ 58 53 /*Dealing with dense matrix: recover pointer and size: */ 59 pmxdoublematrix=(double*)mxGetPr(mxmatrix);54 double* pmxmatrix=(double*)mxGetPr(mxmatrix); 60 55 rows=mxGetM(mxmatrix); 61 56 cols=mxGetN(mxmatrix); … … 63 58 /*Create serial matrix: */ 64 59 if(rows*cols){ 65 matrix= (double*)xcalloc(rows*cols,sizeof(double));60 matrix=xNewZeroInit<double>(rows*cols); 66 61 67 62 for(i=0;i<rows;i++){ 68 63 for(j=0;j<cols;j++){ 69 matrix[cols*i+j]=(double)pmx doublematrix[rows*j+i];64 matrix[cols*i+j]=(double)pmxmatrix[rows*j+i]; 70 65 } 71 66 } … … 74 69 else if(mxIsClass(mxmatrix,"single")){ 75 70 /*Dealing with dense matrix: recover pointer and size: */ 76 pmxsinglematrix=(float*)mxGetPr(mxmatrix);71 float *pmxmatrix=(float*)mxGetPr(mxmatrix); 77 72 rows=mxGetM(mxmatrix); 78 73 cols=mxGetN(mxmatrix); … … 80 75 /*Create serial matrix: */ 81 76 if(rows*cols){ 82 matrix= (double*)xcalloc(rows*cols,sizeof(double));77 matrix=xNewZeroInit<double>(rows*cols); 83 78 84 79 for(i=0;i<rows;i++){ 85 80 for(j=0;j<cols;j++){ 86 matrix[cols*i+j]=(double)pmxsinglematrix[rows*j+i]; 81 matrix[cols*i+j]=(double)pmxmatrix[rows*j+i]; 82 } 83 } 84 } 85 } 86 else if(mxIsClass(mxmatrix,"int16")){ 87 /*Dealing with dense matrix: recover pointer and size: */ 88 short int *pmxmatrix=(short*)mxGetPr(mxmatrix); 89 rows=mxGetM(mxmatrix); 90 cols=mxGetN(mxmatrix); 91 92 /*Create serial matrix: */ 93 if(rows*cols){ 94 matrix=xNewZeroInit<double>(rows*cols); 95 96 for(i=0;i<rows;i++){ 97 for(j=0;j<cols;j++){ 98 matrix[cols*i+j]=(double)pmxmatrix[rows*j+i]; 99 } 100 } 101 } 102 } 103 else if(mxIsClass(mxmatrix,"uint8")){ 104 /*Dealing with dense matrix: recover pointer and size: */ 105 char *pmxmatrix=(char*)mxGetPr(mxmatrix); 106 rows=mxGetM(mxmatrix); 107 cols=mxGetN(mxmatrix); 108 109 /*Create serial matrix: */ 110 if(rows*cols){ 111 matrix=xNewZeroInit<double>(rows*cols); 112 113 for(i=0;i<rows;i++){ 114 for(j=0;j<cols;j++){ 115 matrix[cols*i+j]=(double)pmxmatrix[rows*j+i]; 87 116 } 88 117 } … … 90 119 } 91 120 else{ 92 _error _("Matlab matrix type Not implemented yet");121 _error2_("Matlab matrix type Not implemented yet"); 93 122 } 94 123 -
issm/trunk/src/c/matlab/io/MatlabMatrixToMatrix.cpp
r12330 r12706 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> -
issm/trunk/src/c/matlab/io/MatlabMatrixToPetscMatrix.cpp
r12330 r12706 9 9 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 10 10 #endif 11 11 #include "../../shared/shared.h" 12 12 13 13 /*Petsc includes: */ … … 19 19 #include "mex.h" 20 20 21 #include "../../shared/shared.h"22 23 21 int MatlabMatrixToPetscMatrix(Mat* pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){ 24 22 25 23 int rows, cols; 26 double * mxmatrix_ptr=NULL;27 double * tmatrix=NULL;24 double *mxmatrix_ptr = NULL; 25 double *tmatrix = NULL; 28 26 int ierr; 29 27 int i,j; 30 28 31 29 /*output: */ 32 Mat matrix =NULL;30 Mat matrix = NULL; 33 31 34 32 /*matlab indices: */ 35 mwIndex * ir=NULL;36 mwIndex * jc=NULL;37 double * pr=NULL;33 mwIndex *ir = NULL; 34 mwIndex *jc = NULL; 35 double *pr = NULL; 38 36 int count; 39 37 int nnz; … … 41 39 42 40 /*petsc indices: */ 43 int * idxm=NULL;44 int * idxn=NULL;41 int *idxm = NULL; 42 int *idxn = NULL; 45 43 46 44 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 74 72 } 75 73 } 76 77 74 } 78 75 else{ 79 80 76 /*Dealing with dense matrix: recover pointer and size: */ 81 77 mxmatrix_ptr=(double*)mxGetPr(mxmatrix); … … 84 80 85 81 /*transpose, as Petsc now does not allows MAT_COLUMN_ORIENTED matrices in MatSetValues: */ 86 tmatrix= (double*)xmalloc(rows*cols*sizeof(double));82 tmatrix=xNew<double>(rows*cols); 87 83 for(i=0;i<cols;i++){ 88 84 for(j=0;j<rows;j++){ … … 95 91 96 92 /*Insert mxmatrix_ptr values into petsc matrix: */ 97 idxm= (int*)xmalloc(rows*sizeof(int));98 idxn= (int*)xmalloc(cols*sizeof(int));93 idxm=xNew<int>(rows); 94 idxn=xNew<int>(cols); 99 95 100 96 for(i=0;i<rows;i++)idxm[i]=i; … … 103 99 ierr=MatSetValues(matrix,rows,idxm,cols,idxn,tmatrix,INSERT_VALUES); CHKERRQ(ierr); 104 100 105 xfree((void**)&tmatrix); 106 101 xDelete<double>(tmatrix); 107 102 } 108 103 … … 110 105 MatAssemblyBegin(matrix,MAT_FINAL_ASSEMBLY); 111 106 MatAssemblyEnd(matrix,MAT_FINAL_ASSEMBLY); 112 113 107 114 108 /*Assign output pointer: */ -
issm/trunk/src/c/matlab/io/MatlabMatrixToSeqMat.cpp
r12330 r12706 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> -
issm/trunk/src/c/matlab/io/MatlabNArrayToNArray.cpp
r12330 r12706 15 15 #include <mex.h> 16 16 17 /*FUNCTION MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{ 1*/17 /*FUNCTION MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{*/ 18 18 int MatlabNArrayToNArray(double** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){ 19 19 … … 39 39 ndims=mxGetNumberOfDimensions(mxmatrix); 40 40 ipt =mxGetDimensions(mxmatrix); 41 size = (int *) xcalloc(ndims,sizeof(int));42 for (i=0; i<ndims;i++) size[i]=(int)ipt[i];41 size =xNew<int>(ndims); 42 for (i=0;i<ndims;i++) size[i]=(int)ipt[i]; 43 43 44 44 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 51 51 nz=(int)((double)nnz/(double)rows); 52 52 53 matrix= (double*)xcalloc(rows*cols,sizeof(double));53 matrix=xNewZeroInit<double>(rows*cols); 54 54 55 55 /*Now, get ir,jc and pr: */ … … 74 74 75 75 /*Create serial matrix: */ 76 matrix= (double*)xcalloc(numel,sizeof(double));77 78 dims= (int *) xcalloc(ndims,sizeof(int));76 matrix=xNewZeroInit<double>(numel); 77 78 dims=xNew<int>(ndims); 79 79 for(i=0;i<numel;i++){ 80 80 ColumnWiseDimsFromIndex(dims,i,size,ndims); … … 82 82 *(matrix+j)=*(mxmatrix_ptr+i); 83 83 } 84 x free((void**)&dims);84 xDelete<int>(dims); 85 85 86 86 } … … 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{ 1*/97 /*FUNCTION MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{*/ 98 98 int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){ 99 99 … … 119 119 ndims=mxGetNumberOfDimensions(mxmatrix); 120 120 ipt =mxGetDimensions(mxmatrix); 121 size = (int *) xcalloc(ndims,sizeof(int));122 for (i=0; i<ndims;i++) size[i]=(int)ipt[i];121 size =xNew<int>(ndims); 122 for (i=0;i<ndims;i++) size[i]=(int)ipt[i]; 123 123 124 124 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 131 131 nz=(int)((double)nnz/(double)rows); 132 132 133 matrix= (bool*)xcalloc(rows*cols,sizeof(bool));133 matrix=xNewZeroInit<bool>(rows*cols); 134 134 135 135 /*Now, get ir,jc and pm: */ … … 154 154 155 155 /*Create serial matrix: */ 156 matrix=(bool*)xcalloc(numel,sizeof(bool)); 157 158 dims=(int *) xcalloc(ndims,sizeof(int)); 156 matrix=xNew<bool>(numel); 157 dims=xNew<int>(ndims); 159 158 for(i=0;i<numel;i++){ 160 159 ColumnWiseDimsFromIndex(dims,i,size,ndims); … … 162 161 *(matrix+j)=(bool)*(mxmatrix_ptr+i); 163 162 } 164 xfree((void**)&dims); 165 163 xDelete<int>(dims); 166 164 } 167 165 … … 175 173 } 176 174 /*}}}*/ 177 /*FUNCTION MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{ 1*/175 /*FUNCTION MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){{{*/ 178 176 int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix){ 179 177 180 int i,j,rows,cols;181 int numel,ndims;182 int *size,*dims;183 mxChar * mxmatrix_ptr=NULL;184 const mwSize * ipt=NULL;178 int i,j,rows,cols; 179 int numel,ndims; 180 int *size , *dims; 181 mxChar *mxmatrix_ptr = NULL; 182 const mwSize *ipt = NULL; 185 183 186 184 /*output: */ … … 188 186 189 187 /*matlab indices: */ 190 mwIndex * ir=NULL;191 mwIndex * jc=NULL;192 char * pm=NULL;193 int count;194 int nnz;195 int nz;188 mwIndex *ir = NULL; 189 mwIndex *jc = NULL; 190 char *pm = NULL; 191 int count; 192 int nnz; 193 int nz; 196 194 197 195 /*get Matlab matrix information: */ … … 199 197 ndims=mxGetNumberOfDimensions(mxmatrix); 200 198 ipt =mxGetDimensions(mxmatrix); 201 size = (int *) xcalloc(ndims,sizeof(int));202 for (i=0; i<ndims;i++) size[i]=(int)ipt[i];199 size =xNew<int>(ndims); 200 for (i=0;i<ndims;i++) size[i]=(int)ipt[i]; 203 201 204 202 /*Ok, first check if we are dealing with a sparse or full matrix: */ … … 211 209 nz=(int)((double)nnz/(double)rows); 212 210 213 matrix= (char*)xcalloc(rows*cols,sizeof(double));211 matrix=xNew<char>(rows*cols); 214 212 215 213 /*Now, get ir,jc and pm: */ … … 234 232 235 233 /*Create serial matrix: */ 236 matrix=(char*)xcalloc(numel+1,sizeof(mxChar)); 234 matrix=xNew<char>(numel+1); 235 matrix[numel]='\0'; 237 236 238 237 /*looping code adapted from Matlab example explore.c: */ … … 259 258 } 260 259 } 261 262 260 } 263 261 -
issm/trunk/src/c/matlab/io/MatlabVectorToDoubleVector.cpp
r12330 r12706 46 46 47 47 /*Check that input is actualy a vector*/ 48 if (cols!=1) _error _("input vector of size %ix%i should have only one column",rows,cols);48 if (cols!=1) _error2_("input vector of size " << rows << "x" << cols << " should have only one column"); 49 49 50 50 nz=(int)((double)nnz/(double)rows); 51 51 52 52 if(rows){ 53 vector= (double*)xcalloc(rows,sizeof(double));53 vector=xNewZeroInit<double>(rows); 54 54 55 55 /*Now, get ir,jc and pr: */ … … 77 77 78 78 /*Check that input is actualy a vector*/ 79 if (cols!=1) _error _("input vector of size %ix%i should have only one column",rows,cols);79 if (cols!=1) _error2_("input vector of size " << rows << "x" << cols << " should have only one column"); 80 80 81 81 /*allocate and memcpy*/ 82 82 if(rows){ 83 vector= (double*)xmalloc(rows*sizeof(double));83 vector=xNew<double>(rows); 84 84 memcpy(vector,mxvector_ptr,rows*sizeof(double)); 85 85 } -
issm/trunk/src/c/matlab/io/MatlabVectorToPetscVector.cpp
r12330 r12706 79 79 80 80 /*Insert mxvector_ptr values into petsc vector: */ 81 idxm= (int*)xmalloc(rows*sizeof(int));81 idxm=xNew<int>(rows); 82 82 83 83 for(i=0;i<rows;i++)idxm[i]=i; -
issm/trunk/src/c/matlab/io/MatlabVectorToSeqVec.cpp
r12330 r12706 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> -
issm/trunk/src/c/matlab/io/MatlabVectorToVector.cpp
r12330 r12706 3 3 4 4 /*Headers:*/ 5 /*{{{ 1*/5 /*{{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> -
issm/trunk/src/c/matlab/io/OptionParse.cpp
r12348 r12706 15 15 #include "./matlabio.h" 16 16 17 /*FUNCTION OptionDoubleParse {{{ 1*/17 /*FUNCTION OptionDoubleParse {{{*/ 18 18 OptionDouble* OptionDoubleParse( char* name, const mxArray* prhs[]){ 19 19 … … 22 22 /*check and parse the name */ 23 23 odouble=new OptionDouble; 24 odouble->name = (char *) xmalloc((strlen(name)+1)*sizeof(char));24 odouble->name =xNew<char>(strlen(name)+1); 25 25 memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char)); 26 26 27 27 /*check and parse the value */ 28 28 if (!mxIsClass(prhs[0],"double")){ 29 _error _("Value of option \"%s\" must be class \"%s\", not class \"%s\".",odouble->name,"double",odouble->name,mxGetClassName(prhs[0]));29 _error2_("Value of option \"" << odouble->name << "\" must be class \"double\", not class \"" << mxGetClassName(prhs[0]) <<"\"."); 30 30 } 31 32 31 FetchData(&odouble->values,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]); 33 32 34 33 return(odouble); 35 34 }/*}}}*/ 36 /*FUNCTION OptionLogicalParse {{{ 1*/35 /*FUNCTION OptionLogicalParse {{{*/ 37 36 OptionLogical* OptionLogicalParse( char* name, const mxArray* prhs[]){ 38 37 … … 41 40 /*check and parse the name */ 42 41 ological=new OptionLogical; 43 ological->name = (char*)xmalloc((strlen(name)+1)*sizeof(char));42 ological->name =xNew<char>(strlen(name)+1); 44 43 memcpy(ological->name,name,(strlen(name)+1)*sizeof(char)); 45 44 46 45 /*check and parse the value */ 47 46 if (!mxIsClass(prhs[0],"logical")){ 48 _error _("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ological->name,"logical",ological->name,mxGetClassName(prhs[0]));47 _error2_("Value of option \"" << ological->name << "\" must be class \"logical\", not class \"" << mxGetClassName(prhs[0]) <<"\"."); 49 48 } 50 51 49 FetchData(&ological->values,&ological->numel,&ological->ndims,&ological->size,prhs[0]); 52 50 53 51 return(ological); 54 52 }/*}}}*/ 55 /*FUNCTION OptionCharParse {{{ 1*/53 /*FUNCTION OptionCharParse {{{*/ 56 54 OptionChar* OptionCharParse( char* name, const mxArray* prhs[]){ 57 55 … … 60 58 /*check and parse the name */ 61 59 ochar=new OptionChar(); 62 ochar->name = (char*)xmalloc((strlen(name)+1)*sizeof(char));60 ochar->name =xNew<char>(strlen(name)+1); 63 61 memcpy(ochar->name,name,(strlen(name)+1)*sizeof(char)); 64 62 65 63 /*check and parse the value */ 66 64 if (!mxIsClass(prhs[0],"char")){ 67 _error _("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ochar->name,"char",ochar->name,mxGetClassName(prhs[0]));65 _error2_("Value of option \"" << ochar->name << "\" must be class \"char\", not class \"" << mxGetClassName(prhs[0]) <<"\"."); 68 66 } 69 70 67 FetchData(&ochar->values,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]); 71 68 72 69 return(ochar); 73 70 }/*}}}*/ 74 /*FUNCTION OptionStructParse {{{ 1*/71 /*FUNCTION OptionStructParse {{{*/ 75 72 OptionStruct* OptionStructParse( char* name, const mxArray* prhs[]){ 76 73 … … 85 82 /*check and parse the name */ 86 83 ostruct=new OptionStruct; 87 ostruct->name = (char*)xmalloc((strlen(name)+1)*sizeof(char));84 ostruct->name =xNew<char>(strlen(name)+1); 88 85 memcpy(ostruct->name,name,(strlen(name)+1)*sizeof(char)); 89 86 90 87 /*check and parse the value */ 91 88 if (!mxIsClass(prhs[0],"struct")){ 92 _error _("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ostruct->name,"struct",ostruct->name,mxGetClassName(prhs[0]));89 _error2_("Value of option \"" << ostruct->name << "\" must be class \"struct\", not class \"" << mxGetClassName(prhs[0]) <<"\"."); 93 90 } 94 95 91 ostruct->numel=mxGetNumberOfElements(prhs[0]); 96 92 ostruct->ndims=mxGetNumberOfDimensions(prhs[0]); 97 93 ipt =mxGetDimensions(prhs[0]); 98 ostruct->size = (int *) xmalloc(ostruct->ndims*sizeof(int));94 ostruct->size =xNew<int>(ostruct->ndims); 99 95 for (i=0; i<ostruct->ndims; i++) ostruct->size[i]=(int)ipt[i]; 100 if (ostruct->numel) ostruct->values= (Options**) xmalloc(ostruct->numel*sizeof(Options *));96 if (ostruct->numel) ostruct->values=xNew<Options*>(ostruct->numel); 101 97 102 98 /*loop through and process each element of the struct array */ … … 117 113 return(ostruct); 118 114 }/*}}}*/ 119 /*FUNCTION OptionCellParse {{{ 1*/115 /*FUNCTION OptionCellParse {{{*/ 120 116 OptionCell* OptionCellParse( char* name, const mxArray* prhs[]){ 121 117 … … 132 128 /*check and parse the name */ 133 129 ocell=new OptionCell; 134 ocell->name = (char *) xmalloc((strlen(name)+1)*sizeof(char));130 ocell->name =xNew<char>(strlen(name)+1); 135 131 memcpy(ocell->name,name,(strlen(name)+1)*sizeof(char)); 136 132 137 133 /*check and parse the value */ 138 134 if (!mxIsClass(prhs[0],"cell")){ 139 _error _("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ocell->name,"cell",ocell->name,mxGetClassName(prhs[0]));135 _error2_("Value of option \"" << ocell->name << "\" must be class \"cell\", not class \"" << mxGetClassName(prhs[0]) <<"\"."); 140 136 } 141 137 … … 143 139 ocell->ndims=mxGetNumberOfDimensions(prhs[0]); 144 140 ipt =mxGetDimensions(prhs[0]); 145 ocell->size = (int *) xmalloc(ocell->ndims*sizeof(int));141 ocell->size =xNew<int>(ocell->ndims); 146 142 for (i=0; i<ocell->ndims; i++) ocell->size[i]=(int)ipt[i]; 147 143 ocell->values=new Options; 148 144 149 145 /*loop through and process each element of the cell array */ 150 dims= (int *) xmalloc(ocell->ndims*sizeof(int));146 dims=xNew<int>(ocell->ndims); 151 147 for (cindex=0; cindex<ocell->numel; cindex++) { 152 148 ColumnWiseDimsFromIndex(dims,(int)cindex,ocell->size,ocell->ndims); … … 163 159 option=NULL; 164 160 } 165 x free((void**)&dims);161 xDelete<int>(dims); 166 162 167 163 return(ocell); 168 164 }/*}}}*/ 169 /*FUNCTION OptionParse{{{ 1*/165 /*FUNCTION OptionParse{{{*/ 170 166 Option* OptionParse(char* name, const mxArray* prhs[]){ 171 167 … … 180 176 else if(mxIsClass(prhs[0],"cell")) option=(Option*)OptionCellParse(name,prhs); 181 177 else { 182 _p rintf_(true," Converting value of option \"%s\" from unrecognized class \"%s\" to class \"%s\".\n",name,mxGetClassName(prhs[0]),"struct");178 _pprintLine_(" Converting value of option \"" << name << "\" from unrecognized class \"" << mxGetClassName(prhs[0]) << "\" to class \"" << "struct" << "\"."); 183 179 if (!mexCallMATLAB(1,lhs,1,(mxArray**)prhs,"struct")) { 184 180 option=(Option*)OptionStructParse(name,(const mxArray**)lhs); 185 181 mxDestroyArray(lhs[0]); 186 182 } 187 else _error _("Second argument value of option \"%s\" is of unrecognized class \"%s\".",name,mxGetClassName(prhs[0]));183 else _error2_("Second argument value of option \""<< name <<"\" is of unrecognized class \""<< mxGetClassName(prhs[0]) <<"\"."); 188 184 } 189 185 -
issm/trunk/src/c/matlab/io/PrintfFunction.cpp
r12330 r12706 27 27 28 28 /*allocate buffer for given string size*/ 29 buffer= (char*)xmalloc(size*sizeof(char));29 buffer=xNew<char>(size); 30 30 31 31 /* Try to print in the allocated space. */ … … 47 47 size*=2; /* twice the old size */ 48 48 49 x free((void**)&buffer);49 xDelete<char>(buffer); 50 50 } 51 51 52 52 /*Ok, if we are running in parallel, get node 0 to print*/ 53 if(my_rank==0) printf(buffer);53 if(my_rank==0)_printString_(buffer); 54 54 55 55 /*Clean up and return*/ 56 x free((void**)&buffer);56 xDelete<char>(buffer); 57 57 return 1; 58 58 } -
issm/trunk/src/c/matlab/io/WriteMatlabData.cpp
r12330 r12706 17 17 18 18 /*Primitive data types*/ 19 /*FUNCTION WriteData(mxArray** pdataref,double* matrix, int M,int N){{{ 1*/19 /*FUNCTION WriteData(mxArray** pdataref,double* matrix, int M,int N){{{*/ 20 20 void WriteData(mxArray** pdataref,double* matrix, int M,int N){ 21 21 … … 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{ 1*/44 /*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{*/ 45 45 void WriteData(mxArray** pdataref,int* matrix, int M,int N){ 46 46 … … 67 67 } 68 68 /*}}}*/ 69 /*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{ 1*/69 /*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{*/ 70 70 void WriteData(mxArray** pdataref,double* vector, int M){ 71 71 … … 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION WriteData(mxArray** pdataref,double scalar){{{ 1*/92 /*FUNCTION WriteData(mxArray** pdataref,double scalar){{{*/ 93 93 void WriteData(mxArray** pdataref,double scalar){ 94 94 … … 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION WriteData(mxArray** pdataref,int integer){{{ 1*/98 /*FUNCTION WriteData(mxArray** pdataref,int integer){{{*/ 99 99 void WriteData(mxArray** pdataref,int integer){ 100 100 … … 103 103 } 104 104 /*}}}*/ 105 /*FUNCTION WriteData(mxArray** pdataref,int boolean){{{ 1*/105 /*FUNCTION WriteData(mxArray** pdataref,int boolean){{{*/ 106 106 void WriteData(mxArray** pdataref,bool boolean){ 107 107 … … 110 110 } 111 111 /*}}}*/ 112 /*FUNCTION WriteData(mxArray** pdataref,char* string){{{ 1*/112 /*FUNCTION WriteData(mxArray** pdataref,char* string){{{*/ 113 113 void WriteData(mxArray** pdataref,char* string){ 114 114 … … 118 118 119 119 /*ISSM objects*/ 120 /*FUNCTION WriteData(mxArray** pdataref,BamgGeom* bamggeom){{{ 1*/120 /*FUNCTION WriteData(mxArray** pdataref,BamgGeom* bamggeom){{{*/ 121 121 void WriteData(mxArray** pdataref,BamgGeom* bamggeom){ 122 122 … … 158 158 } 159 159 /*}}}*/ 160 /*FUNCTION WriteData(mxArray** pdataref,BamgMesh* bamgmesh){{{ 1*/160 /*FUNCTION WriteData(mxArray** pdataref,BamgMesh* bamgmesh){{{*/ 161 161 void WriteData(mxArray** pdataref,BamgMesh* bamgmesh){ 162 162 … … 216 216 } 217 217 /*}}}*/ 218 /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{ 1*/218 /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{*/ 219 219 void WriteData(mxArray** pdataref,Matrix* matrix){ 220 220 … … 249 249 250 250 /*Free ressources:*/ 251 x free((void**)&matrix_ptr);252 253 } 254 else{ 255 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 256 } 257 258 *pdataref=dataref; 259 } 260 /*}}}*/ 261 /*FUNCTION WriteData(mxArray** pdataref,Vector* vector){{{ 1*/251 xDelete<double>(matrix_ptr); 252 253 } 254 else{ 255 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 256 } 257 258 *pdataref=dataref; 259 } 260 /*}}}*/ 261 /*FUNCTION WriteData(mxArray** pdataref,Vector* vector){{{*/ 262 262 void WriteData(mxArray** pdataref,Vector* vector){ 263 263 … … 290 290 291 291 /*Clean-up and return*/ 292 x free((void**)&vector_ptr);292 xDelete<double>(vector_ptr); 293 293 *pdataref=dataref; 294 294 } … … 296 296 297 297 /*Toolkit*/ 298 /*FUNCTION SetStructureField{{{ 1*/298 /*FUNCTION SetStructureField{{{*/ 299 299 void SetStructureField(mxArray* dataref,const char* fieldname,int M,int N,double* fieldpointer){ 300 300 -
issm/trunk/src/c/modules/AverageFilterx/AverageFilterx.cpp
r3913 r12706 18 18 19 19 /*output: */ 20 double* imageout=NULL;20 double* imageout=NULL; 21 21 22 imageout= (double*)xmalloc(samps*lines*sizeof(double));22 imageout=xNew<double>(samps*lines); 23 23 24 24 for ( i = 0; i < lines; i++ ){ -
issm/trunk/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
r11995 r12706 65 65 66 66 /*Free ressources:*/ 67 x free((void**)&qmu_part);67 xDelete<double>(qmu_part); 68 68 xdelete(&partition_contributions); 69 69 xdelete(&partition_areas); -
issm/trunk/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp
r5208 r12706 12 12 using namespace std; 13 13 14 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,double* index,double* x,double* y,int nods,int nels){ 15 16 /*Intermediary*/ 17 int i,j,k; 18 int verbose=0; 19 int noerr=1; 14 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,int* index,double* x,double* y,int nods,int nels){ 20 15 21 16 /*Options*/ 22 BamgOpts* bamgopts=NULL; 23 bamgopts=new BamgOpts(); 17 BamgOpts* bamgopts=new BamgOpts(); 24 18 25 // read mesh 26 if(verbose) printf("Reading mesh\n"); 19 /*read mesh*/ 27 20 Mesh Th(index,x,y,nods,nels); 28 21 29 //write mesh and geometry 30 if (verbose) printf("Write Geometry\n"); 22 /*write mesh and geometry*/ 31 23 Th.Gh.WriteGeometry(bamggeom,bamgopts); 32 if (verbose) printf("Write Mesh\n");33 24 Th.WriteMesh(bamgmesh,bamgopts); 34 25 35 / /clean up26 /*clean up and return*/ 36 27 delete bamgopts; 37 38 /*No error return*/ 39 return noerr; 28 return 1; 40 29 41 30 } -
issm/trunk/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.h
r3913 r12706 9 9 10 10 /* local prototypes: */ 11 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom, double* index,double* x,double* y,int nods,int nels);11 int BamgConvertMeshx(BamgMesh* bamgmesh,BamgGeom* bamggeom,int* index,double* x,double* y,int nods,int nels); 12 12 13 13 #endif -
issm/trunk/src/c/modules/Bamgx/Bamgx.cpp
r12330 r12706 38 38 /*If no mesh in input, generate one*/ 39 39 if(bamgmesh_in->TrianglesSize[0]==0){ 40 /*Mesh generation {{{ 1*/40 /*Mesh generation {{{*/ 41 41 42 42 //Step1: generate geometry Gh 43 if (verbosity>0) printf("Construction of a mesh from a given geometry\n");44 if (verbosity>1) printf(" Processing geometry...\n");43 if (verbosity>0) _printLine_("Construction of a mesh from a given geometry"); 44 if (verbosity>1) _printLine_(" Processing geometry..."); 45 45 Geometry Gh(bamggeom_in,bamgopts); 46 46 … … 50 50 51 51 //build metric using geometry 52 if (verbosity>1) printf(" Generating Metric...\n");52 if (verbosity>1) _printLine_(" Generating Metric..."); 53 53 for(i=0;i<Gh.nbv;i++){ 54 54 Metric M=Gh[i]; … … 60 60 61 61 //generate mesh 62 if (verbosity>1) printf(" Generating Mesh...\n");62 if (verbosity>1) _printLine_(" Generating Mesh..."); 63 63 Mesh Th(maxnbv,Gh,bamgopts); 64 64 … … 73 73 74 74 //Build output 75 if (verbosity>1) printf(" Write Mesh...\n");75 if (verbosity>1) _printLine_(" Write Mesh..."); 76 76 Th.WriteMesh(bamgmesh_out,bamgopts); 77 if (verbosity>1) printf(" Write Geometry...\n");77 if (verbosity>1) _printLine_(" Write Geometry..."); 78 78 Gh.WriteGeometry(bamggeom_out,bamgopts); 79 79 … … 84 84 } 85 85 else{ 86 /*Anisotropic mesh adaptation {{{ 1*/86 /*Anisotropic mesh adaptation {{{*/ 87 87 88 88 // read background mesh 89 if (verbosity>0) printf("Anisotropic mesh adaptation\n");90 if (verbosity>1) printf(" Processing initial mesh and geometry...\n");89 if (verbosity>0) _printLine_("Anisotropic mesh adaptation"); 90 if (verbosity>1) _printLine_(" Processing initial mesh and geometry..."); 91 91 Mesh BTh(bamggeom_in,bamgmesh_in,bamgopts); 92 92 … … 100 100 //Generate initial metric 101 101 if (bamgopts->metric){ 102 if (verbosity>1) printf(" Processing Metric...\n");102 if (verbosity>1) _printLine_(" Processing Metric..."); 103 103 BTh.ReadMetric(bamgopts); 104 104 } 105 105 else { 106 if (verbosity>1) printf(" Generating initial Metric...\n");106 if (verbosity>1) _printLine_(" Generating initial Metric..."); 107 107 Metric Mhmax(bamgopts->hmax); 108 108 for (int iv=0;iv<BTh.nbv;iv++) BTh[iv].m = Mhmax; … … 111 111 //use present fields to generate metric if present 112 112 if (bamgopts->field){ 113 if (verbosity>1) printf(" Merge metric with field provided...\n");113 if (verbosity>1) _printLine_(" Merge metric with field provided..."); 114 114 BTh.AddMetric(bamgopts); 115 115 } … … 117 117 // change using hVertices if provided 118 118 if(bamgopts->hVertices && bamgopts->hVerticesSize[0]==BTh.nbv){ 119 if (verbosity>1) printf(" Merging Metric with hVertices...\n");119 if (verbosity>1) _printLine_(" Merging Metric with hVertices..."); 120 120 for (i=0;i<BTh.nbv;i++){ 121 if (! isnan(bamgopts->hVertices[i])){121 if (!xIsNan<IssmDouble>(bamgopts->hVertices[i])){ 122 122 BTh[i].m=Metric((float)bamgopts->hVertices[i]); 123 123 } … … 127 127 // change using hminVertices if provided 128 128 if (bamgopts->hminVertices){ 129 if (verbosity>1) printf(" Merging Metric with hminVertices...\n");129 if (verbosity>1) _printLine_(" Merging Metric with hminVertices..."); 130 130 for (i=0;i<BTh.nbv;i++){ 131 if (! isnan(bamgopts->hminVertices[i])){131 if (!xIsNan<IssmDouble>(bamgopts->hminVertices[i])){ 132 132 Metric M=BTh.vertices[i].m; 133 133 EigenMetric Vp(M/coef); … … 140 140 // change using hmaxVertices if provided 141 141 if (bamgopts->hmaxVertices){ 142 if (verbosity>1) printf(" Merging Metric with hmaxVertices...\n");142 if (verbosity>1) _printLine_(" Merging Metric with hmaxVertices..."); 143 143 for (i=0;i<BTh.nbv;i++){ 144 if (! isnan(bamgopts->hmaxVertices[i])){144 if (!xIsNan<IssmDouble>(bamgopts->hmaxVertices[i])){ 145 145 Metric M=BTh.vertices[i].m; 146 146 EigenMetric Vp(M/coef); … … 164 164 165 165 //Build new mesh 166 if (verbosity>1) printf(" Generating Mesh...\n");166 if (verbosity>1) _printLine_(" Generating Mesh..."); 167 167 Thr=&BTh,Thb=0; 168 168 Mesh & Th( *(0 ? new Mesh(*Thr,&Thr->Gh,Thb,maxnbv) : new Mesh(maxnbv,BTh,bamgopts,bamgopts->KeepVertices))); … … 185 185 if(verbosity>0) { 186 186 if (Th.nbt-Th.nbtout-Th.nbq*2){ 187 printf(" new number of triangles = %i\n",(Th.nbt-Th.nbtout-Th.nbq*2));187 _printLine_(" new number of triangles = " << (Th.nbt-Th.nbtout-Th.nbq*2)); 188 188 } 189 189 if (Th.nbq ){ 190 printf(" new number of quads = %i\n",Th.nbq);190 _printLine_(" new number of quads = " << Th.nbq); 191 191 } 192 192 } 193 193 194 194 //Build output 195 if (verbosity>1) printf(" Write Mesh...\n");195 if (verbosity>1) _printLine_(" Write Mesh..."); 196 196 Th.WriteMesh(bamgmesh_out,bamgopts); 197 if (verbosity>1) printf(" Write Geometry...\n");197 if (verbosity>1) _printLine_(" Write Geometry..."); 198 198 Th.Gh.WriteGeometry(bamggeom_out,bamgopts); 199 if (verbosity>1) printf(" Write Metric...\n");199 if (verbosity>1) _printLine_(" Write Metric..."); 200 200 BTh.WriteMetric(bamgopts); 201 201 … … 207 207 208 208 /*No error return*/ 209 if (verbosity>1) printf(" Exiting Bamg.\n");209 if (verbosity>1) _printLine_(" Exiting Bamg."); 210 210 return noerr; 211 211 -
issm/trunk/src/c/modules/Chacox/Chacox.cpp
r11527 r12706 66 66 67 67 if (DEBUG_TRACE > 0) { 68 printf("<Entering main>\n");68 _printLine_("<Entering main>"); 69 69 } 70 70 71 71 if (PRINT_HEADERS) { 72 printf("\n Chaco 2.0\n");73 printf(" Sandia National Laboratories\n\n");72 _printLine_("\n Chaco 2.0"); 73 _printLine_(" Sandia National Laboratories\n"); 74 74 } 75 75 … … 177 177 178 178 if (DEBUG_MEMORY > 0) { 179 printf("\n");179 _printLine_(""); 180 180 smalloc_stats(); 181 181 } … … 185 185 186 186 if (DEBUG_TRACE > 1) { 187 printf("<Leaving main>\n");187 _printLine_("<Leaving main>"); 188 188 } 189 189 -
issm/trunk/src/c/modules/Chacox/input_parse.cpp
r11527 r12706 38 38 39 39 if (DEBUG_TRACE > 0) { 40 printf("<Entering input_parse>\n");40 _printLine_("<Entering input_parse>"); 41 41 } 42 42 43 43 if (PROMPT) { 44 printf("Parallel machine architecture:\n");45 printf(" (0) Hypercube\n");46 printf(" (1) One-dimensional mesh\n");47 printf(" (2) Two-dimensional mesh\n");48 printf(" (3) Three-dimensional mesh\n");44 _printLine_("Parallel machine architecture:"); 45 _printLine_(" (0) Hypercube"); 46 _printLine_(" (1) One-dimensional mesh"); 47 _printLine_(" (2) Two-dimensional mesh"); 48 _printLine_(" (3) Three-dimensional mesh"); 49 49 } 50 50 *architecture = (int)options[OPT_ARCH]; … … 57 57 /* Name output assignment file. */ 58 58 if (PROMPT) 59 printf("Assignment output file: ");59 _printString_("Assignment output file: "); 60 60 outassignname = NULL; 61 61 62 62 /* Name output results file. */ 63 63 if (PROMPT) 64 printf("File name for saving run results: ");64 _printString_("File name for saving run results: "); 65 65 outfilename = NULL; 66 66 … … 75 75 else { 76 76 if (PROMPT) { 77 printf("Global partitioning method:\n");78 printf(" (1) Multilevel-KL\n");79 printf(" (2) Spectral\n");80 printf(" (3) Inertial\n");81 printf(" (4) Linear\n");82 printf(" (5) Random\n");83 printf(" (6) Scattered\n");84 printf(" (7) Read-from-file\n");77 _printLine_("Global partitioning method:"); 78 _printLine_(" (1) Multilevel-KL"); 79 _printLine_(" (2) Spectral"); 80 _printLine_(" (3) Inertial"); 81 _printLine_(" (4) Linear"); 82 _printLine_(" (5) Random"); 83 _printLine_(" (6) Scattered"); 84 _printLine_(" (7) Read-from-file"); 85 85 } 86 86 *global_method = (int)options[OPT_GLOBAL]; … … 94 94 if (*global_method == 7) { /* Name and open input assignment file. */ 95 95 if (PROMPT) 96 printf("Assignment input file: ");96 _printString_("Assignment input file: "); 97 97 } 98 98 99 99 else if (*global_method == 3) { 100 100 if (PROMPT) 101 printf("Geometry input file name: ");101 _printString_("Geometry input file name: "); 102 102 } 103 103 104 104 else if (*global_method == 2) { 105 105 if (PROMPT) { 106 printf("Eigensolver:\n");107 printf(" (1) Multilevel RQI/Symmlq\n");108 printf(" (2) Lanczos\n");106 _printLine_("Eigensolver:"); 107 _printLine_(" (1) Multilevel RQI/Symmlq"); 108 _printLine_(" (2) Lanczos"); 109 109 } 110 110 eigensolver = (int)options[OPT_RQI]; … … 117 117 if (MATCH_TYPE == 5) { /* geometric matching */ 118 118 if (PROMPT) 119 printf("Geometry input file name: ");119 _printString_("Geometry input file name: "); 120 120 } 121 121 *rqi_flag = 1; 122 122 if (PROMPT) 123 printf("Number of vertices to coarsen down to: ");123 _printString_("Number of vertices to coarsen down to: "); 124 124 *vmax = (int)options[OPT_VMAX]; 125 125 if (*vmax <= 0) { … … 137 137 if (MATCH_TYPE == 5) { /* geometric matching */ 138 138 if (PROMPT) 139 printf("Geometry input file name: ");140 } 141 if (PROMPT) 142 printf("Number of vertices to coarsen down to: ");139 _printString_("Geometry input file name: "); 140 } 141 if (PROMPT) 142 _printString_("Number of vertices to coarsen down to: "); 143 143 *vmax = (int)options[OPT_VMAX]; 144 144 if (*vmax <= 0) { … … 168 168 else { 169 169 if (PROMPT) { 170 printf("Local refinement method:\n");171 printf(" (1) Kernighan-Lin\n");172 printf(" (2) None\n");170 _printLine_("Local refinement method:"); 171 _printLine_(" (1) Kernighan-Lin"); 172 _printLine_(" (2) None"); 173 173 } 174 174 *local_method = (int)options[OPT_LOCAL]; … … 185 185 *ndims_tot = 0; 186 186 if (PROMPT) 187 printf("Total number of target hypercube dimensions: ");187 _printString_("Total number of target hypercube dimensions: "); 188 188 *ndims_tot = nparts[0]; 189 189 if (*ndims_tot < 1) { 190 printf(" Number of divisions must be at least 1\n");190 _printLine_(" Number of divisions must be at least 1"); 191 191 printf("%s -- Number of divisions %d must be at least 1.\n", 192 192 __FUNCT__,nparts[0]); … … 200 200 if (*architecture == 2) { 201 201 if (PROMPT) 202 printf("X and Y extent of of 2-D mesh: ");202 _printString_("X and Y extent of of 2-D mesh: "); 203 203 mesh_dims[0] = nparts[0]; 204 204 mesh_dims[1] = nparts[1]; … … 206 206 else if (*architecture == 3) { 207 207 if (PROMPT) 208 printf("X, Y and Z extent of 3-D mesh: ");208 _printString_("X, Y and Z extent of 3-D mesh: "); 209 209 mesh_dims[0] = nparts[0]; 210 210 mesh_dims[1] = nparts[1]; … … 213 213 else { /* Anything else => 1-D mesh */ 214 214 if (PROMPT) 215 printf("Size of 1-D mesh: ");215 _printString_("Size of 1-D mesh: "); 216 216 mesh_dims[0] = nparts[0]; 217 217 *architecture = 1; … … 227 227 else if (*nprocs <= 7) { 228 228 if (PROMPT) { 229 printf("Partitioning dimension: \n");230 printf(" (1) Bisection\n");231 printf(" (2) Quadrisection\n");229 _printLine_("Partitioning dimension: "); 230 _printLine_(" (1) Bisection"); 231 _printLine_(" (2) Quadrisection"); 232 232 } 233 233 *ndims = (int)options[OPT_NDIMS]; … … 240 240 else { 241 241 if (PROMPT) { 242 printf("Partitioning dimension: \n");243 printf(" (1) Bisection\n");244 printf(" (2) Quadrisection\n");245 printf(" (3) Octasection\n");242 _printLine_("Partitioning dimension: "); 243 _printLine_(" (1) Bisection"); 244 _printLine_(" (2) Quadrisection"); 245 _printLine_(" (3) Octasection"); 246 246 } 247 247 *ndims = (int)options[OPT_NDIMS]; -
issm/trunk/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp
r11995 r12706 15 15 int i; 16 16 int found=0; 17 double numberofelements;17 IssmDouble numberofelements; 18 18 Element* element=NULL; 19 19 … … 25 25 26 26 /*Allocate sigma on numberofelements: */ 27 sigma=new Vector( (int)numberofelements);27 sigma=new Vector(reCast<int>(numberofelements)); 28 28 29 29 /*Compute basal stress for each element: */ -
issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
r9761 r12706 25 25 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 26 26 27 _printf_(VerboseMProcessor()," Configuring elements...\n");27 if(VerboseMProcessor()) _pprintLine_(" Configuring elements..."); 28 28 for (i=0;i<elements->Size();i++){ 29 29 element=(Element*)elements->GetObjectByOffset(i); 30 30 element->Configure(elements,loads,nodes,materials,parameters); 31 31 } 32 _printf_(VerboseMProcessor()," Configuring loads...\n");32 if(VerboseMProcessor()) _pprintLine_(" Configuring loads..."); 33 33 for (i=0;i<loads->Size();i++){ 34 34 load=(Load*)loads->GetObjectByOffset(i); … … 37 37 } 38 38 } 39 _printf_(VerboseMProcessor()," Configuring nodes...\n");39 if(VerboseMProcessor()) _pprintLine_(" Configuring nodes..."); 40 40 for (i=0;i<nodes->Size();i++){ 41 41 node=(Node*)nodes->GetObjectByOffset(i); … … 45 45 } 46 46 47 _printf_(VerboseMProcessor()," Configuring materials...\n");47 if(VerboseMProcessor()) _pprintLine_(" Configuring materials..."); 48 48 for (i=0;i<materials->Size();i++){ 49 49 material=(Material*)materials->GetObjectByOffset(i); -
issm/trunk/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp
r9761 r12706 25 25 26 26 /*Display message*/ 27 _printf_(VerboseModule()," Constraining penalties\n");27 if(VerboseModule()) _pprintLine_(" Constraining penalties"); 28 28 29 29 /*recover parameters: */ -
issm/trunk/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp
r12330 r12706 12 12 13 13 /*current module: */ 14 /*RiftIsPresent(Loads* loads,int configuration_type){{{ 1*/14 /*RiftIsPresent(Loads* loads,int configuration_type){{{*/ 15 15 int RiftIsPresent(Loads* loads,int configuration_type){ 16 16 … … 41 41 } 42 42 /*}}}*/ 43 /*RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){{{ 1*/43 /*RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){{{*/ 44 44 void RiftConstraintsState(int* pconverged, int* pnum_unstable_constraints,Loads* loads,int min_mechanical_constraints,int configuration_type){ 45 45 … … 56 56 } 57 57 else if(num_unstable_constraints<=min_mechanical_constraints){ 58 _printf_(VerboseModule()," freezing constraints\n");58 if(VerboseModule()) _pprintLine_(" freezing constraints"); 59 59 RiftFreezeConstraints(loads,configuration_type); 60 60 } … … 65 65 } 66 66 /*}}}*/ 67 /*RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){{{ 1*/67 /*RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){{{*/ 68 68 void RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){ 69 69 … … 106 106 } 107 107 /*}}}*/ 108 /*RiftIsFrozen(Loads* loads,int configuration_type){{{ 1*/108 /*RiftIsFrozen(Loads* loads,int configuration_type){{{*/ 109 109 int RiftIsFrozen(Loads* loads,int configuration_type){ 110 110 … … 144 144 } 145 145 /*}}}*/ 146 /*RiftFreezeConstraints(Loads* loads,int configuration_type){{{ 1*/146 /*RiftFreezeConstraints(Loads* loads,int configuration_type){{{*/ 147 147 void RiftFreezeConstraints(Loads* loads,int configuration_type){ 148 148 … … 172 172 173 173 /*diverse trials and errors: */ 174 /*RiftIsMaterialStable(Loads* loads){{{ 1*/174 /*RiftIsMaterialStable(Loads* loads){{{*/ 175 175 int RiftIsMaterialStable(Loads* loads){ 176 176 … … 204 204 } 205 205 /*}}}*/ 206 /*RiftIsPreStable(Loads* loads){{{ 1*/206 /*RiftIsPreStable(Loads* loads){{{*/ 207 207 int RiftIsPreStable(Loads* loads){ 208 208 … … 243 243 } 244 244 /*}}}*/ 245 /*RiftSetPreStable(Loads* loads){{{ 1*/245 /*RiftSetPreStable(Loads* loads){{{*/ 246 246 void RiftSetPreStable(Loads* loads){ 247 247 … … 264 264 } 265 265 /*}}}*/ 266 /*RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){{{ 1*/266 /*RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){{{*/ 267 267 void RiftPreConstrain(int* pnum_unstable_constraints,Loads* loads){ 268 268 … … 300 300 } 301 301 /*}}}*/ 302 /*RiftMaxPenetrationInInputs(Loads* loads){{{ 1*/302 /*RiftMaxPenetrationInInputs(Loads* loads){{{*/ 303 303 void RiftMaxPenetrationInInputs(Loads* loads){ 304 304 … … 309 309 310 310 /*rift penetration: */ 311 double max_penetration=0;312 double mpi_max_penetration;313 double penetration;311 IssmDouble max_penetration=0; 312 IssmDouble mpi_max_penetration; 313 IssmDouble penetration; 314 314 315 315 /*Ok, we are going to find the node pairs which are not penetrating, even though they … … 342 342 } 343 343 /*}}}*/ 344 /*RiftPotentialUnstableConstraints(Loads* loads){{{ 1*/344 /*RiftPotentialUnstableConstraints(Loads* loads){{{*/ 345 345 int RiftPotentialUnstableConstraints(Loads* loads){ 346 346 -
issm/trunk/src/c/modules/ContourToMeshx/ContourToMeshx.cpp
r12330 r12706 70 70 71 71 /*Free ressources:*/ 72 x free((void**)&in_nod_serial);72 xDelete<double>(in_nod_serial); 73 73 74 74 return noerr; -
issm/trunk/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp
r11995 r12706 33 33 34 34 /*Clean up and return*/ 35 x free((void**)&control_type);35 xDelete<int>(control_type); 36 36 *pgradient=gradient; 37 37 } -
issm/trunk/src/c/modules/ControlInputScaleGradientx/ControlInputScaleGradientx.cpp
r11527 r12706 37 37 38 38 /*Clean up and return*/ 39 x free((void**)&control_type);40 x free((void**)&scalar_list);39 xDelete<int>(control_type); 40 xDelete<double>(scalar_list); 41 41 } -
issm/trunk/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp
r11995 r12706 27 27 28 28 /*Clean up and return*/ 29 x free((void**)&control_type);29 xDelete<int>(control_type); 30 30 31 31 } … … 39 39 40 40 /*Clean up and return*/ 41 x free((void**)&serial_gradient);41 xDelete<double>(serial_gradient); 42 42 } -
issm/trunk/src/c/modules/CostFunctionx/CostFunctionx.cpp
r11995 r12706 35 35 36 36 /*Assign output pointers: */ 37 x free((void**)&responses);37 xDelete<int>(responses); 38 38 *pJ=J; 39 39 } -
issm/trunk/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp
r11995 r12706 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, double kmax){12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax){ 13 13 14 14 int i,connectivity; -
issm/trunk/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h
r11995 r12706 10 10 11 11 /* local prototypes: */ 12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, double kmax);12 void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax); 13 13 14 14 #endif /* _CREATEJACOBIANMATRIXX_H */ -
issm/trunk/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp
r9650 r12706 30 30 double femmodel_response; 31 31 int flag; 32 double* vertex_response=NULL; 33 double* qmu_response=NULL; 34 35 double* responses_pointer=NULL; 32 double *vertex_response = NULL; 33 double *qmu_response = NULL; 34 double *responses_pointer = NULL; 36 35 37 36 /*retrieve npart: */ … … 66 65 67 66 /*Free ressources:*/ 68 x free((void**)&vertex_response);69 x free((void**)&qmu_response);67 xDelete<double>(vertex_response); 68 xDelete<double>(qmu_response); 70 69 71 70 } … … 87 86 } 88 87 else if (flag==NodalEnum){ 89 _error _("nodal response functions not supported yet!");88 _error2_("nodal response functions not supported yet!"); 90 89 91 90 /*increment response_pointer :*/ … … 105 104 } 106 105 } 107 else _error _("%s%i%s"," flag type ",flag," not supported yet for response analysis");106 else _error2_("flag type " << flag << " not supported yet for response analysis"); 108 107 } 109 108 … … 111 110 /*Synthesize echo: {{{*/ 112 111 if(my_rank==0){ 113 printf(" responses: %i: ",d_numresponses);114 for(i=0;i<d_numresponses-1;i++) printf("%g|",d_responses[i]);115 printf("%g",d_responses[d_numresponses-1]);116 printf("\n");112 _printString_(" responses: " << d_numresponses << ": "); 113 for(i=0;i<d_numresponses-1;i++)_printString_(d_responses[i] << "|"); 114 _printString_(d_responses[d_numresponses-1]); 115 _printLine_(""); 117 116 } 118 117 /*}}}*/ -
issm/trunk/src/c/modules/Dakotax/DakotaFree.cpp
r9761 r12706 22 22 extern int my_rank; 23 23 24 double * variables=NULL;25 char ** variables_descriptors=NULL;26 char ** responses_descriptors=NULL;27 char * string=NULL;24 double *variables = NULL; 25 char **variables_descriptors = NULL; 26 char **responses_descriptors = NULL; 27 char *string = NULL; 28 28 29 29 /*recover pointers: */ … … 35 35 /*Free variables and variables_descriptors only on cpu !=0*/ 36 36 if(my_rank!=0){ 37 x free((void**)&variables);37 xDelete<double>(variables); 38 38 for(i=0;i<numvariables;i++){ 39 39 string=variables_descriptors[i]; 40 x free((void**)&string);40 xDelete<char>(string); 41 41 } 42 x free((void**)&variables_descriptors);42 xDelete<char*>(variables_descriptors); 43 43 } 44 44 … … 46 46 for(i=0;i<numresponses;i++){ 47 47 string=responses_descriptors[i]; 48 x free((void**)&string);48 xDelete<char>(string); 49 49 } 50 50 //rest of dynamic allocations. 51 x free((void**)&responses_descriptors);51 xDelete<char*>(responses_descriptors); 52 52 53 53 /*Assign output pointers:*/ … … 56 56 *presponses_descriptors=responses_descriptors; 57 57 } 58 -
issm/trunk/src/c/modules/Dakotax/DakotaMPI_Bcast.cpp
r9761 r12706 38 38 39 39 /*variables:*/ 40 if(my_rank!=0)variables= (double*)xmalloc(numvariables*sizeof(double));40 if(my_rank!=0)variables=xNew<double>(numvariables); 41 41 MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,MPI_COMM_WORLD); 42 42 43 43 /*variables_descriptors: */ 44 44 if(my_rank!=0){ 45 variables_descriptors= (char**)xmalloc(numvariables*sizeof(char*));45 variables_descriptors=xNew<char*>(numvariables); 46 46 } 47 47 for(i=0;i<numvariables;i++){ … … 51 51 } 52 52 MPI_Bcast(&string_length,1,MPI_INT,0,MPI_COMM_WORLD); 53 if(my_rank!=0)string= (char*)xmalloc(string_length);53 if(my_rank!=0)string=xNew<char>(string_length); 54 54 MPI_Bcast(string,string_length,MPI_CHAR,0,MPI_COMM_WORLD); 55 55 if(my_rank!=0)variables_descriptors[i]=string; -
issm/trunk/src/c/modules/Dakotax/Dakotax.cpp
r12330 r12706 121 121 122 122 /*Free ressources:*/ 123 x free((void**)&dakota_input_file);124 x free((void**)&dakota_error_file);125 x free((void**)&dakota_output_file);123 xDelete<char>(dakota_input_file); 124 xDelete<char>(dakota_error_file); 125 xDelete<char>(dakota_output_file); 126 126 127 127 #endif //#ifdef _HAVE_DAKOTA_ -
issm/trunk/src/c/modules/Dakotax/DescriptorIndex.cpp
r9761 r12706 23 23 /*retrieve first token, separated by underscore: */ 24 24 pch = strtok (descriptor,"_"); 25 if(!pch)_error _("%s%s%s"," descriptor ",descriptor," is not correctly formatted!");25 if(!pch)_error2_("descriptor " << descriptor << " is not correctly formatted!"); 26 26 27 27 if (strncmp(pch,"scaled",6)==0){ 28 28 /*we have a scaled variable. recover the root: */ 29 29 pch = strtok (NULL, "_"); 30 if(!pch)_error _("%s%s%s"," scaled descriptor ",descriptor," is not correctly formatted!");30 if(!pch)_error2_("scaled descriptor " << descriptor << " is not correctly formatted!"); 31 31 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 32 32 … … 44 44 /*we have an indexed variable. recover the root: */ 45 45 pch = strtok (NULL, "_"); 46 if(!pch)_error _("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");46 if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!"); 47 47 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 48 48 /*now recover the index: */ 49 49 pch = strtok (NULL, "_"); 50 if(!pch)_error _("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");50 if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!"); 51 51 sscanf(pch,"%i",pindex); 52 52 return IndexedEnum; … … 55 55 /*we have an indexed variable. recover the root: */ 56 56 pch = strtok (NULL, "_"); 57 if(!pch)_error _("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");57 if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!"); 58 58 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 59 59 /*now recover the index: */ 60 60 pch = strtok (NULL, "_"); 61 if(!pch)_error _("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");61 if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!"); 62 62 sscanf(pch,"%i",pindex); 63 63 return NodalEnum; -
issm/trunk/src/c/modules/Dakotax/SpawnCoreParallel.cpp
r9775 r12706 53 53 /*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */ 54 54 MPI_Barrier(MPI_COMM_WORLD); 55 _printf_(VerboseQmu(),"qmu iteration: %i\n",counter);55 if(VerboseQmu()) _pprintLine_("qmu iteration: " << counter); 56 56 57 57 /*retrieve parameters: */ … … 67 67 68 68 /*Determine solution sequence: */ 69 _printf_(VerboseQmu(),"%s%s%s\n","Starting ",EnumToStringx(solution_type)," core:");69 if(VerboseQmu()) _pprintLine_("Starting " << EnumToStringx(solution_type) << " core:"); 70 70 CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type); 71 71 #ifdef _HAVE_CONTROL_ 72 72 if(control_analysis)solutioncore=&control_core; 73 73 #else 74 _error _("ISSM was not compiled with control capabilities, exiting!");74 _error2_("ISSM was not compiled with control capabilities, exiting!"); 75 75 #endif 76 76 … … 79 79 80 80 /*compute responses: */ 81 _printf_(VerboseQmu(),"compute dakota responses:\n");81 if(VerboseQmu()) _pprintLine_("compute dakota responses:"); 82 82 DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponsedescriptors,d_numresponses); 83 83 -
issm/trunk/src/c/modules/ElementConnectivityx/ElementConnectivityx.cpp
r3913 r12706 36 36 maxels=width-1; 37 37 /*Allocate connectivity: */ 38 elementconnectivity= (double*)xcalloc(nel*3,sizeof(double));38 elementconnectivity=xNewZeroInit<double>(nel*3); 39 39 40 40 /*Go through all elements, and for each element, go through its nodes, to get the neighbouring elements. -
issm/trunk/src/c/modules/ElementResponsex/ElementResponsex.cpp
r12330 r12706 39 39 #ifdef _HAVE_MPI_ 40 40 MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD); 41 if(!sumfound)_error _("%s%i%s","could not find material with id",index," to compute ElementResponse");41 if(!sumfound)_error2_("could not find material with id" << index << " to compute ElementResponse"); 42 42 #endif 43 43 -
issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
r12347 r12706 154 154 case SettingsResultsAsPatchesEnum : return "SettingsResultsAsPatches"; 155 155 case SettingsWaitonlockEnum : return "SettingsWaitonlock"; 156 case DebugP etscProfilingEnum : return "DebugPetscProfiling";157 case P etscProfilingCurrentMemEnum : return "PetscProfilingCurrentMem";158 case P etscProfilingCurrentFlopsEnum : return "PetscProfilingCurrentFlops";159 case P etscProfilingSolutionTimeEnum : return "PetscProfilingSolutionTime";156 case DebugProfilingEnum : return "DebugProfiling"; 157 case ProfilingCurrentMemEnum : return "ProfilingCurrentMem"; 158 case ProfilingCurrentFlopsEnum : return "ProfilingCurrentFlops"; 159 case ProfilingSolutionTimeEnum : return "ProfilingSolutionTime"; 160 160 case MaxIterationConvergenceFlagEnum : return "MaxIterationConvergenceFlag"; 161 161 case SteadystateMaxiterEnum : return "SteadystateMaxiter"; … … 167 167 case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance"; 168 168 case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd"; 169 case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients"; 169 170 case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures"; 171 case SurfaceforcingsHcEnum : return "SurfaceforcingsHc"; 172 case SurfaceforcingsSmbPosMaxEnum : return "SurfaceforcingsSmbPosMax"; 173 case SurfaceforcingsSmbPosMinEnum : return "SurfaceforcingsSmbPosMin"; 174 case SurfaceforcingsAPosEnum : return "SurfaceforcingsAPos"; 175 case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos"; 176 case SurfaceforcingsANegEnum : return "SurfaceforcingsANeg"; 177 case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg"; 170 178 case ThermalMaxiterEnum : return "ThermalMaxiter"; 171 179 case ThermalPenaltyFactorEnum : return "ThermalPenaltyFactor"; … … 466 474 467 475 len=strlen(EnumToStringx(enum_in)); 468 string= (char*)xmalloc((len+1)*sizeof(char));476 string=xNew<char>(len+1); 469 477 memcpy(string,EnumToStringx(enum_in),(len+1)*sizeof(char)); 470 478 -
issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp
r12330 r12706 11 11 #include "../modules.h" 12 12 13 int Exp2Kmlx(char* filexp,char* filkml, 14 int sgn, 15 bool holes){ 13 int Exp2Kmlx(char* filexp,char* filkml,int sgn,bool holes){ 16 14 17 15 double cm,sp; 18 16 19 17 Xy2lldef(&cm,&sp,sgn); 20 21 return(Exp2Kmlx(filexp,filkml, 22 sgn,cm,sp, 23 holes)); 18 return(Exp2Kmlx(filexp,filkml,sgn,cm,sp,holes)); 24 19 } 25 20 26 int Exp2Kmlx(char* filexp,char* filkml, 27 int sgn,double cm,double sp, 28 bool holes){ 29 30 int i,j,iret=0; 31 int lwidth=1; 32 double popac=0.50; 33 int nprof; 34 int *pnvert=NULL; 35 double **pprofx=NULL,**pprofy=NULL; 36 bool *closed=NULL; 37 double *lat=NULL,*lon=NULL; 21 int Exp2Kmlx(char* filexp,char* filkml,int sgn,double cm,double sp,bool holes){ 22 23 int i ,j,iret=0; 24 int lwidth = 1; 25 double popac = 0.50; 26 int nprof; 27 int *pnvert = NULL; 28 double **pprofx = NULL,**pprofy=NULL; 29 bool *closed = NULL; 30 double *lat = NULL, *lon=NULL; 38 31 39 32 char indent[81]=""; … … 57 50 clock0=clock(); 58 51 time0 =time(NULL); 59 _p rintf_(true,"\nExp2Kmlx Module -- %s",ctime(&time0));60 61 /*read exp file */52 _pprintString_("\nExp2Kmlx Module -- " << ctime(&time0)); 53 54 /*read exp file */ 62 55 63 56 if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp)) 64 _error _("Error reading exp file.");65 _p rintf_(true,"Exp2Kmlx -- Reading %d exp profiles from file \"%s\".\n",nprof,filexp);57 _error2_("Error reading exp file."); 58 _pprintLine_("Exp2Kmlx -- Reading " << nprof << " exp profiles from file \"" << filexp << "\"."); 66 59 // for (i=0; i<nprof; i++) 67 // printf("i=%d; nvert=%d, closed=%d\n",i,pnvert[i],closed[i]);60 // _printLine_("i=" << i << "; nvert=" << pnvert[i] << ", closed=" << closed[i]); 68 61 69 62 /* construct kml file */ … … 128 121 129 122 if (holes && nprof && (pnvert[0] <= 1 || pprofx[0][pnvert[0]-1] != pprofx[0][0] || pprofy[0][pnvert[0]-1] != pprofy[0][0])) { 130 _p rintf_(true,"Warning -- Outer profile is not closed, so \"holes\" option will be ignored.\n");123 _pprintLine_("Warning -- Outer profile is not closed, so \"holes\" option will be ignored."); 131 124 holes=false; 132 125 } … … 143 136 144 137 kring->ncoord =pnvert[i]-1; 145 lat= (double *) xmalloc(kring->ncoord*sizeof(double));146 lon= (double *) xmalloc(kring->ncoord*sizeof(double));138 lat=xNew<double>(kring->ncoord); 139 lon=xNew<double>(kring->ncoord); 147 140 Xy2llx(lat,lon,pprofx[i],pprofy[i],kring->ncoord,sgn,cm,sp); 148 kring->coords =(double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));141 kring->coords=xNew<double>(kring->ncoord*3); 149 142 for (j=0; j<kring->ncoord; j++) { 150 kring->coords[ j][0]=lon[j];151 kring->coords[ j][1]=lat[j];152 kring->coords[ j][2]=0.;143 kring->coords[3*j+0]=lon[j]; 144 kring->coords[3*j+1]=lat[j]; 145 kring->coords[3*j+2]=0.; 153 146 } 154 x free((void**)&lon);155 x free((void**)&lat);147 xDelete<double>(lon); 148 xDelete<double>(lat); 156 149 157 150 (kpoly ->outer )->AddObject((Object*)kring); … … 160 153 for (i=1; i<nprof; i++) { 161 154 if (pnvert[i] <= 1 || pprofx[i][pnvert[i]-1] != pprofx[i][0] || pprofy[i][pnvert[i]-1] != pprofy[i][0]) { 162 _p rintf_(true,"Warning -- Inner profile %d is not closed with \"holes\" specified, so it will be ignored.\n",i+1);155 _pprintLine_("Warning -- Inner profile " << i+1 << " is not closed with \"holes\" specified, so it will be ignored."); 163 156 continue; 164 157 } … … 167 160 168 161 kring->ncoord =pnvert[i]-1; 169 lat= (double *) xmalloc(kring->ncoord*sizeof(double));170 lon= (double *) xmalloc(kring->ncoord*sizeof(double));162 lat=xNew<double>(kring->ncoord); 163 lon=xNew<double>(kring->ncoord); 171 164 Xy2llx(lat,lon,pprofx[i],pprofy[i],kring->ncoord,sgn,cm,sp); 172 kring->coords = (double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));165 kring->coords =xNew<double>(kring->ncoord*3); 173 166 for (j=0; j<kring->ncoord; j++) { 174 kring->coords[ j][0]=lon[j];175 kring->coords[ j][1]=lat[j];176 kring->coords[ j][2]=0.;177 } 178 x free((void**)&lon);179 x free((void**)&lat);167 kring->coords[3*j+0]=lon[j]; 168 kring->coords[3*j+1]=lat[j]; 169 kring->coords[3*j+2]=0.; 170 } 171 xDelete<double>(lon); 172 xDelete<double>(lat); 180 173 181 174 (kpoly ->inner )->AddObject((Object*)kring); … … 204 197 205 198 kring->ncoord =pnvert[i]-1; 206 lat= (double *) xmalloc(kring->ncoord*sizeof(double));207 lon= (double *) xmalloc(kring->ncoord*sizeof(double));199 lat=xNew<double>(kring->ncoord); 200 lon=xNew<double>(kring->ncoord); 208 201 Xy2llx(lat,lon,pprofx[i],pprofy[i],kring->ncoord,sgn,cm,sp); 209 kring->coords = (double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));202 kring->coords =xNew<double>(kring->ncoord*3); 210 203 for (j=0; j<kring->ncoord; j++) { 211 kring->coords[ j][0]=lon[j];212 kring->coords[ j][1]=lat[j];213 kring->coords[ j][2]=0.;204 kring->coords[3*j+0]=lon[j]; 205 kring->coords[3*j+1]=lat[j]; 206 kring->coords[3*j+2]=0.; 214 207 } 215 x free((void**)&lon);216 x free((void**)&lat);208 xDelete<double>(lon); 209 xDelete<double>(lat); 217 210 218 211 (kpoly ->outer )->AddObject((Object*)kring); … … 231 224 232 225 kline->ncoord =pnvert[i]; 233 lat= (double *) xmalloc(kline->ncoord*sizeof(double));234 lon= (double *) xmalloc(kline->ncoord*sizeof(double));226 lat=xNew<double>(kline->ncoord); 227 lon=xNew<double>(kline->ncoord); 235 228 Xy2llx(lat,lon,pprofx[i],pprofy[i],kline->ncoord,sgn,cm,sp); 236 kline->coords = (double (*)[3]) xmalloc(kline->ncoord*3*sizeof(double));229 kline->coords =xNew<double>(kline->ncoord*3); 237 230 for (j=0; j<kline->ncoord; j++) { 238 kline->coords[ j][0]=lon[j];239 kline->coords[ j][1]=lat[j];240 kline->coords[ j][2]=0.;231 kline->coords[3*j+0]=lon[j]; 232 kline->coords[3*j+1]=lat[j]; 233 kline->coords[3*j+2]=0.; 241 234 } 242 x free((void**)&lon);243 x free((void**)&lat);235 xDelete<double>(lon); 236 xDelete<double>(lat); 244 237 245 238 (kplace->geometry )->AddObject((Object*)kline); … … 251 244 kplace->visibility=true; 252 245 sprintf(kplace->styleurl ,"#RandomLineEmptyPoly"); 246 int one=1; 253 247 254 248 kpoint=new KML_Point(); 255 249 256 lat= (double *) xmalloc(sizeof(double));257 lon= (double *) xmalloc(sizeof(double));250 lat=xNew<double>(one); 251 lon=xNew<double>(one); 258 252 Xy2llx(lat,lon,pprofx[i],pprofy[i],1,sgn,cm,sp); 259 253 kpoint->coords[0]=lon[0]; 260 254 kpoint->coords[1]=lat[0]; 261 255 kpoint->coords[2]=0.; 262 x free((void**)&lon);263 x free((void**)&lat);256 xDelete<double>(lon); 257 xDelete<double>(lat); 264 258 265 259 (kplace->geometry )->AddObject((Object*)kpoint); … … 281 275 /* write kml file */ 282 276 283 _p rintf_(true,"Exp2Kmlx -- Writing kml document to file \"%s\".\n",filkml);277 _pprintLine_("Exp2Kmlx -- Writing kml document to file \"" << filkml << "\"."); 284 278 fid=fopen(filkml,"w"); 285 279 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); … … 289 283 delete kfile; 290 284 for (i=nprof-1; i>=0; i--) { 291 x free((void**)&(pprofy[i]));292 x free((void**)&(pprofx[i]));293 } 294 x free((void**)&pnvert);285 xDelete<double>(pprofy[i]); 286 xDelete<double>(pprofx[i]); 287 } 288 xDelete<int>(pnvert); 295 289 296 290 clock1=clock(); -
issm/trunk/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp
r11995 r12706 26 26 /*Get size of vector: */ 27 27 gsize=nodes->NumberOfDofs(configuration_type,GsetEnum); 28 if (gsize==0) _error _("Allocating a Vec of size 0 as gsize=0 for configuration: %s",EnumToStringx(configuration_type));28 if (gsize==0) _error2_("Allocating a Vec of size 0 as gsize=0 for configuration: " << EnumToStringx(configuration_type)); 29 29 30 30 /*Initialize solution: */ -
issm/trunk/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp
r11995 r12706 32 32 33 33 /*Assign output pointers:*/ 34 x free((void**)&control_type);34 xDelete<int>(control_type); 35 35 *pvector=vector; 36 36 } -
issm/trunk/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
r11995 r12706 32 32 } 33 33 else{ 34 _error _("%s%s%s"," vector type: ",EnumToStringx(type)," not supported yet!");34 _error2_("vector type: " << EnumToStringx(type) << " not supported yet!"); 35 35 } 36 36 … … 41 41 } 42 42 43 void GetVectorFromInputsx( double** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){43 void GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){ 44 44 45 45 /*output: */ 46 double* vector=NULL;46 IssmDouble* vector=NULL; 47 47 48 48 /*intermediary: */ -
issm/trunk/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h
r11995 r12706 10 10 /* local prototypes: */ 11 11 void GetVectorFromInputsx( Vector** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int name,int type); 12 void GetVectorFromInputsx( double** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int name,int type);12 void GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int name,int type); 13 13 14 14 #endif /* _GETVECTORFROMINPUTSXX_H */ -
issm/trunk/src/c/modules/Gradjx/Gradjx.cpp
r11995 r12706 14 14 int i,j,numberofvertices; 15 15 int num_controls; 16 double norm_inf;17 double *norm_list= NULL;18 int *control_type= NULL;19 Vector * gradient= NULL;20 Vector * *gradient_list= NULL;16 double norm_inf; 17 double *norm_list = NULL; 18 int *control_type = NULL; 19 Vector *gradient = NULL; 20 Vector **gradient_list = NULL; 21 21 22 22 /*retrieve some parameters: */ … … 26 26 27 27 /*Allocate gradient_list */ 28 gradient_list = (Vector**)xmalloc(num_controls*sizeof(Vector*));29 norm_list = (double*)xmalloc(num_controls*sizeof(double));28 gradient_list = xNew<Vector*>(num_controls); 29 norm_list = xNew<double>(num_controls); 30 30 for(i=0;i<num_controls;i++){ 31 31 gradient_list[i]=new Vector(num_controls*numberofvertices); … … 54 54 /*Check that gradient is clean*/ 55 55 norm_inf=gradient->Norm(NORM_INF); 56 if(norm_inf<=0) _error _("||∂J/∂α||∞ = 0 gradient norm is zero");57 if( isnan(norm_inf))_error_("||∂J/∂α||∞ = NaN gradient norm is NaN");56 if(norm_inf<=0) _error2_("||∂J/∂α||∞ = 0 gradient norm is zero"); 57 if(xIsNan<IssmDouble>(norm_inf))_error2_("||∂J/∂α||∞ = NaN gradient norm is NaN"); 58 58 59 59 /*Clean-up and assign output pointer*/ … … 62 62 } 63 63 else{ 64 x free((void**)&norm_list);64 xDelete<double>(norm_list); 65 65 } 66 66 if(pgradient) *pgradient=gradient; 67 x free((void**)&gradient_list);68 x free((void**)&control_type);67 xDelete<Vector*>(gradient_list); 68 xDelete<int>(control_type); 69 69 } -
issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r12330 r12706 20 20 Element* element = NULL; 21 21 22 _printf_(VerboseModule()," Migrating grounding line\n");22 if(VerboseModule()) _pprintLine_(" Migrating grounding line"); 23 23 24 24 /*retrieve parameters: */ … … 27 27 28 28 if(migration_style==NoneEnum) return; 29 if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error _("%s not supported yet!",EnumToStringx(migration_style));29 if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error2_(EnumToStringx(migration_style) << " not supported yet!"); 30 30 31 31 if(migration_style==SoftMigrationEnum){ … … 49 49 /*free ressouces: */ 50 50 xdelete(&vec_old_floatingice); 51 x free((void**)&vertices_potentially_ungrounding);52 x free((void**)&vertices_ungrounding);53 x free((void**)&old_floatingice);51 xDelete<double>(vertices_potentially_ungrounding); 52 xDelete<double>(vertices_ungrounding); 53 xDelete<double>(old_floatingice); 54 54 } 55 55 56 /*FUNCTION CreateNodesOnFloatingIce {{{ 1*/56 /*FUNCTION CreateNodesOnFloatingIce {{{*/ 57 57 Vector* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){ 58 58 … … 81 81 } 82 82 /*%}}}*/ 83 /*FUNCTION PotentialSheetUngrounding {{{ 1*/83 /*FUNCTION PotentialSheetUngrounding {{{*/ 84 84 double* PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){ 85 85 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{ 1*/110 /*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{*/ 111 111 double* PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding){ 112 112 … … 158 158 #ifdef _HAVE_MPI_ 159 159 MPI_Allreduce(&local_nflipped,&nflipped,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD); 160 _printf_(VerboseConvergence()," Additional number of vertices allowed to unground: %i\n",nflipped);160 if(VerboseConvergence()) _pprintLine_(" Additional number of vertices allowed to unground: " << nflipped); 161 161 #else 162 162 nflipped=local_nflipped; … … 164 164 165 165 /*Avoid leaks: */ 166 x free((void**)&elements_neighboring_floatingce);167 x free((void**)&nodes_on_floatingice);166 xDelete<double>(elements_neighboring_floatingce); 167 xDelete<double>(nodes_on_floatingice); 168 168 169 169 /*Assemble and serialize:*/ … … 174 174 /*Free ressources:*/ 175 175 xdelete(&vec_nodes_on_floatingice); 176 x free((void**)&elements_neighboring_floatingce);176 xDelete<double>(elements_neighboring_floatingce); 177 177 178 178 return nodes_on_floatingice; -
issm/trunk/src/c/modules/HoleFillerx/HoleFillerx.cpp
r9313 r12706 43 43 44 44 /*^^^^^^^^^^^^^ Remove pixels close to the holes ^^^^^^^^^^^^^*/ 45 image2 = (double*) xmalloc( lines*samps*sizeof(double));45 image2 = xNew<double>(lines*samps); 46 46 memcpy(image2,image,lines*samps*sizeof(double)); 47 47 … … 64 64 } 65 65 66 image3 = (double*) xmalloc( lines*samps*sizeof(double));66 image3 = xNew<double>(lines*samps); 67 67 memcpy(image3,image2,lines*samps*sizeof(double)); 68 68 … … 76 76 } 77 77 } 78 printf( "\n" );79 printf("Number of zeroes remaining: %10ld",lines*samps-counter);78 _printLine_( "" ); 79 _printString_("Number of zeroes remaining: " << lines*samps-counter); 80 80 fflush( stdout ); 81 81 #endif … … 95 95 } 96 96 // n u m b e r o f z e r o e s r e m a i n i n g : 1 2 3 4 5 6 7 8 9 10 97 printf( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );98 printf("Number of zeroes remaining: %10ld",lines*samps-counter);97 _printString_( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" ); 98 _printString_("Number of zeroes remaining: " << lines*samps-counter); 99 99 fflush( stdout ); 100 100 #endif … … 104 104 /***************** FIRST RUN *********************/ 105 105 /* 106 fprintf ( stdout, "First Application: " ); time(&t2); printf( ctime(&t2) );106 fprintf ( stdout, "First Application: " ); time(&t2); _printString_( ctime(&t2) ); 107 107 */ 108 108 for ( i = 0; i < lines; i++ ){ … … 277 277 278 278 #ifdef _DEBUG2_ 279 // printf("%g %g %g \n",temp,elev,range);279 //_printLine_(temp << " " << elev << " " << range << " "); 280 280 #endif 281 281 … … 304 304 /************************ SMOOTH THE RESULT ***********************/ 305 305 306 image4 = (double*) xmalloc( lines*samps*sizeof(double));306 image4 = xNew<double>(lines*samps); 307 307 memcpy(image4,image3,lines*samps*sizeof(double)); 308 308 … … 348 348 349 349 /*Allocate output image: */ 350 imageout= (double*)xmalloc(samps*lines*sizeof(double));350 imageout=xNew<double>(samps*lines); 351 351 memcpy(imageout,image3,lines*samps*sizeof(double)); 352 352 … … 354 354 355 355 #ifdef _DEBUG2_ 356 printf( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );357 printf("Number of zeroes remaining: 0\n\n");356 _printString_( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" ); 357 _printLine_("Number of zeroes remaining: 0\n"); 358 358 printf ( "\n"); 359 359 #endif … … 363 363 /*Assign output pointers: */ 364 364 *pimageout=imageout; 365 366 365 return 1; 367 368 366 } -
issm/trunk/src/c/modules/InputArtificialNoisex/InputArtificialNoisex.cpp
r5578 r12706 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int enum_name, double min,double max){11 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int enum_name,IssmDouble min,IssmDouble max){ 12 12 13 13 int i; -
issm/trunk/src/c/modules/InputArtificialNoisex/InputArtificialNoisex.h
r5578 r12706 10 10 11 11 /* local prototypes: */ 12 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int enum_name, double min,double max);12 void InputArtificialNoisex( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int enum_name,IssmDouble min,IssmDouble max); 13 13 14 14 #endif /* _UPDATEINPUTSFROMVECTORXX_H */ -
issm/trunk/src/c/modules/InputConvergencex/InputConvergencex.cpp
r12330 r12706 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, double* criterionvalues,int num_criterionenums){11 bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, IssmDouble* criterionvalues,int num_criterionenums){ 12 12 13 13 /*intermediary:*/ 14 int i;15 bool converged;16 int num_notconverged=0;17 int total_notconverged;18 double *eps= NULL;19 Element * element=NULL;14 int i; 15 bool converged; 16 int num_notconverged = 0; 17 int total_notconverged; 18 IssmDouble *eps = NULL; 19 Element *element = NULL; 20 20 21 21 /*allocate dynamic memory: */ 22 eps= (double*)xmalloc(num_criterionenums*sizeof(double));22 eps=xNew<IssmDouble>(num_criterionenums); 23 23 24 24 /*Go through elements, and ask them to do the job: */ … … 34 34 num_notconverged=total_notconverged; 35 35 #endif 36 _printf_(VerboseConvergence()," #elements above convergence criterion = %i\n",num_notconverged);36 if(VerboseConvergence()) _pprintLine_(" #elements above convergence criterion = " << num_notconverged); 37 37 38 38 /*Free ressources:*/ 39 x free((void**)&eps);39 xDelete<IssmDouble>(eps); 40 40 41 41 /*return: */ -
issm/trunk/src/c/modules/InputConvergencex/InputConvergencex.h
r4778 r12706 8 8 9 9 /* local prototypes: */ 10 bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, double* criterionvalues,int num_criterionenums);10 bool InputConvergencex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int* enums, int num_enums, int* criterionenums, IssmDouble* criterionvalues,int num_criterionenums); 11 11 12 12 #endif /* _INPUTCONVERGENCEX_H */ -
issm/trunk/src/c/modules/InputScalex/InputScalex.cpp
r4573 r12706 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, double scale_factor){11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, IssmDouble scale_factor){ 12 12 13 13 /*intermediary:*/ -
issm/trunk/src/c/modules/InputScalex/InputScalex.h
r4236 r12706 9 9 10 10 /* local prototypes: */ 11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, double scale_factor);11 void InputScalex(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type, IssmDouble scale_factor); 12 12 13 13 #endif /* _SCALEINPUTX_H */ -
issm/trunk/src/c/modules/InputToResultx/InputToResultx.cpp
r11995 r12706 13 13 /*intermediary:*/ 14 14 int step; 15 double time;15 IssmDouble time; 16 16 Element *element = NULL; 17 17 -
issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp
r4573 r12706 49 49 } 50 50 } 51 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double constant, int name){51 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble constant, int name){ 52 52 53 53 int i; -
issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h
r4236 r12706 12 12 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, bool constant, int name); 13 13 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, int constant, int name); 14 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, double constant, int name);14 void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, IssmDouble constant, int name); 15 15 16 16 #endif /* _UPDATEINPUTSFROMCONSTANTXX_H */ -
issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
r10571 r12706 21 21 double *qmu_part = NULL; 22 22 23 double * distributed_values=NULL;24 double * parameter=NULL;25 char * descriptor=NULL;23 double *distributed_values = NULL; 24 double *parameter = NULL; 25 char *descriptor = NULL; 26 26 char root[50]; //root name of variable, ex: DragCoefficent, RhoIce, etc ... 27 27 … … 49 49 50 50 51 distributed_values= (double*)xmalloc(npart*sizeof(double));51 distributed_values=xNew<double>(npart); 52 52 for(j=0;j<npart;j++){ 53 53 distributed_values[j]=variables[i+j]; … … 91 91 92 92 /*Free allocations: */ 93 x free((void**)¶meter);94 x free((void**)&distributed_values);93 xDelete<double>(parameter); 94 xDelete<double>(distributed_values); 95 95 } 96 96 else if (strncmp(descriptor,"indexed_",8)==0){ 97 _error _("indexed variables not supported yet!");97 _error2_("indexed variables not supported yet!"); 98 98 } 99 99 else if (strncmp(descriptor,"nodal_",8)==0){ 100 _error _("nodal variables not supported yet!");100 _error2_("nodal variables not supported yet!"); 101 101 } 102 102 else{ … … 107 107 108 108 /*Free ressources:*/ 109 xfree((void**)&qmu_part); 110 109 xDelete<double>(qmu_part); 111 110 } -
issm/trunk/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
r11995 r12706 11 11 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* solution){ 12 12 13 double* serial_solution=NULL;13 IssmDouble* serial_solution=NULL; 14 14 15 15 /*Serialize solution, so that elements can index into it on every CPU: */ … … 20 20 21 21 /*Free ressources:*/ 22 xfree((void**)&serial_solution); 23 22 xDelete<IssmDouble>(serial_solution); 24 23 } 25 24 26 25 27 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double* solution){26 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution){ 28 27 29 28 /*Intermediary*/ … … 36 35 element->InputUpdateFromSolution(solution); 37 36 } 38 39 37 } -
issm/trunk/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h
r11995 r12706 11 11 /* local prototypes: */ 12 12 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,Vector* solution); 13 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double* solution);13 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution); 14 14 15 15 //with timestep 16 16 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,Vector* solution,int timestep); 17 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double* solution, int timestep);17 void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution, int timestep); 18 18 19 19 #endif /* _UPDATEINPUTSFROMSOLUTIONXX_H */ -
issm/trunk/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp
r11995 r12706 18 18 19 19 /*Free ressources:*/ 20 x free((void**)&serial_vector);20 xDelete<double>(serial_vector); 21 21 } 22 22 -
issm/trunk/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp
r11995 r12706 11 11 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* vector, int name, int type){ 12 12 13 double* serial_vector=NULL;13 IssmDouble* serial_vector=NULL; 14 14 15 15 serial_vector=vector->ToMPISerial(); … … 18 18 19 19 /*Free ressources:*/ 20 x free((void**)&serial_vector);20 xDelete<IssmDouble>(serial_vector); 21 21 } 22 22 23 23 24 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, double* vector, int name, int type){24 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* vector, int name, int type){ 25 25 26 26 int i; -
issm/trunk/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h
r11995 r12706 11 11 /* local prototypes: */ 12 12 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,Vector* vector, int name,int type); 13 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters, double* vector, int name,int type);13 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* vector, int name,int type); 14 14 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,int* vector, int name,int type); 15 15 void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters,bool* vector, int name,int type); -
issm/trunk/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp
r11995 r12706 13 13 #include "../../shared/shared.h" 14 14 #include "../../include/include.h" 15 #include "../../io/io.h" 15 16 /*}}}*/ 16 17 … … 36 37 /*Some checks on arguments: */ 37 38 if ((M<2) || (N<2) || (nods<=0)){ 38 _error _("nothing to be done according to the dimensions of input matrices and vectors.");39 _error2_("nothing to be done according to the dimensions of input matrices and vectors."); 39 40 } 40 41 if (x_in[1]-x_in[0]<0){ 41 _error _("x coordinate vector should be increasing.\n use Matlab's command x=flipud(x), also flip the data matrix data=fliplr(data)");42 _error2_("x coordinate vector should be increasing.\n use Matlab's command x=flipud(x), also flip the data matrix data=fliplr(data)"); 42 43 } 43 44 if (y_in[1]-y_in[0]<0){ 44 _error _("y coordinate vector should be increasing.\n use Matlab's command y=flipud(y), also flip the data matrix data=flipud(data)");45 _error2_("y coordinate vector should be increasing.\n use Matlab's command y=flipud(y), also flip the data matrix data=flipud(data)"); 45 46 } 46 47 … … 52 53 53 54 /*The coordinates given in input describe the contour of each pixel. Take the center of each pixel*/ 54 x= (double*)xmalloc(N*sizeof(double));55 y= (double*)xmalloc(M*sizeof(double));55 x=xNew<double>(N); 56 y=xNew<double>(M); 56 57 for (i=0;i<N;i++) x[i]=(x_in[i]+x_in[i+1])/2; 57 58 for (i=0;i<M;i++) y[i]=(y_in[i]+y_in[i+1])/2; … … 62 63 63 64 /*The coordinates given in input describe the center each pixel. Keep them*/ 64 x= (double*)xmalloc(N*sizeof(double));65 y= (double*)xmalloc(M*sizeof(double));65 x=xNew<double>(N); 66 y=xNew<double>(M); 66 67 for (i=0;i<N;i++) x[i]=x_in[i]; 67 68 for (i=0;i<M;i++) y[i]=y_in[i]; 68 69 } 69 70 else{ 70 _error _("x and y vectors length should be 1 or 0 more than data number of rows.");71 _error2_("x and y vectors length should be 1 or 0 more than data number of rows."); 71 72 } 72 73 … … 81 82 gate.data_mesh=data_mesh; 82 83 gate.data=data; 84 gate.default_value=default_value; 85 gate.interp=interpenum; 83 86 gate.M=M; 84 87 gate.N=N; 85 gate.interp=interpenum;86 88 87 89 /*launch the thread manager with InterpFromGridToMeshxt as a core: */ 88 90 LaunchThread(InterpFromGridToMeshxt,(void*)&gate,num); 91 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 89 92 90 93 /*Assign output pointers:*/ … … 92 95 } 93 96 /*}}}*/ 94 /*InterpFromGridToMeshxt {{{ 1*/97 /*InterpFromGridToMeshxt {{{*/ 95 98 void* InterpFromGridToMeshxt(void* vpthread_handle){ 96 99 … … 124 127 double *y = gate->y; 125 128 int nods = gate->nods; 126 Vector *data_mesh = gate->data_mesh;129 Vector *data_mesh = gate->data_mesh; 127 130 double *data = gate->data; 128 131 double default_value = gate->default_value; … … 131 134 int N = gate->N; 132 135 136 bool debug = M*N>1? true:false; 137 debug = true; 138 133 139 /*partition loop across threads: */ 134 140 PartitionRange(&i0,&i1,nods,num_threads,my_thread); 135 141 for (i=i0;i<i1;i++) { 136 142 143 if(debug && my_thread==0) 144 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%"); 137 145 x_grid=*(x_mesh+i); 138 146 y_grid=*(y_mesh+i); … … 170 178 break; 171 179 default: 172 printf("Interpolation %s not supported yet\n",EnumToStringx(interpenum));180 _printLine_("Interpolation " << EnumToStringx(interpenum) << " not supported yet"); 173 181 return NULL; /*WARNING: no error because it would blow up the multithreading!*/ 174 182 } 175 if( isnan(data_value)) data_value=default_value;183 if(xIsNan<IssmDouble>(data_value)) data_value=default_value; 176 184 } 177 185 else{ … … 183 191 }/*}}}*/ 184 192 185 /*findindices {{{ 1*/193 /*findindices {{{*/ 186 194 bool findindices(int* pn,int* pm,double* x,int x_rows, double* y,int y_rows, double xgrid,double ygrid){ 187 195 … … 218 226 return (foundx && foundy); 219 227 }/*}}}*/ 220 /*triangleinterp{{{ 1*/228 /*triangleinterp{{{*/ 221 229 double triangleinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){ 222 230 /*split the rectangle in 2 triangle and … … 259 267 } 260 268 }/*}}}*/ 261 /*bilinearinterp{{{ 1*/269 /*bilinearinterp{{{*/ 262 270 double bilinearinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){ 263 271 /*Bilinear interpolation: (http://en.wikipedia.org/wiki/Bilinear_interpolation) */ … … 286 294 } 287 295 /*}}}*/ 288 /*nearestinterp{{{ 1*/296 /*nearestinterp{{{*/ 289 297 double nearestinterp(double x1,double x2,double y1,double y2,double Q11,double Q12,double Q21,double Q22,double x,double y){ 290 298 /*Nearest neighbor interpolation*/ -
issm/trunk/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp
r11995 r12706 41 41 /*some checks*/ 42 42 if (nels_data<1 || nods_data<3 || nods_prime==0){ 43 _error _("nothing to be done according to the mesh given in input");43 _error2_("nothing to be done according to the mesh given in input"); 44 44 } 45 45 … … 55 55 } 56 56 else{ 57 _error _("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");57 _error2_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!"); 58 58 } 59 59 60 60 if((numcontours) && (interpolation_type==2)){ 61 _error _("element interpolation_type with contours not supported yet!");61 _error2_("element interpolation_type with contours not supported yet!"); 62 62 } 63 63 … … 84 84 } 85 85 else{ 86 incontour= (double*)xmalloc(nods_prime*sizeof(double));87 for (i=0;i<nods_prime;i++) incontour[i]=1 ;86 incontour=xNew<double>(nods_prime); 87 for (i=0;i<nods_prime;i++) incontour[i]=1.0; 88 88 } 89 89 … … 112 112 113 113 /*Assign output pointers:*/ 114 x free((void**)&incontour);114 xDelete<double>(incontour); 115 115 *pdata_prime=data_prime; 116 116 } -
issm/trunk/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp
r11995 r12706 17 17 bool debug; 18 18 int nels_data; 19 double * index_data=NULL;20 double * x_data=NULL;21 double * y_data=NULL;22 double * data=NULL;23 double xmin,xmax;24 double ymin,ymax;25 int nods_prime;26 Vector * data_prime=NULL;27 double * x_prime=NULL;28 double * y_prime=NULL;29 double * default_values=NULL;19 double *index_data = NULL; 20 double *x_data = NULL; 21 double *y_data = NULL; 22 double *data = NULL; 23 double xmin ,xmax; 24 double ymin ,ymax; 25 int nods_prime; 26 Vector *data_prime = NULL; 27 double *x_prime = NULL; 28 double *y_prime = NULL; 29 double *default_values = NULL; 30 30 int num_default_values; 31 double * incontour=NULL;31 double *incontour = NULL; 32 32 33 33 /*intermediary: */ … … 46 46 47 47 /*recover parameters :*/ 48 interpolation_type =gate->interpolation_type;49 debug =gate->debug;50 nels_data =gate->nels_data;51 index_data =gate->index_data;52 x_data =gate->x_data;53 y_data =gate->y_data;54 data =gate->data;55 xmin =gate->xmin;56 xmax =gate->xmax;57 ymin =gate->ymin;58 ymax =gate->ymax;59 nods_prime =gate->nods_prime;60 data_prime =gate->data_prime;61 x_prime =gate->x_prime;62 y_prime =gate->y_prime;63 default_values =gate->default_values;64 num_default_values =gate->num_default_values;65 incontour =gate->incontour;48 interpolation_type = gate->interpolation_type; 49 debug = gate->debug; 50 nels_data = gate->nels_data; 51 index_data = gate->index_data; 52 x_data = gate->x_data; 53 y_data = gate->y_data; 54 data = gate->data; 55 xmin = gate->xmin; 56 xmax = gate->xmax; 57 ymin = gate->ymin; 58 ymax = gate->ymax; 59 nods_prime = gate->nods_prime; 60 data_prime = gate->data_prime; 61 x_prime = gate->x_prime; 62 y_prime = gate->y_prime; 63 default_values = gate->default_values; 64 num_default_values = gate->num_default_values; 65 incontour = gate->incontour; 66 66 67 67 /*partition loop across threads: */ … … 69 69 70 70 /*Loop over the elements*/ 71 if (debug && my_thread==0) printf(" interpolation progress: %5.2lf %%",0.0);72 73 71 for (i=i0;i<i1;i++){ 74 72 75 73 /*display current iteration*/ 76 if (debug && my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100*num_threads); 74 if (debug && my_thread==0 && fmod((double)i,(double)100)==0) 75 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%"); 77 76 78 77 /*if there is no point inside the domain, go to next iteration*/ … … 114 113 data_value=data[i]; 115 114 } 116 if ( isnan(data_value)){115 if (xIsNan<IssmDouble>(data_value)){ 117 116 if(num_default_values==1) data_value=default_values[0]; 118 117 else data_value=default_values[j]; … … 125 124 } 126 125 } 127 if (debug && my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);128 126 if(debug && my_thread==0) 127 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 129 128 return NULL; 130 131 129 } -
issm/trunk/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
r11995 r12706 30 30 /*some checks*/ 31 31 if (nels<1 || nods<3 || nlines<1 || ncols<1 || xposting==0 || yposting==0){ 32 _error _("nothing to be done according to the mesh given in input");32 _error2_("nothing to be done according to the mesh given in input"); 33 33 } 34 34 … … 41 41 } 42 42 else{ 43 _error _("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");43 _error2_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!"); 44 44 } 45 45 46 46 /*First, allocate pointers: */ 47 griddata= (double*)xcalloc(nlines*ncols,sizeof(double));48 x_grid= (double*)xcalloc(ncols,sizeof(double));49 y_grid= (double*)xcalloc(nlines,sizeof(double));47 griddata=xNewZeroInit<double>(nlines*ncols); 48 x_grid=xNewZeroInit<double>(ncols); 49 y_grid=xNewZeroInit<double>(nlines); 50 50 51 51 /*Set debug to 1 if there are lots of elements*/ … … 85 85 86 86 /*Loop over the elements*/ 87 if (debug) printf(" interpolation progress: %5.2lf %%",0.0);88 87 for (n=0;n<nels;n++){ 89 88 90 89 /*display current iteration*/ 91 if (debug && fmod((double)n,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)n/nels*100); 90 if (debug && fmod((double)n,(double)100)==0) 91 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(n)/double(nels)*100<<"%"); 92 92 93 93 /*Get extrema coordinates of current elements*/ … … 160 160 data_value=data_mesh[n]; 161 161 } 162 if ( isnan(data_value)) data_value=default_value;162 if (xIsNan<IssmDouble>(data_value)) data_value=default_value; 163 163 164 164 /*insert value and go to the next point*/ … … 168 168 } 169 169 } 170 if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0); 170 if (debug) 171 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 171 172 172 173 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
r12330 r12706 13 13 using namespace std; 14 14 15 int InterpFromMeshToMesh2dx(double** pdata_interp, double* index_data,double* x_data,double* y_data,int nods_data,int nels_data,16 double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values, DataSet* contours){15 int InterpFromMeshToMesh2dx(double** pdata_interp,int* index_data,double* x_data,double* y_data,int nods_data,int nels_data, 16 double* data,int M_data,int N_data,double* x_interp,double* y_interp,int N_interp,Options* options){ 17 17 18 18 /*Output*/ … … 20 20 21 21 /*Intermediary*/ 22 bool isdefault; 23 double defaultvalue; 22 24 R2 r; 23 25 I2 I; … … 29 31 double data_value; 30 32 Icoor2 dete[3]; 31 int verbose=0;32 33 /*default values: */34 Vector* vec_incontour=NULL;35 double* incontour=NULL;36 bool skip_bamg=false;37 33 38 34 /*Checks*/ 39 if ( data_cols<=0){40 _error _("data provided has a negative number of columns");35 if (M_data!=nods_data && M_data!=nels_data){ 36 _error2_("data provided should have either " << nods_data << " or " << nels_data << " lines (not " << M_data << ")"); 41 37 } 42 if (data_rows!=nods_data && data_rows!=nels_data){ 43 _error_("data provided should have either %i or %i lines (not %i)",nods_data,nels_data,data_rows); 38 39 /*Get default*/ 40 if(options->GetOption("default")){ 41 isdefault=true; 42 options->Get(&defaultvalue,"default"); 44 43 } 45 if((num_default_values) && (data_cols>1)){ 46 _error_("data provided can only have 1 column if a default value is provided"); 47 } 48 49 /*If default values supplied, figure out which nodes are inside the contour, including the border of the contour: */ 50 if(num_default_values){ 51 ContourToNodesx( &vec_incontour,x_interp,y_interp,nods_interp,contours,1); 52 incontour=vec_incontour->ToMPISerial(); 44 else{ 45 isdefault=false; 53 46 } 54 47 55 48 /*Initialize output*/ 56 if (verbose) printf("Initializing output vector\n"); 57 data_interp=(double*)xmalloc(nods_interp*data_cols*sizeof(double)); 49 data_interp=xNew<double>(N_interp*N_data); 58 50 59 // read background mesh 60 if (verbose) printf("Reading mesh\n"); 51 /*read background mesh*/ 61 52 Mesh Th(index_data,x_data,y_data,nods_data,nels_data); 53 54 /*Get reference number (for subdomains)*/ 55 long* reft = xNew<long>(Th.nbt); 56 Th.TriangleReferenceList(reft); 62 57 Th.CreateSingleVertexToTriangleConnectivity(); 63 58 64 //Loop over output nodes 65 if (verbose) printf("Loop over the nodes\n"); 66 for(i=0;i<nods_interp;i++){ 67 68 /*reset skip_bamg: */ 69 skip_bamg=false; 59 /*Loop over output nodes*/ 60 for(i=0;i<N_interp;i++){ 70 61 71 /*figure out if we should skip bamg logic: */ 72 if(num_default_values){ 73 if(!incontour[i]){ 74 /*This node is not inside the contour. Skip Bamg logic and apply default value.: */ 75 skip_bamg=true; 62 /*Get current point coordinates*/ 63 r.x=x_interp[i]; r.y=y_interp[i]; 64 I2 I=Th.R2ToI2(r); 65 66 /*Find triangle holding r/I*/ 67 Triangle &tb=*Th.TriangleFindFromCoord(I,dete); 68 69 /*point inside convex*/ 70 if (tb.det>0){ 71 72 /*Area coordinates*/ 73 areacoord[0]= (double) dete[0]/tb.det; 74 areacoord[1]= (double) dete[1]/tb.det; 75 areacoord[2]= (double) dete[2]/tb.det; 76 /*3 vertices of the triangle*/ 77 i0=Th.GetId(tb[0]); 78 i1=Th.GetId(tb[1]); 79 i2=Th.GetId(tb[2]); 80 /*triangle number*/ 81 it=Th.GetId(tb); 82 83 /*Inside convex but outside mesh*/ 84 if (reft[it]<0 & isdefault){ 85 for(j=0;j<N_data;j++) data_interp[i*N_data+j]=defaultvalue; 86 continue; 76 87 } 77 88 } 78 79 if(skip_bamg==false){ 80 81 //Get current point coordinates 82 r.x=x_interp[i]; r.y=y_interp[i]; 83 I2 I=Th.R2ToI2(r); 84 85 //Find triangle holding r/I 86 Triangle &tb=*Th.TriangleFindFromCoord(I,dete); 87 88 // internal point 89 if (tb.det>0){ 90 //Area coordinate 91 areacoord[0]= (double) dete[0]/tb.det; 92 areacoord[1]= (double) dete[1]/tb.det; 93 areacoord[2]= (double) dete[2]/tb.det; 94 //3 vertices of the triangle 95 i0=Th.GetId(tb[0]); 96 i1=Th.GetId(tb[1]); 97 i2=Th.GetId(tb[2]); 98 //triangle number 99 it=Th.GetId(tb); 89 //external point 90 else{ 91 if(isdefault){ 92 for(j=0;j<N_data;j++) data_interp[i*N_data+j]=defaultvalue; 93 continue; 100 94 } 101 //external point 102 else { 95 else{ 103 96 //Get closest adjacent triangle (inside the mesh) 104 97 AdjacentTriangle ta=CloseBoundaryEdge(I,&tb,aa,bb).Adj(); … … 116 109 it=Th.GetId(tc); 117 110 } 118 119 if (data_rows==nods_data){ 120 for (j=0;j<data_cols;j++){ 121 data_interp[i*data_cols+j]=areacoord[0]*data[data_cols*i0+j]+areacoord[1]*data[data_cols*i1+j]+areacoord[2]*data[data_cols*i2+j]; 122 } 123 } 124 else{ 125 for (j=0;j<data_cols;j++){ 126 if (it<0 || it>=nels_data){ 127 _error_("Triangle number %i not in [0 %i], because not correctly implemented yet... interpolate on grid first",it,nels_data); 128 } 129 data_interp[i*data_cols+j]=data[data_cols*it+j]; 130 } 111 } 112 113 if (M_data==nods_data){ 114 for (j=0;j<N_data;j++){ 115 data_interp[i*N_data+j]=areacoord[0]*data[N_data*i0+j]+areacoord[1]*data[N_data*i1+j]+areacoord[2]*data[N_data*i2+j]; 131 116 } 132 117 } 133 118 else{ 134 if(num_default_values==1) data_interp[i]=default_values[0]; 135 else data_interp[i]=default_values[i]; 119 for (j=0;j<N_data;j++){ 120 if (it<0 || it>=nels_data){ 121 _error2_("Triangle number " << it << " not in [0 " << nels_data << "], report bug to developers"); 122 } 123 data_interp[i*N_data+j]=data[N_data*it+j]; 124 } 136 125 } 137 126 } 138 127 139 /* Assign output pointers:*/140 if (verbose) printf("Assigning output\n");128 /*clean-up and return*/ 129 xDelete<long>(reft); 141 130 *pdata_interp=data_interp; 142 143 /*No error return*/144 131 return 1; 145 132 } -
issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.h
r12330 r12706 6 6 #define _INTERPFROMMESHTOMESH2DX_H 7 7 8 #include "../../objects/objects.h" 8 class Options; 9 9 10 /* local prototypes: */ 11 int InterpFromMeshToMesh2dx(double** pdata_interp,double* index_data,double* x_data,double* y_data,int nods_data,int nels_data, 12 double* data,int data_rows,int data_cols,double* x_interp,double* y_interp,int nods_interp,double* default_values,int num_default_values,DataSet* contours); 10 int InterpFromMeshToMesh2dx(double** pdata_interp,int* index_data,double* x_data,double* y_data,int nods_data,int nels_data, 11 double* data,int M_data,int N_data,double* x_interp,double* y_interp,int N_interp,Options* options); 13 12 14 13 #endif -
issm/trunk/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp
r11995 r12706 27 27 /*some checks*/ 28 28 if (nels_data<1 || nods_data<6 || nods_prime==0){ 29 _error _("nothing to be done according to the mesh given in input");29 _error2_("nothing to be done according to the mesh given in input"); 30 30 } 31 31 … … 41 41 } 42 42 else{ 43 _error _("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!");43 _error2_("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!"); 44 44 } 45 45 … … 58 58 59 59 /*Loop over the elements*/ 60 if (debug) printf(" interpolation progress: %5.2lf %%",0.0);61 60 for (i=0;i<nels_data;i++){ 62 61 63 62 /*display current iteration*/ 64 if (debug && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100); 63 if (debug && fmod((double)i,(double)100)==0) 64 _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<double(i)/double(nels_data)*100<<"%"); 65 65 66 66 /*Get extrema coordinates of current elements*/ … … 124 124 data_value=data[i]; 125 125 } 126 if ( isnan(data_value)) data_value=default_value;126 if (xIsNan<IssmDouble>(data_value)) data_value=default_value; 127 127 128 128 /*insert value and go to the next point*/ … … 132 132 } 133 133 } 134 if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0); 134 if (debug) 135 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 135 136 136 137 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
r9725 r12706 22 22 int counter; 23 23 int nods; 24 double* times=NULL;25 double* values=NULL;24 IssmDouble* times=NULL; 25 IssmDouble* values=NULL; 26 26 bool spcpresent=false; 27 27 int count=0; … … 29 29 30 30 /*variables being fetched: */ 31 double *doublevector = NULL;31 IssmDouble *IssmDoublevector = NULL; 32 32 int M,N; 33 33 … … 38 38 fid=iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum); 39 39 40 if(code!=7)_error _("%s%s"," expecting a double vector for constraints with enum ",EnumToStringx(vector_enum));41 if(vector_layout!=1)_error _("%s%s"," expecting a nodal vector for constraints with enum ",EnumToStringx(vector_enum));40 if(code!=7)_error2_("expecting a IssmDouble vector for constraints with enum " << EnumToStringx(vector_enum)); 41 if(vector_layout!=1)_error2_("expecting a nodal vector for constraints with enum " << EnumToStringx(vector_enum)); 42 42 43 43 /*Fetch vector:*/ 44 iomodel->FetchData(& doublevector,&M,&N,vector_enum);44 iomodel->FetchData(&IssmDoublevector,&M,&N,vector_enum); 45 45 46 46 /*Transient or static?:*/ … … 55 55 if((iomodel->my_vertices[i])){ 56 56 57 if (! isnan(doublevector[i])){57 if (!xIsNan<IssmDouble>(IssmDoublevector[i])){ 58 58 59 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, doublevector[i],analysis_type));59 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,IssmDoublevector[i],analysis_type)); 60 60 count++; 61 61 } … … 69 69 70 70 /*figure out times: */ 71 times= (double*)xmalloc(N*sizeof(double));71 times=xNew<IssmDouble>(N); 72 72 for(j=0;j<N;j++){ 73 times[j]= doublevector[(M-1)*N+j];73 times[j]=IssmDoublevector[(M-1)*N+j]; 74 74 } 75 75 /*unit conversion: */ … … 83 83 84 84 /*figure out times and values: */ 85 values= (double*)xmalloc(N*sizeof(double));85 values=xNew<IssmDouble>(N); 86 86 spcpresent=false; 87 87 for(j=0;j<N;j++){ 88 values[j]= doublevector[i*N+j];89 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default88 values[j]=IssmDoublevector[i*N+j]; 89 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 90 90 } 91 91 … … 94 94 count++; 95 95 } 96 x free((void**)&values);96 xDelete<IssmDouble>(values); 97 97 } 98 98 } 99 99 } 100 100 else{ 101 _error _("Size of field %s not supported",EnumToStringx(vector_enum));101 _error2_("Size of field " << EnumToStringx(vector_enum) << " not supported"); 102 102 } 103 103 104 104 /*Free ressources:*/ 105 x free((void**)&doublevector);106 x free((void**)×);107 x free((void**)&values);105 xDelete<IssmDouble>(IssmDoublevector); 106 xDelete<IssmDouble>(times); 107 xDelete<IssmDouble>(values); 108 108 } -
issm/trunk/src/c/modules/KMLFileReadx/KMLFileReadx.cpp
r11527 r12706 21 21 clock0=clock(); 22 22 time0 =time(NULL); 23 _p rintf_(true,"\nKMLFileReadx Module -- %s",ctime(&time0));23 _pprintString_("\nKMLFileReadx Module -- " << ctime(&time0)); 24 24 25 25 /* read kml file */ … … 43 43 } 44 44 45 // _p rintf_(true,"%s\n",kstr);46 x free((void**)&kstr);45 // _pprintLine_(kstr); 46 xDelete<char>(kstr); 47 47 } 48 48 49 49 if (kxml) { 50 _p rintf_(true,"XML declaration:\n");50 _pprintLine_("XML declaration:"); 51 51 kxml->DeepEcho(" "); 52 52 delete kxml; 53 53 } 54 54 if (kdtd) { 55 _p rintf_(true,"DTD declaration (not yet implemented):\n");55 _pprintLine_("DTD declaration (not yet implemented):"); 56 56 kdtd->DeepEcho(" "); 57 57 delete kdtd; -
issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.cpp
r9761 r12706 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void KMLMeshWritex(int* ierror, 12 char* name, 13 char* notes, 14 int* elem,int melem,int nelem, 15 int* nodecon,int mncon,int nncon, 16 double* lat, double* lng, 17 int* part, 18 double* data, int mdata, int ndata, 19 double* cmap, int mcmap, int ncmap, 20 FILE* fid){ 21 22 int i,j,k,ipt=0,jpt=0,nnodes; 23 int mxepg=25; 24 int lwidth=1; 25 double popac=0.50; 26 char indent[81]=" "; 27 char cstr[81]; 28 double* edata=NULL; 29 bool ncfree=false, 30 edfree=false; 31 KML_Document* kdoc=NULL; 32 KML_Style* kstyle; 33 KML_LineStyle* klsty; 34 KML_PolyStyle* kpsty; 11 void KMLMeshWritex(int* ierror,char* name,char* notes,int* elem,int melem,int nelem,int* nodecon,int mncon,int nncon,double* lat, double* lng,int* part,double* data, int mdata, int ndata,double* cmap, int mcmap, int ncmap,FILE* fid){ 12 13 int i,j,k,ipt=0,jpt=0,nnodes; 14 int mxepg = 25; 15 int lwidth = 1; 16 double popac = 0.50; 17 char indent[81] = " "; 18 char cstr[81]; 19 double *edata = NULL; 20 bool ncfree=false, edfree=false; 21 KML_Document *kdoc = NULL; 22 KML_Style *kstyle; 23 KML_LineStyle *klsty; 24 KML_PolyStyle *kpsty; 35 25 36 26 clock_t clock0,clock1,clock0a,clock0b,clock0c; … … 39 29 clock0=clock(); 40 30 time0 =time(NULL); 41 _p rintf_(true,"\nKMLMeshWritex Module -- %s",ctime(&time0));31 _pprintString_("\nKMLMeshWritex Module -- " << ctime(&time0)); 42 32 43 33 /* construct kml document */ … … 93 83 94 84 if (cmap) { 95 _p rintf_(true,"Writing %d Matlab colors as KML style templates.\n",mcmap);85 _pprintLine_("Writing " << mcmap << " Matlab colors as KML style templates."); 96 86 ipt=0; 97 87 for (i=0; i<mcmap; i++) { … … 128 118 129 119 if (!nodecon) { 130 _p rintf_(true,"Creating the node connectivity table.\n");120 _pprintLine_("Creating the node connectivity table."); 131 121 nncon=mxepg+1; 132 nodecon= (int *) xcalloc(mncon*nncon,sizeof(int));122 nodecon=xNewZeroInit<int>(mncon*nncon); 133 123 ncfree=true; 134 124 … … 143 133 } 144 134 else 145 _error _("Nodal connectivity table needs more than specified %d columns.\n",mxepg);135 _error2_("Nodal connectivity table needs more than specified " << mxepg << " columns.\n"); 146 136 } 147 137 jpt++; … … 159 149 160 150 else if (mdata == mncon) { 161 _p rintf_(true,"Averaging nodal data to element data.\n");162 edata= (double *) xcalloc(melem*ndata,sizeof(double));151 _pprintLine_("Averaging nodal data to element data."); 152 edata=xNewZeroInit<double>(melem*ndata); 163 153 edfree=true; 164 154 … … 183 173 184 174 else 185 _error _("Data matrix has incorrect number of %d rows.\n",mdata);175 _error2_("Data matrix has incorrect number of " << mdata << " rows.\n"); 186 176 } 187 177 … … 194 184 cmap,mcmap,ncmap)); 195 185 196 if (edfree) xfree((void**)&edata);197 if (ncfree) xfree((void**)&nodecon);186 if(edfree) xDelete<double>(edata); 187 if(ncfree) xDelete<int>(nodecon); 198 188 clock0a=clock(); 199 189 time0a =time(NULL); … … 203 193 /* write kml file */ 204 194 205 _p rintf_(true,"Writing kml document to file.\n");195 _pprintLine_("Writing kml document to file."); 206 196 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 207 197 fprintf(fid,"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n"); … … 213 203 ((double)(clock0b-clock0a))/CLOCKS_PER_SEC,difftime(time0b,time0a)); 214 204 215 _p rintf_(true,"Deleting kml document.\n");205 _pprintLine_("Deleting kml document."); 216 206 delete kdoc; 217 207 clock0c=clock(); … … 314 304 /* write each element as a polygon placemark */ 315 305 316 _p rintf_(true,"Writing %d tria elements as KML polygons.\n",melem);306 _pprintLine_("Writing " << melem << " tria elements as KML polygons."); 317 307 318 308 for (i=0; i<melem; i++) { … … 344 334 kring=new KML_LinearRing(); 345 335 kring->ncoord =nelem+1; 346 kring->coords =(double (*)[3]) xmalloc((nelem+1)*3*sizeof(double));336 kring->coords =xNew<double>((nelem+1)*3); 347 337 348 338 /* write the nodal coordinates as a linear ring */ 349 339 350 340 for (j=0; j<nelem; j++) { 351 kring->coords[ j][0]=lng[elem[ipt]-1];352 kring->coords[ j][1]=lat[elem[ipt]-1];353 kring->coords[ j][2]=alt;341 kring->coords[3*j+0]=lng[elem[ipt]-1]; 342 kring->coords[3*j+1]=lat[elem[ipt]-1]; 343 kring->coords[3*j+2]=alt; 354 344 ipt++; 355 345 } 356 kring->coords[ nelem][0]=kring->coords[0][0];357 kring->coords[ nelem][1]=kring->coords[0][1];358 kring->coords[ nelem][2]=kring->coords[0][2];346 kring->coords[3*nelem+0]=kring->coords[3*0+0]; 347 kring->coords[3*nelem+1]=kring->coords[3*0+1]; 348 kring->coords[3*nelem+2]=kring->coords[3*0+2]; 359 349 // kring->DeepEcho(); 360 350 361 351 /* assemble the linear ring into polygon into placemark into folder */ 362 352 363 (kpoly ->outer )->AddObject((Object*)kring);364 (kplace->geometry )->AddObject((Object*)kpoly);365 (kfold ->feature )->AddObject((Object*)kplace);353 (kpoly ->outer )->AddObject((Object*)kring); 354 (kplace->geometry)->AddObject((Object*)kpoly); 355 (kfold ->feature )->AddObject((Object*)kplace); 366 356 367 357 // if (!(int)fmod((double)(i+1),1000)) 368 // _p rintf_(true," %d tria elements written.\n",(i+1));358 // _pprintLine_(" " << (i+1) << " tria elements written."); 369 359 } 370 _p rintf_(true," %d tria elements written.\n",melem);360 _pprintLine_(" " << melem << " tria elements written."); 371 361 372 362 return(kfold); -
issm/trunk/src/c/modules/KMLOverlayx/KMLOverlayx.cpp
r9761 r12706 28 28 clock0=clock(); 29 29 time0 =time(NULL); 30 _p rintf_(true,"\nKMLOverlayx Module -- %s",ctime(&time0));30 _pprintString_("\nKMLOverlayx Module -- " << ctime(&time0)); 31 31 32 32 /* construct kml file */ … … 82 82 /* write kml file */ 83 83 84 _p rintf_(true,"Writing kml document to file.\n");84 _pprintLine_("Writing kml document to file."); 85 85 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 86 86 kfile->Write(fid,indent); -
issm/trunk/src/c/modules/Kml2Expx/Kml2Expx.cpp
r9761 r12706 38 38 clock0=clock(); 39 39 time0 =time(NULL); 40 _p rintf_(true,"\nKml2Expx Module -- %s",ctime(&time0));40 _pprintString_("\nKml2Expx Module -- " << ctime(&time0)); 41 41 42 42 /* read kml file */ … … 44 44 fidi=fopen(filkml,"r"); 45 45 if (!(kobj=KMLFileReadx(fidi))) 46 _error _("Error reading kml file.");46 _error2_("Error reading kml file."); 47 47 fclose(fidi); 48 48 49 49 /* open exp file */ 50 50 51 _p rintf_(true,"Writing exp profiles to file.\n");51 _pprintLine_("Writing exp profiles to file."); 52 52 fido=fopen(filexp,"w"); 53 53 -
issm/trunk/src/c/modules/Krigingx/Krigingx.cpp
r12330 r12706 10 10 #include "../../Container/Observations.h" 11 11 #include "../modules.h" 12 13 12 #ifdef _HAVE_GSL_ 14 13 #include <gsl/gsl_linalg.h> 15 14 #endif 16 17 #include "../../objects/Kriging/GaussianVariogram.h"18 15 /*FUNCTION Krigingx{{{*/ 19 16 int Krigingx(double** ppredictions,double **perror,double* obs_x, double* obs_y, double* obs_list, int obs_length,double* x_interp,double* y_interp,int n_interp,Options* options){ … … 47 44 48 45 /*Allocate output*/ 49 predictions = (double*)xcalloc(n_interp,sizeof(double));50 error = (double*)xcalloc(n_interp,sizeof(double));46 predictions =xNewZeroInit<double>(n_interp); 47 error =xNewZeroInit<double>(n_interp); 51 48 52 49 /*Get output*/ … … 59 56 observations->Variomap(predictions,x_interp,n_interp); 60 57 } 61 else if(strcmp(output,"prediction")==0){ 62 58 else if(strcmp(output,"delaunay")==0){ 59 int nobs,nel; 60 double *x = NULL; 61 double *y = NULL; 62 double *data = NULL; 63 int *index = NULL; 64 65 observations->ObservationList(&x,&y,&data,&nobs); 66 67 _printLine_("Generation Delaunay Triangulation"); 68 BamgTriangulatex(&index,&nel,x,y,nobs); 69 70 _printLine_("Interpolating"); 71 xDelete<double>(predictions); 72 InterpFromMeshToMesh2dx(&predictions,index,x,y,nobs,nel,data,nobs,1,x_interp,y_interp,n_interp,options); 73 xDelete<double>(x); 74 xDelete<double>(y); 75 xDelete<double>(data); 76 xDelete<int>(index); 77 } 78 else if(strcmp(output,"nearestneighbor")==0){ 63 79 /*initialize thread parameters: */ 64 80 gate.n_interp = n_interp; … … 72 88 gate.predictions = predictions; 73 89 gate.error = error; 74 gate.percent = (double*)xcalloc(num,sizeof(double)); 90 gate.percent = xNewZeroInit<double>(num); 91 92 /*launch the thread manager with Krigingxt as a core: */ 93 LaunchThread(NearestNeighbort,(void*)&gate,num); 94 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 95 xDelete<double>(gate.percent); 96 } 97 else if(strcmp(output,"idw")==0){ //Inverse distance weighting 98 /*initialize thread parameters: */ 99 gate.n_interp = n_interp; 100 gate.x_interp = x_interp; 101 gate.y_interp = y_interp; 102 gate.radius = radius; 103 gate.mindata = mindata; 104 gate.maxdata = maxdata; 105 gate.variogram = variogram; 106 gate.observations = observations; 107 gate.predictions = predictions; 108 gate.error = error; 109 gate.percent = xNewZeroInit<double>(num); 110 111 /*launch the thread manager with Krigingxt as a core: */ 112 LaunchThread(idwt,(void*)&gate,num); 113 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 114 xDelete<double>(gate.percent); 115 } 116 else if(strcmp(output,"prediction")==0){ 117 118 /*initialize thread parameters: */ 119 gate.n_interp = n_interp; 120 gate.x_interp = x_interp; 121 gate.y_interp = y_interp; 122 gate.radius = radius; 123 gate.mindata = mindata; 124 gate.maxdata = maxdata; 125 gate.variogram = variogram; 126 gate.observations = observations; 127 gate.predictions = predictions; 128 gate.error = error; 129 gate.percent = xNewZeroInit<double>(num); 75 130 76 131 /*launch the thread manager with Krigingxt as a core: */ 77 132 LaunchThread(Krigingxt,(void*)&gate,num); 78 printf("\r interpolation progress: 100.00%%\n");79 x free((void**)&gate.percent);133 _printLine_("\r interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 134 xDelete<double>(gate.percent); 80 135 } 81 136 else{ 82 _error _("output '%s' not supported yet",output);137 _error2_("output '" << output << "' not supported yet"); 83 138 } 84 139 … … 86 141 delete variogram; 87 142 delete observations; 88 x free((void**)&output);143 xDelete<char>(output); 89 144 *ppredictions = predictions; 90 145 *perror = error; … … 121 176 122 177 /*Intermediaries*/ 123 int i,j,n_obs; 124 double numerator,denominator,ratio,localpercent; 125 double *x = NULL; 126 double *y = NULL; 127 double *obs = NULL; 128 double *Gamma = NULL; 129 double *GinvG0 = NULL; 130 double *Ginv1 = NULL; 131 double *GinvZ = NULL; 132 double *gamma0 = NULL; 133 double *ones = NULL; 178 double localpercent; 179 180 /*partition loop across threads: */ 181 PartitionRange(&i0,&i1,n_interp,num_threads,my_thread); 182 for(int idx=i0;idx<i1;idx++){ 183 184 /*Print info*/ 185 percent[my_thread]=double(idx-i0)/double(i1-i0)*100.; 186 localpercent=percent[0]; 187 for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 188 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 189 190 /*Kriging interpolation*/ 191 observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram); 192 } 193 194 return NULL; 195 }/*}}}*/ 196 /*FUNCTION NearestNeighbort{{{*/ 197 void* NearestNeighbort(void* vpthread_handle){ 198 199 /*gate variables :*/ 200 KrigingxThreadStruct *gate = NULL; 201 pthread_handle *handle = NULL; 202 int my_thread; 203 int num_threads; 204 int i0,i1; 205 206 /*recover handle and gate: */ 207 handle = (pthread_handle*)vpthread_handle; 208 gate = (KrigingxThreadStruct*)handle->gate; 209 my_thread = handle->id; 210 num_threads = handle->num; 211 212 /*recover parameters :*/ 213 int n_interp = gate->n_interp; 214 double *x_interp = gate->x_interp; 215 double *y_interp = gate->y_interp; 216 double radius = gate->radius; 217 int mindata = gate->mindata; 218 int maxdata = gate->maxdata; 219 Variogram *variogram = gate->variogram; 220 Observations *observations = gate->observations; 221 double *predictions = gate->predictions; 222 double *error = gate->error; 223 double *percent = gate->percent; 224 225 /*Intermediaries*/ 226 int i; 227 double localpercent; 134 228 135 229 /*partition loop across threads: */ … … 141 235 localpercent=percent[0]; 142 236 for(i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 143 printf("\r interpolation progress: %5.2lf%%",localpercent); 144 145 /*Get list of observations for current point*/ 146 observations->ObservationList(&x,&y,&obs,&n_obs,x_interp[idx],y_interp[idx],radius,maxdata); 147 if(n_obs<mindata){ 148 predictions[idx] = -999.0; 149 error[idx] = -999.0; 150 continue; 151 } 152 153 /*Allocate intermediary matrix and vectors*/ 154 155 Gamma = (double*)xmalloc(n_obs*n_obs*sizeof(double)); 156 gamma0 = (double*)xmalloc(n_obs*sizeof(double)); 157 ones = (double*)xmalloc(n_obs*sizeof(double)); 158 159 /*First: Create semivariogram matrix for observations*/ 160 for(i=0;i<n_obs;i++){ 161 for(j=0;j<=i;j++){ 162 //Gamma[i*n_obs+j] = variogram->SemiVariogram(x[i]-x[j],y[i]-y[j]); 163 Gamma[i*n_obs+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]); 164 Gamma[j*n_obs+i] = Gamma[i*n_obs+j]; 165 } 166 } 167 for(i=0;i<n_obs;i++) ones[i]=1; 168 169 /*Get semivariogram vector associated to this location*/ 170 //for(i=0;i<n_obs;i++) gamma0[i] = variogram->SemiVariogram(x[i]-x_interp[idx],y[i]-y_interp[idx]); 171 for(i=0;i<n_obs;i++) gamma0[i] = variogram->Covariance(x[i]-x_interp[idx],y[i]-y_interp[idx]); 172 173 /*Solve the three linear systems*/ 174 GslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0 175 GslSolve(&Ginv1, Gamma,ones,n_obs); // Gamma^-1 ones 176 GslSolve(&GinvZ, Gamma,obs,n_obs); // Gamma^-1 Z 177 178 /*Prepare predictor*/ 179 numerator=-1.; denominator=0.; 180 for(i=0;i<n_obs;i++) numerator +=GinvG0[i]; 181 for(i=0;i<n_obs;i++) denominator+=Ginv1[i]; 182 ratio=numerator/denominator; 183 184 predictions[idx] = 0.; 185 error[idx] = - numerator*numerator/denominator; 186 for(i=0;i<n_obs;i++) predictions[idx] += (gamma0[i]-ratio)*GinvZ[i]; 187 for(i=0;i<n_obs;i++) error[idx] += gamma0[i]*GinvG0[i]; 188 189 /*clean-up*/ 190 xfree((void**)&x); 191 xfree((void**)&y); 192 xfree((void**)&obs); 193 xfree((void**)&Gamma); 194 xfree((void**)&gamma0); 195 xfree((void**)&ones); 196 xfree((void**)&GinvG0); 197 xfree((void**)&Ginv1); 198 xfree((void**)&GinvZ); 199 } 200 237 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 238 239 observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius); 240 } 241 242 return NULL; 243 }/*}}}*/ 244 /*FUNCTION idwt{{{*/ 245 void* idwt(void* vpthread_handle){ 246 247 /*gate variables :*/ 248 KrigingxThreadStruct *gate = NULL; 249 pthread_handle *handle = NULL; 250 int my_thread; 251 int num_threads; 252 int i0,i1; 253 254 /*recover handle and gate: */ 255 handle = (pthread_handle*)vpthread_handle; 256 gate = (KrigingxThreadStruct*)handle->gate; 257 my_thread = handle->id; 258 num_threads = handle->num; 259 260 /*recover parameters :*/ 261 int n_interp = gate->n_interp; 262 double *x_interp = gate->x_interp; 263 double *y_interp = gate->y_interp; 264 double radius = gate->radius; 265 int mindata = gate->mindata; 266 int maxdata = gate->maxdata; 267 Variogram *variogram = gate->variogram; 268 Observations *observations = gate->observations; 269 double *predictions = gate->predictions; 270 double *error = gate->error; 271 double *percent = gate->percent; 272 273 /*Intermediaries*/ 274 double localpercent; 275 double power = 2.; 276 277 /*partition loop across threads: */ 278 PartitionRange(&i0,&i1,n_interp,num_threads,my_thread); 279 for(int idx=i0;idx<i1;idx++){ 280 281 /*Print info*/ 282 percent[my_thread]=double(idx-i0)/double(i1-i0)*100.; 283 localpercent=percent[0]; 284 for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]); 285 if(my_thread==0) _printString_("\r interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%"); 286 287 observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power); 288 } 201 289 return NULL; 202 290 }/*}}}*/ … … 214 302 else if(strcmp(model,"spherical")==0) variogram = new SphericalVariogram(options); 215 303 else if(strcmp(model,"power")==0) variogram = new PowerVariogram(options); 216 else _error _("variogram %s not supported yet (list of supported variogram: gaussian, exponential, spherical and power)",model);304 else _error2_("variogram " << model << " not supported yet (list of supported variogram: gaussian, exponential, spherical and power)"); 217 305 } 218 306 else variogram = new GaussianVariogram(options); 219 307 220 308 /*Assign output pointer*/ 221 x free((void**)&model);309 xDelete<char>(model); 222 310 *pvariogram = variogram; 223 311 }/*}}}*/ 224 void GslSolve(double** pX,double* A,double* B,int n){/*{{{*/225 #ifdef _HAVE_GSL_226 227 /*GSL Matrices and vectors: */228 int s;229 gsl_matrix_view a;230 gsl_vector_view b;231 gsl_vector *x = NULL;232 gsl_permutation *p = NULL;233 234 /*A will be modified by LU decomposition. Use copy*/235 double* Acopy = (double*)xmalloc(n*n*sizeof(double));236 memcpy(Acopy,A,n*n*sizeof(double));237 238 /*Initialize gsl matrices and vectors: */239 a = gsl_matrix_view_array (Acopy,n,n);240 b = gsl_vector_view_array (B,n);241 x = gsl_vector_alloc (n);242 243 /*Run LU and solve: */244 p = gsl_permutation_alloc (n);245 gsl_linalg_LU_decomp (&a.matrix, p, &s);246 gsl_linalg_LU_solve (&a.matrix, p, &b.vector, x);247 248 //printf ("x = \n");249 //gsl_vector_fprintf (stdout, x, "%g");250 251 /*Copy result*/252 double* X = (double*)xmalloc(n*sizeof(double));253 memcpy(X,gsl_vector_ptr(x,0),n*sizeof(double));254 255 /*Clean up and assign output pointer*/256 xfree((void**)&Acopy);257 gsl_permutation_free(p);258 gsl_vector_free(x);259 *pX=X;260 #else261 _error_("GSL support required");262 #endif263 }/*}}}*/ -
issm/trunk/src/c/modules/Krigingx/Krigingx.h
r12330 r12706 13 13 14 14 int Krigingx(double** ppredictions,double **perror,double* x, double* y, double* observations, int n_obs,double* x_interp,double* y_interp,int n_interp,Options* options); 15 int pKrigingx(double** ppredictions,double **perror,double* x, double* y, double* observations, int n_obs,double* x_interp,double* y_interp,int n_interp,Options* options); 15 16 void ProcessVariogram(Variogram **pvariogram,Options* options); 16 void GslSolve(double** pX,double* A,double* B,int n);17 17 18 18 /*threading: */ … … 32 32 33 33 void* Krigingxt(void*); 34 void* NearestNeighbort(void*); 35 void* idwt(void*); 34 36 #endif /* _KRIGINGX_H */ -
issm/trunk/src/c/modules/Ll2xyx/Ll2xyx.cpp
r9761 r12706 52 52 double T,rho,sl,tc,mc; 53 53 54 if((sgn!=1) && (sgn!=-1)) _error _("Sign should be either +1 or -1.\n");54 if((sgn!=1) && (sgn!=-1)) _error2_("Sign should be either +1 or -1.\n"); 55 55 56 56 delta = central_meridian; … … 116 116 *pdelta= 45; 117 117 *pslat = 70; 118 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n");118 if(flag) _pprintLine_("Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45)."); 119 119 } 120 120 else if (sgn == -1) { 121 121 *pdelta= 0; 122 122 *pslat = 71; 123 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n");123 if(flag) _pprintLine_("Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0)."); 124 124 } 125 else _error _("Sign should be either +1 or -1.\n");125 else _error2_("Sign should be either +1 or -1.\n"); 126 126 127 127 return; -
issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp
r12330 r12706 67 67 for(j=0;j<M;j++){ 68 68 double* matrix=array[j]; 69 x free((void**)&matrix);69 xDelete<double>(matrix); 70 70 } 71 x free((void**)&mdims_array);72 x free((void**)&ndims_array);73 x free((void**)&array);71 xDelete<int>(mdims_array); 72 xDelete<int>(ndims_array); 73 xDelete<double*>(array); 74 74 75 75 /*Assign output pointers: */ -
issm/trunk/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp
r11995 r12706 17 17 18 18 /*Display message*/ 19 _printf_(VerboseModule()," Merging solution vector from fset to gset\n");19 if(VerboseModule()) _pprintLine_(" Merging solution vector from fset to gset"); 20 20 21 21 /*first, get gsize, fsize and ssize: */ -
issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp
r12330 r12706 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes, double* elements,12 int numberofelements2d,int numberofnodes2d, double* elements2d,int numlayers,int elements_width, int dim,int num_procs){11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,IssmDouble* elements, 12 int numberofelements2d,int numberofnodes2d,IssmDouble* elements2d,int numlayers,int elements_width, int dim,int num_procs){ 13 13 14 14 int noerr=1; … … 31 31 32 32 if(dim==2){ 33 epart= (int*)xmalloc(numberofelements*sizeof(int));34 npart= (int*)xmalloc(numberofnodes*sizeof(int));35 index= (int*)xmalloc(elements_width*numberofelements*sizeof(int));33 epart=xNew<int>(numberofelements); 34 npart=xNew<int>(numberofnodes); 35 index=xNew<int>(elements_width*numberofelements); 36 36 for (i=0;i<numberofelements;i++){ 37 37 for (j=0;j<elements_width;j++){ 38 *(index+elements_width*i+j)= (int)*(elements+elements_width*i+j)-1; //-1 for C indexing in Metis38 *(index+elements_width*i+j)=reCast<int>(*(elements+elements_width*i+j))-1; //-1 for C indexing in Metis 39 39 } 40 40 } … … 51 51 for (i=0;i<numberofnodes;i++) npart[i]=0; 52 52 } 53 else _error _("At least one processor is required");53 else _error2_("At least one processor is required"); 54 54 } 55 55 else{ … … 57 57 58 58 /*First build concatenated 2d mesh from 2d_coll and 2d_noncoll: */ 59 epart2d= (int*)xmalloc(numberofelements2d*sizeof(int));60 npart2d= (int*)xmalloc(numberofnodes2d*sizeof(int));61 index2d= (int*)xmalloc(3*numberofelements2d*sizeof(int));59 epart2d=xNew<int>(numberofelements2d); 60 npart2d=xNew<int>(numberofnodes2d); 61 index2d=xNew<int>(3*numberofelements2d); 62 62 63 63 for (i=0;i<numberofelements2d;i++){ 64 64 for (j=0;j<3;j++){ 65 *(index2d+3*i+j)= (int)*(elements2d+3*i+j)-1; //-1 for C indexing in Metis65 *(index2d+3*i+j)=reCast<int>(*(elements2d+3*i+j))-1; //-1 for C indexing in Metis 66 66 } 67 67 } … … 78 78 for (i=0;i<numberofnodes2d;i++) npart2d[i]=0; 79 79 } 80 else _error _("At least one processor is required");80 else _error2_("At least one processor is required"); 81 81 82 82 /*Extrude epart2d to epart, using numlayers: */ 83 epart= (int*)xmalloc(numberofelements*sizeof(int));83 epart=xNew<int>(numberofelements); 84 84 85 85 count=0; … … 92 92 93 93 /*Extrude npart2d to npart, using numlayers: */ 94 npart= (int*)xmalloc(numberofnodes*sizeof(int));94 npart=xNew<int>(numberofnodes); 95 95 96 96 count=0; … … 108 108 109 109 /*Free ressources: */ 110 xfree((void**)&index); 111 xfree((void**)&epart2d); 112 xfree((void**)&npart2d); 113 xfree((void**)&index2d); 114 110 xDelete<int>(index); 111 xDelete<int>(epart2d); 112 xDelete<int>(npart2d); 113 xDelete<int>(index2d); 115 114 return noerr; 116 117 115 } -
issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h
r8303 r12706 6 6 #define _MESHPARTITIONX_H 7 7 8 #include "../../include/include.h" 9 8 10 /* local prototypes: */ 9 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes, double* elements,10 int numberofelements2d,int numberofnodes2d, double* elements2d,int numlayers,int elements_width, int dim,int numareas);11 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofnodes,IssmDouble* elements, 12 int numberofelements2d,int numberofnodes2d,IssmDouble* elements2d,int numlayers,int elements_width, int dim,int numareas); 11 13 12 14 #endif /* _MESHPARTITIONX_H */ -
issm/trunk/src/c/modules/MeshProfileIntersectionx/ElementSegment.cpp
r8303 r12706 38 38 if( (edge1==IntersectEnum) && (edge2==IntersectEnum) && (edge3==IntersectEnum) ){ 39 39 /*This case is impossible: */ 40 _error _("error: a line cannot go through 3 different vertices!");40 _error2_("error: a line cannot go through 3 different vertices!"); 41 41 } 42 42 else if( ((edge1==IntersectEnum) && (edge2==IntersectEnum)) || ((edge2==IntersectEnum) && (edge3==IntersectEnum)) || ((edge3==IntersectEnum) && (edge1==IntersectEnum)) ){ -
issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp
r8303 r12706 5 5 6 6 void MeshProfileIntersectionx( double** psegments, int* pnumsegs, int* index, double* x, double* y, int nel, int nods, Contour** contours,int numcontours){ 7 8 7 9 8 int i,j,k; … … 28 27 29 28 /*Allocate: */ 30 allsegments= (double**)xmalloc(numcontours*sizeof(double*));31 allnumsegs= (int*)xmalloc(numcontours*sizeof(int));29 allsegments=xNew<double*>(numcontours); 30 allnumsegs=xNew<int>(numcontours); 32 31 33 32 /*Loop through all contours: */ … … 53 52 54 53 /*Out of all segments, create one common array of segments: */ 55 segments= (double*)xmalloc(5*numsegs*sizeof(double));54 segments=xNew<double>(5*numsegs); 56 55 count=0; 57 56 for(i=0;i<numcontours;i++){ -
issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshSegmentsIntersection.cpp
r8303 r12706 32 32 /*Using the segments_dataset dataset, create segments: */ 33 33 numsegs=segments_dataset->Size(); 34 segments= (double*)xmalloc(5*numsegs*sizeof(double));34 segments=xNew<double>(5*numsegs); 35 35 for(i=0;i<numsegs;i++){ 36 36 Segment* segment=(Segment*)segments_dataset->GetObjectByOffset(i); -
issm/trunk/src/c/modules/ModelProcessorx/Balancethickness/CreateNodesBalancethickness.cpp
r10522 r12706 46 46 47 47 /*Check in 3d*/ 48 if(stabilization==3 && dim==3) _error _("DG 3d not implemented yet");48 if(stabilization==3 && dim==3) _error2_("DG 3d not implemented yet"); 49 49 50 50 /*First fetch data: */ -
issm/trunk/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
r11527 r12706 63 63 parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps)); 64 64 65 x free((void**)&control_type);66 x free((void**)&cm_responses);67 x free((void**)&cm_jump);68 x free((void**)&optscal);69 x free((void**)&maxiter);65 xDelete<int>(control_type); 66 xDelete<double>(cm_responses); 67 xDelete<double>(cm_jump); 68 xDelete<double>(optscal); 69 xDelete<double>(maxiter); 70 70 } 71 71 -
issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r10981 r12706 48 48 case FrictionCoefficientEnum: iomodel->FetchData(1,FrictionCoefficientEnum); break; 49 49 case MaterialsRheologyBbarEnum: iomodel->FetchData(1,MaterialsRheologyBEnum); break; 50 default: _error _("Control %s not implemented yet",EnumToStringx((int)iomodel->Data(InversionControlParametersEnum)[i]));50 default: _error2_("Control " << EnumToStringx((int)iomodel->Data(InversionControlParametersEnum)[i]) << " not implemented yet"); 51 51 } 52 52 } -
issm/trunk/src/c/modules/ModelProcessorx/CreateDataSets.cpp
r9775 r12706 124 124 125 125 default: 126 _error _("%s%s%s"," analysis_type: ",EnumToStringx(analysis_type)," not supported yet!");126 _error2_("analysis_type: " << EnumToStringx(analysis_type) << " not supported yet!"); 127 127 } 128 128 -
issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
r11027 r12706 23 23 int numberofelements; 24 24 int numberofvertices; 25 double* elements=NULL;25 IssmDouble* elements=NULL; 26 26 27 27 /*output*/ … … 43 43 44 44 /*Allocate ouput*/ 45 connectivity= (int*)xcalloc(numberofvertices,sizeof(int));45 connectivity=xNewZeroInit<int>(numberofvertices); 46 46 47 47 /*Get element width (3 or 6)*/ … … 56 56 for (i=0;i<numberofelements;i++){ 57 57 for (j=0;j<elementswidth;j++){ 58 vertexid= (int)elements[elementswidth*i+j];58 vertexid=reCast<int>(elements[elementswidth*i+j]); 59 59 _assert_(vertexid>0 && vertexid-1<numberofvertices); 60 60 connectivity[vertexid-1]+=1; -
issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
r12293 r12706 24 24 int numoutputs; 25 25 Parameters *parameters = NULL; 26 double *requestedoutputs = NULL;26 IssmDouble *requestedoutputs = NULL; 27 27 28 28 if(*pparameters)return; //do not create parameters twice! … … 57 57 parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum)); 58 58 parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum)); 59 parameters->AddObject(iomodel->CopyConstantObject(DebugP etscProfilingEnum));59 parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum)); 60 60 parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum)); 61 61 parameters->AddObject(iomodel->CopyConstantObject(ConstantsReferencetemperatureEnum)); … … 90 90 parameters->AddObject(iomodel->CopyConstantObject(InversionTaoEnum)); 91 91 parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIspddEnum)); 92 parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIssmbgradientsEnum)); 92 93 93 94 /*some parameters that did not come with the iomodel: */ … … 105 106 parameters->AddObject(new IntParam(DiagnosticNumRequestedOutputsEnum,numoutputs)); 106 107 if(numoutputs)parameters->AddObject(new IntVecParam(DiagnosticRequestedOutputsEnum,requestedoutputs,numoutputs)); 107 x free((void**)&requestedoutputs);108 xDelete<IssmDouble>(requestedoutputs); 108 109 iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,TransientRequestedOutputsEnum); 109 110 parameters->AddObject(new IntParam(TransientNumRequestedOutputsEnum,numoutputs)); 110 111 if(numoutputs)parameters->AddObject(new IntVecParam(TransientRequestedOutputsEnum,requestedoutputs,numoutputs)); 111 x free((void**)&requestedoutputs);112 xDelete<IssmDouble>(requestedoutputs); 112 113 iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,SteadystateRequestedOutputsEnum); 113 114 parameters->AddObject(new IntParam(SteadystateNumRequestedOutputsEnum,numoutputs)); 114 115 if(numoutputs)parameters->AddObject(new IntVecParam(SteadystateRequestedOutputsEnum,requestedoutputs,numoutputs)); 115 x free((void**)&requestedoutputs);116 xDelete<IssmDouble>(requestedoutputs); 116 117 117 118 /*Before returning, create parameters in case we are running Qmu or control types runs: */ -
issm/trunk/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
r9733 r12706 23 23 int numberofelements; 24 24 int numberofvertices; 25 double* elements=NULL;25 IssmDouble* elements=NULL; 26 26 27 27 /*output*/ … … 44 44 45 45 /*Allocate ouput*/ 46 connectivity= (int*)xcalloc(numberofvertices,sizeof(int));46 connectivity=xNewZeroInit<int>(numberofvertices); 47 47 48 48 /*Get element width (3 or 6)*/ … … 59 59 if(iomodel->my_elements[i]){ 60 60 for (j=0;j<elementswidth;j++){ 61 vertexid= (int)elements[elementswidth*i+j];61 vertexid=reCast<int>(elements[elementswidth*i+j]); 62 62 _assert_(vertexid>0 && vertexid-1<numberofvertices); 63 63 connectivity[vertexid-1]=i+1; -
issm/trunk/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp
r10660 r12706 15 15 void CreateParametersDakota(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type){ 16 16 17 /*variable declarations: {{{ 1*/17 /*variable declarations: {{{*/ 18 18 int i,j,k; 19 19 … … 73 73 iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum); 74 74 75 /*name of qmu input, error and output files:{{{ 1*/76 qmuinname= (char*)xmalloc((strlen(name)+strlen(".qmu.in")+1)*sizeof(char));75 /*name of qmu input, error and output files:{{{*/ 76 qmuinname=xNew<char>((strlen(name)+strlen(".qmu.in")+1)); 77 77 sprintf(qmuinname,"%s%s",name,".qmu.in"); 78 78 parameters->AddObject(new StringParam(QmuInNameEnum,qmuinname)); 79 79 80 qmuoutname= (char*)xmalloc((strlen(name)+strlen(".qmu.out")+1)*sizeof(char));80 qmuoutname=xNew<char>((strlen(name)+strlen(".qmu.out")+1)); 81 81 sprintf(qmuoutname,"%s%s",name,".qmu.out"); 82 82 parameters->AddObject(new StringParam(QmuOutNameEnum,qmuoutname)); 83 83 84 qmuerrname= (char*)xmalloc((strlen(name)+strlen(".qmu.err")+1)*sizeof(char));84 qmuerrname=xNew<char>((strlen(name)+strlen(".qmu.err")+1)); 85 85 sprintf(qmuerrname,"%s%s",name,".qmu.err"); 86 86 parameters->AddObject(new StringParam(QmuErrNameEnum,qmuerrname)); 87 87 /*}}}*/ 88 /*Fetch variable descriptors: {{{ 1*/88 /*Fetch variable descriptors: {{{*/ 89 89 iomodel->FetchData(&variabledescriptors,&numvariabledescriptors,QmuVariabledescriptorsEnum); 90 90 … … 93 93 94 94 /*}}}*/ 95 /*Fetch response descriptors: {{{ 1*/95 /*Fetch response descriptors: {{{*/ 96 96 iomodel->FetchData(&responsedescriptors,&numresponsedescriptors,QmuResponsedescriptorsEnum); 97 97 … … 100 100 parameters->AddObject(new IntParam(QmuNumberofresponsesEnum,numberofresponses)); 101 101 /*}}}*/ 102 /*Deal with partitioning: {{{ 1*/102 /*Deal with partitioning: {{{*/ 103 103 /*partition vertices in iomodel->qmu_npart parts, unless a partition is already present: */ 104 104 … … 111 111 ElementsAndVerticesPartitioning(&iomodel->my_elements,&iomodel->my_vertices,iomodel); 112 112 113 dpart= (double*)xmalloc(numberofvertices*sizeof(double));113 dpart=xNew<double>(numberofvertices); 114 114 for(i=0;i<numberofvertices;i++)dpart[i]=iomodel->my_vertices[i]; 115 115 } 116 116 parameters->AddObject(new DoubleVecParam(QmuPartitionEnum,dpart,numberofvertices)); 117 117 /*}}}*/ 118 /*Deal with data needed because of qmu variables: {{{ 1*/118 /*Deal with data needed because of qmu variables: {{{*/ 119 119 120 120 for(i=0;i<numvariabledescriptors;i++){ … … 136 136 137 137 /*Free ressources:*/ 138 x free((void**)&dakota_parameter);139 } 140 } 141 /*}}}*/ 142 /*Deal with data needed to compute qmu responses: {{{ 1*/138 xDelete<double>(dakota_parameter); 139 } 140 } 141 /*}}}*/ 142 /*Deal with data needed to compute qmu responses: {{{*/ 143 143 for(i=0;i<numresponsedescriptors;i++){ 144 144 … … 153 153 /*Fetch the mass flux segments necessary to compute the mass fluxes. Build a DoubleMatArrayParam object out of them: */ 154 154 iomodel->FetchData(&array,&mdims_array,&ndims_array,&qmu_mass_flux_num_profiles,QmuMassFluxSegmentsEnum); 155 if(qmu_mass_flux_num_profiles==0)_error _("qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!");155 if(qmu_mass_flux_num_profiles==0)_error2_("qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!"); 156 156 157 157 /*Go through segments, and extract those that belong to this cpu: */ … … 166 166 } 167 167 if(m){ 168 matrix= (double*)xcalloc(5*m,sizeof(double));168 matrix=xNewZeroInit<double>(5*m); 169 169 count=0; 170 170 for(j=0;j<temp_m;j++){ … … 185 185 186 186 /*Free temporary matrix: */ 187 x free((void**)&temp_matrix);187 xDelete<double>(temp_matrix); 188 188 } 189 189 … … 194 194 for(i=0;i<qmu_mass_flux_num_profiles;i++){ 195 195 double* matrix=array[i]; 196 x free((void**)&matrix);197 } 198 x free((void**)&mdims_array);199 x free((void**)&ndims_array);200 x free((void**)&array);201 } 202 /*}}}*/ 203 /*Free data: {{{ 1*/196 xDelete<double>(matrix); 197 } 198 xDelete<int>(mdims_array); 199 xDelete<int>(ndims_array); 200 xDelete<double*>(array); 201 } 202 /*}}}*/ 203 /*Free data: {{{*/ 204 204 for(i=0;i<numresponsedescriptors;i++){ 205 205 descriptor=responsedescriptors[i]; 206 x free((void**)&descriptor);207 } 208 x free((void**)&responsedescriptors);206 xDelete<char>(descriptor); 207 } 208 xDelete<char*>(responsedescriptors); 209 209 210 210 for(i=0;i<numvariabledescriptors;i++){ 211 211 descriptor=variabledescriptors[i]; 212 x free((void**)&descriptor);213 } 214 x free((void**)&variabledescriptors);215 x free((void**)&part);216 x free((void**)&dpart);217 x free((void**)&qmuinname);218 x free((void**)&qmuerrname);219 x free((void**)&qmuoutname);212 xDelete<char>(descriptor); 213 } 214 xDelete<char*>(variabledescriptors); 215 xDelete<int>(part); 216 xDelete<double>(dpart); 217 xDelete<char>(qmuinname); 218 xDelete<char>(qmuerrname); 219 xDelete<char>(qmuoutname); 220 220 /*}}}*/ 221 221 } //if(dakota_analysis) 222 222 223 223 /*Free data*/ 224 x free((void**)&name);224 xDelete<char>(name); 225 225 226 226 /*Assign output pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
r10544 r12706 87 87 88 88 /*figure out times: */ 89 timesx= (double*)xmalloc(Nx*sizeof(double));89 timesx=xNew<double>(Nx); 90 90 for(j=0;j<Nx;j++){ 91 91 timesx[j]=spcvx[(Mx-1)*Nx+j]; … … 94 94 UnitConversion(timesx,Nx,ExtToIuEnum,TimeEnum); 95 95 /*figure out times: */ 96 timesy= (double*)xmalloc(Ny*sizeof(double));96 timesy=xNew<double>(Ny); 97 97 for(j=0;j<Ny;j++){ 98 98 timesy[j]=spcvy[(My-1)*Ny+j]; … … 101 101 UnitConversion(timesy,Ny,ExtToIuEnum,TimeEnum); 102 102 /*figure out times: */ 103 timesz= (double*)xmalloc(Nz*sizeof(double));103 timesz=xNew<double>(Nz); 104 104 for(j=0;j<Nz;j++){ 105 105 timesz[j]=spcvz[(Mz-1)*Nz+j]; … … 107 107 /*unit conversion: */ 108 108 UnitConversion(timesz,Nz,ExtToIuEnum,TimeEnum); 109 110 109 111 110 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ … … 121 120 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 122 121 count++; 123 if (! isnan(spcvx[i])){122 if (!xIsNan<IssmDouble>(spcvx[i])){ 124 123 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 125 124 count++; 126 125 } 127 if (! isnan(spcvy[i])){126 if (!xIsNan<IssmDouble>(spcvy[i])){ 128 127 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 129 128 count++; … … 136 135 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 137 136 count++; 138 if (! isnan(spcvx[i])){137 if (!xIsNan<IssmDouble>(spcvx[i])){ 139 138 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 140 139 count++; 141 140 } 142 if (! isnan(spcvy[i])){141 if (!xIsNan<IssmDouble>(spcvy[i])){ 143 142 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 144 143 count++; … … 146 145 147 146 } 148 else _error _("if vertices_type is MacAyealPattyn, you shoud have nodeonpattyn or nodeonmacayeal");147 else _error2_("if vertices_type is MacAyealPattyn, you shoud have nodeonpattyn or nodeonmacayeal"); 149 148 } 150 149 /*Also add spcs of coupling: zero at the border pattyn/stokes for the appropriate dofs*/ … … 158 157 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 159 158 count++; 160 if (! isnan(spcvx[i])){159 if (!xIsNan<IssmDouble>(spcvx[i])){ 161 160 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 162 161 count++; 163 162 } 164 if (! isnan(spcvy[i])){163 if (!xIsNan<IssmDouble>(spcvy[i])){ 165 164 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 166 165 count++; … … 173 172 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 174 173 count++; 175 if (! isnan(spcvx[i])){174 if (!xIsNan<IssmDouble>(spcvx[i])){ 176 175 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 177 176 count++; 178 177 } 179 if (! isnan(spcvy[i])){178 if (!xIsNan<IssmDouble>(spcvy[i])){ 180 179 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 181 180 count++; 182 181 } 183 if (! isnan(spcvz[i])){182 if (!xIsNan<IssmDouble>(spcvz[i])){ 184 183 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 185 184 count++; 186 185 } 187 186 } 188 else _error _("if vertices_type is PattynStokes, you shoud have nodeonpattyn or nodeonstokes");187 else _error2_("if vertices_type is PattynStokes, you shoud have nodeonpattyn or nodeonstokes"); 189 188 } 190 189 /*Also add spcs of coupling: zero at the border pattyn/stokes for the appropriate dofs*/ … … 198 197 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 199 198 count++; 200 if (! isnan(spcvx[i])){199 if (!xIsNan<IssmDouble>(spcvx[i])){ 201 200 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 202 201 count++; 203 202 } 204 if (! isnan(spcvy[i])){203 if (!xIsNan<IssmDouble>(spcvy[i])){ 205 204 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 206 205 count++; … … 213 212 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,0,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 214 213 count++; 215 if (! isnan(spcvx[i])){214 if (!xIsNan<IssmDouble>(spcvx[i])){ 216 215 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 217 216 count++; 218 217 } 219 if (! isnan(spcvy[i])){218 if (!xIsNan<IssmDouble>(spcvy[i])){ 220 219 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 221 220 count++; 222 221 } 223 if (! isnan(spcvz[i])){222 if (!xIsNan<IssmDouble>(spcvz[i])){ 224 223 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,5,spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 225 224 count++; 226 225 } 227 226 } 228 else _error _("if vertices_type is MacAyealStokes, you shoud have nodeonmacayeal or nodeonstokes");227 else _error2_("if vertices_type is MacAyealStokes, you shoud have nodeonmacayeal or nodeonstokes"); 229 228 } 230 229 /*Now add the regular spcs*/ 231 230 else{ 232 if (Mx==numberofvertices && ! isnan(spcvx[i])){231 if (Mx==numberofvertices && !xIsNan<IssmDouble>(spcvx[i])){ 233 232 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,spcvx[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 234 233 count++; … … 236 235 else if (Mx==numberofvertices+1) { 237 236 /*figure out times and values: */ 238 values= (double*)xmalloc(Nx*sizeof(double));237 values=xNew<double>(Nx); 239 238 spcpresent=false; 240 239 for(j=0;j<Nx;j++){ 241 240 values[j]=spcvx[i*Nx+j]/yts; 242 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default241 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 243 242 } 244 243 … … 247 246 count++; 248 247 } 249 x free((void**)&values);248 xDelete<double>(values); 250 249 } 251 250 else if (vertices_type[i]==HutterApproximationEnum){ … … 254 253 } 255 254 256 if (My==numberofvertices && ! isnan(spcvy[i])){255 if (My==numberofvertices && !xIsNan<IssmDouble>(spcvy[i])){ 257 256 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,spcvy[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy. 258 257 count++; … … 260 259 else if (My==numberofvertices+1){ 261 260 /*figure out times and values: */ 262 values= (double*)xmalloc(Ny*sizeof(double));261 values=xNew<double>(Ny); 263 262 spcpresent=false; 264 263 for(j=0;j<Ny;j++){ 265 264 values[j]=spcvy[i*Ny+j]/yts; 266 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default265 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 267 266 } 268 267 if(spcpresent){ … … 270 269 count++; 271 270 } 272 x free((void**)&values);271 xDelete<double>(values); 273 272 } 274 273 else if (vertices_type[i]==HutterApproximationEnum){ … … 278 277 279 278 if ((int)vertices_type[i]==StokesApproximationEnum || ((int)vertices_type[i]==NoneApproximationEnum)){ 280 if (Mz==numberofvertices && ! isnan(spcvz[i])){279 if (Mz==numberofvertices && !xIsNan<IssmDouble>(spcvz[i])){ 281 280 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,spcvz[i]/yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 282 281 count++; … … 284 283 else if (Mz==numberofvertices+1){ 285 284 /*figure out times and values: */ 286 values= (double*)xmalloc(Nz*sizeof(double));285 values=xNew<double>(Nz); 287 286 spcpresent=false; 288 287 for(j=0;j<Nz;j++){ 289 288 values[j]=spcvz[i*Nz+j]/yts; 290 if(! isnan(values[j]))spcpresent=true; //NaN means no spc by default289 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 291 290 } 292 291 if(spcpresent){ … … 294 293 count++; 295 294 } 296 x free((void**)&values);295 xDelete<double>(values); 297 296 } 298 297 … … 319 318 count++; 320 319 break; 321 default: _error _("Vertex approximation %s not supported",EnumToStringx((int)vertices_type[i]));320 default: _error2_("Vertex approximation " << EnumToStringx((int)vertices_type[i]) << " not supported"); 322 321 } 323 322 } … … 326 325 327 326 /*Free data: */ 328 x free((void**)&spcvx);329 x free((void**)&spcvy);330 x free((void**)&spcvz);331 x free((void**)&nodeonmacayeal);332 x free((void**)&nodeonpattyn);333 x free((void**)&nodeonstokes);334 x free((void**)&nodeonicesheet);335 x free((void**)&nodeonbed);336 x free((void**)&vertices_type);337 x free((void**)&surface);338 x free((void**)&z);327 xDelete<double>(spcvx); 328 xDelete<double>(spcvy); 329 xDelete<double>(spcvz); 330 xDelete<double>(nodeonmacayeal); 331 xDelete<double>(nodeonpattyn); 332 xDelete<double>(nodeonstokes); 333 xDelete<double>(nodeonicesheet); 334 xDelete<double>(nodeonbed); 335 xDelete<double>(vertices_type); 336 xDelete<double>(surface); 337 xDelete<double>(z); 339 338 340 339 /*Free resources:*/ 341 x free((void**)×x);342 x free((void**)×y);343 x free((void**)×z);344 x free((void**)&values);340 xDelete<double>(timesx); 341 xDelete<double>(timesy); 342 xDelete<double>(timesz); 343 xDelete<double>(values); 345 344 346 345 /*Assign output pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r10522 r12706 120 120 /*Free data: */ 121 121 iomodel->DeleteData(3,DiagnosticIcefrontEnum,ThicknessEnum,BedEnum); 122 x free((void**)&elements_type);123 x free((void**)&pressureload);122 xDelete<double>(elements_type); 123 xDelete<double>(pressureload); 124 124 125 125 /*Create Penpair for penalties: */ … … 144 144 145 145 /*free ressources: */ 146 x free((void**)&penalties);146 xDelete<double>(penalties); 147 147 148 148 /*Create Riffront loads for rifts: */ … … 157 157 } 158 158 iomodel->DeleteData(5,RiftsRiftstructEnum,ThicknessEnum,BedEnum,SurfaceEnum,MaskVertexonfloatingiceEnum); 159 x free((void**)&riftfront);159 xDelete<Riftfront>(riftfront); 160 160 } 161 161 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateConstraintsDiagnosticHutter.cpp
r10522 r12706 60 60 } 61 61 else{ 62 if (! isnan(iomodel->Data(DiagnosticSpcvxEnum)[i])){62 if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvxEnum)[i])){ 63 63 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(DiagnosticSpcvxEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 64 64 count++; 65 65 } 66 66 67 if (! isnan(iomodel->Data(DiagnosticSpcvyEnum)[i])){67 if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvyEnum)[i])){ 68 68 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->Data(DiagnosticSpcvyEnum)[i]/yts,DiagnosticHutterAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 69 69 count++; -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r11237 r12706 56 56 count++; 57 57 } 58 else if (! isnan(iomodel->Data(DiagnosticSpcvzEnum)[i])){58 else if (!xIsNan<IssmDouble>(iomodel->Data(DiagnosticSpcvzEnum)[i])){ 59 59 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, 60 60 iomodel->Data(DiagnosticSpcvzEnum)[i]/yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. -
issm/trunk/src/c/modules/ModelProcessorx/DistributeNumDofs.cpp
r9218 r12706 7 7 #include "../../EnumDefinitions/EnumDefinitions.h" 8 8 9 void DistributeNumDofs(DofIndexing* index,int analysis_type, double* vertices_type){9 void DistributeNumDofs(DofIndexing* index,int analysis_type,IssmDouble* vertices_type){ 10 10 11 11 /*For now, we distribute by analysis_type, later, we will distribute using the analysis_type, … … 35 35 else if (vertices_type[0]==MacAyealPattynApproximationEnum){ 36 36 numdofs=4; 37 doftype= (int*)xmalloc(numdofs*sizeof(int));37 doftype=xNew<int>(numdofs); 38 38 doftype[0]=MacAyealApproximationEnum; 39 39 doftype[1]=MacAyealApproximationEnum; … … 43 43 else if (vertices_type[0]==PattynStokesApproximationEnum){ 44 44 numdofs=6; 45 doftype= (int*)xmalloc(numdofs*sizeof(int));45 doftype=xNew<int>(numdofs); 46 46 doftype[0]=PattynApproximationEnum; 47 47 doftype[1]=PattynApproximationEnum; … … 53 53 else if (vertices_type[0]==MacAyealStokesApproximationEnum){ 54 54 numdofs=6; 55 doftype= (int*)xmalloc(numdofs*sizeof(int));55 doftype=xNew<int>(numdofs); 56 56 doftype[0]=MacAyealApproximationEnum; 57 57 doftype[1]=MacAyealApproximationEnum; … … 61 61 doftype[5]=StokesApproximationEnum; 62 62 } 63 else _error _("Approximationtype %i (%s) not implemented yet for DiagnosticHoriz",(int)*vertices_type,EnumToStringx((int)*vertices_type));63 else _error2_("Approximationtype " << reCast<int>(*vertices_type) << " (" << EnumToStringx(reCast<int>(*vertices_type)) << ") not implemented yet for DiagnosticHoriz"); 64 64 } 65 65 else if (analysis_type==DiagnosticVertAnalysisEnum){ … … 90 90 numdofs=1; 91 91 } 92 else _error _("analysis type: %i (%s) not implemented yet",analysis_type,EnumToStringx(analysis_type));92 else _error2_("analysis type: " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not implemented yet"); 93 93 94 94 /*Now initialize the index*/ … … 96 96 97 97 /*Clean up*/ 98 x free((void**)&doftype);98 xDelete<int>(doftype); 99 99 } -
issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r12330 r12706 42 42 int el1,el2; 43 43 int dim; 44 double* elements=NULL;45 double* elements2d=NULL;46 double* riftinfo=NULL;47 double* vertex_pairing=NULL;44 IssmDouble* elements=NULL; 45 IssmDouble* elements2d=NULL; 46 IssmDouble* riftinfo=NULL; 47 IssmDouble* vertex_pairing=NULL; 48 48 49 49 /*Fetch parameters: */ … … 76 76 77 77 /*Free elements and elements2d: */ 78 x free((void**)&elements);79 x free((void**)&elements2d);78 xDelete<IssmDouble>(elements); 79 xDelete<IssmDouble>(elements2d); 80 80 81 81 /*Deal with rifts, they have to be included into one partition only, not several: */ … … 83 83 iomodel->FetchData(&riftinfo,&numrifts,NULL,RiftsRiftstructEnum); 84 84 for(i=0;i<numrifts;i++){ 85 el1= (int)*(riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing86 el2= (int)*(riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing85 el1=reCast<int>(*(riftinfo+RIFTINFOSIZE*i+2))-1; //matlab indexing to c indexing 86 el2=reCast<int>(*(riftinfo+RIFTINFOSIZE*i+3))-1; //matlab indexing to c indexing 87 87 epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding vertices; 88 88 } 89 x free((void**)&riftinfo);89 xDelete<IssmDouble>(riftinfo); 90 90 } 91 91 92 92 /*Used later on: */ 93 my_vertices= (int*)xcalloc(numberofvertices,sizeof(int));94 my_elements= (bool*)xcalloc(numberofelements,sizeof(bool));93 my_vertices=xNewZeroInit<int>(numberofvertices); 94 my_elements=xNewZeroInit<bool>(numberofelements); 95 95 96 96 /*Start figuring out, out of the partition, which elements belong to this cpu: */ … … 107 107 into the vertices coordinates. If we start plugging 1 into my_vertices for each index[n][i] (i=0:2), then my_vertices 108 108 will hold which vertices belong to this partition*/ 109 my_vertices[ (int)*(elements+elements_width*i+0)-1]=1;110 my_vertices[ (int)*(elements+elements_width*i+1)-1]=1;111 my_vertices[ (int)*(elements+elements_width*i+2)-1]=1;109 my_vertices[reCast<int>(*(elements+elements_width*i+0))-1]=1; 110 my_vertices[reCast<int>(*(elements+elements_width*i+1))-1]=1; 111 my_vertices[reCast<int>(*(elements+elements_width*i+2))-1]=1; 112 112 113 113 if(elements_width==6){ 114 my_vertices[ (int)*(elements+elements_width*i+3)-1]=1;115 my_vertices[ (int)*(elements+elements_width*i+4)-1]=1;116 my_vertices[ (int)*(elements+elements_width*i+5)-1]=1;114 my_vertices[reCast<int>(*(elements+elements_width*i+3))-1]=1; 115 my_vertices[reCast<int>(*(elements+elements_width*i+4))-1]=1; 116 my_vertices[reCast<int>(*(elements+elements_width*i+5))-1]=1; 117 117 } 118 118 } 119 119 }//for (i=0;i<numberofelements;i++) 120 120 /*Free data : */ 121 x free((void**)&elements);121 xDelete<IssmDouble>(elements); 122 122 123 123 /*We might have vertex_pairing in which case, some vertices have to be cloned: … … 126 126 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,DiagnosticVertexPairingEnum); 127 127 for(i=0;i<numvertex_pairing;i++){ 128 if(my_vertices[ (int)vertex_pairing[2*i+0]-1] && !my_vertices[(int)vertex_pairing[2*i+1]-1]){129 my_vertices[ (int)vertex_pairing[2*i+1]-1]=2; //to know that these elements are not on the partition128 if(my_vertices[reCast<int>(vertex_pairing[2*i+0])-1] && !my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]){ 129 my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]=2; //to know that these elements are not on the partition 130 130 } 131 131 } 132 x free((void**)&vertex_pairing);132 xDelete<IssmDouble>(vertex_pairing); 133 133 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,PrognosticVertexPairingEnum); 134 134 for(i=0;i<numvertex_pairing;i++){ 135 if(my_vertices[ (int)vertex_pairing[2*i+0]-1] && !my_vertices[(int)vertex_pairing[2*i+1]-1]){136 my_vertices[ (int)vertex_pairing[2*i+1]-1]=2; //to know that these elements are not on the partition135 if(my_vertices[reCast<int>(vertex_pairing[2*i+0])-1] && !my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]){ 136 my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]=2; //to know that these elements are not on the partition 137 137 } 138 138 } 139 x free((void**)&vertex_pairing);139 xDelete<IssmDouble>(vertex_pairing); 140 140 141 141 /*Free ressources:*/ 142 x free((void**)&npart);143 x free((void**)&epart);142 xDelete<int>(npart); 143 xDelete<int>(epart); 144 144 145 145 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp
r11527 r12706 9 9 #include "../../../objects/objects.h" 10 10 #include "../../../shared/shared.h" 11 #include "../../../include/include.h" 11 12 #include "../ModelProcessorx.h" 12 13 … … 14 15 15 16 /*Intermediary*/ 16 int i;17 int count;17 int i,j; 18 int count; 18 19 int dim; 20 int M,N; 19 21 int numberofvertices; 22 bool spcpresent=false; 20 23 double heatcapacity; 21 24 double referencetemperature; 22 25 23 26 /*Output*/ 27 IssmDouble *spcvector = NULL; 28 IssmDouble* times=NULL; 29 IssmDouble* values=NULL; 24 30 Constraints* constraints = NULL; 25 SpcStatic* spcstatic = NULL;26 31 27 32 /*Fetch parameters: */ … … 44 49 45 50 /*Fetch data: */ 46 double *spctemperature=NULL; 47 iomodel->FetchData(&spctemperature,NULL,NULL,ThermalSpctemperatureEnum); 51 iomodel->FetchData(&spcvector,&M,&N,ThermalSpctemperatureEnum); 48 52 49 /*Initialize counter*/ 50 count=0; 53 //FIX ME: SHOULD USE IOMODELCREATECONSTRAINTS 54 /*Transient or static?:*/ 55 if(M==numberofvertices){ 56 /*static: just create Constraints objects*/ 57 count=0; 51 58 52 /*Create constraints from x,y,z: */ 53 for (i=0;i<numberofvertices;i++){ 54 /*keep only this partition's nodes:*/ 55 if((iomodel->my_vertices[i])){ 59 for (i=0;i<numberofvertices;i++){ 60 /*keep only this partition's nodes:*/ 61 if((iomodel->my_vertices[i])){ 56 62 57 if (!isnan(spctemperature[i])){63 if (!xIsNan<IssmDouble>(spcvector[i])){ 58 64 59 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(spctemperature[i]-referencetemperature),EnthalpyAnalysisEnum));60 count++;65 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,heatcapacity*(spcvector[i]-referencetemperature),EnthalpyAnalysisEnum)); 66 count++; 61 67 68 } 62 69 } 63 70 } 64 71 } 72 else if (M==(numberofvertices+1)){ 73 /*transient: create transient SpcTransient objects. Same logic, except we need to retrieve 74 * various times and values to initialize an SpcTransient object: */ 75 count=0; 65 76 66 /*Free data: */ 67 xfree((void**)&spctemperature); 68 77 /*figure out times: */ 78 times=xNew<IssmDouble>(N); 79 for(j=0;j<N;j++){ 80 times[j]=spcvector[(M-1)*N+j]; 81 } 82 /*unit conversion: */ 83 UnitConversion(times,N,ExtToIuEnum,TimeEnum); 84 85 /*Create constraints from x,y,z: */ 86 for (i=0;i<numberofvertices;i++){ 87 88 /*keep only this partition's nodes:*/ 89 if((iomodel->my_vertices[i])){ 90 91 /*figure out times and values: */ 92 values=xNew<IssmDouble>(N); 93 spcpresent=false; 94 for(j=0;j<N;j++){ 95 values[j]=heatcapacity*(spcvector[i*N+j]-referencetemperature); 96 if(!xIsNan<IssmDouble>(values[j]))spcpresent=true; //NaN means no spc by default 97 } 98 99 if(spcpresent){ 100 constraints->AddObject(new SpcTransient(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,N,times,values,EnthalpyAnalysisEnum)); 101 count++; 102 } 103 xDelete<IssmDouble>(values); 104 } 105 } 106 } 107 else{ 108 _error2_("Size of field " << EnumToStringx(ThermalSpctemperatureEnum) << " not supported"); 109 } 110 111 /*Free ressources:*/ 112 xDelete<IssmDouble>(spcvector); 113 xDelete<IssmDouble>(times); 114 xDelete<IssmDouble>(values); 115 69 116 /*Assign output pointer: */ 70 117 *pconstraints=constraints; -
issm/trunk/src/c/modules/ModelProcessorx/Melting/CreateLoadsMelting.cpp
r10522 r12706 26 26 27 27 /*if 2d: Error*/ 28 if (dim==2) _error _("2d meshes not supported yet");28 if (dim==2) _error2_("2d meshes not supported yet"); 29 29 30 30 /*Recover pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
r11995 r12706 68 68 if(solution_type==SteadystateSolutionEnum && analysis_type==EnthalpyAnalysisEnum && isenthalpy==false) continue; 69 69 70 _printf_(VerboseMProcessor()," creating datasets for analysis %s\n",EnumToStringx(analysis_type));70 if(VerboseMProcessor()) _pprintLine_(" creating datasets for analysis " << EnumToStringx(analysis_type)); 71 71 CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,¶meters,iomodel,solution_type,analysis_type,nummodels,i); 72 72 } -
issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.h
r10576 r12706 108 108 109 109 /*Distribution of dofs: */ 110 void DistributeNumDofs(DofIndexing* index,int analysis_type, double* vertices_type);110 void DistributeNumDofs(DofIndexing* index,int analysis_type,IssmDouble* vertices_type); 111 111 112 112 #endif -
issm/trunk/src/c/modules/ModelProcessorx/NodesPartitioning.cpp
r9733 r12706 24 24 25 25 /*First thing, this is a new partition for a new analysis_type, therefore, to avoid a leak, erase the nodes partition that might come through pmy_nodes: */ 26 x free((void**)pmy_nodes);26 xDelete<bool>(*pmy_nodes); 27 27 28 28 /*Now, depending on whether we are running galerkin discontinous or continuous elements, carry out a different partition of the nodes: */ … … 44 44 iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum); 45 45 46 my_nodes= (bool*)xmalloc(numberofvertices*sizeof(bool));47 memcpy(my_nodes,my_vertices,numberofvertices*sizeof(bool));46 my_nodes=xNew<bool>(numberofvertices); 47 for(int i=0;i<numberofvertices;i++) my_nodes[i]=(bool)my_vertices[i]; 48 48 49 49 /*Assign output pointers:*/ … … 69 69 bool* my_nodes=NULL; 70 70 71 int i1,i2;72 int cols;73 doublee1,e2;74 int pos;75 int numberofedges;76 double* edges=NULL;77 double* elements=NULL;71 int i1,i2; 72 int cols; 73 int e1,e2; 74 int pos; 75 int numberofedges; 76 int *edges = NULL; 77 int *elements = NULL; 78 78 79 79 /*Fetch parameters: */ … … 90 90 91 91 /*Allocate*/ 92 my_nodes= (bool*)xcalloc(3*numberofelements,sizeof(int));92 my_nodes=xNewZeroInit<bool>(3*numberofelements); 93 93 94 94 /*First: add all the nodes of all the elements belonging to this cpu*/ … … 96 96 for (i=0;i<numberofelements;i++){ 97 97 if (my_elements[i]){ 98 my_nodes[3*i+0]= 1;99 my_nodes[3*i+1]= 1;100 my_nodes[3*i+2]= 1;98 my_nodes[3*i+0]=true; 99 my_nodes[3*i+1]=true; 100 my_nodes[3*i+2]=true; 101 101 } 102 102 } 103 103 } 104 104 else{ 105 _error _("not implemented yet");105 _error2_("not implemented yet"); 106 106 } 107 107 … … 111 111 iomodel->FetchData(&edges,&numberofedges,&cols,MeshEdgesEnum); 112 112 iomodel->FetchData(&elements,NULL,NULL,MeshElementsEnum); 113 if (cols!=4) _error _("field edges should have 4 columns");113 if (cols!=4) _error2_("field edges should have 4 columns"); 114 114 115 115 /*!All elements have been partitioned above, only create elements for this CPU: */ … … 125 125 * we must clone the nodes on this partition so that the loads (Numericalflux) 126 126 * will have access to their properties (dofs,...)*/ 127 if(my_elements[ (int)e1] && !isnan(e2) && !my_elements[(int)e2]){127 if(my_elements[e1] && e2!=-2 && !my_elements[e2]){ 128 128 129 129 /*1: Get vertices ids*/ 130 i1= (int)edges[4*i+0];131 i2= (int)edges[4*i+1];130 i1=edges[4*i+0]; 131 i2=edges[4*i+1]; 132 132 133 133 /*2: Get the column where these ids are located in the index*/ 134 134 pos=UNDEF; 135 135 for(j=0;j<3;j++){ 136 if ( (int)elements[3*(int)e2+j]==i1) pos=j;136 if (elements[3*e2+j]==i1) pos=j; 137 137 } 138 138 … … 140 140 * we can now create the corresponding nodes:*/ 141 141 if (pos==0){ 142 my_nodes[ (int)e2*3+0]=1;143 my_nodes[ (int)e2*3+2]=1;142 my_nodes[e2*3+0]=true; 143 my_nodes[e2*3+2]=true; 144 144 } 145 145 else if(pos==1){ 146 my_nodes[ (int)e2*3+1]=1;147 my_nodes[ (int)e2*3+0]=1;146 my_nodes[e2*3+1]=true; 147 my_nodes[e2*3+0]=true; 148 148 } 149 149 else if (pos==2){ 150 my_nodes[ (int)e2*3+2]=1;151 my_nodes[ (int)e2*3+1]=1;150 my_nodes[e2*3+2]=true; 151 my_nodes[e2*3+1]=true; 152 152 } 153 153 else{ 154 _error _("Problem in edges creation");154 _error2_("Problem in edges creation"); 155 155 } 156 156 } … … 158 158 159 159 /*Free data: */ 160 x free((void**)&elements);161 x free((void**)&edges);160 xDelete<int>(elements); 161 xDelete<int>(edges); 162 162 163 163 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
r10522 r12706 47 47 48 48 /*Get left and right elements*/ 49 element= (int)(iomodel->Data(MeshEdgesEnum)[4*i+2])-1; //edges are [node1 node2 elem1 elem2]49 element=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+2])-1; //edges are [node1 node2 elem1 elem2] 50 50 51 51 /*Now, if this element is not in the partition, pass: */ … … 61 61 62 62 /*Create Penpair for vertex_pairing: */ 63 double *vertex_pairing=NULL;64 double *nodeonbed=NULL;63 IssmDouble *vertex_pairing=NULL; 64 IssmDouble *nodeonbed=NULL; 65 65 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,PrognosticVertexPairingEnum); 66 66 iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum); … … 68 68 for(i=0;i<numvertex_pairing;i++){ 69 69 70 if(iomodel->my_vertices[ (int)vertex_pairing[2*i+0]-1]){70 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){ 71 71 72 72 /*In debugging mode, check that the second node is in the same cpu*/ 73 _assert_(iomodel->my_vertices[ (int)vertex_pairing[2*i+1]-1]);73 _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]); 74 74 75 75 /*Skip if one of the two is not on the bed*/ 76 if(! nodeonbed[(int)vertex_pairing[2*i+0]-1] || !nodeonbed[(int)vertex_pairing[2*i+1]-1]) continue;76 if(!(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbed[reCast<int>(vertex_pairing[2*i+1])-1]))) continue; 77 77 78 78 /*Get node ids*/ 79 penpair_ids[0]=iomodel->nodecounter+ (int)vertex_pairing[2*i+0];80 penpair_ids[1]=iomodel->nodecounter+ (int)vertex_pairing[2*i+1];79 penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]); 80 penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]); 81 81 82 82 /*Create Load*/ … … 90 90 91 91 /*free ressources: */ 92 xfree((void**)&vertex_pairing); 93 xfree((void**)&nodeonbed); 94 92 xDelete<IssmDouble>(vertex_pairing); 93 xDelete<IssmDouble>(nodeonbed); 95 94 96 95 /*Assign output pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateNodesPrognostic.cpp
r10522 r12706 46 46 47 47 /*Check in 3d*/ 48 if(stabilization==3 && dim==3) _error _("DG 3d not implemented yet");48 if(stabilization==3 && dim==3) _error2_("DG 3d not implemented yet"); 49 49 50 50 /*First fetch data: */ … … 72 72 73 73 //Get index of the vertex on which the current node is located 74 vertex_id= (int)*(iomodel->Data(MeshElementsEnum)+3*i+j); //(Matlab indexing)74 vertex_id=reCast<int>(*(iomodel->Data(MeshElementsEnum)+3*i+j)); //(Matlab indexing) 75 75 io_index=vertex_id-1; //(C indexing) 76 76 _assert_(vertex_id>0 && vertex_id<=numberofvertices); -
issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
r12301 r12706 21 21 bool dakota_analysis; 22 22 bool ispdd; 23 bool issmbgradients; 23 24 24 25 /*Fetch data needed: */ … … 29 30 iomodel->FetchData(1,MeshElementsEnum); 30 31 iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum); 32 iomodel->Constant(&issmbgradients,SurfaceforcingsIssmbgradientsEnum); 31 33 32 34 /*Update elements: */ … … 73 75 iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum); 74 76 } 77 if(issmbgradients){ 78 iomodel->FetchDataToInput(elements,SurfaceforcingsHcEnum); 79 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMaxEnum); 80 iomodel->FetchDataToInput(elements,SurfaceforcingsSmbPosMinEnum); 81 iomodel->FetchDataToInput(elements,SurfaceforcingsAPosEnum); 82 iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum); 83 iomodel->FetchDataToInput(elements,SurfaceforcingsANegEnum); 84 iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum); 85 } 75 86 else{ 76 87 iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum); -
issm/trunk/src/c/modules/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
r10522 r12706 33 33 34 34 /*return if 2d mesh*/ 35 if (dim==2) _error _("2d meshes not supported yet");35 if (dim==2) _error2_("2d meshes not supported yet"); 36 36 37 37 //create penalties for nodes: no node can have a temperature over the melting point … … 43 43 /*keep only this partition's nodes:*/ 44 44 if((iomodel->my_vertices[i]==1)){ 45 if ( isnan(iomodel->Data(ThermalSpctemperatureEnum)[i])){ //No penalty applied on spc nodes!45 if (xIsNan<IssmDouble>(iomodel->Data(ThermalSpctemperatureEnum)[i])){ //No penalty applied on spc nodes! 46 46 loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,ThermalAnalysisEnum)); 47 47 } -
issm/trunk/src/c/modules/NodalValuex/NodalValuex.cpp
r12330 r12706 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void NodalValuex( double* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){12 void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units){ 13 13 14 14 extern int my_rank; … … 16 16 int index; 17 17 Element* element=NULL; 18 double value;18 IssmDouble value; 19 19 int found; 20 20 int sumfound; … … 38 38 #ifdef _HAVE_MPI_ 39 39 MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD); 40 if(!sumfound)_error _("%s%i%s%s","could not find element with vertex with id",index," to compute nodal value ",EnumToStringx(natureofdataenum));40 if(!sumfound)_error2_("could not find element with vertex with id" << index << " to compute nodal value " << EnumToStringx(natureofdataenum)); 41 41 #endif 42 42 -
issm/trunk/src/c/modules/NodalValuex/NodalValuex.h
r9206 r12706 10 10 11 11 /* local prototypes: */ 12 void NodalValuex( double* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units);12 void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units); 13 13 14 14 #endif /* _NODALVALUEX_H */ -
issm/trunk/src/c/modules/NodeConnectivityx/NodeConnectivityx.cpp
r6412 r12706 37 37 38 38 /*Allocate connectivity: */ 39 connectivity= (double*)xcalloc(nods*width,sizeof(double));39 connectivity=xNewZeroInit<double>(nods*width); 40 40 41 41 /*Go through all elements, and for each elements, plug into the connectivity, all the nodes. … … 71 71 * warn the user to increase the connectivity width: */ 72 72 for(i=0;i<nods;i++){ 73 if (*(connectivity+width*i+maxels)>maxels)_error _("%s%g%s"," max connectivity width reached (",*(connectivity+width*i+maxels),")! increase width of connectivity table");73 if (*(connectivity+width*i+maxels)>maxels)_error2_("max connectivity width reached (" << *(connectivity+width*i+maxels) << ")! increase width of connectivity table"); 74 74 } 75 75 -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r12330 r12706 16 16 #include "../../objects/objects.h" 17 17 18 void OutputResultsx( Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){18 void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){ 19 19 20 20 extern int my_rank; … … 46 46 EnumToStringx(&solutiontypestring,solutiontype); 47 47 results->AddObject(new StringExternalResult(results->Size()+1,SolutionTypeEnum,solutiontypestring,1,0)); 48 x free((void**)&solutiontypestring);48 xDelete<char>(solutiontypestring); 49 49 } 50 50 … … 68 68 fid=pfopen(cpu_outputfilename ,"wb"); 69 69 } 70 x free((void**)&outputfilename);70 xDelete<char>(outputfilename); 71 71 72 72 /*Add file pointer in parameters for further calls to OutputResultsx: */ -
issm/trunk/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp
r12330 r12706 27 27 28 28 /*intermediary: */ 29 double* analyses=NULL;29 IssmDouble* analyses=NULL; 30 30 char** strings=NULL; 31 31 int numanalyses; … … 48 48 49 49 /*Now, allocate analyses and strings: */ 50 analyses= (double*)xmalloc(numanalyses*sizeof(double));51 strings= (char**)xmalloc(numanalyses*sizeof(char*));50 analyses=xNew<IssmDouble>(numanalyses); 51 strings=xNew<char*>(numanalyses); 52 52 for(i=0;i<numanalyses;i++)strings[i]=NULL; 53 53 … … 70 70 to the already existing options*/ 71 71 if(strings[numanalyses-1]==NULL){ 72 string= (char*)xmalloc((strlen(line)+1)*sizeof(char));73 memcpy(string,line,(strlen(line)+1)*sizeof(char));72 string=xNew<char>((strlen(line)+1)); 73 xMemCpy<char>(string,line,(strlen(line)+1)); 74 74 75 75 strings[numanalyses-1]=string; … … 77 77 else{ 78 78 string=strings[numanalyses-1]; 79 newstring= (char*)xmalloc((strlen(line)+1)*sizeof(char));80 memcpy(newstring,line,(strlen(line)+1)*sizeof(char));79 newstring=xNew<char>((strlen(line)+1)); 80 xMemCpy<char>(newstring,line,(strlen(line)+1)); 81 81 82 82 /*concatenate:*/ 83 catstring= (char*)xmalloc((strlen(string)+1+strlen(newstring)+1+1)*sizeof(char)); //fit in a space " "84 memcpy(catstring,string,(strlen(string)+1)*sizeof(char));83 catstring=xNew<char>(strlen(string)+1+strlen(newstring)+1+1); //fit in a space " " 84 xMemCpy<char>(catstring,string,(strlen(string)+1)); 85 85 86 86 strcat(catstring," "); 87 87 strcat(catstring,newstring); 88 88 strings[numanalyses-1]=catstring; 89 x free((void**)&newstring);90 x free((void**)&string);89 xDelete<char>(newstring); 90 xDelete<char>(string); 91 91 } 92 92 } … … 98 98 MPI_Bcast(&numanalyses,1,MPI_INT,0,MPI_COMM_WORLD); 99 99 if(my_rank!=0){ 100 analyses= (double*)xmalloc(numanalyses*sizeof(double));101 strings= (char**)xmalloc(numanalyses*sizeof(char*));100 analyses=xNew<IssmPDouble>(numanalyses); 101 strings=xNew<char*>(numanalyses); 102 102 } 103 103 MPI_Bcast(analyses,numanalyses,MPI_DOUBLE,0,MPI_COMM_WORLD); … … 106 106 char* string=strings[i]; 107 107 if(my_rank==0){ 108 if(string==NULL) _error _("PETSc options for analysis %s have been declared but were not found",EnumToStringx((int)analyses[i]));108 if(string==NULL) _error2_("PETSc options for analysis " << EnumToStringx(reCast<int>(analyses[i])) << " have been declared but were not found"); 109 109 } 110 110 if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char); 111 111 #ifdef _HAVE_MPI_ 112 112 MPI_Bcast(&stringlength,1,MPI_INT,0,MPI_COMM_WORLD); 113 if(my_rank!=0)string= (char*)xmalloc(stringlength);113 if(my_rank!=0)string=xNew<char>(stringlength); 114 114 MPI_Bcast(string,stringlength,MPI_CHAR,0,MPI_COMM_WORLD); 115 115 if(my_rank!=0)strings[i]=string; … … 122 122 123 123 /*Clean up and return*/ 124 for(i=0;i<numanalyses;i++) x free((void**)&strings[i]);125 x free((void**)&strings);126 x free((void**)&analyses);124 for(i=0;i<numanalyses;i++) xDelete<char>(strings[i]); 125 xDelete<char*>(strings); 126 xDelete<IssmDouble>(analyses); 127 127 return; 128 128 } 129 -
issm/trunk/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp
r11995 r12706 39 39 40 40 /*allocate: */ 41 already= (bool*)xcalloc(nods,sizeof(bool));41 already=xNewZeroInit<bool>(nods); 42 42 43 43 /*partition loop across threads: */ … … 45 45 46 46 /*Loop over the nodes*/ 47 if (my_thread==0) printf(" loop progress: %5.2lf %%",0.0);48 49 47 for (i=i0;i<i1;i++){ 50 48 51 49 /*display current iteration*/ 52 if (my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nods*100*num_threads); 50 if (my_thread==0 && fmod((double)i,(double)100)==0) 51 _printString_("\r loop progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%"); 53 52 54 53 distance=mindistance+100; //make sure initialization respects min distance criterion. … … 70 69 } 71 70 } 72 if (my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0); 71 if (my_thread==0) 72 _printLine_("\r loop progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%"); 73 73 74 74 /*Free ressources:*/ 75 x free((void**)&already);75 xDelete<bool>(already); 76 76 77 77 return NULL; -
issm/trunk/src/c/modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp
r12346 r12706 23 23 24 24 int i, it, jj, itm; 25 double DT = 0.02, sigfac, snormfac;26 double signorm = 5.5; // signorm : sigma of the temperature distribution for a normal day27 double siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm28 double signormc = signorm - 0.5; // sigma of the temperature distribution for cloudy day29 double siglimc, siglim0, siglim0c;30 double tstep, tsint, tint, tstepc;25 IssmDouble DT = 0.02, sigfac, snormfac; 26 IssmDouble signorm = 5.5; // signorm : sigma of the temperature distribution for a normal day 27 IssmDouble siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm 28 IssmDouble signormc = signorm - 0.5; // sigma of the temperature distribution for cloudy day 29 IssmDouble siglimc, siglim0, siglim0c; 30 IssmDouble tstep, tsint, tint, tstepc; 31 31 int NPDMAX = 1504, NPDCMAX = 1454; 32 // double pdds[NPDMAX]={0};33 // double pds[NPDCMAX]={0};34 double pddt, pd ; // pd : snow/precip fraction, precipitation falling as snow35 double PDup, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)36 double tstar; // monthly mean surface temp32 //IssmDouble pdds[NPDMAX]={0}; 33 //IssmDouble pds[NPDCMAX]={0}; 34 IssmDouble pddt, pd ; // pd : snow/precip fraction, precipitation falling as snow 35 IssmDouble PDup, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C) 36 IssmDouble tstar; // monthly mean surface temp 37 37 38 double* pdds=NULL;39 double* pds=NULL;38 IssmDouble* pdds=NULL; 39 IssmDouble* pds=NULL; 40 40 Element* element = NULL; 41 41 42 pdds= (double*)xmalloc(NPDMAX*sizeof(double)+1);43 pds= (double*)xmalloc(NPDCMAX*sizeof(double)+1);42 pdds=xNew<IssmDouble>(NPDMAX+1); 43 pds=xNew<IssmDouble>(NPDCMAX+1); 44 44 45 45 // initialize PDD (creation of a lookup table) … … 54 54 PDup = siglimc+PDCUT; 55 55 56 itm = (int)(2*siglim/DT + 1.5);56 itm = reCast<int,IssmDouble>((2*siglim/DT + 1.5)); 57 57 58 58 if (itm >= NPDMAX){ 59 printf("increase NPDMAX in massBalance.cpp\n");59 _printLine_("increase NPDMAX in massBalance.cpp"); 60 60 exit (1); 61 61 } … … 81 81 snormfac = 1.0/(signormc*sqrt(2.0*acos(-1.0))); 82 82 siglimc = 2.5*signormc ; 83 itm = (int)((PDCUT+2.*siglimc)/DT + 1.5);83 itm = reCast<int,IssmDouble>((PDCUT+2.*siglimc)/DT + 1.5); 84 84 if (itm >= NPDCMAX){ 85 printf("'increase NPDCMAX in p35com'\n");85 _printLine_("'increase NPDCMAX in p35com'"); 86 86 exit (1); 87 87 } … … 106 106 } 107 107 /*free ressouces: */ 108 x free((void**)&pdds);109 x free((void**)&pds);108 xDelete<IssmDouble>(pdds); 109 xDelete<IssmDouble>(pds); 110 110 111 111 } -
issm/trunk/src/c/modules/Reduceloadx/Reduceloadx.cpp
r11995 r12706 22 22 int verbose; 23 23 24 _printf_(VerboseModule()," Dirichlet lifting applied to load vector\n");24 if(VerboseModule()) _pprintLine_(" Dirichlet lifting applied to load vector"); 25 25 26 26 Kfs->GetSize(&global_m,&global_n); -
issm/trunk/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp
r11995 r12706 15 15 int configuration_type; 16 16 int fsize; 17 double* ug_serial=NULL;17 IssmDouble* ug_serial=NULL; 18 18 19 19 /*first figure out fsize: */ … … 51 51 52 52 /*Free ressources:*/ 53 x free((void**)&ug_serial);53 xDelete<IssmDouble>(ug_serial); 54 54 55 55 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp
r11995 r12706 51 51 52 52 /*Free ressources:*/ 53 x free((void**)&yg_serial);53 xDelete<double>(yg_serial); 54 54 55 55 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/RequestedOutputsx/RequestedOutputsx.cpp
r11995 r12706 13 13 int output_enum; 14 14 int step; 15 double time;16 double output_value;15 IssmDouble time; 16 IssmDouble output_value; 17 17 Element *element = NULL; 18 18 -
issm/trunk/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp
r9761 r12706 22 22 23 23 /*Display message*/ 24 _printf_(VerboseModule()," Resetting penalties\n");24 if(VerboseModule()) _pprintLine_(" Resetting penalties"); 25 25 26 26 /*recover parameters: */ … … 30 30 * management routine, otherwise, skip : */ 31 31 if (RiftIsPresent(loads,analysis_type)){ 32 _error _("rift constraints reset not supported yet!");32 _error2_("rift constraints reset not supported yet!"); 33 33 } 34 34 else if(ThermalIsPresent(loads,analysis_type)){ -
issm/trunk/src/c/modules/Responsex/Responsex.cpp
r11237 r12706 16 16 #include "../modules.h" 17 17 18 void Responsex( double* responses,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index){18 void Responsex(IssmDouble* responses,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index){ 19 19 20 20 switch (StringToEnumx(response_descriptor)){ … … 46 46 case VelEnum:ElementResponsex(responses, elements,nodes, vertices, loads, materials, parameters,VelEnum,process_units); break; 47 47 case FrictionCoefficientEnum:NodalValuex(responses, FrictionCoefficientEnum,elements,nodes, vertices, loads, materials, parameters,process_units); break; 48 default: _error _(" response descriptor \"%s\" not supported yet!",response_descriptor); break;48 default: _error2_("response descriptor \"" << response_descriptor << "\" not supported yet!"); break; 49 49 #else 50 default: _error _("ISSM was not compiled with responses capabilities, exiting!");50 default: _error2_("ISSM was not compiled with responses capabilities, exiting!"); 51 51 #endif 52 52 } -
issm/trunk/src/c/modules/Responsex/Responsex.h
r11237 r12706 9 9 #include "../../Container/Container.h" 10 10 11 void Responsex( double* presponse,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index);11 void Responsex(IssmDouble* presponse,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,const char* response_descriptor,bool process_units,int weight_index); 12 12 13 13 #endif /* _RESPONSESXX_H */ -
issm/trunk/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp
r11995 r12706 25 25 } 26 26 27 x free((void**)&control_type);27 xDelete<int>(control_type); 28 28 } 29 29 … … 37 37 38 38 /*Free ressources:*/ 39 x free((void**)&serial_vector);39 xDelete<double>(serial_vector); 40 40 } -
issm/trunk/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp
r11527 r12706 39 39 int nshape,ncoord; 40 40 double cpsum; 41 int *pstype =NULL,*pnpart=NULL,**ppstrt=NULL,**pptype=NULL,*pnvert=NULL;42 double **pshapx=NULL,**pshapy=NULL,**pshapz=NULL,**pshapm=NULL;43 double *lat =NULL,*lon=NULL;41 int *pstype = NULL, *pnpart=NULL,**ppstrt=NULL,**pptype=NULL,*pnvert=NULL; 42 double **pshapx = NULL,**pshapy=NULL,**pshapz=NULL,**pshapm=NULL; 43 double *lat = NULL, *lon=NULL; 44 44 45 45 SHPHandle hSHP; … … 49 49 50 50 char indent[81]=""; 51 KML_File* kfile =NULL; 52 KML_Document* kdoc =NULL; 53 KML_Style* kstyle=NULL; 54 KML_LineStyle* klsty =NULL; 55 KML_PolyStyle* kpsty =NULL; 56 KML_Folder* kfold =NULL; 57 KML_Placemark* kplace=NULL; 58 KML_MultiGeometry* kmulti=NULL; 59 KML_Polygon* kpoly =NULL; 60 KML_LinearRing* kring =NULL; 61 KML_LineString* kline =NULL; 62 KML_Point* kpoint=NULL; 63 64 FILE* fid=NULL; 51 KML_File *kfile = NULL; 52 KML_Document *kdoc = NULL; 53 KML_Style *kstyle = NULL; 54 KML_LineStyle *klsty = NULL; 55 KML_PolyStyle *kpsty = NULL; 56 KML_Folder *kfold = NULL; 57 KML_Placemark *kplace = NULL; 58 KML_MultiGeometry *kmulti = NULL; 59 KML_Polygon *kpoly = NULL; 60 KML_LinearRing *kring = NULL; 61 KML_LineString *kline = NULL; 62 KML_Point *kpoint = NULL; 63 FILE *fid = NULL; 65 64 66 65 clock_t clock0,clock1; … … 69 68 clock0=clock(); 70 69 time0 =time(NULL); 71 _p rintf_(true,"\nShp2Kmlx Module -- %s",ctime(&time0));70 _pprintString_("\nShp2Kmlx Module -- " << ctime(&time0)); 72 71 73 72 /* note that much of the following code is taken from shpdump.c in shapelib. */ … … 76 75 77 76 hSHP = SHPOpen( filshp, "rb" ); 78 if (!hSHP) _error _("Error opening shp/shx files.");77 if (!hSHP) _error2_("Error opening shp/shx files."); 79 78 80 79 /* read header and print out file bounds */ … … 97 96 98 97 nshape=nEntities; 99 pstype= (int *) xmalloc(nshape*sizeof(int));100 pnpart= (int *) xmalloc(nshape*sizeof(int));101 ppstrt= (int **) xmalloc(nshape*sizeof(int *));102 pptype= (int **) xmalloc(nshape*sizeof(int *));103 pnvert= (int *) xmalloc(nshape*sizeof(int));104 pshapx= (double **) xmalloc(nshape*sizeof(double *));105 pshapy= (double **) xmalloc(nshape*sizeof(double *));106 pshapz= (double **) xmalloc(nshape*sizeof(double *));107 pshapm= (double **) xmalloc(nshape*sizeof(double *));98 pstype=xNew<int>(nshape); 99 pnpart=xNew<int>(nshape); 100 ppstrt=xNew<int*>(nshape); 101 pptype=xNew<int*>(nshape); 102 pnvert=xNew<int>(nshape); 103 pshapx=xNew<double*>(nshape); 104 pshapy=xNew<double*>(nshape); 105 pshapz=xNew<double*>(nshape); 106 pshapm=xNew<double*>(nshape); 108 107 109 108 /* loop over the list of shapes */ … … 129 128 pnpart[i]=psShape->nParts; 130 129 if (pnpart[i]) { 131 ppstrt[i]= (int *) xmalloc(pnpart[i]*sizeof(int));132 pptype[i]= (int *) xmalloc(pnpart[i]*sizeof(int));130 ppstrt[i]=xNew<int>(pnpart[i]); 131 pptype[i]=xNew<int>(pnpart[i]); 133 132 } 134 133 else { … … 138 137 pnvert[i]=psShape->nVertices; 139 138 if (pnvert[i]) { 140 pshapx[i]= (double *) xmalloc(pnvert[i]*sizeof(double));141 pshapy[i]= (double *) xmalloc(pnvert[i]*sizeof(double));142 pshapz[i]= (double *) xmalloc(pnvert[i]*sizeof(double));143 pshapm[i]= (double *) xmalloc(pnvert[i]*sizeof(double));139 pshapx[i]=xNew<double>(pnvert[i]); 140 pshapy[i]=xNew<double>(pnvert[i]); 141 pshapz[i]=xNew<double>(pnvert[i]); 142 pshapm[i]=xNew<double>(pnvert[i]); 144 143 } 145 144 else { … … 296 295 kpoint=new KML_Point(); 297 296 298 lat= (double *) xmalloc(pnvert[i]*sizeof(double));299 lon= (double *) xmalloc(pnvert[i]*sizeof(double));297 lat=xNew<double>(pnvert[i]); 298 lon=xNew<double>(pnvert[i]); 300 299 if (sgn) { 301 300 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 310 309 kpoint->coords[2]=pshapz[i][0]; 311 310 312 x free((void**)&lon);313 x free((void**)&lat);311 xDelete<double>(lon); 312 xDelete<double>(lat); 314 313 315 314 (kplace->geometry )->AddObject((Object*)kpoint); … … 337 336 /* convert to lat/lon, if necessary */ 338 337 339 lat= (double *) xmalloc(pnvert[i]*sizeof(double));340 lon= (double *) xmalloc(pnvert[i]*sizeof(double));338 lat=xNew<double>(pnvert[i]); 339 lon=xNew<double>(pnvert[i]); 341 340 if (sgn) { 342 341 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 353 352 354 353 kline->ncoord =(j<pnpart[i]-1 ? ppstrt[i][j+1]-ppstrt[i][j] : pnvert[i]-ppstrt[i][j]); 355 kline->coords = (double (*)[3]) xmalloc(kline->ncoord*3*sizeof(double));354 kline->coords =xNew<double>(kline->ncoord*3); 356 355 for (k=0; k<kline->ncoord; k++) { 357 kline->coords[ k][0]=lon [ppstrt[i][j]+k];358 kline->coords[ k][1]=lat [ppstrt[i][j]+k];359 kline->coords[ k][2]=pshapz[i][ppstrt[i][j]+k];356 kline->coords[3*k+0]=lon [ppstrt[i][j]+k]; 357 kline->coords[3*k+1]=lat [ppstrt[i][j]+k]; 358 kline->coords[3*k+2]=pshapz[i][ppstrt[i][j]+k]; 360 359 } 361 362 360 (kmulti->geometry )->AddObject((Object*)kline); 363 kline = NULL;364 } 365 366 x free((void**)&lon);367 x free((void**)&lat);368 369 (kplace->geometry )->AddObject((Object*)kmulti);361 kline = NULL; 362 } 363 364 xDelete<double>(lon); 365 xDelete<double>(lat); 366 367 (kplace->geometry)->AddObject((Object*)kmulti); 370 368 kmulti=NULL; 371 (kfold ->feature )->AddObject((Object*)kplace);369 (kfold ->feature )->AddObject((Object*)kplace); 372 370 kplace=NULL; 373 371 } … … 401 399 /* convert to lat/lon, if necessary */ 402 400 403 lat= (double *) xmalloc(pnvert[i]*sizeof(double));404 lon= (double *) xmalloc(pnvert[i]*sizeof(double));401 lat=xNew<double>(pnvert[i]); 402 lon=xNew<double>(pnvert[i]); 405 403 if (sgn) { 406 404 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 438 436 439 437 kring->ncoord =(j<pnpart[i]-1 ? ppstrt[i][j+1]-ppstrt[i][j] : pnvert[i]-ppstrt[i][j]); 440 kring->coords = (double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));438 kring->coords =xNew<double>(kring->ncoord*3); 441 439 if (cpsum < 0) 442 440 for (k=0; k<kring->ncoord; k++) { 443 kring->coords[ kring->ncoord-1-k][0]=lon [ppstrt[i][j]+k];444 kring->coords[ kring->ncoord-1-k][1]=lat [ppstrt[i][j]+k];445 kring->coords[ kring->ncoord-1-k][2]=pshapz[i][ppstrt[i][j]+k];441 kring->coords[3*(kring->ncoord-1-k)+0]=lon [ppstrt[i][j]+k]; 442 kring->coords[3*(kring->ncoord-1-k)+1]=lat [ppstrt[i][j]+k]; 443 kring->coords[3*(kring->ncoord-1-k)+2]=pshapz[i][ppstrt[i][j]+k]; 446 444 } 447 445 else 448 446 for (k=0; k<kring->ncoord; k++) { 449 kring->coords[ k ][0]=lon [ppstrt[i][j]+k];450 kring->coords[ k ][1]=lat [ppstrt[i][j]+k];451 kring->coords[ k ][2]=pshapz[i][ppstrt[i][j]+k];447 kring->coords[3*k+0]=lon [ppstrt[i][j]+k]; 448 kring->coords[3*k+1]=lat [ppstrt[i][j]+k]; 449 kring->coords[3*k+2]=pshapz[i][ppstrt[i][j]+k]; 452 450 } 453 451 … … 470 468 471 469 kring->ncoord =(j<pnpart[i]-1 ? ppstrt[i][j+1]-ppstrt[i][j] : pnvert[i]-ppstrt[i][j]); 472 kring->coords = (double (*)[3]) xmalloc(kring->ncoord*3*sizeof(double));470 kring->coords =xNew<double>(kring->ncoord*3); 473 471 for (k=0; k<kring->ncoord; k++) { 474 kring->coords[ k][0]=lon [ppstrt[i][j]+k];475 kring->coords[ k][1]=lat [ppstrt[i][j]+k];476 kring->coords[ k][2]=pshapz[i][ppstrt[i][j]+k];472 kring->coords[3*k+0]=lon [ppstrt[i][j]+k]; 473 kring->coords[3*k+1]=lat [ppstrt[i][j]+k]; 474 kring->coords[3*k+2]=pshapz[i][ppstrt[i][j]+k]; 477 475 } 478 476 … … 487 485 } 488 486 489 x free((void**)&lon);490 x free((void**)&lat);487 xDelete<double>(lon); 488 xDelete<double>(lat); 491 489 492 490 (kplace->geometry )->AddObject((Object*)kmulti); … … 518 516 /* convert to lat/lon, if necessary */ 519 517 520 lat= (double *) xmalloc(pnvert[i]*sizeof(double));521 lon= (double *) xmalloc(pnvert[i]*sizeof(double));518 lat=xNew<double>(pnvert[i]); 519 lon=xNew<double>(pnvert[i]); 522 520 if (sgn) { 523 521 Xy2llx(lat,lon,pshapx[i],pshapy[i],pnvert[i],sgn,cm,sp); … … 541 539 } 542 540 543 x free((void**)&lon);544 x free((void**)&lat);541 xDelete<double>(lon); 542 xDelete<double>(lat); 545 543 546 544 (kplace->geometry )->AddObject((Object*)kmulti); … … 575 573 /* write kml file */ 576 574 577 _p rintf_(true,"Writing kml document to file.\n");575 _pprintLine_("Writing kml document to file."); 578 576 fid=fopen(filkml,"w"); 579 577 fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); … … 583 581 delete kfile; 584 582 for (i=nshape-1; i>=0; i--) { 585 x free((void**)&(pshapm[i]));586 x free((void**)&(pshapz[i]));587 x free((void**)&(pshapy[i]));588 x free((void**)&(pshapx[i]));589 } 590 x free((void**)&pshapm);591 x free((void**)&pshapz);592 x free((void**)&pshapy);593 x free((void**)&pshapx);594 x free((void**)&pnvert);583 xDelete<double>((pshapm[i])); 584 xDelete<double>((pshapz[i])); 585 xDelete<double>((pshapy[i])); 586 xDelete<double>((pshapx[i])); 587 } 588 xDelete<double*>(pshapm); 589 xDelete<double*>(pshapz); 590 xDelete<double*>(pshapy); 591 xDelete<double*>(pshapx); 592 xDelete<int>(pnvert); 595 593 for (i=nshape-1; i>=0; i--) { 596 x free((void**)&(pptype[i]));597 x free((void**)&(ppstrt[i]));598 } 599 x free((void**)&pptype);600 x free((void**)&ppstrt);601 x free((void**)&pnpart);602 x free((void**)&pstype);594 xDelete<int>((pptype[i])); 595 xDelete<int>((ppstrt[i])); 596 } 597 xDelete<int*>(pptype); 598 xDelete<int*>(ppstrt); 599 xDelete<int>(pnpart); 600 xDelete<int>(pstype); 603 601 604 602 clock1=clock(); -
issm/trunk/src/c/modules/Solverx/DofTypesToIndexSet.cpp
r9826 r12706 20 20 21 21 int start,end; 22 double* df_local=NULL;22 IssmDouble* df_local=NULL; 23 23 int df_local_size; 24 24 int i; … … 46 46 47 47 /*Allocate indices: */ 48 if(pressure_num)pressure_indices= (int*)xmalloc(pressure_num*sizeof(int));49 if(velocity_num)velocity_indices= (int*)xmalloc(velocity_num*sizeof(int));48 if(pressure_num)pressure_indices=xNew<int>(pressure_num); 49 if(velocity_num)velocity_indices=xNew<int>(velocity_num); 50 50 51 51 pressure_count=0; … … 74 74 75 75 /*Free ressources:*/ 76 x free((void**)&pressure_indices);77 x free((void**)&velocity_indices);76 xDelete<int>(pressure_indices); 77 xDelete<int>(velocity_indices); 78 78 79 79 /*Assign output pointers:*/ -
issm/trunk/src/c/modules/Solverx/Solverx.cpp
r12330 r12706 55 55 56 56 #else 57 _error _("GSL support not compiled in!");57 _error2_("GSL support not compiled in!"); 58 58 #endif 59 59 #endif -
issm/trunk/src/c/modules/Solverx/Solverx.h
r11995 r12706 19 19 #ifdef _HAVE_PETSC_ 20 20 void SolverxPetsc(Vec* puf, Mat Kff, Vec pf, Vec uf0,Vec df, Parameters* parameters); 21 void DofTypesToIndexSet(IS* pisv, IS* pisp, Vec df,int typeenum);21 void DofTypesToIndexSet(IS* pisv, IS* pisp, Vec df,int typeenum); 22 22 #endif 23 23 24 24 #ifdef _HAVE_GSL_ 25 void SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf); 25 void SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf); 26 void SolverxGsl(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n); 26 27 #endif 27 28 -
issm/trunk/src/c/modules/Solverx/SolverxGsl.cpp
r11995 r12706 2 2 * \brief Gsl implementation of solver 3 3 */ 4 5 #ifdef HAVE_CONFIG_H 6 #include <config.h> 7 #else 8 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 9 #endif 10 #include <cstring> 11 #include <gsl/gsl_linalg.h> 4 12 5 13 #include "./Solverx.h" … … 8 16 #include "../../io/io.h" 9 17 10 #ifdef HAVE_CONFIG_H 11 #include <config.h> 12 #else 13 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 14 #endif 15 16 #include <gsl/gsl_linalg.h> 17 18 void SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf){ 19 20 /*intermediary: */ 21 SeqMat* KffCopy=NULL; 22 23 /*Output: */ 24 SeqVec* uf = NULL; 25 26 27 /*GSL Matrices and vectors: */ 28 gsl_matrix_view m; 29 gsl_vector_view b; 30 gsl_vector* x=NULL; 31 gsl_permutation* p=NULL; 32 33 /*We are going to do an in place LU decomp, so we need to save the matrix with its original structure: */ 34 KffCopy=Kff->Duplicate(); 35 18 void SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf){/*{{{*/ 36 19 37 20 /*Intermediary: */ 38 21 int M,N,N2,s; 22 SeqVec *uf = NULL; 23 IssmDouble *x = NULL; 39 24 40 25 Kff->GetSize(&M,&N); 41 26 pf->GetSize(&N2); 42 27 43 if(N!=N2)_error_("Right hand side vector of size %i, when matrix is of size %i-%i !",N2,M,N); 44 if(M!=N)_error_("Stiffness matrix should be square!"); 28 if(N!=N2)_error2_("Right hand side vector of size " << N2 << ", when matrix is of size " << M << "-" << N << " !"); 29 if(M!=N)_error2_("Stiffness matrix should be square!"); 30 31 SolverxGsl(&x,Kff->matrix,pf->vector,N); 32 uf=new SeqVec(x,N); 33 34 /*Assign output pointers:*/ 35 *puf=uf; 36 }/*}}}*/ 37 void SolverxGsl(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n){/*{{{*/ 38 39 /*GSL Matrices and vectors: */ 40 int s; 41 gsl_matrix_view a; 42 gsl_vector_view b; 43 gsl_vector *x = NULL; 44 gsl_permutation *p = NULL; 45 #ifdef _HAVE_ADOLC_ 46 // if we use Adol-C then the IssmDouble will be an adouble 47 // and the calls to gsl_... will not work 48 // and we should call a suitable wrapped solve instead 49 _error2_("SolverxGsl: should not be here with Adol-C"); 50 #else 51 /*A will be modified by LU decomposition. Use copy*/ 52 IssmDouble* Acopy = xNew<IssmDouble>(n*n); 53 xMemCpy<IssmDouble>(Acopy,A,n*n); 45 54 46 55 /*Initialize gsl matrices and vectors: */ 47 m = gsl_matrix_view_array (KffCopy->matrix, M, N);48 b = gsl_vector_view_array ( pf->vector, N);49 x = gsl_vector_alloc ( N);56 a = gsl_matrix_view_array (Acopy,n,n); 57 b = gsl_vector_view_array (B,n); 58 x = gsl_vector_alloc (n); 50 59 51 60 /*Run LU and solve: */ 52 p = gsl_permutation_alloc ( N);53 gsl_linalg_LU_decomp (& m.matrix, p, &s);54 gsl_linalg_LU_solve (& m.matrix, p, &b.vector, x);61 p = gsl_permutation_alloc (n); 62 gsl_linalg_LU_decomp (&a.matrix, p, &s); 63 gsl_linalg_LU_solve (&a.matrix, p, &b.vector, x); 55 64 56 65 //printf ("x = \n"); 57 66 //gsl_vector_fprintf (stdout, x, "%g"); 58 67 59 /*Get uf initialized with the results: */ 60 uf=new SeqVec(gsl_vector_ptr(x,0),M); 68 /*Copy result*/ 69 IssmDouble* X = xNew<IssmDouble>(n); 70 memcpy(X,gsl_vector_ptr(x,0),n*sizeof(IssmDouble)); 61 71 62 /*Free resources:*/ 63 gsl_permutation_free (p); 64 gsl_vector_free (x); 65 66 delete KffCopy; 67 68 69 /*Assign output pointers:*/ 70 *puf=uf; 71 } 72 /*Clean up and assign output pointer*/ 73 xDelete<IssmDouble>(Acopy); 74 gsl_permutation_free(p); 75 gsl_vector_free(x); 76 *pX=X; 77 #endif 78 }/*}}}*/ -
issm/trunk/src/c/modules/Solverx/SolverxPetsc.cpp
r12330 r12706 44 44 45 45 /*Display message*/ 46 _printf_(VerboseModule()," Solving\n");46 if(VerboseModule()) _pprintLine_(" Solving"); 47 47 #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2) 48 48 if(VerboseSolver())PetscOptionsPrint(stdout); … … 81 81 #if _PETSC_MAJOR_ >=3 82 82 #ifndef _HAVE_MUMPS_ 83 _error _("requested MUMPS solver, which was not compiled into ISSM!\n");83 _error2_("requested MUMPS solver, which was not compiled into ISSM!\n"); 84 84 #endif 85 85 #endif … … 105 105 if (solver_type==StokesSolverEnum){ 106 106 /*Make indices out of doftypes: */ 107 if(!df)_error _("need doftypes for Stokes solver!\n");107 if(!df)_error2_("need doftypes for Stokes solver!\n"); 108 108 DofTypesToIndexSet(&isv,&isp,df,StokesSolverEnum); 109 109 … … 136 136 /*Check convergence*/ 137 137 KSPGetIterationNumber(ksp,&iteration_number); 138 if (iteration_number<0) _error _("%s%i"," Solver diverged at iteration number: ",-iteration_number);138 if (iteration_number<0) _error2_("Solver diverged at iteration number: " << -iteration_number); 139 139 140 140 /*Free resources:*/ -
issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
r12347 r12706 158 158 else if (strcmp(name,"SettingsResultsAsPatches")==0) return SettingsResultsAsPatchesEnum; 159 159 else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum; 160 else if (strcmp(name,"DebugP etscProfiling")==0) return DebugPetscProfilingEnum;161 else if (strcmp(name,"P etscProfilingCurrentMem")==0) return PetscProfilingCurrentMemEnum;162 else if (strcmp(name,"P etscProfilingCurrentFlops")==0) return PetscProfilingCurrentFlopsEnum;163 else if (strcmp(name,"P etscProfilingSolutionTime")==0) return PetscProfilingSolutionTimeEnum;160 else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum; 161 else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum; 162 else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum; 163 else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum; 164 164 else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum; 165 165 else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum; … … 171 171 else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum; 172 172 else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum; 173 else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum; 173 174 else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum; 175 else if (strcmp(name,"SurfaceforcingsHc")==0) return SurfaceforcingsHcEnum; 176 else if (strcmp(name,"SurfaceforcingsSmbPosMax")==0) return SurfaceforcingsSmbPosMaxEnum; 177 else if (strcmp(name,"SurfaceforcingsSmbPosMin")==0) return SurfaceforcingsSmbPosMinEnum; 178 else if (strcmp(name,"SurfaceforcingsAPos")==0) return SurfaceforcingsAPosEnum; 179 else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum; 180 else if (strcmp(name,"SurfaceforcingsANeg")==0) return SurfaceforcingsANegEnum; 181 else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum; 174 182 else if (strcmp(name,"ThermalMaxiter")==0) return ThermalMaxiterEnum; 175 183 else if (strcmp(name,"ThermalPenaltyFactor")==0) return ThermalPenaltyFactorEnum; … … 253 261 else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum; 254 262 else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum; 255 else if (strcmp(name,"Element")==0) return ElementEnum; 263 else stage=3; 264 } 265 if(stage==3){ 266 if (strcmp(name,"Element")==0) return ElementEnum; 256 267 else if (strcmp(name,"ElementResult")==0) return ElementResultEnum; 257 268 else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum; … … 261 272 else if (strcmp(name,"Input")==0) return InputEnum; 262 273 else if (strcmp(name,"IntInput")==0) return IntInputEnum; 263 else stage=3; 264 } 265 if(stage==3){ 266 if (strcmp(name,"IntParam")==0) return IntParamEnum; 274 else if (strcmp(name,"IntParam")==0) return IntParamEnum; 267 275 else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum; 268 276 else if (strcmp(name,"MacAyeal2dIceFront")==0) return MacAyeal2dIceFrontEnum; … … 376 384 else if (strcmp(name,"QmuTemperature")==0) return QmuTemperatureEnum; 377 385 else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum; 378 else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum; 386 else stage=4; 387 } 388 if(stage==4){ 389 if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum; 379 390 else if (strcmp(name,"StressTensor")==0) return StressTensorEnum; 380 391 else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum; … … 384 395 else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum; 385 396 else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum; 386 else stage=4; 387 } 388 if(stage==4){ 389 if (strcmp(name,"IceVolume")==0) return IceVolumeEnum; 397 else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum; 390 398 else if (strcmp(name,"P0")==0) return P0Enum; 391 399 else if (strcmp(name,"P1")==0) return P1Enum; … … 470 478 } 471 479 /*If we reach this point, the string provided has not been found*/ 472 _error_("Enum %s not found",name);480 _error2_("Enum " << name << " not found"); 473 481 } -
issm/trunk/src/c/modules/SurfaceAreax/SurfaceAreax.cpp
r12330 r12706 11 11 #include "../InputUpdateFromConstantx/InputUpdateFromConstantx.h" 12 12 13 void SurfaceAreax( double* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){13 void SurfaceAreax( IssmDouble* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){ 14 14 15 15 /*Intermediary*/ … … 18 18 19 19 /*output: */ 20 double S=0;21 double S_sum;20 IssmDouble S=0; 21 IssmDouble S_sum; 22 22 23 23 /*Compute gradients: */ -
issm/trunk/src/c/modules/SurfaceAreax/SurfaceAreax.h
r4236 r12706 10 10 11 11 /* local prototypes: */ 12 void SurfaceAreax( double* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);12 void SurfaceAreax( IssmDouble* pS, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters); 13 13 14 14 #endif /* _SURFACEAREAX_H */ -
issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
r11995 r12706 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){ 13 13 14 14 /*intermediary: */ … … 25 25 Vector* pf = NULL; 26 26 Vector* df=NULL; 27 double kmax = 0;27 IssmDouble kmax = 0; 28 28 29 29 /*Display message*/ 30 _printf_(VerboseModule()," Generating matrices\n");30 if(VerboseModule()) _pprintLine_(" Generating matrices"); 31 31 32 32 /*retrive parameters: */ … … 41 41 numberofdofspernode=nodes->MaxNumDofs(configuration_type,GsetEnum); 42 42 43 /*Checks in debugging mode {{{ 1*/43 /*Checks in debugging mode {{{*/ 44 44 if(penalty_kflag)_assert_(kflag); 45 45 if(penalty_pflag)_assert_(pflag); -
issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.h
r11995 r12706 10 10 11 11 /* local prototypes: */ 12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, 13 13 bool kflag=true,bool pflag=true,bool penalty_kflag=true,bool penalty_pflag=true); 14 14 -
issm/trunk/src/c/modules/TimeAdaptx/TimeAdaptx.cpp
r12330 r12706 10 10 #include "../../Container/Container.h" 11 11 12 void TimeAdaptx( double* pdt, Elements* elements, Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters){12 void TimeAdaptx(IssmDouble* pdt, Elements* elements, Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters){ 13 13 14 14 int i; 15 15 16 16 /*output: */ 17 double dt;17 IssmDouble dt; 18 18 19 19 /*intermediary: */ 20 20 Element *element = NULL; 21 double min_dt = 0;22 double node_min_dt = 0;21 IssmDouble min_dt = 0; 22 IssmDouble node_min_dt = 0; 23 23 24 24 /*Go through elements, and figure out the minimum of the time steps for each element (using CFL criterion): */ -
issm/trunk/src/c/modules/TimeAdaptx/TimeAdaptx.h
r6130 r12706 9 9 10 10 /* local prototypes: */ 11 void TimeAdaptx( double* pdt, Elements* elements, Nodes* nodes,Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters);11 void TimeAdaptx(IssmDouble* pdt, Elements* elements, Nodes* nodes,Vertices* vertices,Loads* loads, Materials* materials, Parameters* parameters); 12 12 13 13 #endif /* _TIMEADAPTX_H */ -
issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp
r12330 r12706 57 57 58 58 /*fill in the point list: */ 59 in.pointlist = (REAL *) xmalloc(in.numberofpoints * 2 * sizeof(REAL));59 in.pointlist = xNew<REAL>(in.numberofpoints*2); 60 60 61 61 counter=0; … … 78 78 79 79 /*fill in the point attribute list: */ 80 in.pointattributelist = (REAL*)xmalloc(in.numberofpoints*in.numberofpointattributes*sizeof(REAL));80 in.pointattributelist = xNew<REAL>(in.numberofpoints*in.numberofpointattributes); 81 81 for (i=0;i<in.numberofpoints;i++) in.pointattributelist[i] = 0.0; 82 82 83 83 /*fill in the point marker list: */ 84 in.pointmarkerlist = (int *) xmalloc(in.numberofpoints * sizeof(int));84 in.pointmarkerlist = xNew<int>(in.numberofpoints); 85 85 for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0; 86 86 … … 97 97 } 98 98 99 in.segmentlist = (int *) xmalloc(in.numberofsegments * 2 * sizeof(int));100 in.segmentmarkerlist = (int *) xcalloc(in.numberofsegments,sizeof(int));99 in.segmentlist = xNew<int>(in.numberofsegments*2); 100 in.segmentmarkerlist = xNewZeroInit<int>(in.numberofsegments); 101 101 counter=0; 102 102 backcounter=0; … … 135 135 in.numberofholes = domain->Size()-1; /*everything is a hole, but for the first profile.*/ 136 136 if(in.numberofholes){ 137 in.holelist = (REAL *) xmalloc(in.numberofholes * 2 * sizeof(REAL));137 in.holelist = xNew<REAL>(in.numberofholes*2); 138 138 for (i=0;i<domain->Size()-1;i++){ 139 139 contour=(Contour*)domain->GetObjectByOffset(i+1); … … 164 164 165 165 /*Allocate index, x and y: */ 166 index= (double*)xmalloc(3*out.numberoftriangles*sizeof(double));167 x= (double*)xmalloc(out.numberofpoints*sizeof(double));168 y= (double*)xmalloc(out.numberofpoints*sizeof(double));169 segments= (double*)xmalloc(3*out.numberofsegments*sizeof(double));170 segmentmarkerlist= (double*)xmalloc(out.numberofsegments*sizeof(double));166 index=xNew<double>(3*out.numberoftriangles); 167 x=xNew<double>(out.numberofpoints); 168 y=xNew<double>(out.numberofpoints); 169 segments=xNew<double>(3*out.numberofsegments); 170 segmentmarkerlist=xNew<double>(out.numberofsegments); 171 171 172 172 for (i = 0; i< out.numberoftriangles; i++) { -
issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.cpp
r8303 r12706 13 13 using namespace std; 14 14 15 void TriaSearchx(double** ptria, double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){15 void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){ 16 16 17 17 /*Output*/ … … 19 19 20 20 /*allocate: */ 21 tria= (double*)xmalloc(numberofnodes*sizeof(double));21 tria=xNew<double>(numberofnodes); 22 22 23 23 /*Intermediary*/ … … 52 52 } 53 53 54 55 54 /*Assign output pointers:*/ 56 55 *ptria=tria; -
issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.h
r8303 r12706 9 9 10 10 /* local prototypes: */ 11 void TriaSearchx(double** ptria, double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes);11 void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes); 12 12 13 13 #endif -
issm/trunk/src/c/modules/UpdateConstraintsx/UpdateConstraintsx.cpp
r9761 r12706 14 14 void UpdateConstraintsx(Nodes* nodes,Constraints* constraints,Parameters* parameters){ 15 15 16 double time;16 IssmDouble time; 17 17 int analysis_type; 18 18 … … 22 22 23 23 /*start module: */ 24 _printf_(VerboseModule(),"%s%g\n"," Updating constraints for time: ",time);24 if(VerboseModule()) _pprintLine_(" Updating constraints for time: " << time); 25 25 26 26 /*First, update dof constraints in nodes, using constraints: */ -
issm/trunk/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp
r11995 r12706 13 13 14 14 int configuration_type; 15 double* yg_serial=NULL;15 IssmDouble* yg_serial=NULL; 16 16 17 17 /*Get current configuration*/ … … 34 34 35 35 /*Free ressources:*/ 36 x free((void**)&yg_serial);36 xDelete<IssmDouble>(yg_serial); 37 37 } -
issm/trunk/src/c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp
r11995 r12706 15 15 Vector* vz = NULL; 16 16 Vertex *vertex = NULL; 17 double *thickness = NULL;18 double *bed = NULL;17 IssmDouble *thickness = NULL; 18 IssmDouble *bed = NULL; 19 19 20 20 /*get vertex vectors for bed and thickness: */ … … 38 38 39 39 /*Free ressources:*/ 40 x free((void**)&thickness);41 x free((void**)&bed);40 xDelete<IssmDouble>(thickness); 41 xDelete<IssmDouble>(bed); 42 42 xdelete(&vz); 43 43 return 1; -
issm/trunk/src/c/modules/VecMergex/VecMergex.cpp
r11995 r12706 15 15 int i; 16 16 int configuration_type; 17 double* uf_serial=NULL;17 IssmDouble* uf_serial=NULL; 18 18 19 19 /*retrieve parameters: */ … … 41 41 } 42 42 /*Free ressources:*/ 43 x free((void**)&uf_serial);43 xDelete<IssmDouble>(uf_serial); 44 44 45 45 /*Assemble vector: */ -
issm/trunk/src/c/modules/Xy2llx/Xy2llx.cpp
r9761 r12706 53 53 double sl,rho,cm,T,chi; 54 54 55 if((sgn!=1) && (sgn!=-1)) _error _("Sign should be either +1 or -1.\n");55 if((sgn!=1) && (sgn!=-1)) _error2_("Sign should be either +1 or -1.\n"); 56 56 57 57 delta = central_meridian; … … 124 124 *pdelta= 45; 125 125 *pslat = 70; 126 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n");126 if(flag) _pprintLine_("Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45)."); 127 127 } 128 128 else if (sgn == -1) { 129 129 *pdelta= 0; 130 130 *pslat = 71; 131 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n");131 if(flag) _pprintLine_("Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0)."); 132 132 } 133 else _error _("Sign should be either +1 or -1.\n");133 else _error2_("Sign should be either +1 or -1.\n"); 134 134 135 135 return; -
issm/trunk/src/c/modules/modules.h
r12330 r12706 106 106 #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h" 107 107 #include "./Scotchx/Scotchx.h" 108 #include "./SmbGradientsx/SmbGradientsx.h" 108 109 #include "./Solverx/Solverx.h" 109 110 #include "./SpcNodesx/SpcNodesx.h" -
issm/trunk/src/c/objects/Bamg/AdjacentTriangle.cpp
r5401 r12706 14 14 15 15 /*Methods*/ 16 /*FUNCTION AdjacentTriangle::Locked {{{ 1*/16 /*FUNCTION AdjacentTriangle::Locked {{{*/ 17 17 int AdjacentTriangle::Locked() const { 18 18 return t->AdjEdgeIndex[a] & 4; 19 19 } 20 20 /*}}}*/ 21 /*FUNCTION AdjacentTriangle::MarkUnSwap {{{ 1*/21 /*FUNCTION AdjacentTriangle::MarkUnSwap {{{*/ 22 22 int AdjacentTriangle::MarkUnSwap() const { 23 23 return t->AdjEdgeIndex[a] & 8; 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION AdjacentTriangle::GetAllFlag_UnSwap {{{ 1*/26 /*FUNCTION AdjacentTriangle::GetAllFlag_UnSwap {{{*/ 27 27 int AdjacentTriangle::GetAllFlag_UnSwap() const { 28 28 // take all flag except MarkUnSwap … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION AdjacentTriangle::SetLock {{{ 1*/32 /*FUNCTION AdjacentTriangle::SetLock {{{*/ 33 33 void AdjacentTriangle::SetLock(){ 34 34 t->SetLocked(a); 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION AdjacentTriangle::Adj {{{ 1*/37 /*FUNCTION AdjacentTriangle::Adj {{{*/ 38 38 AdjacentTriangle AdjacentTriangle::Adj() const { 39 39 return t->Adj(a); 40 40 } 41 41 /*}}}*/ 42 /*FUNCTION AdjacentTriangle::EdgeVertex {{{ 1*/42 /*FUNCTION AdjacentTriangle::EdgeVertex {{{*/ 43 43 BamgVertex* AdjacentTriangle::EdgeVertex(const int & i) const { 44 44 return t->vertices[VerticesOfTriangularEdge[a][i]]; 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION AdjacentTriangle::OppositeVertex {{{ 1*/47 /*FUNCTION AdjacentTriangle::OppositeVertex {{{*/ 48 48 BamgVertex* AdjacentTriangle::OppositeVertex() const { 49 49 return t->vertices[bamg::OppositeVertex[a]]; 50 50 } 51 51 /*}}}*/ 52 /*FUNCTION AdjacentTriangle::det {{{ 1*/52 /*FUNCTION AdjacentTriangle::det {{{*/ 53 53 Icoor2 & AdjacentTriangle::det() const { 54 54 return t->det; 55 55 } 56 56 /*}}}*/ 57 /*FUNCTION AdjacentTriangle::swap {{{ 1*/57 /*FUNCTION AdjacentTriangle::swap {{{*/ 58 58 int AdjacentTriangle::swap(){ 59 59 return t->swap(a); 60 60 } 61 61 /*}}}*/ 62 /*FUNCTION AdjacentTriangle::SetAdj2 {{{ 1*/62 /*FUNCTION AdjacentTriangle::SetAdj2 {{{*/ 63 63 void AdjacentTriangle::SetAdj2(const AdjacentTriangle & ta, int l ){ 64 64 //set Adjacent Triangle of a triangle -
issm/trunk/src/c/objects/Bamg/BamgGeom.cpp
r12330 r12706 5 5 6 6 /*Constructors/Destructors*/ 7 /*FUNCTION BamgGeom::BamgGeom(){{{ 1*/7 /*FUNCTION BamgGeom::BamgGeom(){{{*/ 8 8 BamgGeom::BamgGeom(){ 9 9 … … 19 19 } 20 20 /*}}}*/ 21 /*FUNCTION BamgGeom::~BamgGeom(){{{ 1*/21 /*FUNCTION BamgGeom::~BamgGeom(){{{*/ 22 22 BamgGeom::~BamgGeom(){ 23 23 24 x free((void**)&this->Vertices);25 x free((void**)&this->Edges);26 x free((void**)&this->TangentAtEdges);27 x free((void**)&this->Corners);28 x free((void**)&this->RequiredVertices);29 x free((void**)&this->RequiredEdges);30 x free((void**)&this->CrackedEdges);31 x free((void**)&this->SubDomains);24 xDelete<double>(this->Vertices); 25 xDelete<double>(this->Edges); 26 xDelete<double>(this->TangentAtEdges); 27 xDelete<double>(this->Corners); 28 xDelete<double>(this->RequiredVertices); 29 xDelete<double>(this->RequiredEdges); 30 xDelete<double>(this->CrackedEdges); 31 xDelete<double>(this->SubDomains); 32 32 33 33 } -
issm/trunk/src/c/objects/Bamg/BamgMesh.cpp
r12330 r12706 5 5 6 6 /*Constructors/Destructors*/ 7 /*FUNCTION BamgMesh::BamgMesh(){{{ 1*/7 /*FUNCTION BamgMesh::BamgMesh(){{{*/ 8 8 BamgMesh::BamgMesh(){ 9 9 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION BamgMesh::~BamgMesh(){{{ 1*/32 /*FUNCTION BamgMesh::~BamgMesh(){{{*/ 33 33 BamgMesh::~BamgMesh(){ 34 34 35 x free((void**)&this->Vertices);36 x free((void**)&this->Edges);37 x free((void**)&this->Triangles);38 x free((void**)&this->Quadrilaterals);35 xDelete<double>(this->Vertices); 36 xDelete<double>(this->Edges); 37 xDelete<double>(this->Triangles); 38 xDelete<double>(this->Quadrilaterals); 39 39 40 x free((void**)&this->SubDomains);41 x free((void**)&this->SubDomainsFromGeom);42 x free((void**)&this->CrackedVertices);43 x free((void**)&this->CrackedEdges);40 xDelete<double>(this->SubDomains); 41 xDelete<double>(this->SubDomainsFromGeom); 42 xDelete<double>(this->CrackedVertices); 43 xDelete<double>(this->CrackedEdges); 44 44 45 x free((void**)&this->VerticesOnGeomVertex);46 x free((void**)&this->VerticesOnGeomEdge);47 x free((void**)&this->EdgesOnGeomEdge);45 xDelete<double>(this->VerticesOnGeomVertex); 46 xDelete<double>(this->VerticesOnGeomEdge); 47 xDelete<double>(this->EdgesOnGeomEdge); 48 48 49 x free((void**)&this->IssmEdges);50 x free((void**)&this->IssmSegments);49 xDelete<double>(this->IssmEdges); 50 xDelete<double>(this->IssmSegments); 51 51 52 xfree((void**)&this->ElementConnectivity); 53 xfree((void**)&this->NodalConnectivity); 54 xfree((void**)&this->NodalElementConnectivity); 55 56 52 xDelete<double>(this->ElementConnectivity); 53 xDelete<double>(this->NodalConnectivity); 54 xDelete<double>(this->NodalElementConnectivity); 57 55 } 58 56 /*}}}*/ -
issm/trunk/src/c/objects/Bamg/BamgOpts.cpp
r12330 r12706 6 6 7 7 /*Constructors/Destructors*/ 8 /*FUNCTION BamgOpts::BamgOpts() {{{ 1*/8 /*FUNCTION BamgOpts::BamgOpts() {{{*/ 9 9 BamgOpts::BamgOpts(){ 10 10 … … 41 41 } 42 42 /*}}}*/ 43 /*FUNCTION BamgOpts::~BamgOpts() {{{ 1*/43 /*FUNCTION BamgOpts::~BamgOpts() {{{*/ 44 44 BamgOpts::~BamgOpts(){ 45 45 46 x free((void**)&this->hminVertices);47 x free((void**)&this->hmaxVertices);48 x free((void**)&this->hVertices);49 x free((void**)&this->metric);50 x free((void**)&this->field);51 x free((void**)&this->err);46 xDelete<double>(this->hminVertices); 47 xDelete<double>(this->hmaxVertices); 48 xDelete<double>(this->hVertices); 49 xDelete<double>(this->metric); 50 xDelete<double>(this->field); 51 xDelete<double>(this->err); 52 52 53 53 } … … 55 55 56 56 /*Methods*/ 57 /*FUNCTION BamgOpts::Check{{{ 1*/57 /*FUNCTION BamgOpts::Check{{{*/ 58 58 void BamgOpts::Check(void){ 59 59 60 60 int i; 61 61 62 if (this->anisomax<1) _error _("'anisomax' option should be >=1");63 if (this->coeff==0) _error _("'coeff' should be positive");64 if (this->errg<0) _error _("'errg' option should be >0");65 if (this->gradation<1) _error _("'gradation' option should be >=1");66 if (this->Hessiantype!=0 && this->Hessiantype!=1) _error _("'Hessiantype' supported options are 0 and 1");67 if (this->maxnbv<3) _error _("'maxnbv' option should be >3");68 if (this->maxsubdiv<=1) _error _("'maxsubdiv' should be >1");69 if (this->Metrictype!=0 && this->Metrictype!=1 && this->Metrictype!=2) _error _("'Metrictype' supported options are 0, 1 and 2");70 if (this->nbjacobi<=0) _error _("'nbjacobi' option should be >0");71 if (this->nbsmooth<=0) _error _("'nbsmooth' option should be >0");62 if (this->anisomax<1) _error2_("'anisomax' option should be >=1"); 63 if (this->coeff==0) _error2_("'coeff' should be positive"); 64 if (this->errg<0) _error2_("'errg' option should be >0"); 65 if (this->gradation<1) _error2_("'gradation' option should be >=1"); 66 if (this->Hessiantype!=0 && this->Hessiantype!=1) _error2_("'Hessiantype' supported options are 0 and 1"); 67 if (this->maxnbv<3) _error2_("'maxnbv' option should be >3"); 68 if (this->maxsubdiv<=1) _error2_("'maxsubdiv' should be >1"); 69 if (this->Metrictype!=0 && this->Metrictype!=1 && this->Metrictype!=2) _error2_("'Metrictype' supported options are 0, 1 and 2"); 70 if (this->nbjacobi<=0) _error2_("'nbjacobi' option should be >0"); 71 if (this->nbsmooth<=0) _error2_("'nbsmooth' option should be >0"); 72 72 73 if (this->Crack!=0 && this->Crack!=1) _error _("'Crack' supported options are 0 and 1");74 if (this->KeepVertices!=0 && this->KeepVertices!=1) _error _("'KeepVertices' supported options are 0 and 1");75 if (this->geometricalmetric!=0 && this->geometricalmetric!=1) _error _("'geometricalmetric' supported options are 0 and 1");73 if (this->Crack!=0 && this->Crack!=1) _error2_("'Crack' supported options are 0 and 1"); 74 if (this->KeepVertices!=0 && this->KeepVertices!=1) _error2_("'KeepVertices' supported options are 0 and 1"); 75 if (this->geometricalmetric!=0 && this->geometricalmetric!=1) _error2_("'geometricalmetric' supported options are 0 and 1"); 76 76 77 if (this->hmin<=0) _error _("'hmin' option should be >0");78 if (this->hmax<=0 || this->hmax<this->hmin) _error _("'hmax' option should be between 0 and hmin=%g",this->hmin);79 if (this->hminVertices && this->hminVerticesSize[1]!=1) _error _("'hminVertices' should be a column");80 if (this->hmaxVertices && this->hmaxVerticesSize[1]!=1) _error _("'hmaxVertices' should be a column");81 if (this->hVertices && this->hVerticesSize[1]!=1) _error _("'hVertices' should be a column");82 if (this->metric && (this->metricSize[1]!=1 && this->metricSize[1]!=3)) _error _("'metric' should have either 1 (iso) or 3 (aniso) columns.");77 if (this->hmin<=0) _error2_("'hmin' option should be >0"); 78 if (this->hmax<=0 || this->hmax<this->hmin) _error2_("'hmax' option should be between 0 and hmin=" << this->hmin); 79 if (this->hminVertices && this->hminVerticesSize[1]!=1) _error2_("'hminVertices' should be a column"); 80 if (this->hmaxVertices && this->hmaxVerticesSize[1]!=1) _error2_("'hmaxVertices' should be a column"); 81 if (this->hVertices && this->hVerticesSize[1]!=1) _error2_("'hVertices' should be a column"); 82 if (this->metric && (this->metricSize[1]!=1 && this->metricSize[1]!=3)) _error2_("'metric' should have either 1 (iso) or 3 (aniso) columns."); 83 83 if (this->field){ 84 if (this->errSize[0]!=1 || this->errSize[1]!=this->fieldSize[1]) _error _("'err' should be of size %i x %i",1,this->fieldSize[1]);85 for (i=0;i<this->fieldSize[1];i++) {if (this->err[i]<=0) _error _("'err' option should be >0");};84 if (this->errSize[0]!=1 || this->errSize[1]!=this->fieldSize[1]) _error2_("'err' should be of size " << 1 << " x " << this->fieldSize[1]); 85 for (i=0;i<this->fieldSize[1];i++) {if (this->err[i]<=0) _error2_("'err' option should be >0");}; 86 86 } 87 87 -
issm/trunk/src/c/objects/Bamg/BamgQuadtree.cpp
r12330 r12706 7 7 namespace bamg { 8 8 9 /*MACROS {{{ 1*/9 /*MACROS {{{*/ 10 10 /* 11 11 * … … 48 48 #define J_IJ(k,l) ((k&2) ? l:0) 49 49 /*}}}*/ 50 /*DOCUMENTATION What is a BamgQuadtree? {{{ 150 /*DOCUMENTATION What is a BamgQuadtree? {{{ 51 51 * A Quadtree is a very simple way to group vertices according 52 52 * to their locations. A square that holds all the points of the mesh … … 94 94 * Using binaries is therefore very easy to locate a vertex in a box: 95 95 * we just need to look at the bits from the left to the right (See ::Add) 96 }}} 1*/96 }}}*/ 97 97 98 98 /*Constructors/Destructors*/ 99 /*FUNCTION BamgQuadtree::BamgQuadtree(){{{ 1*/99 /*FUNCTION BamgQuadtree::BamgQuadtree(){{{*/ 100 100 BamgQuadtree::BamgQuadtree(){ 101 101 … … 111 111 112 112 } 113 /*}}} 1*/114 /*FUNCTION BamgQuadtree::BamgQuadtree(Mesh * t,long nbv){{{ 1*/113 /*}}}*/ 114 /*FUNCTION BamgQuadtree::BamgQuadtree(Mesh * t,long nbv){{{*/ 115 115 BamgQuadtree::BamgQuadtree(Mesh * t,long nbv){ 116 116 … … 133 133 134 134 } 135 /*}}} 1*/136 /*FUNCTION BamgQuadtree::~BamgQuadtree(){{{ 1*/135 /*}}}*/ 136 /*FUNCTION BamgQuadtree::~BamgQuadtree(){{{*/ 137 137 BamgQuadtree::~BamgQuadtree() { 138 138 delete boxcontainer; 139 139 root=NULL; 140 140 } 141 /*}}} 1*/141 /*}}}*/ 142 142 143 143 /*Methods*/ 144 /*FUNCTION BamgQuadtree::Add{{{ 1*/144 /*FUNCTION BamgQuadtree::Add{{{*/ 145 145 void BamgQuadtree::Add(BamgVertex &w){ 146 146 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, BamgQuadtree.cpp/Add)*/ … … 230 230 NbVertices++; 231 231 } 232 /*}}} 1*/233 /*FUNCTION BamgQuadtree::NearestVertex{{{ 1*/232 /*}}}*/ 233 /*FUNCTION BamgQuadtree::NearestVertex{{{*/ 234 234 BamgVertex* BamgQuadtree::NearestVertex(Icoor1 i,Icoor1 j) { 235 235 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, BamgQuadtree.cpp/NearestVertex)*/ … … 389 389 390 390 } 391 /*}}} 1*/392 /*FUNCTION BamgQuadtree::NearestVertexWithNormal{{{ 1*/391 /*}}}*/ 392 /*FUNCTION BamgQuadtree::NearestVertexWithNormal{{{*/ 393 393 BamgVertex* BamgQuadtree::NearestVertexWithNormal(Icoor1 i,Icoor1 j) { 394 394 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, BamgQuadtree.cpp/NearestVertexWithNormal)*/ … … 497 497 return vn; 498 498 } 499 /*}}} 1*/500 /*FUNCTION BamgQuadtree::NewBamgQuadtreeBox {{{ 1*/499 /*}}}*/ 500 /*FUNCTION BamgQuadtree::NewBamgQuadtreeBox {{{*/ 501 501 BamgQuadtree::BamgQuadtreeBox* BamgQuadtree::NewBamgQuadtreeBox(void){ 502 502 … … 521 521 return newbox; 522 522 }/*}}}*/ 523 /*FUNCTION BamgQuadtree::ToClose {{{ 1*/523 /*FUNCTION BamgQuadtree::ToClose {{{*/ 524 524 BamgVertex* BamgQuadtree::ToClose(BamgVertex & v,double seuil,Icoor1 hx,Icoor1 hy){ 525 525 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, BamgQuadtree.cpp/ToClose)*/ … … 595 595 return 0; 596 596 } 597 /*}}} 1*/597 /*}}}*/ 598 598 } -
issm/trunk/src/c/objects/Bamg/BamgQuadtree.h
r12330 r12706 29 29 }; 30 30 /*Object functions*/ 31 void Echo() {_error _("not implemented yet"); };32 void DeepEcho() {_error _("not implemented yet"); };33 int Id() {_error _("not implemented yet"); };34 int MyRank() {_error _("not implemented yet"); };35 int ObjectEnum() {_error _("not implemented yet"); };36 Object *copy() {_error _("not implemented yet"); };31 void Echo() {_error2_("not implemented yet"); }; 32 void DeepEcho() {_error2_("not implemented yet"); }; 33 int Id() {_error2_("not implemented yet"); }; 34 int MyRank() {_error2_("not implemented yet"); }; 35 int ObjectEnum() {_error2_("not implemented yet"); }; 36 Object *copy() {_error2_("not implemented yet"); }; 37 37 }; 38 38 -
issm/trunk/src/c/objects/Bamg/BamgVertex.cpp
r6412 r12706 9 9 10 10 /*Methods*/ 11 /*FUNCTION BamgVertex::Echo {{{ 1*/11 /*FUNCTION BamgVertex::Echo {{{*/ 12 12 13 13 void BamgVertex::Echo(void){ 14 14 15 printf("Vertex:\n");16 printf(" integer coordinates i.x: %i, i.y: %i\n",i.x,i.y);17 printf(" Euclidean coordinates r.x: %g, r.y: %g\n",r.x,r.y);18 printf(" ReferenceNumber = %i\n",ReferenceNumber);15 _printLine_("Vertex:"); 16 _printLine_(" integer coordinates i.x: " << i.x << ", i.y: " << i.y); 17 _printLine_(" Euclidean coordinates r.x: " << r.x << ", r.y: " << r.y); 18 _printLine_(" ReferenceNumber = " << ReferenceNumber); 19 19 m.Echo(); 20 20 … … 22 22 } 23 23 /*}}}*/ 24 /*FUNCTION BamgVertex::GetReferenceNumber{{{ 1*/24 /*FUNCTION BamgVertex::GetReferenceNumber{{{*/ 25 25 int BamgVertex::GetReferenceNumber() const { 26 26 return ReferenceNumber; 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION BamgVertex::MetricFromHessian{{{ 1*/29 /*FUNCTION BamgVertex::MetricFromHessian{{{*/ 30 30 void BamgVertex::MetricFromHessian(const double Hxx,const double Hyx, const double Hyy,const double smin,const double smax,const double s,double err,BamgOpts* bamgopts){ 31 31 /*Compute Metric from Hessian*/ … … 76 76 } 77 77 else{ 78 _error _("Metrictype %i not supported yet (use 0,1 or 2(default))",Metrictype);78 _error2_("Metrictype " << Metrictype << " not supported yet (use 0,1 or 2(default))"); 79 79 } 80 80 … … 105 105 106 106 } 107 /*}}} 1*/108 /*FUNCTION BamgVertex::Optim {{{ 1*/107 /*}}}*/ 108 /*FUNCTION BamgVertex::Optim {{{*/ 109 109 long BamgVertex::Optim(int i,int koption){ 110 110 long ret=0; … … 119 119 } 120 120 /*}}}*/ 121 /*FUNCTION BamgVertex::Smoothing{{{ 1*/121 /*FUNCTION BamgVertex::Smoothing{{{*/ 122 122 double BamgVertex::Smoothing(Mesh &Th,const Mesh &BTh,Triangle* &tstart ,double omega){ 123 123 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Smoothing)*/ … … 146 146 j = NextEdge[jc]; 147 147 if (k>=2000){ 148 _error _("k>=2000 (Maximum number of iterations reached)");148 _error2_("k>=2000 (Maximum number of iterations reached)"); 149 149 } 150 150 } while ( tbegin != tria); … … 213 213 j = NextEdge[jc]; 214 214 if (k>=2000){ 215 _error _("k>=2000");215 _error2_("k>=2000"); 216 216 } 217 217 }while ( tbegin != tria); … … 222 222 return delta; 223 223 } 224 /*}}} 1*/224 /*}}}*/ 225 225 226 226 /*Intermediary*/ 227 /*FUNCTION QuadQuality{{{ 1*/227 /*FUNCTION QuadQuality{{{*/ 228 228 double QuadQuality(const BamgVertex & a,const BamgVertex &b,const BamgVertex &c,const BamgVertex &d) { 229 229 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshQuad.cpp/QuadQuality)*/ … … 252 252 return 1.0-Max(Max(Abs(cosDAB),Abs(cosABC)),Max(Abs(cosBCD),Abs(cosCDA))); 253 253 } 254 /*}}} 1*/254 /*}}}*/ 255 255 256 256 } -
issm/trunk/src/c/objects/Bamg/CrackedEdge.cpp
r3913 r12706 9 9 10 10 /*Constructors/Destructors*/ 11 /*FUNCTION CrackedEdge() {{{ 1*/11 /*FUNCTION CrackedEdge() {{{*/ 12 12 CrackedEdge::CrackedEdge() { 13 13 a=NULL; -
issm/trunk/src/c/objects/Bamg/Curve.cpp
r5401 r12706 10 10 11 11 /*Constructors/Destructors*/ 12 /*FUNCTION Curve::Curve(){{{ 1*/12 /*FUNCTION Curve::Curve(){{{*/ 13 13 Curve::Curve(){ 14 14 FirstEdge=NULL; … … 20 20 21 21 /*Methods*/ 22 /*FUNCTION Curve::Reverse {{{ 1*/22 /*FUNCTION Curve::Reverse {{{*/ 23 23 void Curve::Reverse() { 24 24 /*reverse the direction of the curve */ … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION Curve::Set {{{ 1*/29 /*FUNCTION Curve::Set {{{*/ 30 30 void Curve::Set(const Curve & rec,const Geometry & Gh ,Geometry & GhNew){ 31 31 *this = rec; -
issm/trunk/src/c/objects/Bamg/Direction.cpp
r5148 r12706 9 9 10 10 /*Constructors/Destructors*/ 11 /*FUNCTION Direction() {{{ 1*/11 /*FUNCTION Direction() {{{*/ 12 12 Direction::Direction(): 13 13 dir(MaxICoor){ 14 14 15 15 }/*}}}*/ 16 /*FUNCTION Direction(Icoor1 i,Icoor1 j) {{{ 1*/16 /*FUNCTION Direction(Icoor1 i,Icoor1 j) {{{*/ 17 17 Direction::Direction(Icoor1 i,Icoor1 j) { 18 18 Icoor2 n2 = 2*(Abs(i)+Abs(j)); … … 23 23 24 24 /*Methods*/ 25 /*FUNCTION Direction::direction{{{ 1*/25 /*FUNCTION Direction::direction{{{*/ 26 26 int Direction::direction(Icoor1 i,Icoor1 j) { 27 27 int r =1; -
issm/trunk/src/c/objects/Bamg/Edge.cpp
r6412 r12706 13 13 14 14 /*Methods*/ 15 /*FUNCTION Edge::Set {{{ 1*/15 /*FUNCTION Edge::Set {{{*/ 16 16 void Edge::Set(const Mesh & Th ,long i,Mesh & ThNew){ 17 17 *this = Th.edges[i]; … … 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION Edge::Echo {{{ 1*/26 /*FUNCTION Edge::Echo {{{*/ 27 27 void Edge::Echo(void){ 28 printf("Edge:\n");29 printf(" pointers towards two vertices: %p %p\n",v[0],v[1]);30 printf(" ReferenceNumber = %i\n",ReferenceNumber);31 printf(" GeomEdgeHook = %p\n",GeomEdgeHook);32 printf(" two adjacent edges on the same curve: %p %p\n",adj[0],adj[1]);28 _printLine_("Edge:"); 29 _printLine_(" pointers towards two vertices: " << v[0] << " " << v[1]); 30 _printLine_(" ReferenceNumber = " << ReferenceNumber); 31 _printLine_(" GeomEdgeHook = " << GeomEdgeHook); 32 _printLine_(" two adjacent edges on the same curve: " << adj[0] << " " << adj[1]); 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION Edge::Renumbering{{{ 1*/35 /*FUNCTION Edge::Renumbering{{{*/ 36 36 void Edge::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){ 37 37 … … 41 41 } 42 42 /*}}}*/ 43 /*FUNCTION Edge::Intersection{{{ 1*/43 /*FUNCTION Edge::Intersection{{{*/ 44 44 int Edge::Intersection(const Edge & e){ 45 45 46 46 /*some shecks*/ 47 if (!(adj[0]==&e || adj[1]==&e)){ _error _("Intersection bug"); }47 if (!(adj[0]==&e || adj[1]==&e)){ _error2_("Intersection bug"); } 48 48 _assert_(adj[0]==&e || adj[1]==&e); 49 49 -
issm/trunk/src/c/objects/Bamg/EigenMetric.cpp
r9371 r12706 9 9 10 10 /*Constructor*/ 11 /*FUNCTION EigenMetric::EigenMetric(const Metric M){{{ 1*/11 /*FUNCTION EigenMetric::EigenMetric(const Metric M){{{*/ 12 12 EigenMetric::EigenMetric(const Metric& M){ 13 13 /*From a metric (a11,a21,a22), get eigen values lambda1 and lambda2 and one eigen vector v*/ … … 88 88 89 89 } 90 /*}}} 1*/91 /*FUNCTION EigenMetric::EigenMetric(double r1,double r2,const D2 vp1){{{ 1*/90 /*}}}*/ 91 /*FUNCTION EigenMetric::EigenMetric(double r1,double r2,const D2 vp1){{{*/ 92 92 EigenMetric::EigenMetric(double r1,double r2,const D2& vp1): lambda1(r1),lambda2(r2),v(vp1){ 93 93 … … 95 95 96 96 /*Methods*/ 97 /*FUNCTION EigenMetric::Abs{{{ 1*/97 /*FUNCTION EigenMetric::Abs{{{*/ 98 98 void EigenMetric::Abs(){ 99 99 lambda1=bamg::Abs(lambda1),lambda2=bamg::Abs(lambda2); 100 100 }/*}}}*/ 101 /*FUNCTION EigenMetric::Aniso{{{ 1*/101 /*FUNCTION EigenMetric::Aniso{{{*/ 102 102 double EigenMetric::Aniso() const { 103 103 return sqrt( Aniso2()); 104 104 }/*}}}*/ 105 /*FUNCTION EigenMetric::Aniso2{{{ 1*/105 /*FUNCTION EigenMetric::Aniso2{{{*/ 106 106 double EigenMetric::Aniso2() const { 107 107 return lmax()/lmin(); 108 108 }/*}}}*/ 109 /*FUNCTION EigenMetric::BoundAniso{{{ 1*/109 /*FUNCTION EigenMetric::BoundAniso{{{*/ 110 110 void EigenMetric::BoundAniso(const double c){ 111 111 BoundAniso2(1/(c*c)); 112 112 }/*}}}*/ 113 /*FUNCTION EigenMetric::Echo {{{ 1*/113 /*FUNCTION EigenMetric::Echo {{{*/ 114 114 void EigenMetric::Echo(void){ 115 115 116 printf("EigenMetric:\n");117 printf(" lambda1: %g\n",lambda1);118 printf(" lambda2: %g\n",lambda2);119 printf(" v.x: %g\n",v.x);120 printf(" v.y: %g\n",v.y);116 _printLine_("EigenMetric:"); 117 _printLine_(" lambda1: " << lambda1); 118 _printLine_(" lambda2: " << lambda2); 119 _printLine_(" v.x: " << v.x); 120 _printLine_(" v.y: " << v.y); 121 121 122 122 return; 123 123 } 124 124 /*}}}*/ 125 /*FUNCTION EigenMetric::hmin{{{ 1*/125 /*FUNCTION EigenMetric::hmin{{{*/ 126 126 double EigenMetric::hmin() const { 127 127 return sqrt(1/bamg::Max3(lambda1,lambda2,1e-30)); 128 128 }/*}}}*/ 129 /*FUNCTION EigenMetric::hmax{{{ 1*/129 /*FUNCTION EigenMetric::hmax{{{*/ 130 130 double EigenMetric::hmax() const { 131 131 return sqrt(1/bamg::Max(bamg::Min(lambda1,lambda2),1e-30)); 132 132 }/*}}}*/ 133 /*FUNCTION EigenMetric::Isotrope{{{ 1*/133 /*FUNCTION EigenMetric::Isotrope{{{*/ 134 134 void EigenMetric::Isotrope() { 135 135 lambda1=lambda2=bamg::Max(lambda1,lambda2); 136 136 }/*}}}*/ 137 /*FUNCTION EigenMetric::lmax{{{ 1*/137 /*FUNCTION EigenMetric::lmax{{{*/ 138 138 double EigenMetric::lmax() const { 139 139 return bamg::Max3(lambda1,lambda2,1e-30); 140 140 }/*}}}*/ 141 /*FUNCTION EigenMetric::lmin{{{ 1*/141 /*FUNCTION EigenMetric::lmin{{{*/ 142 142 double EigenMetric::lmin() const { 143 143 return bamg::Max(bamg::Min(lambda1,lambda2),1e-30); 144 144 }/*}}}*/ 145 /*FUNCTION EigenMetric::Min{{{ 1*/145 /*FUNCTION EigenMetric::Min{{{*/ 146 146 void EigenMetric::Min(double a) { 147 147 lambda1=bamg::Min(a,lambda1); lambda2=bamg::Min(a,lambda2) ; 148 148 }/*}}}*/ 149 /*FUNCTION EigenMetric::Max{{{ 1*/149 /*FUNCTION EigenMetric::Max{{{*/ 150 150 void EigenMetric::Max(double a) { 151 151 //change eigen values 152 152 lambda1=bamg::Max(a,lambda1); lambda2=bamg::Max(a,lambda2) ; 153 153 }/*}}}*/ 154 /*FUNCTION EigenMetric::Minh{{{ 1*/154 /*FUNCTION EigenMetric::Minh{{{*/ 155 155 void EigenMetric::Minh(double h) { 156 156 Min(1.0/(h*h)); 157 157 }/*}}}*/ 158 /*FUNCTION EigenMetric::Maxh{{{ 1*/158 /*FUNCTION EigenMetric::Maxh{{{*/ 159 159 void EigenMetric::Maxh(double h) { 160 160 //Call Max function 161 161 Max(1.0/(h*h)); 162 162 }/*}}}*/ 163 /*FUNCTION EigenMetric::pow{{{ 1*/163 /*FUNCTION EigenMetric::pow{{{*/ 164 164 void EigenMetric::pow(double p){ 165 165 lambda1=::pow(lambda1,p);lambda2=::pow(lambda2,p); -
issm/trunk/src/c/objects/Bamg/GeomEdge.cpp
r6412 r12706 16 16 17 17 /*Methods*/ 18 /*FUNCTION GeomEdge::Cracked{{{ 1*/18 /*FUNCTION GeomEdge::Cracked{{{*/ 19 19 int GeomEdge::Cracked() const { 20 20 return type &1; 21 21 }/*}}}*/ 22 /*FUNCTION GeomEdge::F{{{ 1*/22 /*FUNCTION GeomEdge::F{{{*/ 23 23 R2 GeomEdge::F(double theta) const{ 24 24 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/F)*/ … … 62 62 return A*ca + B*cb + tg[0]*cta + tg[1]*ctb; 63 63 } 64 /*}}} 1*/65 /*FUNCTION GeomEdge::Mark{{{ 1*/64 /*}}}*/ 65 /*FUNCTION GeomEdge::Mark{{{*/ 66 66 int GeomEdge::Mark() const { 67 67 return type &16; 68 68 }/*}}}*/ 69 /*FUNCTION GeomEdge::R1tg{{{ 1*/69 /*FUNCTION GeomEdge::R1tg{{{*/ 70 70 double GeomEdge::R1tg(double theta,R2 & t) const{ 71 71 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/R1tg)*/ … … 138 138 else return 0; 139 139 } 140 /*}}} 1*/141 /*FUNCTION GeomEdge::Required{{{ 1*/140 /*}}}*/ 141 /*FUNCTION GeomEdge::Required{{{*/ 142 142 int GeomEdge::Required() { 143 143 return type &64; 144 144 }/*}}}*/ 145 /*FUNCTION GeomEdge::Set {{{ 1*/145 /*FUNCTION GeomEdge::Set {{{*/ 146 146 void GeomEdge::Set(const GeomEdge & rec,const Geometry & Gh ,Geometry & GhNew){ 147 147 *this = rec; … … 152 152 } 153 153 /*}}}*/ 154 /*FUNCTION GeomEdge::SetCracked{{{ 1*/154 /*FUNCTION GeomEdge::SetCracked{{{*/ 155 155 void GeomEdge::SetCracked() { 156 156 type |= 1;/*=>1st digit to 1*/ 157 157 }/*}}}*/ 158 /*FUNCTION GeomEdge::SetTgA{{{ 1*/158 /*FUNCTION GeomEdge::SetTgA{{{*/ 159 159 void GeomEdge::SetTgA() { 160 160 type |=4; /*=>2d digit to 1*/ 161 161 }/*}}}*/ 162 /*FUNCTION GeomEdge::SetTgB{{{ 1*/162 /*FUNCTION GeomEdge::SetTgB{{{*/ 163 163 void GeomEdge::SetTgB() { 164 164 type |=8; /*=> 3d digit to 1*/ 165 165 }/*}}}*/ 166 /*FUNCTION GeomEdge::SetMark{{{ 1*/166 /*FUNCTION GeomEdge::SetMark{{{*/ 167 167 void GeomEdge::SetMark() { 168 168 type |=16;/*=> 4th digiy to 1*/ 169 169 }/*}}}*/ 170 /*FUNCTION GeomEdge::SetUnMark{{{ 1*/170 /*FUNCTION GeomEdge::SetUnMark{{{*/ 171 171 void GeomEdge::SetUnMark() { 172 172 type &= 1007 /* 1023-16 = 000111110111 => 4th digit to 0*/; 173 173 }/*}}}*/ 174 /*FUNCTION GeomEdge::SetRequired{{{ 1*/174 /*FUNCTION GeomEdge::SetRequired{{{*/ 175 175 void GeomEdge::SetRequired() { 176 176 type |= 64;/*=>6th digit to 1*/ 177 177 }/*}}}*/ 178 /*FUNCTION GeomEdge::Tg{{{ 1*/178 /*FUNCTION GeomEdge::Tg{{{*/ 179 179 int GeomEdge::Tg(int i) const { 180 180 return i==0 ? TgA() : TgB(); 181 181 }/*}}}*/ 182 /*FUNCTION GeomEdge::TgA{{{ 1*/182 /*FUNCTION GeomEdge::TgA{{{*/ 183 183 int GeomEdge::TgA() const { 184 184 return type &4; 185 185 }/*}}}*/ 186 /*FUNCTION GeomEdge::TgB{{{ 1*/186 /*FUNCTION GeomEdge::TgB{{{*/ 187 187 int GeomEdge::TgB() const { 188 188 return type &8; -
issm/trunk/src/c/objects/Bamg/GeomSubDomain.cpp
r5573 r12706 12 12 13 13 /*Methods*/ 14 /*FUNCTION GeomSubDomain::Set {{{ 1*/14 /*FUNCTION GeomSubDomain::Set {{{*/ 15 15 void GeomSubDomain::Set(const GeomSubDomain & rec,const Geometry & Gh ,const Geometry & GhNew){ 16 16 *this = rec; -
issm/trunk/src/c/objects/Bamg/GeomVertex.cpp
r5573 r12706 14 14 15 15 /*Methods*/ 16 /*FUNCTION GeomVertex::Corner {{{ 1*/16 /*FUNCTION GeomVertex::Corner {{{*/ 17 17 int GeomVertex::Corner() const { 18 18 return type & 4; 19 19 } 20 20 /*}}}*/ 21 /*FUNCTION GeomVertex::Required {{{ 1*/21 /*FUNCTION GeomVertex::Required {{{*/ 22 22 int GeomVertex::Required()const { 23 23 // a corner is required … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION GeomVertex::SetCorner {{{ 1*/27 /*FUNCTION GeomVertex::SetCorner {{{*/ 28 28 void GeomVertex::SetCorner(){ 29 29 type |= 4; 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION GeomVertex::SetRequired {{{ 1*/32 /*FUNCTION GeomVertex::SetRequired {{{*/ 33 33 void GeomVertex::SetRequired(){ 34 34 type |= 2; -
issm/trunk/src/c/objects/Bamg/Geometry.cpp
r12330 r12706 13 13 14 14 /*Constructors/Destructors*/ 15 /*FUNCTION Geometry::Geometry(){{{ 1*/15 /*FUNCTION Geometry::Geometry(){{{*/ 16 16 Geometry::Geometry(){ 17 17 Init(); 18 18 } 19 19 /*}}}*/ 20 /*FUNCTION Geometry::Geometry(BamgGeom* bamggeom, BamgOpts* bamgopts){{{ 1*/20 /*FUNCTION Geometry::Geometry(BamgGeom* bamggeom, BamgOpts* bamgopts){{{*/ 21 21 Geometry::Geometry(BamgGeom* bamggeom, BamgOpts* bamgopts){ 22 22 Init(); … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION Geometry::Geometry(const Geometry & Gh) (COPY operator){{{ 1*/27 /*FUNCTION Geometry::Geometry(const Geometry & Gh) (COPY operator){{{*/ 28 28 Geometry::Geometry(const Geometry & Gh) { 29 29 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/Geometry)*/ … … 44 44 subdomains[i].Set(Gh.subdomains[i],Gh,*this); 45 45 } 46 /*}}} 1*/47 /*FUNCTION Geometry::~Geometry(){{{ 1*/46 /*}}}*/ 47 /*FUNCTION Geometry::~Geometry(){{{*/ 48 48 Geometry::~Geometry() { 49 49 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/~Geometry)*/ 50 if(NbRef>0){ printf("Trying to delete geometry and NbRef>0, probably due to an error"); return;}50 if(NbRef>0){ _printString_("Trying to delete geometry and NbRef>0, probably due to an error"); return;} 51 51 if(vertices) delete [] vertices; vertices=0; 52 52 if(edges) delete [] edges; edges=0; … … 56 56 Init(); 57 57 } 58 /*}}} 1*/58 /*}}}*/ 59 59 60 60 /*IO*/ 61 /*FUNCTION Geometry::ReadGeometry{{{ 1*/61 /*FUNCTION Geometry::ReadGeometry{{{*/ 62 62 void Geometry::ReadGeometry(BamgGeom* bamggeom,BamgOpts* bamgopts){ 63 63 … … 76 76 77 77 //some checks 78 if (bamggeom->Vertices==NULL) _error _("the domain provided does not contain any vertex");79 if (bamggeom->Edges==NULL) _error _("the domain provided does not contain any edge");78 if (bamggeom->Vertices==NULL) _error2_("the domain provided does not contain any vertex"); 79 if (bamggeom->Edges==NULL) _error2_("the domain provided does not contain any edge"); 80 80 81 81 //Vertices 82 82 if (bamggeom->Vertices){ 83 if(verbose>5) printf(" processing Vertices\n");84 if (bamggeom->VerticesSize[1]!=3) _error _("Vertices should have 3 columns");83 if(verbose>5) _printLine_(" processing Vertices"); 84 if (bamggeom->VerticesSize[1]!=3) _error2_("Vertices should have 3 columns"); 85 85 vertices = new GeomVertex[nbv]; 86 86 for (i=0;i<nbv;i++) { … … 115 115 */ 116 116 coefIcoor=(MaxICoor)/(Max(pmax.x-pmin.x,pmax.y-pmin.y)); 117 if(coefIcoor<=0) _error _("coefIcoor should be positive");117 if(coefIcoor<=0) _error2_("coefIcoor should be positive"); 118 118 } 119 119 else{ 120 _error _("No BamgVertex provided");120 _error2_("No BamgVertex provided"); 121 121 } 122 122 … … 126 126 double* verticeslength=NULL; 127 127 128 if(verbose>5) printf(" processing Edges\n");129 if (bamggeom->EdgesSize[1]!=3) _error _("Edges should have 3 columns");128 if(verbose>5) _printLine_(" processing Edges"); 129 if (bamggeom->EdgesSize[1]!=3) _error2_("Edges should have 3 columns"); 130 130 edges = new GeomEdge[nbe]; 131 131 … … 176 176 } 177 177 else{ 178 _error _("No edges provided");178 _error2_("No edges provided"); 179 179 } 180 180 181 181 //hVertices 182 182 if(bamgopts->hVertices && bamgopts->hVerticesSize[0]==nbv){ 183 if(verbose>5) printf(" processing hVertices\n");183 if(verbose>5) _printLine_(" processing hVertices"); 184 184 for (i=0;i< nbv;i++){ 185 if (! isnan(bamgopts->hVertices[i])){185 if (!xIsNan<IssmDouble>(bamgopts->hVertices[i])){ 186 186 vertices[i].m=Metric((double)bamgopts->hVertices[i]); 187 187 } … … 191 191 //MetricVertices 192 192 if(bamgopts->metric && bamgopts->metric[0]==nbv){ 193 if(verbose>5) printf(" processing MetricVertices\n");193 if(verbose>5) _printLine_(" processing MetricVertices"); 194 194 for (i=0;i< nbv;i++) { 195 195 vertices[i].m = Metric((double)bamgopts->metric[i*3+0],(double)bamgopts->metric[i*3+1],(double)bamgopts->metric[i*3+2]); … … 199 199 //MaxCornerAngle 200 200 if (bamgopts->MaxCornerAngle){ 201 if(verbose>5) printf(" processing MaxCornerAngle\n");201 if(verbose>5) _printLine_(" processing MaxCornerAngle"); 202 202 MaxCornerAngle=bamgopts->MaxCornerAngle*Pi/180; 203 203 } … … 205 205 //TangentAtEdges 206 206 if (bamggeom->TangentAtEdges){ 207 if(verbose>5) printf(" processing TangentAtEdges");208 if (bamggeom->TangentAtEdgesSize[1]!=4) _error _("TangentAtEdges should have 4 columns");207 if(verbose>5) _printString_(" processing TangentAtEdges"); 208 if (bamggeom->TangentAtEdgesSize[1]!=4) _error2_("TangentAtEdges should have 4 columns"); 209 209 int n,i,j,k; 210 210 R2 tg; … … 216 216 tg.x=bamggeom->TangentAtEdges[k*4+2]; 217 217 tg.y=bamggeom->TangentAtEdges[k*4+3]; 218 if (i<0 || i>=nbe) _error _("TangentAtEdges first index exceeds matrix dimension");219 if (j!=0 && j!=1) _error _("TangentAtEdges second index should be 1 or 2 only");218 if (i<0 || i>=nbe) _error2_("TangentAtEdges first index exceeds matrix dimension"); 219 if (j!=0 && j!=1) _error2_("TangentAtEdges second index should be 1 or 2 only"); 220 220 edges[i].tg[j] = tg; 221 221 } … … 224 224 //Corners 225 225 if(bamggeom->Corners){ 226 if(verbose>5) printf(" processing Corners");227 if (bamggeom->CornersSize[1]!=1) _error _("Corners should have 1 column");226 if(verbose>5) _printString_(" processing Corners"); 227 if (bamggeom->CornersSize[1]!=1) _error2_("Corners should have 1 column"); 228 228 n=bamggeom->CornersSize[0]; 229 229 for (i=0;i<n;i++) { 230 230 j=(int)bamggeom->Corners[i]-1; //for C indexing 231 if (j>nbv-1 || j<0) _error _("Bad corner definition: should in [0 %i]",nbv);231 if (j>nbv-1 || j<0) _error2_("Bad corner definition: should in [0 " << nbv << "]"); 232 232 /*Required => at the same time SetRequired and SetCorner*/ 233 233 vertices[j].SetCorner(); … … 238 238 //RequiredVertices 239 239 if(bamggeom->RequiredVertices){ 240 if(verbose>5) printf(" processing RequiredVertices\n");241 if (bamggeom->RequiredVerticesSize[1]!=1) _error _("RequiredVertices should have 1 column");240 if(verbose>5) _printLine_(" processing RequiredVertices"); 241 if (bamggeom->RequiredVerticesSize[1]!=1) _error2_("RequiredVertices should have 1 column"); 242 242 n=bamggeom->RequiredVerticesSize[0]; 243 243 for (i=0;i<n;i++) { 244 244 j=(int)bamggeom->RequiredVertices[i]-1; //for C indexing 245 if (j>nbv-1 || j<0) _error _("Bad RequiredVerticess definition: should in [0 %i]",nbv);245 if (j>nbv-1 || j<0) _error2_("Bad RequiredVerticess definition: should in [0 " << nbv << "]"); 246 246 vertices[j].SetRequired(); 247 247 } … … 250 250 //RequiredEdges 251 251 if(bamggeom->RequiredEdges){ 252 if(verbose>5) printf(" processing RequiredEdges\n");253 if (bamggeom->RequiredEdgesSize[1]!=1) _error _("RequiredEdges should have 1 column");252 if(verbose>5) _printLine_(" processing RequiredEdges"); 253 if (bamggeom->RequiredEdgesSize[1]!=1) _error2_("RequiredEdges should have 1 column"); 254 254 n=bamggeom->RequiredEdgesSize[0]; 255 255 for (i=0;i<n;i++) { 256 256 j=(int)bamggeom->RequiredEdges[i]-1; //for C indexing 257 if (j>nbe-1 || j<0) _error _("Bad RequiredEdges definition: should in [0 %i]",nbe);257 if (j>nbe-1 || j<0) _error2_("Bad RequiredEdges definition: should in [0 " << nbe << "]"); 258 258 edges[j].SetRequired(); 259 259 } … … 262 262 //SubDomain 263 263 if(bamggeom->SubDomains){ 264 if(verbose>5) printf(" processing SubDomains\n");265 if (bamggeom->SubDomainsSize[1]!=4) _error _("SubDomains should have 4 columns");264 if(verbose>5) _printLine_(" processing SubDomains"); 265 if (bamggeom->SubDomainsSize[1]!=4) _error2_("SubDomains should have 4 columns"); 266 266 nbsubdomains=bamggeom->SubDomainsSize[0]; 267 267 subdomains = new GeomSubDomain[nbsubdomains]; … … 271 271 i2=(int)bamggeom->SubDomains[i*4+2]; 272 272 i3=(int)bamggeom->SubDomains[i*4+3]; 273 if (i0!=2) _error _("Bad Subdomain definition: first number should be 2 (for Edges)");274 if (i1>nbe || i1<=0) _error _("Bad Subdomain definition: second number should in [1 %i] (edge number)",nbe);273 if (i0!=2) _error2_("Bad Subdomain definition: first number should be 2 (for Edges)"); 274 if (i1>nbe || i1<=0) _error2_("Bad Subdomain definition: second number should in [1 " << nbe << "] (edge number)"); 275 275 subdomains[i].edge=edges + (i1-1); 276 276 subdomains[i].direction = (int) i2; … … 279 279 } 280 280 } 281 /*}}} 1*/282 /*FUNCTION Geometry::WriteGeometry{{{ 1*/281 /*}}}*/ 282 /*FUNCTION Geometry::WriteGeometry{{{*/ 283 283 void Geometry::WriteGeometry(BamgGeom* bamggeom, BamgOpts* bamgopts){ 284 284 … … 294 294 295 295 /*Vertices*/ 296 if(verbose>5) printf(" writing Vertices\n");296 if(verbose>5) _printLine_(" writing Vertices"); 297 297 bamggeom->VerticesSize[0]=nbv; 298 298 bamggeom->VerticesSize[1]=3; 299 299 if (nbv){ 300 bamggeom->Vertices= (double*)xmalloc(3*nbv*sizeof(double));300 bamggeom->Vertices=xNew<double>(3*nbv); 301 301 for (i=0;i<nbv;i++){ 302 302 bamggeom->Vertices[i*3+0]=vertices[i].r.x; … … 310 310 311 311 /*Edges*/ 312 if(verbose>5) printf(" writing Edges\n");312 if(verbose>5) _printLine_(" writing Edges"); 313 313 bamggeom->EdgesSize[0]=nbe; 314 314 bamggeom->EdgesSize[1]=3; 315 315 if (nbe){ 316 bamggeom->Edges= (double*)xmalloc(3*nbe*sizeof(double));316 bamggeom->Edges=xNew<double>(3*nbe); 317 317 for (i=0;i<nbe;i++){ 318 318 bamggeom->Edges[i*3+0]=GetId(edges[i][0])+1; //back to Matlab indexing … … 328 328 329 329 /*RequiredEdges*/ 330 if(verbose>5) printf(" writing %i RequiredEdges\n",nbreq);330 if(verbose>5) _printLine_(" writing " << nbreq << " RequiredEdges"); 331 331 bamggeom->RequiredEdgesSize[0]=nbreq; 332 332 bamggeom->RequiredEdgesSize[1]=1; 333 333 if (nbreq){ 334 bamggeom->RequiredEdges= (double*)xmalloc(1*nbreq*sizeof(double));334 bamggeom->RequiredEdges=xNew<double>(1*nbreq); 335 335 count=0; 336 336 for (i=0;i<nbe;i++){ … … 345 345 346 346 /*RequiredVertices*/ 347 if(verbose>5) printf(" writing %i RequiredVertices\n",nbreqv);347 if(verbose>5) _printLine_(" writing " << nbreqv << " RequiredVertices"); 348 348 bamggeom->RequiredVerticesSize[0]=nbreqv; 349 349 bamggeom->RequiredVerticesSize[1]=1; 350 350 if (nbreqv){ 351 bamggeom->RequiredVertices= (double*)xmalloc(1*nbreqv*sizeof(double));351 bamggeom->RequiredVertices=xNew<double>(1*nbreqv); 352 352 count=0; 353 353 for (i=0;i<nbv;i++){ … … 360 360 361 361 /*SubDomains*/ 362 if(verbose>5) printf(" writing SubDomains\n");362 if(verbose>5) _printLine_(" writing SubDomains"); 363 363 bamggeom->SubDomainsSize[0]=nbsubdomains; 364 364 bamggeom->SubDomainsSize[1]=4; 365 365 if (nbsubdomains){ 366 bamggeom->SubDomains= (double*)xmalloc(4*nbsubdomains*sizeof(double));366 bamggeom->SubDomains=xNew<double>(4*nbsubdomains); 367 367 for (i=0;i<nbsubdomains;i++){ 368 368 bamggeom->SubDomains[4*i+0]=2; … … 374 374 375 375 /*TangentAtEdges*/ 376 if(verbose>5) printf(" writing TangentAtEdges\n");376 if(verbose>5) _printLine_(" writing TangentAtEdges"); 377 377 bamggeom->TangentAtEdgesSize[0]=nbtan; 378 378 bamggeom->TangentAtEdgesSize[1]=4; 379 379 if (nbtan){ 380 bamggeom->TangentAtEdges= (double*)xmalloc(4*nbtan*sizeof(double));380 bamggeom->TangentAtEdges=xNew<double>(4*nbtan); 381 381 count=0; 382 382 for (i=0;i<nbe;i++){ … … 397 397 } 398 398 } 399 /*}}} 1*/399 /*}}}*/ 400 400 401 401 /*Methods*/ 402 /*FUNCTION Geometry::Echo {{{ 1*/402 /*FUNCTION Geometry::Echo {{{*/ 403 403 void Geometry::Echo(void){ 404 404 405 printf("Geometry:\n");406 printf(" nbv (number of vertices) : %i\n",nbv);407 printf(" nbe (number of edges) : %i\n",nbe);408 printf(" nbsubdomains: %i\n",nbsubdomains);409 printf(" nbcurves: %i\n",nbcurves);410 printf(" vertices: %p\n",vertices);411 printf(" edges: %p\n",edges);412 printf(" quadtree: %p\n",quadtree);413 printf(" subdomains: %p\n",subdomains);414 printf(" curves: %p\n",curves);415 printf(" pmin (x,y): (%g %g)\n",pmin.x,pmin.y);416 printf(" pmax (x,y): (%g %g)\n",pmax.x,pmax.y);417 printf(" coefIcoor: %g\n",coefIcoor);418 printf(" MaxCornerAngle: %g\n",MaxCornerAngle);405 _printLine_("Geometry:"); 406 _printLine_(" nbv (number of vertices) : " << nbv); 407 _printLine_(" nbe (number of edges) : " << nbe); 408 _printLine_(" nbsubdomains: " << nbsubdomains); 409 _printLine_(" nbcurves: " << nbcurves); 410 _printLine_(" vertices: " << vertices); 411 _printLine_(" edges: " << edges); 412 _printLine_(" quadtree: " << quadtree); 413 _printLine_(" subdomains: " << subdomains); 414 _printLine_(" curves: " << curves); 415 _printLine_(" pmin (x,y): (" << pmin.x << " " << pmin.y << ")"); 416 _printLine_(" pmax (x,y): (" << pmax.x << " " << pmax.y << ")"); 417 _printLine_(" coefIcoor: " << coefIcoor); 418 _printLine_(" MaxCornerAngle: " << MaxCornerAngle); 419 419 420 420 return; 421 421 } 422 422 /*}}}*/ 423 /*FUNCTION Geometry::Init{{{ 1*/423 /*FUNCTION Geometry::Init{{{*/ 424 424 void Geometry::Init(void){ 425 425 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/EmptyGeometry)*/ … … 437 437 MaxCornerAngle = 10*Pi/180; //default is 10 degres 438 438 } 439 /*}}} 1*/440 /*FUNCTION Geometry::MinimalHmin{{{ 1*/439 /*}}}*/ 440 /*FUNCTION Geometry::MinimalHmin{{{*/ 441 441 double Geometry::MinimalHmin() { 442 442 /* coeffIcoor = (2^30-1)/D … … 445 445 return 2.0/coefIcoor; 446 446 }/*}}}*/ 447 /*FUNCTION Geometry::MaximalHmax{{{ 1*/447 /*FUNCTION Geometry::MaximalHmax{{{*/ 448 448 double Geometry::MaximalHmax() { 449 449 return Max(pmax.x-pmin.x,pmax.y-pmin.y); 450 450 }/*}}}*/ 451 /*FUNCTION Geometry::GetId(const GeomVertex &t){{{ 1*/451 /*FUNCTION Geometry::GetId(const GeomVertex &t){{{*/ 452 452 long Geometry::GetId(const GeomVertex & t) const { 453 453 return &t - vertices; 454 454 }/*}}}*/ 455 /*FUNCTION Geometry::GetId(const GeomVertex * t){{{ 1*/455 /*FUNCTION Geometry::GetId(const GeomVertex * t){{{*/ 456 456 long Geometry::GetId(const GeomVertex * t) const { 457 457 return t - vertices; 458 458 }/*}}}*/ 459 /*FUNCTION Geometry::GetId(const GeomEdge & t){{{ 1*/459 /*FUNCTION Geometry::GetId(const GeomEdge & t){{{*/ 460 460 long Geometry::GetId(const GeomEdge & t) const { 461 461 return &t - edges; 462 462 }/*}}}*/ 463 /*FUNCTION Geometry::GetId(const GeomEdge * t){{{ 1*/463 /*FUNCTION Geometry::GetId(const GeomEdge * t){{{*/ 464 464 long Geometry::GetId(const GeomEdge * t) const { 465 465 return t - edges; 466 466 }/*}}}*/ 467 /*FUNCTION Geometry::GetId(const Curve * c){{{ 1*/467 /*FUNCTION Geometry::GetId(const Curve * c){{{*/ 468 468 long Geometry::GetId(const Curve * c) const { 469 469 return c - curves; 470 470 }/*}}}*/ 471 /*FUNCTION Geometry::Containing{{{ 1*/471 /*FUNCTION Geometry::Containing{{{*/ 472 472 GeomEdge* Geometry::Containing(const R2 P, GeomEdge * start) const { 473 473 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/Contening)*/ … … 494 494 return on; 495 495 } 496 /*}}} 1*/497 /*FUNCTION Geometry::PostRead{{{ 1*/496 /*}}}*/ 497 /*FUNCTION Geometry::PostRead{{{*/ 498 498 void Geometry::PostRead(){ 499 499 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/AfterRead)*/ … … 527 527 /*if there is a vertex found that is to close to vertices[i] -> error*/ 528 528 if( v && Norme1(v->r - vertices[i].r) < eps ){ 529 printf("reference numbers: %i %i\n",v->ReferenceNumber,vertices[i].ReferenceNumber);530 printf("Id: %i\n",i+1);529 _printLine_("reference numbers: " << v->ReferenceNumber << " " << vertices[i].ReferenceNumber); 530 _printLine_("Id: " << i+1); 531 531 delete [] next_p; 532 532 delete [] head_v; 533 533 delete [] eangle; 534 _error _("two points of the geometry are very closed to each other (see reference numbers above)");534 _error2_("two points of the geometry are very closed to each other (see reference numbers above)"); 535 535 } 536 536 … … 610 610 delete [] head_v; 611 611 delete [] eangle; 612 _error _("Length of edge %i is 0",i);612 _error2_("Length of edge " << i << " is 0"); 613 613 } 614 614 //compute angle in [-Pi Pi] … … 704 704 long i1 = n1/2 ,j1=n1%2; 705 705 706 if( edges[i1].v[j1] != edges[i].v[j]) _error _("Problem while processing edges: check the edge list");706 if( edges[i1].v[j1] != edges[i].v[j]) _error2_("Problem while processing edges: check the edge list"); 707 707 708 708 edges[i1].Adj[j1] = edges + i; … … 817 817 818 818 } 819 /*}}} 1*/820 /*FUNCTION Geometry::ProjectOnCurve {{{ 1*/819 /*}}}*/ 820 /*FUNCTION Geometry::ProjectOnCurve {{{*/ 821 821 GeomEdge* Geometry::ProjectOnCurve(const Edge &e,double s,BamgVertex &V,VertexOnGeom &GV) const { 822 822 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/ProjectOnCurve)*/ … … 831 831 GeomEdge* on=e.GeomEdgeHook; 832 832 if (!on){ 833 _error _("ProjectOnCurve error message: edge provided should be on geometry");833 _error2_("ProjectOnCurve error message: edge provided should be on geometry"); 834 834 } 835 835 if (!e[0].GeomEdgeHook || !e[1].GeomEdgeHook){ 836 _error _("ProjectOnCurve error message: at least one of the vertex of the edge provided is not on geometry");836 _error2_("ProjectOnCurve error message: at least one of the vertex of the edge provided is not on geometry"); 837 837 } 838 838 … … 870 870 if (bge<=0) { 871 871 if(NbTry) { 872 printf("Fatal Error: on the class Mesh before call Geometry::ProjectOnCurve\n");873 printf("That bug might come from:\n");874 printf(" 1) a mesh edge containing more than %i geometrical edges\n",mxe/2);875 printf(" 2) code bug : be sure that we call Mesh::SetVertexFieldOn() before\n");876 printf("To solve the problem do a coarsening of the geometrical mesh or change the constant value of mxe (dangerous)\n");877 _error _("see above");872 _printLine_("Fatal Error: on the class Mesh before call Geometry::ProjectOnCurve"); 873 _printLine_("That bug might come from:"); 874 _printLine_(" 1) a mesh edge containing more than " << mxe/2 << " geometrical edges"); 875 _printLine_(" 2) code bug : be sure that we call Mesh::SetVertexFieldOn() before"); 876 _printLine_("To solve the problem do a coarsening of the geometrical mesh or change the constant value of mxe (dangerous)"); 877 _error2_("see above"); 878 878 } 879 879 NbTry++; … … 887 887 while (eg1 != (GeomEdge*) vg1 && (*eg1)(direction1) != (GeomVertex*) vg1) { 888 888 if(tge>=mxe ) { 889 printf("WARNING: on the class Mesh before call Geometry::ProjectOnCurve is having issues (isn't it Eric?)\n");889 _printLine_("WARNING: on the class Mesh before call Geometry::ProjectOnCurve is having issues (isn't it Eric?)"); 890 890 NbTry++; 891 891 if (NbTry<2) goto retry; 892 printf("Fatal Error: on the class Mesh before call Geometry::ProjectOnCurve\n");893 printf("That bug might come from:\n");894 printf(" 1) a mesh edge contening more than %i geometrical edges\n",mxe/2);895 printf(" 2) code bug : be sure that we call Mesh::SetVertexFieldOn() before\n");896 printf("To solve the problem do a coarsening of the geometrical mesh or change the constant value of mxe (dangerous)\n");897 _error _("see above");892 _printLine_("Fatal Error: on the class Mesh before call Geometry::ProjectOnCurve"); 893 _printLine_("That bug might come from:"); 894 _printLine_(" 1) a mesh edge contening more than " << mxe/2 << " geometrical edges"); 895 _printLine_(" 2) code bug : be sure that we call Mesh::SetVertexFieldOn() before"); 896 _printLine_("To solve the problem do a coarsening of the geometrical mesh or change the constant value of mxe (dangerous)"); 897 _error2_("see above"); 898 898 } 899 899 GeomEdge* tmpge = eg1; … … 951 951 return on; 952 952 } 953 /*}}} 1*/954 /*FUNCTION Geometry::R2ToI2{{{ 1*/953 /*}}}*/ 954 /*FUNCTION Geometry::R2ToI2{{{*/ 955 955 I2 Geometry::R2ToI2(const R2 & P) const { 956 956 /*coefIcoor is the coefficient used for integer coordinates: … … 965 965 return I2( (Icoor1) (coefIcoor*(P.x-pmin.x)) ,(Icoor1) (coefIcoor*(P.y-pmin.y)) ); 966 966 }/*}}}*/ 967 /*FUNCTION Geometry::UnMarkEdges{{{ 1*/967 /*FUNCTION Geometry::UnMarkEdges{{{*/ 968 968 void Geometry::UnMarkEdges() { 969 969 for (int i=0;i<nbe;i++) edges[i].SetUnMark(); -
issm/trunk/src/c/objects/Bamg/ListofIntersectionTriangles.cpp
r9306 r12706 9 9 10 10 /*Constructors Destructors*/ 11 /*FUNCTION ListofIntersectionTriangles::ListofIntersectionTriangles{{{ 1*/11 /*FUNCTION ListofIntersectionTriangles::ListofIntersectionTriangles{{{*/ 12 12 ListofIntersectionTriangles::ListofIntersectionTriangles(int n,int m) 13 13 : MaxSize(n), Size(0), len(-1),state(-1),lIntTria(new IntersectionTriangles[n]) , … … 15 15 } 16 16 /*}}}*/ 17 /*FUNCTION ListofIntersectionTriangles::~ListofIntersectionTriangles{{{ 1*/17 /*FUNCTION ListofIntersectionTriangles::~ListofIntersectionTriangles{{{*/ 18 18 ListofIntersectionTriangles::~ListofIntersectionTriangles(){ 19 19 if (lIntTria) delete [] lIntTria,lIntTria=0; … … 23 23 24 24 /*Methods*/ 25 /*FUNCTION ListofIntersectionTriangles::Init{{{ 1*/25 /*FUNCTION ListofIntersectionTriangles::Init{{{*/ 26 26 void ListofIntersectionTriangles::Init(void){ 27 27 state=0; … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION ListofIntersectionTriangles::Length{{{ 1*/32 /*FUNCTION ListofIntersectionTriangles::Length{{{*/ 33 33 double ListofIntersectionTriangles::Length(){ 34 34 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Length)*/ … … 38 38 // check Size 39 39 if (Size<=0){ 40 _error _("Size<=0");40 _error2_("Size<=0"); 41 41 } 42 42 … … 77 77 return s; 78 78 } 79 /*}}} 1*/80 /*FUNCTION ListofIntersectionTriangles::NewItem(Triangle * tt,double d0,double d1,double d2) {{{ 1*/79 /*}}}*/ 80 /*FUNCTION ListofIntersectionTriangles::NewItem(Triangle * tt,double d0,double d1,double d2) {{{*/ 81 81 int ListofIntersectionTriangles::NewItem(Triangle * tt,double d0,double d1,double d2) { 82 82 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NewItem)*/ … … 105 105 return n; 106 106 } 107 /*}}} 1*/108 /*FUNCTION ListofIntersectionTriangles::NewItem(R2 A,const Metric & mm){{{ 1*/107 /*}}}*/ 108 /*FUNCTION ListofIntersectionTriangles::NewItem(R2 A,const Metric & mm){{{*/ 109 109 int ListofIntersectionTriangles::NewItem(R2 A,const Metric & mm) { 110 110 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NewItem)*/ … … 121 121 return n; 122 122 } 123 /*}}} 1*/124 /*FUNCTION ListofIntersectionTriangles::NewPoints{{{ 1*/123 /*}}}*/ 124 /*FUNCTION ListofIntersectionTriangles::NewPoints{{{*/ 125 125 long ListofIntersectionTriangles::NewPoints(BamgVertex* vertices,long &nbv,long maxnbv){ 126 126 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NewPoints)*/ … … 167 167 //x.Echo(); 168 168 //y.Echo(); 169 // printf("cx = %g, cy=%g\n",cx,cy);169 //_printLine_("cx = " << cx << ", cy=" << cy); 170 170 171 171 si += sint; … … 178 178 return nbv-nbvold; 179 179 } 180 /*}}} 1*/181 /*FUNCTION ListofIntersectionTriangles::NewSubSeg{{{ 1*/180 /*}}}*/ 181 /*FUNCTION ListofIntersectionTriangles::NewSubSeg{{{*/ 182 182 void ListofIntersectionTriangles::NewSubSeg(GeomEdge *e,double s0,double s1){ 183 183 long int verbosity=0; … … 186 186 MaxNbSeg *= 2; 187 187 if (verbosity>3){ 188 printf(" reshape lSegsI from %i to %i\n",mneo,MaxNbSeg);188 _printLine_(" reshape lSegsI from " << mneo << " to " << MaxNbSeg); 189 189 } 190 190 _assert_(lSegsI && NbSeg<MaxNbSeg); … … 201 201 } 202 202 /*}}}*/ 203 /*FUNCTION ListofIntersectionTriangles::ReShape{{{ 1*/203 /*FUNCTION ListofIntersectionTriangles::ReShape{{{*/ 204 204 void ListofIntersectionTriangles::ReShape(){ 205 205 … … 211 211 for (int i=0;i<MaxSize;i++) nw[i] = lIntTria[i]; 212 212 long int verbosity=0; 213 if(verbosity>3) printf(" ListofIntersectionTriangles ReShape Maxsize %i -> %i\n",MaxSize,MaxNbSeg);213 if(verbosity>3) _printLine_(" ListofIntersectionTriangles ReShape Maxsize " << MaxSize << " -> " << MaxNbSeg); 214 214 MaxSize = newsize; 215 215 delete [] lIntTria;// remove old … … 217 217 } 218 218 /*}}}*/ 219 /*FUNCTION ListofIntersectionTriangles::SplitEdge{{{ 1*/219 /*FUNCTION ListofIntersectionTriangles::SplitEdge{{{*/ 220 220 void ListofIntersectionTriangles::SplitEdge(const Mesh & Bh, const R2 &A,const R2 &B,int nbegin) { 221 221 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ListofIntersectionTriangles)*/ … … 268 268 k=(*t)(0) ? (( (*t)(1) ? ( (*t)(2) ? -1 : 2) : 1 )) : 0; 269 269 if (k<0){ 270 _error _("k<0");270 _error2_("k<0"); 271 271 } 272 272 ocut = OppositeEdge[k]; … … 312 312 double dij = detj-deti; 313 313 if (i+j+k != 0 + 1 +2){ 314 _error _("i+j+k != 0 + 1 +2");314 _error2_("i+j+k != 0 + 1 +2"); 315 315 } 316 316 ba[j] = detj/dij; … … 384 384 } 385 385 else { 386 _error _("Bug Split Edge");386 _error2_("Bug Split Edge"); 387 387 } 388 388 } … … 421 421 } // for(;;) 422 422 } 423 /*}}} 1*/423 /*}}}*/ 424 424 425 425 } -
issm/trunk/src/c/objects/Bamg/ListofIntersectionTriangles.h
r6412 r12706 34 34 double c01=lEnd-lBegin, c0=(lEnd-s)/c01, c1=(s-lBegin)/c01; 35 35 if (lBegin>s || s>lEnd){ 36 _error _("lBegin>s || s>lEnd");36 _error2_("lBegin>s || s>lEnd"); 37 37 } 38 38 return e->F(sBegin*c0+sEnd*c1); -
issm/trunk/src/c/objects/Bamg/Mesh.cpp
r12330 r12706 11 11 12 12 /*Constructors/Destructors*/ 13 /*FUNCTION Mesh::Mesh(BamgGeom* bamggeom,BamgMesh* bamgmesh, BamgOpts* bamgopts){{{ 1*/13 /*FUNCTION Mesh::Mesh(BamgGeom* bamggeom,BamgMesh* bamgmesh, BamgOpts* bamgopts){{{*/ 14 14 Mesh::Mesh(BamgGeom* bamggeom,BamgMesh* bamgmesh, BamgOpts* bamgopts):Gh(*(new Geometry())),BTh(*this){ 15 15 … … 29 29 if(bamggeom->Edges==NULL) { 30 30 /*Recreate geometry if needed*/ 31 printf("WARNING: mesh present but no geometry found. Reconstructing...\n");31 _printLine_("WARNING: mesh present but no geometry found. Reconstructing..."); 32 32 BuildGeometryFromMesh(bamgopts); 33 33 Gh.PostRead(); … … 40 40 ReconstructExistingMesh(); 41 41 } 42 /*}}} 1*/43 /*FUNCTION Mesh::Mesh( double* index,double* x,double* y,int nods,int nels){{{1*/44 Mesh::Mesh( double* index,double* x,double* y,int nods,int nels):Gh(*(new Geometry())),BTh(*this){42 /*}}}*/ 43 /*FUNCTION Mesh::Mesh(int* index,double* x,double* y,int nods,int nels){{{*/ 44 Mesh::Mesh(int* index,double* x,double* y,int nods,int nels):Gh(*(new Geometry())),BTh(*this){ 45 45 46 46 Init(0); … … 49 49 ReconstructExistingMesh(); 50 50 } 51 /*}}} 1*/52 /*FUNCTION Mesh::Mesh(double* x,double* y,int nods){{{ 1*/51 /*}}}*/ 52 /*FUNCTION Mesh::Mesh(double* x,double* y,int nods){{{*/ 53 53 Mesh::Mesh(double* x,double* y,int nods):Gh(*(new Geometry())),BTh(*this){ 54 54 Triangulate(x,y,nods); 55 55 } 56 /*}}} 1*/57 /*FUNCTION Mesh::Mesh(const Mesh & Tho,const int *flag ,const int *bb){{{ 1*/56 /*}}}*/ 57 /*FUNCTION Mesh::Mesh(const Mesh & Tho,const int *flag ,const int *bb){{{*/ 58 58 Mesh::Mesh(const Mesh & Tho,const int *flag ,const int *bb,BamgOpts* bamgopts) : Gh(*(new Geometry())), BTh(*this) { 59 59 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Triangles)*/ … … 101 101 if (kk[i]>=0) kk[i]=k++; 102 102 } 103 printf(" number of vertices %i, remove = %i\n",k,Tho.nbv - k);104 printf(" number of triangles %i, remove = %i\n",kt,nbInT-kt);105 printf(" number of New boundary edge %i\n",nbNewBedge);103 _printLine_(" number of vertices " << k << ", remove = " << Tho.nbv - k); 104 _printLine_(" number of triangles " << kt << ", remove = " << nbInT-kt); 105 _printLine_(" number of New boundary edge " << nbNewBedge); 106 106 long imaxnbv =k; 107 107 Init(imaxnbv); … … 117 117 delete [] kk; 118 118 delete [] refv; 119 _error _("imaxnbv != nbv");119 _error2_("imaxnbv != nbv"); 120 120 } 121 121 for (i=0;i<Tho.nbt;i++) … … 128 128 if (i0<0 || i1<0 || i2<0){ 129 129 delete [] refv; 130 _error _("i0<0 || i1<0 || i2< 0");130 _error2_("i0<0 || i1<0 || i2< 0"); 131 131 } 132 132 if (i0>=Tho.nbv || i1>=Tho.nbv || i2>=Tho.nbv){ 133 _error _("i0>=Tho.nbv || i1>=Tho.nbv || i2>=Tho.nbv");133 _error2_("i0>=Tho.nbv || i1>=Tho.nbv || i2>=Tho.nbv"); 134 134 } 135 135 triangles[nbt] = Triangle(this,kk[i0],kk[i1],kk[i2]); … … 138 138 } 139 139 if (kt!=nbt){ 140 _error _("kt!=nbt");140 _error2_("kt!=nbt"); 141 141 } 142 142 if (nbt==0 && nbv==0) { 143 _error _("All triangles have been removed");143 _error2_("All triangles have been removed"); 144 144 } 145 145 delete [] kk; … … 153 153 154 154 if (!nbsubdomains){ 155 _error _("nbsubdomains==0");155 _error2_("nbsubdomains==0"); 156 156 } 157 157 if (!subdomains[0].head || !subdomains[0].head->link){ 158 _error _("!subdomains[0].head || !subdomains[0].head->link");158 _error2_("!subdomains[0].head || !subdomains[0].head->link"); 159 159 } 160 160 161 161 } 162 /*}}} 1*/163 /*FUNCTION Mesh::Mesh(Mesh & Th,Geometry * pGh,Mesh * pBth,long maxnbv_in) COPY{{{ 1*/162 /*}}}*/ 163 /*FUNCTION Mesh::Mesh(Mesh & Th,Geometry * pGh,Mesh * pBth,long maxnbv_in) COPY{{{*/ 164 164 Mesh::Mesh(Mesh & Th,Geometry * pGh,Mesh * pBth,long maxnbv_in) 165 165 : Gh(*(pGh?pGh:&Th.Gh)), BTh(*(pBth?pBth:this)) { … … 224 224 225 225 } 226 /*}}} 1*/227 /*FUNCTION Mesh::Mesh(long maxnbv,Mesh & BT,BamgOpts* bamgopts,int keepBackVertices){{{ 1*/226 /*}}}*/ 227 /*FUNCTION Mesh::Mesh(long maxnbv,Mesh & BT,BamgOpts* bamgopts,int keepBackVertices){{{*/ 228 228 Mesh::Mesh(long imaxnbv,Mesh & BT,BamgOpts* bamgopts,int keepBackVertices) :Gh(BT.Gh),BTh(BT) { 229 229 this->Init(imaxnbv); 230 230 TriangulateFromGeom1(bamgopts,keepBackVertices); 231 231 } 232 /*}}} 1*/233 /*FUNCTION Mesh::Mesh(long maxnbv,Geometry & G,BamgOpts* bamgopts){{{ 1*/232 /*}}}*/ 233 /*FUNCTION Mesh::Mesh(long maxnbv,Geometry & G,BamgOpts* bamgopts){{{*/ 234 234 Mesh::Mesh(long imaxnbv,Geometry & G,BamgOpts* bamgopts):Gh(G),BTh(*this){ 235 235 Init(imaxnbv); 236 236 TriangulateFromGeom0(bamgopts); 237 237 } 238 /*}}} 1*/239 /*FUNCTION Mesh::~Mesh(){{{ 1*/238 /*}}}*/ 239 /*FUNCTION Mesh::~Mesh(){{{*/ 240 240 Mesh::~Mesh() { 241 241 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Triangles)*/ … … 262 262 Init(0); // set all to zero 263 263 } 264 /*}}} 1*/264 /*}}}*/ 265 265 266 266 /*IO*/ 267 /*FUNCTION Mesh::ReadMesh( double* index,double* x,double* y,int nods,int nels){{{1*/268 void Mesh::ReadMesh( double* index,double* x,double* y,int nods,int nels){267 /*FUNCTION Mesh::ReadMesh(int* index,double* x,double* y,int nods,int nels){{{*/ 268 void Mesh::ReadMesh(int* index,double* x,double* y,int nods,int nels){ 269 269 270 270 double Hmin = HUGE_VAL;// the infinie value … … 280 280 281 281 //Vertices 282 if (verbose) printf("Reading vertices (%i)\n",nbv);283 vertices= (BamgVertex*)xmalloc(nbv*sizeof(BamgVertex));284 orderedvertices= (BamgVertex**)xmalloc(nbv*sizeof(BamgVertex*));282 if (verbose) _printLine_("Reading vertices (" << nbv << ")"); 283 vertices=xNew<BamgVertex>(nbv); 284 orderedvertices=xNew<BamgVertex*>(nbv); 285 285 for (i=0;i<nbv;i++){ 286 286 vertices[i].r.x=x[i]; … … 294 294 295 295 //Triangles 296 if (verbose) printf("Reading triangles (%i)\n",nbt);296 if (verbose) _printLine_("Reading triangles (" << nbt << ")"); 297 297 triangles =new Triangle[maxnbt]; //we cannot allocate only nbt triangles since 298 nodeflags= (bool*)xmalloc(nbv*sizeof(bool));298 nodeflags=xNew<bool>(nbv); 299 299 for(i=0;i<nbv;i++) nodeflags[i]=false; 300 300 //other triangles will be added for each edge … … 310 310 311 311 /*Recreate geometry: */ 312 if (verbose) printf("Building Geometry\n");312 if (verbose) _printLine_("Building Geometry"); 313 313 BuildGeometryFromMesh(); 314 if (verbose) printf("Completing geometry\n");314 if (verbose) _printLine_("Completing geometry"); 315 315 Gh.PostRead(); 316 316 … … 319 319 for(i=0;i<nbv;i++){ 320 320 if(!nodeflags[i]){ 321 printf("Vertex %i does not belong to any element\n",i+1);321 _printLine_("Vertex " << i+1 << " does not belong to any element"); 322 322 isorphan=true; 323 323 } 324 324 } 325 if(isorphan) _error _("Orphan found in mesh, see ids above");325 if(isorphan) _error2_("Orphan found in mesh, see ids above"); 326 326 327 327 /*Clean up*/ 328 x free((void**)&nodeflags);329 } 330 /*}}} 1*/331 /*FUNCTION Mesh::ReadMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts){{{ 1*/328 xDelete<bool>(nodeflags); 329 } 330 /*}}}*/ 331 /*FUNCTION Mesh::ReadMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts){{{*/ 332 332 void Mesh::ReadMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts){ 333 333 … … 346 346 //Vertices 347 347 if(bamgmesh->Vertices){ 348 if(verbose>5) printf(" processing Vertices\n");349 350 vertices= (BamgVertex*)xmalloc(nbv*sizeof(BamgVertex));351 orderedvertices= (BamgVertex**)xmalloc(nbv*sizeof(BamgVertex*));348 if(verbose>5) _printLine_(" processing Vertices"); 349 350 vertices=xNew<BamgVertex>(nbv); 351 orderedvertices=xNew<BamgVertex*>(nbv); 352 352 353 353 for (i=0;i<nbv;i++){ … … 362 362 } 363 363 else{ 364 if(verbose>5) _error _("no Vertices found in the initial mesh");364 if(verbose>5) _error2_("no Vertices found in the initial mesh"); 365 365 } 366 366 367 367 //Triangles 368 368 if(bamgmesh->Triangles){ 369 if(verbose>5) printf(" processing Triangles\n");369 if(verbose>5) _printLine_(" processing Triangles"); 370 370 triangles =new Triangle[maxnbt]; //we cannot allocate only nbt triangles since 371 371 //other triangles will be added for each edge … … 380 380 } 381 381 else{ 382 if(verbose>5) _error _("no Triangles found in the initial mesh");382 if(verbose>5) _error2_("no Triangles found in the initial mesh"); 383 383 } 384 384 385 385 //Quadrilaterals 386 386 if(bamgmesh->Quadrilaterals){ 387 if(verbose>5) printf(" processing Quadrilaterals\n");387 if(verbose>5) _printLine_(" processing Quadrilaterals"); 388 388 long i1,i2,i3,i4,iref; 389 389 triangles =new Triangle[nbt]; … … 407 407 //VerticesOnGeomEdge 408 408 if(bamgmesh->VerticesOnGeomEdge){ 409 if(verbose>5) printf(" processing VerticesOnGeomEdge\n");409 if(verbose>5) _printLine_(" processing VerticesOnGeomEdge"); 410 410 NbVerticesOnGeomEdge=bamgmesh->VerticesOnGeomEdgeSize[0]; 411 411 VerticesOnGeomEdge= new VertexOnGeom[NbVerticesOnGeomEdge] ; … … 422 422 //VerticesOnGeomVertex 423 423 if(bamgmesh->VerticesOnGeomVertexSize[0]){ 424 if(verbose>5) printf(" processing VerticesOnGeomVertex\n");424 if(verbose>5) _printLine_(" processing VerticesOnGeomVertex"); 425 425 NbVerticesOnGeomVertex=bamgmesh->VerticesOnGeomVertexSize[0]; 426 426 VerticesOnGeomVertex = new VertexOnGeom[NbVerticesOnGeomVertex] ; … … 438 438 double* len=NULL; 439 439 440 if(verbose>5) printf(" processing Edges\n");440 if(verbose>5) _printLine_(" processing Edges"); 441 441 nbe=bamgmesh->EdgesSize[0]; 442 442 edges= new Edge[nbe]; … … 498 498 //EdgeOnGeomEdge 499 499 if(bamgmesh->EdgesOnGeomEdge){ 500 if(verbose>5) printf(" processing EdgesOnGeomEdge\n");500 if(verbose>5) _printLine_(" processing EdgesOnGeomEdge"); 501 501 int i1,i2,i,j; 502 502 i2=bamgmesh->EdgesOnGeomEdgeSize[0]; … … 506 506 //Check value 507 507 if(!(i>=0 && j>=0 && i<nbe && j<Gh.nbe)) { 508 _error _("ReadMesh error: EdgesOnGeomEdge edge provided (line %i: [%i %i]) is incorrect (must be positive, [0<i<nbe=%i 0<j<Gh.nbe=%i]",i1+1,i+1,j+1,nbe,Gh.nbe);508 _error2_("ReadMesh error: EdgesOnGeomEdge edge provided (line " << i1+1 << ": [" << i+1 << " " << j+1 << "]) is incorrect (must be positive, [0<i<nbe=" << nbe << " 0<j<Gh.nbe=" << Gh.nbe << "]"); 509 509 } 510 510 edges[i].GeomEdgeHook=Gh.edges+j; … … 515 515 if(bamgmesh->SubDomains){ 516 516 long i3,head,direction; 517 if(verbose>5) printf(" processing SubDomains\n");517 if(verbose>5) _printLine_(" processing SubDomains"); 518 518 nbsubdomains=bamgmesh->SubDomainsSize[0]; 519 519 subdomains = new SubDomain [ nbsubdomains ]; … … 522 522 head=(int)bamgmesh->SubDomains[i*3+1]-1;//C indexing 523 523 direction=(int)bamgmesh->SubDomains[i*3+2]; 524 if (i3!=23) _error _("Bad Subdomain definition: first number should be 3");525 if (head<0 || head>=nbt) _error _("Bad Subdomain definition: head should in [1 %i] (triangle number)",nbt);524 if (i3!=23) _error2_("Bad Subdomain definition: first number should be 3"); 525 if (head<0 || head>=nbt) _error2_("Bad Subdomain definition: head should in [1 " << nbt << "] (triangle number)"); 526 526 subdomains[i].head = triangles+head; 527 527 } … … 529 529 530 530 } 531 /*}}} 1*/532 /*FUNCTION Mesh::WriteMesh {{{ 1*/531 /*}}}*/ 532 /*FUNCTION Mesh::WriteMesh {{{*/ 533 533 void Mesh::WriteMesh(BamgMesh* bamgmesh,BamgOpts* bamgopts){ 534 534 … … 553 553 554 554 //Memory Allocation 555 head_1= (int*)xmalloc(nbv*sizeof(int));556 next_1= (int*)xmalloc(3*nbt*sizeof(int));557 connectivitysize_1= (int*)xmalloc(nbv*sizeof(int));555 head_1=xNew<int>(nbv); 556 next_1=xNew<int>(3*nbt); 557 connectivitysize_1=xNew<int>(nbv); 558 558 559 559 //Initialization … … 567 567 for (j=0;j<3;j++){ 568 568 int v=GetId(triangles[i][j]); //jth vertex of the ith triangle 569 if (k>3*nbt-1 || k<0) _error _("k = %i, nbt = %i",k,nbt);569 if (k>3*nbt-1 || k<0) _error2_("k = " << k << ", nbt = " << nbt); 570 570 next_1[k]=head_1[v]; 571 if (v>nbv-1 || v<0) _error _("v = %i, nbv = %i",v,nbv);571 if (v>nbv-1 || v<0) _error2_("v = " << v << ", nbv = " << nbv); 572 572 head_1[v]=k++; 573 573 connectivitysize_1[v]+=1; … … 584 584 585 585 /*Vertices*/ 586 if(verbose>5) printf(" writing Vertices\n");586 if(verbose>5) _printLine_(" writing Vertices"); 587 587 bamgmesh->VerticesSize[0]=nbv; 588 588 bamgmesh->VerticesSize[1]=3; 589 589 if (nbv){ 590 bamgmesh->Vertices= (double*)xmalloc(3*nbv*sizeof(double));590 bamgmesh->Vertices=xNew<double>(3*nbv); 591 591 for (i=0;i<nbv;i++){ 592 592 bamgmesh->Vertices[i*3+0]=vertices[i].r.x; … … 597 597 598 598 /*Edges*/ 599 if(verbose>5) printf(" writing Edges\n");599 if(verbose>5) _printLine_(" writing Edges"); 600 600 bamgmesh->EdgesSize[0]=nbe; 601 601 bamgmesh->EdgesSize[1]=3; 602 602 int NumIssmSegments=0; 603 603 if (nbe){ 604 bamgmesh->Edges= (double*)xmalloc(3*nbe*sizeof(double));604 bamgmesh->Edges=xNew<double>(3*nbe); 605 605 for (i=0;i<nbe;i++){ 606 606 bamgmesh->Edges[i*3+0]=GetId(edges[i][0])+1; //back to M indexing … … 614 614 615 615 /*Element edges*/ 616 if(verbose>5) printf(" writing element edges\n");616 if(verbose>5) _printLine_(" writing element edges"); 617 617 SetOfEdges4* edge4=new SetOfEdges4(nbt*3,nbv); 618 618 double* elemedge=NULL; 619 elemedge= (double*)xmalloc(3*nbt*sizeof(double));620 for (i=0;i<3*nbt;i++) elemedge[i]= NAN;619 elemedge=xNew<double>(3*nbt); 620 for (i=0;i<3*nbt;i++) elemedge[i]=-2.;//will become -1 621 621 k=0; 622 622 for (i=0;i<nbt;i++){ … … 642 642 bamgmesh->IssmEdgesSize[0]=edge4->nb(); 643 643 bamgmesh->IssmEdgesSize[1]=4; 644 bamgmesh->IssmEdges= (double*)xmalloc(4*edge4->nb()*sizeof(double));644 bamgmesh->IssmEdges=xNew<double>(4*edge4->nb()); 645 645 for (i=0;i<edge4->nb();i++){ 646 646 /*Invert first two vertices if necessary*/ … … 667 667 //clean up 668 668 delete edge4; 669 x free((void**)&elemedge);669 xDelete<double>(elemedge); 670 670 671 671 /*IssmSegments*/ 672 if(verbose>5) printf(" writing IssmSegments\n");672 if(verbose>5) _printLine_(" writing IssmSegments"); 673 673 bamgmesh->IssmSegmentsSize[0]=NumIssmSegments; 674 674 bamgmesh->IssmSegmentsSize[1]=4; 675 bamgmesh->IssmSegments= (double*)xmalloc(4*NumIssmSegments*sizeof(double));675 bamgmesh->IssmSegments=xNew<double>(4*NumIssmSegments); 676 676 num=0; 677 677 for (i=0;i<nbe;i++){ … … 707 707 } 708 708 if (!stop){ 709 _error _("Element holding segment [%i %i] not found...",i1+1,i2+1);709 _error2_("Element holding segment [" << i1+1 << " " << i2+1 << "] not found..."); 710 710 } 711 711 } … … 713 713 714 714 /*Triangles*/ 715 if(verbose>5) printf(" writing Triangles\n");715 if(verbose>5) _printLine_(" writing Triangles"); 716 716 k=nbInT-nbq*2; 717 717 num=0; … … 719 719 bamgmesh->TrianglesSize[1]=4; 720 720 if (k){ 721 bamgmesh->Triangles= (double*)xmalloc(4*k*sizeof(double));721 bamgmesh->Triangles=xNew<double>(4*k); 722 722 for (i=0;i<nbt;i++){ 723 723 Triangle &t=triangles[i]; … … 734 734 735 735 /*Quadrilaterals*/ 736 if(verbose>5) printf(" writing Quadrilaterals\n");736 if(verbose>5) _printLine_(" writing Quadrilaterals"); 737 737 bamgmesh->QuadrilateralsSize[0]=nbq; 738 738 bamgmesh->QuadrilateralsSize[1]=5; 739 739 if (nbq){ 740 bamgmesh->Quadrilaterals= (double*)xmalloc(5*nbq*sizeof(double));740 bamgmesh->Quadrilaterals=xNew<double>(5*nbq); 741 741 for (i=0;i<nbt;i++){ 742 742 Triangle &t =triangles[i]; … … 755 755 756 756 /*SubDomains*/ 757 if(verbose>5) printf(" writing SubDomains\n");757 if(verbose>5) _printLine_(" writing SubDomains"); 758 758 bamgmesh->SubDomainsSize[0]=nbsubdomains; 759 759 bamgmesh->SubDomainsSize[1]=4; 760 760 if (nbsubdomains){ 761 bamgmesh->SubDomains= (double*)xmalloc(4*nbsubdomains*sizeof(double));761 bamgmesh->SubDomains=xNew<double>(4*nbsubdomains); 762 762 for (i=0;i<nbsubdomains;i++){ 763 763 bamgmesh->SubDomains[i*4+0]=3; … … 769 769 770 770 /*SubDomainsFromGeom*/ 771 if(verbose>5) printf(" writing SubDomainsFromGeom\n");771 if(verbose>5) _printLine_(" writing SubDomainsFromGeom"); 772 772 bamgmesh->SubDomainsFromGeomSize[0]=Gh.nbsubdomains; 773 773 bamgmesh->SubDomainsFromGeomSize[1]=4; 774 774 if (Gh.nbsubdomains){ 775 bamgmesh->SubDomainsFromGeom= (double*)xmalloc(4*Gh.nbsubdomains*sizeof(double));775 bamgmesh->SubDomainsFromGeom=xNew<double>(4*Gh.nbsubdomains); 776 776 for (i=0;i<Gh.nbsubdomains;i++){ 777 777 bamgmesh->SubDomainsFromGeom[i*4+0]=2; … … 783 783 784 784 /*VerticesOnGeomVertex*/ 785 if(verbose>5) printf(" writing VerticesOnGeomVertex\n");785 if(verbose>5) _printLine_(" writing VerticesOnGeomVertex"); 786 786 bamgmesh->VerticesOnGeomVertexSize[0]=NbVerticesOnGeomVertex; 787 787 bamgmesh->VerticesOnGeomVertexSize[1]=2; 788 788 if (NbVerticesOnGeomVertex){ 789 bamgmesh->VerticesOnGeomVertex= (double*)xmalloc(2*NbVerticesOnGeomVertex*sizeof(double));789 bamgmesh->VerticesOnGeomVertex=xNew<double>(2*NbVerticesOnGeomVertex); 790 790 for (i=0;i<NbVerticesOnGeomVertex;i++){ 791 791 VertexOnGeom &v=VerticesOnGeomVertex[i]; … … 797 797 798 798 /*VertexOnGeomEdge*/ 799 if(verbose>5) printf(" writing VerticesOnGeomEdge\n");799 if(verbose>5) _printLine_(" writing VerticesOnGeomEdge"); 800 800 bamgmesh->VerticesOnGeomEdgeSize[0]=NbVerticesOnGeomEdge; 801 801 bamgmesh->VerticesOnGeomEdgeSize[1]=3; 802 802 if (NbVerticesOnGeomEdge){ 803 bamgmesh->VerticesOnGeomEdge= (double*)xmalloc(3*NbVerticesOnGeomEdge*sizeof(double));803 bamgmesh->VerticesOnGeomEdge=xNew<double>(3*NbVerticesOnGeomEdge); 804 804 for (i=0;i<NbVerticesOnGeomEdge;i++){ 805 805 const VertexOnGeom &v=VerticesOnGeomEdge[i]; 806 806 if (!v.OnGeomEdge()){ 807 _error _("A vertices supposed to be OnGeomEdge is actually not");807 _error2_("A vertices supposed to be OnGeomEdge is actually not"); 808 808 } 809 809 bamgmesh->VerticesOnGeomEdge[i*3+0]=GetId((BamgVertex*)v)+1; //back to Matlab indexing … … 814 814 815 815 /*EdgesOnGeomEdge*/ 816 if(verbose>5) printf(" writing EdgesOnGeomEdge\n");816 if(verbose>5) _printLine_(" writing EdgesOnGeomEdge"); 817 817 k=0; 818 818 for (i=0;i<nbe;i++){ … … 822 822 bamgmesh->EdgesOnGeomEdgeSize[1]=2; 823 823 if (k){ 824 bamgmesh->EdgesOnGeomEdge= (double*)xmalloc(2*(int)k*sizeof(double));824 bamgmesh->EdgesOnGeomEdge=xNew<double>(2*(int)k); 825 825 int count=0; 826 826 for (i=0;i<nbe;i++){ … … 834 834 835 835 /*Element Connectivity*/ 836 if(verbose>5) printf(" writing Element connectivity\n");836 if(verbose>5) _printLine_(" writing Element connectivity"); 837 837 bamgmesh->ElementConnectivitySize[0]=nbt-nbtout; 838 838 bamgmesh->ElementConnectivitySize[1]=3; 839 bamgmesh->ElementConnectivity= (double*)xmalloc(3*(nbt-nbtout)*sizeof(double));839 bamgmesh->ElementConnectivity=xNew<double>(3*(nbt-nbtout)); 840 840 for (i=0;i<3*(nbt-nbtout);i++) bamgmesh->ElementConnectivity[i]=NAN; 841 841 num=0; … … 854 854 855 855 /*ElementNodal Connectivity*/ 856 if(verbose>5) printf(" writing Nodal element connectivity\n");856 if(verbose>5) _printLine_(" writing Nodal element connectivity"); 857 857 bamgmesh->NodalElementConnectivitySize[0]=nbv; 858 858 bamgmesh->NodalElementConnectivitySize[1]=connectivitymax_1; 859 bamgmesh->NodalElementConnectivity= (double*)xmalloc(connectivitymax_1*nbv*sizeof(double));859 bamgmesh->NodalElementConnectivity=xNew<double>(connectivitymax_1*nbv); 860 860 for (i=0;i<connectivitymax_1*nbv;i++) bamgmesh->NodalElementConnectivity[i]=NAN; 861 861 for (i=0;i<nbv;i++){ … … 869 869 870 870 /*Nodal Connectivity*/ 871 if(verbose>5) printf(" writing Nodal connectivity\n");871 if(verbose>5) _printLine_(" writing Nodal connectivity"); 872 872 //chaining algorithm (again...) 873 873 int* head_2=NULL; … … 877 877 i1=bamgmesh->IssmEdgesSize[0]; 878 878 i2=bamgmesh->IssmEdgesSize[1]; 879 head_2= (int*)xmalloc(nbv*sizeof(int));880 next_2= (int*)xmalloc(2*i1*sizeof(int));881 connectivitysize_2= (int*)xmalloc(nbv*sizeof(int));879 head_2=xNew<int>(nbv); 880 next_2=xNew<int>(2*i1); 881 connectivitysize_2=xNew<int>(nbv); 882 882 //Initialization 883 883 for (i=0;i<nbv;i++) head_2[i]=-1; … … 888 888 for (j=0;j<2;j++){ 889 889 int v=(int)bamgmesh->IssmEdges[i*i2+j]-1; //back to C indexing 890 if (k>2*i1-1 || k<0) _error _("Index exceed matrix dimensions (k=%i not in [0 %i]",k,2*i1-1);890 if (k>2*i1-1 || k<0) _error2_("Index exceed matrix dimensions (k=" << k << " not in [0 " << 2*i1-1 << "]"); 891 891 next_2[k]=head_2[v]; 892 if (v>nbv-1 || v<0) _error _("Index exceed matrix dimensions (v=%i not in [0 %i])",v,nbv-1);892 if (v>nbv-1 || v<0) _error2_("Index exceed matrix dimensions (v=" << v << " not in [0 " << nbv-1 << "])"); 893 893 head_2[v]=k++; 894 894 connectivitysize_2[v]+=1; … … 902 902 bamgmesh->NodalConnectivitySize[0]=nbv; 903 903 bamgmesh->NodalConnectivitySize[1]=connectivitymax_2; 904 bamgmesh->NodalConnectivity= (double*)xmalloc(connectivitymax_2*nbv*sizeof(double));904 bamgmesh->NodalConnectivity=xNew<double>(connectivitymax_2*nbv); 905 905 for (i=0;i<connectivitymax_2*nbv;i++) bamgmesh->NodalConnectivity[i]=NAN; 906 906 for (i=0;i<nbv;i++){ … … 921 921 922 922 /*Cracked vertices*/ 923 if(verbose>5) printf(" writing Cracked vertices\n");923 if(verbose>5) _printLine_(" writing Cracked vertices"); 924 924 bamgmesh->CrackedVerticesSize[0]=NbCrackedVertices; 925 925 bamgmesh->CrackedVerticesSize[1]=2; 926 926 if (NbCrackedVertices){ 927 bamgmesh->CrackedVertices= (double*)xmalloc(2*NbCrackedVertices*sizeof(double));927 bamgmesh->CrackedVertices=xNew<double>(2*NbCrackedVertices); 928 928 for (i=0;i<NbCrackedVertices;i++){ 929 929 bamgmesh->CrackedVertices[i*2+0]=CrackedVertices[i*2+0]+1; //M indexing … … 933 933 934 934 /*Cracked vertices*/ 935 if(verbose>5) printf(" writing Cracked vertices\n");935 if(verbose>5) _printLine_(" writing Cracked vertices"); 936 936 bamgmesh->CrackedEdgesSize[0]=NbCrackedEdges; 937 937 bamgmesh->CrackedEdgesSize[1]=4; 938 938 if (NbCrackedEdges){ 939 bamgmesh->CrackedEdges= (double*)xmalloc(2*NbCrackedEdges*sizeof(double));939 bamgmesh->CrackedEdges=xNew<double>(2*NbCrackedEdges); 940 940 for (i=0;i<NbCrackedEdges;i++){ 941 941 bamgmesh->CrackedEdges[i*2+0]=0;//CrackedEdges[i]->+1; //M indexing … … 945 945 946 946 //clean up 947 x free((void**)&connectivitysize_1);948 x free((void**)&head_1);949 x free((void**)&next_1);950 x free((void**)&connectivitysize_2);951 x free((void**)&head_2);952 x free((void**)&next_2);947 xDelete<int>(connectivitysize_1); 948 xDelete<int>(head_1); 949 xDelete<int>(next_1); 950 xDelete<int>(connectivitysize_2); 951 xDelete<int>(head_2); 952 xDelete<int>(next_2); 953 953 delete [] reft; 954 954 delete [] numt; 955 955 } 956 /*}}} 1*/957 /*FUNCTION Mesh::ReadMetric{{{ 1*/956 /*}}}*/ 957 /*FUNCTION Mesh::ReadMetric{{{*/ 958 958 void Mesh::ReadMetric(const BamgOpts* bamgopts) { 959 959 … … 961 961 int i,j; 962 962 963 if(bamgopts->verbose>3) printf(" processing metric\n");963 if(bamgopts->verbose>3) _printLine_(" processing metric"); 964 964 double hmin = Max(bamgopts->hmin,MinimalHmin()); 965 965 double hmax = Min(bamgopts->hmax,MaximalHmax()); … … 992 992 } 993 993 } 994 /*}}} 1*/995 /*FUNCTION Mesh::WriteMetric{{{ 1*/994 /*}}}*/ 995 /*FUNCTION Mesh::WriteMetric{{{*/ 996 996 void Mesh::WriteMetric(BamgOpts* bamgopts) { 997 997 int i; 998 x free((void**)&bamgopts->metric);999 bamgopts->metric= (double*)xmalloc(3*nbv*sizeof(double));998 xDelete<double>(bamgopts->metric); 999 bamgopts->metric=xNew<double>(3*nbv); 1000 1000 for (i=0;i<nbv;i++){ 1001 1001 bamgopts->metric[i*3+0]=vertices[i].m.a11; … … 1004 1004 } 1005 1005 } 1006 /*}}} 1*/1007 /*FUNCTION Mesh::WriteIndex{{{ 1*/1006 /*}}}*/ 1007 /*FUNCTION Mesh::WriteIndex{{{*/ 1008 1008 void Mesh::WriteIndex(int** pindex,int* pnels){ 1009 1009 … … 1023 1023 1024 1024 if (k){ 1025 index= (int*)xmalloc(3*k*sizeof(double));1025 index=xNew<int>(3*k); 1026 1026 num=0; 1027 1027 for (i=0;i<nbt;i++){ 1028 1028 Triangle &t=triangles[i]; 1029 1029 if (t.det>0 && !(t.Hidden(0)||t.Hidden(1) || t.Hidden(2) )){ 1030 if(t.Anisotropy()<2 & t.Length()<1.e+5){1030 //if(t.Anisotropy()<2 & t.Length()<1.e+5){ 1031 1031 index[num*3+0]=GetId(t[0])+1; //back to M indexing 1032 1032 index[num*3+1]=GetId(t[1])+1; //back to M indexing 1033 1033 index[num*3+2]=GetId(t[2])+1; //back to M indexing 1034 1034 num=num+1; 1035 }1035 //} 1036 1036 } 1037 1037 } … … 1042 1042 *pnels=num; 1043 1043 } 1044 /*}}} 1*/1044 /*}}}*/ 1045 1045 1046 1046 /*Methods*/ 1047 /*FUNCTION Mesh::AddGeometryMetric{{{ 1*/1047 /*FUNCTION Mesh::AddGeometryMetric{{{*/ 1048 1048 void Mesh::AddGeometryMetric(BamgOpts* bamgopts){ 1049 1049 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/IntersectGeomMetric)*/ … … 1061 1061 //check that hmax is positive 1062 1062 if (hmax<=0){ 1063 _error _("hmax<=0");1063 _error2_("hmax<=0"); 1064 1064 } 1065 1065 … … 1090 1090 1091 1091 if (ht<=0 || hn<=0){ 1092 _error _("ht<=0 || hn<=0");1092 _error2_("ht<=0 || hn<=0"); 1093 1093 } 1094 1094 EigenMetric Vp(1/(ht*ht),1/(hn*hn),tg); … … 1099 1099 // the problem is for the vertex on vertex 1100 1100 } 1101 /*}}} 1*/1102 /*FUNCTION Mesh::AddMetric{{{ 1*/1101 /*}}}*/ 1102 /*FUNCTION Mesh::AddMetric{{{*/ 1103 1103 void Mesh::AddMetric(BamgOpts* bamgopts){ 1104 1104 // Hessiantype = 0 => H is computed using double P2 projection … … 1115 1115 } 1116 1116 else{ 1117 _error _("Hessiantype %i not supported yet (1->use Green formula, 0-> double P2 projection)",Hessiantype);1118 } 1119 } 1120 /*}}} 1*/1121 /*FUNCTION Mesh::AddVertex{{{ 1*/1117 _error2_("Hessiantype " << Hessiantype << " not supported yet (1->use Green formula, 0-> double P2 projection)"); 1118 } 1119 } 1120 /*}}}*/ 1121 /*FUNCTION Mesh::AddVertex{{{*/ 1122 1122 void Mesh::AddVertex( BamgVertex &s,Triangle* t, Icoor2* det3) { 1123 1123 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Add)*/ … … 1159 1159 //some checks 1160 1160 if (( infvertexindex <0 ) && (detOld <0) || ( infvertexindex >=0 ) && (detOld >0) ){ 1161 _error _("inconsistent configuration (Contact ISSM developers)");1161 _error2_("inconsistent configuration (Contact ISSM developers)"); 1162 1162 } 1163 1163 … … 1201 1201 } 1202 1202 else{ 1203 _error _("Cannot add a vertex more than once. Check duplicates");1203 _error2_("Cannot add a vertex more than once. Check duplicates"); 1204 1204 } 1205 1205 } … … 1214 1214 tt[2]= &triangles[nbt++]; 1215 1215 1216 if (nbt>maxnbt) _error _("Not enough triangles");1216 if (nbt>maxnbt) _error2_("Not enough triangles"); 1217 1217 1218 1218 *tt[1]=*tt[2]=*t; … … 1251 1251 1252 1252 if (!rswap) { 1253 _error _("swap the point s is on a edge");1254 } 1255 } 1256 } 1257 /*}}} 1*/1258 /*FUNCTION Mesh::BoundAnisotropy{{{ 1*/1253 _error2_("swap the point s is on a edge"); 1254 } 1255 } 1256 } 1257 /*}}}*/ 1258 /*FUNCTION Mesh::BoundAnisotropy{{{*/ 1259 1259 void Mesh::BoundAnisotropy(double anisomax,double hminaniso) { 1260 1260 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/BoundAnisotropy)*/ … … 1264 1264 1265 1265 //display info 1266 if (verbose > 1) printf(" BoundAnisotropy by %g\n",anisomax);1266 if (verbose > 1) _printLine_(" BoundAnisotropy by " << anisomax); 1267 1267 1268 1268 double h1=1.e30,h2=1e-30; … … 1291 1291 //display info 1292 1292 if (verbose>2){ 1293 printf(" input: Hmin = %g, Hmax = %g, factor of anisotropy max = %g\n",pow(h2,-0.5),pow(h1,-0.5),pow(rx,0.5));1294 printf(" output: Hmin = %g, Hmax = %g, factor of anisotropy max = %g\n",pow(hn2,-0.5),pow(hn1,-0.5),pow(rnx,0.5));1295 } 1296 } 1297 /*}}} 1*/1298 /*FUNCTION Mesh::BuildGeometryFromMesh{{{ 1*/1293 _printLine_(" input: Hmin = " << pow(h2,-0.5) << ", Hmax = " << pow(h1,-0.5) << ", factor of anisotropy max = " << pow(rx,0.5)); 1294 _printLine_(" output: Hmin = " << pow(hn2,-0.5) << ", Hmax = " << pow(hn1,-0.5)<< ", factor of anisotropy max = " <<pow(rnx,0.5)); 1295 } 1296 } 1297 /*}}}*/ 1298 /*FUNCTION Mesh::BuildGeometryFromMesh{{{*/ 1299 1299 void Mesh::BuildGeometryFromMesh(BamgOpts* bamgopts){ 1300 1300 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/ConsGeometry)*/ … … 1314 1314 1315 1315 //display info 1316 if (verbose>1) printf(" construction of the geometry from the 2d mesh\n");1316 if (verbose>1) _printLine_(" construction of the geometry from the 2d mesh"); 1317 1317 1318 1318 //check that the mesh is not empty 1319 1319 if (nbt<=0 || nbv <=0 ) { 1320 _error _("nbt or nbv is negative (Mesh empty?)");1320 _error2_("nbt or nbv is negative (Mesh empty?)"); 1321 1321 } 1322 1322 … … 1340 1340 if (nbe != edge4->nb()){ 1341 1341 delete [] st; 1342 _error _("Some Double edge in the mesh, the number is %i, nbe4=%i",nbe,edge4->nb());1342 _error2_("Some Double edge in the mesh, the number is " << nbe << ", nbe4=" << edge4->nb()); 1343 1343 } 1344 1344 //keep nbe in nbeold … … 1360 1360 //check that it is not an edge on boundary (should not already exist) 1361 1361 if (triangles[i].TriangleAdj(j) || triangles[st[k]/3].TriangleAdj((int) (st[k]%3))){ 1362 _error _("problem in Geometry reconstruction: an edge on boundary is duplicated (double element?)");1362 _error2_("problem in Geometry reconstruction: an edge on boundary is duplicated (double element?)"); 1363 1363 } 1364 1364 //OK, the element is not on boundary, is belongs to 2 triangles -> build Adjacent triangles list … … 1374 1374 //else (see 3 lines above), the edge has been called more than twice: return error 1375 1375 else { 1376 printf("The edge (%i,%i) belongs to more than 2 triangles (%i)\n",GetId(triangles[i][VerticesOfTriangularEdge[j][0]]),GetId(triangles[i][VerticesOfTriangularEdge[j][1]]),k);1377 printf("Edge %i of triangle %i\n",j,i);1378 printf("Edge %i of triangle %i\n",(-st[k]+2)%3,(-st[k]+2)/3);1379 printf("Edge %i of triangle %i\n",triangles[(-st[k]+2)/3].NuEdgeTriangleAdj((int)((-st[k]+2)%3)),GetId(triangles[(-st[k]+2)/3].TriangleAdj((int)((-st[k]+2)%3))));1380 _error _("An edge belongs to more than 2 triangles");1376 _printLine_("The edge (" << GetId(triangles[i][VerticesOfTriangularEdge[j][0]]) << "," << GetId(triangles[i][VerticesOfTriangularEdge[j][1]]) << ") belongs to more than 2 triangles (" << k << ")"); 1377 _printLine_("Edge " << j << " of triangle " << i); 1378 _printLine_("Edge " << (-st[k]+2)%3 << " of triangle " << (-st[k]+2)/3); 1379 _printLine_("Edge " << triangles[(-st[k]+2)/3].NuEdgeTriangleAdj((int)((-st[k]+2)%3)) << " of triangle " << GetId(triangles[(-st[k]+2)/3].TriangleAdj((int)((-st[k]+2)%3)))); 1380 _error2_("An edge belongs to more than 2 triangles"); 1381 1381 } 1382 1382 } … … 1389 1389 //display info 1390 1390 if(verbose>5) { 1391 printf(" info on Mesh:\n");1392 printf(" - number of vertices = %i \n",nbv);1393 printf(" - number of triangles = %i \n",nbt);1394 printf(" - number of given edges = %i \n",nbe);1395 printf(" - number of all edges = %i \n",nbedges);1396 printf(" - Euler number 1 - nb of holes = %i \n" ,nbt-nbedges+nbv);1391 _printLine_(" info on Mesh:"); 1392 _printLine_(" - number of vertices = " << nbv); 1393 _printLine_(" - number of triangles = " << nbt); 1394 _printLine_(" - number of given edges = " << nbe); 1395 _printLine_(" - number of all edges = " << nbedges); 1396 _printLine_(" - Euler number 1 - nb of holes = " << nbt-nbedges+nbv); 1397 1397 } 1398 1398 … … 1425 1425 1426 1426 //display info 1427 if(verbose>4) printf(" Construction of the edges %i\n",nbe);1427 if(verbose>4) _printLine_(" Construction of the edges " << nbe); 1428 1428 1429 1429 for (i=0;i<nbedges;i++){ … … 1451 1451 edges[add].ReferenceNumber=edgessave[i].ReferenceNumber; 1452 1452 edges[add].GeomEdgeHook=edgessave[i].GeomEdgeHook; // HACK to get required edges 1453 printf("oh no...\n");1453 _printLine_("oh no..."); 1454 1454 } 1455 1455 else … … 1460 1460 //check that we have been through all edges 1461 1461 if (k!=nbe){ 1462 _error _("problem in edge construction process: k!=nbe (should not happen)");1462 _error2_("problem in edge construction process: k!=nbe (should not happen)"); 1463 1463 } 1464 1464 //delete edgessave … … 1505 1505 //check that we have the correct vertex 1506 1506 if (v!=edges[i0 ].v[j0]){ 1507 _error _("v!=edges[i0 ].v[j0]: this should not happen as the vertex belongs to this edge");1507 _error2_("v!=edges[i0 ].v[j0]: this should not happen as the vertex belongs to this edge"); 1508 1508 } 1509 1509 … … 1522 1522 //check that nbsubdomains is empty 1523 1523 if (nbsubdomains){ 1524 _error _("nbsubdomains should be 0");1524 _error2_("nbsubdomains should be 0"); 1525 1525 } 1526 1526 nbsubdomains=0; … … 1566 1566 } 1567 1567 } 1568 if (verbose> 3) printf(" The Number of sub domain = %i\n",nbsubdomains);1568 if (verbose> 3) _printLine_(" The Number of sub domain = " << nbsubdomains); 1569 1569 1570 1570 //build subdomains … … 1591 1591 if (k!= nbsubdomains){ 1592 1592 delete [] colorT; 1593 _error _("k!= nbsubdomains");1593 _error2_("k!= nbsubdomains"); 1594 1594 } 1595 1595 //delete colorT and st … … 1618 1618 Gh.nbsubdomains = nbsubdomains; 1619 1619 Gh.subdomains = new GeomSubDomain[nbsubdomains]; 1620 if (verbose>3) printf(" number of vertices = %i\n number of edges = %i\n",Gh.nbv,Gh.nbe);1620 if (verbose>3) _printLine_(" number of vertices = " << Gh.nbv << "\n number of edges = " << Gh.nbe); 1621 1621 NbVerticesOnGeomVertex = Gh.nbv; 1622 1622 VerticesOnGeomVertex = new VertexOnGeom[NbVerticesOnGeomVertex]; … … 1652 1652 if (Gh.coefIcoor<=0){ 1653 1653 delete [] colorV; 1654 _error _("Gh.coefIcoor<=0 in infered Geometry (this should not happen)");1654 _error2_("Gh.coefIcoor<=0 in infered Geometry (this should not happen)"); 1655 1655 } 1656 1656 … … 1705 1705 delete [] len; 1706 1706 delete [] colorV; 1707 _error _("problem in Edge4 construction: k != i");1707 _error2_("problem in Edge4 construction: k != i"); 1708 1708 } 1709 1709 } … … 1734 1734 } 1735 1735 else 1736 _error _("%i should be >=0");1736 _error2_("%i should be >=0"); 1737 1737 } 1738 1738 … … 1748 1748 1749 1749 } 1750 /*}}} 1*/1751 /*FUNCTION Mesh::BuildMetric0 (double P2 projection){{{ 1*/1750 /*}}}*/ 1751 /*FUNCTION Mesh::BuildMetric0 (double P2 projection){{{*/ 1752 1752 void Mesh::BuildMetric0(BamgOpts* bamgopts){ 1753 1753 … … 1768 1768 1769 1769 /*Check size*/ 1770 if (bamgopts->fieldSize[0] != nbv) _error _("'field' should have %i rows",nbv);1770 if (bamgopts->fieldSize[0] != nbv) _error2_("'field' should have " << nbv << " rows"); 1771 1771 1772 1772 //initialization of some variables … … 1790 1790 //display infos 1791 1791 if(verbose>1) { 1792 printf(" Construction of Metric: number of field: %i (nbt=%i, nbv=%i)\n",nbsol,nbt,nbv);1792 _printLine_(" Construction of Metric: number of field: " << nbsol << " (nbt=" << nbt << ", nbv=" << nbv << ")"); 1793 1793 } 1794 1794 1795 1795 //first, build the chains that will be used for the Hessian computation, as weel as the area of each element 1796 1796 int* head_s=NULL; 1797 head_s= (int*)xmalloc(nbv*sizeof(int));1797 head_s=xNew<int>(nbv); 1798 1798 int* next_p=NULL; 1799 next_p= (int*)xmalloc(3*nbt*sizeof(int));1799 next_p=xNew<int>(3*nbt); 1800 1800 int p=0; 1801 1801 //initialization … … 1862 1862 1863 1863 //display info 1864 if(verbose>2) printf(" Solution %i, Min = %g, Max = %g, Delta = %g\n",nusol,smin,smax,sdelta);1864 if(verbose>2) _printLine_(" Solution " << nusol << ", Min = " << smin << ", Max = " << smax << ", Delta = " << sdelta); 1865 1865 1866 1866 //skip constant field 1867 1867 if (sdelta < 1.0e-10*Max(absmax,1e-20)){ 1868 printf(" Solution %i is constant, skipping...\n",nusol);1868 _printLine_(" Solution " << nusol << " is constant, skipping..."); 1869 1869 continue; 1870 1870 } … … 1936 1936 1937 1937 //clean up 1938 x free((void**)&head_s);1939 x free((void**)&next_p);1938 xDelete<int>(head_s); 1939 xDelete<int>(next_p); 1940 1940 delete [] detT; 1941 1941 delete [] alpha; … … 1953 1953 delete [] dydy_vertex; 1954 1954 } 1955 /*}}} 1*/1956 /*FUNCTION Mesh::BuildMetric1 (Green formula){{{ 1*/1955 /*}}}*/ 1956 /*FUNCTION Mesh::BuildMetric1 (Green formula){{{*/ 1957 1957 void Mesh::BuildMetric1(BamgOpts* bamgopts){ 1958 1958 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/IntersectConsMetric)*/ … … 1973 1973 1974 1974 /*Check size*/ 1975 if (bamgopts->fieldSize[0] != nbv) _error _("'field' should have %i rows",nbv);1975 if (bamgopts->fieldSize[0] != nbv) _error2_("'field' should have " << nbv << " rows"); 1976 1976 1977 1977 //initialization of some variables … … 1992 1992 //display infos 1993 1993 if(verbose>1) { 1994 printf(" Construction of Metric: number of field: %i (nbt=%i, nbv=%i)\n",nbsol,nbt,nbv);1994 _printLine_(" Construction of Metric: number of field: " << nbsol << " (nbt=" << nbt << ", nbv=" << nbv << ")"); 1995 1995 } 1996 1996 … … 2075 2075 2076 2076 //display info 2077 if(verbose>2) printf(" Solution %i, Min = %g, Max = %g, Delta = %g, number of fields = %i\n",nusol,smin,smax,sdelta,nbsol);2077 if(verbose>2) _printLine_(" Solution " << nusol << ", Min = " << smin << ", Max = " << smax << ", Delta = " << sdelta << ", number of fields = " << nbsol); 2078 2078 2079 2079 //skip constant field 2080 2080 if (sdelta < 1.0e-10*Max(absmax,1e-20) ){ 2081 if (verbose>2) printf(" Solution %i is constant, skipping...\n",nusol);2081 if (verbose>2) _printLine_(" Solution " << nusol << " is constant, skipping..."); 2082 2082 continue; 2083 2083 } … … 2244 2244 2245 2245 } 2246 /*}}} 1*/2247 /*FUNCTION Mesh::CrackMesh{{{ 1*/2246 /*}}}*/ 2247 /*FUNCTION Mesh::CrackMesh{{{*/ 2248 2248 void Mesh::CrackMesh(BamgOpts* bamgopts) { 2249 2249 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/CrackMesh)*/ … … 2264 2264 //Return if no edge is cracked 2265 2265 if(k==0) return; 2266 if (verbose>4) printf(" number of Cracked Edges = %i\n",k);2266 if (verbose>4) _printLine_(" number of Cracked Edges = " << k); 2267 2267 2268 2268 //Initialize Cracked edge … … 2298 2298 if (splitvertex[i1]==3 || splitvertex[i2]==3){ 2299 2299 delete [] splitvertex; 2300 _error _("Crossing rifts not supported yet");2300 _error2_("Crossing rifts not supported yet"); 2301 2301 } 2302 2302 } … … 2305 2305 2306 2306 //Add new vertices 2307 if (verbose>4) printf(" number of Cracked Vertices = %i\n",NbCrackedVertices);2307 if (verbose>4) _printLine_(" number of Cracked Vertices = " << NbCrackedVertices); 2308 2308 if (NbCrackedVertices){ 2309 CrackedVertices= (long*)xmalloc(2*NbCrackedVertices*sizeof(double));2309 CrackedVertices=xNew<long>(2*NbCrackedVertices); 2310 2310 num=0; 2311 2311 for (i=0;i<nbv;i++){ … … 2374 2374 } 2375 2375 } 2376 // printf("%i -> %i %i %i, edge [%i->%i %i->%i]\n",element_renu[GetId(ta.t)],GetId((*ta.t)[0])+1,GetId((*ta.t)[1])+1,GetId((*ta.t)[2])+1,i1,j1,i2,j2);2376 //_printLine_(element_renu[GetId(ta.t)] << " -> " << GetId((*ta.t)[0])+1 << " " << GetId((*ta.t)[1])+1 << " " << GetId((*ta.t)[2])+1 << ", edge [" << i1 << "->" << j1 << " " << i2 << "->" << j2 << "]"); 2377 2377 ta = Next(ta).Adj(); 2378 if (count++>50) _error _("Maximum number of iteration exceeded");2378 if (count++>50) _error2_("Maximum number of iteration exceeded"); 2379 2379 }while ((tbegin != ta)); 2380 2380 } … … 2383 2383 for(i=0;i<NbCrackedEdges;i++){ 2384 2384 if (Edgeflags[i]!=2){ 2385 _error _("A problem occured: at least one crack edge (number %i) does not belong to 2 elements",i+1);2385 _error2_("A problem occured: at least one crack edge (number " << i+1 << ") does not belong to 2 elements"); 2386 2386 } 2387 2387 } … … 2392 2392 2393 2393 } 2394 /*}}} 1*/2395 /*FUNCTION Mesh::Echo{{{ 1*/2394 /*}}}*/ 2395 /*FUNCTION Mesh::Echo{{{*/ 2396 2396 void Mesh::Echo(void) { 2397 2397 2398 2398 int i; 2399 2399 2400 printf("Mesh Echo:\n");2401 printf(" nbv = %i\n",nbv);2402 printf(" nbt = %i\n",nbt);2403 printf(" nbe = %i\n",nbe);2404 printf(" nbq = %i\n",nbq);2405 printf(" index:\n");2400 _printLine_("Mesh Echo:"); 2401 _printLine_(" nbv = " << nbv); 2402 _printLine_(" nbt = " << nbt); 2403 _printLine_(" nbe = " << nbe); 2404 _printLine_(" nbq = " << nbq); 2405 _printLine_(" index:"); 2406 2406 for (i=0;i<nbt;i++){ 2407 printf(" %4i: [%4i %4i %4i]\n",i+1,2408 ((BamgVertex *)triangles[i](0))?GetId(triangles[i][0])+1:0,2409 ((BamgVertex *)triangles[i](1))?GetId(triangles[i][1])+1:0,2410 ((BamgVertex *)triangles[i](2))?GetId(triangles[i][2])+1:0);2411 } 2412 printf(" coordinates:\n");2407 _printLine_(" " << setw(4) << i+1 << ": [" 2408 << setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][0])+1:0) << " " 2409 << setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][1])+1:0) << " " 2410 << setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][2])+1:0) << "]"); 2411 } 2412 _printLine_(" coordinates:"); 2413 2413 for (i=0;i<nbv;i++){ 2414 printf(" %4i: [%g %g]\n",i+1,vertices[i].r.x,vertices[i].r.y);2415 } 2416 2417 } 2418 /*}}} 1*/2419 /*FUNCTION Mesh::ForceBoundary{{{ 1*/2414 _printLine_(" " << setw(4) << i+1 << ": [" << vertices[i].r.x << " " << vertices[i].r.y << "]"); 2415 } 2416 2417 } 2418 /*}}}*/ 2419 /*FUNCTION Mesh::ForceBoundary{{{*/ 2420 2420 void Mesh::ForceBoundary() { 2421 2421 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ForceBoundary)*/ … … 2426 2426 2427 2427 //display 2428 if (verbose > 2) printf(" ForceBoundary nb of edge: %i\n",nbe);2428 if (verbose > 2) _printLine_(" ForceBoundary nb of edge: " << nbe); 2429 2429 2430 2430 //check that there is no triangle with 0 determinant … … 2433 2433 } 2434 2434 if (k!=0) { 2435 _error _("there is %i triangles of mes = 0",k);2435 _error2_("there is " << k << " triangles of mes = 0"); 2436 2436 } 2437 2437 … … 2447 2447 if (nbswp) nbfe++; 2448 2448 if ( nbswp < 0 && k < 5){ 2449 _error _("Missing Edge %i, v0=%i,v1=%i",i,GetId(edges[i][0]),GetId(edges[i][1]));2449 _error2_("Missing Edge " << i << ", v0=" << GetId(edges[i][0]) << ",v1=" << GetId(edges[i][1])); 2450 2450 } 2451 2451 } 2452 2452 2453 2453 if (k!=0) { 2454 _error _("There are %i lost edges, the boundary might be crossing",k);2454 _error2_("There are " << k << " lost edges, the boundary might be crossing"); 2455 2455 } 2456 2456 for (int j=0;j<nbv;j++){ 2457 2457 Nbswap += vertices[j].Optim(1,0); 2458 2458 } 2459 if (verbose > 3) printf(" number of inforced edge = %i, number of swap= %i\n",nbfe,Nbswap);2460 } 2461 /*}}} 1*/2462 /*FUNCTION Mesh::FindSubDomain{{{ 1*/2459 if (verbose > 3) _printLine_(" number of inforced edge = " << nbfe << ", number of swap= " << Nbswap); 2460 } 2461 /*}}}*/ 2462 /*FUNCTION Mesh::FindSubDomain{{{*/ 2463 2463 void Mesh::FindSubDomain(int OutSide) { 2464 2464 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FindSubDomain)*/ … … 2467 2467 2468 2468 if (verbose >2){ 2469 if (OutSide) printf(" Find all external sub-domain\n");2470 else printf(" Find all internal sub-domain\n");2469 if (OutSide) _printLine_(" Find all external sub-domain"); 2470 else _printLine_(" Find all internal sub-domain"); 2471 2471 } 2472 2472 short * HeapArete = new short[nbt]; … … 2534 2534 if (nbt == nbtout || !NbSubDomTot) { 2535 2535 delete [] HeapArete; 2536 _error _("The boundary is not close: all triangles are outside");2536 _error2_("The boundary is not close: all triangles are outside"); 2537 2537 } 2538 2538 … … 2572 2572 if (k!=nbsubdomains){ 2573 2573 delete [] mark; 2574 _error _("k!=nbsubdomains");2574 _error2_("k!=nbsubdomains"); 2575 2575 } 2576 2576 if(OutSide) … … 2613 2613 }//while (t) 2614 2614 } 2615 if(verbose>4) printf(" Number of removes subdomains (OutSideMesh) = %i\n",nbsubdomains-j);2615 if(verbose>4) _printLine_(" Number of removes subdomains (OutSideMesh) = " << nbsubdomains-j); 2616 2616 nbsubdomains=j; 2617 2617 } … … 2662 2662 subdomains[i].head=t=ta; 2663 2663 if(t<triangles || t >= triangles+nbt || t->det < 0 || t->link == 0) { 2664 _error _("bad definition of SubSomain %i",i);2664 _error2_("bad definition of SubSomain " << i); 2665 2665 } 2666 2666 long it = GetId(t); … … 2677 2677 kkk++; 2678 2678 if (mark[GetId(tt)]>=0){ 2679 _error _("mark[GetId(tt)]>=0");2679 _error2_("mark[GetId(tt)]>=0"); 2680 2680 } 2681 2681 mark[GetId(tt)]=i; … … 2686 2686 ta = Previous(Adj(ta)); 2687 2687 if(t == (Triangle *) ta) { 2688 _error _("bad definition of SubSomain %i",i);2688 _error2_("bad definition of SubSomain " << i); 2689 2689 } 2690 2690 } … … 2692 2692 2693 2693 if (inew < nbsubdomains) { 2694 if (verbose>5) printf("WARNING: %i SubDomains are being removed\n",nbsubdomains-inew);2694 if (verbose>5) _printLine_("WARNING: " << nbsubdomains-inew << " SubDomains are being removed"); 2695 2695 nbsubdomains=inew;} 2696 2696 … … 2707 2707 if(!triangles[it].link) nbtout++; 2708 2708 } 2709 /*}}} 1*/2710 /*FUNCTION Mesh::GetId(const Triangle & t) const{{{ 1*/2709 /*}}}*/ 2710 /*FUNCTION Mesh::GetId(const Triangle & t) const{{{*/ 2711 2711 long Mesh::GetId(const Triangle & t) const { 2712 2712 return &t - triangles; 2713 2713 } 2714 /*}}} 1*/2715 /*FUNCTION Mesh::GetId(const Triangle * t) const{{{ 1*/2714 /*}}}*/ 2715 /*FUNCTION Mesh::GetId(const Triangle * t) const{{{*/ 2716 2716 long Mesh::GetId(const Triangle * t) const { 2717 2717 return t - triangles; 2718 2718 } 2719 /*}}} 1*/2720 /*FUNCTION Mesh::GetId(const BamgVertex & t) const{{{ 1*/2719 /*}}}*/ 2720 /*FUNCTION Mesh::GetId(const BamgVertex & t) const{{{*/ 2721 2721 long Mesh::GetId(const BamgVertex & t) const { 2722 2722 return &t - vertices; 2723 2723 } 2724 /*}}} 1*/2725 /*FUNCTION Mesh::GetId(const BamgVertex * t) const{{{ 1*/2724 /*}}}*/ 2725 /*FUNCTION Mesh::GetId(const BamgVertex * t) const{{{*/ 2726 2726 long Mesh::GetId(const BamgVertex * t) const { 2727 2727 return t - vertices; 2728 2728 } 2729 /*}}} 1*/2730 /*FUNCTION Mesh::GetId(const Edge & t) const{{{ 1*/2729 /*}}}*/ 2730 /*FUNCTION Mesh::GetId(const Edge & t) const{{{*/ 2731 2731 long Mesh::GetId(const Edge & t) const { 2732 2732 return &t - edges; 2733 2733 } 2734 /*}}} 1*/2735 /*FUNCTION Mesh::GetId(const Edge * t) const{{{ 1*/2734 /*}}}*/ 2735 /*FUNCTION Mesh::GetId(const Edge * t) const{{{*/ 2736 2736 long Mesh::GetId(const Edge * t) const { 2737 2737 return t - edges; 2738 2738 } 2739 /*}}} 1*/2740 /*FUNCTION Mesh::Init{{{ 1*/2739 /*}}}*/ 2740 /*FUNCTION Mesh::Init{{{*/ 2741 2741 void Mesh::Init(long maxnbv_in) { 2742 2742 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/PreInit)*/ … … 2786 2786 } 2787 2787 } 2788 /*}}} 1*/2789 /*FUNCTION Mesh::Insert{{{ 1*/2788 /*}}}*/ 2789 /*FUNCTION Mesh::Insert{{{*/ 2790 2790 void Mesh::Insert() { 2791 2791 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Insert)*/ … … 2800 2800 2801 2801 //Display info 2802 if (verbose>2) printf(" Insert initial %i vertices\n",nbv);2802 if (verbose>2) _printLine_(" Insert initial " << nbv << " vertices"); 2803 2803 2804 2804 //Compute integer coordinates for the existing vertices … … 2848 2848 //if i is higher than nbv, it means that all the determinants are 0, 2849 2849 //all vertices are aligned! 2850 if (++i>=nbv) _error _("all the vertices are aligned");2850 if (++i>=nbv) _error2_("all the vertices are aligned"); 2851 2851 } 2852 2852 // exchange i et 2 in "orderedvertices" so that … … 2891 2891 /*Now, add the vertices One by One*/ 2892 2892 long NbSwap=0; 2893 if (verbose>3) printf(" Begining of insertion process...\n");2893 if (verbose>3) _printLine_(" Begining of insertion process..."); 2894 2894 2895 2895 for (int icount=2; icount<nbv; icount++) { … … 2914 2914 //Display info 2915 2915 if (verbose>3) { 2916 printf(" NbSwap of insertion: %i\n",NbSwap);2917 printf(" NbSwap/nbv: %i\n",NbSwap/nbv);2916 _printLine_(" NbSwap of insertion: " << NbSwap); 2917 _printLine_(" NbSwap/nbv: " << NbSwap/nbv); 2918 2918 } 2919 2919 … … 2929 2929 NbSwap += orderedvertices[is1]->Optim(0,0); 2930 2930 if (verbose>3) { 2931 printf(" Optim Loop: %i\n",Nbloop);2932 printf(" NbSwap/nbv: %i\n",NbSwap/nbv);2931 _printLine_(" Optim Loop: " << Nbloop); 2932 _printLine_(" NbSwap/nbv: " << NbSwap/nbv); 2933 2933 } 2934 2934 if(!NbSwap) break; … … 2938 2938 #endif 2939 2939 } 2940 /*}}} 1*/2941 /*FUNCTION Mesh::InsertNewPoints{{{ 1*/2940 /*}}}*/ 2941 /*FUNCTION Mesh::InsertNewPoints{{{*/ 2942 2942 long Mesh::InsertNewPoints(long nbvold,long & NbTSwap) { 2943 2943 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/InsertNewPoints)*/ … … 2953 2953 2954 2954 //display info if required 2955 if (verbose>5) printf(" Try to Insert %i new points\n",nbvnew);2955 if (verbose>5) _printLine_(" Try to Insert " << nbvnew << " new points"); 2956 2956 2957 2957 //return if no new points … … 2984 2984 long j=vj.ReferenceNumber; 2985 2985 if (&vj!=orderedvertices[j]){ 2986 _error _("&vj!= orderedvertices[j]");2986 _error2_("&vj!= orderedvertices[j]"); 2987 2987 } 2988 2988 if(i!=j){ … … 2994 2994 if (tcvj && !tcvj->link){ 2995 2995 tcvj->Echo(); 2996 _error _("problem inserting point in InsertNewPoints (tcvj=%p and tcvj->link=%i)",tcvj,tcvj->link);2996 _error2_("problem inserting point in InsertNewPoints (tcvj=" << tcvj << " and tcvj->link=" << tcvj->link << ")"); 2997 2997 } 2998 2998 quadtree->Add(vj); … … 3003 3003 } 3004 3004 if (verbose>3) { 3005 printf(" number of new points: %i\n",iv);3006 printf(" number of to close (?) points: %i\n",nbv-iv);3007 printf(" number of swap after: %i\n",NbSwap);3005 _printLine_(" number of new points: " << iv); 3006 _printLine_(" number of to close (?) points: " << nbv-iv); 3007 _printLine_(" number of swap after: " << NbSwap); 3008 3008 } 3009 3009 nbv = iv; 3010 3010 3011 3011 for (i=nbvold;i<nbv;i++) NbSwap += vertices[i].Optim(1); 3012 if (verbose>3) printf(" NbSwap=%i\n",NbSwap);3012 if (verbose>3) _printLine_(" NbSwap=" << NbSwap); 3013 3013 3014 3014 NbTSwap += NbSwap ; 3015 3015 return nbv-nbvold; 3016 3016 } 3017 /*}}} 1*/3018 /*FUNCTION Mesh::isCracked{{{ 1*/3017 /*}}}*/ 3018 /*FUNCTION Mesh::isCracked{{{*/ 3019 3019 int Mesh::isCracked() const { 3020 3020 return NbCrackedVertices != 0; 3021 3021 } 3022 /*}}} 1*/3023 /*FUNCTION Mesh::MakeGeomEdgeToEdge{{{ 1*/3022 /*}}}*/ 3023 /*FUNCTION Mesh::MakeGeomEdgeToEdge{{{*/ 3024 3024 Edge** Mesh::MakeGeomEdgeToEdge() { 3025 3025 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MakeGeomEdgeToEdge)*/ 3026 3026 3027 3027 if (!Gh.nbe){ 3028 _error _("!Gh.nbe");3028 _error2_("!Gh.nbe"); 3029 3029 } 3030 3030 Edge **e= new (Edge* [Gh.nbe]); … … 3056 3056 if (!e[i]){ 3057 3057 kk++; 3058 if(kk<10) printf("BUG: the geometrical edge %i is on no edge curve\n",i);3059 } 3060 } 3061 if(kk) _error _("See above");3058 if(kk<10) _printLine_("BUG: the geometrical edge " << i << " is on no edge curve"); 3059 } 3060 } 3061 if(kk) _error2_("See above"); 3062 3062 3063 3063 return e; 3064 3064 } 3065 /*}}} 1*/3066 /*FUNCTION Mesh::MakeQuadrangles{{{ 1*/3065 /*}}}*/ 3066 /*FUNCTION Mesh::MakeQuadrangles{{{*/ 3067 3067 void Mesh::MakeQuadrangles(double costheta){ 3068 3068 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MakeQuadrangles)*/ … … 3070 3070 long int verbose=0; 3071 3071 3072 if (verbose>2) printf("MakeQuadrangles costheta = %g\n",costheta);3072 if (verbose>2) _printLine_("MakeQuadrangles costheta = " << costheta); 3073 3073 3074 3074 if (costheta >1) { 3075 if (verbose>5) printf(" do nothing: costheta > 1\n");3075 if (verbose>5) _printLine_(" do nothing: costheta > 1"); 3076 3076 } 3077 3077 … … 3100 3100 nbq = kk; 3101 3101 if (verbose>2){ 3102 printf(" number of quadrilaterals = %i\n",nbq);3103 printf(" number of triangles = %i\n",nbt-nbtout- nbq*2);3104 printf(" number of outside triangles = %i\n",nbtout);3102 _printLine_(" number of quadrilaterals = " << nbq); 3103 _printLine_(" number of triangles = " << nbt-nbtout- nbq*2); 3104 _printLine_(" number of outside triangles = " << nbtout); 3105 3105 } 3106 3106 delete [] qq; 3107 3107 } 3108 /*}}} 1*/3109 /*FUNCTION Mesh::MakeBamgQuadtree{{{ 1*/3108 /*}}}*/ 3109 /*FUNCTION Mesh::MakeBamgQuadtree{{{*/ 3110 3110 void Mesh::MakeBamgQuadtree() { 3111 3111 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MakeBamgQuadtree)*/ … … 3115 3115 3116 3116 } 3117 /*}}} 1*/3118 /*FUNCTION Mesh::MaxinalHmax{{{ 1*/3117 /*}}}*/ 3118 /*FUNCTION Mesh::MaxinalHmax{{{*/ 3119 3119 double Mesh::MaximalHmax() { 3120 3120 return Max(pmax.x-pmin.x,pmax.y-pmin.y); 3121 3121 } 3122 /*}}} 1*/3123 /*FUNCTION Mesh::MaxSubDivision{{{ 1*/3122 /*}}}*/ 3123 /*FUNCTION Mesh::MaxSubDivision{{{*/ 3124 3124 void Mesh::MaxSubDivision(double maxsubdiv) { 3125 3125 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/MaxSubDivision)*/ … … 3128 3128 3129 3129 const double maxsubdiv2 = maxsubdiv*maxsubdiv; 3130 if(verbose>1) printf(" Limit the subdivision of a edges in the new mesh by %g\n",maxsubdiv);3130 if(verbose>1) _printLine_(" Limit the subdivision of a edges in the new mesh by " << maxsubdiv); 3131 3131 // for all the edges 3132 3132 // if the len of the edge is to long … … 3171 3171 } 3172 3172 if(verbose>3){ 3173 printf(" number of metric changes = %i, maximum number of subdivision of a edges before change = %g\n",nbchange,pow(lmax,0.5));3174 } 3175 } 3176 /*}}} 1*/3177 /*FUNCTION Mesh::MetricAt{{{ 1*/3173 _printLine_(" number of metric changes = " << nbchange << ", maximum number of subdivision of a edges before change = " << pow(lmax,0.5)); 3174 } 3175 } 3176 /*}}}*/ 3177 /*FUNCTION Mesh::MetricAt{{{*/ 3178 3178 Metric Mesh::MetricAt(const R2 & A) const { 3179 3179 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/MetricAt)*/ … … 3195 3195 } 3196 3196 } 3197 /*}}} 1*/3198 /*FUNCTION Mesh::MininalHmin{{{ 1*/3197 /*}}}*/ 3198 /*FUNCTION Mesh::MininalHmin{{{*/ 3199 3199 double Mesh::MinimalHmin() { 3200 3200 return 2.0/coefIcoor; 3201 3201 } 3202 /*}}} 1*/3203 /*FUNCTION Mesh::NearestVertex{{{ 1*/3202 /*}}}*/ 3203 /*FUNCTION Mesh::NearestVertex{{{*/ 3204 3204 BamgVertex* Mesh::NearestVertex(Icoor1 i,Icoor1 j) { 3205 3205 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NearestVertex)*/ 3206 3206 return quadtree->NearestVertex(i,j); 3207 3207 } 3208 /*}}} 1*/3209 /*FUNCTION Mesh::NewPoints{{{ 1*/3208 /*}}}*/ 3209 /*FUNCTION Mesh::NewPoints{{{*/ 3210 3210 void Mesh::NewPoints(Mesh & Bh,BamgOpts* bamgopts,int KeepVertices){ 3211 3211 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/NewPoints)*/ … … 3225 3225 /*First, insert old points if requested*/ 3226 3226 if (KeepVertices && (&Bh != this) && (nbv+Bh.nbv< maxnbv)){ 3227 if (verbose>5) printf(" Inserting initial mesh points\n");3227 if (verbose>5) _printLine_(" Inserting initial mesh points"); 3228 3228 for (i=0;i<Bh.nbv;i++){ 3229 3229 BamgVertex &bv=Bh[i]; … … 3244 3244 // Big loop (most time consuming) 3245 3245 int iter=0; 3246 if (verbose>5) printf(" Big loop\n");3246 if (verbose>5) _printLine_(" Big loop"); 3247 3247 do { 3248 3248 /*Update variables*/ … … 3258 3258 //check i 3259 3259 if (i<0 || i>=nbt ){ 3260 _error _("Index problem in NewPoints (i=%i not in [0 %i])",i,nbt-1);3260 _error2_("Index problem in NewPoints (i=" << i << " not in [0 " << nbt-1 << "])"); 3261 3261 } 3262 3262 //change first_np_or_next_t[i] … … 3309 3309 } 3310 3310 if (ta.EdgeVertex(0)!=s){ 3311 _error _("ta.EdgeVertex(0)!=s");3311 _error2_("ta.EdgeVertex(0)!=s"); 3312 3312 } 3313 3313 ta = Next(Adj(ta)); … … 3326 3326 NbTSwap += NbSwapf ; 3327 3327 } 3328 /*}}} 1*/3329 /*FUNCTION Mesh::ProjectOnCurve{{{ 1*/3328 /*}}}*/ 3329 /*FUNCTION Mesh::ProjectOnCurve{{{*/ 3330 3330 GeomEdge* Mesh::ProjectOnCurve( Edge & BhAB, BamgVertex & vA, BamgVertex & vB, 3331 3331 double theta,BamgVertex & R,VertexOnEdge & BR,VertexOnGeom & GR) { … … 3344 3344 } 3345 3345 else { 3346 _error _("ProjectOnCurve On BamgVertex %i forget call to SetVertexFieldOnBTh",BTh.GetId(vA));3346 _error2_("ProjectOnCurve On BamgVertex " << BTh.GetId(vA) << " forget call to SetVertexFieldOnBTh"); 3347 3347 } 3348 3348 … … 3355 3355 } 3356 3356 else { 3357 _error _("ProjectOnCurve On BamgVertex %i forget call to SetVertexFieldOnBTh",BTh.GetId(vB));3357 _error2_("ProjectOnCurve On BamgVertex " << BTh.GetId(vB) << " forget call to SetVertexFieldOnBTh"); 3358 3358 } 3359 3359 Edge * e = &BhAB; 3360 3360 if (!pA || !pB || !e){ 3361 _error _("!pA || !pB || !e");3361 _error2_("!pA || !pB || !e"); 3362 3362 } 3363 3363 // be carefull the back ground edge e is on same geom edge … … 3365 3365 //check Is a background Mesh; 3366 3366 if (e<BTh.edges || e>=BTh.edges+BTh.nbe){ 3367 _error _("e<BTh.edges || e>=BTh.edges+BTh.nbe");3367 _error2_("e<BTh.edges || e>=BTh.edges+BTh.nbe"); 3368 3368 } 3369 3369 // walk on BTh edge … … 3388 3388 } 3389 3389 else{ // do the search by walking 3390 _error _("case not supported yet");3390 _error2_("case not supported yet"); 3391 3391 } 3392 3392 … … 3452 3452 3453 3453 } 3454 _error _("Big bug...");3454 _error2_("Big bug..."); 3455 3455 return 0; // just for the compiler 3456 3456 } 3457 /*}}} 1*/3458 /*FUNCTION Mesh::ReconstructExistingMesh{{{ 1*/3457 /*}}}*/ 3458 /*FUNCTION Mesh::ReconstructExistingMesh{{{*/ 3459 3459 void Mesh::ReconstructExistingMesh(){ 3460 3460 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FillHoleInMesh)*/ … … 3475 3475 // find extrema coordinates of vertices pmin,pmax 3476 3476 long i; 3477 if(verbose>2) printf(" Reconstruct mesh of %i vertices\n",nbv);3477 if(verbose>2) _printLine_(" Reconstruct mesh of " << nbv << " vertices"); 3478 3478 3479 3479 //initialize orderedvertices … … 3493 3493 } 3494 3494 if (kk != nbe){ 3495 _error _("There are %i double edges in the mesh",kk-nbe);3495 _error2_("There are " << kk-nbe << " double edges in the mesh"); 3496 3496 } 3497 3497 … … 3525 3525 //An edge belongs to 2 triangles 3526 3526 else { 3527 _error _("The edge (%i , %i) belongs to more than 2 triangles",GetId(triangles[i][VerticesOfTriangularEdge[j][0]]),GetId(triangles[i][VerticesOfTriangularEdge[j][1]]));3527 _error2_("The edge (" << GetId(triangles[i][VerticesOfTriangularEdge[j][0]]) << " , " << GetId(triangles[i][VerticesOfTriangularEdge[j][1]]) << ") belongs to more than 2 triangles"); 3528 3528 } 3529 3529 } … … 3532 3532 //Display info if required 3533 3533 if(verbose>5) { 3534 printf(" info of Mesh:\n");3535 printf(" - number of vertices = %i \n",nbv);3536 printf(" - number of triangles = %i \n",nbt);3537 printf(" - number of given edges = %i \n",nbe);3538 printf(" - number of all edges = %i \n" ,edge4->nb());3539 printf(" - Euler number 1 - nb of holes = %i \n" ,nbt-edge4->nb()+nbv);3534 _printLine_(" info of Mesh:"); 3535 _printLine_(" - number of vertices = " << nbv << " "); 3536 _printLine_(" - number of triangles = " << nbt << " "); 3537 _printLine_(" - number of given edges = " << nbe << " "); 3538 _printLine_(" - number of all edges = " << edge4->nb()); 3539 _printLine_(" - Euler number 1 - nb of holes = " << nbt-edge4->nb()+nbv); 3540 3540 } 3541 3541 … … 3554 3554 if (k<10) { 3555 3555 //print only 10 edges 3556 printf("Lost boundary edges %i : %i %i\n",i,edge4->i(i),edge4->j(i));3556 _printLine_("Lost boundary edges " << i << " : " << edge4->i(i) << " " << edge4->j(i)); 3557 3557 } 3558 3558 else if (k==10){ 3559 printf("Other lost boundary edges not shown...\n");3559 _printLine_("Other lost boundary edges not shown..."); 3560 3560 } 3561 3561 } … … 3563 3563 } 3564 3564 if(k) { 3565 _error _("%i boundary edges (from the geometry) are not defined as mesh edges",k);3565 _error2_(k << " boundary edges (from the geometry) are not defined as mesh edges"); 3566 3566 } 3567 3567 … … 3590 3590 for (i=2;det(orderedvertices[0]->i,orderedvertices[1]->i,orderedvertices[i]->i)==0;) 3591 3591 if (++i>=nbvb) { 3592 _error _("ReconstructExistingMesh: All the vertices are aligned");3592 _error2_("ReconstructExistingMesh: All the vertices are aligned"); 3593 3593 } 3594 3594 //Move this vertex (i) to the 2d position in orderedvertices … … 3650 3650 } 3651 3651 if(nbloss) { 3652 _error _("we lost %i existing edges other %i",nbloss,knbe);3652 _error2_("we lost " << nbloss << " existing edges other " << knbe); 3653 3653 } 3654 3654 … … 3725 3725 subdomains = savesubdomains; 3726 3726 if (k) { 3727 _error _("number of triangles edges alone = %i",k);3727 _error2_("number of triangles edges alone = " << k); 3728 3728 } 3729 3729 FindSubDomain(); … … 3745 3745 /*Check that the 2 vertices are on geometry AND required*/ 3746 3746 if(!edges[i][j].GeomEdgeHook->IsRequiredVertex()){ 3747 printf("ReconstructExistingMesh error message: problem with the edge number %i: [%i %i]\n",i+1,GetId(edges[i][0])+1,GetId(edges[i][1])+1);3748 printf("This edge is on geometrical edge number %i\n",Gh.GetId(edges[i].GeomEdgeHook)+1);3747 _printLine_("ReconstructExistingMesh error message: problem with the edge number " << i+1 << ": [" << GetId(edges[i][0])+1 << " " << GetId(edges[i][1])+1 << "]"); 3748 _printLine_("This edge is on geometrical edge number " << Gh.GetId(edges[i].GeomEdgeHook)+1); 3749 3749 if (edges[i][j].GeomEdgeHook->OnGeomVertex()) 3750 printf("the vertex number %i of this edge is a geometric BamgVertex number %i\n",GetId(edges[i][j])+1,Gh.GetId(edges[i][j].GeomEdgeHook->gv)+1);3750 _printLine_("the vertex number " << GetId(edges[i][j])+1 << " of this edge is a geometric BamgVertex number " << Gh.GetId(edges[i][j].GeomEdgeHook->gv)+1); 3751 3751 else if (edges[i][j].GeomEdgeHook->OnGeomEdge()) 3752 printf("the vertex number %i of this edge is a geometric Edge number %i\n",GetId(edges[i][j])+1,Gh.GetId(edges[i][j].GeomEdgeHook->ge)+1);3752 _printLine_("the vertex number " << GetId(edges[i][j])+1 << " of this edge is a geometric Edge number " << Gh.GetId(edges[i][j].GeomEdgeHook->ge)+1); 3753 3753 else 3754 printf("Its pointer is %p\n",edges[i][j].GeomEdgeHook);3755 3756 printf("This edge is on geometry and has no adjacent edge (open curve) and one of the tip is not required\n");3757 _error _("See above (might be cryptic...)");3754 _printLine_("Its pointer is " << edges[i][j].GeomEdgeHook); 3755 3756 _printLine_("This edge is on geometry and has no adjacent edge (open curve) and one of the tip is not required"); 3757 _error2_("See above (might be cryptic...)"); 3758 3758 } 3759 3759 } … … 3762 3762 } 3763 3763 } 3764 /*}}} 1*/3765 /*FUNCTION Mesh::TrianglesRenumberBySubDomain{{{ 1*/3764 /*}}}*/ 3765 /*FUNCTION Mesh::TrianglesRenumberBySubDomain{{{*/ 3766 3766 void Mesh::TrianglesRenumberBySubDomain(bool justcompress){ 3767 3767 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ReNumberingTheTriangleBySubDomain)*/ … … 3778 3778 t=t0=subdomains[i].head; 3779 3779 if (!t0){ // not empty sub domain 3780 _error _("!t0");3780 _error2_("!t0"); 3781 3781 } 3782 3782 do { 3783 3783 long kt = GetId(t); 3784 3784 if (kt<0 || kt >= nbt ){ 3785 _error _("kt<0 || kt >= nbt");3785 _error2_("kt<0 || kt >= nbt"); 3786 3786 } 3787 3787 if (renu[kt]!=-1){ 3788 _error _("renu[kt]!=-1");3788 _error2_("renu[kt]!=-1"); 3789 3789 } 3790 3790 renu[kt]=k++; … … 3803 3803 } 3804 3804 if (k != nbt){ 3805 _error _("k != nbt");3805 _error2_("k != nbt"); 3806 3806 } 3807 3807 // do the change on all the pointeur … … 3831 3831 3832 3832 } 3833 /*}}} 1*/3834 /*FUNCTION Mesh::VerticesRenumber{{{ 1*/3833 /*}}}*/ 3834 /*FUNCTION Mesh::VerticesRenumber{{{*/ 3835 3835 void Mesh::VerticesRenumber(long * renu) { 3836 3836 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ReNumberingVertex)*/ … … 3842 3842 long it,ie,i; 3843 3843 3844 printf("renumbering triangles\n");3844 _printLine_("renumbering triangles"); 3845 3845 for ( it=0;it<nbt;it++) 3846 3846 triangles[it].Renumbering(vertices,ve,renu); 3847 3847 3848 printf("renumbering edges\n");3848 _printLine_("renumbering edges"); 3849 3849 for ( ie=0;ie<nbe;ie++) 3850 3850 edges[ie].Renumbering(vertices,ve,renu); 3851 3851 3852 printf("renumbering vertices on geom\n");3852 _printLine_("renumbering vertices on geom"); 3853 3853 for (i=0;i< NbVerticesOnGeomVertex;i++) 3854 3854 { … … 3858 3858 } 3859 3859 3860 printf("renumbering vertices on edge\n");3860 _printLine_("renumbering vertices on edge"); 3861 3861 for (i=0;i< NbVerticesOnGeomEdge;i++) 3862 3862 { … … 3866 3866 } 3867 3867 3868 printf("renumbering vertices on Bth vertex\n");3868 _printLine_("renumbering vertices on Bth vertex"); 3869 3869 for (i=0;i< NbVertexOnBThVertex;i++) 3870 3870 { … … 3905 3905 for ( it=0;it<nbv;it++) renu[i]= -renu[i]-1; 3906 3906 } 3907 /*}}} 1*/3908 /*FUNCTION Mesh::SetIntCoor{{{ 1*/3907 /*}}}*/ 3908 /*FUNCTION Mesh::SetIntCoor{{{*/ 3909 3909 void Mesh::SetIntCoor(const char * strfrom) { 3910 3910 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/SetIntCoor)*/ … … 3929 3929 coefIcoor= (MaxICoor)/(Max(pmax.x-pmin.x,pmax.y-pmin.y)); 3930 3930 if (coefIcoor<=0){ 3931 _error _("coefIcoor should be positive, a problem in the geometry is likely");3931 _error2_("coefIcoor should be positive, a problem in the geometry is likely"); 3932 3932 } 3933 3933 … … 3956 3956 number_of_errors++; 3957 3957 if (number_of_errors<20){ 3958 printf("Area of Triangle %i < 0 (det=%i)\n",i+1,triangles[i].det);3958 _printLine_("Area of Triangle " << i+1 << " < 0 (det=" << triangles[i].det << ")"); 3959 3959 } 3960 3960 } … … 3965 3965 } 3966 3966 3967 if (number_of_errors) _error _("Fatal error: some triangles have negative areas, see above");3967 if (number_of_errors) _error2_("Fatal error: some triangles have negative areas, see above"); 3968 3968 } 3969 /*}}} 1*/3970 /*FUNCTION Mesh::ShowRegulaty{{{ 1*/3969 /*}}}*/ 3970 /*FUNCTION Mesh::ShowRegulaty{{{*/ 3971 3971 void Mesh::ShowRegulaty() const { 3972 3972 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr>*/ … … 4024 4024 gammamn=sqrt(gammamn); 4025 4025 gammamx=sqrt(gammamx); 4026 printf(" Adaptmesh info:\n");4027 printf(" number of triangles = %i\n",nt);4028 printf(" hmin = %g, hmax=%g\n",hmin,hmax);4029 printf(" area = %g, M area = %g, M area/( |Khat| nt) = %g\n",area,Marea,Marea/(aireKh*nt));4030 printf(" infinite-regularity(?): min = %g, max = %g\n",gammamn,gammamx);4031 printf(" anisomax = %g, beta max = %g, min = %g\n",pow(alpha2,0.5),1./pow(beta/aireKh,0.5),1./pow(beta0/aireKh,0.5));4026 _printLine_(" Adaptmesh info:"); 4027 _printLine_(" number of triangles = " << nt); 4028 _printLine_(" hmin = " << hmin << ", hmax=" << hmax); 4029 _printLine_(" area = " << area << ", M area = " << Marea << ", M area/( |Khat| nt) = " << Marea/(aireKh*nt)); 4030 _printLine_(" infinite-regularity(?): min = " << gammamn << ", max = " << gammamx); 4031 _printLine_(" anisomax = " << pow(alpha2,0.5) << ", beta max = " << 1./pow(beta/aireKh,0.5) << ", min = " << 1./pow(beta0/aireKh,0.5)); 4032 4032 } 4033 /*}}} 1*/4034 /*FUNCTION Mesh::ShowHistogram{{{ 1*/4033 /*}}}*/ 4034 /*FUNCTION Mesh::ShowHistogram{{{*/ 4035 4035 void Mesh::ShowHistogram() const { 4036 4036 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ShowHistogram)*/ … … 4063 4063 } 4064 4064 } 4065 printf(" --- Histogram of the unit mesh, nb of edges = %i\n",nbedges);4066 printf(" length of edge in | %% of edge | Nb of edges \n");4067 printf(" --------------------+-------------+-------------\n");4065 _printLine_(" --- Histogram of the unit mesh, nb of edges = " << nbedges); 4066 _printLine_(" length of edge in | %% of edge | Nb of edges "); 4067 _printLine_(" --------------------+-------------+-------------"); 4068 4068 for (i=0;i<=kmax;i++){ 4069 if (i==0) printf(" %10i",0);4070 else printf(" %10g",exp(lmin+i/delta));4071 if (i==kmax) printf(" +inf ");4072 else printf(" %10g",exp(lmin+(i+1)/delta));4073 printf("| %10g |\n",((long) ((10000.0 * histo[i])/ nbedges))/100.0);4074 printf(" %i\n",histo[i]);4075 } 4076 printf(" --------------------+-------------+-------------\n");4069 if (i==0) _printString_( " " << setw(10) << 0.); 4070 else _printString_( " " << setw(10) << exp(lmin+i/delta)); 4071 if (i==kmax) _printString_(" +inf "); 4072 else _printString_( " " << setw(10) << exp(lmin+(i+1)/delta)); 4073 _printLine_("| " << setw(10) << (long((10000. * histo[i])/ nbedges)/100.) << " |"); 4074 _printLine_(" " << histo[i]); 4075 } 4076 _printLine_(" --------------------+-------------+-------------"); 4077 4077 } 4078 /*}}} 1*/4079 /*FUNCTION Mesh::SmoothingVertex{{{ 1*/4078 /*}}}*/ 4079 /*FUNCTION Mesh::SmoothingVertex{{{*/ 4080 4080 void Mesh::SmoothingVertex(int nbiter,double omega ) { 4081 4081 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/SmoothingVertex)*/ … … 4100 4100 for ( k=0;k<NbVerticesOnGeomEdge;k++ ) 4101 4101 tstart[ GetId(VerticesOnGeomEdge[k].meshvertex)]=&vide; 4102 if(verbose>2) printf(" SmoothingVertex: nb Iteration = %i, Omega=%g\n",nbiter,omega);4102 if(verbose>2) _printLine_(" SmoothingVertex: nb Iteration = " << nbiter << ", Omega=" << omega); 4103 4103 for (k=0;k<nbiter;k++) 4104 4104 { … … 4112 4112 if (tstart[i] != &vide) // not a boundary vertex 4113 4113 NbSwap += vertices[i].Optim(1); 4114 if (verbose>3) printf(" move max = %g, iteration = %i, nb of swap = %i\n",pow(delta,0.5),k,NbSwap);4114 if (verbose>3) _printLine_(" move max = " << pow(delta,0.5) << ", iteration = " << k << ", nb of swap = " << NbSwap); 4115 4115 } 4116 4116 … … 4118 4118 if (quadtree) quadtree= new BamgQuadtree(this); 4119 4119 } 4120 /*}}} 1*/4121 /*FUNCTION Mesh::SmoothMetric{{{ 1*/4120 /*}}}*/ 4121 /*FUNCTION Mesh::SmoothMetric{{{*/ 4122 4122 void Mesh::SmoothMetric(double raisonmax) { 4123 4123 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/SmoothMetric)*/ … … 4126 4126 4127 4127 if(raisonmax<1.1) return; 4128 if(verbose > 1) printf(" Mesh::SmoothMetric raisonmax = %g\n",raisonmax);4128 if(verbose > 1) _printLine_(" Mesh::SmoothMetric raisonmax = " << raisonmax); 4129 4129 CreateSingleVertexToTriangleConnectivity(); 4130 4130 long i,j,kch,kk,ip; … … 4146 4146 register Triangle* t= vertices[i].t; 4147 4147 if (!t){ 4148 _error _("!t");4148 _error2_("!t"); 4149 4149 } 4150 4150 BamgVertex & vi = vertices[i]; … … 4154 4154 ta=Previous(Adj(ta)); 4155 4155 if (vertices+i != ta.EdgeVertex(1)){ 4156 _error _("vertices+i != ta.EdgeVertex(1)");4156 _error2_("vertices+i != ta.EdgeVertex(1)"); 4157 4157 } 4158 4158 BamgVertex & vj = *(ta.EdgeVertex(0)); … … 4160 4160 j= &vj-vertices; 4161 4161 if (j<0 || j >= nbv){ 4162 _error _("j<0 || j >= nbv");4162 _error2_("j<0 || j >= nbv"); 4163 4163 } 4164 4164 R2 Aij = (R2) vj - (R2) vi; … … 4192 4192 Exchange(first_np_or_next_t0,first_np_or_next_t1); 4193 4193 } 4194 if(verbose>2) printf(" number of iterations = %i\n",kch);4194 if(verbose>2) _printLine_(" number of iterations = " << kch); 4195 4195 delete [] first_np_or_next_t0; 4196 4196 delete [] first_np_or_next_t1; 4197 4197 } 4198 /*}}} 1*/4199 /*FUNCTION Mesh::SplitElement{{{ 1*/4198 /*}}}*/ 4199 /*FUNCTION Mesh::SplitElement{{{*/ 4200 4200 int Mesh::SplitElement(int choice){ 4201 4201 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshQuad.cpp/SplitElement)*/ … … 4284 4284 // the first PB is to now a background edge between the 2 vertices 4285 4285 if (!edgesGtoB){ 4286 _error _("!edgesGtoB");4286 _error2_("!edgesGtoB"); 4287 4287 } 4288 4288 ong= ProjectOnCurve(*edgesGtoB[Gh.GetId(edges[i].GeomEdgeHook)], … … 4356 4356 Triangle & t = triangles[i]; 4357 4357 if (!t.link){ 4358 _error _("!t.link");4358 _error2_("!t.link"); 4359 4359 } 4360 4360 for(int j=0;j<3;j++) … … 4382 4382 || (bb=Area2( t[0].r , A.r , t[2].r )) < 0.0 4383 4383 || (cc=Area2( t[0].r , t[1].r , A.r )) < 0.0)){ 4384 printf("%i not in triangle %i In= %i %g %g %g %g\n",ke + nbvold,i,!!t.link,aa,bb,cc,dd);4385 _error _("Number of triangles with P2 interpolation Problem");4384 _printLine_(ke + nbvold << " not in triangle " << i << " In= " << !!t.link << " " << aa << " " << bb << " " << cc << " " << dd); 4385 _error2_("Number of triangles with P2 interpolation Problem"); 4386 4386 } 4387 4387 } … … 4390 4390 || (bb=Area2( tt[0].r , A.r , tt[2].r )) < 0 4391 4391 || (cc=Area2( tt[0].r , tt[1].r , A.r )) < 0)){ 4392 printf("%i not in triangle %i In= %i %g %g %g %g\n",ke + nbvold,ii,!!tt.link,aa,bb,cc,dd);4393 _error _("Number of triangles with P2 interpolation Problem");4392 _printLine_(ke + nbvold << " not in triangle " << ii << " In= " << !!tt.link << " " << aa << " " << bb << " " << cc << " " << dd); 4393 _error2_("Number of triangles with P2 interpolation Problem"); 4394 4394 } 4395 4395 } … … 4439 4439 } // tt 4440 4440 else 4441 _error _("Bug...");4441 _error2_("Bug..."); 4442 4442 } // ke<0 4443 4443 else … … 4452 4452 } 4453 4453 if (nbinvisible>=2){ 4454 _error _("nbinvisible>=2");4454 _error2_("nbinvisible>=2"); 4455 4455 } 4456 4456 switch (nbsplitedge) { … … 4464 4464 } 4465 4465 if (ksplit[i]<40){ 4466 _error _("ksplit[i]<40");4466 _error2_("ksplit[i]<40"); 4467 4467 } 4468 4468 } … … 4481 4481 int ke=(int) (ksplit[i]%10); 4482 4482 if (kk>=7 || kk<=0){ 4483 _error _("kk>=7 || kk<=0");4483 _error2_("kk>=7 || kk<=0"); 4484 4484 } 4485 4485 … … 4498 4498 4499 4499 if (nbmkadj>=10){ 4500 _error _("nbmkadj>=10");4500 _error2_("nbmkadj>=10"); 4501 4501 } 4502 4502 // -------------------------- … … 4516 4516 t1=t0; 4517 4517 if (kedge[3*i+i0]<0){ 4518 _error _("kedge[3*i+i0]<0");4518 _error2_("kedge[3*i+i0]<0"); 4519 4519 } 4520 4520 BamgVertex * v3 = vertices + kedge[3*i+k0]; … … 4532 4532 t2=t1=t0; 4533 4533 if (kedge[3*i+k1]<0){ 4534 _error _("kedge[3*i+k1]<0");4534 _error2_("kedge[3*i+k1]<0"); 4535 4535 } 4536 4536 if (kedge[3*i+k2]<0){ 4537 _error _("kedge[3*i+k2]<0");4537 _error2_("kedge[3*i+k2]<0"); 4538 4538 } 4539 4539 … … 4559 4559 t3=t2=t1=t0; 4560 4560 if (kedge[3*i+k0] <0 || kedge[3*i+k1]<0 || kedge[3*i+k2]<0){ 4561 _error _("kedge[3*i+k0] <0 || kedge[3*i+k1]<0 || kedge[3*i+k2]<0");4561 _error2_("kedge[3*i+k0] <0 || kedge[3*i+k1]<0 || kedge[3*i+k2]<0"); 4562 4562 } 4563 4563 BamgVertex * v12 = vertices + kedge[3*i+k0]; … … 4633 4633 } 4634 4634 if (nbmkadj>13){// 13 = 6 + 4 + 4635 _error _("nbmkadj>13");4635 _error2_("nbmkadj>13"); 4636 4636 } 4637 4637 … … 4685 4685 4686 4686 if (verbose>2){ 4687 printf(" number of quadrilaterals = %i\n",nbq);4688 printf(" number of triangles = %i\n",nbt-nbtout- nbq*2);4689 printf(" number of outside triangles = %i\n",nbtout);4687 _printLine_(" number of quadrilaterals = " << nbq); 4688 _printLine_(" number of triangles = " << nbt-nbtout- nbq*2); 4689 _printLine_(" number of outside triangles = " << nbtout); 4690 4690 } 4691 4691 … … 4706 4706 return ret; // ok 4707 4707 } 4708 /*}}} 1*/4709 /*FUNCTION Mesh::SplitInternalEdgeWithBorderVertices{{{ 1*/4708 /*}}}*/ 4709 /*FUNCTION Mesh::SplitInternalEdgeWithBorderVertices{{{*/ 4710 4710 long Mesh::SplitInternalEdgeWithBorderVertices(){ 4711 4711 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/SplitInternalEdgeWithBorderVertices)*/ … … 4754 4754 Triangle *tcvi = TriangleFindFromCoord(vi.i,det3); 4755 4755 if (tcvi && !tcvi->link) { 4756 printf("problem inserting point in SplitInternalEdgeWithBorderVertices (tcvj && !tcvj->link)\n");4756 _printLine_("problem inserting point in SplitInternalEdgeWithBorderVertices (tcvj && !tcvj->link)"); 4757 4757 } 4758 4758 4759 4759 quadtree->Add(vi); 4760 4760 if (!tcvi || tcvi->det<0){// internal 4761 _error _("!tcvi || tcvi->det < 0");4761 _error2_("!tcvi || tcvi->det < 0"); 4762 4762 } 4763 4763 AddVertex(vi,tcvi,det3); … … 4767 4767 } 4768 4768 if (verbose>3) { 4769 printf(" number of points: %i\n",iv);4770 printf(" number of swap to split internal edges with border vertices: %i\n",NbSwap);4769 _printLine_(" number of points: " << iv); 4770 _printLine_(" number of swap to split internal edges with border vertices: " << NbSwap); 4771 4771 nbv = iv; 4772 4772 } 4773 4773 } 4774 if (NbSplitEdge>nbv-nbvold) printf("WARNING: not enough vertices to split all internal edges, we lost %i edges...\n",NbSplitEdge - ( nbv-nbvold));4775 if (verbose>2) printf("SplitInternalEdgeWithBorderVertices: Number of splited edge %i\n",NbSplitEdge);4774 if (NbSplitEdge>nbv-nbvold) _printLine_("WARNING: not enough vertices to split all internal edges, we lost " << NbSplitEdge - ( nbv-nbvold) << " edges..."); 4775 if (verbose>2) _printLine_("SplitInternalEdgeWithBorderVertices: Number of splited edge " << NbSplitEdge); 4776 4776 4777 4777 return NbSplitEdge; 4778 4778 } 4779 /*}}} 1*/4780 /*FUNCTION Mesh::ToI2{{{ 1*/4779 /*}}}*/ 4780 /*FUNCTION Mesh::ToI2{{{*/ 4781 4781 I2 Mesh::R2ToI2(const R2 & P) const { 4782 4782 return I2( (Icoor1) (coefIcoor*(P.x-pmin.x)),(Icoor1) (coefIcoor*(P.y-pmin.y)) ); 4783 4783 } 4784 /*}}} 1*/4785 /*FUNCTION Mesh::ToR2{{{ 1*/4784 /*}}}*/ 4785 /*FUNCTION Mesh::ToR2{{{*/ 4786 4786 R2 Mesh::I2ToR2(const I2 & P) const { 4787 4787 return R2( (double) P.x/coefIcoor+pmin.x, (double) P.y/coefIcoor+pmin.y); 4788 4788 } 4789 /*}}} 1*/4790 /*FUNCTION Mesh::TriangleFindFromCoord{{{ 1*/4789 /*}}}*/ 4790 /*FUNCTION Mesh::TriangleFindFromCoord{{{*/ 4791 4791 Triangle * Mesh::TriangleFindFromCoord(const I2 & B,Icoor2 det3[3], Triangle *tstart) const { 4792 4792 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FindTriangleContening)*/ … … 4803 4803 4804 4804 /*Check that the quadtree does exist*/ 4805 if (!quadtree) _error _("no starting triangle provided and no quadtree available");4805 if (!quadtree) _error2_("no starting triangle provided and no quadtree available"); 4806 4806 4807 4807 /*Call NearestVertex*/ … … 4809 4809 4810 4810 /*Check output (Vertex a)*/ 4811 if (!a) _error _("problem while trying to find nearest vertex from a given point. No output found");4812 if (!a->t) _error _("no triangle is associated to vertex number %i (orphan?)",GetId(a)+1);4811 if (!a) _error2_("problem while trying to find nearest vertex from a given point. No output found"); 4812 if (!a->t) _error2_("no triangle is associated to vertex number " << GetId(a)+1 << " (orphan?)"); 4813 4813 _assert_(a>=vertices && a<vertices+nbv); 4814 4814 … … 4845 4845 4846 4846 /*Increase counter*/ 4847 if (++counter>=10000) _error _("Maximum number of iteration reached (threshold = %i).",counter);4847 if (++counter>=10000) _error2_("Maximum number of iteration reached (threshold = " << counter << ")."); 4848 4848 4849 4849 j= OppositeVertex[jj]; … … 4879 4879 return t; 4880 4880 } 4881 /*}}} 1*/4882 /*FUNCTION Mesh::TriangleIntNumbering{{{ 1*/4881 /*}}}*/ 4882 /*FUNCTION Mesh::TriangleIntNumbering{{{*/ 4883 4883 void Mesh::TriangleIntNumbering(long* renumbering){ 4884 4884 … … 4890 4890 return; 4891 4891 } 4892 /*}}} 1*/4893 /*FUNCTION Mesh::TriangleReferenceList{{{ 1*/4892 /*}}}*/ 4893 /*FUNCTION Mesh::TriangleReferenceList{{{*/ 4894 4894 long Mesh::TriangleReferenceList(long* reft) const { 4895 4895 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ConsRefTriangle)*/ … … 4909 4909 4910 4910 //check that the subdomain is not empty 4911 if (!t0){ _error _("At least one subdomain is empty");}4911 if (!t0){ _error2_("At least one subdomain is empty");} 4912 4912 4913 4913 //loop … … 4930 4930 return k; 4931 4931 } 4932 /*}}} 1*/4933 /*FUNCTION Mesh::Triangulate{{{ 1*/4932 /*}}}*/ 4933 /*FUNCTION Mesh::Triangulate{{{*/ 4934 4934 void Mesh::Triangulate(double* x,double* y,int nods){ 4935 4935 … … 4943 4943 4944 4944 //Vertices 4945 if(verbose) printf("Reading vertices (%i)\n",nbv);4945 if(verbose) _printLine_("Reading vertices (" << nbv << ")"); 4946 4946 for (i=0;i<nbv;i++){ 4947 4947 vertices[i].r.x=x[i]; … … 4957 4957 Insert(); 4958 4958 } 4959 /*}}} 1*/4960 /*FUNCTION Mesh::TriangulateFromGeom0{{{ 1*/4959 /*}}}*/ 4960 /*FUNCTION Mesh::TriangulateFromGeom0{{{*/ 4961 4961 void Mesh::TriangulateFromGeom0(BamgOpts* bamgopts){ 4962 4962 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/GeomToTriangles0)*/ … … 4992 4992 //allocate 4993 4993 VerticesOnGeomVertex = new VertexOnGeom[NbVerticesOnGeomVertex]; 4994 if(NbVerticesOnGeomVertex >= maxnbv) _error _("too many vertices on geometry: %i >= %i",NbVerticesOnGeomVertex,maxnbv);4994 if(NbVerticesOnGeomVertex >= maxnbv) _error2_("too many vertices on geometry: " << NbVerticesOnGeomVertex << " >= " << maxnbv); 4995 4995 _assert_(nbv==0); 4996 4996 //Build VerticesOnGeomVertex … … 5081 5081 NbNewPoints=0; 5082 5082 NbEdgeCurve=0; 5083 if (nbvend>=maxnbv) _error _("maximum number of vertices too low! Check the domain outline or increase maxnbv");5083 if (nbvend>=maxnbv) _error2_("maximum number of vertices too low! Check the domain outline or increase maxnbv"); 5084 5084 lcurve =0; 5085 5085 s = lstep; //-1 initially, then length of each sub edge … … 5255 5255 5256 5256 //Insert points inside existing triangles 5257 if (verbose>4) printf(" -- current number of vertices = %i\n",nbv);5258 if (verbose>3) printf(" Creating initial Constrained Delaunay Triangulation...\n");5259 if (verbose>3) printf(" Inserting boundary points\n");5257 if (verbose>4) _printLine_(" -- current number of vertices = " << nbv); 5258 if (verbose>3) _printLine_(" Creating initial Constrained Delaunay Triangulation..."); 5259 if (verbose>3) _printLine_(" Inserting boundary points"); 5260 5260 Insert(); 5261 5261 5262 5262 //Force the boundary 5263 if (verbose>3) printf(" Forcing boundaries\n");5263 if (verbose>3) _printLine_(" Forcing boundaries"); 5264 5264 ForceBoundary(); 5265 5265 5266 5266 //Extract SubDomains 5267 if (verbose>3) printf(" Extracting subdomains\n");5267 if (verbose>3) _printLine_(" Extracting subdomains"); 5268 5268 FindSubDomain(); 5269 5269 5270 if (verbose>3) printf(" Inserting internal points\n");5270 if (verbose>3) _printLine_(" Inserting internal points"); 5271 5271 NewPoints(*this,bamgopts,0) ; 5272 if (verbose>4) printf(" -- current number of vertices = %i\n",nbv);5273 } 5274 /*}}} 1*/5275 /*FUNCTION Mesh::TriangulateFromGeom1{{{ 1*/5272 if (verbose>4) _printLine_(" -- current number of vertices = " << nbv); 5273 } 5274 /*}}}*/ 5275 /*FUNCTION Mesh::TriangulateFromGeom1{{{*/ 5276 5276 void Mesh::TriangulateFromGeom1(BamgOpts* bamgopts,int KeepVertices){ 5277 5277 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/GeomToTriangles1)*/ … … 5323 5323 if(NbVerticesOnGeomVertex >= maxnbv){ 5324 5324 delete [] bcurve; 5325 _error _("too many vertices on geometry: %i >= %i",NbVerticesOnGeomVertex,maxnbv);5325 _error2_("too many vertices on geometry: " << NbVerticesOnGeomVertex << " >= " << maxnbv); 5326 5326 } 5327 5327 … … 5373 5373 int nc=ei.GeomEdgeHook->CurveNumber; 5374 5374 5375 // printf("Dealing with curve number %i\n",nc);5376 // printf("edge on geometry is same as GhCurve? %s\n",(ei.GeomEdgeHook==Gh.curves[nc].FirstEdge || ei.GeomEdgeHook==Gh.curves[nc].LastEdge)?"yes":"no");5375 //_printLine_("Dealing with curve number " << nc); 5376 //_printLine_("edge on geometry is same as GhCurve? " << (ei.GeomEdgeHook==Gh.curves[nc].FirstEdge || ei.GeomEdgeHook==Gh.curves[nc].LastEdge)?"yes":"no"); 5377 5377 //if(ei.GeomEdgeHook==Gh.curves[nc].FirstEdge || ei.GeomEdgeHook==Gh.curves[nc].LastEdge){ 5378 // printf("Do we have the right extremity? curve first vertex -> %s\n",((GeomVertex *)*ei[je].GeomEdgeHook==&(*Gh.curves[nc].FirstEdge)[Gh.curves[nc].FirstVertexIndex])?"yes":"no");5379 // printf("Do we have the right extremity? curve last vertex -> %s\n",((GeomVertex *)*ei[je].GeomEdgeHook==&(*Gh.curves[nc].LastEdge)[Gh.curves[nc].LastVertexIndex])?"yes":"no");5378 // _printLine_("Do we have the right extremity? curve first vertex -> " << ((GeomVertex *)*ei[je].GeomEdgeHook==&(*Gh.curves[nc].FirstEdge)[Gh.curves[nc].FirstVertexIndex])?"yes":"no"); 5379 // _printLine_("Do we have the right extremity? curve last vertex -> " << ((GeomVertex *)*ei[je].GeomEdgeHook==&(*Gh.curves[nc].LastEdge)[Gh.curves[nc].LastVertexIndex])?"yes":"no"); 5380 5380 //} 5381 5381 //BUG FIX from original bamg … … 5394 5394 if (bfind!=Gh.nbcurves){ 5395 5395 delete [] bcurve; 5396 _error _("problem generating number of curves (%i found in the geometry but %i curve found in the mesh)",Gh.nbcurves,bfind);5396 _error2_("problem generating number of curves (" << Gh.nbcurves << " found in the geometry but " << bfind << " curve found in the mesh)"); 5397 5397 } 5398 5398 … … 5493 5493 double se= (sNew-L0)/LAB; 5494 5494 if (se<0 || se>=1.000000001){ 5495 _error _("Problem creating point on a boundary: se=%g should be in [0 1]",se);5495 _error2_("Problem creating point on a boundary: se=" << se << " should be in [0 1]"); 5496 5496 } 5497 5497 se = abscisseInterpole(v0.m,v1.m,AB,se,1); 5498 5498 if (se<0 || se>1){ 5499 _error _("Problem creating point on a boundary: se=%g should be in [0 1]",se);5499 _error2_("Problem creating point on a boundary: se=" << se << " should be in [0 1]"); 5500 5500 } 5501 5501 se = k1 ? se : 1. - se; … … 5529 5529 } 5530 5530 if (!ee.adj[k1]) { 5531 _error _(" adj edge %i, nbe=%i, Gh.vertices=%i",BTh.GetId(ee),nbe,Gh.vertices);5531 _error2_("adj edge " << BTh.GetId(ee) << ", nbe=" << nbe << ", Gh.vertices=" << Gh.vertices); 5532 5532 } 5533 5533 pe = ee.adj[k1]; // next edge … … 5567 5567 if(step==0){ 5568 5568 if(nbv+NbOfNewPoints > maxnbv) { 5569 _error _("too many vertices on geometry: %i >= %i",nbv+NbOfNewPoints,maxnbv);5569 _error2_("too many vertices on geometry: " << nbv+NbOfNewPoints << " >= " << maxnbv); 5570 5570 } 5571 5571 edges = new Edge[NbOfNewEdge]; … … 5585 5585 5586 5586 //Insert points inside existing triangles 5587 if (verbose>4) printf(" -- current number of vertices = %i\n",nbv);5588 if (verbose>3) printf(" Creating initial Constrained Delaunay Triangulation...\n");5589 if (verbose>3) printf(" Inserting boundary points\n");5587 if (verbose>4) _printLine_(" -- current number of vertices = " << nbv); 5588 if (verbose>3) _printLine_(" Creating initial Constrained Delaunay Triangulation..."); 5589 if (verbose>3) _printLine_(" Inserting boundary points"); 5590 5590 Insert(); 5591 5591 5592 5592 //Force the boundary 5593 if (verbose>3) printf(" Forcing boundaries\n");5593 if (verbose>3) _printLine_(" Forcing boundaries"); 5594 5594 ForceBoundary(); 5595 5595 5596 5596 //Extract SubDomains 5597 if (verbose>3) printf(" Extracting subdomains\n");5597 if (verbose>3) _printLine_(" Extracting subdomains"); 5598 5598 FindSubDomain(); 5599 5599 5600 if (verbose>3) printf(" Inserting internal points\n");5600 if (verbose>3) _printLine_(" Inserting internal points"); 5601 5601 NewPoints(BTh,bamgopts,KeepVertices) ; 5602 if (verbose>4) printf(" -- current number of vertices = %i\n",nbv);5603 } 5604 /*}}} 1*/5602 if (verbose>4) _printLine_(" -- current number of vertices = " << nbv); 5603 } 5604 /*}}}*/ 5605 5605 5606 5606 /*Intermediary*/ 5607 /*FUNCTION CloseBoundaryEdge{{{ 1*/5607 /*FUNCTION CloseBoundaryEdge{{{*/ 5608 5608 AdjacentTriangle CloseBoundaryEdge(I2 A,Triangle *t, double &a,double &b) { 5609 5609 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/CloseBoundaryEdge)*/ … … 5612 5612 int dir=0; 5613 5613 if (k<0){ 5614 _error _("k<0");5614 _error2_("k<0"); 5615 5615 } 5616 5616 int kkk=0; … … 5620 5620 kkk++; 5621 5621 if (kkk>=1000){ 5622 _error _("kkk>=1000");5622 _error2_("kkk>=1000"); 5623 5623 } 5624 5624 BamgVertex &vI = *edge.EdgeVertex(0); … … 5637 5637 double IJ2 = IJ_IA + IJ_AJ; 5638 5638 if (IJ2==0){ 5639 _error _("IJ2==0");5639 _error2_("IJ2==0"); 5640 5640 } 5641 5641 a= IJ_AJ/IJ2; … … 5644 5644 } 5645 5645 } 5646 /*}}} 1*/5647 /*FUNCTION CloseBoundaryEdgeV2{{{ 1*/5646 /*}}}*/ 5647 /*FUNCTION CloseBoundaryEdgeV2{{{*/ 5648 5648 AdjacentTriangle CloseBoundaryEdgeV2(I2 C,Triangle *t, double &a,double &b) { 5649 5649 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/CloseBoundaryEdgeV2)*/ … … 5655 5655 // int dir=0; 5656 5656 if (t->link != 0){ 5657 _error _("t->link != 0");5657 _error2_("t->link != 0"); 5658 5658 } 5659 5659 // to have a starting edges … … 5727 5727 } 5728 5728 if (cas ==-2){ 5729 _error _("cas==-2");5729 _error2_("cas==-2"); 5730 5730 } 5731 5731 // l1 = ||C s1|| , l0 = ||C s0|| … … 5744 5744 kkk++; 5745 5745 if (edge.EdgeVertex(0)!=s && kkk>=10000){ 5746 _error _("edge.EdgeVertex(0)!=s && kkk>=10000");5746 _error2_("edge.EdgeVertex(0)!=s && kkk>=10000"); 5747 5747 } 5748 5748 … … 5776 5776 5777 5777 if (!(Triangle *) er){ 5778 _error _("!(Triangle *) er");5778 _error2_("!(Triangle *) er"); 5779 5779 } 5780 5780 I2 A((I2)*er.EdgeVertex(0)); … … 5793 5793 return er; 5794 5794 } 5795 /*}}} 1*/5796 /*FUNCTION ForceEdge{{{ 1*/5795 /*}}}*/ 5796 /*FUNCTION ForceEdge{{{*/ 5797 5797 int ForceEdge(BamgVertex &a, BamgVertex & b,AdjacentTriangle & taret) { 5798 5798 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ForceEdge)*/ … … 5800 5800 int NbSwap =0; 5801 5801 if (!a.t || !b.t){ // the 2 vertex is in a mesh 5802 _error _("!a.t || !b.t");5802 _error2_("!a.t || !b.t"); 5803 5803 } 5804 5804 int k=0; … … 5817 5817 vbegin =v2; 5818 5818 if (!v2){ 5819 _error _("!v2");5819 _error2_("!v2"); 5820 5820 } 5821 5821 det2 = det(*v2,a,b); … … 5834 5834 tc = Previous(tc); 5835 5835 if (!v1 || !v2){ 5836 _error _("!v1 || !v2");5836 _error2_("!v1 || !v2"); 5837 5837 } 5838 5838 Icoor2 detss = 0,l=0,ks; 5839 5839 while ((ks=SwapForForcingEdge( va, vb, tc, detss, det1,det2,NbSwap))) 5840 5840 if(l++ > 10000000) { 5841 _error _("Loop in forcing Egde, nb de swap=%i, nb of try swap (%i) too big",NbSwap,l);5841 _error2_("Loop in forcing Egde, nb de swap=" << NbSwap << ", nb of try swap (" << l << ") too big"); 5842 5842 } 5843 5843 BamgVertex *aa = tc.EdgeVertex(0), *bb = tc.EdgeVertex(1); … … 5858 5858 k++; 5859 5859 if (k>=2000){ 5860 _error _("k>=2000");5860 _error2_("k>=2000"); 5861 5861 } 5862 5862 if ( vbegin == v2 ) return -1;// error … … 5869 5869 return NbSwap; 5870 5870 } 5871 /*}}} 1*/5872 /*FUNCTION swap{{{ 1*/5871 /*}}}*/ 5872 /*FUNCTION swap{{{*/ 5873 5873 void swap(Triangle *t1,short a1, Triangle *t2,short a2, BamgVertex *s1,BamgVertex *s2,Icoor2 det1,Icoor2 det2){ 5874 5874 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/swap)*/ … … 5914 5914 t2->SetSingleVertexToTriangleConnectivity(); 5915 5915 } // end swap 5916 /*}}} 1*/5917 /*FUNCTION SwapForForcingEdge{{{ 1*/5916 /*}}}*/ 5917 /*FUNCTION SwapForForcingEdge{{{*/ 5918 5918 int SwapForForcingEdge(BamgVertex * & pva ,BamgVertex * & pvb ,AdjacentTriangle & tt1,Icoor2 & dets1, Icoor2 & detsa,Icoor2 & detsb, int & NbSwap) { 5919 5919 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/SwapForForcingEdge)*/ … … 5930 5930 short a1=tt1,a2=tt2;// les 2 numero de l arete dans les 2 triangles 5931 5931 if ( a1<0 || a1>=3 ){ 5932 _error _("a1<0 || a1>=3");5932 _error2_("a1<0 || a1>=3"); 5933 5933 } 5934 5934 … … 5942 5942 Icoor2 detT = det1+det2; 5943 5943 if ((det1<=0 ) || (det2<=0)){ 5944 _error _("(det1<=0 ) || (det2<=0)");5944 _error2_("(det1<=0 ) || (det2<=0)"); 5945 5945 } 5946 5946 if ( (detsa>=0) || (detsb<=0) ){ // [a,b] cut infinite line va,bb 5947 _error _("(detsa>=0) || (detsb<=0)");5947 _error2_("(detsa>=0) || (detsb<=0)"); 5948 5948 } 5949 5949 Icoor2 ndet1 = bamg::det(s1,sa,s2); … … 6002 6002 return ret; 6003 6003 } 6004 /*}}} 1*/6004 /*}}}*/ 6005 6005 6006 6006 } -
issm/trunk/src/c/objects/Bamg/Mesh.h
r12330 r12706 57 57 //Constructors/Destructors 58 58 Mesh(BamgGeom* bamggeom,BamgMesh* bamgmesh,BamgOpts* bamgopts); 59 Mesh( double* index,double* x,double* y,int nods,int nels);/*MeshConvert*/59 Mesh(int* index,double* x,double* y,int nods,int nels);/*MeshConvert*/ 60 60 Mesh(double* x,double* y,int nods); /*BamgTriangulate*/ 61 61 Mesh(Mesh &,Geometry * pGh=0,Mesh* pBTh=0,long maxnbv_in=0 ); //copy operator … … 110 110 BamgVertex* NearestVertex(Icoor1 i,Icoor1 j) ; 111 111 Triangle* TriangleFindFromCoord(const I2 & ,Icoor2 [3],Triangle *tstart=0) const; 112 void ReadMesh( double* index,double* x,double* y,int nods,int nels);112 void ReadMesh(int* index,double* x,double* y,int nods,int nels); 113 113 void ReadMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts); 114 114 void WriteMesh(BamgMesh* bamgmesh,BamgOpts* bamgopts); -
issm/trunk/src/c/objects/Bamg/Metric.cpp
r9371 r12706 14 14 15 15 /*Constructor/Destructor*/ 16 /*FUNCTION Metric::Metric(){{{1*/ 17 /*FUNCTION Metric::Metric(double a){{{1*/ 16 /*FUNCTION Metric::Metric(double a){{{*/ 18 17 Metric::Metric(double a): a11(1/(a*a)),a21(0),a22(1/(a*a)){ 19 18 20 19 }/*}}}*/ 21 /*FUNCTION Metric::Metric(double a,double b,double c){{{ 1*/20 /*FUNCTION Metric::Metric(double a,double b,double c){{{*/ 22 21 Metric::Metric(double a,double b,double c) :a11(a),a21(b),a22(c){ 23 22 24 23 }/*}}}*/ 25 /*FUNCTION Metric::Metric(const double a[3],const Metric& m0, const Metric& m1,const Metric& m2 ){{{ 1*/24 /*FUNCTION Metric::Metric(const double a[3],const Metric& m0, const Metric& m1,const Metric& m2 ){{{*/ 26 25 Metric::Metric(const double a[3],const Metric& m0, const Metric& m1,const Metric& m2 ){ 27 26 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/Metric)*/ … … 43 42 *this = vab; 44 43 } 45 /*}}} 1*/46 /*FUNCTION Metric::Metric(double a,const Metric& ma, double b,const Metric& mb){{{ 1*/44 /*}}}*/ 45 /*FUNCTION Metric::Metric(double a,const Metric& ma, double b,const Metric& mb){{{*/ 47 46 Metric::Metric(double a,const Metric& ma, double b,const Metric& mb) { 48 47 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/EigenMetric)*/ … … 63 62 *this=vab; 64 63 } 65 /*}}} 1*/64 /*}}}*/ 66 65 67 66 /*Methods*/ 68 /*FUNCTION Metric::det{{{ 1*/67 /*FUNCTION Metric::det{{{*/ 69 68 double Metric::det() const { 70 69 return a11*a22-a21*a21; 71 70 } /*}}}*/ 72 /*FUNCTION Metric::Echo {{{ 1*/71 /*FUNCTION Metric::Echo {{{*/ 73 72 void Metric::Echo(void){ 74 73 75 printf("Metric:\n");76 printf(" [a11 a21 a22]: [%g %g %g]\n",a11,a21,a22);74 _printLine_("Metric:"); 75 _printLine_(" [a11 a21 a22]: [" << a11 << " " << a21 << " " << a22 << "]"); 77 76 78 77 return; 79 78 } 80 79 /*}}}*/ 81 /*FUNCTION Metric::IntersectWith{{{ 1*/80 /*FUNCTION Metric::IntersectWith{{{*/ 82 81 int Metric::IntersectWith(const Metric& M2) { 83 82 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/IntersectWith)*/ … … 131 130 return change; 132 131 } 133 /*}}} 1*/134 /*FUNCTION Metric::mul{{{ 1*/132 /*}}}*/ 133 /*FUNCTION Metric::mul{{{*/ 135 134 R2 Metric::mul(const R2 x)const { 136 135 return R2(a11*x.x+a21*x.y,a21*x.x+a22*x.y); … … 138 137 139 138 /*Intermediary*/ 140 /*FUNCTION LengthInterpole{{{ 1*/139 /*FUNCTION LengthInterpole{{{*/ 141 140 double LengthInterpole(const Metric& Ma,const Metric& Mb, R2 AB) { 142 141 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/LengthInterpole)*/ … … 198 197 // warning for optimisation S is in [0:0.5] not in [0:1] 199 198 if (i>=512){ 200 _error _("i>=512");199 _error2_("i>=512"); 201 200 } 202 201 LastMetricInterpole.lab=l; 203 202 LastMetricInterpole.opt=i; 204 if (i>200 && kkk++<10) printf("WARNING: LengthInterpole: ( i=%i l=%i sss=%g ) %g\n",i,l,sss,sstop);203 if (i>200 && kkk++<10) _printLine_("WARNING: LengthInterpole: ( i=" << i << " l=" << l << " sss=" << sss << " ) " << sstop); 205 204 return l; 206 205 } 207 /*}}} 1*/208 /*FUNCTION SimultaneousMatrixReduction{{{ 1*/206 /*}}}*/ 207 /*FUNCTION SimultaneousMatrixReduction{{{*/ 209 208 void SimultaneousMatrixReduction( Metric M1, Metric M2, D2xD2 &V) { 210 209 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/ReductionSimultanee)*/ … … 308 307 } 309 308 } 310 /*}}} 1*/311 /*FUNCTION abscisseInterpole{{{ 1*/309 /*}}}*/ 310 /*FUNCTION abscisseInterpole{{{*/ 312 311 double abscisseInterpole(const Metric& Ma,const Metric& Mb, R2 AB,double s,int optim) { 313 312 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/abscisseInterpole)*/ … … 346 345 } 347 346 if (r>1 || r<0){ 348 _error _("r>1 || r<0");347 _error2_("r>1 || r<0"); 349 348 } 350 349 return r ; 351 350 } 352 /*}}} 1*/351 /*}}}*/ 353 352 354 353 } -
issm/trunk/src/c/objects/Bamg/SetOfE4.cpp
r6412 r12706 5 5 6 6 /*Constructor*/ 7 /*FUNCTION SetOfEdges4::SetOfEdges4(long mmx,long nnx){{{ 1*/7 /*FUNCTION SetOfEdges4::SetOfEdges4(long mmx,long nnx){{{*/ 8 8 SetOfEdges4::SetOfEdges4(long mmx,long nnx){ 9 9 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, SetOfEdges4.cpp/SetOfEdges4)*/ … … 23 23 while(i--) head[i]=-1; 24 24 } 25 /*}}} 1*/25 /*}}}*/ 26 26 27 27 /*Methods*/ 28 /*FUNCTION SetOfEdges4::add{{{ 1*/28 /*FUNCTION SetOfEdges4::add{{{*/ 29 29 long SetOfEdges4::add(long ii,long jj) { 30 30 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, SetOfEdges4.cpp/add)*/ … … 50 50 //check that nbax <=NbOfEdges 51 51 if (nbax <=NbOfEdges ) { 52 _error _("SetOfEdges4::add overflow: NbOfEdges=%i > nbax=%i",NbOfEdges,nbax);52 _error2_("SetOfEdges4::add overflow: NbOfEdges=" << NbOfEdges << " > nbax=" << nbax); 53 53 } 54 54 … … 60 60 return NbOfEdges ++; 61 61 } 62 /*}}} 1*/63 /*FUNCTION SetOfEdges4::find {{{ 1*/62 /*}}}*/ 63 /*FUNCTION SetOfEdges4::find {{{*/ 64 64 long SetOfEdges4::find(long ii,long jj) { 65 65 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, SetOfEdges4.cpp/find)*/ … … 87 87 return -1; 88 88 } 89 /*}}} 1*/90 /*FUNCTION SetOfEdges4::i{{{ 1*/89 /*}}}*/ 90 /*FUNCTION SetOfEdges4::i{{{*/ 91 91 long SetOfEdges4::i(long k){ 92 92 return Edges[k].i; 93 93 } 94 /*}}} 1*/95 /*FUNCTION SetOfEdges4::j{{{ 1*/94 /*}}}*/ 95 /*FUNCTION SetOfEdges4::j{{{*/ 96 96 long SetOfEdges4::j(long k){ 97 97 return Edges[k].j; 98 98 } 99 /*}}} 1*/100 /*FUNCTION SetOfEdges4::nb{{{ 1*/99 /*}}}*/ 100 /*FUNCTION SetOfEdges4::nb{{{*/ 101 101 long SetOfEdges4::nb(){ 102 102 return NbOfEdges; 103 103 } 104 /*}}} 1*/105 /*FUNCTION SetOfEdges4::newarete{{{ 1*/104 /*}}}*/ 105 /*FUNCTION SetOfEdges4::newarete{{{*/ 106 106 long SetOfEdges4::newarete(long k){ 107 107 return NbOfEdges == k+1; 108 108 } 109 /*}}} 1*/110 /*FUNCTION SetOfEdges4::SortAndAdd{{{ 1*/109 /*}}}*/ 110 /*FUNCTION SetOfEdges4::SortAndAdd{{{*/ 111 111 long SetOfEdges4::SortAndAdd (long ii,long jj) { 112 112 return ii <=jj ? add (ii,jj) : add (jj,ii) ; 113 113 } 114 /*}}} 1*/115 /*FUNCTION SetOfEdges4::SortAndFind{{{ 1*/114 /*}}}*/ 115 /*FUNCTION SetOfEdges4::SortAndFind{{{*/ 116 116 long SetOfEdges4::SortAndFind (long ii,long jj) { 117 117 return ii <=jj ? find (ii,jj) : find (jj,ii) ; 118 118 } 119 /*}}} 1*/119 /*}}}*/ 120 120 } -
issm/trunk/src/c/objects/Bamg/SubDomain.cpp
r6412 r12706 12 12 13 13 /*Methods*/ 14 /*FUNCTION SubDomain::Set {{{ 1*/14 /*FUNCTION SubDomain::Set {{{*/ 15 15 void SubDomain::Set(const Mesh & Th ,long i,Mesh & ThNew){ 16 16 *this = Th.subdomains[i]; 17 17 if ( head-Th.triangles<0 || head-Th.triangles>=Th.nbt){ 18 _error _("head-Th.triangles<0 || head-Th.triangles>=Th.nbt");18 _error2_("head-Th.triangles<0 || head-Th.triangles>=Th.nbt"); 19 19 } 20 20 head = ThNew.triangles + Th.GetId(head) ; 21 21 if (edge-Th.edges<0 || edge-Th.edges>=Th.nbe);{ 22 _error _("edge-Th.edges<0 || edge-Th.edges>=Th.nbe");22 _error2_("edge-Th.edges<0 || edge-Th.edges>=Th.nbe"); 23 23 } 24 24 edge = ThNew.edges+ Th.GetId(edge); -
issm/trunk/src/c/objects/Bamg/Triangle.cpp
r11995 r12706 9 9 10 10 /*Constructors/Destructors*/ 11 /*FUNCTION Triangle(){{{ 1*/11 /*FUNCTION Triangle(){{{*/ 12 12 Triangle::Triangle(void){ 13 13 14 14 } 15 15 /*}}}*/ 16 /*FUNCTION Triangle(Mesh *Th,long i,long j,long k) {{{ 1*/16 /*FUNCTION Triangle(Mesh *Th,long i,long j,long k) {{{*/ 17 17 Triangle::Triangle(Mesh *Th,long i,long j,long k) { 18 18 BamgVertex *v=Th->vertices; 19 19 long nbv = Th->nbv; 20 20 if (i<0 || j<0 || k<0){ 21 _error _("i<0 || j<0 || k<0");21 _error2_("i<0 || j<0 || k<0"); 22 22 } 23 23 if (i>=nbv || j>=nbv || k>=nbv){ 24 _error _("i>=nbv || j>=nbv || k>=nbv");24 _error2_("i>=nbv || j>=nbv || k>=nbv"); 25 25 } 26 26 vertices[0]=v+i; … … 32 32 } 33 33 /*}}}*/ 34 /*FUNCTION Triangle(BamgVertex *v0,BamgVertex *v1,BamgVertex *v2) {{{ 1*/34 /*FUNCTION Triangle(BamgVertex *v0,BamgVertex *v1,BamgVertex *v2) {{{*/ 35 35 Triangle::Triangle(BamgVertex *v0,BamgVertex *v1,BamgVertex *v2){ 36 36 vertices[0]=v0; … … 47 47 48 48 /*Methods*/ 49 /*FUNCTION Triangle::Adj{{{ 1*/49 /*FUNCTION Triangle::Adj{{{*/ 50 50 AdjacentTriangle Triangle::Adj(int i) const { 51 51 return AdjacentTriangle(adj[i],AdjEdgeIndex[i]&3); 52 52 };/*}}}*/ 53 /*FUNCTION Triangle::Anisotropy{{{ 1*/53 /*FUNCTION Triangle::Anisotropy{{{*/ 54 54 double Triangle::Anisotropy() const{ 55 55 … … 80 80 return lmax/lmin; 81 81 };/*}}}*/ 82 /*FUNCTION Triangle::Length{{{ 1*/82 /*FUNCTION Triangle::Length{{{*/ 83 83 double Triangle::Length() const{ 84 84 … … 102 102 return l; 103 103 };/*}}}*/ 104 /*FUNCTION Triangle::Echo {{{ 1*/104 /*FUNCTION Triangle::Echo {{{*/ 105 105 void Triangle::Echo(void){ 106 106 107 107 int i; 108 108 109 printf("Triangle:\n");110 printf(" vertices pointer towards three vertices\n");111 printf(" vertices[0] vertices[1] vertices[2] = %p %p %p\n",vertices[0],vertices[1],vertices[2]);112 printf(" adj pointer towards three adjacent triangles\n");113 printf(" adj[0] adj[1] adj[2] = %p %p %p\n",adj[0],adj[1],adj[2]);114 printf(" det (integer triangle determinant) = %i\n",det);109 _printLine_("Triangle:"); 110 _printLine_(" vertices pointer towards three vertices"); 111 _printLine_(" vertices[0] vertices[1] vertices[2] = " << vertices[0] << " " << vertices[1] << " " << vertices[2]); 112 _printLine_(" adj pointer towards three adjacent triangles"); 113 _printLine_(" adj[0] adj[1] adj[2] = " << adj[0] << " " << adj[1] << " " << adj[2]); 114 _printLine_(" det (integer triangle determinant) = " << det); 115 115 if (link){ 116 printf(" link (pointer toward duplicate triangle)= %p\n",link);116 _printLine_(" link (pointer toward duplicate triangle)= " << link); 117 117 } 118 118 else{ 119 printf(" color = %i\n",color);120 } 121 122 printf("\nThree vertices:\n");119 _printLine_(" color = " << color); 120 } 121 122 _printLine_("\nThree vertices:"); 123 123 for(i=0;i<3;i++){ 124 124 if (vertices[i]){ … … 126 126 } 127 127 else{ 128 printf(" vertex %i does not exist\n",i+1);128 _printLine_(" vertex " << i+1 << " does not exist"); 129 129 } 130 130 } … … 133 133 } 134 134 /*}}}*/ 135 /*FUNCTION Triangle::FindBoundaryEdge{{{ 1*/135 /*FUNCTION Triangle::FindBoundaryEdge{{{*/ 136 136 AdjacentTriangle Triangle::FindBoundaryEdge(int i) const{ 137 137 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FindBoundaryEdge)*/ … … 173 173 //check number of iterations 174 174 if (k>=2000){ 175 _error _("too many iteration in Triangle::FindBoundaryEdge (k>=2000)");175 _error2_("too many iteration in Triangle::FindBoundaryEdge (k>=2000)"); 176 176 } 177 177 } while (this!= t); … … 179 179 return AdjacentTriangle(NULL,0); 180 180 } 181 /*}}} 1*/182 /*FUNCTION Triangle::GetAllflag{{{ 1*/181 /*}}}*/ 182 /*FUNCTION Triangle::GetAllflag{{{*/ 183 183 int Triangle::GetAllflag(int a){ 184 184 return AdjEdgeIndex[a] & 1020; 185 185 }/*}}}*/ 186 /*FUNCTION Triangle::Hidden{{{ 1*/186 /*FUNCTION Triangle::Hidden{{{*/ 187 187 int Triangle::Hidden(int a)const { 188 188 return AdjEdgeIndex[a]&16; 189 189 } /*}}}*/ 190 /*FUNCTION Triangle::Locked{{{ 1*/190 /*FUNCTION Triangle::Locked{{{*/ 191 191 int Triangle::Locked(int a)const { 192 192 return AdjEdgeIndex[a]&4; 193 193 } /*}}}*/ 194 /*FUNCTION Triangle::NuEdgeTriangleAdj{{{ 1*/194 /*FUNCTION Triangle::NuEdgeTriangleAdj{{{*/ 195 195 short Triangle::NuEdgeTriangleAdj(int i) const { 196 196 /*Number of the adjacent edge in adj tria (make sure it is between 0 and 2*/ 197 197 return AdjEdgeIndex[i&3]&3; 198 198 }/*}}}*/ 199 /*FUNCTION Triangle::Optim{{{ 1*/199 /*FUNCTION Triangle::Optim{{{*/ 200 200 long Triangle::Optim(short i,int koption) { 201 201 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Optim)*/ … … 213 213 do { 214 214 while (t->swap(j,koption)){ 215 if (k>=20000) _error _("k>=20000");215 if (k>=20000) _error2_("k>=20000"); 216 216 NbSwap++; 217 217 k++; … … 229 229 return NbSwap; 230 230 } 231 /*}}} 1*/232 /*FUNCTION Triangle::Quadrangle {{{ 1*/231 /*}}}*/ 232 /*FUNCTION Triangle::Quadrangle {{{*/ 233 233 Triangle* Triangle::Quadrangle(BamgVertex * & v0,BamgVertex * & v1,BamgVertex * & v2,BamgVertex * & v3) const{ 234 234 // return the other triangle of the quad if a quad or 0 if not a quat … … 251 251 } 252 252 /*}}}*/ 253 /*FUNCTION Triangle::QualityQuad {{{ 1*/253 /*FUNCTION Triangle::QualityQuad {{{*/ 254 254 double Triangle::QualityQuad(int a,int option) const{ 255 255 double q; … … 274 274 } 275 275 /*}}}*/ 276 /*FUNCTION Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){{{ 1*/276 /*FUNCTION Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){{{*/ 277 277 void Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){ 278 278 … … 282 282 if (adj[2] >=tb && adj[2] <te) adj[2] = tb + renu[adj[2]-tb]; 283 283 }/*}}}*/ 284 /*FUNCTION Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){{{ 1*/284 /*FUNCTION Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){{{*/ 285 285 void Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){ 286 286 if (vertices[0] >=vb && vertices[0] <ve) vertices[0] = vb + renu[vertices[0]-vb]; … … 288 288 if (vertices[2] >=vb && vertices[2] <ve) vertices[2] = vb + renu[vertices[2]-vb]; 289 289 }/*}}}*/ 290 /*FUNCTION Triangle::Set {{{ 1*/290 /*FUNCTION Triangle::Set {{{*/ 291 291 void Triangle::Set(const Triangle & rec,const Mesh & Th ,Mesh & ThNew){ 292 292 *this = rec; … … 301 301 } 302 302 /*}}}*/ 303 /*FUNCTION Triangle::SetAdjAdj{{{ 1*/303 /*FUNCTION Triangle::SetAdjAdj{{{*/ 304 304 void Triangle::SetAdjAdj(short a){ 305 305 // Copy all the mark … … 313 313 } 314 314 }/*}}}*/ 315 /*FUNCTION Triangle::SetAdj2{{{ 1*/315 /*FUNCTION Triangle::SetAdj2{{{*/ 316 316 void Triangle::SetAdj2(short a,Triangle *t,short aat){ 317 317 /*For current triangle: … … 326 326 } 327 327 }/*}}}*/ 328 /*FUNCTION Triangle::SetAllFlag{{{ 1*/328 /*FUNCTION Triangle::SetAllFlag{{{*/ 329 329 void Triangle::SetAllFlag(int a,int f){ 330 330 AdjEdgeIndex[a] = (AdjEdgeIndex[a] &3) + (1020 & f); 331 331 }/*}}}*/ 332 /*FUNCTION Triangle::SetDet{{{ 1*/332 /*FUNCTION Triangle::SetDet{{{*/ 333 333 void Triangle::SetDet() { 334 334 if(vertices[0] && vertices[1] && vertices[2]) det = bamg::det(*vertices[0],*vertices[1],*vertices[2]); 335 335 else det = -1; 336 336 }/*}}}*/ 337 /*FUNCTION Triangle::SetHidden{{{ 1*/337 /*FUNCTION Triangle::SetHidden{{{*/ 338 338 void Triangle::SetHidden(int a){ 339 339 //Get Adjacent Triangle number a … … 344 344 AdjEdgeIndex[a] |= 16; 345 345 }/*}}}*/ 346 /*FUNCTION Triangle::SetLocked{{{ 1*/346 /*FUNCTION Triangle::SetLocked{{{*/ 347 347 void Triangle::SetLocked(int a){ 348 348 //mark the edge as on Boundary … … 351 351 AdjEdgeIndex[a] |= 4; 352 352 }/*}}}*/ 353 /*FUNCTION Triangle::SetMarkUnSwap{{{ 1*/353 /*FUNCTION Triangle::SetMarkUnSwap{{{*/ 354 354 void Triangle::SetMarkUnSwap(int a){ 355 355 register Triangle * t = adj[a]; … … 357 357 AdjEdgeIndex[a] |=8 ; 358 358 }/*}}}*/ 359 /*FUNCTION Triangle::SetSingleVertexToTriangleConnectivity{{{ 1*/359 /*FUNCTION Triangle::SetSingleVertexToTriangleConnectivity{{{*/ 360 360 void Triangle::SetSingleVertexToTriangleConnectivity() { 361 361 if (vertices[0]) (vertices[0]->t=this,vertices[0]->IndexInTriangle=0); … … 363 363 if (vertices[2]) (vertices[2]->t=this,vertices[2]->IndexInTriangle=2); 364 364 }/*}}}*/ 365 /*FUNCTION Triangle::SetUnMarkUnSwap{{{ 1*/365 /*FUNCTION Triangle::SetUnMarkUnSwap{{{*/ 366 366 void Triangle::SetUnMarkUnSwap(int a){ 367 367 register Triangle * t = adj[a]; … … 369 369 AdjEdgeIndex[a] &=55 ; 370 370 }/*}}}*/ 371 /*FUNCTION Triangle::swap{{{ 1*/371 /*FUNCTION Triangle::swap{{{*/ 372 372 int Triangle::swap(short a,int koption){ 373 373 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/swap)*/ … … 483 483 return OnSwap; 484 484 } 485 /*}}} 1*/486 /*FUNCTION Triangle::TriangleAdj{{{ 1*/485 /*}}}*/ 486 /*FUNCTION Triangle::TriangleAdj{{{*/ 487 487 Triangle* Triangle::TriangleAdj(int i) const { 488 488 return adj[i&3]; -
issm/trunk/src/c/objects/Bamg/VertexOnEdge.cpp
r9326 r12706 10 10 11 11 /*Methods*/ 12 /*FUNCTION VertexOnEdge::Set {{{ 1*/12 /*FUNCTION VertexOnEdge::Set {{{*/ 13 13 void VertexOnEdge::Set(const Mesh & Th ,long i,Mesh & ThNew){ 14 14 *this = Th.VertexOnBThEdge[i]; … … 16 16 } 17 17 /*}}}*/ 18 /*FUNCTION VertexOnEdge::SetOnBTh{{{ 1*/18 /*FUNCTION VertexOnEdge::SetOnBTh{{{*/ 19 19 void VertexOnEdge::SetOnBTh(){ 20 20 v->BackgroundEdgeHook=this; -
issm/trunk/src/c/objects/Bamg/VertexOnGeom.cpp
r9399 r12706 11 11 12 12 /*Constructors/Destructors*/ 13 /*FUNCTION VertexOnGeom::VertexOnGeom(){{{ 1*/13 /*FUNCTION VertexOnGeom::VertexOnGeom(){{{*/ 14 14 VertexOnGeom::VertexOnGeom(){ 15 15 meshvertex=NULL; … … 18 18 } 19 19 /*}}}*/ 20 /*FUNCTION VertexOnGeom::VertexOnGeom(BamgVertex & m,GeomVertex &g){{{ 1*/20 /*FUNCTION VertexOnGeom::VertexOnGeom(BamgVertex & m,GeomVertex &g){{{*/ 21 21 VertexOnGeom::VertexOnGeom(BamgVertex & m,GeomVertex &g){ 22 22 meshvertex=&m; … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION VertexOnGeom::VertexOnGeom(BamgVertex & m,GeomEdge &g,double s){{{ 1*/27 /*FUNCTION VertexOnGeom::VertexOnGeom(BamgVertex & m,GeomEdge &g,double s){{{*/ 28 28 VertexOnGeom::VertexOnGeom(BamgVertex & m,GeomEdge &g,double s){ 29 29 meshvertex=&m; … … 34 34 35 35 /*Methods*/ 36 /*FUNCTION VertexOnGeom::Set {{{ 1*/36 /*FUNCTION VertexOnGeom::Set {{{*/ 37 37 void VertexOnGeom::Set(const VertexOnGeom & rec,const Mesh & Th ,Mesh & ThNew){ 38 38 *this = rec; … … 46 46 } 47 47 /*}}}*/ 48 /*FUNCTION VertexOnGeom::OnGeomVertex{{{ 1*/48 /*FUNCTION VertexOnGeom::OnGeomVertex{{{*/ 49 49 int VertexOnGeom::OnGeomVertex()const{ 50 50 return this? curvilincoord <0 :0; 51 51 } 52 52 /*}}}*/ 53 /*FUNCTION VertexOnGeom::OnGeomEdge{{{ 1*/53 /*FUNCTION VertexOnGeom::OnGeomEdge{{{*/ 54 54 int VertexOnGeom::OnGeomEdge() const{ 55 55 return this? curvilincoord >=0 :0; 56 56 } 57 57 /*}}}*/ 58 /*FUNCTION VertexOnGeom::IsRequiredVertex{{{ 1*/58 /*FUNCTION VertexOnGeom::IsRequiredVertex{{{*/ 59 59 int VertexOnGeom::IsRequiredVertex() { 60 60 return this? ((curvilincoord<0 ? (gv?gv->Required():0):0 )) : 0; 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION VertexOnGeom::SetOn{{{ 1*/63 /*FUNCTION VertexOnGeom::SetOn{{{*/ 64 64 void VertexOnGeom::SetOn(){ 65 65 meshvertex->GeomEdgeHook=this; -
issm/trunk/src/c/objects/Bamg/VertexOnVertex.cpp
r9371 r12706 10 10 11 11 /*Constructors/Destructors*/ 12 /*FUNCTION VertexOnVertex::VertexOnVertex(){{{ 1*/12 /*FUNCTION VertexOnVertex::VertexOnVertex(){{{*/ 13 13 VertexOnVertex::VertexOnVertex() { 14 14 v=NULL; 15 15 bv=NULL; 16 16 };/*}}}*/ 17 /*FUNCTION VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw){{{ 1*/17 /*FUNCTION VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw){{{*/ 18 18 VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw) :v(w),bv(bw){ 19 19 … … 21 21 22 22 /*Methods*/ 23 /*FUNCTION VertexOnVertex::Set{{{ 1*/23 /*FUNCTION VertexOnVertex::Set{{{*/ 24 24 void VertexOnVertex::Set(const Mesh &Th ,long i,Mesh &ThNew) { 25 25 *this = Th.VertexOnBThVertex[i]; … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION VertexOnVertex::SetOnBTh{{{ 1*/29 /*FUNCTION VertexOnVertex::SetOnBTh{{{*/ 30 30 void VertexOnVertex::SetOnBTh(){ 31 31 v->BackgroundVertexHook=bv;v->IndexInTriangle=IsVertexOnVertex; -
issm/trunk/src/c/objects/Constraints/Constraint.h
r12330 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 class Nodes; 14 14 #include "../Object.h" -
issm/trunk/src/c/objects/Constraints/SpcDynamic.cpp
r12330 r12706 18 18 19 19 /*SpcDynamic constructors and destructor*/ 20 /*FUNCTION SpcDynamic::SpcDynamic(){{{ 1*/20 /*FUNCTION SpcDynamic::SpcDynamic(){{{*/ 21 21 SpcDynamic::SpcDynamic(){ 22 22 return; 23 23 } 24 /*}}} 1*/25 /*FUNCTION SpcDynamic::SpcDynamic(int spc_sid,int spc_nodeid,...){{{ 1*/24 /*}}}*/ 25 /*FUNCTION SpcDynamic::SpcDynamic(int spc_sid,int spc_nodeid,...){{{*/ 26 26 SpcDynamic::SpcDynamic(int spc_sid,int spc_nodeid, int spc_dof,int spc_analysis_type){ 27 27 … … 35 35 return; 36 36 } 37 /*}}} 1*/38 /*FUNCTION SpcDynamic::~SpcDynamic{{{ 1*/37 /*}}}*/ 38 /*FUNCTION SpcDynamic::~SpcDynamic{{{*/ 39 39 SpcDynamic::~SpcDynamic(){ 40 40 return; 41 41 } 42 /*}}} 1*/42 /*}}}*/ 43 43 44 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION SpcDynamic::Echo {{{ 1*/45 /*FUNCTION SpcDynamic::Echo {{{*/ 46 46 void SpcDynamic::Echo(void){ 47 47 48 printf("SpcDynamic:\n");49 printf(" sid: %i\n",sid);50 printf(" nodeid: %i\n",nodeid);51 printf(" dof: %i\n",dof);52 printf(" value: %g\n",value);53 printf(" isset: %s\n",isset?"true":"false");54 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));48 _printLine_("SpcDynamic:"); 49 _printLine_(" sid: " << sid); 50 _printLine_(" nodeid: " << nodeid); 51 _printLine_(" dof: " << dof); 52 _printLine_(" value: " << value); 53 _printLine_(" isset: " <<(isset?"true":"false")); 54 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 55 55 return; 56 56 } 57 /*}}} 1*/58 /*FUNCTION SpcDynamic::DeepEcho {{{ 1*/57 /*}}}*/ 58 /*FUNCTION SpcDynamic::DeepEcho {{{*/ 59 59 void SpcDynamic::DeepEcho(void){ 60 60 … … 62 62 return; 63 63 } 64 /*}}} 1*/65 /*FUNCTION SpcDynamic::Id {{{ 1*/64 /*}}}*/ 65 /*FUNCTION SpcDynamic::Id {{{*/ 66 66 int SpcDynamic::Id(void){ return sid; } 67 /*}}} 1*/68 /*FUNCTION SpcDynamic::MyRank {{{ 1*/67 /*}}}*/ 68 /*FUNCTION SpcDynamic::MyRank {{{*/ 69 69 int SpcDynamic::MyRank(void){ 70 70 extern int my_rank; 71 71 return my_rank; 72 72 } 73 /*}}} 1*/74 /*FUNCTION SpcDynamic::ObjectEnum{{{ 1*/73 /*}}}*/ 74 /*FUNCTION SpcDynamic::ObjectEnum{{{*/ 75 75 int SpcDynamic::ObjectEnum(void){ 76 76 … … 78 78 79 79 } 80 /*}}} 1*/81 /*FUNCTION SpcDynamic::copy {{{ 1*/80 /*}}}*/ 81 /*FUNCTION SpcDynamic::copy {{{*/ 82 82 Object* SpcDynamic::copy() { 83 83 return new SpcDynamic(*this); 84 84 } 85 /*}}} 1*/85 /*}}}*/ 86 86 87 87 /*Constraint virtual functions definitions: */ 88 /*FUNCTION SpcDynamic::InAnalysis{{{ 1*/88 /*FUNCTION SpcDynamic::InAnalysis{{{*/ 89 89 bool SpcDynamic::InAnalysis(int in_analysis_type){ 90 90 if (in_analysis_type==this->analysis_type) return true; … … 92 92 } 93 93 /*}}}*/ 94 /*FUNCTION SpcDynamic::ConstrainNode{{{ 1*/94 /*FUNCTION SpcDynamic::ConstrainNode{{{*/ 95 95 void SpcDynamic::ConstrainNode(Nodes* nodes,Parameters* parameters){ 96 96 … … 110 110 111 111 /*SpcDynamic functions*/ 112 /*FUNCTION SpcDynamic::GetDof {{{ 1*/112 /*FUNCTION SpcDynamic::GetDof {{{*/ 113 113 int SpcDynamic::GetDof(){ 114 114 return dof; 115 115 } 116 /*}}} 1*/117 /*FUNCTION SpcDynamic::GetNodeId {{{ 1*/116 /*}}}*/ 117 /*FUNCTION SpcDynamic::GetNodeId {{{*/ 118 118 int SpcDynamic::GetNodeId(){ 119 119 120 120 return nodeid; 121 121 } 122 /*}}} 1*/123 /*FUNCTION SpcDynamic::GetValue {{{ 1*/124 double SpcDynamic::GetValue(){122 /*}}}*/ 123 /*FUNCTION SpcDynamic::GetValue {{{*/ 124 IssmDouble SpcDynamic::GetValue(){ 125 125 _assert_(this->isset); 126 _assert_(! isnan(value));126 _assert_(!xIsNan<IssmDouble>(value)); 127 127 return value; 128 128 } 129 /*}}} 1*/130 /*FUNCTION SpcDynamic::SetDynamicConstraint {{{ 1*/131 void SpcDynamic::SetDynamicConstraint(Nodes* nodes, double* yg_serial){129 /*}}}*/ 130 /*FUNCTION SpcDynamic::SetDynamicConstraint {{{*/ 131 void SpcDynamic::SetDynamicConstraint(Nodes* nodes,IssmDouble* yg_serial){ 132 132 133 133 int pos; … … 139 139 this->isset=true; 140 140 } 141 /*}}} 1*/141 /*}}}*/ -
issm/trunk/src/c/objects/Constraints/SpcDynamic.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../Object.h" 11 11 class DataSet; … … 18 18 int nodeid; /*!node id*/ 19 19 int dof; /*!component*/ 20 double value; /*value*/20 IssmDouble value; /*value*/ 21 21 bool isset; 22 22 int analysis_type; … … 24 24 public: 25 25 26 /*SpcDynamic constructors, destructors:{{{ 1*/26 /*SpcDynamic constructors, destructors:{{{*/ 27 27 SpcDynamic(); 28 28 SpcDynamic(int sid,int nodeid, int dof,int analysis_type); 29 29 ~SpcDynamic(); 30 30 /*}}}*/ 31 /*Object virtual functions definitions:{{{ 1*/31 /*Object virtual functions definitions:{{{ */ 32 32 void Echo(); 33 33 void DeepEcho(); … … 37 37 Object* copy(); 38 38 /*}}}*/ 39 /*Constraint virtual functions definitions: {{{ 1*/39 /*Constraint virtual functions definitions: {{{*/ 40 40 void ConstrainNode(Nodes* nodes,Parameters* parameters); 41 41 bool InAnalysis(int analysis_type); 42 42 /*}}}*/ 43 /*SpcDynamic management:{{{ 1*/43 /*SpcDynamic management:{{{ */ 44 44 int GetNodeId(); 45 45 int GetDof(); 46 double GetValue();47 void SetDynamicConstraint(Nodes* nodes, double *yg_serial);46 IssmDouble GetValue(); 47 void SetDynamicConstraint(Nodes* nodes,IssmDouble *yg_serial); 48 48 /*}}}*/ 49 49 -
issm/trunk/src/c/objects/Constraints/SpcStatic.cpp
r12330 r12706 18 18 19 19 /*SpcStatic constructors and destructor*/ 20 /*FUNCTION SpcStatic::SpcStatic(){{{ 1*/20 /*FUNCTION SpcStatic::SpcStatic(){{{*/ 21 21 SpcStatic::SpcStatic(){ 22 22 return; 23 23 } 24 /*}}} 1*/25 /*FUNCTION SpcStatic::SpcStatic(int spc_sid,int spc_nodeid,...){{{ 1*/26 SpcStatic::SpcStatic(int spc_sid,int spc_nodeid, int spc_dof, double spc_value,int spc_analysis_type){24 /*}}}*/ 25 /*FUNCTION SpcStatic::SpcStatic(int spc_sid,int spc_nodeid,...){{{*/ 26 SpcStatic::SpcStatic(int spc_sid,int spc_nodeid, int spc_dof,IssmDouble spc_value,int spc_analysis_type){ 27 27 28 28 sid=spc_sid; … … 34 34 return; 35 35 } 36 /*}}} 1*/37 /*FUNCTION SpcStatic::~SpcStatic{{{ 1*/36 /*}}}*/ 37 /*FUNCTION SpcStatic::~SpcStatic{{{*/ 38 38 SpcStatic::~SpcStatic(){ 39 39 return; 40 40 } 41 /*}}} 1*/41 /*}}}*/ 42 42 43 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION SpcStatic::Echo {{{ 1*/44 /*FUNCTION SpcStatic::Echo {{{*/ 45 45 void SpcStatic::Echo(void){ 46 46 47 printf("SpcStatic:\n");48 printf(" sid: %i\n",sid);49 printf(" nodeid: %i\n",nodeid);50 printf(" dof: %i\n",dof);51 printf(" value: %g\n",value);52 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));47 _printLine_("SpcStatic:"); 48 _printLine_(" sid: " << sid); 49 _printLine_(" nodeid: " << nodeid); 50 _printLine_(" dof: " << dof); 51 _printLine_(" value: " << value); 52 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 53 53 return; 54 54 } 55 /*}}} 1*/56 /*FUNCTION SpcStatic::DeepEcho {{{ 1*/55 /*}}}*/ 56 /*FUNCTION SpcStatic::DeepEcho {{{*/ 57 57 void SpcStatic::DeepEcho(void){ 58 58 59 printf("SpcStatic:\n");60 printf(" sid: %i\n",sid);61 printf(" nodeid: %i\n",nodeid);62 printf(" dof: %i\n",dof);63 printf(" value: %g\n",value);64 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));59 _printLine_("SpcStatic:"); 60 _printLine_(" sid: " << sid); 61 _printLine_(" nodeid: " << nodeid); 62 _printLine_(" dof: " << dof); 63 _printLine_(" value: " << value); 64 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 65 65 return; 66 66 } 67 /*}}} 1*/68 /*FUNCTION SpcStatic::Id {{{ 1*/67 /*}}}*/ 68 /*FUNCTION SpcStatic::Id {{{*/ 69 69 int SpcStatic::Id(void){ return sid; } 70 /*}}} 1*/71 /*FUNCTION SpcStatic::MyRank {{{ 1*/70 /*}}}*/ 71 /*FUNCTION SpcStatic::MyRank {{{*/ 72 72 int SpcStatic::MyRank(void){ 73 73 extern int my_rank; 74 74 return my_rank; 75 75 } 76 /*}}} 1*/77 /*FUNCTION SpcStatic::ObjectEnum{{{ 1*/76 /*}}}*/ 77 /*FUNCTION SpcStatic::ObjectEnum{{{*/ 78 78 int SpcStatic::ObjectEnum(void){ 79 79 … … 81 81 82 82 } 83 /*}}} 1*/84 /*FUNCTION SpcStatic::copy {{{ 1*/83 /*}}}*/ 84 /*FUNCTION SpcStatic::copy {{{*/ 85 85 Object* SpcStatic::copy() { 86 86 return new SpcStatic(*this); 87 87 } 88 /*}}} 1*/88 /*}}}*/ 89 89 90 90 /*Constraint virtual functions definitions: */ 91 /*FUNCTION SpcStatic::InAnalysis{{{ 1*/91 /*FUNCTION SpcStatic::InAnalysis{{{*/ 92 92 bool SpcStatic::InAnalysis(int in_analysis_type){ 93 93 if (in_analysis_type==this->analysis_type) return true; … … 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION SpcStatic::ConstrainNode{{{ 1*/97 /*FUNCTION SpcStatic::ConstrainNode{{{*/ 98 98 void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){ 99 99 … … 111 111 112 112 /*SpcStatic functions*/ 113 /*FUNCTION SpcStatic::GetDof {{{ 1*/113 /*FUNCTION SpcStatic::GetDof {{{*/ 114 114 int SpcStatic::GetDof(){ 115 115 return dof; 116 116 } 117 /*}}} 1*/118 /*FUNCTION SpcStatic::GetNodeId {{{ 1*/117 /*}}}*/ 118 /*FUNCTION SpcStatic::GetNodeId {{{*/ 119 119 int SpcStatic::GetNodeId(){ 120 120 121 121 return nodeid; 122 122 } 123 /*}}} 1*/124 /*FUNCTION SpcStatic::GetValue {{{ 1*/125 double SpcStatic::GetValue(){126 _assert_(! isnan(value));123 /*}}}*/ 124 /*FUNCTION SpcStatic::GetValue {{{*/ 125 IssmDouble SpcStatic::GetValue(){ 126 _assert_(!xIsNan<IssmDouble>(value)); 127 127 return value; 128 128 } 129 /*}}} 1*/129 /*}}}*/ -
issm/trunk/src/c/objects/Constraints/SpcStatic.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../Object.h" 11 11 class DataSet; … … 18 18 int nodeid; /*!node id*/ 19 19 int dof; /*!component*/ 20 double value; /*value*/20 IssmDouble value; /*value*/ 21 21 int analysis_type; 22 22 23 23 public: 24 24 25 /*SpcStatic constructors, destructors:{{{ 1*/25 /*SpcStatic constructors, destructors:{{{*/ 26 26 SpcStatic(); 27 SpcStatic(int sid,int nodeid, int dof, double value,int analysis_type);27 SpcStatic(int sid,int nodeid, int dof,IssmDouble value,int analysis_type); 28 28 ~SpcStatic(); 29 29 /*}}}*/ 30 /*Object virtual functions definitions:{{{ 1*/30 /*Object virtual functions definitions:{{{ */ 31 31 void Echo(); 32 32 void DeepEcho(); … … 36 36 Object* copy(); 37 37 /*}}}*/ 38 /*Constraint virtual functions definitions: {{{ 1*/38 /*Constraint virtual functions definitions: {{{*/ 39 39 void ConstrainNode(Nodes* nodes,Parameters* parameters); 40 40 bool InAnalysis(int analysis_type); 41 41 /*}}}*/ 42 /*SpcStatic management:{{{ 1*/42 /*SpcStatic management:{{{ */ 43 43 int GetNodeId(); 44 44 int GetDof(); 45 double GetValue();45 IssmDouble GetValue(); 46 46 /*}}}*/ 47 47 -
issm/trunk/src/c/objects/Constraints/SpcTransient.cpp
r12330 r12706 18 18 19 19 /*SpcTransient constructors and destructor*/ 20 /*FUNCTION SpcTransient::SpcTransient(){{{ 1*/20 /*FUNCTION SpcTransient::SpcTransient(){{{*/ 21 21 SpcTransient::SpcTransient(){ 22 22 sid=-1; … … 29 29 return; 30 30 } 31 /*}}} 1*/32 /*FUNCTION SpcTransient::SpcTransient(int spc_sid,int spc_nodeid,...){{{ 1*/33 SpcTransient::SpcTransient(int spc_sid,int spc_nodeid, int spc_dof,int spc_nsteps, double* spc_times, double* spc_values,int spc_analysis_type){31 /*}}}*/ 32 /*FUNCTION SpcTransient::SpcTransient(int spc_sid,int spc_nodeid,...){{{*/ 33 SpcTransient::SpcTransient(int spc_sid,int spc_nodeid, int spc_dof,int spc_nsteps, IssmDouble* spc_times, IssmDouble* spc_values,int spc_analysis_type){ 34 34 35 35 sid=spc_sid; … … 38 38 nsteps=spc_nsteps; 39 39 if(spc_nsteps){ 40 values= (double*)xmalloc(spc_nsteps*sizeof(double));41 times= (double*)xmalloc(spc_nsteps*sizeof(double));42 memcpy(values,spc_values,nsteps*sizeof(double));43 memcpy(times,spc_times,nsteps*sizeof(double));40 values=xNew<IssmDouble>(spc_nsteps); 41 times=xNew<IssmDouble>(spc_nsteps); 42 xMemCpy<IssmDouble>(values,spc_values,nsteps); 43 xMemCpy<IssmDouble>(times,spc_times,nsteps); 44 44 } 45 45 analysis_type=spc_analysis_type; 46 46 return; 47 47 } 48 /*}}} 1*/49 /*FUNCTION SpcTransient::~SpcTransient{{{ 1*/48 /*}}}*/ 49 /*FUNCTION SpcTransient::~SpcTransient{{{*/ 50 50 SpcTransient::~SpcTransient(){ 51 x free((void**)×);52 x free((void**)&values);51 xDelete<IssmDouble>(times); 52 xDelete<IssmDouble>(values); 53 53 return; 54 54 } 55 /*}}} 1*/55 /*}}}*/ 56 56 57 57 /*Object virtual functions definitions:*/ 58 /*FUNCTION SpcTransient::Echo {{{ 1*/58 /*FUNCTION SpcTransient::Echo {{{*/ 59 59 void SpcTransient::Echo(void){ 60 60 61 61 int i; 62 printf("SpcTransient:\n");63 printf(" sid: %i\n",sid);64 printf(" nodeid: %i\n",nodeid);65 printf(" dof: %i\n",dof);66 printf(" nsteps: %i\n",nsteps);67 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));68 printf(" steps|times|values\n");62 _printLine_("SpcTransient:"); 63 _printLine_(" sid: " << sid); 64 _printLine_(" nodeid: " << nodeid); 65 _printLine_(" dof: " << dof); 66 _printLine_(" nsteps: " << nsteps); 67 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 68 _printLine_(" steps|times|values"); 69 69 for(i=0;i<nsteps;i++){ 70 printf("%i-%g:%g\n",i,times[i],values[i]);70 _printLine_(i << "-" << times[i] << ":" << values[i]); 71 71 } 72 72 return; 73 73 } 74 /*}}} 1*/75 /*FUNCTION SpcTransient::DeepEcho {{{ 1*/74 /*}}}*/ 75 /*FUNCTION SpcTransient::DeepEcho {{{*/ 76 76 void SpcTransient::DeepEcho(void){ 77 77 this->Echo(); 78 78 } 79 /*}}} 1*/80 /*FUNCTION SpcTransient::Id {{{ 1*/79 /*}}}*/ 80 /*FUNCTION SpcTransient::Id {{{*/ 81 81 int SpcTransient::Id(void){ return sid; } 82 /*}}} 1*/83 /*FUNCTION SpcTransient::MyRank {{{ 1*/82 /*}}}*/ 83 /*FUNCTION SpcTransient::MyRank {{{*/ 84 84 int SpcTransient::MyRank(void){ 85 85 extern int my_rank; 86 86 return my_rank; 87 87 } 88 /*}}} 1*/89 /*FUNCTION SpcTransient::ObjectEnum{{{ 1*/88 /*}}}*/ 89 /*FUNCTION SpcTransient::ObjectEnum{{{*/ 90 90 int SpcTransient::ObjectEnum(void){ 91 91 … … 93 93 94 94 } 95 /*}}} 1*/96 /*FUNCTION SpcTransient::copy {{{ 1*/95 /*}}}*/ 96 /*FUNCTION SpcTransient::copy {{{*/ 97 97 Object* SpcTransient::copy() { 98 98 return new SpcTransient(sid,nodeid,dof,nsteps,times,values,analysis_type); 99 99 } 100 /*}}} 1*/100 /*}}}*/ 101 101 102 102 /*Constraint virtual functions definitions:*/ 103 /*FUNCTION SpcTransient::InAnalysis{{{ 1*/103 /*FUNCTION SpcTransient::InAnalysis{{{*/ 104 104 bool SpcTransient::InAnalysis(int in_analysis_type){ 105 105 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION SpcTransient::ConstrainNode{{{ 1*/110 /*FUNCTION SpcTransient::ConstrainNode{{{*/ 111 111 void SpcTransient::ConstrainNode(Nodes* nodes,Parameters* parameters){ 112 112 113 113 Node* node=NULL; 114 double time=0;114 IssmDouble time=0; 115 115 int i; 116 double alpha=-1;117 double value;116 IssmDouble alpha=-1; 117 IssmDouble value; 118 118 bool found=false; 119 119 … … 146 146 } 147 147 148 if(!found)_error _("could not find time segment for constraint");148 if(!found)_error2_("could not find time segment for constraint"); 149 149 150 150 /*Apply or relax constraint: */ 151 if( isnan(value)){151 if(xIsNan<IssmDouble>(value)){ 152 152 node->RelaxConstraint(dof); 153 153 } … … 158 158 159 159 /*SpcTransient functions*/ 160 /*FUNCTION SpcTransient::GetDof {{{ 1*/160 /*FUNCTION SpcTransient::GetDof {{{*/ 161 161 int SpcTransient::GetDof(){ 162 162 return dof; 163 163 } 164 /*}}} 1*/165 /*FUNCTION SpcTransient::GetNodeId {{{ 1*/164 /*}}}*/ 165 /*FUNCTION SpcTransient::GetNodeId {{{*/ 166 166 int SpcTransient::GetNodeId(){ 167 167 168 168 return nodeid; 169 169 } 170 /*}}} 1*/171 /*FUNCTION SpcTransient::GetValue {{{ 1*/172 double SpcTransient::GetValue(){170 /*}}}*/ 171 /*FUNCTION SpcTransient::GetValue {{{*/ 172 IssmDouble SpcTransient::GetValue(){ 173 173 return values[0]; 174 174 } 175 /*}}} 1*/175 /*}}}*/ 176 176 -
issm/trunk/src/c/objects/Constraints/SpcTransient.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../Object.h" 11 11 class DataSet; … … 18 18 int nodeid; /*!node id*/ 19 19 int dof; /*!component*/ 20 double* values; /*different values in time*/21 double* times; /*different time steps*/20 IssmDouble* values; /*different values in time*/ 21 IssmDouble* times; /*different time steps*/ 22 22 int nsteps; /*number of time steps*/ 23 23 int analysis_type; … … 25 25 public: 26 26 27 /*SpcTransient constructors, destructors:{{{ 1*/27 /*SpcTransient constructors, destructors:{{{*/ 28 28 SpcTransient(); 29 SpcTransient(int sid,int nodeid, int dof,int nsteps, double* times, double* values,int analysis_type);29 SpcTransient(int sid,int nodeid, int dof,int nsteps, IssmDouble* times, IssmDouble* values,int analysis_type); 30 30 ~SpcTransient(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{ */ 33 33 void Echo(); 34 34 void DeepEcho(); … … 38 38 Object* copy(); 39 39 /*}}}*/ 40 /*Constraint virtual functions definitions: {{{ 1*/40 /*Constraint virtual functions definitions: {{{*/ 41 41 void ConstrainNode(Nodes* nodes,Parameters* parameters); 42 42 bool InAnalysis(int analysis_type); 43 43 /*}}}*/ 44 /*SpcTransient management:{{{ 1*/44 /*SpcTransient management:{{{ */ 45 45 int GetNodeId(); 46 46 int GetDof(); 47 double GetValue();47 IssmDouble GetValue(); 48 48 /*}}}*/ 49 49 -
issm/trunk/src/c/objects/Contour.cpp
r12330 r12706 15 15 16 16 /*Contour constructors and destructors:*/ 17 /*FUNCTION Contour::Contour() default constructor {{{ 1*/17 /*FUNCTION Contour::Contour() default constructor {{{*/ 18 18 Contour::Contour(){ 19 19 this->id=0; … … 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION Contour::Contour(int pid, int nods, double* x, double* y,bool closed) {{{1*/27 Contour::Contour(int pid,int pnods, double* px, double* py,bool pclosed){26 /*FUNCTION Contour::Contour(int pid, int nods, IssmDouble* x, IssmDouble* y,bool closed) {{{*/ 27 Contour::Contour(int pid,int pnods, IssmDouble* px, IssmDouble* py,bool pclosed){ 28 28 29 29 this->id=pid; … … 31 31 this->closed=pclosed; 32 32 if(nods){ 33 this->x= (double*)xmalloc(nods*sizeof(double));34 memcpy(this->x,px,nods*sizeof(double));35 this->y= (double*)xmalloc(nods*sizeof(double));36 memcpy(this->y,py,nods*sizeof(double));33 this->x=xNew<IssmDouble>(nods); 34 xMemCpy<IssmDouble>(this->x,px,nods); 35 this->y=xNew<IssmDouble>(nods); 36 xMemCpy<IssmDouble>(this->y,py,nods); 37 37 } 38 38 } 39 39 /*}}}*/ 40 /*FUNCTION Contour::Contour() default constructor {{{ 1*/40 /*FUNCTION Contour::Contour() default constructor {{{*/ 41 41 Contour::~Contour(){ 42 x free((void**)&this->x);43 x free((void**)&this->y);42 xDelete<IssmDouble>(this->x); 43 xDelete<IssmDouble>(this->y); 44 44 } 45 45 /*}}}*/ … … 47 47 48 48 /*Object virtual function resolutoin: */ 49 /*FUNCTION Contour::Echo(){{{ 1*/49 /*FUNCTION Contour::Echo(){{{*/ 50 50 void Contour::Echo(void){ 51 51 52 52 int i; 53 53 54 printf("Contour: %i:\n",id);55 printf(" nods: %i\n",nods);56 printf(" closed: %s\n",closed?"true":"false");54 _printLine_("Contour: " << id); 55 _printLine_(" nods: " << nods); 56 _printLine_(" closed: " << (closed?"true":"false")); 57 57 if(nods){ 58 printf(" x,y:\n");58 _printLine_(" x,y:"); 59 59 for(i=0;i<nods;i++){ 60 printf("%i: %g|%g\n",i,x[i],y[i]);60 _printLine_(i << ": " << x[i] << "|" << y[i]); 61 61 } 62 62 } 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION Contour::DeepEcho(){{{ 1*/65 /*FUNCTION Contour::DeepEcho(){{{*/ 66 66 void Contour::DeepEcho(void){ 67 67 this->Echo(); 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION Contour::Id(){{{ 1*/70 /*FUNCTION Contour::Id(){{{*/ 71 71 int Contour::Id(void){ 72 72 return id; 73 73 } 74 74 /*}}}*/ 75 /*FUNCTION Contour::MyRank{{{ 1*/75 /*FUNCTION Contour::MyRank{{{*/ 76 76 int Contour::MyRank(void){ 77 77 extern int my_rank; … … 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION Contour::ObjectEnum{{{ 1*/82 /*FUNCTION Contour::ObjectEnum{{{*/ 83 83 int Contour::ObjectEnum(void){ 84 84 … … 87 87 } 88 88 /*}}}*/ 89 /*FUNCTION Contour::copy {{{ 1*/89 /*FUNCTION Contour::copy {{{*/ 90 90 Object* Contour::copy() { 91 91 -
issm/trunk/src/c/objects/Contour.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Object.h" 11 11 #include "../shared/Exceptions/exceptions.h" … … 24 24 bool closed; //is this contour closed? 25 25 26 /*Contour constructors, destructors {{{ 1*/26 /*Contour constructors, destructors {{{*/ 27 27 Contour(); 28 28 Contour(int id, int nods, IssmDouble* x, IssmDouble* y,bool closed); 29 29 ~Contour(); 30 30 /*}}}*/ 31 /*Object virtual functions{{{ 1*/31 /*Object virtual functions{{{*/ 32 32 void Echo(void); 33 33 void DeepEcho(void); -
issm/trunk/src/c/objects/DakotaPlugin.cpp
r9571 r12706 57 57 58 58 int i; 59 double* variables=NULL;59 IssmDouble* variables=NULL; 60 60 char** variable_descriptors=NULL; 61 61 char* variable_descriptor=NULL; 62 double* responses=NULL;62 IssmDouble* responses=NULL; 63 63 64 64 /*increae counter: */ … … 69 69 70 70 /*First, the variables: */ 71 variables= (double*)xmalloc(numACV*sizeof(double));71 variables=xNew<IssmDouble>(numACV); 72 72 for(i=0;i<numACV;i++){ 73 73 variables[i]=xC[i]; 74 74 } 75 75 /*The descriptors: */ 76 variable_descriptors= (char**)xmalloc(numACV*sizeof(char*));76 variable_descriptors=xNew<char*>(numACV); 77 77 for(i=0;i<numACV;i++){ 78 78 string label=xCLabels[i]; 79 variable_descriptor= (char*)xmalloc((strlen(label.c_str())+1)*sizeof(char));79 variable_descriptor=xNew<char>(strlen(label.c_str())+1); 80 80 memcpy(variable_descriptor,label.c_str(),(strlen(label.c_str())+1)*sizeof(char)); 81 81 … … 85 85 86 86 /*Initialize responses: */ 87 responses= (double*)xcalloc(numFns,sizeof(double));87 responses=xNewZeroInit<IssmDouble>(numFns); 88 88 89 89 /*run core solution: */ … … 97 97 98 98 /*Free ressources:*/ 99 x free((void**)&variables);99 xDelete<IssmDouble>(variables); 100 100 for(i=0;i<numACV;i++){ 101 101 variable_descriptor=variable_descriptors[i]; 102 x free((void**)&variable_descriptor);102 xDelete<char>(variable_descriptor); 103 103 } 104 x free((void**)&variable_descriptors);105 x free((void**)&responses);104 xDelete<char*>(variable_descriptors); 105 xDelete<IssmDouble>(responses); 106 106 107 107 return 0; -
issm/trunk/src/c/objects/DakotaPlugin.h
r4042 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 13 13 -
issm/trunk/src/c/objects/DofIndexing.cpp
r12330 r12706 18 18 19 19 /*DofIndexing constructors and destructor*/ 20 /*FUNCTION DofIndexing::DofIndexing(){{{ 1*/20 /*FUNCTION DofIndexing::DofIndexing(){{{*/ 21 21 DofIndexing::DofIndexing(){ 22 22 … … 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION DofIndexing::DofIndexing(int gsize){{{ 1*/37 /*FUNCTION DofIndexing::DofIndexing(int gsize){{{*/ 38 38 DofIndexing::DofIndexing(int in_gsize){ 39 39 this->Init(in_gsize,NULL); 40 40 } 41 41 /*}}}*/ 42 /*FUNCTION DofIndexing::DofIndexing(DofIndexing* in) -> copy{{{ 1*/42 /*FUNCTION DofIndexing::DofIndexing(DofIndexing* in) -> copy{{{*/ 43 43 DofIndexing::DofIndexing(DofIndexing* in){ //copy constructor 44 44 … … 51 51 52 52 if(this->gsize>0){ 53 this->f_set= (bool*)xmalloc(this->gsize*sizeof(bool));54 this->s_set= (bool*)xmalloc(this->gsize*sizeof(bool));55 this->svalues= (double*)xmalloc(this->gsize*sizeof(int));56 if(in->doftype)this->doftype= (int*)xmalloc(this->gsize*sizeof(int));57 this->gdoflist= (int*)xmalloc(this->gsize*sizeof(int));53 this->f_set=xNew<bool>(this->gsize); 54 this->s_set=xNew<bool>(this->gsize); 55 this->svalues=xNew<IssmDouble>(this->gsize); 56 if(in->doftype)this->doftype=xNew<int>(this->gsize); 57 this->gdoflist=xNew<int>(this->gsize); 58 58 } 59 59 else{ … … 64 64 this->gdoflist=NULL; 65 65 } 66 if(this->fsize>0 && this->fsize!=UNDEF)this->fdoflist= (int*)xmalloc(this->fsize*sizeof(int)); else this->fdoflist=NULL;67 if(this->ssize>0 && this->ssize!=UNDEF)this->sdoflist= (int*)xmalloc(this->ssize*sizeof(int)); else this->sdoflist=NULL;66 if(this->fsize>0 && this->fsize!=UNDEF)this->fdoflist=xNew<int>(this->fsize); else this->fdoflist=NULL; 67 if(this->ssize>0 && this->ssize!=UNDEF)this->sdoflist=xNew<int>(this->ssize); else this->sdoflist=NULL; 68 68 69 69 if(this->gsize>0){ 70 70 memcpy(this->f_set,in->f_set,this->gsize*sizeof(bool)); 71 71 memcpy(this->s_set,in->s_set,this->gsize*sizeof(bool)); 72 memcpy(this->svalues,in->svalues,this->gsize*sizeof(double));72 xMemCpy<IssmDouble>(this->svalues,in->svalues,this->gsize); 73 73 if(this->doftype)memcpy(this->doftype,in->doftype,this->gsize*sizeof(int)); 74 74 memcpy(this->gdoflist,in->gdoflist,this->gsize*sizeof(int)); … … 79 79 } 80 80 /*}}}*/ 81 /*FUNCTION DofIndexing::~DofIndexing() {{{ 1*/81 /*FUNCTION DofIndexing::~DofIndexing() {{{*/ 82 82 DofIndexing::~DofIndexing(){ //destructor 83 83 84 x free((void**)&f_set);85 x free((void**)&s_set);86 x free((void**)&svalues);87 x free((void**)&doftype);88 x free((void**)&gdoflist);89 x free((void**)&fdoflist);90 x free((void**)&sdoflist);91 92 } 93 /*}}}*/ 94 /*FUNCTION DofIndexing::Init{{{ 1*/84 xDelete<bool>(f_set); 85 xDelete<bool>(s_set); 86 xDelete<IssmDouble>(svalues); 87 xDelete<int>(doftype); 88 xDelete<int>(gdoflist); 89 xDelete<int>(fdoflist); 90 xDelete<int>(sdoflist); 91 92 } 93 /*}}}*/ 94 /*FUNCTION DofIndexing::Init{{{*/ 95 95 void DofIndexing::Init(int in_gsize,int* in_doftype){ 96 96 … … 102 102 /*allocate: */ 103 103 if(this->gsize>0){ 104 this->f_set= (bool*)xmalloc(this->gsize*sizeof(bool));105 this->s_set= (bool*)xmalloc(this->gsize*sizeof(bool));106 this->svalues= (double*)xmalloc(this->gsize*sizeof(double));107 if(in_doftype)this->doftype= (int*)xmalloc(this->gsize*sizeof(int));108 this->gdoflist= (int*)xmalloc(this->gsize*sizeof(int));104 this->f_set=xNew<bool>(this->gsize); 105 this->s_set=xNew<bool>(this->gsize); 106 this->svalues=xNew<IssmDouble>(this->gsize); 107 if(in_doftype)this->doftype=xNew<int>(this->gsize); 108 this->gdoflist=xNew<int>(this->gsize); 109 109 } 110 110 … … 119 119 } 120 120 /*}}}*/ 121 /*FUNCTION DofIndexing::InitSet{{{ 1*/121 /*FUNCTION DofIndexing::InitSet{{{*/ 122 122 void DofIndexing::InitSet(int setenum){ 123 123 … … 131 131 for(i=0;i<this->gsize;i++) if(f_set[i])size++; 132 132 this->fsize=size; 133 x free((void**)&this->fdoflist);134 if(this->fsize)this->fdoflist= (int*)xmalloc(size*sizeof(int));133 xDelete<int>(this->fdoflist); 134 if(this->fsize)this->fdoflist=xNew<int>(size); 135 135 else this->fdoflist=NULL; 136 136 } … … 139 139 for(i=0;i<this->gsize;i++) if(s_set[i])size++; 140 140 this->ssize=size; 141 x free((void**)&this->sdoflist);142 if(this->ssize)this->sdoflist= (int*)xmalloc(size*sizeof(int));141 xDelete<int>(this->sdoflist); 142 if(this->ssize)this->sdoflist=xNew<int>(size); 143 143 else this->sdoflist=NULL; 144 144 } 145 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");145 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 146 146 } 147 147 /*}}}*/ 148 148 149 149 /*Some of the Object functionality: */ 150 /*FUNCTION DofIndexing::Echo{{{ 1*/150 /*FUNCTION DofIndexing::Echo{{{*/ 151 151 void DofIndexing::Echo(void){ 152 152 153 153 int i; 154 154 155 printf("DofIndexing:\n");156 printf(" gsize: %i\n",gsize);157 printf(" clone: %i\n",clone);158 } 159 /*}}}*/ 160 /*FUNCTION DofIndexing::DeepEcho{{{ 1*/155 _printLine_("DofIndexing:"); 156 _printLine_(" gsize: " << gsize); 157 _printLine_(" clone: " << clone); 158 } 159 /*}}}*/ 160 /*FUNCTION DofIndexing::DeepEcho{{{*/ 161 161 void DofIndexing::DeepEcho(void){ 162 162 163 163 int i; 164 164 165 printf("DofIndexing:\n");166 printf(" gsize: %i\n",gsize);167 printf(" fsize: %i\n",fsize);168 printf(" ssize: %i\n",ssize);169 printf(" clone: %i\n",clone);165 _printLine_("DofIndexing:"); 166 _printLine_(" gsize: " << gsize); 167 _printLine_(" fsize: " << fsize); 168 _printLine_(" ssize: " << ssize); 169 _printLine_(" clone: " << clone); 170 170 171 printf(" set membership: f,s sets \n");171 _printLine_(" set membership: f,s sets "); 172 172 for(i=0;i<gsize;i++){ 173 printf(" dof %i: %s %s\n",i,f_set[i]?"true":"false",s_set[i]?"true":"false");174 } 175 176 printf(" svalues (%i): |",this->ssize);173 _printLine_(" dof " << i << ": " <<(f_set[i]?"true":"false")<< " " <<(s_set[i]?"true":"false")); 174 } 175 176 _printString_(" svalues (" << this->ssize << "): |"); 177 177 for(i=0;i<this->gsize;i++){ 178 if(this->s_set[i]) printf(" %g |",svalues[i]);179 } 180 printf("\n");178 if(this->s_set[i])_printString_(" " << svalues[i] << " |"); 179 } 180 _printLine_(""); 181 181 182 182 if(doftype){ 183 printf(" doftype: |");183 _printString_(" doftype: |"); 184 184 for(i=0;i<gsize;i++){ 185 printf(" %i |",doftype[i]);185 _printString_(" " << doftype[i] << " |"); 186 186 } 187 printf("\n");188 } 189 else printf(" doftype: NULL\n");190 191 printf(" g_doflist (%i): |",this->gsize);187 _printLine_(""); 188 } 189 else _printLine_(" doftype: NULL"); 190 191 _printString_(" g_doflist (" << this->gsize << "): |"); 192 192 for(i=0;i<this->gsize;i++){ 193 printf(" %i |",gdoflist[i]);194 } 195 printf("\n");196 197 printf(" f_doflist (%i): |",this->fsize);193 _printString_(" " << gdoflist[i] << " |"); 194 } 195 _printLine_(""); 196 197 _printString_(" f_doflist (" << this->fsize << "): |"); 198 198 for(i=0;i<this->fsize;i++){ 199 printf(" %i |",fdoflist[i]);200 } 201 printf("\n");202 203 printf(" s_doflist (%i): |",this->ssize);199 _printString_(" " << fdoflist[i] << " |"); 200 } 201 _printLine_(""); 202 203 _printString_(" s_doflist (" << this->ssize << "): |"); 204 204 for(i=0;i<this->ssize;i++){ 205 printf(" %i |",sdoflist[i]);206 } 207 printf("\n");205 _printString_(" " << sdoflist[i] << " |"); 206 } 207 _printLine_(""); 208 208 } 209 209 /*}}}*/ -
issm/trunk/src/c/objects/DofIndexing.h
r12330 r12706 34 34 35 35 36 /*DofIndexing constructors, destructors {{{ 1*/36 /*DofIndexing constructors, destructors {{{*/ 37 37 DofIndexing(); 38 38 DofIndexing(int g_size); … … 42 42 ~DofIndexing(); 43 43 /*}}}*/ 44 /*Object like functionality: {{{ 1*/44 /*Object like functionality: {{{*/ 45 45 void Echo(void); 46 46 void DeepEcho(void); 47 47 void copy(DofIndexing* properties); 48 48 /*}}}*/ 49 /*DofIndexing management: {{{ 1*/49 /*DofIndexing management: {{{*/ 50 50 DofIndexing* Spawn(int* indices, int numindices); 51 51 /*}}}*/ -
issm/trunk/src/c/objects/ElementResults/BoolElementResult.cpp
r12330 r12706 19 19 20 20 /*BoolElementResult constructors and destructor*/ 21 /*FUNCTION BoolElementResult::BoolElementResult(){{{ 1*/21 /*FUNCTION BoolElementResult::BoolElementResult(){{{*/ 22 22 BoolElementResult::BoolElementResult(){ 23 23 return; 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION BoolElementResult::BoolElementResult(int in_enum_type,IssmDouble in_value,int in_step, double in_time){{{1*/27 BoolElementResult::BoolElementResult(int in_enum_type,bool in_value,int in_step, double in_time){26 /*FUNCTION BoolElementResult::BoolElementResult(int in_enum_type,IssmDouble in_value,int in_step, IssmDouble in_time){{{*/ 27 BoolElementResult::BoolElementResult(int in_enum_type,bool in_value,int in_step, IssmDouble in_time){ 28 28 29 29 enum_type=in_enum_type; … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION BoolElementResult::~BoolElementResult(){{{ 1*/35 /*FUNCTION BoolElementResult::~BoolElementResult(){{{*/ 36 36 BoolElementResult::~BoolElementResult(){ 37 37 return; … … 40 40 41 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION BoolElementResult::Echo {{{ 1*/42 /*FUNCTION BoolElementResult::Echo {{{*/ 43 43 void BoolElementResult::Echo(void){ 44 44 this->DeepEcho(); 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION BoolElementResult::DeepEcho{{{ 1*/47 /*FUNCTION BoolElementResult::DeepEcho{{{*/ 48 48 void BoolElementResult::DeepEcho(void){ 49 49 50 printf("BoolElementResult:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" value: %s\n",this->value?"true":"false");53 printf(" step: %i\n",this->step);54 printf(" time: %g\n",this->time);50 _printLine_("BoolElementResult:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" value: "<<(this->value?"true":"false")); 53 _printLine_(" step: " << this->step); 54 _printLine_(" time: " << this->time); 55 55 } 56 56 /*}}}*/ 57 /*FUNCTION BoolElementResult::Id{{{ 1*/57 /*FUNCTION BoolElementResult::Id{{{*/ 58 58 int BoolElementResult::Id(void){ return -1; } 59 59 /*}}}*/ 60 /*FUNCTION BoolElementResult::MyRank{{{ 1*/60 /*FUNCTION BoolElementResult::MyRank{{{*/ 61 61 int BoolElementResult::MyRank(void){ 62 62 extern int my_rank; … … 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION BoolElementResult::ObjectEnum{{{ 1*/66 /*FUNCTION BoolElementResult::ObjectEnum{{{*/ 67 67 int BoolElementResult::ObjectEnum(void){ 68 68 … … 71 71 } 72 72 /*}}}*/ 73 /*FUNCTION BoolElementResult::copy{{{ 1*/73 /*FUNCTION BoolElementResult::copy{{{*/ 74 74 Object* BoolElementResult::copy() { 75 75 … … 80 80 81 81 /*ElementResult management*/ 82 /*FUNCTION BoolElementResult::InstanceEnum{{{ 1*/82 /*FUNCTION BoolElementResult::InstanceEnum{{{*/ 83 83 int BoolElementResult::InstanceEnum(void){ 84 84 … … 87 87 } 88 88 /*}}}*/ 89 /*FUNCTION BoolElementResult::SpawnTriaElementResult{{{ 1*/89 /*FUNCTION BoolElementResult::SpawnTriaElementResult{{{*/ 90 90 ElementResult* BoolElementResult::SpawnTriaElementResult(int* indices){ 91 91 … … 104 104 } 105 105 /*}}}*/ 106 /*FUNCTION BoolElementResult::ProcessUnits{{{ 1*/106 /*FUNCTION BoolElementResult::ProcessUnits{{{*/ 107 107 void BoolElementResult::ProcessUnits(Parameters* parameters){ 108 109 this->value=UnitConversion(this->value,IuToExtEnum,this->enum_type); 110 108 // no op 111 109 } 112 110 /*}}}*/ 113 /*FUNCTION BoolElementResult::NumberOfNodalValues{{{ 1*/111 /*FUNCTION BoolElementResult::NumberOfNodalValues{{{*/ 114 112 int BoolElementResult::NumberOfNodalValues(void){ 115 113 return 1; 116 114 } 117 115 /*}}}*/ 118 /*FUNCTION BoolElementResult::PatchFill{{{ 1*/116 /*FUNCTION BoolElementResult::PatchFill{{{*/ 119 117 void BoolElementResult::PatchFill(int row, Patch* patch){ 120 118 … … 122 120 * of the patch object: enum_type step time element_id interpolation vertices_ids nodal_values 123 121 * Here, we will supply the enum_type, step, time, interpolation and nodal_values: */ 124 double doublevalue=this->value?1:0;125 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,& doublevalue,1);122 IssmDouble IssmDoublevalue=this->value?1:0; 123 patch->fillresultinfo(row,this->enum_type,this->step,this->time,P0Enum,&IssmDoublevalue,1); 126 124 127 125 } 128 126 /*}}}*/ 129 /*FUNCTION BoolElementResult::GetVectorFromResults{{{ 1*/127 /*FUNCTION BoolElementResult::GetVectorFromResults{{{*/ 130 128 void BoolElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){ 131 129 132 _error _("cannot return vector on vertices");130 _error2_("cannot return vector on vertices"); 133 131 } /*}}}*/ 134 /*FUNCTION BoolElementResult::GetElementVectorFromResults{{{ 1*/132 /*FUNCTION BoolElementResult::GetElementVectorFromResults{{{*/ 135 133 void BoolElementResult::GetElementVectorFromResults(Vector* vector,int dof){ 136 134 -
issm/trunk/src/c/objects/ElementResults/BoolElementResult.h
r12330 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../Inputs/Input.h" 13 13 #include "../../include/include.h" … … 21 21 bool value; 22 22 int step; 23 double time;23 IssmDouble time; 24 24 25 25 public: 26 26 27 /*BoolElementResult constructors, destructors: {{{ 1*/27 /*BoolElementResult constructors, destructors: {{{*/ 28 28 BoolElementResult(); 29 BoolElementResult(int enum_type,bool value,int step, double time);29 BoolElementResult(int enum_type,bool value,int step,IssmDouble time); 30 30 ~BoolElementResult(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{ */ 33 33 void Echo(); 34 34 void DeepEcho(); … … 38 38 Object* copy(); 39 39 /*}}}*/ 40 /*ElementResult virtual functions definitions: {{{ 1*/40 /*ElementResult virtual functions definitions: {{{*/ 41 41 ElementResult* SpawnTriaElementResult(int* indices); 42 double GetTime(void){return time;};42 IssmDouble GetTime(void){return time;}; 43 43 int GetStep(void){return step;}; 44 44 void ProcessUnits(Parameters* parameters); … … 46 46 void PatchFill(int row, Patch* patch); 47 47 /*}}}*/ 48 /*BoolElementResult management: {{{ 1*/48 /*BoolElementResult management: {{{*/ 49 49 int InstanceEnum(); 50 50 void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs); -
issm/trunk/src/c/objects/ElementResults/DoubleElementResult.cpp
r12628 r12706 19 19 20 20 /*DoubleElementResult constructors and destructor*/ 21 /*FUNCTION DoubleElementResult::DoubleElementResult(){{{ 1*/21 /*FUNCTION DoubleElementResult::DoubleElementResult(){{{*/ 22 22 DoubleElementResult::DoubleElementResult(){ 23 23 return; 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION DoubleElementResult::DoubleElementResult(int in_enum_type,IssmDouble in_value,int in_step, double in_time){{{1*/27 DoubleElementResult::DoubleElementResult(int in_enum_type,IssmDouble in_value,int in_step, double in_time){26 /*FUNCTION DoubleElementResult::DoubleElementResult(int in_enum_type,IssmDouble in_value,int in_step, IssmDouble in_time){{{*/ 27 DoubleElementResult::DoubleElementResult(int in_enum_type,IssmDouble in_value,int in_step, IssmDouble in_time){ 28 28 29 29 enum_type=in_enum_type; … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION DoubleElementResult::~DoubleElementResult(){{{ 1*/35 /*FUNCTION DoubleElementResult::~DoubleElementResult(){{{*/ 36 36 DoubleElementResult::~DoubleElementResult(){ 37 37 return; … … 40 40 41 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION DoubleElementResult::Echo {{{ 1*/42 /*FUNCTION DoubleElementResult::Echo {{{*/ 43 43 void DoubleElementResult::Echo(void){ 44 44 this->DeepEcho(); 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION DoubleElementResult::DeepEcho{{{ 1*/47 /*FUNCTION DoubleElementResult::DeepEcho{{{*/ 48 48 void DoubleElementResult::DeepEcho(void){ 49 49 50 printf("DoubleElementResult:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" value: %g\n",this->value);53 printf(" step: %i\n",this->step);54 printf(" time: %g\n",this->time);50 _printLine_("DoubleElementResult:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" value: " << this->value); 53 _printLine_(" step: " << this->step); 54 _printLine_(" time: " << this->time); 55 55 } 56 56 /*}}}*/ 57 /*FUNCTION DoubleElementResult::Id{{{ 1*/57 /*FUNCTION DoubleElementResult::Id{{{*/ 58 58 int DoubleElementResult::Id(void){ return -1; } 59 59 /*}}}*/ 60 /*FUNCTION DoubleElementResult::MyRank{{{ 1*/60 /*FUNCTION DoubleElementResult::MyRank{{{*/ 61 61 int DoubleElementResult::MyRank(void){ 62 62 extern int my_rank; … … 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION DoubleElementResult::ObjectEnum{{{ 1*/66 /*FUNCTION DoubleElementResult::ObjectEnum{{{*/ 67 67 int DoubleElementResult::ObjectEnum(void){ 68 68 … … 71 71 } 72 72 /*}}}*/ 73 /*FUNCTION DoubleElementResult::copy{{{ 1*/73 /*FUNCTION DoubleElementResult::copy{{{*/ 74 74 Object* DoubleElementResult::copy() { 75 75 … … 80 80 81 81 /*ElementResult management*/ 82 /*FUNCTION DoubleElementResult::InstanceEnum{{{ 1*/82 /*FUNCTION DoubleElementResult::InstanceEnum{{{*/ 83 83 int DoubleElementResult::InstanceEnum(void){ 84 84 … … 87 87 } 88 88 /*}}}*/ 89 /*FUNCTION DoubleElementResult::SpawnTriaElementResult{{{ 1*/89 /*FUNCTION DoubleElementResult::SpawnTriaElementResult{{{*/ 90 90 ElementResult* DoubleElementResult::SpawnTriaElementResult(int* indices){ 91 91 … … 104 104 } 105 105 /*}}}*/ 106 /*FUNCTION DoubleElementResult::ProcessUnits{{{ 1*/106 /*FUNCTION DoubleElementResult::ProcessUnits{{{*/ 107 107 void DoubleElementResult::ProcessUnits(Parameters* parameters){ 108 108 … … 111 111 } 112 112 /*}}}*/ 113 /*FUNCTION DoubleElementResult::NumberOfNodalValues{{{ 1*/113 /*FUNCTION DoubleElementResult::NumberOfNodalValues{{{*/ 114 114 int DoubleElementResult::NumberOfNodalValues(void){ 115 115 return 1; 116 116 } 117 117 /*}}}*/ 118 /*FUNCTION DoubleElementResult::PatchFill{{{ 1*/118 /*FUNCTION DoubleElementResult::PatchFill{{{*/ 119 119 void DoubleElementResult::PatchFill(int row, Patch* patch){ 120 120 -
issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h
r12628 r12706 1 1 /*! \file DoubleElementResult.h 2 * \brief: header file for double result object3 * A double result object is just derived from a DoubleInput object, with additional time and step information.2 * \brief: header file for IssmDouble result object 3 * A IssmDouble result object is just derived from a DoubleInput object, with additional time and step information. 4 4 */ 5 5 … … 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../Inputs/Input.h" 13 13 #include "../../include/include.h" … … 19 19 private: 20 20 int enum_type; 21 double value;21 IssmDouble value; 22 22 int step; 23 double time;23 IssmDouble time; 24 24 25 25 public: 26 26 27 /*DoubleElementResult constructors, destructors: {{{ 1*/27 /*DoubleElementResult constructors, destructors: {{{*/ 28 28 DoubleElementResult(); 29 DoubleElementResult(int enum_type, double value,int step,double time);29 DoubleElementResult(int enum_type,IssmDouble value,int step,IssmDouble time); 30 30 ~DoubleElementResult(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{ */ 33 33 void Echo(); 34 34 void DeepEcho(); … … 38 38 Object* copy(); 39 39 /*}}}*/ 40 /*ElementResult virtual functions definitions: {{{ 1*/40 /*ElementResult virtual functions definitions: {{{*/ 41 41 ElementResult* SpawnTriaElementResult(int* indices); 42 double GetTime(void){return time;};42 IssmDouble GetTime(void){return time;}; 43 43 int GetStep(void){return step;}; 44 44 void ProcessUnits(Parameters* parameters); … … 46 46 void PatchFill(int row, Patch* patch); 47 47 /*}}}*/ 48 /*DoubleElementResult management: {{{ 1*/48 /*DoubleElementResult management: {{{*/ 49 49 int InstanceEnum(); 50 50 void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs); -
issm/trunk/src/c/objects/ElementResults/ElementResult.h
r11995 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "../Object.h" 12 12 /*}}}*/ … … 19 19 20 20 virtual ElementResult* SpawnTriaElementResult(int* indices)=0; 21 virtual double GetTime(void)=0;21 virtual IssmDouble GetTime(void)=0; 22 22 virtual int GetStep(void)=0; 23 23 virtual void ProcessUnits(Parameters* parameters)=0; -
issm/trunk/src/c/objects/ElementResults/PentaP1ElementResult.cpp
r12330 r12706 19 19 20 20 /*PentaP1ElementResult constructors and destructor*/ 21 /*FUNCTION PentaP1ElementResult::PentaP1ElementResult(){{{ 1*/21 /*FUNCTION PentaP1ElementResult::PentaP1ElementResult(){{{*/ 22 22 PentaP1ElementResult::PentaP1ElementResult(){ 23 23 return; 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION PentaP1ElementResult::PentaP1ElementResult(int in_enum_type, double* in_values,int in_step, double in_time){{{1*/27 PentaP1ElementResult::PentaP1ElementResult(int in_enum_type, double* in_values,int in_step, double in_time){26 /*FUNCTION PentaP1ElementResult::PentaP1ElementResult(int in_enum_type,IssmDouble* in_values,int in_step, IssmDouble in_time){{{*/ 27 PentaP1ElementResult::PentaP1ElementResult(int in_enum_type,IssmDouble* in_values,int in_step, IssmDouble in_time){ 28 28 29 29 int i; … … 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION PentaP1ElementResult::~PentaP1ElementResult(){{{ 1*/37 /*FUNCTION PentaP1ElementResult::~PentaP1ElementResult(){{{*/ 38 38 PentaP1ElementResult::~PentaP1ElementResult(){ 39 39 return; … … 42 42 43 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION PentaP1ElementResult::Echo {{{ 1*/44 /*FUNCTION PentaP1ElementResult::Echo {{{*/ 45 45 void PentaP1ElementResult::Echo(void){ 46 46 this->DeepEcho(); 47 47 } 48 48 /*}}}*/ 49 /*FUNCTION PentaP1ElementResult::DeepEcho{{{ 1*/49 /*FUNCTION PentaP1ElementResult::DeepEcho{{{*/ 50 50 void PentaP1ElementResult::DeepEcho(void){ 51 51 52 printf("PentaP1ElementResult:\n");53 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));54 printf(" values: [%g %g %g %g %g %g]\n",this->values[0],this->values[1],this->values[2],this->values[3],this->values[4],this->values[5]);55 printf(" step: %i\n",this->step);56 printf(" time: %g\n",this->time);52 _printLine_("PentaP1ElementResult:"); 53 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 54 _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << " " << this->values[3] << " " << this->values[4] << " " << this->values[5] << "]"); 55 _printLine_(" step: " << this->step); 56 _printLine_(" time: " << this->time); 57 57 58 58 } 59 59 /*}}}*/ 60 /*FUNCTION PentaP1ElementResult::Id{{{ 1*/60 /*FUNCTION PentaP1ElementResult::Id{{{*/ 61 61 int PentaP1ElementResult::Id(void){ return -1; } 62 62 /*}}}*/ 63 /*FUNCTION PentaP1ElementResult::MyRank{{{ 1*/63 /*FUNCTION PentaP1ElementResult::MyRank{{{*/ 64 64 int PentaP1ElementResult::MyRank(void){ 65 65 extern int my_rank; … … 67 67 } 68 68 /*}}}*/ 69 /*FUNCTION PentaP1ElementResult::ObjectEnum{{{ 1*/69 /*FUNCTION PentaP1ElementResult::ObjectEnum{{{*/ 70 70 int PentaP1ElementResult::ObjectEnum(void){ 71 71 … … 74 74 } 75 75 /*}}}*/ 76 /*FUNCTION PentaP1ElementResult::copy{{{ 1*/76 /*FUNCTION PentaP1ElementResult::copy{{{*/ 77 77 Object* PentaP1ElementResult::copy() { 78 78 … … 83 83 84 84 /*ElementResult management*/ 85 /*FUNCTION PentaP1ElementResult::InstanceEnum{{{ 1*/85 /*FUNCTION PentaP1ElementResult::InstanceEnum{{{*/ 86 86 int PentaP1ElementResult::InstanceEnum(void){ 87 87 … … 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION PentaP1ElementResult::SpawnTriaElementResult{{{ 1*/92 /*FUNCTION PentaP1ElementResult::SpawnTriaElementResult{{{*/ 93 93 ElementResult* PentaP1ElementResult::SpawnTriaElementResult(int* indices){ 94 94 95 95 /*output*/ 96 96 TriaP1ElementResult* outresult=NULL; 97 double newvalues[3];97 IssmDouble newvalues[3]; 98 98 99 99 /*Loop over the new indices*/ … … 115 115 } 116 116 /*}}}*/ 117 /*FUNCTION PentaP1ElementResult::ProcessUnits{{{ 1*/117 /*FUNCTION PentaP1ElementResult::ProcessUnits{{{*/ 118 118 void PentaP1ElementResult::ProcessUnits(Parameters* parameters){ 119 119 … … 122 122 } 123 123 /*}}}*/ 124 /*FUNCTION PentaP1ElementResult::NumberOfNodalValues{{{ 1*/124 /*FUNCTION PentaP1ElementResult::NumberOfNodalValues{{{*/ 125 125 int PentaP1ElementResult::NumberOfNodalValues(void){ 126 126 return 6; 127 127 } 128 128 /*}}}*/ 129 /*FUNCTION PentaP1ElementResult::PatchFill{{{ 1*/129 /*FUNCTION PentaP1ElementResult::PatchFill{{{*/ 130 130 void PentaP1ElementResult::PatchFill(int row, Patch* patch){ 131 131 … … 137 137 } 138 138 /*}}}*/ 139 /*FUNCTION PentaP1ElementResult::GetVectorFromResults{{{ 1*/139 /*FUNCTION PentaP1ElementResult::GetVectorFromResults{{{*/ 140 140 void PentaP1ElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){ 141 141 142 double data[6];142 IssmDouble data[6]; 143 143 144 if(numdofs!=6)_error _("Result %s is a PentaP1ElementResult and cannot write vector of %i dofs",numdofs);145 for(int i=0;i<6;i++) data[i]=this->values[i]/( double)connectivitylist[i];144 if(numdofs!=6)_error2_("Result " << EnumToStringx(this->enum_type) << " is a PentaP1ElementResult and cannot write vector of " << numdofs << " dofs"); 145 for(int i=0;i<6;i++) data[i]=this->values[i]/(IssmDouble)connectivitylist[i]; 146 146 vector->SetValues(numdofs,doflist,&data[0],ADD_VAL); 147 147 148 148 } /*}}}*/ 149 /*FUNCTION PentaP1ElementResult::GetElementVectorFromResults{{{ 1*/149 /*FUNCTION PentaP1ElementResult::GetElementVectorFromResults{{{*/ 150 150 void PentaP1ElementResult::GetElementVectorFromResults(Vector* vector,int dof){ 151 151 152 _error _("Result %s is a PentaP1ElementResult and should not write vector of size numberofelemenrs",EnumToStringx(enum_type));152 _error2_("Result " << EnumToStringx(enum_type) << " is a PentaP1ElementResult and should not write vector of size numberofelemenrs"); 153 153 } /*}}}*/ -
issm/trunk/src/c/objects/ElementResults/PentaP1ElementResult.h
r12330 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../Inputs/Input.h" 13 13 #include "../../include/include.h" … … 18 18 private: 19 19 int enum_type; 20 double values[6];20 IssmDouble values[6]; 21 21 int step; 22 double time;22 IssmDouble time; 23 23 24 24 public: 25 25 26 /*PentaP1ElementResult constructors, destructors: {{{ 1*/26 /*PentaP1ElementResult constructors, destructors: {{{*/ 27 27 PentaP1ElementResult(); 28 PentaP1ElementResult(int enum_type, double* values,int step, double time);28 PentaP1ElementResult(int enum_type,IssmDouble* values,int step, IssmDouble time); 29 29 ~PentaP1ElementResult(); 30 30 /*}}}*/ 31 /*Object virtual functions definitions:{{{ 1*/31 /*Object virtual functions definitions:{{{ */ 32 32 void Echo(); 33 33 void DeepEcho(); … … 37 37 Object* copy(); 38 38 /*}}}*/ 39 /*ElementResult virtual functions definitions: {{{ 1*/39 /*ElementResult virtual functions definitions: {{{*/ 40 40 ElementResult* SpawnTriaElementResult(int* indices); 41 double GetTime(void){return time;};41 IssmDouble GetTime(void){return time;}; 42 42 int GetStep(void){return step;}; 43 43 void ProcessUnits(Parameters* parameters); … … 45 45 void PatchFill(int row, Patch* patch); 46 46 /*}}}*/ 47 /*PentaP1ElementResult management: {{{ 1*/47 /*PentaP1ElementResult management: {{{*/ 48 48 int InstanceEnum(); 49 49 void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs); -
issm/trunk/src/c/objects/ElementResults/TriaP1ElementResult.cpp
r12330 r12706 19 19 20 20 /*TriaP1ElementResult constructors and destructor*/ 21 /*FUNCTION TriaP1ElementResult::TriaP1ElementResult(){{{ 1*/21 /*FUNCTION TriaP1ElementResult::TriaP1ElementResult(){{{*/ 22 22 TriaP1ElementResult::TriaP1ElementResult(){ 23 23 return; 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION TriaP1ElementResult::TriaP1ElementResult(int in_enum_type, double* in_values,int in_step, double in_time){{{1*/27 TriaP1ElementResult::TriaP1ElementResult(int in_enum_type, double* in_values,int in_step, double in_time){26 /*FUNCTION TriaP1ElementResult::TriaP1ElementResult(int in_enum_type,IssmDouble* in_values,int in_step, IssmDouble in_time){{{*/ 27 TriaP1ElementResult::TriaP1ElementResult(int in_enum_type,IssmDouble* in_values,int in_step, IssmDouble in_time){ 28 28 29 29 enum_type=in_enum_type; … … 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION TriaP1ElementResult::~TriaP1ElementResult(){{{ 1*/37 /*FUNCTION TriaP1ElementResult::~TriaP1ElementResult(){{{*/ 38 38 TriaP1ElementResult::~TriaP1ElementResult(){ 39 39 return; … … 42 42 43 43 /*Object virtual functions definitions:*/ 44 /*FUNCTION TriaP1ElementResult::Echo {{{ 1*/44 /*FUNCTION TriaP1ElementResult::Echo {{{*/ 45 45 void TriaP1ElementResult::Echo(void){ 46 46 this->DeepEcho(); 47 47 } 48 48 /*}}}*/ 49 /*FUNCTION TriaP1ElementResult::DeepEcho{{{ 1*/49 /*FUNCTION TriaP1ElementResult::DeepEcho{{{*/ 50 50 void TriaP1ElementResult::DeepEcho(void){ 51 51 52 printf("TriaP1ElementResult:\n");53 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));54 printf(" values: [%g %g %g]\n",this->values[0],this->values[1],this->values[2]);55 printf(" step: %i\n",this->step);56 printf(" time: %g\n",this->time);52 _printLine_("TriaP1ElementResult:"); 53 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 54 _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << "]"); 55 _printLine_(" step: " << this->step); 56 _printLine_(" time: " << this->time); 57 57 } 58 58 /*}}}*/ 59 /*FUNCTION TriaP1ElementResult::Id{{{ 1*/59 /*FUNCTION TriaP1ElementResult::Id{{{*/ 60 60 int TriaP1ElementResult::Id(void){ return -1; } 61 61 /*}}}*/ 62 /*FUNCTION TriaP1ElementResult::MyRank{{{ 1*/62 /*FUNCTION TriaP1ElementResult::MyRank{{{*/ 63 63 int TriaP1ElementResult::MyRank(void){ 64 64 extern int my_rank; … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION TriaP1ElementResult::ObjectEnum{{{ 1*/68 /*FUNCTION TriaP1ElementResult::ObjectEnum{{{*/ 69 69 int TriaP1ElementResult::ObjectEnum(void){ 70 70 … … 73 73 } 74 74 /*}}}*/ 75 /*FUNCTION TriaP1ElementResult::copy{{{ 1*/75 /*FUNCTION TriaP1ElementResult::copy{{{*/ 76 76 Object* TriaP1ElementResult::copy() { 77 77 … … 82 82 83 83 /*ElementResult management*/ 84 /*FUNCTION TriaP1ElementResult::InstanceEnum{{{ 1*/84 /*FUNCTION TriaP1ElementResult::InstanceEnum{{{*/ 85 85 int TriaP1ElementResult::InstanceEnum(void){ 86 86 … … 89 89 } 90 90 /*}}}*/ 91 /*FUNCTION TriaP1ElementResult::SpawnTriaElementResult{{{ 1*/91 /*FUNCTION TriaP1ElementResult::SpawnTriaElementResult{{{*/ 92 92 ElementResult* TriaP1ElementResult::SpawnTriaElementResult(int* indices){ 93 93 … … 103 103 } 104 104 /*}}}*/ 105 /*FUNCTION TriaP1ElementResult::ProcessUnits{{{ 1*/105 /*FUNCTION TriaP1ElementResult::ProcessUnits{{{*/ 106 106 void TriaP1ElementResult::ProcessUnits(Parameters* parameters){ 107 107 … … 110 110 } 111 111 /*}}}*/ 112 /*FUNCTION TriaP1ElementResult::NumberOfNodalValues{{{ 1*/112 /*FUNCTION TriaP1ElementResult::NumberOfNodalValues{{{*/ 113 113 int TriaP1ElementResult::NumberOfNodalValues(void){ 114 114 return 3; 115 115 } 116 116 /*}}}*/ 117 /*FUNCTION TriaP1ElementResult::PatchFill{{{ 1*/117 /*FUNCTION TriaP1ElementResult::PatchFill{{{*/ 118 118 void TriaP1ElementResult::PatchFill(int row, Patch* patch){ 119 119 … … 125 125 } 126 126 /*}}}*/ 127 /*FUNCTION TriaP1ElementResult::GetVectorFromResults{{{ 1*/127 /*FUNCTION TriaP1ElementResult::GetVectorFromResults{{{*/ 128 128 void TriaP1ElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){ 129 129 130 double data[3];130 IssmDouble data[3]; 131 131 132 if(numdofs!=3)_error _("Result %s is a TriaP1ElementResult and cannot write vector of %i dofs",numdofs);133 for(int i=0;i<3;i++) data[i]=this->values[i]/( double)connectivitylist[i];132 if(numdofs!=3)_error2_("Result " << EnumToStringx(this->enum_type) << " is a TriaP1ElementResult and cannot write vector of " << numdofs << " dofs"); 133 for(int i=0;i<3;i++) data[i]=this->values[i]/(IssmDouble)connectivitylist[i]; 134 134 vector->SetValues(numdofs,doflist,&data[0],ADD_VAL); 135 135 136 136 } /*}}}*/ 137 /*FUNCTION TriaP1ElementResult::GetElementVectorFromResults{{{ 1*/137 /*FUNCTION TriaP1ElementResult::GetElementVectorFromResults{{{*/ 138 138 void TriaP1ElementResult::GetElementVectorFromResults(Vector* vector,int dof){ 139 _error _("Result %s is a TriaP1ElementResult and should not write vector of size numberofelemenrs",EnumToStringx(enum_type));139 _error2_("Result " << EnumToStringx(enum_type) << " is a TriaP1ElementResult and should not write vector of size numberofelemenrs"); 140 140 } /*}}}*/ -
issm/trunk/src/c/objects/ElementResults/TriaP1ElementResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "../Inputs/Input.h" 12 12 #include "../../include/include.h" … … 17 17 private: 18 18 int enum_type; 19 double values[3];19 IssmDouble values[3]; 20 20 int step; 21 double time;21 IssmDouble time; 22 22 23 23 public: 24 24 25 /*TriaP1ElementResult constructors, destructors: {{{ 1*/25 /*TriaP1ElementResult constructors, destructors: {{{*/ 26 26 TriaP1ElementResult(); 27 TriaP1ElementResult(int enum_type, double* values,int step,double time);27 TriaP1ElementResult(int enum_type,IssmDouble* values,int step,IssmDouble time); 28 28 ~TriaP1ElementResult(); 29 29 /*}}}*/ 30 /*Object virtual functions definitions:{{{ 1*/30 /*Object virtual functions definitions:{{{ */ 31 31 void Echo(); 32 32 void DeepEcho(); … … 36 36 Object* copy(); 37 37 /*}}}*/ 38 /*ElementResult virtual functions definitions: {{{ 1*/38 /*ElementResult virtual functions definitions: {{{*/ 39 39 ElementResult* SpawnTriaElementResult(int* indices); 40 double GetTime(void){return time;};40 IssmDouble GetTime(void){return time;}; 41 41 int GetStep(void){return step;}; 42 42 void ProcessUnits(Parameters* parameters); … … 44 44 void PatchFill(int row, Patch* patch); 45 45 /*}}}*/ 46 /*TriaP1ElementResult management: {{{ 1*/46 /*TriaP1ElementResult management: {{{*/ 47 47 int InstanceEnum(); 48 48 void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs); -
issm/trunk/src/c/objects/Elements/Element.h
r12630 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 #include "../Object.h" 14 14 … … 38 38 virtual bool IsFloating()=0; 39 39 virtual bool IsNodeOnShelf()=0; 40 virtual bool IsNodeOnShelfFromFlags( double* flags)=0;40 virtual bool IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 41 41 virtual bool IsOnBed()=0; 42 virtual void GetInputListOnVertices( double* pvalue,int enumtype)=0;43 virtual void GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue)=0;44 virtual void GetInputValue( double* pvalue,Node* node,int enumtype)=0;42 virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0; 43 virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0; 44 virtual void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0; 45 45 46 virtual double SurfaceArea(void)=0;46 virtual IssmDouble SurfaceArea(void)=0; 47 47 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0; 48 48 virtual void ComputeBasalStress(Vector* sigma_b)=0; … … 50 50 virtual void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes)=0; 51 51 virtual void PatchFill(int* pcount, Patch* patch)=0; 52 virtual void ListResultsInfo(int** results_enums,int** results_size, double** results_times,int** results_steps,int* num_results)=0;52 virtual void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results)=0; 53 53 virtual void DeleteResults(void)=0; 54 54 virtual void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type)=0; 55 virtual void InputToResult(int enum_type,int step, double time)=0;55 virtual void InputToResult(int enum_type,int step,IssmDouble time)=0; 56 56 virtual void InputDuplicate(int original_enum,int new_enum)=0; 57 virtual void InputCreate( double scalar,int name,int code)=0;58 virtual void InputCreate( double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;57 virtual void InputCreate(IssmDouble scalar,int name,int code)=0; 58 virtual void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0; 59 59 virtual void ProcessResultsUnits(void)=0; 60 virtual void RequestedOutput(int output_enum,int step, double time)=0;60 virtual void RequestedOutput(int output_enum,int step,IssmDouble time)=0; 61 61 62 virtual int NodalValue( double* pvalue, int index, int natureofdataenum,bool process_units)=0;63 virtual void InputScale(int enum_type, double scale_factor)=0;62 virtual int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units)=0; 63 virtual void InputScale(int enum_type,IssmDouble scale_factor)=0; 64 64 virtual void GetVectorFromInputs(Vector* vector, int name_enum)=0; 65 65 virtual void GetVectorFromResults(Vector* vector,int id,int enum_in,int interp)=0; 66 virtual void InputArtificialNoise(int enum_type, double min,double max)=0;67 virtual bool InputConvergence( double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums)=0;68 virtual void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas, double* vertex_response,double* qmu_part)=0;66 virtual void InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max)=0; 67 virtual bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums)=0; 68 virtual void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0; 69 69 virtual int* GetHorizontalNeighboorSids(void)=0; 70 virtual double TimeAdapt()=0;71 virtual void MigrateGroundingLine( double* old_floating_ice,double* sheet_ungrounding)=0;70 virtual IssmDouble TimeAdapt()=0; 71 virtual void MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding)=0; 72 72 virtual void PotentialSheetUngrounding(Vector* potential_sheet_ungrounding)=0; 73 virtual void PositiveDegreeDay(double* pdds,double* pds,double signorm)=0; 74 virtual int UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0; 73 virtual void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0; 74 virtual void SmbGradients()=0; 75 virtual int UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0; 75 76 virtual void ResetCoordinateSystem()=0; 76 virtual void SmearFunction(Vector* smearedvector, double (*WeightFunction)(double distance,double radius),double radius)=0;77 virtual void SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius)=0; 77 78 78 79 #ifdef _HAVE_RESPONSES_ 79 virtual void MinVel( double* pminvel, bool process_units)=0;80 virtual void MaxVel( double* pmaxvel, bool process_units)=0;81 virtual void MinVx( double* pminvx, bool process_units)=0;82 virtual void MaxVx( double* pmaxvx, bool process_units)=0;83 virtual void MaxAbsVx( double* pmaxabsvx, bool process_units)=0;84 virtual void MinVy( double* pminvy, bool process_units)=0;85 virtual void MaxVy( double* pmaxvy, bool process_units)=0;86 virtual void MaxAbsVy( double* pmaxabsvy, bool process_units)=0;87 virtual void MinVz( double* pminvz, bool process_units)=0;88 virtual void MaxVz( double* pmaxvz, bool process_units)=0;89 virtual void MaxAbsVz( double* pmaxabsvz, bool process_units)=0;90 virtual double MassFlux(double* segment,bool process_units)=0;91 virtual void ElementResponse( double* presponse,int response_enum,bool process_units)=0;92 virtual double IceVolume(void)=0;80 virtual void MinVel(IssmDouble* pminvel, bool process_units)=0; 81 virtual void MaxVel(IssmDouble* pmaxvel, bool process_units)=0; 82 virtual void MinVx(IssmDouble* pminvx, bool process_units)=0; 83 virtual void MaxVx(IssmDouble* pmaxvx, bool process_units)=0; 84 virtual void MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units)=0; 85 virtual void MinVy(IssmDouble* pminvy, bool process_units)=0; 86 virtual void MaxVy(IssmDouble* pmaxvy, bool process_units)=0; 87 virtual void MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units)=0; 88 virtual void MinVz(IssmDouble* pminvz, bool process_units)=0; 89 virtual void MaxVz(IssmDouble* pmaxvz, bool process_units)=0; 90 virtual void MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units)=0; 91 virtual IssmDouble MassFlux(IssmDouble* segment,bool process_units)=0; 92 virtual void ElementResponse(IssmDouble* presponse,int response_enum,bool process_units)=0; 93 virtual IssmDouble IceVolume(void)=0; 93 94 #endif 94 95 95 96 #ifdef _HAVE_CONTROL_ 96 97 virtual void Gradj(Vector* gradient,int control_type,int control_index)=0; 97 virtual double ThicknessAbsMisfit(bool process_units ,int weight_index)=0;98 virtual double SurfaceAbsVelMisfit(bool process_units ,int weight_index)=0;99 virtual double SurfaceRelVelMisfit(bool process_units ,int weight_index)=0;100 virtual double SurfaceLogVelMisfit(bool process_units ,int weight_index)=0;101 virtual double SurfaceLogVxVyMisfit(bool process_units,int weight_index)=0;102 virtual double SurfaceAverageVelMisfit(bool process_units,int weight_index)=0;103 virtual double ThicknessAbsGradient(bool process_units,int weight_index)=0;104 virtual double RheologyBbarAbsGradient(bool process_units,int weight_index)=0;105 virtual double DragCoefficientAbsGradient(bool process_units,int weight_index)=0;98 virtual IssmDouble ThicknessAbsMisfit(bool process_units ,int weight_index)=0; 99 virtual IssmDouble SurfaceAbsVelMisfit(bool process_units ,int weight_index)=0; 100 virtual IssmDouble SurfaceRelVelMisfit(bool process_units ,int weight_index)=0; 101 virtual IssmDouble SurfaceLogVelMisfit(bool process_units ,int weight_index)=0; 102 virtual IssmDouble SurfaceLogVxVyMisfit(bool process_units,int weight_index)=0; 103 virtual IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index)=0; 104 virtual IssmDouble ThicknessAbsGradient(bool process_units,int weight_index)=0; 105 virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0; 106 virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0; 106 107 virtual void ControlInputGetGradient(Vector* gradient,int enum_type,int control_index)=0; 107 virtual void ControlInputSetGradient( double* gradient,int enum_type,int control_index)=0;108 virtual void ControlInputScaleGradient(int enum_type, double scale)=0;108 virtual void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index)=0; 109 virtual void ControlInputScaleGradient(int enum_type, IssmDouble scale)=0; 109 110 virtual void GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data)=0; 110 virtual void SetControlInputsFromVector( double* vector,int control_enum,int control_index)=0;111 virtual void InputControlUpdate( double scalar,bool save_parameter)=0;111 virtual void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index)=0; 112 virtual void InputControlUpdate(IssmDouble scalar,bool save_parameter)=0; 112 113 #endif 113 114 }; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r12643 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 24 24 25 25 /*Constructors/destructor/copy*/ 26 /*FUNCTION Penta::Penta(){{{ 1*/26 /*FUNCTION Penta::Penta(){{{*/ 27 27 Penta::Penta(){ 28 28 … … 39 39 } 40 40 /*}}}*/ 41 /*FUNCTION Penta::~Penta(){{{ 1*/41 /*FUNCTION Penta::~Penta(){{{*/ 42 42 Penta::~Penta(){ 43 43 delete inputs; … … 46 46 } 47 47 /*}}}*/ 48 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{ 1*/48 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{*/ 49 49 Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels) 50 50 :PentaRef(nummodels) … … 56 56 57 57 /*Checks in debugging mode*/ 58 /*{{{ 2*/58 /*{{{*/ 59 59 _assert_(iomodel->Data(MeshUpperelementsEnum)); 60 60 _assert_(iomodel->Data(MeshLowerelementsEnum)); … … 66 66 67 67 /*Build neighbors list*/ 68 if ( isnan(iomodel->Data(MeshUpperelementsEnum)[index])) penta_elements_ids[1]=this->id; //upper penta is the same penta68 if (xIsNan<IssmDouble>(iomodel->Data(MeshUpperelementsEnum)[index])) penta_elements_ids[1]=this->id; //upper penta is the same penta 69 69 else penta_elements_ids[1]=(int)(iomodel->Data(MeshUpperelementsEnum)[index]); 70 if ( isnan(iomodel->Data(MeshLowerelementsEnum)[index])) penta_elements_ids[0]=this->id; //lower penta is the same penta70 if (xIsNan<IssmDouble>(iomodel->Data(MeshLowerelementsEnum)[index])) penta_elements_ids[0]=this->id; //lower penta is the same penta 71 71 else penta_elements_ids[0]=(int)(iomodel->Data(MeshLowerelementsEnum)[index]); 72 72 this->InitHookNeighbors(penta_elements_ids); … … 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION Penta::copy {{{ 1*/92 /*FUNCTION Penta::copy {{{*/ 93 93 Object* Penta::copy() { 94 94 … … 100 100 101 101 //deal with PentaRef mother class 102 penta->element_type_list= (int*)xmalloc(this->numanalyses*sizeof(int));102 penta->element_type_list=xNew<int>(this->numanalyses); 103 103 for(i=0;i<this->numanalyses;i++) penta->element_type_list[i]=this->element_type_list[i]; 104 104 … … 130 130 131 131 /*recover objects: */ 132 penta->nodes= (Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.132 penta->nodes=xNew<Node*>(6); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 133 133 for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i]; 134 134 penta->matice=(Matice*)penta->hmatice->delivers(); … … 144 144 145 145 /*Other*/ 146 /*FUNCTION Penta::AverageOntoPartition {{{ 1*/147 void Penta::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas, double* vertex_response,double* qmu_part){148 _error _("Not supported yet!");149 } 150 /*}}}*/ 151 /*FUNCTION Penta::BedNormal {{{ 1*/152 void Penta::BedNormal( double* bed_normal, double xyz_list[3][3]){146 /*FUNCTION Penta::AverageOntoPartition {{{*/ 147 void Penta::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){ 148 _error2_("Not supported yet!"); 149 } 150 /*}}}*/ 151 /*FUNCTION Penta::BedNormal {{{*/ 152 void Penta::BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){ 153 153 154 154 int i; 155 double v13[3],v23[3];156 double normal[3];157 double normal_norm;155 IssmDouble v13[3],v23[3]; 156 IssmDouble normal[3]; 157 IssmDouble normal_norm; 158 158 159 159 for (i=0;i<3;i++){ … … 173 173 } 174 174 /*}}}*/ 175 /*FUNCTION Penta::BasalFrictionCreateInput {{{ 1*/175 /*FUNCTION Penta::BasalFrictionCreateInput {{{*/ 176 176 void Penta::BasalFrictionCreateInput(void){ 177 177 … … 181 181 /*Intermediaries */ 182 182 int count,ig; 183 double basalfriction[NUMVERTICES]={0,0,0,0,0,0};184 double alpha2,vx,vy;183 IssmDouble basalfriction[NUMVERTICES]={0,0,0,0,0,0}; 184 IssmDouble alpha2,vx,vy; 185 185 Friction* friction=NULL; 186 186 GaussPenta* gauss=NULL; … … 225 225 } 226 226 /*}}}*/ 227 /*FUNCTION Penta::ComputeBasalStress {{{ 1*/227 /*FUNCTION Penta::ComputeBasalStress {{{*/ 228 228 void Penta::ComputeBasalStress(Vector* sigma_b){ 229 229 … … 233 233 int analysis_type,approximation; 234 234 int doflist[NUMVERTICES]; 235 double xyz_list[NUMVERTICES][3];236 double xyz_list_tria[3][3];237 double rho_ice,gravity,stokesreconditioning;238 double pressure,viscosity,bed,Jdet2d;239 double bed_normal[3];240 double basalforce[3];241 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/242 double devstresstensor[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/243 double stresstensor[6]={0.0};244 double sigma_xx,sigma_yy,sigma_zz;245 double sigma_xy,sigma_xz,sigma_yz;246 double surface=0,value=0;235 IssmDouble xyz_list[NUMVERTICES][3]; 236 IssmDouble xyz_list_tria[3][3]; 237 IssmDouble rho_ice,gravity,stokesreconditioning; 238 IssmDouble pressure,viscosity,bed,Jdet2d; 239 IssmDouble bed_normal[3]; 240 IssmDouble basalforce[3]; 241 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 242 IssmDouble devstresstensor[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 243 IssmDouble stresstensor[6]={0.0}; 244 IssmDouble sigma_xx,sigma_yy,sigma_zz; 245 IssmDouble sigma_xy,sigma_xz,sigma_yz; 246 IssmDouble surface=0,value=0; 247 247 GaussPenta* gauss; 248 248 … … 252 252 253 253 /*Check analysis_types*/ 254 if (analysis_type!=DiagnosticHorizAnalysisEnum) _error _("Not supported yet!");255 if (approximation!=StokesApproximationEnum) _error _("Not supported yet!");254 if (analysis_type!=DiagnosticHorizAnalysisEnum) _error2_("Not supported yet!"); 255 if (approximation!=StokesApproximationEnum) _error2_("Not supported yet!"); 256 256 257 257 /*retrieve some parameters: */ … … 315 315 } 316 316 /*}}}*/ 317 /*FUNCTION Penta::ComputeStrainRate {{{ 1*/317 /*FUNCTION Penta::ComputeStrainRate {{{*/ 318 318 void Penta::ComputeStrainRate(Vector* eps){ 319 319 320 _error _("Not implemented yet");321 322 } 323 /*}}}*/ 324 /*FUNCTION Penta::ComputeStressTensor {{{ 1*/320 _error2_("Not implemented yet"); 321 322 } 323 /*}}}*/ 324 /*FUNCTION Penta::ComputeStressTensor {{{*/ 325 325 void Penta::ComputeStressTensor(){ 326 326 327 327 int iv; 328 double xyz_list[NUMVERTICES][3];329 double pressure,viscosity;330 double epsilon[6]; /* epsilon=[exx,eyy,exy];*/331 double sigma_xx[NUMVERTICES];332 double sigma_yy[NUMVERTICES];333 double sigma_zz[NUMVERTICES];334 double sigma_xy[NUMVERTICES];335 double sigma_xz[NUMVERTICES];336 double sigma_yz[NUMVERTICES];328 IssmDouble xyz_list[NUMVERTICES][3]; 329 IssmDouble pressure,viscosity; 330 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,exy];*/ 331 IssmDouble sigma_xx[NUMVERTICES]; 332 IssmDouble sigma_yy[NUMVERTICES]; 333 IssmDouble sigma_zz[NUMVERTICES]; 334 IssmDouble sigma_xy[NUMVERTICES]; 335 IssmDouble sigma_xz[NUMVERTICES]; 336 IssmDouble sigma_yz[NUMVERTICES]; 337 337 GaussPenta* gauss=NULL; 338 338 … … 377 377 } 378 378 /*}}}*/ 379 /*FUNCTION Penta::Configure {{{ 1*/379 /*FUNCTION Penta::Configure {{{*/ 380 380 void Penta::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 381 381 … … 409 409 } 410 410 /*}}}*/ 411 /*FUNCTION Penta::CreateKMatrix {{{ 1*/411 /*FUNCTION Penta::CreateKMatrix {{{*/ 412 412 void Penta::CreateKMatrix(Matrix* Kff, Matrix* Kfs,Vector* df){ 413 413 … … 418 418 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 419 419 420 /*Checks in debugging {{{ 2*/420 /*Checks in debugging {{{*/ 421 421 _assert_(this->nodes && this->matice && this->matpar && this->verticalneighbors && this->parameters && this->inputs); 422 422 /*}}}*/ … … 464 464 #endif 465 465 default: 466 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));466 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 467 467 } 468 468 … … 479 479 } 480 480 /*}}}*/ 481 /*FUNCTION Penta::CreateKMatrixPrognostic {{{ 1*/481 /*FUNCTION Penta::CreateKMatrixPrognostic {{{*/ 482 482 ElementMatrix* Penta::CreateKMatrixPrognostic(void){ 483 483 … … 500 500 } 501 501 /*}}}*/ 502 /*FUNCTION Penta::CreateKMatrixSlope {{{ 1*/502 /*FUNCTION Penta::CreateKMatrixSlope {{{*/ 503 503 ElementMatrix* Penta::CreateKMatrixSlope(void){ 504 504 … … 513 513 } 514 514 /*}}}*/ 515 /*FUNCTION Penta::CreatePVector {{{ 1*/515 /*FUNCTION Penta::CreatePVector {{{*/ 516 516 void Penta::CreatePVector(Vector* pf){ 517 517 … … 521 521 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 522 522 523 /*if debugging mode, check that all pointers exist {{{ 2*/523 /*if debugging mode, check that all pointers exist {{{*/ 524 524 _assert_(this->nodes && this->matice && this->matpar && this->verticalneighbors && this->parameters && this->inputs); 525 525 /*}}}*/ … … 569 569 #endif 570 570 default: 571 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));571 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 572 572 } 573 573 … … 579 579 } 580 580 /*}}}*/ 581 /*FUNCTION Penta::CreatePVectorPrognostic {{{ 1*/581 /*FUNCTION Penta::CreatePVectorPrognostic {{{*/ 582 582 ElementVector* Penta::CreatePVectorPrognostic(void){ 583 583 … … 601 601 } 602 602 /*}}}*/ 603 /*FUNCTION Penta::CreatePVectorSlope {{{ 1*/603 /*FUNCTION Penta::CreatePVectorSlope {{{*/ 604 604 ElementVector* Penta::CreatePVectorSlope(void){ 605 605 … … 615 615 } 616 616 /*}}}*/ 617 /*FUNCTION Penta::CreateJacobianMatrix{{{ 1*/617 /*FUNCTION Penta::CreateJacobianMatrix{{{*/ 618 618 void Penta::CreateJacobianMatrix(Matrix* Jff){ 619 619 … … 623 623 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 624 624 625 /*Checks in debugging {{{ 2*/625 /*Checks in debugging {{{*/ 626 626 _assert_(this->nodes && this->matice && this->matpar && this->verticalneighbors && this->parameters && this->inputs); 627 627 /*}}}*/ … … 638 638 #endif 639 639 default: 640 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));640 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 641 641 } 642 642 … … 648 648 } 649 649 /*}}}*/ 650 /*FUNCTION Penta::DeepEcho{{{ 1*/650 /*FUNCTION Penta::DeepEcho{{{*/ 651 651 void Penta::DeepEcho(void){ 652 652 653 653 int i; 654 654 655 printf("Penta:\n");656 printf(" id: %i\n",id);655 _printLine_("Penta:"); 656 _printLine_(" id: " << id); 657 657 nodes[0]->DeepEcho(); 658 658 nodes[1]->DeepEcho(); … … 663 663 matice->DeepEcho(); 664 664 matpar->DeepEcho(); 665 printf(" neighbor ids: %i-%i\n",verticalneighbors[0]->Id(),verticalneighbors[1]->Id());666 printf(" parameters\n");665 _printLine_(" neighbor ids: " << verticalneighbors[0]->Id() << "-" << verticalneighbors[1]->Id()); 666 _printLine_(" parameters"); 667 667 parameters->DeepEcho(); 668 printf(" inputs\n");668 _printLine_(" inputs"); 669 669 inputs->DeepEcho(); 670 printf(" results\n");670 _printLine_(" results"); 671 671 results->DeepEcho(); 672 printf("neighboor sids: \n");673 printf(" %i %i %i\n",horizontalneighborsids[0],horizontalneighborsids[1],horizontalneighborsids[2]);672 _printLine_("neighboor sids: "); 673 _printLine_(" " << horizontalneighborsids[0] << " " << horizontalneighborsids[1] << " " << horizontalneighborsids[2]); 674 674 675 675 return; 676 676 } 677 677 /*}}}*/ 678 /*FUNCTION Penta::DeleteResults {{{ 1*/678 /*FUNCTION Penta::DeleteResults {{{*/ 679 679 void Penta::DeleteResults(void){ 680 680 … … 685 685 } 686 686 /*}}}*/ 687 /*FUNCTION Penta::Echo{{{ 1*/687 /*FUNCTION Penta::Echo{{{*/ 688 688 689 689 void Penta::Echo(void){ … … 691 691 } 692 692 /*}}}*/ 693 /*FUNCTION Penta::ObjectEnum{{{ 1*/693 /*FUNCTION Penta::ObjectEnum{{{*/ 694 694 int Penta::ObjectEnum(void){ 695 695 … … 698 698 } 699 699 /*}}}*/ 700 /*FUNCTION Penta::GetBasalElement{{{ 1*/700 /*FUNCTION Penta::GetBasalElement{{{*/ 701 701 Penta* Penta::GetBasalElement(void){ 702 702 … … 719 719 } 720 720 /*}}}*/ 721 /*FUNCTION Penta::GetDofList {{{ 1*/721 /*FUNCTION Penta::GetDofList {{{*/ 722 722 void Penta::GetDofList(int** pdoflist,int approximation_enum,int setenum){ 723 723 … … 730 730 731 731 /*Allocate: */ 732 doflist= (int*)xmalloc(numberofdofs*sizeof(int));732 doflist=xNew<int>(numberofdofs); 733 733 734 734 /*Populate: */ … … 743 743 } 744 744 /*}}}*/ 745 /*FUNCTION Penta::GetDofList1 {{{ 1*/745 /*FUNCTION Penta::GetDofList1 {{{*/ 746 746 void Penta::GetDofList1(int* doflist){ 747 747 … … 751 751 } 752 752 /*}}}*/ 753 /*FUNCTION Penta::GetConnectivityList {{{ 1*/753 /*FUNCTION Penta::GetConnectivityList {{{*/ 754 754 void Penta::GetConnectivityList(int* connectivity){ 755 755 for(int i=0;i<NUMVERTICES;i++) connectivity[i]=nodes[i]->GetConnectivity(); 756 756 } 757 757 /*}}}*/ 758 /*FUNCTION Penta::GetElementType {{{ 1*/758 /*FUNCTION Penta::GetElementType {{{*/ 759 759 int Penta::GetElementType(){ 760 760 … … 763 763 } 764 764 /*}}}*/ 765 /*FUNCTION Penta::GetElementSizes{{{ 1*/766 void Penta::GetElementSizes( double* hx,double* hy,double* hz){767 768 double xyz_list[NUMVERTICES][3];769 double xmin,ymin,zmin;770 double xmax,ymax,zmax;765 /*FUNCTION Penta::GetElementSizes{{{*/ 766 void Penta::GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){ 767 768 IssmDouble xyz_list[NUMVERTICES][3]; 769 IssmDouble xmin,ymin,zmin; 770 IssmDouble xmax,ymax,zmax; 771 771 772 772 /*Get xyz list: */ … … 790 790 } 791 791 /*}}}*/ 792 /*FUNCTION Penta::GetHorizontalNeighboorSids {{{ 1*/792 /*FUNCTION Penta::GetHorizontalNeighboorSids {{{*/ 793 793 int* Penta::GetHorizontalNeighboorSids(){ 794 794 … … 798 798 } 799 799 /*}}}*/ 800 /*FUNCTION Penta::GetLowerElement{{{ 1*/800 /*FUNCTION Penta::GetLowerElement{{{*/ 801 801 Penta* Penta::GetLowerElement(void){ 802 802 … … 808 808 } 809 809 /*}}}*/ 810 /*FUNCTION Penta::GetNodeIndex {{{ 1*/810 /*FUNCTION Penta::GetNodeIndex {{{*/ 811 811 int Penta::GetNodeIndex(Node* node){ 812 812 … … 816 816 return i; 817 817 } 818 _error _("Node provided not found among element nodes");819 820 } 821 /*}}}*/ 822 /*FUNCTION Penta::GetInputListOnVertices( double* pvalue,int enumtype) {{{1*/823 void Penta::GetInputListOnVertices( double* pvalue,int enumtype){818 _error2_("Node provided not found among element nodes"); 819 820 } 821 /*}}}*/ 822 /*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/ 823 void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){ 824 824 825 825 /*Intermediaries*/ 826 double value[NUMVERTICES];826 IssmDouble value[NUMVERTICES]; 827 827 GaussPenta *gauss = NULL; 828 828 829 829 /*Recover input*/ 830 830 Input* input=inputs->GetInput(enumtype); 831 if (!input) _error _("Input %s not found in element",EnumToStringx(enumtype));831 if (!input) _error2_("Input " << EnumToStringx(enumtype) << " not found in element"); 832 832 833 833 /*Checks in debugging mode*/ … … 845 845 } 846 846 /*}}}*/ 847 /*FUNCTION Penta::GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue) {{{1*/848 void Penta::GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue){847 /*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/ 848 void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){ 849 849 850 850 /*Intermediaries*/ 851 double value[NUMVERTICES];851 IssmDouble value[NUMVERTICES]; 852 852 GaussPenta *gauss = NULL; 853 853 … … 874 874 } 875 875 /*}}}*/ 876 /*FUNCTION Penta::GetInputValue( double* pvalue,Node* node,int enumtype) {{{1*/877 void Penta::GetInputValue( double* pvalue,Node* node,int enumtype){876 /*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/ 877 void Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){ 878 878 879 879 Input* input=inputs->GetInput(enumtype); 880 if(!input) _error _("No input of type %s found in tria",EnumToStringx(enumtype));880 if(!input) _error2_("No input of type " << EnumToStringx(enumtype) << " found in tria"); 881 881 882 882 GaussPenta* gauss=new GaussPenta(); … … 887 887 } 888 888 /*}}}*/ 889 /*FUNCTION Penta::GetPhi {{{ 1*/890 void Penta::GetPhi( double* phi, double* epsilon, double viscosity){889 /*FUNCTION Penta::GetPhi {{{*/ 890 void Penta::GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity){ 891 891 /*Compute deformational heating from epsilon and viscosity */ 892 892 893 double epsilon_matrix[3][3];894 double epsilon_eff;895 double epsilon_sqr[3][3];893 IssmDouble epsilon_matrix[3][3]; 894 IssmDouble epsilon_eff; 895 IssmDouble epsilon_sqr[3][3]; 896 896 897 897 /* Build epsilon matrix */ … … 925 925 } 926 926 /*}}}*/ 927 /*FUNCTION Penta::GetSidList{{{ 1*/927 /*FUNCTION Penta::GetSidList{{{*/ 928 928 void Penta::GetSidList(int* sidlist){ 929 929 … … 933 933 } 934 934 /*}}}*/ 935 /*FUNCTION Penta::GetSolutionFromInputs{{{ 1*/935 /*FUNCTION Penta::GetSolutionFromInputs{{{*/ 936 936 void Penta::GetSolutionFromInputs(Vector* solution){ 937 937 … … 973 973 #endif 974 974 default: 975 _error _("analysis: %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));976 } 977 } 978 /*}}}*/ 979 /*FUNCTION Penta::GetStabilizationParameter {{{ 1*/980 double Penta::GetStabilizationParameter(double u, double v, double w, double diameter, double kappa){975 _error2_("analysis: " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 976 } 977 } 978 /*}}}*/ 979 /*FUNCTION Penta::GetStabilizationParameter {{{*/ 980 IssmDouble Penta::GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){ 981 981 /*Compute stabilization parameter*/ 982 982 /*kappa=thermalconductivity/(rho_ice*hearcapacity) for thermal model*/ 983 983 /*kappa=enthalpydiffusionparameter for enthalpy model*/ 984 984 985 double normu;986 double tau_parameter;985 IssmDouble normu; 986 IssmDouble tau_parameter; 987 987 988 988 normu=pow(pow(u,2)+pow(v,2)+pow(w,2),0.5); … … 995 995 } 996 996 /*}}}*/ 997 /*FUNCTION Penta::GetStrainRate3dPattyn{{{ 1*/998 void Penta::GetStrainRate3dPattyn( double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input){997 /*FUNCTION Penta::GetStrainRate3dPattyn{{{*/ 998 void Penta::GetStrainRate3dPattyn(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input){ 999 999 /*Compute the 3d Blatter/PattynStrain Rate (5 components): 1000 1000 * … … 1008 1008 1009 1009 int i; 1010 double epsilonvx[5];1011 double epsilonvy[5];1010 IssmDouble epsilonvx[5]; 1011 IssmDouble epsilonvy[5]; 1012 1012 1013 1013 /*Check that both inputs have been found*/ 1014 1014 if (!vx_input || !vy_input){ 1015 _error _("Input missing. Here are the input pointers we have for vx: %p, vy: %p\n",vx_input,vy_input);1015 _error2_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n"); 1016 1016 } 1017 1017 … … 1024 1024 } 1025 1025 /*}}}*/ 1026 /*FUNCTION Penta::GetStrainRate3d{{{ 1*/1027 void Penta::GetStrainRate3d( double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input){1026 /*FUNCTION Penta::GetStrainRate3d{{{*/ 1027 void Penta::GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input){ 1028 1028 /*Compute the 3d Strain Rate (6 components): 1029 1029 * … … 1032 1032 1033 1033 int i; 1034 double epsilonvx[6];1035 double epsilonvy[6];1036 double epsilonvz[6];1034 IssmDouble epsilonvx[6]; 1035 IssmDouble epsilonvy[6]; 1036 IssmDouble epsilonvz[6]; 1037 1037 1038 1038 /*Check that both inputs have been found*/ 1039 1039 if (!vx_input || !vy_input || !vz_input){ 1040 _error _("Input missing. Here are the input pointers we have for vx: %p, vy: %p, vz: %p\n",vx_input,vy_input,vz_input);1040 _error2_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << ", vz: " << vz_input << "\n"); 1041 1041 } 1042 1042 … … 1050 1050 } 1051 1051 /*}}}*/ 1052 /*FUNCTION Penta::GetUpperElement{{{ 1*/1052 /*FUNCTION Penta::GetUpperElement{{{*/ 1053 1053 Penta* Penta::GetUpperElement(void){ 1054 1054 … … 1060 1060 } 1061 1061 /*}}}*/ 1062 /*FUNCTION Penta::GetVectorFromInputs{{{ 1*/1062 /*FUNCTION Penta::GetVectorFromInputs{{{*/ 1063 1063 void Penta::GetVectorFromInputs(Vector* vector,int input_enum){ 1064 1064 … … 1073 1073 /*Get input (either in element or material)*/ 1074 1074 Input* input=inputs->GetInput(input_enum); 1075 if(!input) _error _("Input %s not found in element",EnumToStringx(input_enum));1075 if(!input) _error2_("Input " << EnumToStringx(input_enum) << " not found in element"); 1076 1076 1077 1077 /*We found the enum. Use its values to fill into the vector, using the vertices ids: */ … … 1079 1079 } 1080 1080 /*}}}*/ 1081 /*FUNCTION Penta::GetVectorFromResults{{{ 1*/1081 /*FUNCTION Penta::GetVectorFromResults{{{*/ 1082 1082 void Penta::GetVectorFromResults(Vector* vector,int offset,int enum_in,int interp){ 1083 1083 … … 1098 1098 } 1099 1099 else{ 1100 printf("Interpolation %s not supported\n",EnumToStringx(interp));1101 } 1102 } 1103 /*}}}*/ 1104 /*FUNCTION Penta::GetZcoord {{{ 1*/1105 double Penta::GetZcoord(GaussPenta* gauss){1100 _printLine_("Interpolation " << EnumToStringx(interp) << " not supported"); 1101 } 1102 } 1103 /*}}}*/ 1104 /*FUNCTION Penta::GetZcoord {{{*/ 1105 IssmDouble Penta::GetZcoord(GaussPenta* gauss){ 1106 1106 1107 1107 int i; 1108 double z;1109 double xyz_list[NUMVERTICES][3];1110 double z_list[NUMVERTICES];1108 IssmDouble z; 1109 IssmDouble xyz_list[NUMVERTICES][3]; 1110 IssmDouble z_list[NUMVERTICES]; 1111 1111 1112 1112 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); … … 1117 1117 } 1118 1118 /*}}}*/ 1119 /*FUNCTION Penta::Sid {{{ 1*/1119 /*FUNCTION Penta::Sid {{{*/ 1120 1120 int Penta::Sid(){ 1121 1121 … … 1124 1124 } 1125 1125 /*}}}*/ 1126 /*FUNCTION Penta::Id {{{ 1*/1126 /*FUNCTION Penta::Id {{{*/ 1127 1127 int Penta::Id(void){ 1128 1128 return id; 1129 1129 } 1130 1130 /*}}}*/ 1131 /*FUNCTION Penta::InputArtificialNoise{{{ 1*/1132 void Penta::InputArtificialNoise(int enum_type, double min,double max){1131 /*FUNCTION Penta::InputArtificialNoise{{{*/ 1132 void Penta::InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max){ 1133 1133 1134 1134 Input* input=NULL; … … 1136 1136 /*Make a copy of the original input: */ 1137 1137 input=(Input*)this->inputs->GetInput(enum_type); 1138 if(!input)_error _(" could not find old input with enum: %s",EnumToStringx(enum_type));1138 if(!input)_error2_("could not find old input with enum: " << EnumToStringx(enum_type)); 1139 1139 1140 1140 /*ArtificialNoise: */ … … 1142 1142 } 1143 1143 /*}}}*/ 1144 /*FUNCTION Penta::InputConvergence{{{ 1*/1145 bool Penta::InputConvergence( double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums){1144 /*FUNCTION Penta::InputConvergence{{{*/ 1145 bool Penta::InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums){ 1146 1146 1147 1147 int i; … … 1150 1150 Input** old_inputs=NULL; 1151 1151 1152 new_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the new inputs1153 old_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the old inputs1152 new_inputs=xNew<Input*>(num_enums/2); //half the enums are for the new inputs 1153 old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs 1154 1154 1155 1155 for(i=0;i<num_enums/2;i++){ 1156 1156 new_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+0]); 1157 1157 old_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+1]); 1158 if(!new_inputs[i])_error _("%s%s"," could not find input with enum ",EnumToStringx(enums[2*i+0]));1159 if(!old_inputs[i])_error _("%s%s"," could not find input with enum ",EnumToStringx(enums[2*i+0]));1158 if(!new_inputs[i])_error2_("could not find input with enum " << EnumToStringx(enums[2*i+0])); 1159 if(!old_inputs[i])_error2_("could not find input with enum " << EnumToStringx(enums[2*i+0])); 1160 1160 } 1161 1161 … … 1167 1167 1168 1168 /*clean up*/ 1169 x free((void**)&new_inputs);1170 x free((void**)&old_inputs);1169 xDelete<Input*>(new_inputs); 1170 xDelete<Input*>(old_inputs); 1171 1171 1172 1172 /*Return output*/ … … 1174 1174 } 1175 1175 /*}}}*/ 1176 /*FUNCTION Penta::InputCreate( double scalar,int enum,int code);{{{1*/1177 void Penta::InputCreate( double scalar,int name,int code){1176 /*FUNCTION Penta::InputCreate(IssmDouble scalar,int enum,int code);{{{*/ 1177 void Penta::InputCreate(IssmDouble scalar,int name,int code){ 1178 1178 1179 1179 /*Check that name is an element input*/ … … 1186 1186 this->inputs->AddInput(new IntInput(name,(int)scalar)); 1187 1187 } 1188 else if ((code==7) || (code==3)){ // double1189 this->inputs->AddInput(new DoubleInput(name,( double)scalar));1190 } 1191 else _error _("%s%i"," could not recognize nature of vector from code ",code);1192 1193 } 1194 /*}}}*/ 1195 /*FUNCTION Penta::InputCreate( double* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{1*/1196 void Penta::InputCreate( double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements1188 else if ((code==7) || (code==3)){ //IssmDouble 1189 this->inputs->AddInput(new DoubleInput(name,(IssmDouble)scalar)); 1190 } 1191 else _error2_("could not recognize nature of vector from code " << code); 1192 1193 } 1194 /*}}}*/ 1195 /*FUNCTION Penta::InputCreate(IssmDouble* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/ 1196 void Penta::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements 1197 1197 1198 1198 /*Intermediaries*/ … … 1200 1200 int penta_vertex_ids[6]; 1201 1201 int row; 1202 double nodeinputs[6];1203 double time;1202 IssmDouble nodeinputs[6]; 1203 IssmDouble time; 1204 1204 TransientInput* transientinput=NULL; 1205 1205 1206 1206 int numberofvertices; 1207 1207 int numberofelements; 1208 double yts;1208 IssmDouble yts; 1209 1209 1210 1210 /*Fetch parameters: */ … … 1225 1225 1226 1226 /*create input values: */ 1227 for(i=0;i<6;i++)nodeinputs[i]=( double)vector[penta_vertex_ids[i]-1];1227 for(i=0;i<6;i++)nodeinputs[i]=(IssmDouble)vector[penta_vertex_ids[i]-1]; 1228 1228 1229 1229 /*process units: */ … … 1240 1240 for(i=0;i<6;i++){ 1241 1241 row=penta_vertex_ids[i]-1; 1242 nodeinputs[i]=( double)vector[N*row+t];1242 nodeinputs[i]=(IssmDouble)vector[N*row+t]; 1243 1243 } 1244 1244 … … 1247 1247 1248 1248 /*time? :*/ 1249 time=( double)vector[(M-1)*N+t]*yts;1249 time=(IssmDouble)vector[(M-1)*N+t]*yts; 1250 1250 1251 1251 if(t==0)transientinput=new TransientInput(vector_enum); … … 1254 1254 this->inputs->AddInput(transientinput); 1255 1255 } 1256 else _error _("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long. Enum %s",numberofvertices,M,EnumToStringx(vector_enum));1256 else _error2_("nodal vector is either numberofnodes (" << numberofvertices << "), or numberofnodes+1 long. Field provided is " << M << " long. Enum " << EnumToStringx(vector_enum)); 1257 1257 } 1258 1258 else if(vector_type==2){ //element vector … … 1268 1268 this->inputs->AddInput(new IntInput(vector_enum,(int)vector[index])); 1269 1269 } 1270 else if (code==7){ // double1271 this->inputs->AddInput(new DoubleInput(vector_enum,( double)vector[index]));1270 else if (code==7){ //IssmDouble 1271 this->inputs->AddInput(new DoubleInput(vector_enum,(IssmDouble)vector[index])); 1272 1272 } 1273 else _error _("%s%i"," could not recognize nature of vector from code ",code);1273 else _error2_("could not recognize nature of vector from code " << code); 1274 1274 } 1275 1275 else { 1276 _error _("transient elementary inputs not supported yet!");1276 _error2_("transient elementary inputs not supported yet!"); 1277 1277 } 1278 1278 } 1279 1279 else{ 1280 _error _("Cannot add input for vector type %i (not supported)",vector_type);1281 } 1282 1283 } 1284 /*}}}*/ 1285 /*FUNCTION Penta::InputDepthAverageAtBase{{{ 1*/1280 _error2_("Cannot add input for vector type " << vector_type << " (not supported)"); 1281 } 1282 1283 } 1284 /*}}}*/ 1285 /*FUNCTION Penta::InputDepthAverageAtBase{{{*/ 1286 1286 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){ 1287 1287 1288 1288 int step,i; 1289 double xyz_list[NUMVERTICES][3];1290 double Helem_list[NUMVERTICES];1291 double zeros_list[NUMVERTICES]={0.0};1289 IssmDouble xyz_list[NUMVERTICES][3]; 1290 IssmDouble Helem_list[NUMVERTICES]; 1291 IssmDouble zeros_list[NUMVERTICES]={0.0}; 1292 1292 Penta* penta=NULL; 1293 1293 Input* original_input=NULL; … … 1317 1317 original_input=(Input*)penta->matice->inputs->GetInput(enum_type); 1318 1318 else 1319 _error _("object %s not supported yet",EnumToStringx(object_enum));1320 if(!original_input) _error _("could not find input with enum %s",EnumToStringx(enum_type));1319 _error2_("object " << EnumToStringx(object_enum) << " not supported yet"); 1320 if(!original_input) _error2_("could not find input with enum " << EnumToStringx(enum_type)); 1321 1321 1322 1322 /*If first time, initialize total_integrated_input*/ … … 1329 1329 total_integrated_input=new DoubleInput(average_enum_type,0.0); 1330 1330 else 1331 _error _("object %s not supported yet",EnumToStringx(original_input->ObjectEnum()));1331 _error2_("object " << EnumToStringx(original_input->ObjectEnum()) << " not supported yet"); 1332 1332 } 1333 1333 … … 1377 1377 this->matice->inputs->AddInput((Input*)depth_averaged_input); 1378 1378 else 1379 _error _("object %s not supported yet",EnumToStringx(object_enum));1380 } 1381 /*}}}*/ 1382 /*FUNCTION Penta::InputDuplicate{{{ 1*/1379 _error2_("object " << EnumToStringx(object_enum) << " not supported yet"); 1380 } 1381 /*}}}*/ 1382 /*FUNCTION Penta::InputDuplicate{{{*/ 1383 1383 void Penta::InputDuplicate(int original_enum,int new_enum){ 1384 1384 … … 1388 1388 } 1389 1389 /*}}}*/ 1390 /*FUNCTION Penta::InputExtrude {{{ 1*/1390 /*FUNCTION Penta::InputExtrude {{{*/ 1391 1391 void Penta::InputExtrude(int enum_type,int object_type){ 1392 1392 … … 1402 1402 if (object_type==ElementEnum){ 1403 1403 num_inputs=1; 1404 base_inputs= (Input**)xmalloc(num_inputs*sizeof(Input*));1404 base_inputs=xNew<Input*>(num_inputs); 1405 1405 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1406 1406 } 1407 1407 else if (object_type==MaterialsEnum){ 1408 1408 num_inputs=1; 1409 base_inputs= (Input**)xmalloc(num_inputs*sizeof(Input*));1409 base_inputs=xNew<Input*>(num_inputs); 1410 1410 base_inputs[0]=(Input*)matice->inputs->GetInput(enum_type); 1411 1411 } 1412 1412 else if (object_type==NodeEnum){ 1413 1413 num_inputs=3; //only the three upper nodes 1414 base_inputs= (Input**)xmalloc(num_inputs*sizeof(Input*));1414 base_inputs=xNew<Input*>(num_inputs); 1415 1415 for(i=0;i<num_inputs;i++){ 1416 1416 base_inputs[i]=(Input*)this->nodes[i]->inputs->GetInput(enum_type); … … 1418 1418 } 1419 1419 else{ 1420 _error _("object of type %s not supported yet",EnumToStringx(object_type));1420 _error2_("object of type " << EnumToStringx(object_type) << " not supported yet"); 1421 1421 } 1422 1422 for(i=0;i<num_inputs;i++){ 1423 if(!base_inputs[i]) _error _("could not find input with enum %s in object %s",EnumToStringx(enum_type),EnumToStringx(object_type));1423 if(!base_inputs[i]) _error2_("could not find input with enum " << EnumToStringx(enum_type) << " in object " << EnumToStringx(object_type)); 1424 1424 base_inputs[i]->Extrude(); 1425 1425 } … … 1448 1448 } 1449 1449 else{ 1450 _error _("object of type %s not supported yet",EnumToStringx(object_type));1450 _error2_("object of type " << EnumToStringx(object_type) << " not supported yet"); 1451 1451 } 1452 1452 } … … 1457 1457 1458 1458 /*clean-up and return*/ 1459 x free((void**)&base_inputs);1460 } 1461 /*}}}*/ 1462 /*FUNCTION Penta::InputScale{{{ 1*/1463 void Penta::InputScale(int enum_type, double scale_factor){1459 xDelete<Input*>(base_inputs); 1460 } 1461 /*}}}*/ 1462 /*FUNCTION Penta::InputScale{{{*/ 1463 void Penta::InputScale(int enum_type,IssmDouble scale_factor){ 1464 1464 1465 1465 Input* input=NULL; … … 1467 1467 /*Make a copy of the original input: */ 1468 1468 input=(Input*)this->inputs->GetInput(enum_type); 1469 if(!input)_error _(" could not find old input with enum: %s",EnumToStringx(enum_type));1469 if(!input)_error2_("could not find old input with enum: " << EnumToStringx(enum_type)); 1470 1470 1471 1471 /*Scale: */ … … 1473 1473 } 1474 1474 /*}}}*/ 1475 /*FUNCTION Penta::InputToResult{{{ 1*/1476 void Penta::InputToResult(int enum_type,int step, double time){1475 /*FUNCTION Penta::InputToResult{{{*/ 1476 void Penta::InputToResult(int enum_type,int step,IssmDouble time){ 1477 1477 1478 1478 int i; … … 1483 1483 if (enum_type==MaterialsRheologyBbarEnum) input=this->matice->inputs->GetInput(MaterialsRheologyBEnum); 1484 1484 else input=this->inputs->GetInput(enum_type); 1485 //if (!input) _error _("Input %s not found in penta->inputs",EnumToStringx(enum_type)); why error out? if the requested input does not exist, we should still1485 //if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found in penta->inputs"); why error out? if the requested input does not exist, we should still 1486 1486 //try and output whatever we can instead of just failing. 1487 1487 if(!input)return; … … 1498 1498 } 1499 1499 /*}}}*/ 1500 /*FUNCTION Penta::InputUpdateFromConstant(bool value, int name);{{{ 1*/1500 /*FUNCTION Penta::InputUpdateFromConstant(bool value, int name);{{{*/ 1501 1501 void Penta::InputUpdateFromConstant(bool constant, int name){ 1502 1502 … … 1508 1508 } 1509 1509 /*}}}*/ 1510 /*FUNCTION Penta::InputUpdateFromConstant( double value, int name);{{{1*/1511 void Penta::InputUpdateFromConstant( double constant, int name){1510 /*FUNCTION Penta::InputUpdateFromConstant(IssmDouble value, int name);{{{*/ 1511 void Penta::InputUpdateFromConstant(IssmDouble constant, int name){ 1512 1512 /*Check that name is an element input*/ 1513 1513 if (!IsInput(name)) return; … … 1517 1517 } 1518 1518 /*}}}*/ 1519 /*FUNCTION Penta::InputUpdateFromConstant(int value, int name);{{{ 1*/1519 /*FUNCTION Penta::InputUpdateFromConstant(int value, int name);{{{*/ 1520 1520 void Penta::InputUpdateFromConstant(int constant, int name){ 1521 1521 /*Check that name is an element input*/ … … 1526 1526 } 1527 1527 /*}}}*/ 1528 /*FUNCTION Penta::InputUpdateFromIoModel {{{ 1*/1528 /*FUNCTION Penta::InputUpdateFromIoModel {{{*/ 1529 1529 void Penta::InputUpdateFromIoModel(int index,IoModel* iomodel){ 1530 1530 … … 1532 1532 IssmInt i,j; 1533 1533 int penta_vertex_ids[6]; 1534 double nodeinputs[6];1535 double cmmininputs[6];1536 double cmmaxinputs[6];1537 1538 double yts;1534 IssmDouble nodeinputs[6]; 1535 IssmDouble cmmininputs[6]; 1536 IssmDouble cmmaxinputs[6]; 1537 1538 IssmDouble yts; 1539 1539 bool control_analysis; 1540 1540 int num_control_type; … … 1548 1548 1549 1549 /*Checks if debuging*/ 1550 /*{{{ 2*/1550 /*{{{*/ 1551 1551 _assert_(iomodel->Data(MeshElementsEnum)); 1552 1552 /*}}}*/ … … 1597 1597 /*Matice will take care of it*/ break; 1598 1598 default: 1599 _error _("Control %s not implemented yet",EnumToStringx((int)iomodel->Data(InversionControlParametersEnum)[i]));1599 _error2_("Control " << EnumToStringx((int)iomodel->Data(InversionControlParametersEnum)[i]) << " not implemented yet"); 1600 1600 } 1601 1601 } … … 1630 1630 } 1631 1631 else{ 1632 _error _("Approximation type %s not supported yet",EnumToStringx((int)*(iomodel->Data(FlowequationElementEquationEnum)+index)));1632 _error2_("Approximation type " << EnumToStringx((int)*(iomodel->Data(FlowequationElementEquationEnum)+index)) << " not supported yet"); 1633 1633 } 1634 1634 } … … 1649 1649 } 1650 1650 /*}}}*/ 1651 /*FUNCTION Penta::InputUpdateFromSolution {{{ 1*/1652 void Penta::InputUpdateFromSolution( double* solution){1651 /*FUNCTION Penta::InputUpdateFromSolution {{{*/ 1652 void Penta::InputUpdateFromSolution(IssmDouble* solution){ 1653 1653 1654 1654 int analysis_type; … … 1714 1714 #endif 1715 1715 default: 1716 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));1717 } 1718 } 1719 /*}}}*/ 1720 /*FUNCTION Penta::InputUpdateFromSolutionPrognostic{{{ 1*/1721 void Penta::InputUpdateFromSolutionPrognostic( double* solution){1716 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 1717 } 1718 } 1719 /*}}}*/ 1720 /*FUNCTION Penta::InputUpdateFromSolutionPrognostic{{{*/ 1721 void Penta::InputUpdateFromSolutionPrognostic(IssmDouble* solution){ 1722 1722 1723 1723 const int numdof = NDOF1*NUMVERTICES; … … 1726 1726 int i,hydroadjustment; 1727 1727 int* doflist = NULL; 1728 double rho_ice,rho_water,minthickness;1729 double newthickness[numdof];1730 double newbed[numdof];1731 double newsurface[numdof];1732 double oldbed[NUMVERTICES];1733 double oldsurface[NUMVERTICES];1734 double oldthickness[NUMVERTICES];1728 IssmDouble rho_ice,rho_water,minthickness; 1729 IssmDouble newthickness[numdof]; 1730 IssmDouble newbed[numdof]; 1731 IssmDouble newsurface[numdof]; 1732 IssmDouble oldbed[NUMVERTICES]; 1733 IssmDouble oldsurface[NUMVERTICES]; 1734 IssmDouble oldthickness[NUMVERTICES]; 1735 1735 Penta *penta = NULL; 1736 1736 … … 1745 1745 for(i=0;i<numdof2d;i++){ 1746 1746 newthickness[i]=solution[doflist[i]]; 1747 if( isnan(newthickness[i])) _error_("NaN found in solution vector");1747 if(xIsNan<IssmDouble>(newthickness[i])) _error2_("NaN found in solution vector"); 1748 1748 /*Constrain thickness to be at least 1m*/ 1749 1749 if(newthickness[i]<minthickness) newthickness[i]=minthickness; … … 1778 1778 newbed[i]=oldbed[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i]); //bed = oldbed + di * dH 1779 1779 } 1780 else _error _("Hydrostatic adjustment %i (%s) not supported yet",hydroadjustment,EnumToStringx(hydroadjustment));1780 else _error2_("Hydrostatic adjustment " << hydroadjustment << " (" << EnumToStringx(hydroadjustment) << ") not supported yet"); 1781 1781 } 1782 1782 } … … 1798 1798 1799 1799 /*Free ressources:*/ 1800 x free((void**)&doflist);1801 } 1802 /*}}}*/ 1803 /*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{ 1*/1804 void Penta::InputUpdateFromSolutionOneDof( double* solution,int enum_type){1800 xDelete<int>(doflist); 1801 } 1802 /*}}}*/ 1803 /*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{*/ 1804 void Penta::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){ 1805 1805 1806 1806 const int numdof = NDOF1*NUMVERTICES; 1807 1807 1808 double values[numdof];1808 IssmDouble values[numdof]; 1809 1809 int* doflist=NULL; 1810 1810 … … 1815 1815 for(int i=0;i<numdof;i++){ 1816 1816 values[i]=solution[doflist[i]]; 1817 if( isnan(values[i])) _error_("NaN found in solution vector");1817 if(xIsNan<IssmDouble>(values[i])) _error2_("NaN found in solution vector"); 1818 1818 } 1819 1819 … … 1822 1822 1823 1823 /*Free ressources:*/ 1824 x free((void**)&doflist);1825 } 1826 /*}}}*/ 1827 /*FUNCTION Penta::InputUpdateFromSolutionOneDofCollpased{{{ 1*/1828 void Penta::InputUpdateFromSolutionOneDofCollapsed( double* solution,int enum_type){1824 xDelete<int>(doflist); 1825 } 1826 /*}}}*/ 1827 /*FUNCTION Penta::InputUpdateFromSolutionOneDofCollpased{{{*/ 1828 void Penta::InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){ 1829 1829 1830 1830 const int numdof = NDOF1*NUMVERTICES; 1831 1831 const int numdof2d = NDOF1*NUMVERTICES2D; 1832 1832 1833 double values[numdof];1833 IssmDouble values[numdof]; 1834 1834 int* doflist = NULL; 1835 1835 Penta *penta = NULL; … … 1845 1845 values[i] =solution[doflist[i]]; 1846 1846 values[i+numdof2d]=values[i]; 1847 if( isnan(values[i])) _error_("NaN found in solution vector");1847 if(xIsNan<IssmDouble>(values[i])) _error2_("NaN found in solution vector"); 1848 1848 } 1849 1849 … … 1862 1862 1863 1863 /*Free ressources:*/ 1864 x free((void**)&doflist);1865 } 1866 /*}}}*/ 1867 /*FUNCTION Penta::InputUpdateFromVector( double* vector, int name, int type);{{{1*/1868 void Penta::InputUpdateFromVector( double* vector, int name, int type){1864 xDelete<int>(doflist); 1865 } 1866 /*}}}*/ 1867 /*FUNCTION Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/ 1868 void Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 1869 1869 1870 1870 /*Check that name is an element input*/ … … 1878 1878 1879 1879 /*New PentaVertexInpu*/ 1880 double values[6];1880 IssmDouble values[6]; 1881 1881 1882 1882 /*Get values on the 6 vertices*/ … … 1891 1891 default: 1892 1892 1893 _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));1894 } 1895 } 1896 /*}}}*/ 1897 /*FUNCTION Penta::InputUpdateFromVector(int* vector, int name, int type);{{{ 1*/1893 _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 1894 } 1895 } 1896 /*}}}*/ 1897 /*FUNCTION Penta::InputUpdateFromVector(int* vector, int name, int type);{{{*/ 1898 1898 void Penta::InputUpdateFromVector(int* vector, int name, int type){ 1899 _error _("not supported yet!");1900 } 1901 /*}}}*/ 1902 /*FUNCTION Penta::InputUpdateFromVector(bool* vector, int name, int type);{{{ 1*/1899 _error2_("not supported yet!"); 1900 } 1901 /*}}}*/ 1902 /*FUNCTION Penta::InputUpdateFromVector(bool* vector, int name, int type);{{{*/ 1903 1903 void Penta::InputUpdateFromVector(bool* vector, int name, int type){ 1904 _error _("not supported yet!");1905 } 1906 /*}}}*/ 1907 /*FUNCTION Penta::IsOnBed{{{ 1*/1904 _error2_("not supported yet!"); 1905 } 1906 /*}}}*/ 1907 /*FUNCTION Penta::IsOnBed{{{*/ 1908 1908 bool Penta::IsOnBed(void){ 1909 1909 … … 1913 1913 } 1914 1914 /*}}}*/ 1915 /*FUNCTION Penta::IsInput{{{ 1*/1915 /*FUNCTION Penta::IsInput{{{*/ 1916 1916 bool Penta::IsInput(int name){ 1917 1917 if ( … … 1957 1957 } 1958 1958 /*}}}*/ 1959 /*FUNCTION Penta::IsFloating{{{ 1*/1959 /*FUNCTION Penta::IsFloating{{{*/ 1960 1960 bool Penta::IsFloating(){ 1961 1961 … … 1965 1965 } 1966 1966 /*}}}*/ 1967 /*FUNCTION Penta::IsNodeOnShelf {{{ 1*/1967 /*FUNCTION Penta::IsNodeOnShelf {{{*/ 1968 1968 bool Penta::IsNodeOnShelf(){ 1969 1969 … … 1980 1980 } 1981 1981 /*}}}*/ 1982 /*FUNCTION Penta::IsNodeOnShelfFromFlags {{{ 1*/1983 bool Penta::IsNodeOnShelfFromFlags( double* flags){1982 /*FUNCTION Penta::IsNodeOnShelfFromFlags {{{*/ 1983 bool Penta::IsNodeOnShelfFromFlags(IssmDouble* flags){ 1984 1984 1985 1985 int i; … … 1995 1995 } 1996 1996 /*}}}*/ 1997 /*FUNCTION Penta::IsOnSurface{{{ 1*/1997 /*FUNCTION Penta::IsOnSurface{{{*/ 1998 1998 bool Penta::IsOnSurface(void){ 1999 1999 … … 2003 2003 } 2004 2004 /*}}}*/ 2005 /*FUNCTION Penta::IsOnWater {{{ 1*/2005 /*FUNCTION Penta::IsOnWater {{{*/ 2006 2006 bool Penta::IsOnWater(){ 2007 2007 … … 2012 2012 /*}}}*/ 2013 2013 /*FUNCTION Penta::ListResultsInfo{{{*/ 2014 void Penta::ListResultsInfo(int** in_resultsenums,int** in_resultssizes, double** in_resultstimes,int** in_resultssteps,int* in_num_results){2014 void Penta::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,IssmDouble** in_resultstimes,int** in_resultssteps,int* in_num_results){ 2015 2015 2016 2016 /*Intermediaries*/ … … 2019 2019 int *resultsenums = NULL; 2020 2020 int *resultssizes = NULL; 2021 double *resultstimes = NULL;2021 IssmDouble *resultstimes = NULL; 2022 2022 int *resultssteps = NULL; 2023 2023 … … 2034 2034 2035 2035 /*Allocate output*/ 2036 resultsenums= (int*)xmalloc(numberofresults*sizeof(int));2037 resultssizes= (int*)xmalloc(numberofresults*sizeof(int));2038 resultstimes= (double*)xmalloc(numberofresults*sizeof(double));2039 resultssteps= (int*)xmalloc(numberofresults*sizeof(int));2036 resultsenums=xNew<int>(numberofresults); 2037 resultssizes=xNew<int>(numberofresults); 2038 resultstimes=xNew<IssmDouble>(numberofresults); 2039 resultssteps=xNew<int>(numberofresults); 2040 2040 2041 2041 /*populate enums*/ … … 2062 2062 2063 2063 }/*}}}*/ 2064 /*FUNCTION Penta::MigrateGroundingLine{{{ 1*/2065 void Penta::MigrateGroundingLine( double* old_floating_ice,double* sheet_ungrounding){2064 /*FUNCTION Penta::MigrateGroundingLine{{{*/ 2065 void Penta::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){ 2066 2066 2067 2067 int i,migration_style,unground; 2068 2068 bool elementonshelf = false; 2069 double bed_hydro,yts,gl_melting_rate;2070 double rho_water,rho_ice,density;2071 double melting[NUMVERTICES];2072 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];2069 IssmDouble bed_hydro,yts,gl_melting_rate; 2070 IssmDouble rho_water,rho_ice,density; 2071 IssmDouble melting[NUMVERTICES]; 2072 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES]; 2073 2073 2074 2074 if(!IsOnBed()) return; … … 2145 2145 } 2146 2146 /*}}}*/ 2147 /*FUNCTION Penta::MinEdgeLength{{{ 1*/2148 double Penta::MinEdgeLength(double xyz_list[6][3]){2147 /*FUNCTION Penta::MinEdgeLength{{{*/ 2148 IssmDouble Penta::MinEdgeLength(IssmDouble xyz_list[6][3]){ 2149 2149 /*Return the minimum lenght of the nine egdes of the penta*/ 2150 2150 2151 2151 int i,node0,node1; 2152 2152 int edges[9][2]={{0,1},{0,2},{1,2},{3,4},{3,5},{4,5},{0,3},{1,4},{2,5}}; //list of the nine edges 2153 double length;2154 double minlength=-1;2153 IssmDouble length; 2154 IssmDouble minlength=-1; 2155 2155 2156 2156 for(i=0;i<9;i++){ … … 2167 2167 } 2168 2168 /*}}}*/ 2169 /*FUNCTION Penta::MyRank {{{ 1*/2169 /*FUNCTION Penta::MyRank {{{*/ 2170 2170 int Penta::MyRank(void){ 2171 2171 extern int my_rank; … … 2173 2173 } 2174 2174 /*}}}*/ 2175 /*FUNCTION Penta::NodalValue {{{ 1*/2176 int Penta::NodalValue( double* pvalue, int index, int natureofdataenum,bool process_units){2175 /*FUNCTION Penta::NodalValue {{{*/ 2176 int Penta::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units){ 2177 2177 2178 2178 int i; 2179 2179 int found=0; 2180 double value;2180 IssmDouble value; 2181 2181 Input* data=NULL; 2182 2182 GaussPenta* gauss=NULL; … … 2204 2204 } 2205 2205 /*}}}*/ 2206 /*FUNCTION Penta::PatchFill{{{ 1*/2206 /*FUNCTION Penta::PatchFill{{{*/ 2207 2207 void Penta::PatchFill(int* pcount, Patch* patch){ 2208 2208 … … 2231 2231 *pcount=count; 2232 2232 }/*}}}*/ 2233 /*FUNCTION Penta::PatchSize{{{ 1*/2233 /*FUNCTION Penta::PatchSize{{{*/ 2234 2234 void Penta::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){ 2235 2235 … … 2255 2255 } 2256 2256 /*}}}*/ 2257 /*FUNCTION Penta::PositiveDegreeDay{{{ 1*/2258 void Penta::PositiveDegreeDay( double* pdds,double* pds,double signorm){2259 2260 double agd[NUMVERTICES]; // surface mass balance2261 double monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];2262 double h[NUMVERTICES],s[NUMVERTICES]; // ,b2263 double rho_water,rho_ice;2257 /*FUNCTION Penta::PositiveDegreeDay{{{*/ 2258 void Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){ 2259 2260 IssmDouble agd[NUMVERTICES]; // surface mass balance 2261 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12]; 2262 IssmDouble h[NUMVERTICES],s[NUMVERTICES]; // ,b 2263 IssmDouble rho_water,rho_ice; 2264 2264 2265 2265 /*Recover monthly temperatures and precipitation*/ … … 2267 2267 Input* input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2); 2268 2268 GaussPenta* gauss=new GaussPenta(); 2269 double time,yts;2269 IssmDouble time,yts; 2270 2270 this->parameters->FindParam(&time,TimeEnum); 2271 2271 this->parameters->FindParam(&yts,ConstantsYtsEnum); … … 2299 2299 } 2300 2300 /*}}}*/ 2301 /*FUNCTION Penta::PotentialSheetUngrounding{{{ 1*/2301 /*FUNCTION Penta::PotentialSheetUngrounding{{{*/ 2302 2302 void Penta::PotentialSheetUngrounding(Vector* potential_sheet_ungrounding){ 2303 2303 2304 2304 int i; 2305 double h[NUMVERTICES],ba[NUMVERTICES];2306 double bed_hydro;2307 double rho_water,rho_ice,density;2305 IssmDouble h[NUMVERTICES],ba[NUMVERTICES]; 2306 IssmDouble bed_hydro; 2307 IssmDouble rho_water,rho_ice,density; 2308 2308 bool elementonshelf = false; 2309 2309 … … 2328 2328 } 2329 2329 /*}}}*/ 2330 /*FUNCTION Penta::ProcessResultsUnits{{{ 1*/2330 /*FUNCTION Penta::ProcessResultsUnits{{{*/ 2331 2331 void Penta::ProcessResultsUnits(void){ 2332 2332 … … 2339 2339 } 2340 2340 /*}}}*/ 2341 /*FUNCTION Penta::ReduceMatrixStokes {{{ 1*/2342 void Penta::ReduceMatrixStokes( double* Ke_reduced, double* Ke_temp){2341 /*FUNCTION Penta::ReduceMatrixStokes {{{*/ 2342 void Penta::ReduceMatrixStokes(IssmDouble* Ke_reduced, IssmDouble* Ke_temp){ 2343 2343 2344 2344 int i,j; 2345 double Kii[24][24];2346 double Kib[24][3];2347 double Kbb[3][3];2348 double Kbi[3][24];2349 double Kbbinv[3][3];2350 double Kright[24][24];2345 IssmDouble Kii[24][24]; 2346 IssmDouble Kib[24][3]; 2347 IssmDouble Kbb[3][3]; 2348 IssmDouble Kbi[3][24]; 2349 IssmDouble Kbbinv[3][3]; 2350 IssmDouble Kright[24][24]; 2351 2351 2352 2352 /*Create the four matrices used for reduction */ … … 2381 2381 } 2382 2382 /*}}}*/ 2383 /*FUNCTION Penta::ReduceVectorStokes {{{ 1*/2384 void Penta::ReduceVectorStokes( double* Pe_reduced, double* Ke_temp, double* Pe_temp){2383 /*FUNCTION Penta::ReduceVectorStokes {{{*/ 2384 void Penta::ReduceVectorStokes(IssmDouble* Pe_reduced, IssmDouble* Ke_temp, IssmDouble* Pe_temp){ 2385 2385 2386 2386 int i,j; 2387 double Pi[24];2388 double Pb[3];2389 double Kbb[3][3];2390 double Kib[24][3];2391 double Kbbinv[3][3];2392 double Pright[24];2387 IssmDouble Pi[24]; 2388 IssmDouble Pb[3]; 2389 IssmDouble Kbb[3][3]; 2390 IssmDouble Kib[24][3]; 2391 IssmDouble Kbbinv[3][3]; 2392 IssmDouble Pright[24]; 2393 2393 2394 2394 /*Create the four matrices used for reduction */ … … 2416 2416 } 2417 2417 /*}}}*/ 2418 /*FUNCTION Penta::RequestedOutput{{{ 1*/2419 void Penta::RequestedOutput(int output_enum,int step, double time){2418 /*FUNCTION Penta::RequestedOutput{{{*/ 2419 void Penta::RequestedOutput(int output_enum,int step,IssmDouble time){ 2420 2420 2421 2421 if(IsInput(output_enum)){ … … 2467 2467 } 2468 2468 /*}}}*/ 2469 /*FUNCTION Penta::ResetCoordinateSystem{{{ 1*/2469 /*FUNCTION Penta::ResetCoordinateSystem{{{*/ 2470 2470 void Penta::ResetCoordinateSystem(void){ 2471 2471 2472 2472 int approximation; 2473 double slopex[NUMVERTICES];2474 double slopey[NUMVERTICES];2475 double xz_plane[6];2473 IssmDouble slopex[NUMVERTICES]; 2474 IssmDouble slopey[NUMVERTICES]; 2475 IssmDouble xz_plane[6]; 2476 2476 2477 2477 /*For Stokes only: we want the CS to be tangential to the bedrock*/ … … 2495 2495 } 2496 2496 /*}}}*/ 2497 /*FUNCTION Penta::SetClone {{{ 1*/2497 /*FUNCTION Penta::SetClone {{{*/ 2498 2498 void Penta::SetClone(int* minranks){ 2499 2499 2500 _error _("not implemented yet");2501 } 2502 /*}}} 1*/2503 /*FUNCTION Penta::SetCurrentConfiguration {{{ 1*/2500 _error2_("not implemented yet"); 2501 } 2502 /*}}}*/ 2503 /*FUNCTION Penta::SetCurrentConfiguration {{{*/ 2504 2504 void Penta::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 2505 2505 … … 2517 2517 } 2518 2518 /*}}}*/ 2519 /*FUNCTION Penta::SpawnTria {{{ 1*/2519 /*FUNCTION Penta::SpawnTria {{{*/ 2520 2520 Tria* Penta::SpawnTria(int g0, int g1, int g2){ 2521 2521 … … 2560 2560 } 2561 2561 /*}}}*/ 2562 /*FUNCTION Penta::SurfaceArea {{{1*/ 2563 double Penta::SurfaceArea(void){ 2562 /*FUNCTION Penta::SmbGradients{{{*/ 2563 void Penta::SmbGradients(void){ 2564 2565 int i; 2566 2567 // input 2568 IssmDouble h[NUMVERTICES]; // ice thickness (m) 2569 IssmDouble s[NUMVERTICES]; // surface elevation (m) 2570 IssmDouble a_pos[NUMVERTICES]; // Hs-SMB relation parameter 2571 IssmDouble b_pos[NUMVERTICES]; // Hs-SMB relation parameter 2572 IssmDouble a_neg[NUMVERTICES]; // Hs-SMB relation parameter 2573 IssmDouble b_neg[NUMVERTICES]; // Hs-SMB relation paremeter 2574 IssmDouble Hc[NUMVERTICES]; // elevation of transition between accumulation regime and ablation regime 2575 IssmDouble smb_pos_max[NUMVERTICES]; // maximum SMB value in the accumulation regime 2576 IssmDouble smb_pos_min[NUMVERTICES]; // minimum SMB value in the accumulation regime 2577 IssmDouble rho_water; // density of fresh water 2578 IssmDouble rho_ice; // density of ice 2579 2580 // output 2581 IssmDouble smb[NUMVERTICES]; // surface mass balance (m/yr ice) 2582 2583 /*Recover SmbGradients*/ 2584 GetInputListOnVertices(&Hc[0],SurfaceforcingsHcEnum); 2585 GetInputListOnVertices(&smb_pos_max[0],SurfaceforcingsSmbPosMaxEnum); 2586 GetInputListOnVertices(&smb_pos_min[0],SurfaceforcingsSmbPosMinEnum); 2587 GetInputListOnVertices(&a_pos[0],SurfaceforcingsAPosEnum); 2588 GetInputListOnVertices(&b_pos[0],SurfaceforcingsBPosEnum); 2589 GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum); 2590 GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum); 2591 2592 /*Recover surface elevatio at vertices: */ 2593 GetInputListOnVertices(&h[0],ThicknessEnum); 2594 GetInputListOnVertices(&s[0],SurfaceEnum); 2595 2596 /*Get material parameters :*/ 2597 rho_ice=matpar->GetRhoIce(); 2598 rho_water=matpar->GetRhoFreshwater(); 2599 2600 // loop over all vertices 2601 for(i=0;i<NUMVERTICES;i++){ 2602 if(s[i]>Hc[i]){ 2603 smb[i]=a_pos[i]+b_pos[i]*s[i]; 2604 if(smb[i]>smb_pos_max[i]){smb[i]=smb_pos_max[i];} 2605 if(smb[i]<smb_pos_min[i]){smb[i]=smb_pos_min[i];} 2606 } 2607 else{ 2608 smb[i]=a_neg[i]+b_neg[i]*s[i]; 2609 } 2610 smb[i]=smb[i]/rho_ice; // SMB in m/y ice 2611 2612 } //end of the loop over the vertices 2613 /*Update inputs*/ 2614 this->inputs->AddInput(new PentaP1Input(SurfaceforcingsMassBalanceEnum,&smb[0])); 2615 } 2616 /*}}}*/ 2617 /*FUNCTION Penta::SurfaceArea {{{*/ 2618 IssmDouble Penta::SurfaceArea(void){ 2564 2619 2565 2620 int approximation; 2566 double S;2621 IssmDouble S; 2567 2622 Tria* tria=NULL; 2568 2623 … … 2597 2652 } 2598 2653 /*}}}*/ 2599 /*FUNCTION Penta::SurfaceNormal {{{ 1*/2600 void Penta::SurfaceNormal( double* surface_normal, double xyz_list[3][3]){2654 /*FUNCTION Penta::SurfaceNormal {{{*/ 2655 void Penta::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){ 2601 2656 2602 2657 int i; 2603 double v13[3],v23[3];2604 double normal[3];2605 double normal_norm;2658 IssmDouble v13[3],v23[3]; 2659 IssmDouble normal[3]; 2660 IssmDouble normal_norm; 2606 2661 2607 2662 for (i=0;i<3;i++){ … … 2621 2676 } 2622 2677 /*}}}*/ 2623 /*FUNCTION Penta::TimeAdapt{{{ 1*/2624 double Penta::TimeAdapt(void){2678 /*FUNCTION Penta::TimeAdapt{{{*/ 2679 IssmDouble Penta::TimeAdapt(void){ 2625 2680 2626 2681 int i; 2627 double C,dx,dy,dz,dt;2628 double maxabsvx,maxabsvy,maxabsvz;2629 double maxx,minx,maxy,miny,maxz,minz;2630 double xyz_list[NUMVERTICES][3];2682 IssmDouble C,dx,dy,dz,dt; 2683 IssmDouble maxabsvx,maxabsvy,maxabsvz; 2684 IssmDouble maxx,minx,maxy,miny,maxz,minz; 2685 IssmDouble xyz_list[NUMVERTICES][3]; 2631 2686 2632 2687 /*get CFL coefficient:*/ … … 2664 2719 2665 2720 return dt; 2666 } 2667 /*FUNCTION Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type) {{{ 1*/2721 }/*}}}*/ 2722 /*FUNCTION Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type) {{{*/ 2668 2723 void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type){ 2669 2724 … … 2673 2728 int penta_node_ids[6]; 2674 2729 int penta_vertex_ids[6]; 2675 double nodeinputs[6];2676 double yts;2730 IssmDouble nodeinputs[6]; 2731 IssmDouble yts; 2677 2732 int stabilization; 2678 2733 bool dakota_analysis; 2679 2734 bool isstokes; 2680 double beta,heatcapacity,referencetemperature,meltingpoint,latentheat;2735 IssmDouble beta,heatcapacity,referencetemperature,meltingpoint,latentheat; 2681 2736 2682 2737 /*Fetch parameters: */ … … 2692 2747 2693 2748 /*Checks if debuging*/ 2694 /*{{{ 2*/2749 /*{{{*/ 2695 2750 _assert_(iomodel->Data(MeshElementsEnum)); 2696 2751 /*}}}*/ … … 2810 2865 this->inputs->AddInput(new PentaP1Input(EnthalpyEnum,nodeinputs)); 2811 2866 } 2812 else _error _("temperature and waterfraction required for the enthalpy solution");2867 else _error2_("temperature and waterfraction required for the enthalpy solution"); 2813 2868 break; 2814 2869 … … 2819 2874 } 2820 2875 /*}}}*/ 2821 /*FUNCTION Penta::UpdatePotentialSheetUngrounding{{{ 1*/2822 int Penta::UpdatePotentialSheetUngrounding( double* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf){2876 /*FUNCTION Penta::UpdatePotentialSheetUngrounding{{{*/ 2877 int Penta::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){ 2823 2878 2824 2879 int i; … … 2839 2894 } 2840 2895 /*}}}*/ 2841 /*FUNCTION Penta::ViscousHeatingCreateInput {{{ 1*/2896 /*FUNCTION Penta::ViscousHeatingCreateInput {{{*/ 2842 2897 void Penta::ViscousHeatingCreateInput(void){ 2843 2898 … … 2847 2902 /*Intermediaries*/ 2848 2903 int iv; 2849 double phi;2850 double viscosity;2851 double xyz_list[NUMVERTICES][3];2852 double epsilon[6];2853 double viscousheating[NUMVERTICES]={0,0,0,0,0,0};2854 double thickness;2904 IssmDouble phi; 2905 IssmDouble viscosity; 2906 IssmDouble xyz_list[NUMVERTICES][3]; 2907 IssmDouble epsilon[6]; 2908 IssmDouble viscousheating[NUMVERTICES]={0,0,0,0,0,0}; 2909 IssmDouble thickness; 2855 2910 GaussPenta *gauss=NULL; 2856 2911 … … 2887 2942 } 2888 2943 /*}}}*/ 2889 /*FUNCTION Penta::SmearFunction {{{ 1*/2890 void Penta::SmearFunction(Vector* smearedvector, double (*WeightFunction)(double distance,double radius),double radius){2891 _error _("not implemented yet");2892 } 2893 /*}}} 1*/2944 /*FUNCTION Penta::SmearFunction {{{*/ 2945 void Penta::SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){ 2946 _error2_("not implemented yet"); 2947 } 2948 /*}}}*/ 2894 2949 2895 2950 #ifdef _HAVE_RESPONSES_ 2896 /*FUNCTION Penta::IceVolume {{{ 1*/2897 double Penta::IceVolume(void){2951 /*FUNCTION Penta::IceVolume {{{*/ 2952 IssmDouble Penta::IceVolume(void){ 2898 2953 2899 2954 /*The volume of a troncated prism is base * 1/3 sum(length of edges)*/ 2900 double base,height;2901 double xyz_list[NUMVERTICES][3];2955 IssmDouble base,height; 2956 IssmDouble xyz_list[NUMVERTICES][3]; 2902 2957 2903 2958 if(IsOnWater())return 0; … … 2917 2972 } 2918 2973 /*}}}*/ 2919 /*FUNCTION Penta::MinVel{{{ 1*/2920 void Penta::MinVel( double* pminvel, bool process_units){2974 /*FUNCTION Penta::MinVel{{{*/ 2975 void Penta::MinVel(IssmDouble* pminvel, bool process_units){ 2921 2976 2922 2977 /*Get minimum:*/ 2923 double minvel=this->inputs->Min(VelEnum);2978 IssmDouble minvel=this->inputs->Min(VelEnum); 2924 2979 2925 2980 /*process units if requested: */ … … 2930 2985 } 2931 2986 /*}}}*/ 2932 /*FUNCTION Penta::MinVx{{{ 1*/2933 void Penta::MinVx( double* pminvx, bool process_units){2987 /*FUNCTION Penta::MinVx{{{*/ 2988 void Penta::MinVx(IssmDouble* pminvx, bool process_units){ 2934 2989 2935 2990 /*Get minimum:*/ 2936 double minvx=this->inputs->Min(VxEnum);2991 IssmDouble minvx=this->inputs->Min(VxEnum); 2937 2992 2938 2993 /*process units if requested: */ … … 2943 2998 } 2944 2999 /*}}}*/ 2945 /*FUNCTION Penta::MinVy{{{ 1*/2946 void Penta::MinVy( double* pminvy, bool process_units){3000 /*FUNCTION Penta::MinVy{{{*/ 3001 void Penta::MinVy(IssmDouble* pminvy, bool process_units){ 2947 3002 2948 3003 /*Get minimum:*/ 2949 double minvy=this->inputs->Min(VyEnum);3004 IssmDouble minvy=this->inputs->Min(VyEnum); 2950 3005 2951 3006 /*process units if requested: */ … … 2956 3011 } 2957 3012 /*}}}*/ 2958 /*FUNCTION Penta::MinVz{{{ 1*/2959 void Penta::MinVz( double* pminvz, bool process_units){3013 /*FUNCTION Penta::MinVz{{{*/ 3014 void Penta::MinVz(IssmDouble* pminvz, bool process_units){ 2960 3015 2961 3016 /*Get minimum:*/ 2962 double minvz=this->inputs->Min(VzEnum);3017 IssmDouble minvz=this->inputs->Min(VzEnum); 2963 3018 2964 3019 /*process units if requested: */ … … 2969 3024 } 2970 3025 /*}}}*/ 2971 /*FUNCTION Penta::MassFlux {{{ 1*/2972 double Penta::MassFlux( double* segment,bool process_units){2973 2974 double mass_flux=0;3026 /*FUNCTION Penta::MassFlux {{{*/ 3027 IssmDouble Penta::MassFlux( IssmDouble* segment,bool process_units){ 3028 3029 IssmDouble mass_flux=0; 2975 3030 2976 3031 if(!IsOnBed()) return mass_flux; … … 2993 3048 } 2994 3049 /*}}}*/ 2995 /*FUNCTION Penta::MaxAbsVx{{{ 1*/2996 void Penta::MaxAbsVx( double* pmaxabsvx, bool process_units){3050 /*FUNCTION Penta::MaxAbsVx{{{*/ 3051 void Penta::MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units){ 2997 3052 2998 3053 /*Get maximum:*/ 2999 double maxabsvx=this->inputs->MaxAbs(VxEnum);3054 IssmDouble maxabsvx=this->inputs->MaxAbs(VxEnum); 3000 3055 3001 3056 /*process units if requested: */ … … 3006 3061 } 3007 3062 /*}}}*/ 3008 /*FUNCTION Penta::MaxAbsVy{{{ 1*/3009 void Penta::MaxAbsVy( double* pmaxabsvy, bool process_units){3063 /*FUNCTION Penta::MaxAbsVy{{{*/ 3064 void Penta::MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units){ 3010 3065 3011 3066 /*Get maximum:*/ 3012 double maxabsvy=this->inputs->MaxAbs(VyEnum);3067 IssmDouble maxabsvy=this->inputs->MaxAbs(VyEnum); 3013 3068 3014 3069 /*process units if requested: */ … … 3019 3074 } 3020 3075 /*}}}*/ 3021 /*FUNCTION Penta::MaxAbsVz{{{ 1*/3022 void Penta::MaxAbsVz( double* pmaxabsvz, bool process_units){3076 /*FUNCTION Penta::MaxAbsVz{{{*/ 3077 void Penta::MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units){ 3023 3078 3024 3079 /*Get maximum:*/ 3025 double maxabsvz=this->inputs->MaxAbs(VzEnum);3080 IssmDouble maxabsvz=this->inputs->MaxAbs(VzEnum); 3026 3081 3027 3082 /*process units if requested: */ … … 3032 3087 } 3033 3088 /*}}}*/ 3034 /*FUNCTION Penta::MaxVel{{{ 1*/3035 void Penta::MaxVel( double* pmaxvel, bool process_units){3089 /*FUNCTION Penta::MaxVel{{{*/ 3090 void Penta::MaxVel(IssmDouble* pmaxvel, bool process_units){ 3036 3091 3037 3092 /*Get maximum:*/ 3038 double maxvel=this->inputs->Max(VelEnum);3093 IssmDouble maxvel=this->inputs->Max(VelEnum); 3039 3094 3040 3095 /*process units if requested: */ … … 3046 3101 } 3047 3102 /*}}}*/ 3048 /*FUNCTION Penta::MaxVx{{{ 1*/3049 void Penta::MaxVx( double* pmaxvx, bool process_units){3103 /*FUNCTION Penta::MaxVx{{{*/ 3104 void Penta::MaxVx(IssmDouble* pmaxvx, bool process_units){ 3050 3105 3051 3106 /*Get maximum:*/ 3052 double maxvx=this->inputs->Max(VxEnum);3107 IssmDouble maxvx=this->inputs->Max(VxEnum); 3053 3108 3054 3109 /*process units if requested: */ … … 3059 3114 } 3060 3115 /*}}}*/ 3061 /*FUNCTION Penta::MaxVy{{{ 1*/3062 void Penta::MaxVy( double* pmaxvy, bool process_units){3116 /*FUNCTION Penta::MaxVy{{{*/ 3117 void Penta::MaxVy(IssmDouble* pmaxvy, bool process_units){ 3063 3118 3064 3119 /*Get maximum:*/ 3065 double maxvy=this->inputs->Max(VyEnum);3120 IssmDouble maxvy=this->inputs->Max(VyEnum); 3066 3121 3067 3122 /*process units if requested: */ … … 3072 3127 } 3073 3128 /*}}}*/ 3074 /*FUNCTION Penta::MaxVz{{{ 1*/3075 void Penta::MaxVz( double* pmaxvz, bool process_units){3129 /*FUNCTION Penta::MaxVz{{{*/ 3130 void Penta::MaxVz(IssmDouble* pmaxvz, bool process_units){ 3076 3131 3077 3132 /*Get maximum:*/ 3078 double maxvz=this->inputs->Max(VzEnum);3133 IssmDouble maxvz=this->inputs->Max(VzEnum); 3079 3134 3080 3135 /*process units if requested: */ … … 3085 3140 } 3086 3141 /*}}}*/ 3087 /*FUNCTION Penta::ElementResponse{{{ 1*/3088 void Penta::ElementResponse( double* presponse,int response_enum,bool process_units){3142 /*FUNCTION Penta::ElementResponse{{{*/ 3143 void Penta::ElementResponse(IssmDouble* presponse,int response_enum,bool process_units){ 3089 3144 3090 3145 switch(response_enum){ … … 3095 3150 3096 3151 /*Get input:*/ 3097 double vel;3152 IssmDouble vel; 3098 3153 Input* vel_input; 3099 3154 … … 3107 3162 *presponse=vel; 3108 3163 default: 3109 _error _("Response type %s not supported yet!",EnumToStringx(response_enum));3164 _error2_("Response type " << EnumToStringx(response_enum) << " not supported yet!"); 3110 3165 } 3111 3166 … … 3115 3170 3116 3171 #ifdef _HAVE_THERMAL_ 3117 /*FUNCTION Penta::CreateKMatrixEnthalpy {{{ 1*/3172 /*FUNCTION Penta::CreateKMatrixEnthalpy {{{*/ 3118 3173 ElementMatrix* Penta::CreateKMatrixEnthalpy(void){ 3119 3174 … … 3129 3184 } 3130 3185 /*}}}*/ 3131 /*FUNCTION Penta::CreateKMatrixEnthalpyVolume {{{ 1*/3186 /*FUNCTION Penta::CreateKMatrixEnthalpyVolume {{{*/ 3132 3187 ElementMatrix* Penta::CreateKMatrixEnthalpyVolume(void){ 3133 3188 … … 3138 3193 int stabilization; 3139 3194 int i,j,ig,found=0; 3140 double Jdet,u,v,w,um,vm,wm;3141 double h,hx,hy,hz,vx,vy,vz,vel;3142 double gravity,rho_ice,rho_water;3143 double epsvel=2.220446049250313e-16;3144 double heatcapacity,thermalconductivity,dt;3145 double pressure,enthalpy;3146 double latentheat,kappa;3147 double tau_parameter,diameter;3148 double xyz_list[NUMVERTICES][3];3149 double B_conduct[3][numdof];3150 double B_advec[3][numdof];3151 double Bprime_advec[3][numdof];3152 double L[numdof];3153 double dbasis[3][6];3154 double D_scalar_conduct,D_scalar_advec;3155 double D_scalar_trans,D_scalar_stab;3156 double D[3][3];3157 double K[3][3]={0.0};3195 IssmDouble Jdet,u,v,w,um,vm,wm; 3196 IssmDouble h,hx,hy,hz,vx,vy,vz,vel; 3197 IssmDouble gravity,rho_ice,rho_water; 3198 IssmDouble epsvel=2.220446049250313e-16; 3199 IssmDouble heatcapacity,thermalconductivity,dt; 3200 IssmDouble pressure,enthalpy; 3201 IssmDouble latentheat,kappa; 3202 IssmDouble tau_parameter,diameter; 3203 IssmDouble xyz_list[NUMVERTICES][3]; 3204 IssmDouble B_conduct[3][numdof]; 3205 IssmDouble B_advec[3][numdof]; 3206 IssmDouble Bprime_advec[3][numdof]; 3207 IssmDouble L[numdof]; 3208 IssmDouble dbasis[3][6]; 3209 IssmDouble D_scalar_conduct,D_scalar_advec; 3210 IssmDouble D_scalar_trans,D_scalar_stab; 3211 IssmDouble D[3][3]; 3212 IssmDouble K[3][3]={0.0}; 3158 3213 Tria* tria=NULL; 3159 3214 GaussPenta *gauss=NULL; … … 3286 3341 } 3287 3342 /*}}}*/ 3288 /*FUNCTION Penta::CreateKMatrixEnthalpyShelf {{{ 1*/3343 /*FUNCTION Penta::CreateKMatrixEnthalpyShelf {{{*/ 3289 3344 ElementMatrix* Penta::CreateKMatrixEnthalpyShelf(void){ 3290 3345 … … 3294 3349 /*Intermediaries */ 3295 3350 int i,j,ig; 3296 double mixed_layer_capacity,thermal_exchange_velocity;3297 double rho_ice,rho_water,heatcapacity;3298 double Jdet2d,dt;3299 double xyz_list[NUMVERTICES][3];3300 double xyz_list_tria[NUMVERTICES2D][3];3301 double basis[NUMVERTICES];3302 double D_scalar;3351 IssmDouble mixed_layer_capacity,thermal_exchange_velocity; 3352 IssmDouble rho_ice,rho_water,heatcapacity; 3353 IssmDouble Jdet2d,dt; 3354 IssmDouble xyz_list[NUMVERTICES][3]; 3355 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 3356 IssmDouble basis[NUMVERTICES]; 3357 IssmDouble D_scalar; 3303 3358 GaussPenta *gauss=NULL; 3304 3359 … … 3340 3395 } 3341 3396 /*}}}*/ 3342 /*FUNCTION Penta::CreateKMatrixMelting {{{ 1*/3397 /*FUNCTION Penta::CreateKMatrixMelting {{{*/ 3343 3398 ElementMatrix* Penta::CreateKMatrixMelting(void){ 3344 3399 … … 3352 3407 } 3353 3408 /*}}}*/ 3354 /*FUNCTION Penta::CreateKMatrixThermal {{{ 1*/3409 /*FUNCTION Penta::CreateKMatrixThermal {{{*/ 3355 3410 ElementMatrix* Penta::CreateKMatrixThermal(void){ 3356 3411 … … 3366 3421 } 3367 3422 /*}}}*/ 3368 /*FUNCTION Penta::CreateKMatrixThermalVolume {{{ 1*/3423 /*FUNCTION Penta::CreateKMatrixThermalVolume {{{*/ 3369 3424 ElementMatrix* Penta::CreateKMatrixThermalVolume(void){ 3370 3425 … … 3375 3430 int stabilization; 3376 3431 int i,j,ig,found=0; 3377 double Jdet,u,v,w,um,vm,wm,vel;3378 double h,hx,hy,hz,vx,vy,vz;3379 double gravity,rho_ice,rho_water,kappa;3380 double heatcapacity,thermalconductivity,dt;3381 double tau_parameter,diameter;3382 double xyz_list[NUMVERTICES][3];3383 double B_conduct[3][numdof];3384 double B_advec[3][numdof];3385 double Bprime_advec[3][numdof];3386 double L[numdof];3387 double dbasis[3][6];3388 double D_scalar_conduct,D_scalar_advec;3389 double D_scalar_trans,D_scalar_stab;3390 double D[3][3];3391 double K[3][3]={0.0};3432 IssmDouble Jdet,u,v,w,um,vm,wm,vel; 3433 IssmDouble h,hx,hy,hz,vx,vy,vz; 3434 IssmDouble gravity,rho_ice,rho_water,kappa; 3435 IssmDouble heatcapacity,thermalconductivity,dt; 3436 IssmDouble tau_parameter,diameter; 3437 IssmDouble xyz_list[NUMVERTICES][3]; 3438 IssmDouble B_conduct[3][numdof]; 3439 IssmDouble B_advec[3][numdof]; 3440 IssmDouble Bprime_advec[3][numdof]; 3441 IssmDouble L[numdof]; 3442 IssmDouble dbasis[3][6]; 3443 IssmDouble D_scalar_conduct,D_scalar_advec; 3444 IssmDouble D_scalar_trans,D_scalar_stab; 3445 IssmDouble D[3][3]; 3446 IssmDouble K[3][3]={0.0}; 3392 3447 Tria* tria=NULL; 3393 3448 GaussPenta *gauss=NULL; … … 3518 3573 } 3519 3574 /*}}}*/ 3520 /*FUNCTION Penta::CreateKMatrixThermalShelf {{{ 1*/3575 /*FUNCTION Penta::CreateKMatrixThermalShelf {{{*/ 3521 3576 ElementMatrix* Penta::CreateKMatrixThermalShelf(void){ 3522 3577 … … 3527 3582 /*Intermediaries */ 3528 3583 int i,j,ig; 3529 double mixed_layer_capacity,thermal_exchange_velocity;3530 double rho_ice,rho_water,heatcapacity;3531 double Jdet2d,dt;3532 double xyz_list[NUMVERTICES][3];3533 double xyz_list_tria[NUMVERTICES2D][3];3534 double basis[NUMVERTICES];3535 double D_scalar;3584 IssmDouble mixed_layer_capacity,thermal_exchange_velocity; 3585 IssmDouble rho_ice,rho_water,heatcapacity; 3586 IssmDouble Jdet2d,dt; 3587 IssmDouble xyz_list[NUMVERTICES][3]; 3588 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 3589 IssmDouble basis[NUMVERTICES]; 3590 IssmDouble D_scalar; 3536 3591 GaussPenta *gauss=NULL; 3537 3592 … … 3573 3628 } 3574 3629 /*}}}*/ 3575 /*FUNCTION Penta::CreatePVectorEnthalpy {{{ 1*/3630 /*FUNCTION Penta::CreatePVectorEnthalpy {{{*/ 3576 3631 ElementVector* Penta::CreatePVectorEnthalpy(void){ 3577 3632 … … 3589 3644 } 3590 3645 /*}}}*/ 3591 /*FUNCTION Penta::CreatePVectorEnthalpyVolume {{{ 1*/3646 /*FUNCTION Penta::CreatePVectorEnthalpyVolume {{{*/ 3592 3647 ElementVector* Penta::CreatePVectorEnthalpyVolume(void){ 3593 3648 … … 3598 3653 int i,j,ig,found=0; 3599 3654 int friction_type,stabilization; 3600 double Jdet,phi,dt;3601 double rho_ice,heatcapacity;3602 double thermalconductivity,kappa;3603 double viscosity,pressure;3604 double enthalpy,enthalpypicard;3605 double tau_parameter,diameter;3606 double u,v,w;3607 double scalar_def,scalar_transient;3608 double temperature_list[NUMVERTICES];3609 double xyz_list[NUMVERTICES][3];3610 double L[numdof];3611 double dbasis[3][6];3612 double epsilon[6];3655 IssmDouble Jdet,phi,dt; 3656 IssmDouble rho_ice,heatcapacity; 3657 IssmDouble thermalconductivity,kappa; 3658 IssmDouble viscosity,pressure; 3659 IssmDouble enthalpy,enthalpypicard; 3660 IssmDouble tau_parameter,diameter; 3661 IssmDouble u,v,w; 3662 IssmDouble scalar_def,scalar_transient; 3663 IssmDouble temperature_list[NUMVERTICES]; 3664 IssmDouble xyz_list[NUMVERTICES][3]; 3665 IssmDouble L[numdof]; 3666 IssmDouble dbasis[3][6]; 3667 IssmDouble epsilon[6]; 3613 3668 GaussPenta *gauss=NULL; 3614 3669 … … 3685 3740 } 3686 3741 /*}}}*/ 3687 /*FUNCTION Penta::CreatePVectorEnthalpyShelf {{{ 1*/3742 /*FUNCTION Penta::CreatePVectorEnthalpyShelf {{{*/ 3688 3743 ElementVector* Penta::CreatePVectorEnthalpyShelf(void){ 3689 3744 … … 3693 3748 /*Intermediaries */ 3694 3749 int i,j,ig; 3695 double Jdet2d;3696 double heatcapacity,h_pmp;3697 double mixed_layer_capacity,thermal_exchange_velocity;3698 double rho_ice,rho_water,pressure,dt,scalar_ocean;3699 double xyz_list[NUMVERTICES][3];3700 double xyz_list_tria[NUMVERTICES2D][3];3701 double basis[NUMVERTICES];3750 IssmDouble Jdet2d; 3751 IssmDouble heatcapacity,h_pmp; 3752 IssmDouble mixed_layer_capacity,thermal_exchange_velocity; 3753 IssmDouble rho_ice,rho_water,pressure,dt,scalar_ocean; 3754 IssmDouble xyz_list[NUMVERTICES][3]; 3755 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 3756 IssmDouble basis[NUMVERTICES]; 3702 3757 GaussPenta* gauss=NULL; 3703 3758 … … 3742 3797 } 3743 3798 /*}}}*/ 3744 /*FUNCTION Penta::CreatePVectorEnthalpySheet {{{ 1*/3799 /*FUNCTION Penta::CreatePVectorEnthalpySheet {{{*/ 3745 3800 ElementVector* Penta::CreatePVectorEnthalpySheet(void){ 3746 3801 … … 3751 3806 int i,j,ig; 3752 3807 int analysis_type; 3753 double xyz_list[NUMVERTICES][3];3754 double xyz_list_tria[NUMVERTICES2D][3]={0.0};3755 double Jdet2d,dt;3756 double rho_ice,heatcapacity,geothermalflux_value;3757 double basalfriction,alpha2,vx,vy;3758 double scalar,enthalpy,enthalpyup;3759 double pressure,pressureup;3760 double basis[NUMVERTICES];3808 IssmDouble xyz_list[NUMVERTICES][3]; 3809 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 3810 IssmDouble Jdet2d,dt; 3811 IssmDouble rho_ice,heatcapacity,geothermalflux_value; 3812 IssmDouble basalfriction,alpha2,vx,vy; 3813 IssmDouble scalar,enthalpy,enthalpyup; 3814 IssmDouble pressure,pressureup; 3815 IssmDouble basis[NUMVERTICES]; 3761 3816 Friction* friction=NULL; 3762 3817 GaussPenta* gauss=NULL; … … 3831 3886 } 3832 3887 /*}}}*/ 3833 /*FUNCTION Penta::CreatePVectorMelting {{{ 1*/3888 /*FUNCTION Penta::CreatePVectorMelting {{{*/ 3834 3889 ElementVector* Penta::CreatePVectorMelting(void){ 3835 3890 return NULL; 3836 3891 } 3837 3892 /*}}}*/ 3838 /*FUNCTION Penta::CreatePVectorThermal {{{ 1*/3893 /*FUNCTION Penta::CreatePVectorThermal {{{*/ 3839 3894 ElementVector* Penta::CreatePVectorThermal(void){ 3840 3895 … … 3852 3907 } 3853 3908 /*}}}*/ 3854 /*FUNCTION Penta::CreatePVectorThermalVolume {{{ 1*/3909 /*FUNCTION Penta::CreatePVectorThermalVolume {{{*/ 3855 3910 ElementVector* Penta::CreatePVectorThermalVolume(void){ 3856 3911 … … 3861 3916 int i,j,ig,found=0; 3862 3917 int friction_type,stabilization; 3863 double Jdet,phi,dt;3864 double rho_ice,heatcapacity;3865 double thermalconductivity,kappa;3866 double viscosity,temperature;3867 double tau_parameter,diameter;3868 double u,v,w;3869 double scalar_def,scalar_transient;3870 double temperature_list[NUMVERTICES];3871 double xyz_list[NUMVERTICES][3];3872 double L[numdof];3873 double dbasis[3][6];3874 double epsilon[6];3918 IssmDouble Jdet,phi,dt; 3919 IssmDouble rho_ice,heatcapacity; 3920 IssmDouble thermalconductivity,kappa; 3921 IssmDouble viscosity,temperature; 3922 IssmDouble tau_parameter,diameter; 3923 IssmDouble u,v,w; 3924 IssmDouble scalar_def,scalar_transient; 3925 IssmDouble temperature_list[NUMVERTICES]; 3926 IssmDouble xyz_list[NUMVERTICES][3]; 3927 IssmDouble L[numdof]; 3928 IssmDouble dbasis[3][6]; 3929 IssmDouble epsilon[6]; 3875 3930 GaussPenta *gauss=NULL; 3876 3931 … … 3939 3994 } 3940 3995 /*}}}*/ 3941 /*FUNCTION Penta::CreatePVectorThermalShelf {{{ 1*/3996 /*FUNCTION Penta::CreatePVectorThermalShelf {{{*/ 3942 3997 ElementVector* Penta::CreatePVectorThermalShelf(void){ 3943 3998 … … 3947 4002 /*Intermediaries */ 3948 4003 int i,j,ig; 3949 double Jdet2d;3950 double mixed_layer_capacity,thermal_exchange_velocity;3951 double rho_ice,rho_water,pressure,dt,scalar_ocean;3952 double heatcapacity,t_pmp;3953 double xyz_list[NUMVERTICES][3];3954 double xyz_list_tria[NUMVERTICES2D][3];3955 double basis[NUMVERTICES];4004 IssmDouble Jdet2d; 4005 IssmDouble mixed_layer_capacity,thermal_exchange_velocity; 4006 IssmDouble rho_ice,rho_water,pressure,dt,scalar_ocean; 4007 IssmDouble heatcapacity,t_pmp; 4008 IssmDouble xyz_list[NUMVERTICES][3]; 4009 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 4010 IssmDouble basis[NUMVERTICES]; 3956 4011 GaussPenta* gauss=NULL; 3957 4012 … … 3996 4051 } 3997 4052 /*}}}*/ 3998 /*FUNCTION Penta::CreatePVectorThermalSheet {{{ 1*/4053 /*FUNCTION Penta::CreatePVectorThermalSheet {{{*/ 3999 4054 ElementVector* Penta::CreatePVectorThermalSheet(void){ 4000 4055 … … 4005 4060 int i,j,ig; 4006 4061 int analysis_type; 4007 double xyz_list[NUMVERTICES][3];4008 double xyz_list_tria[NUMVERTICES2D][3]={0.0};4009 double Jdet2d,dt;4010 double rho_ice,heatcapacity,geothermalflux_value;4011 double basalfriction,alpha2,vx,vy;4012 double basis[NUMVERTICES];4013 double scalar;4062 IssmDouble xyz_list[NUMVERTICES][3]; 4063 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 4064 IssmDouble Jdet2d,dt; 4065 IssmDouble rho_ice,heatcapacity,geothermalflux_value; 4066 IssmDouble basalfriction,alpha2,vx,vy; 4067 IssmDouble basis[NUMVERTICES]; 4068 IssmDouble scalar; 4014 4069 Friction* friction=NULL; 4015 4070 GaussPenta* gauss=NULL; … … 4063 4118 } 4064 4119 /*}}}*/ 4065 /*FUNCTION Penta::GetSolutionFromInputsThermal{{{ 1*/4120 /*FUNCTION Penta::GetSolutionFromInputsThermal{{{*/ 4066 4121 void Penta::GetSolutionFromInputsThermal(Vector* solution){ 4067 4122 … … 4070 4125 int i; 4071 4126 int* doflist=NULL; 4072 double values[numdof];4073 double temp;4127 IssmDouble values[numdof]; 4128 IssmDouble temp; 4074 4129 GaussPenta *gauss=NULL; 4075 4130 … … 4091 4146 /*Free ressources:*/ 4092 4147 delete gauss; 4093 x free((void**)&doflist);4094 } 4095 /*}}}*/ 4096 /*FUNCTION Penta::GetSolutionFromInputsEnthalpy{{{ 1*/4148 xDelete<int>(doflist); 4149 } 4150 /*}}}*/ 4151 /*FUNCTION Penta::GetSolutionFromInputsEnthalpy{{{*/ 4097 4152 void Penta::GetSolutionFromInputsEnthalpy(Vector* solution){ 4098 4153 … … 4101 4156 int i; 4102 4157 int* doflist=NULL; 4103 double values[numdof];4104 double enthalpy;4158 IssmDouble values[numdof]; 4159 IssmDouble enthalpy; 4105 4160 GaussPenta *gauss=NULL; 4106 4161 … … 4122 4177 /*Free ressources:*/ 4123 4178 delete gauss; 4124 x free((void**)&doflist);4125 } 4126 /*}}}*/ 4127 /*FUNCTION Penta::InputUpdateFromSolutionThermal {{{ 1*/4128 void Penta::InputUpdateFromSolutionThermal( double* solution){4179 xDelete<int>(doflist); 4180 } 4181 /*}}}*/ 4182 /*FUNCTION Penta::InputUpdateFromSolutionThermal {{{*/ 4183 void Penta::InputUpdateFromSolutionThermal(IssmDouble* solution){ 4129 4184 4130 4185 const int numdof=NDOF1*NUMVERTICES; … … 4132 4187 bool converged; 4133 4188 int i,rheology_law; 4134 double xyz_list[NUMVERTICES][3];4135 double values[numdof];4136 double B[numdof];4137 double B_average,s_average;4189 IssmDouble xyz_list[NUMVERTICES][3]; 4190 IssmDouble values[numdof]; 4191 IssmDouble B[numdof]; 4192 IssmDouble B_average,s_average; 4138 4193 int* doflist=NULL; 4139 // double pressure[numdof];4194 //IssmDouble pressure[numdof]; 4140 4195 4141 4196 /*Get dof list: */ … … 4150 4205 4151 4206 /*Check solution*/ 4152 if( isnan(values[i])) _error_("NaN found in solution vector");4153 //if(values[i]<0) printf("temperature < 0°K found in solution vector\n");4154 //if(values[i]>275) printf("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)\n");4207 if(xIsNan<IssmDouble>(values[i])) _error2_("NaN found in solution vector"); 4208 //if(values[i]<0) _printLine_("temperature < 0°K found in solution vector"); 4209 //if(values[i]>275) _printLine_("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)"); 4155 4210 } 4156 4211 … … 4184 4239 break; 4185 4240 default: 4186 _error _("Rheology law %s not supported yet",EnumToStringx(rheology_law));4241 _error2_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet"); 4187 4242 4188 4243 } … … 4193 4248 4194 4249 /*Free ressources:*/ 4195 x free((void**)&doflist);4196 } 4197 /*}}}*/ 4198 /*FUNCTION Penta::InputUpdateFromSolutionEnthalpy {{{ 1*/4199 void Penta::InputUpdateFromSolutionEnthalpy( double* solution){4250 xDelete<int>(doflist); 4251 } 4252 /*}}}*/ 4253 /*FUNCTION Penta::InputUpdateFromSolutionEnthalpy {{{*/ 4254 void Penta::InputUpdateFromSolutionEnthalpy(IssmDouble* solution){ 4200 4255 4201 4256 const int numdof=NDOF1*NUMVERTICES; … … 4203 4258 bool converged=false; 4204 4259 int i,rheology_law; 4205 double xyz_list[NUMVERTICES][3];4206 double values[numdof];4207 double pressure[NUMVERTICES];4208 double temperatures[numdof];4209 double waterfraction[numdof];4210 double B[numdof];4211 double B_average,s_average;4260 IssmDouble xyz_list[NUMVERTICES][3]; 4261 IssmDouble values[numdof]; 4262 IssmDouble pressure[NUMVERTICES]; 4263 IssmDouble temperatures[numdof]; 4264 IssmDouble waterfraction[numdof]; 4265 IssmDouble B[numdof]; 4266 IssmDouble B_average,s_average; 4212 4267 int* doflist=NULL; 4213 4268 … … 4220 4275 4221 4276 /*Check solution*/ 4222 if( isnan(values[i])) _error_("NaN found in solution vector");4277 if(xIsNan<IssmDouble>(values[i])) _error2_("NaN found in solution vector"); 4223 4278 } 4224 4279 … … 4233 4288 for(i=0;i<numdof;i++){ 4234 4289 matpar->EnthalpyToThermal(&temperatures[i],&waterfraction[i],values[i],pressure[i]); 4235 if(waterfraction[i]<0) _error _("Negative water fraction found in solution vector");4236 //if(waterfraction[i]>1) _error _("Water fraction >1 found in solution vector");4290 if(waterfraction[i]<0) _error2_("Negative water fraction found in solution vector"); 4291 //if(waterfraction[i]>1) _error2_("Water fraction >1 found in solution vector"); 4237 4292 } 4238 4293 … … 4262 4317 break; 4263 4318 default: 4264 _error _("Rheology law %s not supported yet",EnumToStringx(rheology_law));4319 _error2_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet"); 4265 4320 4266 4321 } … … 4271 4326 4272 4327 /*Free ressources:*/ 4273 x free((void**)&doflist);4328 xDelete<int>(doflist); 4274 4329 } 4275 4330 /*}}}*/ … … 4277 4332 4278 4333 #ifdef _HAVE_CONTROL_ 4279 /*FUNCTION Penta::ControlInputGetGradient{{{ 1*/4334 /*FUNCTION Penta::ControlInputGetGradient{{{*/ 4280 4335 void Penta::ControlInputGetGradient(Vector* gradient,int enum_type,int control_index){ 4281 4336 … … 4290 4345 input=inputs->GetInput(enum_type); 4291 4346 } 4292 if (!input) _error _("Input %s not found",EnumToStringx(enum_type));4293 if (input->ObjectEnum()!=ControlInputEnum) _error _("Input %s is not a ControlInput",EnumToStringx(enum_type));4347 if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found"); 4348 if (input->ObjectEnum()!=ControlInputEnum) _error2_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); 4294 4349 4295 4350 GradientIndexing(&doflist1[0],control_index); … … 4297 4352 4298 4353 }/*}}}*/ 4299 /*FUNCTION Penta::ControlInputScaleGradient{{{ 1*/4300 void Penta::ControlInputScaleGradient(int enum_type, double scale){4354 /*FUNCTION Penta::ControlInputScaleGradient{{{*/ 4355 void Penta::ControlInputScaleGradient(int enum_type,IssmDouble scale){ 4301 4356 4302 4357 Input* input=NULL; … … 4308 4363 input=inputs->GetInput(enum_type); 4309 4364 } 4310 if (!input) _error _("Input %s not found",EnumToStringx(enum_type));4311 if (input->ObjectEnum()!=ControlInputEnum) _error _("Input %s is not a ControlInput",EnumToStringx(enum_type));4365 if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found"); 4366 if (input->ObjectEnum()!=ControlInputEnum) _error2_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); 4312 4367 4313 4368 ((ControlInput*)input)->ScaleGradient(scale); 4314 4369 }/*}}}*/ 4315 /*FUNCTION Penta::ControlInputSetGradient{{{ 1*/4316 void Penta::ControlInputSetGradient( double* gradient,int enum_type,int control_index){4370 /*FUNCTION Penta::ControlInputSetGradient{{{*/ 4371 void Penta::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){ 4317 4372 4318 4373 int doflist1[NUMVERTICES]; 4319 double grad_list[NUMVERTICES];4374 IssmDouble grad_list[NUMVERTICES]; 4320 4375 Input* grad_input=NULL; 4321 4376 Input* input=NULL; … … 4327 4382 input=inputs->GetInput(enum_type); 4328 4383 } 4329 if (!input) _error _("Input %s not found",EnumToStringx(enum_type));4330 if (input->ObjectEnum()!=ControlInputEnum) _error _("Input %s is not a ControlInput",EnumToStringx(enum_type));4384 if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found"); 4385 if (input->ObjectEnum()!=ControlInputEnum) _error2_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); 4331 4386 4332 4387 GradientIndexing(&doflist1[0],control_index); … … 4336 4391 4337 4392 }/*}}}*/ 4338 /*FUNCTION Penta::CreateKMatrixAdjointHoriz{{{ 1*/4393 /*FUNCTION Penta::CreateKMatrixAdjointHoriz{{{*/ 4339 4394 ElementMatrix* Penta::CreateKMatrixAdjointHoriz(void){ 4340 4395 … … 4352 4407 return NULL; 4353 4408 default: 4354 _error _("Approximation %s not supported yet",EnumToStringx(approximation));4355 } 4356 } 4357 /*}}}*/ 4358 /*FUNCTION Penta::CreateKMatrixAdjointMacAyeal2d{{{ 1*/4409 _error2_("Approximation " << EnumToStringx(approximation) << " not supported yet"); 4410 } 4411 } 4412 /*}}}*/ 4413 /*FUNCTION Penta::CreateKMatrixAdjointMacAyeal2d{{{*/ 4359 4414 ElementMatrix* Penta::CreateKMatrixAdjointMacAyeal2d(void){ 4360 4415 … … 4379 4434 } 4380 4435 /*}}}*/ 4381 /*FUNCTION Penta::CreateKMatrixAdjointPattyn{{{ 1*/4436 /*FUNCTION Penta::CreateKMatrixAdjointPattyn{{{*/ 4382 4437 ElementMatrix* Penta::CreateKMatrixAdjointPattyn(void){ 4383 4438 … … 4388 4443 int i,j,ig; 4389 4444 bool incomplete_adjoint; 4390 double xyz_list[NUMVERTICES][3];4391 double Jdet;4392 double eps1dotdphii,eps1dotdphij;4393 double eps2dotdphii,eps2dotdphij;4394 double mu_prime;4395 double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/4396 double eps1[3],eps2[3];4397 double phi[NUMVERTICES];4398 double dphi[3][NUMVERTICES];4445 IssmDouble xyz_list[NUMVERTICES][3]; 4446 IssmDouble Jdet; 4447 IssmDouble eps1dotdphii,eps1dotdphij; 4448 IssmDouble eps2dotdphii,eps2dotdphij; 4449 IssmDouble mu_prime; 4450 IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 4451 IssmDouble eps1[3],eps2[3]; 4452 IssmDouble phi[NUMVERTICES]; 4453 IssmDouble dphi[3][NUMVERTICES]; 4399 4454 GaussPenta *gauss=NULL; 4400 4455 … … 4447 4502 } 4448 4503 /*}}}*/ 4449 /*FUNCTION Penta::CreateKMatrixAdjointStokes{{{ 1*/4504 /*FUNCTION Penta::CreateKMatrixAdjointStokes{{{*/ 4450 4505 ElementMatrix* Penta::CreateKMatrixAdjointStokes(void){ 4451 4506 … … 4456 4511 int i,j,ig; 4457 4512 bool incomplete_adjoint; 4458 double xyz_list[NUMVERTICES][3];4459 double Jdet;4460 double eps1dotdphii,eps1dotdphij;4461 double eps2dotdphii,eps2dotdphij;4462 double eps3dotdphii,eps3dotdphij;4463 double mu_prime;4464 double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/4465 double eps1[3],eps2[3],eps3[3];4466 double phi[NUMVERTICES];4467 double dphi[3][NUMVERTICES];4513 IssmDouble xyz_list[NUMVERTICES][3]; 4514 IssmDouble Jdet; 4515 IssmDouble eps1dotdphii,eps1dotdphij; 4516 IssmDouble eps2dotdphii,eps2dotdphij; 4517 IssmDouble eps3dotdphii,eps3dotdphij; 4518 IssmDouble mu_prime; 4519 IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 4520 IssmDouble eps1[3],eps2[3],eps3[3]; 4521 IssmDouble phi[NUMVERTICES]; 4522 IssmDouble dphi[3][NUMVERTICES]; 4468 4523 GaussPenta *gauss=NULL; 4469 4524 … … 4526 4581 } 4527 4582 /*}}}*/ 4528 /*FUNCTION Penta::CreatePVectorAdjointHoriz{{{ 1*/4583 /*FUNCTION Penta::CreatePVectorAdjointHoriz{{{*/ 4529 4584 ElementVector* Penta::CreatePVectorAdjointHoriz(void){ 4530 4585 … … 4542 4597 return CreatePVectorAdjointStokes(); 4543 4598 default: 4544 _error _("Approximation %s not supported yet",EnumToStringx(approximation));4545 } 4546 } 4547 /*}}}*/ 4548 /*FUNCTION Penta::CreatePVectorAdjointMacAyeal{{{ 1*/4599 _error2_("Approximation " << EnumToStringx(approximation) << " not supported yet"); 4600 } 4601 } 4602 /*}}}*/ 4603 /*FUNCTION Penta::CreatePVectorAdjointMacAyeal{{{*/ 4549 4604 ElementVector* Penta::CreatePVectorAdjointMacAyeal(){ 4550 4605 … … 4560 4615 } 4561 4616 /*}}}*/ 4562 /*FUNCTION Penta::CreatePVectorAdjointPattyn{{{ 1*/4617 /*FUNCTION Penta::CreatePVectorAdjointPattyn{{{*/ 4563 4618 ElementVector* Penta::CreatePVectorAdjointPattyn(void){ 4564 4619 … … 4574 4629 } 4575 4630 /*}}}*/ 4576 /*FUNCTION Penta::CreatePVectorAdjointStokes{{{ 1*/4631 /*FUNCTION Penta::CreatePVectorAdjointStokes{{{*/ 4577 4632 ElementVector* Penta::CreatePVectorAdjointStokes(void){ 4578 4633 … … 4588 4643 } 4589 4644 /*}}}*/ 4590 /*FUNCTION Penta::GradientIndexing{{{ 1*/4645 /*FUNCTION Penta::GradientIndexing{{{*/ 4591 4646 void Penta::GradientIndexing(int* indexing,int control_index){ 4592 4647 … … 4602 4657 } 4603 4658 /*}}}*/ 4604 /*FUNCTION Penta::Gradj {{{ 1*/4659 /*FUNCTION Penta::Gradj {{{*/ 4605 4660 void Penta::Gradj(Vector* gradient,int control_type,int control_index){ 4606 4661 /*dJ/dalpha = ∂L/∂alpha = ∂J/∂alpha + ∂/∂alpha(KU-F)*/ … … 4631 4686 break; 4632 4687 default: 4633 _error _("approximation %s not supported yet",EnumToStringx(approximation));4688 _error2_("approximation " << EnumToStringx(approximation) << " not supported yet"); 4634 4689 } 4635 4690 break; … … 4651 4706 break; 4652 4707 default: 4653 _error _("approximation %s not supported yet",EnumToStringx(approximation));4708 _error2_("approximation " << EnumToStringx(approximation) << " not supported yet"); 4654 4709 } 4655 4710 break; 4656 4711 4657 4712 default: 4658 _error _("control type %s not supported yet: ",EnumToStringx(control_type));4713 _error2_("control type " << EnumToStringx(control_type) << " not supported yet: "); 4659 4714 } 4660 4715 … … 4688 4743 break; 4689 4744 default: 4690 _error _("response %s not supported yet",EnumToStringx(responses[resp]));4691 } 4692 x free((void**)&responses);4693 } 4694 /*}}}*/ 4695 /*FUNCTION Penta::GradjDragMacAyeal {{{ 1*/4745 _error2_("response " << EnumToStringx(responses[resp]) << " not supported yet"); 4746 } 4747 xDelete<int>(responses); 4748 } 4749 /*}}}*/ 4750 /*FUNCTION Penta::GradjDragMacAyeal {{{*/ 4696 4751 void Penta::GradjDragMacAyeal(Vector* gradient,int control_index){ 4697 4752 … … 4705 4760 4706 4761 } /*}}}*/ 4707 /*FUNCTION Penta::GradjDragPattyn {{{ 1*/4762 /*FUNCTION Penta::GradjDragPattyn {{{*/ 4708 4763 void Penta::GradjDragPattyn(Vector* gradient,int control_index){ 4709 4764 … … 4711 4766 int analysis_type; 4712 4767 int doflist1[NUMVERTICES]; 4713 double vx,vy,lambda,mu,alpha_complement,Jdet;4714 double bed,thickness,Neff,drag;4715 double xyz_list[NUMVERTICES][3];4716 double xyz_list_tria[NUMVERTICES2D][3]={0.0};4717 double dk[NDOF3];4718 double grade_g[NUMVERTICES]={0.0};4719 double grade_g_gaussian[NUMVERTICES];4720 double basis[6];4768 IssmDouble vx,vy,lambda,mu,alpha_complement,Jdet; 4769 IssmDouble bed,thickness,Neff,drag; 4770 IssmDouble xyz_list[NUMVERTICES][3]; 4771 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 4772 IssmDouble dk[NDOF3]; 4773 IssmDouble grade_g[NUMVERTICES]={0.0}; 4774 IssmDouble grade_g_gaussian[NUMVERTICES]; 4775 IssmDouble basis[6]; 4721 4776 Friction* friction=NULL; 4722 4777 GaussPenta *gauss=NULL; … … 4765 4820 /*Add gradje_g_gaussian vector to gradje_g: */ 4766 4821 for(i=0;i<NUMVERTICES;i++){ 4767 _assert_(! isnan(grade_g[i]));4822 _assert_(!xIsNan<IssmDouble>(grade_g[i])); 4768 4823 grade_g[i]+=grade_g_gaussian[i]; 4769 4824 } … … 4776 4831 } 4777 4832 /*}}}*/ 4778 /*FUNCTION Penta::GradjDragStokes {{{ 1*/4833 /*FUNCTION Penta::GradjDragStokes {{{*/ 4779 4834 void Penta::GradjDragStokes(Vector* gradient,int control_index){ 4780 4835 … … 4782 4837 int analysis_type; 4783 4838 int doflist1[NUMVERTICES]; 4784 double bed,thickness,Neff;4785 double lambda,mu,xi,Jdet,vx,vy,vz;4786 double alpha_complement,drag;4787 double surface_normal[3],bed_normal[3];4788 double xyz_list[NUMVERTICES][3];4789 double xyz_list_tria[NUMVERTICES2D][3]={0.0};4790 double dk[NDOF3];4791 double basis[6];4792 double grade_g[NUMVERTICES]={0.0};4793 double grade_g_gaussian[NUMVERTICES];4839 IssmDouble bed,thickness,Neff; 4840 IssmDouble lambda,mu,xi,Jdet,vx,vy,vz; 4841 IssmDouble alpha_complement,drag; 4842 IssmDouble surface_normal[3],bed_normal[3]; 4843 IssmDouble xyz_list[NUMVERTICES][3]; 4844 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 4845 IssmDouble dk[NDOF3]; 4846 IssmDouble basis[6]; 4847 IssmDouble grade_g[NUMVERTICES]={0.0}; 4848 IssmDouble grade_g_gaussian[NUMVERTICES]; 4794 4849 Friction* friction=NULL; 4795 4850 GaussPenta* gauss=NULL; … … 4868 4923 } 4869 4924 /*}}}*/ 4870 /*FUNCTION Penta::GradjBbarMacAyeal {{{ 1*/4925 /*FUNCTION Penta::GradjBbarMacAyeal {{{*/ 4871 4926 void Penta::GradjBbarMacAyeal(Vector* gradient,int control_index){ 4872 4927 … … 4886 4941 4887 4942 } /*}}}*/ 4888 /*FUNCTION Penta::GradjBbarPattyn {{{ 1*/4943 /*FUNCTION Penta::GradjBbarPattyn {{{*/ 4889 4944 void Penta::GradjBbarPattyn(Vector* gradient,int control_index){ 4890 4945 … … 4903 4958 this->matice->inputs->DeleteInput(MaterialsRheologyBbarEnum); 4904 4959 } /*}}}*/ 4905 /*FUNCTION Penta::GradjBbarStokes {{{ 1*/4960 /*FUNCTION Penta::GradjBbarStokes {{{*/ 4906 4961 void Penta::GradjBbarStokes(Vector* gradient,int control_index){ 4907 4962 … … 4920 4975 this->matice->inputs->DeleteInput(MaterialsRheologyBbarEnum); 4921 4976 } /*}}}*/ 4922 /*FUNCTION Penta::InputControlUpdate{{{ 1*/4923 void Penta::InputControlUpdate( double scalar,bool save_parameter){4977 /*FUNCTION Penta::InputControlUpdate{{{*/ 4978 void Penta::InputControlUpdate(IssmDouble scalar,bool save_parameter){ 4924 4979 4925 4980 /*Intermediary*/ … … 4942 4997 } 4943 4998 4944 if (input->ObjectEnum()!=ControlInputEnum) _error _("input %s is not a ControlInput",EnumToStringx(control_type[i]));4999 if (input->ObjectEnum()!=ControlInputEnum) _error2_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput"); 4945 5000 4946 5001 ((ControlInput*)input)->UpdateValue(scalar); … … 4955 5010 /*Clean up and return*/ 4956 5011 cleanup_and_return: 4957 x free((void**)&control_type);4958 } 4959 /*}}}*/ 4960 /*FUNCTION Penta::InputUpdateFromSolutionAdjointStokes {{{ 1*/4961 void Penta::InputUpdateFromSolutionAdjointStokes( double* solution){5012 xDelete<int>(control_type); 5013 } 5014 /*}}}*/ 5015 /*FUNCTION Penta::InputUpdateFromSolutionAdjointStokes {{{*/ 5016 void Penta::InputUpdateFromSolutionAdjointStokes(IssmDouble* solution){ 4962 5017 4963 5018 const int numdof=NDOF4*NUMVERTICES; 4964 5019 4965 5020 int i; 4966 double values[numdof];4967 double lambdax[NUMVERTICES];4968 double lambday[NUMVERTICES];4969 double lambdaz[NUMVERTICES];4970 double lambdap[NUMVERTICES];5021 IssmDouble values[numdof]; 5022 IssmDouble lambdax[NUMVERTICES]; 5023 IssmDouble lambday[NUMVERTICES]; 5024 IssmDouble lambdaz[NUMVERTICES]; 5025 IssmDouble lambdap[NUMVERTICES]; 4971 5026 int* doflist=NULL; 4972 5027 … … 4985 5040 4986 5041 /*Check solution*/ 4987 if( isnan(lambdax[i])) _error_("NaN found in solution vector");4988 if( isnan(lambday[i])) _error_("NaN found in solution vector");4989 if( isnan(lambdaz[i])) _error_("NaN found in solution vector");4990 if( isnan(lambdap[i])) _error_("NaN found in solution vector");5042 if(xIsNan<IssmDouble>(lambdax[i])) _error2_("NaN found in solution vector"); 5043 if(xIsNan<IssmDouble>(lambday[i])) _error2_("NaN found in solution vector"); 5044 if(xIsNan<IssmDouble>(lambdaz[i])) _error2_("NaN found in solution vector"); 5045 if(xIsNan<IssmDouble>(lambdap[i])) _error2_("NaN found in solution vector"); 4991 5046 } 4992 5047 … … 4998 5053 4999 5054 /*Free ressources:*/ 5000 x free((void**)&doflist);5001 } 5002 /*}}}*/ 5003 /*FUNCTION Penta::InputUpdateFromSolutionAdjointHoriz {{{ 1*/5004 void Penta::InputUpdateFromSolutionAdjointHoriz( double* solution){5055 xDelete<int>(doflist); 5056 } 5057 /*}}}*/ 5058 /*FUNCTION Penta::InputUpdateFromSolutionAdjointHoriz {{{*/ 5059 void Penta::InputUpdateFromSolutionAdjointHoriz(IssmDouble* solution){ 5005 5060 5006 5061 const int numdof=NDOF2*NUMVERTICES; 5007 5062 5008 5063 int i; 5009 double values[numdof];5010 double lambdax[NUMVERTICES];5011 double lambday[NUMVERTICES];5064 IssmDouble values[numdof]; 5065 IssmDouble lambdax[NUMVERTICES]; 5066 IssmDouble lambday[NUMVERTICES]; 5012 5067 int* doflist=NULL; 5013 5068 … … 5024 5079 5025 5080 /*Check solution*/ 5026 if( isnan(lambdax[i])) _error_("NaN found in solution vector");5027 if( isnan(lambday[i])) _error_("NaN found in solution vector");5081 if(xIsNan<IssmDouble>(lambdax[i])) _error2_("NaN found in solution vector"); 5082 if(xIsNan<IssmDouble>(lambday[i])) _error2_("NaN found in solution vector"); 5028 5083 } 5029 5084 … … 5033 5088 5034 5089 /*Free ressources:*/ 5035 x free((void**)&doflist);5036 } 5037 /*}}}*/ 5038 /*FUNCTION Penta::SurfaceAverageVelMisfit {{{ 1*/5039 double Penta::SurfaceAverageVelMisfit(bool process_units,int weight_index){5090 xDelete<int>(doflist); 5091 } 5092 /*}}}*/ 5093 /*FUNCTION Penta::SurfaceAverageVelMisfit {{{*/ 5094 IssmDouble Penta::SurfaceAverageVelMisfit(bool process_units,int weight_index){ 5040 5095 5041 5096 int approximation; 5042 double J;5097 IssmDouble J; 5043 5098 Tria* tria=NULL; 5044 5099 … … 5073 5128 } 5074 5129 /*}}}*/ 5075 /*FUNCTION Penta::SurfaceAbsVelMisfit {{{ 1*/5076 double Penta::SurfaceAbsVelMisfit(bool process_units,int weight_index){5130 /*FUNCTION Penta::SurfaceAbsVelMisfit {{{*/ 5131 IssmDouble Penta::SurfaceAbsVelMisfit(bool process_units,int weight_index){ 5077 5132 5078 5133 int approximation; 5079 double J;5134 IssmDouble J; 5080 5135 Tria* tria=NULL; 5081 5136 … … 5110 5165 } 5111 5166 /*}}}*/ 5112 /*FUNCTION Penta::SurfaceLogVelMisfit {{{ 1*/5113 double Penta::SurfaceLogVelMisfit(bool process_units,int weight_index){5167 /*FUNCTION Penta::SurfaceLogVelMisfit {{{*/ 5168 IssmDouble Penta::SurfaceLogVelMisfit(bool process_units,int weight_index){ 5114 5169 5115 5170 int approximation; 5116 double J;5171 IssmDouble J; 5117 5172 Tria* tria=NULL; 5118 5173 … … 5147 5202 } 5148 5203 /*}}}*/ 5149 /*FUNCTION Penta::SurfaceLogVxVyMisfit {{{ 1*/5150 double Penta::SurfaceLogVxVyMisfit(bool process_units,int weight_index){5151 5152 double J;5204 /*FUNCTION Penta::SurfaceLogVxVyMisfit {{{*/ 5205 IssmDouble Penta::SurfaceLogVxVyMisfit(bool process_units,int weight_index){ 5206 5207 IssmDouble J; 5153 5208 Tria* tria=NULL; 5154 5209 … … 5186 5241 } 5187 5242 /*}}}*/ 5188 /*FUNCTION Penta::SurfaceRelVelMisfit {{{ 1*/5189 double Penta::SurfaceRelVelMisfit(bool process_units,int weight_index){5243 /*FUNCTION Penta::SurfaceRelVelMisfit {{{*/ 5244 IssmDouble Penta::SurfaceRelVelMisfit(bool process_units,int weight_index){ 5190 5245 5191 5246 int approximation; 5192 double J;5247 IssmDouble J; 5193 5248 Tria* tria=NULL; 5194 5249 … … 5223 5278 } 5224 5279 /*}}}*/ 5225 /*FUNCTION Penta::ThicknessAbsGradient{{{ 1*/5226 double Penta::ThicknessAbsGradient(bool process_units,int weight_index){5227 5228 _error _("Not implemented yet");5229 } 5230 /*}}}*/ 5231 /*FUNCTION Penta::ThicknessAbsMisfit {{{ 1*/5232 double Penta::ThicknessAbsMisfit(bool process_units,int weight_index){5280 /*FUNCTION Penta::ThicknessAbsGradient{{{*/ 5281 IssmDouble Penta::ThicknessAbsGradient(bool process_units,int weight_index){ 5282 5283 _error2_("Not implemented yet"); 5284 } 5285 /*}}}*/ 5286 /*FUNCTION Penta::ThicknessAbsMisfit {{{*/ 5287 IssmDouble Penta::ThicknessAbsMisfit(bool process_units,int weight_index){ 5233 5288 5234 5289 int approximation; 5235 double J;5290 IssmDouble J; 5236 5291 Tria* tria=NULL; 5237 5292 … … 5241 5296 /*If on water, return 0: */ 5242 5297 if(IsOnWater())return 0; 5243 _error _("Not implemented yet");5298 _error2_("Not implemented yet"); 5244 5299 5245 5300 tria=(Tria*)SpawnTria(0,1,2); … … 5249 5304 } 5250 5305 /*}}}*/ 5251 /*FUNCTION Penta::DragCoefficientAbsGradient{{{ 1*/5252 double Penta::DragCoefficientAbsGradient(bool process_units,int weight_index){5253 5254 double J;5306 /*FUNCTION Penta::DragCoefficientAbsGradient{{{*/ 5307 IssmDouble Penta::DragCoefficientAbsGradient(bool process_units,int weight_index){ 5308 5309 IssmDouble J; 5255 5310 Tria* tria=NULL; 5256 5311 … … 5264 5319 } 5265 5320 /*}}}*/ 5266 /*FUNCTION Penta::RheologyBbarAbsGradient{{{ 1*/5267 double Penta::RheologyBbarAbsGradient(bool process_units,int weight_index){5268 5269 double J;5321 /*FUNCTION Penta::RheologyBbarAbsGradient{{{*/ 5322 IssmDouble Penta::RheologyBbarAbsGradient(bool process_units,int weight_index){ 5323 5324 IssmDouble J; 5270 5325 Tria* tria=NULL; 5271 5326 … … 5279 5334 } 5280 5335 /*}}}*/ 5281 /*FUNCTION Penta::GetVectorFromControlInputs{{{ 1*/5336 /*FUNCTION Penta::GetVectorFromControlInputs{{{*/ 5282 5337 void Penta::GetVectorFromControlInputs(Vector* vector,int control_enum,int control_index,const char* data){ 5283 5338 … … 5292 5347 /*Get input (either in element or material)*/ 5293 5348 Input* input=inputs->GetInput(control_enum); 5294 if(!input) _error _("Input %s not found in element",EnumToStringx(control_enum));5349 if(!input) _error2_("Input " << EnumToStringx(control_enum) << " not found in element"); 5295 5350 5296 5351 /*Check that it is a ControlInput*/ 5297 5352 if (input->ObjectEnum()!=ControlInputEnum){ 5298 _error _("input %s is not a ControlInput",EnumToStringx(control_enum));5353 _error2_("input " << EnumToStringx(control_enum) << " is not a ControlInput"); 5299 5354 } 5300 5355 … … 5302 5357 } 5303 5358 /*}}}*/ 5304 /*FUNCTION Penta::SetControlInputsFromVector{{{ 1*/5305 void Penta::SetControlInputsFromVector( double* vector,int control_enum,int control_index){5306 5307 double values[NUMVERTICES];5359 /*FUNCTION Penta::SetControlInputsFromVector{{{*/ 5360 void Penta::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){ 5361 5362 IssmDouble values[NUMVERTICES]; 5308 5363 int doflist1[NUMVERTICES]; 5309 5364 Input *input = NULL; … … 5331 5386 5332 5387 if (input->ObjectEnum()!=ControlInputEnum){ 5333 _error _("input %s is not a ControlInput",EnumToStringx(control_enum));5388 _error2_("input " << EnumToStringx(control_enum) << " is not a ControlInput"); 5334 5389 } 5335 5390 … … 5340 5395 5341 5396 #ifdef _HAVE_DAKOTA_ 5342 /*FUNCTION Penta::InputUpdateFromVectorDakota( double* vector, int name, int type);{{{1*/5343 void Penta::InputUpdateFromVectorDakota( double* vector, int name, int type){5397 /*FUNCTION Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/ 5398 void Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 5344 5399 5345 5400 int i,j; … … 5353 5408 5354 5409 /*New PentaP1Input*/ 5355 double values[6];5410 IssmDouble values[6]; 5356 5411 5357 5412 /*Get values on the 6 vertices*/ … … 5363 5418 switch(name){ 5364 5419 case ThicknessEnum: 5365 /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{ 2*/5366 double thickness[6];5367 double thickness_init[6];5368 double hydrostatic_ratio[6];5369 double surface[6];5370 double bed[6];5420 /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{*/ 5421 IssmDouble thickness[6]; 5422 IssmDouble thickness_init[6]; 5423 IssmDouble hydrostatic_ratio[6]; 5424 IssmDouble surface[6]; 5425 IssmDouble bed[6]; 5371 5426 5372 5427 /*retrieve inputs: */ … … 5382 5437 if (this->IsFloating()){ 5383 5438 /*hydrostatic equilibrium: */ 5384 double rho_ice,rho_water,di;5439 IssmDouble rho_ice,rho_water,di; 5385 5440 rho_ice=this->matpar->GetRhoIce(); 5386 5441 rho_water=this->matpar->GetRhoWater(); … … 5437 5492 5438 5493 default: 5439 _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));5440 } 5441 5442 } 5443 /*}}}*/ 5444 /*FUNCTION Penta::InputUpdateFromVectorDakota(int* vector, int name, int type);{{{ 1*/5494 _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 5495 } 5496 5497 } 5498 /*}}}*/ 5499 /*FUNCTION Penta::InputUpdateFromVectorDakota(int* vector, int name, int type);{{{*/ 5445 5500 void Penta::InputUpdateFromVectorDakota(int* vector, int name, int type){ 5446 _error _("not supported yet!");5447 } 5448 /*}}}*/ 5449 /*FUNCTION Penta::InputUpdateFromVectorDakota(bool* vector, int name, int type);{{{ 1*/5501 _error2_("not supported yet!"); 5502 } 5503 /*}}}*/ 5504 /*FUNCTION Penta::InputUpdateFromVectorDakota(bool* vector, int name, int type);{{{*/ 5450 5505 void Penta::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 5451 _error _("not supported yet!");5452 } 5453 /*}}}*/ 5454 /*FUNCTION Penta::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type);{{{1*/5455 void Penta::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){5506 _error2_("not supported yet!"); 5507 } 5508 /*}}}*/ 5509 /*FUNCTION Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/ 5510 void Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 5456 5511 5457 5512 int i,j,t; 5458 5513 TransientInput* transientinput=NULL; 5459 double values[6];5460 double time;5514 IssmDouble values[6]; 5515 IssmDouble time; 5461 5516 int row; 5462 double yts;5517 IssmDouble yts; 5463 5518 5464 5519 /*Check that name is an element input*/ … … 5478 5533 for(i=0;i<6;i++){ 5479 5534 row=this->nodes[i]->GetSidList(); 5480 values[i]=( double)matrix[ncols*row+t];5535 values[i]=(IssmDouble)matrix[ncols*row+t]; 5481 5536 } 5482 5537 5483 5538 /*time? :*/ 5484 time=( double)matrix[(nrows-1)*ncols+t]*yts;5539 time=(IssmDouble)matrix[(nrows-1)*ncols+t]*yts; 5485 5540 5486 5541 if(t==0) transientinput=new TransientInput(name); … … 5492 5547 5493 5548 default: 5494 _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));5549 _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 5495 5550 } 5496 5551 … … 5500 5555 5501 5556 #ifdef _HAVE_DIAGNOSTIC_ 5502 /*FUNCTION Penta::CreateDVectorDiagnosticHoriz {{{ 1*/5557 /*FUNCTION Penta::CreateDVectorDiagnosticHoriz {{{*/ 5503 5558 ElementVector* Penta::CreateDVectorDiagnosticHoriz(void){ 5504 5559 … … 5514 5569 } 5515 5570 /*}}}*/ 5516 /*FUNCTION Penta::CreateDVectorDiagnosticStokes{{{ 1*/5571 /*FUNCTION Penta::CreateDVectorDiagnosticStokes{{{*/ 5517 5572 ElementVector* Penta::CreateDVectorDiagnosticStokes(void){ 5518 5573 … … 5539 5594 } 5540 5595 /*}}}*/ 5541 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattyn{{{ 1*/5596 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattyn{{{*/ 5542 5597 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealPattyn(void){ 5543 5598 … … 5553 5608 } 5554 5609 /*}}}*/ 5555 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattynViscous{{{ 1*/5610 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattynViscous{{{*/ 5556 5611 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealPattynViscous(void){ 5557 5612 … … 5564 5619 /*Intermediaries */ 5565 5620 int i,j,ig; 5566 double Jdet;5567 double viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity5568 double epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/5569 double xyz_list[NUMVERTICES][3];5570 double B[3][numdofp];5571 double Bprime[3][numdofm];5572 double D[3][3]={0.0}; // material matrix, simple scalar matrix.5573 double D_scalar;5574 double Ke_gg[numdofp][numdofm]={0.0}; //local element stiffness matrix5575 double Ke_gg_gaussian[numdofp][numdofm]; //stiffness matrix evaluated at the gaussian point.5621 IssmDouble Jdet; 5622 IssmDouble viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity 5623 IssmDouble epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 5624 IssmDouble xyz_list[NUMVERTICES][3]; 5625 IssmDouble B[3][numdofp]; 5626 IssmDouble Bprime[3][numdofm]; 5627 IssmDouble D[3][3]={0.0}; // material matrix, simple scalar matrix. 5628 IssmDouble D_scalar; 5629 IssmDouble Ke_gg[numdofp][numdofm]={0.0}; //local element stiffness matrix 5630 IssmDouble Ke_gg_gaussian[numdofp][numdofm]; //stiffness matrix evaluated at the gaussian point. 5576 5631 GaussPenta *gauss=NULL; 5577 5632 GaussTria *gauss_tria=NULL; … … 5646 5701 } 5647 5702 /*}}}*/ 5648 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattynFriction{{{ 1*/5703 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattynFriction{{{*/ 5649 5704 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealPattynFriction(void){ 5650 5705 … … 5656 5711 /*Intermediaries */ 5657 5712 int i,j,ig,analysis_type; 5658 double Jdet2d,slope_magnitude,alpha2;5659 double xyz_list[NUMVERTICES][3];5660 double xyz_list_tria[NUMVERTICES2D][3]={0.0};5661 double slope[3]={0.0,0.0,0.0};5662 double MAXSLOPE=.06; // 6 %5663 double MOUNTAINKEXPONENT=10;5664 double L[2][numdof];5665 double DL[2][2] ={{ 0,0 },{0,0}}; //for basal drag5666 double DL_scalar;5667 double Ke_gg[numdof][numdof] ={0.0};5668 double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag5713 IssmDouble Jdet2d,slope_magnitude,alpha2; 5714 IssmDouble xyz_list[NUMVERTICES][3]; 5715 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 5716 IssmDouble slope[3]={0.0,0.0,0.0}; 5717 IssmDouble MAXSLOPE=.06; // 6 % 5718 IssmDouble MOUNTAINKEXPONENT=10; 5719 IssmDouble L[2][numdof]; 5720 IssmDouble DL[2][2] ={{ 0,0 },{0,0}}; //for basal drag 5721 IssmDouble DL_scalar; 5722 IssmDouble Ke_gg[numdof][numdof] ={0.0}; 5723 IssmDouble Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag 5669 5724 Friction *friction = NULL; 5670 5725 GaussPenta *gauss=NULL; … … 5714 5769 5715 5770 if (slope_magnitude>MAXSLOPE){ 5716 alpha2=pow(( double)10,MOUNTAINKEXPONENT);5771 alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT); 5717 5772 } 5718 5773 … … 5744 5799 } 5745 5800 /*}}}*/ 5746 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealStokes{{{ 1*/5801 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealStokes{{{*/ 5747 5802 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealStokes(void){ 5748 5803 … … 5758 5813 } 5759 5814 /*}}}*/ 5760 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealStokesViscous{{{ 1*/5815 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealStokesViscous{{{*/ 5761 5816 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealStokesViscous(void){ 5762 5817 … … 5769 5824 /*Intermediaries */ 5770 5825 int i,j,ig; 5771 double Jdet;5772 double viscosity,stokesreconditioning; //viscosity5773 double epsilon[6]; /* epsilon=[exx,eyy,exy,exz,eyz];*/5774 double xyz_list[NUMVERTICES][3];5775 double B[4][numdofs+3];5776 double Bprime[4][numdofm];5777 double B2[3][numdofm];5778 double Bprime2[3][numdofs+3];5779 double D[4][4]={0.0}; // material matrix, simple scalar matrix.5780 double D2[3][3]={0.0}; // material matrix, simple scalar matrix.5781 double D_scalar;5782 double Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix5783 double Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix5784 double Ke_gg_gaussian[numdofs+3][numdofm]; //stiffness matrix evaluated at the gaussian point.5785 double Ke_gg_gaussian2[numdofm][numdofs+3]; //stiffness matrix evaluated at the gaussian point.5826 IssmDouble Jdet; 5827 IssmDouble viscosity,stokesreconditioning; //viscosity 5828 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 5829 IssmDouble xyz_list[NUMVERTICES][3]; 5830 IssmDouble B[4][numdofs+3]; 5831 IssmDouble Bprime[4][numdofm]; 5832 IssmDouble B2[3][numdofm]; 5833 IssmDouble Bprime2[3][numdofs+3]; 5834 IssmDouble D[4][4]={0.0}; // material matrix, simple scalar matrix. 5835 IssmDouble D2[3][3]={0.0}; // material matrix, simple scalar matrix. 5836 IssmDouble D_scalar; 5837 IssmDouble Ke_gg[numdofs][numdofm]={0.0}; //local element stiffness matrix 5838 IssmDouble Ke_gg2[numdofm][numdofs]={0.0}; //local element stiffness matrix 5839 IssmDouble Ke_gg_gaussian[numdofs+3][numdofm]; //stiffness matrix evaluated at the gaussian point. 5840 IssmDouble Ke_gg_gaussian2[numdofm][numdofs+3]; //stiffness matrix evaluated at the gaussian point. 5786 5841 GaussPenta *gauss=NULL; 5787 5842 GaussTria *gauss_tria=NULL; … … 5862 5917 } 5863 5918 /*}}}*/ 5864 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealStokesFriction {{{ 1*/5919 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealStokesFriction {{{*/ 5865 5920 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealStokesFriction(void){ 5866 5921 … … 5876 5931 int i,j,ig; 5877 5932 int analysis_type,approximation; 5878 double stokesreconditioning;5879 double viscosity,alpha2_gauss,Jdet2d;5880 double bed_normal[3];5881 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/5882 double xyz_list[NUMVERTICES][3];5883 double xyz_list_tria[NUMVERTICES2D][3];5884 double LMacAyealStokes[8][numdof2dm];5885 double LprimeMacAyealStokes[8][numdof2d];5886 double DLMacAyealStokes[8][8]={0.0};5887 double LStokesMacAyeal[4][numdof2d];5888 double LprimeStokesMacAyeal[4][numdof2dm];5889 double DLStokesMacAyeal[4][4]={0.0};5890 double Ke_drag_gaussian[numdof2dm][numdof2d];5891 double Ke_drag_gaussian2[numdof2d][numdof2dm];5933 IssmDouble stokesreconditioning; 5934 IssmDouble viscosity,alpha2_gauss,Jdet2d; 5935 IssmDouble bed_normal[3]; 5936 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 5937 IssmDouble xyz_list[NUMVERTICES][3]; 5938 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 5939 IssmDouble LMacAyealStokes[8][numdof2dm]; 5940 IssmDouble LprimeMacAyealStokes[8][numdof2d]; 5941 IssmDouble DLMacAyealStokes[8][8]={0.0}; 5942 IssmDouble LStokesMacAyeal[4][numdof2d]; 5943 IssmDouble LprimeStokesMacAyeal[4][numdof2dm]; 5944 IssmDouble DLStokesMacAyeal[4][4]={0.0}; 5945 IssmDouble Ke_drag_gaussian[numdof2dm][numdof2d]; 5946 IssmDouble Ke_drag_gaussian2[numdof2d][numdof2dm]; 5892 5947 Friction* friction=NULL; 5893 5948 GaussPenta *gauss=NULL; … … 5978 6033 } 5979 6034 /*}}}*/ 5980 /*FUNCTION Penta::CreateKMatrixCouplingPattynStokes{{{ 1*/6035 /*FUNCTION Penta::CreateKMatrixCouplingPattynStokes{{{*/ 5981 6036 ElementMatrix* Penta::CreateKMatrixCouplingPattynStokes(void){ 5982 6037 … … 6027 6082 } 6028 6083 /*}}}*/ 6029 /*FUNCTION Penta::CreateKMatrixDiagnosticHoriz {{{ 1*/6084 /*FUNCTION Penta::CreateKMatrixDiagnosticHoriz {{{*/ 6030 6085 ElementMatrix* Penta::CreateKMatrixDiagnosticHoriz(void){ 6031 6086 … … 6051 6106 return CreateKMatrixDiagnosticPattynStokes(); 6052 6107 default: 6053 _error _("Approximation %s not supported yet",EnumToStringx(approximation));6054 } 6055 } 6056 /*}}}*/ 6057 /*FUNCTION Penta::CreateKMatrixDiagnosticHutter{{{ 1*/6108 _error2_("Approximation " << EnumToStringx(approximation) << " not supported yet"); 6109 } 6110 } 6111 /*}}}*/ 6112 /*FUNCTION Penta::CreateKMatrixDiagnosticHutter{{{*/ 6058 6113 ElementMatrix* Penta::CreateKMatrixDiagnosticHutter(void){ 6059 6114 … … 6064 6119 int connectivity[2]; 6065 6120 int i,i0,i1,j0,j1; 6066 double one0,one1;6121 IssmDouble one0,one1; 6067 6122 6068 6123 /*Initialize Element matrix*/ … … 6081 6136 connectivity[0]=nodes[i]->GetConnectivity(); 6082 6137 connectivity[1]=nodes[i+3]->GetConnectivity(); 6083 one0=1/( double)connectivity[0];6084 one1=1/( double)connectivity[1];6138 one0=1/(IssmDouble)connectivity[0]; 6139 one1=1/(IssmDouble)connectivity[1]; 6085 6140 6086 6141 /*Create matrix for these two nodes*/ … … 6117 6172 /*Clean up and return*/ 6118 6173 return Ke; 6119 } 6120 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal2d{{{ 1*/6174 }/*}}}*/ 6175 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal2d{{{*/ 6121 6176 ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal2d(void){ 6122 6177 … … 6141 6196 } 6142 6197 /*}}}*/ 6143 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3d{{{ 1*/6198 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3d{{{*/ 6144 6199 ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal3d(void){ 6145 6200 … … 6155 6210 } 6156 6211 /*}}}*/ 6157 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3dViscous{{{ 1*/6212 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3dViscous{{{*/ 6158 6213 ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal3dViscous(void){ 6159 6214 … … 6163 6218 /*Intermediaries */ 6164 6219 int i,j,ig,approximation; 6165 double Jdet;6166 double viscosity, oldviscosity, newviscosity, viscosity_overshoot;6167 double epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/6168 double epsilons[6]; //6 for stokes6169 double xyz_list[NUMVERTICES][3];6170 double B[3][numdof2d];6171 double Bprime[3][numdof2d];6172 double D[3][3]={0.0}; // material matrix, simple scalar matrix.6173 double D_scalar;6174 double Ke_gg_gaussian[numdof2d][numdof2d]; //stiffness matrix evaluated at the gaussian point.6220 IssmDouble Jdet; 6221 IssmDouble viscosity, oldviscosity, newviscosity, viscosity_overshoot; 6222 IssmDouble epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 6223 IssmDouble epsilons[6]; //6 for stokes 6224 IssmDouble xyz_list[NUMVERTICES][3]; 6225 IssmDouble B[3][numdof2d]; 6226 IssmDouble Bprime[3][numdof2d]; 6227 IssmDouble D[3][3]={0.0}; // material matrix, simple scalar matrix. 6228 IssmDouble D_scalar; 6229 IssmDouble Ke_gg_gaussian[numdof2d][numdof2d]; //stiffness matrix evaluated at the gaussian point. 6175 6230 Tria* tria=NULL; 6176 6231 Penta* pentabase=NULL; … … 6219 6274 matice->GetViscosity3dStokes(&newviscosity,&epsilons[0]); 6220 6275 } 6221 else _error _("approximation %i (%s) not supported yet",approximation,EnumToStringx(approximation));6276 else _error2_("approximation " << approximation << " (" << EnumToStringx(approximation) << ") not supported yet"); 6222 6277 6223 6278 D_scalar=2*newviscosity*gauss->weight*Jdet; … … 6243 6298 } 6244 6299 /*}}}*/ 6245 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3dFriction{{{ 1*/6300 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyeal3dFriction{{{*/ 6246 6301 ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyeal3dFriction(void){ 6247 6302 … … 6260 6315 } 6261 6316 /*}}}*/ 6262 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyealPattyn{{{ 1*/6317 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyealPattyn{{{*/ 6263 6318 ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyealPattyn(void){ 6264 6319 … … 6276 6331 } 6277 6332 /*}}}*/ 6278 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyealStokes{{{ 1*/6333 /*FUNCTION Penta::CreateKMatrixDiagnosticMacAyealStokes{{{*/ 6279 6334 ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyealStokes(void){ 6280 6335 … … 6292 6347 } 6293 6348 /*}}}*/ 6294 /*FUNCTION Penta::CreateKMatrixDiagnosticPattyn{{{ 1*/6349 /*FUNCTION Penta::CreateKMatrixDiagnosticPattyn{{{*/ 6295 6350 ElementMatrix* Penta::CreateKMatrixDiagnosticPattyn(void){ 6296 6351 … … 6307 6362 } 6308 6363 /*}}}*/ 6309 /*FUNCTION Penta::CreateKMatrixDiagnosticPattynViscous{{{ 1*/6364 /*FUNCTION Penta::CreateKMatrixDiagnosticPattynViscous{{{*/ 6310 6365 ElementMatrix* Penta::CreateKMatrixDiagnosticPattynViscous(void){ 6311 6366 … … 6316 6371 int i,j,ig; 6317 6372 int approximation; 6318 double xyz_list[NUMVERTICES][3];6319 double Jdet;6320 double viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity6321 double epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/6322 double D_scalar;6323 double D[5][5]={0.0}; // material matrix, simple scalar matrix.6324 double B[5][numdof];6325 double Bprime[5][numdof];6373 IssmDouble xyz_list[NUMVERTICES][3]; 6374 IssmDouble Jdet; 6375 IssmDouble viscosity,oldviscosity,newviscosity,viscosity_overshoot; //viscosity 6376 IssmDouble epsilon[5],oldepsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 6377 IssmDouble D_scalar; 6378 IssmDouble D[5][5]={0.0}; // material matrix, simple scalar matrix. 6379 IssmDouble B[5][numdof]; 6380 IssmDouble Bprime[5][numdof]; 6326 6381 Tria* tria=NULL; 6327 6382 GaussPenta *gauss=NULL; … … 6372 6427 } 6373 6428 /*}}}*/ 6374 /*FUNCTION Penta::CreateKMatrixDiagnosticPattynFriction{{{ 1*/6429 /*FUNCTION Penta::CreateKMatrixDiagnosticPattynFriction{{{*/ 6375 6430 ElementMatrix* Penta::CreateKMatrixDiagnosticPattynFriction(void){ 6376 6431 … … 6381 6436 int i,j,ig; 6382 6437 int analysis_type; 6383 double xyz_list[NUMVERTICES][3];6384 double xyz_list_tria[NUMVERTICES2D][3]={0.0};6385 double slope_magnitude,alpha2,Jdet;6386 double slope[3]={0.0,0.0,0.0};6387 double MAXSLOPE=.06; // 6 %6388 double MOUNTAINKEXPONENT=10;6389 double L[2][numdof];6390 double DL[2][2]={{ 0,0 },{0,0}}; //for basal drag6391 double DL_scalar;6438 IssmDouble xyz_list[NUMVERTICES][3]; 6439 IssmDouble xyz_list_tria[NUMVERTICES2D][3]={0.0}; 6440 IssmDouble slope_magnitude,alpha2,Jdet; 6441 IssmDouble slope[3]={0.0,0.0,0.0}; 6442 IssmDouble MAXSLOPE=.06; // 6 % 6443 IssmDouble MOUNTAINKEXPONENT=10; 6444 IssmDouble L[2][numdof]; 6445 IssmDouble DL[2][2]={{ 0,0 },{0,0}}; //for basal drag 6446 IssmDouble DL_scalar; 6392 6447 Friction *friction = NULL; 6393 6448 GaussPenta *gauss=NULL; … … 6426 6481 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */ 6427 6482 if (slope_magnitude>MAXSLOPE){ 6428 alpha2=pow(( double)10,MOUNTAINKEXPONENT);6483 alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT); 6429 6484 } 6430 6485 … … 6447 6502 } 6448 6503 /*}}}*/ 6449 /*FUNCTION Penta::CreateKMatrixDiagnosticPattynStokes{{{ 1*/6504 /*FUNCTION Penta::CreateKMatrixDiagnosticPattynStokes{{{*/ 6450 6505 ElementMatrix* Penta::CreateKMatrixDiagnosticPattynStokes(void){ 6451 6506 … … 6463 6518 } 6464 6519 /*}}}*/ 6465 /*FUNCTION Penta::CreateKMatrixDiagnosticStokes{{{ 1*/6520 /*FUNCTION Penta::CreateKMatrixDiagnosticStokes{{{*/ 6466 6521 ElementMatrix* Penta::CreateKMatrixDiagnosticStokes(void){ 6467 6522 … … 6477 6532 } 6478 6533 /*}}}*/ 6479 /*FUNCTION Penta::CreateKMatrixDiagnosticStokesViscous {{{ 1*/6534 /*FUNCTION Penta::CreateKMatrixDiagnosticStokesViscous {{{*/ 6480 6535 ElementMatrix* Penta::CreateKMatrixDiagnosticStokesViscous(void){ 6481 6536 6482 6537 /*Intermediaries */ 6483 6538 int i,j,ig,approximation; 6484 double Jdet,viscosity,stokesreconditioning;6485 double xyz_list[NUMVERTICES][3];6486 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/6487 double B[8][27];6488 double B_prime[8][27];6489 double D_scalar;6490 double D[8][8]={0.0};6491 double Ke_temp[27][27]={0.0}; //for the six nodes and the bubble6539 IssmDouble Jdet,viscosity,stokesreconditioning; 6540 IssmDouble xyz_list[NUMVERTICES][3]; 6541 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 6542 IssmDouble B[8][27]; 6543 IssmDouble B_prime[8][27]; 6544 IssmDouble D_scalar; 6545 IssmDouble D[8][8]={0.0}; 6546 IssmDouble Ke_temp[27][27]={0.0}; //for the six nodes and the bubble 6492 6547 GaussPenta *gauss=NULL; 6493 6548 … … 6538 6593 } 6539 6594 /*}}}*/ 6540 /*FUNCTION Penta::CreateKMatrixDiagnosticStokesFriction{{{ 1*/6595 /*FUNCTION Penta::CreateKMatrixDiagnosticStokesFriction{{{*/ 6541 6596 ElementMatrix* Penta::CreateKMatrixDiagnosticStokesFriction(void){ 6542 6597 … … 6548 6603 int i,j,ig; 6549 6604 int analysis_type,approximation; 6550 double alpha2,Jdet2d;6551 double stokesreconditioning,viscosity;6552 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/6553 double xyz_list[NUMVERTICES][3];6554 double xyz_list_tria[NUMVERTICES2D][3];6555 double LStokes[2][numdof2d];6556 double DLStokes[2][2]={0.0};6557 double Ke_drag_gaussian[numdof2d][numdof2d];6605 IssmDouble alpha2,Jdet2d; 6606 IssmDouble stokesreconditioning,viscosity; 6607 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 6608 IssmDouble xyz_list[NUMVERTICES][3]; 6609 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 6610 IssmDouble LStokes[2][numdof2d]; 6611 IssmDouble DLStokes[2][2]={0.0}; 6612 IssmDouble Ke_drag_gaussian[numdof2d][numdof2d]; 6558 6613 Friction* friction=NULL; 6559 6614 GaussPenta *gauss=NULL; … … 6610 6665 } 6611 6666 /*}}}*/ 6612 /*FUNCTION Penta::CreateKMatrixDiagnosticVert {{{ 1*/6667 /*FUNCTION Penta::CreateKMatrixDiagnosticVert {{{*/ 6613 6668 ElementMatrix* Penta::CreateKMatrixDiagnosticVert(void){ 6614 6669 … … 6625 6680 } 6626 6681 /*}}}*/ 6627 /*FUNCTION Penta::CreateKMatrixDiagnosticVertVolume {{{ 1*/6682 /*FUNCTION Penta::CreateKMatrixDiagnosticVertVolume {{{*/ 6628 6683 ElementMatrix* Penta::CreateKMatrixDiagnosticVertVolume(void){ 6629 6684 … … 6633 6688 /*Intermediaries */ 6634 6689 int i,j,ig; 6635 double Jdet;6636 double xyz_list[NUMVERTICES][3];6637 double B[NDOF1][NUMVERTICES];6638 double Bprime[NDOF1][NUMVERTICES];6639 double DL_scalar;6690 IssmDouble Jdet; 6691 IssmDouble xyz_list[NUMVERTICES][3]; 6692 IssmDouble B[NDOF1][NUMVERTICES]; 6693 IssmDouble Bprime[NDOF1][NUMVERTICES]; 6694 IssmDouble DL_scalar; 6640 6695 GaussPenta *gauss=NULL; 6641 6696 … … 6669 6724 } 6670 6725 /*}}}*/ 6671 /*FUNCTION Penta::CreateKMatrixDiagnosticVertSurface {{{ 1*/6726 /*FUNCTION Penta::CreateKMatrixDiagnosticVertSurface {{{*/ 6672 6727 ElementMatrix* Penta::CreateKMatrixDiagnosticVertSurface(void){ 6673 6728 … … 6679 6734 /*Intermediaries */ 6680 6735 int i,j,ig; 6681 double xyz_list[NUMVERTICES][3];6682 double xyz_list_tria[NUMVERTICES2D][3];6683 double surface_normal[3];6684 double Jdet2d,DL_scalar;6685 double basis[NUMVERTICES];6736 IssmDouble xyz_list[NUMVERTICES][3]; 6737 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 6738 IssmDouble surface_normal[3]; 6739 IssmDouble Jdet2d,DL_scalar; 6740 IssmDouble basis[NUMVERTICES]; 6686 6741 GaussPenta *gauss=NULL; 6687 6742 … … 6716 6771 } 6717 6772 /*}}}*/ 6718 /*FUNCTION Penta::CreatePVectorCouplingMacAyealStokes {{{ 1*/6773 /*FUNCTION Penta::CreatePVectorCouplingMacAyealStokes {{{*/ 6719 6774 ElementVector* Penta::CreatePVectorCouplingMacAyealStokes(void){ 6720 6775 … … 6730 6785 } 6731 6786 /*}}}*/ 6732 /*FUNCTION Penta::CreatePVectorCouplingMacAyealStokesViscous {{{ 1*/6787 /*FUNCTION Penta::CreatePVectorCouplingMacAyealStokesViscous {{{*/ 6733 6788 ElementVector* Penta::CreatePVectorCouplingMacAyealStokesViscous(void){ 6734 6789 … … 6739 6794 int i,j,ig; 6740 6795 int approximation; 6741 double viscosity,Jdet;6742 double stokesreconditioning;6743 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/6744 double dw[3];6745 double xyz_list[NUMVERTICES][3];6746 double basis[6]; //for the six nodes of the penta6747 double dbasis[3][6]; //for the six nodes of the penta6796 IssmDouble viscosity,Jdet; 6797 IssmDouble stokesreconditioning; 6798 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 6799 IssmDouble dw[3]; 6800 IssmDouble xyz_list[NUMVERTICES][3]; 6801 IssmDouble basis[6]; //for the six nodes of the penta 6802 IssmDouble dbasis[3][6]; //for the six nodes of the penta 6748 6803 GaussPenta *gauss=NULL; 6749 6804 … … 6792 6847 } 6793 6848 /*}}}*/ 6794 /*FUNCTION Penta::CreatePVectorCouplingMacAyealStokesFriction{{{ 1*/6849 /*FUNCTION Penta::CreatePVectorCouplingMacAyealStokesFriction{{{*/ 6795 6850 ElementVector* Penta::CreatePVectorCouplingMacAyealStokesFriction(void){ 6796 6851 … … 6801 6856 int i,j,ig; 6802 6857 int approximation,analysis_type; 6803 double Jdet,Jdet2d;6804 double stokesreconditioning;6805 double bed_normal[3];6806 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/6807 double viscosity, w, alpha2_gauss;6808 double dw[3];6809 double xyz_list_tria[NUMVERTICES2D][3];6810 double xyz_list[NUMVERTICES][3];6811 double basis[6]; //for the six nodes of the penta6858 IssmDouble Jdet,Jdet2d; 6859 IssmDouble stokesreconditioning; 6860 IssmDouble bed_normal[3]; 6861 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 6862 IssmDouble viscosity, w, alpha2_gauss; 6863 IssmDouble dw[3]; 6864 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 6865 IssmDouble xyz_list[NUMVERTICES][3]; 6866 IssmDouble basis[6]; //for the six nodes of the penta 6812 6867 Tria* tria=NULL; 6813 6868 Friction* friction=NULL; … … 6867 6922 } 6868 6923 /*}}}*/ 6869 /*FUNCTION Penta::CreatePVectorCouplingPattynStokes {{{ 1*/6924 /*FUNCTION Penta::CreatePVectorCouplingPattynStokes {{{*/ 6870 6925 ElementVector* Penta::CreatePVectorCouplingPattynStokes(void){ 6871 6926 … … 6881 6936 } 6882 6937 /*}}}*/ 6883 /*FUNCTION Penta::CreatePVectorCouplingPattynStokesViscous {{{ 1*/6938 /*FUNCTION Penta::CreatePVectorCouplingPattynStokesViscous {{{*/ 6884 6939 ElementVector* Penta::CreatePVectorCouplingPattynStokesViscous(void){ 6885 6940 … … 6890 6945 int i,j,ig; 6891 6946 int approximation; 6892 double viscosity,Jdet;6893 double stokesreconditioning;6894 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/6895 double dw[3];6896 double xyz_list[NUMVERTICES][3];6897 double basis[6]; //for the six nodes of the penta6898 double dbasis[3][6]; //for the six nodes of the penta6947 IssmDouble viscosity,Jdet; 6948 IssmDouble stokesreconditioning; 6949 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 6950 IssmDouble dw[3]; 6951 IssmDouble xyz_list[NUMVERTICES][3]; 6952 IssmDouble basis[6]; //for the six nodes of the penta 6953 IssmDouble dbasis[3][6]; //for the six nodes of the penta 6899 6954 GaussPenta *gauss=NULL; 6900 6955 … … 6943 6998 } 6944 6999 /*}}}*/ 6945 /*FUNCTION Penta::CreatePVectorCouplingPattynStokesFriction{{{ 1*/7000 /*FUNCTION Penta::CreatePVectorCouplingPattynStokesFriction{{{*/ 6946 7001 ElementVector* Penta::CreatePVectorCouplingPattynStokesFriction(void){ 6947 7002 … … 6952 7007 int i,j,ig; 6953 7008 int approximation,analysis_type; 6954 double Jdet,Jdet2d;6955 double stokesreconditioning;6956 double bed_normal[3];6957 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/6958 double viscosity, w, alpha2_gauss;6959 double dw[3];6960 double xyz_list_tria[NUMVERTICES2D][3];6961 double xyz_list[NUMVERTICES][3];6962 double basis[6]; //for the six nodes of the penta7009 IssmDouble Jdet,Jdet2d; 7010 IssmDouble stokesreconditioning; 7011 IssmDouble bed_normal[3]; 7012 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 7013 IssmDouble viscosity, w, alpha2_gauss; 7014 IssmDouble dw[3]; 7015 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 7016 IssmDouble xyz_list[NUMVERTICES][3]; 7017 IssmDouble basis[6]; //for the six nodes of the penta 6963 7018 Tria* tria=NULL; 6964 7019 Friction* friction=NULL; … … 7018 7073 } 7019 7074 /*}}}*/ 7020 /*FUNCTION Penta::CreatePVectorDiagnosticHoriz{{{ 1*/7075 /*FUNCTION Penta::CreatePVectorDiagnosticHoriz{{{*/ 7021 7076 ElementVector* Penta::CreatePVectorDiagnosticHoriz(void){ 7022 7077 … … 7042 7097 return CreatePVectorDiagnosticPattynStokes(); 7043 7098 default: 7044 _error _("Approximation %s not supported yet",EnumToStringx(approximation));7045 } 7046 } 7047 /*}}}*/ 7048 /*FUNCTION Penta::CreatePVectorDiagnosticMacAyealPattyn{{{ 1*/7099 _error2_("Approximation " << EnumToStringx(approximation) << " not supported yet"); 7100 } 7101 } 7102 /*}}}*/ 7103 /*FUNCTION Penta::CreatePVectorDiagnosticMacAyealPattyn{{{*/ 7049 7104 ElementVector* Penta::CreatePVectorDiagnosticMacAyealPattyn(void){ 7050 7105 … … 7060 7115 } 7061 7116 /*}}}*/ 7062 /*FUNCTION Penta::CreatePVectorDiagnosticMacAyealStokes{{{ 1*/7117 /*FUNCTION Penta::CreatePVectorDiagnosticMacAyealStokes{{{*/ 7063 7118 ElementVector* Penta::CreatePVectorDiagnosticMacAyealStokes(void){ 7064 7119 … … 7076 7131 } 7077 7132 /*}}}*/ 7078 /*FUNCTION Penta::CreatePVectorDiagnosticPattynStokes{{{ 1*/7133 /*FUNCTION Penta::CreatePVectorDiagnosticPattynStokes{{{*/ 7079 7134 ElementVector* Penta::CreatePVectorDiagnosticPattynStokes(void){ 7080 7135 … … 7092 7147 } 7093 7148 /*}}}*/ 7094 /*FUNCTION Penta::CreatePVectorDiagnosticHutter{{{ 1*/7149 /*FUNCTION Penta::CreatePVectorDiagnosticHutter{{{*/ 7095 7150 ElementVector* Penta::CreatePVectorDiagnosticHutter(void){ 7096 7151 … … 7102 7157 int node0,node1; 7103 7158 int connectivity[2]; 7104 double Jdet;7105 double xyz_list[NUMVERTICES][3];7106 double xyz_list_segment[2][3];7107 double z_list[NUMVERTICES];7108 double z_segment[2],slope[2];7109 double slope2,constant_part;7110 double rho_ice,gravity,n,B;7111 double ub,vb,z_g,surface,thickness;7159 IssmDouble Jdet; 7160 IssmDouble xyz_list[NUMVERTICES][3]; 7161 IssmDouble xyz_list_segment[2][3]; 7162 IssmDouble z_list[NUMVERTICES]; 7163 IssmDouble z_segment[2],slope[2]; 7164 IssmDouble slope2,constant_part; 7165 IssmDouble rho_ice,gravity,n,B; 7166 IssmDouble ub,vb,z_g,surface,thickness; 7112 7167 GaussPenta* gauss=NULL; 7113 7168 … … 7157 7212 7158 7213 if (IsOnSurface()){ 7159 for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/( double)connectivity[1];7214 for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/(IssmDouble)connectivity[1]; 7160 7215 } 7161 7216 else{//connectivity is too large, should take only half on it 7162 for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight*2/( double)connectivity[1];7217 for(j=0;j<NDOF2;j++) pe->values[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight*2/(IssmDouble)connectivity[1]; 7163 7218 } 7164 7219 } … … 7167 7222 //Deal with lower surface 7168 7223 if (IsOnBed()){ 7169 constant_part=-1.58*pow(( double)10.0,-(double)10.0)*rho_ice*gravity*thickness;7224 constant_part=-1.58*pow((IssmDouble)10.0,-(IssmDouble)10.0)*rho_ice*gravity*thickness; 7170 7225 ub=constant_part*slope[0]; 7171 7226 vb=constant_part*slope[1]; 7172 7227 7173 pe->values[2*node0]+=ub/( double)connectivity[0];7174 pe->values[2*node0+1]+=vb/( double)connectivity[0];7228 pe->values[2*node0]+=ub/(IssmDouble)connectivity[0]; 7229 pe->values[2*node0+1]+=vb/(IssmDouble)connectivity[0]; 7175 7230 } 7176 7231 } … … 7180 7235 } 7181 7236 /*}}}*/ 7182 /*FUNCTION Penta::CreatePVectorDiagnosticMacAyeal{{{ 1*/7237 /*FUNCTION Penta::CreatePVectorDiagnosticMacAyeal{{{*/ 7183 7238 ElementVector* Penta::CreatePVectorDiagnosticMacAyeal(void){ 7184 7239 … … 7194 7249 } 7195 7250 /*}}}*/ 7196 /*FUNCTION Penta::CreatePVectorDiagnosticPattyn{{{ 1*/7251 /*FUNCTION Penta::CreatePVectorDiagnosticPattyn{{{*/ 7197 7252 ElementVector* Penta::CreatePVectorDiagnosticPattyn(void){ 7198 7253 … … 7202 7257 /*Intermediaries*/ 7203 7258 int i,j,ig; 7204 double Jdet;7205 double slope[3]; //do not put 2! this goes into GetInputDerivativeValue, which addresses slope[3] also!7206 double driving_stress_baseline,thickness;7207 double xyz_list[NUMVERTICES][3];7208 double basis[6];7259 IssmDouble Jdet; 7260 IssmDouble slope[3]; //do not put 2! this goes into GetInputDerivativeValue, which addresses slope[3] also! 7261 IssmDouble driving_stress_baseline,thickness; 7262 IssmDouble xyz_list[NUMVERTICES][3]; 7263 IssmDouble basis[6]; 7209 7264 GaussPenta *gauss=NULL; 7210 7265 … … 7242 7297 } 7243 7298 /*}}}*/ 7244 /*FUNCTION Penta::CreatePVectorDiagnosticStokes {{{ 1*/7299 /*FUNCTION Penta::CreatePVectorDiagnosticStokes {{{*/ 7245 7300 ElementVector* Penta::CreatePVectorDiagnosticStokes(void){ 7246 7301 … … 7256 7311 } 7257 7312 /*}}}*/ 7258 /*FUNCTION Penta::CreatePVectorDiagnosticStokesViscous {{{ 1*/7313 /*FUNCTION Penta::CreatePVectorDiagnosticStokesViscous {{{*/ 7259 7314 ElementVector* Penta::CreatePVectorDiagnosticStokesViscous(void){ 7260 7315 … … 7265 7320 int i,j,ig; 7266 7321 int approximation; 7267 double Jdet,viscosity;7268 double gravity,rho_ice,stokesreconditioning;7269 double xyz_list[NUMVERTICES][3];7270 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/7271 double l1l7[7]; //for the six nodes and the bubble7272 double B[8][numdofbubble];7273 double B_prime[8][numdofbubble];7274 double B_prime_bubble[8][3];7275 double D[8][8]={0.0};7276 double D_scalar;7277 double Pe_gaussian[numdofbubble]={0.0}; //for the six nodes and the bubble7278 double Ke_temp[numdofbubble][3]={0.0}; //for the six nodes and the bubble7279 double Ke_gaussian[numdofbubble][3];7322 IssmDouble Jdet,viscosity; 7323 IssmDouble gravity,rho_ice,stokesreconditioning; 7324 IssmDouble xyz_list[NUMVERTICES][3]; 7325 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 7326 IssmDouble l1l7[7]; //for the six nodes and the bubble 7327 IssmDouble B[8][numdofbubble]; 7328 IssmDouble B_prime[8][numdofbubble]; 7329 IssmDouble B_prime_bubble[8][3]; 7330 IssmDouble D[8][8]={0.0}; 7331 IssmDouble D_scalar; 7332 IssmDouble Pe_gaussian[numdofbubble]={0.0}; //for the six nodes and the bubble 7333 IssmDouble Ke_temp[numdofbubble][3]={0.0}; //for the six nodes and the bubble 7334 IssmDouble Ke_gaussian[numdofbubble][3]; 7280 7335 GaussPenta *gauss=NULL; 7281 7336 … … 7336 7391 } 7337 7392 /*}}}*/ 7338 /*FUNCTION Penta::CreatePVectorDiagnosticStokesShelf{{{ 1*/7393 /*FUNCTION Penta::CreatePVectorDiagnosticStokesShelf{{{*/ 7339 7394 ElementVector* Penta::CreatePVectorDiagnosticStokesShelf(void){ 7340 7395 … … 7342 7397 int i,j,ig; 7343 7398 int approximation,shelf_dampening; 7344 double gravity,rho_water,bed,water_pressure;7345 double damper,normal_vel,vx,vy,vz,dt;7346 double xyz_list_tria[NUMVERTICES2D][3];7347 double xyz_list[NUMVERTICES][3];7348 double bed_normal[3];7349 double dz[3];7350 double basis[6]; //for the six nodes of the penta7351 double Jdet2d;7399 IssmDouble gravity,rho_water,bed,water_pressure; 7400 IssmDouble damper,normal_vel,vx,vy,vz,dt; 7401 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 7402 IssmDouble xyz_list[NUMVERTICES][3]; 7403 IssmDouble bed_normal[3]; 7404 IssmDouble dz[3]; 7405 IssmDouble basis[6]; //for the six nodes of the penta 7406 IssmDouble Jdet2d; 7352 7407 GaussPenta *gauss=NULL; 7353 7408 … … 7404 7459 } 7405 7460 /*}}}*/ 7406 /*FUNCTION Penta::CreatePVectorDiagnosticVert {{{ 1*/7461 /*FUNCTION Penta::CreatePVectorDiagnosticVert {{{*/ 7407 7462 ElementVector* Penta::CreatePVectorDiagnosticVert(void){ 7408 7463 … … 7418 7473 } 7419 7474 /*}}}*/ 7420 /*FUNCTION Penta::CreatePVectorDiagnosticVertVolume {{{ 1*/7475 /*FUNCTION Penta::CreatePVectorDiagnosticVertVolume {{{*/ 7421 7476 ElementVector* Penta::CreatePVectorDiagnosticVertVolume(void){ 7422 7477 … … 7427 7482 int i,ig; 7428 7483 int approximation; 7429 double Jdet;7430 double xyz_list[NUMVERTICES][3];7431 double dudx,dvdy,dwdz;7432 double du[3],dv[3],dw[3];7433 double basis[6];7484 IssmDouble Jdet; 7485 IssmDouble xyz_list[NUMVERTICES][3]; 7486 IssmDouble dudx,dvdy,dwdz; 7487 IssmDouble du[3],dv[3],dw[3]; 7488 IssmDouble basis[6]; 7434 7489 GaussPenta *gauss=NULL; 7435 7490 … … 7474 7529 } 7475 7530 /*}}}*/ 7476 /*FUNCTION Penta::CreatePVectorDiagnosticVertBase {{{ 1*/7531 /*FUNCTION Penta::CreatePVectorDiagnosticVertBase {{{*/ 7477 7532 ElementVector* Penta::CreatePVectorDiagnosticVertBase(void){ 7478 7533 … … 7484 7539 int i,j,ig; 7485 7540 int approximation; 7486 double xyz_list[NUMVERTICES][3];7487 double xyz_list_tria[NUMVERTICES2D][3];7488 double Jdet2d;7489 double vx,vy,vz,dbdx,dbdy,basalmeltingvalue;7490 double slope[3];7491 double basis[NUMVERTICES];7541 IssmDouble xyz_list[NUMVERTICES][3]; 7542 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 7543 IssmDouble Jdet2d; 7544 IssmDouble vx,vy,vz,dbdx,dbdy,basalmeltingvalue; 7545 IssmDouble slope[3]; 7546 IssmDouble basis[NUMVERTICES]; 7492 7547 GaussPenta* gauss=NULL; 7493 7548 … … 7539 7594 } 7540 7595 /*}}}*/ 7541 /*FUNCTION Penta::CreateJacobianDiagnosticHoriz{{{ 1*/7596 /*FUNCTION Penta::CreateJacobianDiagnosticHoriz{{{*/ 7542 7597 ElementMatrix* Penta::CreateJacobianDiagnosticHoriz(void){ 7543 7598 … … 7555 7610 return NULL; 7556 7611 default: 7557 _error _("Approximation %s not supported yet",EnumToStringx(approximation));7558 } 7559 } 7560 /*}}}*/ 7561 /*FUNCTION Penta::CreateJacobianDiagnosticMacayeal2d{{{ 1*/7612 _error2_("Approximation " << EnumToStringx(approximation) << " not supported yet"); 7613 } 7614 } 7615 /*}}}*/ 7616 /*FUNCTION Penta::CreateJacobianDiagnosticMacayeal2d{{{*/ 7562 7617 ElementMatrix* Penta::CreateJacobianDiagnosticMacayeal2d(void){ 7563 7618 … … 7582 7637 } 7583 7638 /*}}}*/ 7584 /*FUNCTION Penta::CreateJacobianDiagnosticPattyn{{{ 1*/7639 /*FUNCTION Penta::CreateJacobianDiagnosticPattyn{{{*/ 7585 7640 ElementMatrix* Penta::CreateJacobianDiagnosticPattyn(void){ 7586 7641 … … 7590 7645 /*Intermediaries */ 7591 7646 int i,j,ig; 7592 double xyz_list[NUMVERTICES][3];7593 double Jdet;7594 double eps1dotdphii,eps1dotdphij;7595 double eps2dotdphii,eps2dotdphij;7596 double mu_prime;7597 double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/7598 double eps1[3],eps2[3];7599 double phi[NUMVERTICES];7600 double dphi[3][NUMVERTICES];7647 IssmDouble xyz_list[NUMVERTICES][3]; 7648 IssmDouble Jdet; 7649 IssmDouble eps1dotdphii,eps1dotdphij; 7650 IssmDouble eps2dotdphii,eps2dotdphij; 7651 IssmDouble mu_prime; 7652 IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 7653 IssmDouble eps1[3],eps2[3]; 7654 IssmDouble phi[NUMVERTICES]; 7655 IssmDouble dphi[3][NUMVERTICES]; 7601 7656 GaussPenta *gauss=NULL; 7602 7657 … … 7647 7702 } 7648 7703 /*}}}*/ 7649 /*FUNCTION Penta::CreateJacobianDiagnosticStokes{{{ 1*/7704 /*FUNCTION Penta::CreateJacobianDiagnosticStokes{{{*/ 7650 7705 ElementMatrix* Penta::CreateJacobianDiagnosticStokes(void){ 7651 7706 … … 7655 7710 /*Intermediaries */ 7656 7711 int i,j,ig; 7657 double xyz_list[NUMVERTICES][3];7658 double Jdet;7659 double eps1dotdphii,eps1dotdphij;7660 double eps2dotdphii,eps2dotdphij;7661 double eps3dotdphii,eps3dotdphij;7662 double mu_prime;7663 double epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/7664 double eps1[3],eps2[3],eps3[3];7665 double phi[NUMVERTICES];7666 double dphi[3][NUMVERTICES];7712 IssmDouble xyz_list[NUMVERTICES][3]; 7713 IssmDouble Jdet; 7714 IssmDouble eps1dotdphii,eps1dotdphij; 7715 IssmDouble eps2dotdphii,eps2dotdphij; 7716 IssmDouble eps3dotdphii,eps3dotdphij; 7717 IssmDouble mu_prime; 7718 IssmDouble epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/ 7719 IssmDouble eps1[3],eps2[3],eps3[3]; 7720 IssmDouble phi[NUMVERTICES]; 7721 IssmDouble dphi[3][NUMVERTICES]; 7667 7722 GaussPenta *gauss=NULL; 7668 7723 … … 7723 7778 } 7724 7779 /*}}}*/ 7725 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticHoriz{{{ 1*/7780 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticHoriz{{{*/ 7726 7781 void Penta::GetSolutionFromInputsDiagnosticHoriz(Vector* solution){ 7727 7782 … … 7731 7786 int approximation; 7732 7787 int* doflist=NULL; 7733 double vx,vy;7734 double values[numdof];7788 IssmDouble vx,vy; 7789 IssmDouble values[numdof]; 7735 7790 GaussPenta* gauss; 7736 7791 … … 7762 7817 /*Free ressources:*/ 7763 7818 delete gauss; 7764 x free((void**)&doflist);7765 } 7766 /*}}}*/ 7767 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticHutter{{{ 1*/7819 xDelete<int>(doflist); 7820 } 7821 /*}}}*/ 7822 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticHutter{{{*/ 7768 7823 void Penta::GetSolutionFromInputsDiagnosticHutter(Vector* solution){ 7769 7824 … … 7772 7827 int i; 7773 7828 int* doflist=NULL; 7774 double vx,vy;7775 double values[numdof];7829 IssmDouble vx,vy; 7830 IssmDouble values[numdof]; 7776 7831 GaussPenta* gauss=NULL; 7777 7832 … … 7798 7853 /*Free ressources:*/ 7799 7854 delete gauss; 7800 x free((void**)&doflist);7801 } 7802 /*}}}*/ 7803 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticVert{{{ 1*/7855 xDelete<int>(doflist); 7856 } 7857 /*}}}*/ 7858 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticVert{{{*/ 7804 7859 void Penta::GetSolutionFromInputsDiagnosticVert(Vector* solution){ 7805 7860 … … 7808 7863 int i; 7809 7864 int* doflist=NULL; 7810 double vz;7811 double values[numdof];7865 IssmDouble vz; 7866 IssmDouble values[numdof]; 7812 7867 GaussPenta* gauss=NULL; 7813 7868 … … 7831 7886 /*Free ressources:*/ 7832 7887 delete gauss; 7833 x free((void**)&doflist);7834 } 7835 /*}}}*/ 7836 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticStokes{{{ 1*/7888 xDelete<int>(doflist); 7889 } 7890 /*}}}*/ 7891 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticStokes{{{*/ 7837 7892 void Penta::GetSolutionFromInputsDiagnosticStokes(Vector* solution){ 7838 7893 … … 7841 7896 int i; 7842 7897 int* doflist=NULL; 7843 double vx,vy,vz,p;7844 double stokesreconditioning;7845 double values[numdof];7898 IssmDouble vx,vy,vz,p; 7899 IssmDouble stokesreconditioning; 7900 IssmDouble values[numdof]; 7846 7901 GaussPenta *gauss; 7847 7902 … … 7876 7931 /*Free ressources:*/ 7877 7932 delete gauss; 7878 x free((void**)&doflist);7879 } 7880 /*}}}*/ 7881 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHoriz {{{ 1*/7882 void Penta::InputUpdateFromSolutionDiagnosticHoriz( double* solution){7933 xDelete<int>(doflist); 7934 } 7935 /*}}}*/ 7936 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHoriz {{{*/ 7937 void Penta::InputUpdateFromSolutionDiagnosticHoriz(IssmDouble* solution){ 7883 7938 7884 7939 int approximation; … … 7915 7970 } 7916 7971 /*}}}*/ 7917 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyeal {{{ 1*/7918 void Penta::InputUpdateFromSolutionDiagnosticMacAyeal( double* solution){7972 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyeal {{{*/ 7973 void Penta::InputUpdateFromSolutionDiagnosticMacAyeal(IssmDouble* solution){ 7919 7974 7920 7975 const int numdof=NDOF2*NUMVERTICES; 7921 7976 7922 7977 int i; 7923 double rho_ice,g;7924 double values[numdof];7925 double vx[NUMVERTICES];7926 double vy[NUMVERTICES];7927 double vz[NUMVERTICES];7928 double vel[NUMVERTICES];7929 double pressure[NUMVERTICES];7930 double surface[NUMVERTICES];7931 double xyz_list[NUMVERTICES][3];7978 IssmDouble rho_ice,g; 7979 IssmDouble values[numdof]; 7980 IssmDouble vx[NUMVERTICES]; 7981 IssmDouble vy[NUMVERTICES]; 7982 IssmDouble vz[NUMVERTICES]; 7983 IssmDouble vel[NUMVERTICES]; 7984 IssmDouble pressure[NUMVERTICES]; 7985 IssmDouble surface[NUMVERTICES]; 7986 IssmDouble xyz_list[NUMVERTICES][3]; 7932 7987 int *doflist = NULL; 7933 7988 Penta *penta = NULL; … … 7950 8005 7951 8006 /*Check solution*/ 7952 if( isnan(vx[i])) _error_("NaN found in solution vector");7953 if( isnan(vy[i])) _error_("NaN found in solution vector");8007 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8008 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 7954 8009 } 7955 8010 … … 7993 8048 7994 8049 /*Free ressources:*/ 7995 x free((void**)&doflist);7996 } 7997 /*}}}*/ 7998 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn {{{ 1*/7999 void Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn( double* solution){8050 xDelete<int>(doflist); 8051 } 8052 /*}}}*/ 8053 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn {{{*/ 8054 void Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn(IssmDouble* solution){ 8000 8055 8001 8056 const int numdof=NDOF2*NUMVERTICES; … … 8003 8058 8004 8059 int i; 8005 double rho_ice,g;8006 double macayeal_values[numdof];8007 double pattyn_values[numdof];8008 double vx[NUMVERTICES];8009 double vy[NUMVERTICES];8010 double vz[NUMVERTICES];8011 double vel[NUMVERTICES];8012 double pressure[NUMVERTICES];8013 double surface[NUMVERTICES];8014 double xyz_list[NUMVERTICES][3];8060 IssmDouble rho_ice,g; 8061 IssmDouble macayeal_values[numdof]; 8062 IssmDouble pattyn_values[numdof]; 8063 IssmDouble vx[NUMVERTICES]; 8064 IssmDouble vy[NUMVERTICES]; 8065 IssmDouble vz[NUMVERTICES]; 8066 IssmDouble vel[NUMVERTICES]; 8067 IssmDouble pressure[NUMVERTICES]; 8068 IssmDouble surface[NUMVERTICES]; 8069 IssmDouble xyz_list[NUMVERTICES][3]; 8015 8070 int* doflistp = NULL; 8016 8071 int* doflistm = NULL; … … 8048 8103 8049 8104 /*Check solution*/ 8050 if( isnan(vx[i])) _error_("NaN found in solution vector");8051 if( isnan(vy[i])) _error_("NaN found in solution vector");8105 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8106 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 8052 8107 } 8053 8108 … … 8076 8131 8077 8132 /*Free ressources:*/ 8078 x free((void**)&doflistp);8079 x free((void**)&doflistm);8080 } 8081 /*}}}*/ 8082 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes {{{ 1*/8083 void Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes( double* solution){8133 xDelete<int>(doflistp); 8134 xDelete<int>(doflistm); 8135 } 8136 /*}}}*/ 8137 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes {{{*/ 8138 void Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes(IssmDouble* solution){ 8084 8139 8085 8140 const int numdofm=NDOF2*NUMVERTICES; … … 8088 8143 8089 8144 int i; 8090 double stokesreconditioning;8091 double macayeal_values[numdofm];8092 double stokes_values[numdofs];8093 double vx[NUMVERTICES];8094 double vy[NUMVERTICES];8095 double vz[NUMVERTICES];8096 double vzmacayeal[NUMVERTICES];8097 double vzstokes[NUMVERTICES];8098 double vel[NUMVERTICES];8099 double pressure[NUMVERTICES];8100 double xyz_list[NUMVERTICES][3];8145 IssmDouble stokesreconditioning; 8146 IssmDouble macayeal_values[numdofm]; 8147 IssmDouble stokes_values[numdofs]; 8148 IssmDouble vx[NUMVERTICES]; 8149 IssmDouble vy[NUMVERTICES]; 8150 IssmDouble vz[NUMVERTICES]; 8151 IssmDouble vzmacayeal[NUMVERTICES]; 8152 IssmDouble vzstokes[NUMVERTICES]; 8153 IssmDouble vel[NUMVERTICES]; 8154 IssmDouble pressure[NUMVERTICES]; 8155 IssmDouble xyz_list[NUMVERTICES][3]; 8101 8156 int* doflistm = NULL; 8102 8157 int* doflists = NULL; … … 8136 8191 8137 8192 /*Check solution*/ 8138 if( isnan(vx[i])) _error_("NaN found in solution vector");8139 if( isnan(vy[i])) _error_("NaN found in solution vector");8140 if( isnan(vzstokes[i])) _error_("NaN found in solution vector");8141 if( isnan(pressure[i])) _error_("NaN found in solution vector");8193 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8194 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 8195 if(xIsNan<IssmDouble>(vzstokes[i])) _error2_("NaN found in solution vector"); 8196 if(xIsNan<IssmDouble>(pressure[i])) _error2_("NaN found in solution vector"); 8142 8197 } 8143 8198 … … 8146 8201 if (vzmacayeal_input){ 8147 8202 if (vzmacayeal_input->ObjectEnum()!=PentaP1InputEnum){ 8148 _error _("Cannot compute Vel as VzMacAyeal is of type %s",EnumToStringx(vzmacayeal_input->ObjectEnum()));8203 _error2_("Cannot compute Vel as VzMacAyeal is of type " << EnumToStringx(vzmacayeal_input->ObjectEnum())); 8149 8204 } 8150 8205 GetInputListOnVertices(&vzmacayeal[0],VzMacAyealEnum); 8151 8206 } 8152 8207 else{ 8153 _error _("Cannot update solution as VzMacAyeal is not present");8208 _error2_("Cannot update solution as VzMacAyeal is not present"); 8154 8209 } 8155 8210 … … 8176 8231 8177 8232 /*Free ressources:*/ 8178 x free((void**)&doflistm);8179 x free((void**)&doflists);8180 } 8181 /*}}}*/ 8182 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattyn {{{ 1*/8183 void Penta::InputUpdateFromSolutionDiagnosticPattyn( double* solution){8233 xDelete<int>(doflistm); 8234 xDelete<int>(doflists); 8235 } 8236 /*}}}*/ 8237 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattyn {{{*/ 8238 void Penta::InputUpdateFromSolutionDiagnosticPattyn(IssmDouble* solution){ 8184 8239 8185 8240 const int numdof=NDOF2*NUMVERTICES; 8186 8241 8187 8242 int i; 8188 double rho_ice,g;8189 double values[numdof];8190 double vx[NUMVERTICES];8191 double vy[NUMVERTICES];8192 double vz[NUMVERTICES];8193 double vel[NUMVERTICES];8194 double pressure[NUMVERTICES];8195 double surface[NUMVERTICES];8196 double xyz_list[NUMVERTICES][3];8243 IssmDouble rho_ice,g; 8244 IssmDouble values[numdof]; 8245 IssmDouble vx[NUMVERTICES]; 8246 IssmDouble vy[NUMVERTICES]; 8247 IssmDouble vz[NUMVERTICES]; 8248 IssmDouble vel[NUMVERTICES]; 8249 IssmDouble pressure[NUMVERTICES]; 8250 IssmDouble surface[NUMVERTICES]; 8251 IssmDouble xyz_list[NUMVERTICES][3]; 8197 8252 int* doflist = NULL; 8198 8253 … … 8215 8270 8216 8271 /*Check solution*/ 8217 if( isnan(vx[i])) _error_("NaN found in solution vector");8218 if( isnan(vy[i])) _error_("NaN found in solution vector");8272 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8273 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 8219 8274 } 8220 8275 … … 8251 8306 8252 8307 /*Free ressources:*/ 8253 x free((void**)&doflist);8254 } 8255 /*}}}*/ 8256 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{ 1*/8257 void Penta::InputUpdateFromSolutionDiagnosticPattynStokes( double* solution){8308 xDelete<int>(doflist); 8309 } 8310 /*}}}*/ 8311 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{*/ 8312 void Penta::InputUpdateFromSolutionDiagnosticPattynStokes(IssmDouble* solution){ 8258 8313 8259 8314 const int numdofp=NDOF2*NUMVERTICES; … … 8261 8316 8262 8317 int i; 8263 double pattyn_values[numdofp];8264 double stokes_values[numdofs];8265 double vx[NUMVERTICES];8266 double vy[NUMVERTICES];8267 double vz[NUMVERTICES];8268 double vzpattyn[NUMVERTICES];8269 double vzstokes[NUMVERTICES];8270 double vel[NUMVERTICES];8271 double pressure[NUMVERTICES];8272 double xyz_list[NUMVERTICES][3];8273 double stokesreconditioning;8318 IssmDouble pattyn_values[numdofp]; 8319 IssmDouble stokes_values[numdofs]; 8320 IssmDouble vx[NUMVERTICES]; 8321 IssmDouble vy[NUMVERTICES]; 8322 IssmDouble vz[NUMVERTICES]; 8323 IssmDouble vzpattyn[NUMVERTICES]; 8324 IssmDouble vzstokes[NUMVERTICES]; 8325 IssmDouble vel[NUMVERTICES]; 8326 IssmDouble pressure[NUMVERTICES]; 8327 IssmDouble xyz_list[NUMVERTICES][3]; 8328 IssmDouble stokesreconditioning; 8274 8329 int* doflistp = NULL; 8275 8330 int* doflists = NULL; … … 8304 8359 8305 8360 /*Check solution*/ 8306 if( isnan(vx[i])) _error_("NaN found in solution vector");8307 if( isnan(vy[i])) _error_("NaN found in solution vector");8308 if( isnan(vzstokes[i])) _error_("NaN found in solution vector");8309 if( isnan(pressure[i])) _error_("NaN found in solution vector");8361 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8362 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 8363 if(xIsNan<IssmDouble>(vzstokes[i])) _error2_("NaN found in solution vector"); 8364 if(xIsNan<IssmDouble>(pressure[i])) _error2_("NaN found in solution vector"); 8310 8365 } 8311 8366 … … 8314 8369 if (vzpattyn_input){ 8315 8370 if (vzpattyn_input->ObjectEnum()!=PentaP1InputEnum){ 8316 _error _("Cannot compute Vel as VzPattyn is of type %s",EnumToStringx(vzpattyn_input->ObjectEnum()));8371 _error2_("Cannot compute Vel as VzPattyn is of type " << EnumToStringx(vzpattyn_input->ObjectEnum())); 8317 8372 } 8318 8373 GetInputListOnVertices(&vzpattyn[0],VzPattynEnum); 8319 8374 } 8320 8375 else{ 8321 _error _("Cannot update solution as VzPattyn is not present");8376 _error2_("Cannot update solution as VzPattyn is not present"); 8322 8377 } 8323 8378 … … 8344 8399 8345 8400 /*Free ressources:*/ 8346 x free((void**)&doflistp);8347 x free((void**)&doflists);8348 } 8349 /*}}}*/ 8350 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{ 1*/8351 void Penta::InputUpdateFromSolutionDiagnosticHutter( double* solution){8401 xDelete<int>(doflistp); 8402 xDelete<int>(doflists); 8403 } 8404 /*}}}*/ 8405 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{*/ 8406 void Penta::InputUpdateFromSolutionDiagnosticHutter(IssmDouble* solution){ 8352 8407 8353 8408 const int numdof=NDOF2*NUMVERTICES; 8354 8409 8355 8410 int i; 8356 double rho_ice,g;8357 double values[numdof];8358 double vx[NUMVERTICES];8359 double vy[NUMVERTICES];8360 double vz[NUMVERTICES];8361 double vel[NUMVERTICES];8362 double pressure[NUMVERTICES];8363 double surface[NUMVERTICES];8364 double xyz_list[NUMVERTICES][3];8411 IssmDouble rho_ice,g; 8412 IssmDouble values[numdof]; 8413 IssmDouble vx[NUMVERTICES]; 8414 IssmDouble vy[NUMVERTICES]; 8415 IssmDouble vz[NUMVERTICES]; 8416 IssmDouble vel[NUMVERTICES]; 8417 IssmDouble pressure[NUMVERTICES]; 8418 IssmDouble surface[NUMVERTICES]; 8419 IssmDouble xyz_list[NUMVERTICES][3]; 8365 8420 int* doflist = NULL; 8366 8421 … … 8380 8435 8381 8436 /*Check solution*/ 8382 if( isnan(vx[i])) _error_("NaN found in solution vector");8383 if( isnan(vy[i])) _error_("NaN found in solution vector");8437 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8438 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 8384 8439 } 8385 8440 … … 8408 8463 8409 8464 /*Free ressources:*/ 8410 x free((void**)&doflist);8411 } 8412 /*}}}*/ 8413 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticVert {{{ 1*/8414 void Penta::InputUpdateFromSolutionDiagnosticVert( double* solution){8465 xDelete<int>(doflist); 8466 } 8467 /*}}}*/ 8468 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticVert {{{*/ 8469 void Penta::InputUpdateFromSolutionDiagnosticVert(IssmDouble* solution){ 8415 8470 8416 8471 const int numdof=NDOF1*NUMVERTICES; … … 8418 8473 int i; 8419 8474 int approximation; 8420 double rho_ice,g;8421 double values[numdof];8422 double vx[NUMVERTICES];8423 double vy[NUMVERTICES];8424 double vz[NUMVERTICES];8425 double vzmacayeal[NUMVERTICES];8426 double vzpattyn[NUMVERTICES];8427 double vzstokes[NUMVERTICES];8428 double vel[NUMVERTICES];8429 double pressure[NUMVERTICES];8430 double surface[NUMVERTICES];8431 double xyz_list[NUMVERTICES][3];8475 IssmDouble rho_ice,g; 8476 IssmDouble values[numdof]; 8477 IssmDouble vx[NUMVERTICES]; 8478 IssmDouble vy[NUMVERTICES]; 8479 IssmDouble vz[NUMVERTICES]; 8480 IssmDouble vzmacayeal[NUMVERTICES]; 8481 IssmDouble vzpattyn[NUMVERTICES]; 8482 IssmDouble vzstokes[NUMVERTICES]; 8483 IssmDouble vel[NUMVERTICES]; 8484 IssmDouble pressure[NUMVERTICES]; 8485 IssmDouble surface[NUMVERTICES]; 8486 IssmDouble xyz_list[NUMVERTICES][3]; 8432 8487 int* doflist = NULL; 8433 8488 … … 8449 8504 8450 8505 /*Check solution*/ 8451 if( isnan(vz[i])) _error_("NaN found in solution vector");8506 if(xIsNan<IssmDouble>(vz[i])) _error2_("NaN found in solution vector"); 8452 8507 } 8453 8508 … … 8460 8515 Input* vzstokes_input=inputs->GetInput(VzStokesEnum); 8461 8516 if (vzstokes_input){ 8462 if (vzstokes_input->ObjectEnum()!=PentaP1InputEnum) _error _("Cannot compute Vel as VzStokes is of type %s",EnumToStringx(vzstokes_input->ObjectEnum()));8517 if (vzstokes_input->ObjectEnum()!=PentaP1InputEnum) _error2_("Cannot compute Vel as VzStokes is of type " << EnumToStringx(vzstokes_input->ObjectEnum())); 8463 8518 GetInputListOnVertices(&vzstokes[0],VzStokesEnum); 8464 8519 } 8465 else _error _("Cannot compute Vz as VzStokes in not present in PattynStokes element");8520 else _error2_("Cannot compute Vz as VzStokes in not present in PattynStokes element"); 8466 8521 for(i=0;i<NUMVERTICES;i++){ 8467 8522 vzpattyn[i]=vz[i]; … … 8472 8527 Input* vzstokes_input=inputs->GetInput(VzStokesEnum); 8473 8528 if (vzstokes_input){ 8474 if (vzstokes_input->ObjectEnum()!=PentaP1InputEnum) _error _("Cannot compute Vel as VzStokes is of type %s",EnumToStringx(vzstokes_input->ObjectEnum()));8529 if (vzstokes_input->ObjectEnum()!=PentaP1InputEnum) _error2_("Cannot compute Vel as VzStokes is of type " << EnumToStringx(vzstokes_input->ObjectEnum())); 8475 8530 GetInputListOnVertices(&vzstokes[0],VzStokesEnum); 8476 8531 } 8477 else _error _("Cannot compute Vz as VzStokes in not present in MacAyealStokes element");8532 else _error2_("Cannot compute Vz as VzStokes in not present in MacAyealStokes element"); 8478 8533 for(i=0;i<NUMVERTICES;i++){ 8479 8534 vzmacayeal[i]=vz[i]; … … 8512 8567 8513 8568 /*Free ressources:*/ 8514 x free((void**)&doflist);8515 } 8516 /*}}}*/ 8517 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticStokes {{{ 1*/8518 void Penta::InputUpdateFromSolutionDiagnosticStokes( double* solution){8569 xDelete<int>(doflist); 8570 } 8571 /*}}}*/ 8572 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticStokes {{{*/ 8573 void Penta::InputUpdateFromSolutionDiagnosticStokes(IssmDouble* solution){ 8519 8574 8520 8575 const int numdof=NDOF4*NUMVERTICES; 8521 8576 8522 8577 int i; 8523 double values[numdof];8524 double vx[NUMVERTICES];8525 double vy[NUMVERTICES];8526 double vz[NUMVERTICES];8527 double vel[NUMVERTICES];8528 double pressure[NUMVERTICES];8529 double stokesreconditioning;8578 IssmDouble values[numdof]; 8579 IssmDouble vx[NUMVERTICES]; 8580 IssmDouble vy[NUMVERTICES]; 8581 IssmDouble vz[NUMVERTICES]; 8582 IssmDouble vel[NUMVERTICES]; 8583 IssmDouble pressure[NUMVERTICES]; 8584 IssmDouble stokesreconditioning; 8530 8585 int* doflist=NULL; 8531 8586 … … 8547 8602 8548 8603 /*Check solution*/ 8549 if( isnan(vx[i])) _error_("NaN found in solution vector");8550 if( isnan(vy[i])) _error_("NaN found in solution vector");8551 if( isnan(vz[i])) _error_("NaN found in solution vector");8552 if( isnan(pressure[i])) _error_("NaN found in solution vector");8604 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 8605 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 8606 if(xIsNan<IssmDouble>(vz[i])) _error2_("NaN found in solution vector"); 8607 if(xIsNan<IssmDouble>(pressure[i])) _error2_("NaN found in solution vector"); 8553 8608 } 8554 8609 … … 8573 8628 8574 8629 /*Free ressources:*/ 8575 x free((void**)&doflist);8630 xDelete<int>(doflist); 8576 8631 } 8577 8632 /*}}}*/ … … 8579 8634 8580 8635 #ifdef _HAVE_BALANCED_ 8581 /*FUNCTION Penta::CreateKMatrixBalancethickness {{{ 1*/8636 /*FUNCTION Penta::CreateKMatrixBalancethickness {{{*/ 8582 8637 ElementMatrix* Penta::CreateKMatrixBalancethickness(void){ 8583 8638 … … 8604 8659 } 8605 8660 /*}}}*/ 8606 /*FUNCTION Penta::CreatePVectorBalancethickness {{{ 1*/8661 /*FUNCTION Penta::CreatePVectorBalancethickness {{{*/ 8607 8662 ElementVector* Penta::CreatePVectorBalancethickness(void){ 8608 8663 -
issm/trunk/src/c/objects/Elements/Penta.h
r12630 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Element.h" 11 11 #include "./PentaHook.h" … … 44 44 Results *results; 45 45 46 /*Penta constructors and destructor: {{{ 1*/46 /*Penta constructors and destructor: {{{*/ 47 47 Penta(); 48 48 Penta(int penta_id,int penta_sid,int i, IoModel* iomodel,int nummodels); 49 49 ~Penta(); 50 50 /*}}}*/ 51 /*Object virtual functions definitions: {{{ 1*/51 /*Object virtual functions definitions: {{{*/ 52 52 Object* copy(); 53 53 void DeepEcho(); … … 57 57 int MyRank(); 58 58 /*}}}*/ 59 /*Update virtual functions definitions: {{{ 1*/59 /*Update virtual functions definitions: {{{*/ 60 60 void InputUpdateFromConstant(bool constant, int name); 61 void InputUpdateFromConstant( double constant, int name);61 void InputUpdateFromConstant(IssmDouble constant, int name); 62 62 void InputUpdateFromConstant(int constant, int name); 63 void InputUpdateFromSolution( double* solutiong);63 void InputUpdateFromSolution(IssmDouble* solutiong); 64 64 void InputUpdateFromVector(bool* vector, int name, int type); 65 void InputUpdateFromVector( double* vector, int name, int type);65 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 66 66 void InputUpdateFromVector(int* vector, int name, int type); 67 67 #ifdef _HAVE_DAKOTA_ 68 68 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 69 void InputUpdateFromVectorDakota( double* vector, int name, int type);69 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 70 70 void InputUpdateFromVectorDakota(int* vector, int name, int type); 71 void InputUpdateFromMatrixDakota( double* matrix, int nows, int ncols, int name, int type);71 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type); 72 72 #endif 73 73 void InputUpdateFromIoModel(int index, IoModel* iomodel); 74 74 /*}}}*/ 75 /*Element virtual functions definitions: {{{ 1*/76 void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas, double* vertex_response,double* qmu_part);75 /*Element virtual functions definitions: {{{*/ 76 void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part); 77 77 void BasalFrictionCreateInput(void); 78 78 void ComputeBasalStress(Vector* sigma_b); … … 87 87 int GetNodeIndex(Node* node); 88 88 void GetSolutionFromInputs(Vector* solution); 89 double GetZcoord(GaussPenta* gauss);89 IssmDouble GetZcoord(GaussPenta* gauss); 90 90 void GetVectorFromInputs(Vector* vector,int name_enum); 91 91 void GetVectorFromResults(Vector* vector,int offset,int name_enum,int interp); 92 92 93 93 int Sid(); 94 void InputArtificialNoise(int enum_type, double min, double max);95 bool InputConvergence( double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums);96 void InputCreate( double scalar,int name,int code);97 void InputCreate( double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);94 void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max); 95 bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums); 96 void InputCreate(IssmDouble scalar,int name,int code); 97 void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 98 98 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum); 99 99 void InputDuplicate(int original_enum,int new_enum); 100 void InputScale(int enum_type, double scale_factor);100 void InputScale(int enum_type,IssmDouble scale_factor); 101 101 102 void InputToResult(int enum_type,int step, double time);103 void MigrateGroundingLine( double* old_floating_ice,double* sheet_ungrounding);102 void InputToResult(int enum_type,int step,IssmDouble time); 103 void MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding); 104 104 void PotentialSheetUngrounding(Vector* potential_sheet_ungrounding); 105 void RequestedOutput(int output_enum,int step, double time);106 void ListResultsInfo(int** results_enums,int** results_size, double** results_times,int** results_steps,int* num_results);105 void RequestedOutput(int output_enum,int step,IssmDouble time); 106 void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results); 107 107 void PatchFill(int* pcount, Patch* patch); 108 108 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 109 void PositiveDegreeDay( double* pdds,double* pds,double signorm);109 void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm); 110 110 void ProcessResultsUnits(void); 111 111 void ResetCoordinateSystem(void); 112 double SurfaceArea(void); 112 void SmbGradients(); 113 IssmDouble SurfaceArea(void); 113 114 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type); 114 int UpdatePotentialSheetUngrounding( double* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf);115 int NodalValue( double* pvalue, int index, int natureofdataenum,bool process_units);116 double TimeAdapt();115 int UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf); 116 int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units); 117 IssmDouble TimeAdapt(); 117 118 int* GetHorizontalNeighboorSids(void); 118 119 void ViscousHeatingCreateInput(void); 119 void SmearFunction(Vector* smearedvector, double (*WeightFunction)(double distance,double radius),double radius);120 void SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius); 120 121 121 122 #ifdef _HAVE_RESPONSES_ 122 double IceVolume(void);123 void MinVel( double* pminvel, bool process_units);124 void MinVx( double* pminvx, bool process_units);125 void MinVy( double* pminvy, bool process_units);126 void MinVz( double* pminvz, bool process_units);127 double MassFlux(double* segment,bool process_units);128 void MaxAbsVx( double* pmaxabsvx, bool process_units);129 void MaxAbsVy( double* pmaxabsvy, bool process_units);130 void MaxAbsVz( double* pmaxabsvz, bool process_units);131 void MaxVel( double* pmaxvel, bool process_units);132 void ElementResponse( double* presponse,int response_enum,bool process_units);133 void MaxVx( double* pmaxvx, bool process_units);134 void MaxVy( double* pmaxvy, bool process_units);135 void MaxVz( double* pmaxvz, bool process_units);123 IssmDouble IceVolume(void); 124 void MinVel(IssmDouble* pminvel, bool process_units); 125 void MinVx(IssmDouble* pminvx, bool process_units); 126 void MinVy(IssmDouble* pminvy, bool process_units); 127 void MinVz(IssmDouble* pminvz, bool process_units); 128 IssmDouble MassFlux(IssmDouble* segment,bool process_units); 129 void MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units); 130 void MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units); 131 void MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units); 132 void MaxVel(IssmDouble* pmaxvel, bool process_units); 133 void ElementResponse(IssmDouble* presponse,int response_enum,bool process_units); 134 void MaxVx(IssmDouble* pmaxvx, bool process_units); 135 void MaxVy(IssmDouble* pmaxvy, bool process_units); 136 void MaxVz(IssmDouble* pmaxvz, bool process_units); 136 137 #endif 137 138 138 139 #ifdef _HAVE_CONTROL_ 139 double DragCoefficientAbsGradient(bool process_units,int weight_index);140 IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index); 140 141 void GradientIndexing(int* indexing,int control_index); 141 142 void Gradj(Vector* gradient,int control_type,int control_index); … … 147 148 void GradjBbarStokes(Vector* gradient,int control_index); 148 149 void GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data); 149 void SetControlInputsFromVector( double* vector,int control_enum,int control_index);150 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index); 150 151 void ControlInputGetGradient(Vector* gradient,int enum_type,int control_index); 151 void ControlInputScaleGradient(int enum_type, double scale);152 void ControlInputSetGradient( double* gradient,int enum_type,int control_index);153 double RheologyBbarAbsGradient(bool process_units,int weight_index);154 double ThicknessAbsMisfit( bool process_units,int weight_index);155 double SurfaceAbsVelMisfit( bool process_units,int weight_index);156 double SurfaceRelVelMisfit( bool process_units,int weight_index);157 double SurfaceLogVelMisfit( bool process_units,int weight_index);158 double SurfaceLogVxVyMisfit( bool process_units,int weight_index);159 double SurfaceAverageVelMisfit(bool process_units,int weight_index);160 double ThicknessAbsGradient(bool process_units,int weight_index);161 void InputControlUpdate( double scalar,bool save_parameter);162 #endif 163 /*}}}*/ 164 /*Penta specific routines:{{{ 1*/165 void BedNormal( double* bed_normal, double xyz_list[3][3]);152 void ControlInputScaleGradient(int enum_type,IssmDouble scale); 153 void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index); 154 IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index); 155 IssmDouble ThicknessAbsMisfit( bool process_units,int weight_index); 156 IssmDouble SurfaceAbsVelMisfit( bool process_units,int weight_index); 157 IssmDouble SurfaceRelVelMisfit( bool process_units,int weight_index); 158 IssmDouble SurfaceLogVelMisfit( bool process_units,int weight_index); 159 IssmDouble SurfaceLogVxVyMisfit( bool process_units,int weight_index); 160 IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index); 161 IssmDouble ThicknessAbsGradient(bool process_units,int weight_index); 162 void InputControlUpdate(IssmDouble scalar,bool save_parameter); 163 #endif 164 /*}}}*/ 165 /*Penta specific routines:{{{*/ 166 void BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]); 166 167 ElementMatrix* CreateKMatrixPrognostic(void); 167 168 ElementMatrix* CreateKMatrixSlope(void); … … 173 174 void GetConnectivityList(int* connectivity); 174 175 int GetElementType(void); 175 void GetElementSizes( double* hx,double* hy,double* hz);176 void GetInputListOnVertices( double* pvalue,int enumtype);177 void GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue);178 void GetInputValue( double* pvalue,Node* node,int enumtype);179 void GetPhi( double* phi, double* epsilon, double viscosity);176 void GetElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz); 177 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype); 178 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue); 179 void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype); 180 void GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity); 180 181 void GetSolutionFromInputsEnthalpy(Vector* solutiong); 181 double GetStabilizationParameter(double u, double v, double w, double diameter, double kappa);182 void GetStrainRate3dPattyn( double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input);183 void GetStrainRate3d( double* epsilon,double* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input);182 IssmDouble GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa); 183 void GetStrainRate3dPattyn(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input); 184 void GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input, Input* vz_input); 184 185 Penta* GetUpperElement(void); 185 186 Penta* GetLowerElement(void); 186 187 Penta* GetBasalElement(void); 187 188 void InputExtrude(int enum_type,int object_type); 188 void InputUpdateFromSolutionPrognostic( double* solutiong);189 void InputUpdateFromSolutionOneDof( double* solutiong,int enum_type);190 void InputUpdateFromSolutionOneDofCollapsed( double* solutiong,int enum_type);189 void InputUpdateFromSolutionPrognostic(IssmDouble* solutiong); 190 void InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type); 191 void InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type); 191 192 bool IsInput(int name); 192 193 bool IsOnSurface(void); … … 194 195 bool IsFloating(void); 195 196 bool IsNodeOnShelf(); 196 bool IsNodeOnShelfFromFlags( double* flags);197 bool IsNodeOnShelfFromFlags(IssmDouble* flags); 197 198 bool IsOnWater(void); 198 double MinEdgeLength(double xyz_list[6][3]);199 void ReduceMatrixStokes( double* Ke_reduced, double* Ke_temp);200 void ReduceVectorStokes( double* Pe_reduced, double* Ke_temp, double* Pe_temp);199 IssmDouble MinEdgeLength(IssmDouble xyz_list[6][3]); 200 void ReduceMatrixStokes(IssmDouble* Ke_reduced, IssmDouble* Ke_temp); 201 void ReduceVectorStokes(IssmDouble* Pe_reduced, IssmDouble* Ke_temp, IssmDouble* Pe_temp); 201 202 void SetClone(int* minranks); 202 203 Tria* SpawnTria(int g0, int g1, int g2); 203 void SurfaceNormal( double* surface_normal, double xyz_list[3][3]);204 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]); 204 205 205 206 #ifdef _HAVE_DIAGNOSTIC_ … … 236 237 ElementMatrix* CreateJacobianDiagnosticPattyn(void); 237 238 ElementMatrix* CreateJacobianDiagnosticStokes(void); 238 void InputUpdateFromSolutionDiagnosticHoriz( double* solutiong);239 void InputUpdateFromSolutionDiagnosticMacAyeal( double* solutiong);240 void InputUpdateFromSolutionDiagnosticMacAyealPattyn( double* solutiong);241 void InputUpdateFromSolutionDiagnosticMacAyealStokes( double* solutiong);242 void InputUpdateFromSolutionDiagnosticPattyn( double* solutiong);243 void InputUpdateFromSolutionDiagnosticPattynStokes( double* solutiong);244 void InputUpdateFromSolutionDiagnosticHutter( double* solutiong);245 void InputUpdateFromSolutionDiagnosticVert( double* solutiong);246 void InputUpdateFromSolutionDiagnosticStokes( double* solutiong);239 void InputUpdateFromSolutionDiagnosticHoriz( IssmDouble* solutiong); 240 void InputUpdateFromSolutionDiagnosticMacAyeal( IssmDouble* solutiong); 241 void InputUpdateFromSolutionDiagnosticMacAyealPattyn( IssmDouble* solutiong); 242 void InputUpdateFromSolutionDiagnosticMacAyealStokes( IssmDouble* solutiong); 243 void InputUpdateFromSolutionDiagnosticPattyn( IssmDouble* solutiong); 244 void InputUpdateFromSolutionDiagnosticPattynStokes( IssmDouble* solutiong); 245 void InputUpdateFromSolutionDiagnosticHutter( IssmDouble* solutiong); 246 void InputUpdateFromSolutionDiagnosticVert( IssmDouble* solutiong); 247 void InputUpdateFromSolutionDiagnosticStokes( IssmDouble* solutiong); 247 248 void GetSolutionFromInputsDiagnosticHoriz(Vector* solutiong); 248 249 void GetSolutionFromInputsDiagnosticHutter(Vector* solutiong); … … 278 279 ElementVector* CreatePVectorAdjointPattyn(void); 279 280 ElementVector* CreatePVectorAdjointStokes(void); 280 void InputUpdateFromSolutionAdjointHoriz( double* solutiong);281 void InputUpdateFromSolutionAdjointStokes( double* solutiong);281 void InputUpdateFromSolutionAdjointHoriz( IssmDouble* solutiong); 282 void InputUpdateFromSolutionAdjointStokes( IssmDouble* solutiong); 282 283 #endif 283 284 … … 303 304 ElementVector* CreatePVectorThermalSheet(void); 304 305 void GetSolutionFromInputsThermal(Vector* solutiong); 305 void InputUpdateFromSolutionThermal( double* solutiong);306 void InputUpdateFromSolutionEnthalpy( double* solutiong);306 void InputUpdateFromSolutionThermal( IssmDouble* solutiong); 307 void InputUpdateFromSolutionEnthalpy( IssmDouble* solutiong); 307 308 #endif 308 309 #ifdef _HAVE_BALANCED_ -
issm/trunk/src/c/objects/Elements/PentaHook.cpp
r9725 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Object constructors and destructor*/ 23 /*FUNCTION PentaHook::PentaHook(){{{ 1*/23 /*FUNCTION PentaHook::PentaHook(){{{*/ 24 24 PentaHook::PentaHook(){ 25 25 numanalyses=UNDEF; … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION PentaHook::~PentaHook(){{{ 1*/32 /*FUNCTION PentaHook::~PentaHook(){{{*/ 33 33 PentaHook::~PentaHook(){ 34 34 … … 44 44 } 45 45 /*}}}*/ 46 /*FUNCTION PentaHook::PentaHook(int in_numanalyses,int matice_id, int matpar_id){{{ 1*/46 /*FUNCTION PentaHook::PentaHook(int in_numanalyses,int matice_id, int matpar_id){{{*/ 47 47 PentaHook::PentaHook(int in_numanalyses,int matice_id, IoModel* iomodel){ 48 48 … … 67 67 /*}}}*/ 68 68 69 /*FUNCTION PentaHook::SetHookNodes{{{ 1*/69 /*FUNCTION PentaHook::SetHookNodes{{{*/ 70 70 void PentaHook::SetHookNodes(int* node_ids,int analysis_counter){ 71 71 this->hnodes[analysis_counter]= new Hook(node_ids,6); … … 73 73 } 74 74 /*}}}*/ 75 /*FUNCTION PentaHook::InitHookNeighbors{{{ 1*/75 /*FUNCTION PentaHook::InitHookNeighbors{{{*/ 76 76 void PentaHook::InitHookNeighbors(int* element_ids){ 77 77 this->hneighbors=new Hook(element_ids,2); … … 79 79 } 80 80 /*}}}*/ 81 /*FUNCTION PentaHook::SpawnTriaHook{{{ 1*/81 /*FUNCTION PentaHook::SpawnTriaHook{{{*/ 82 82 void PentaHook::SpawnTriaHook(TriaHook* triahook,int* indices){ 83 83 -
issm/trunk/src/c/objects/Elements/PentaHook.h
r9356 r12706 19 19 Hook* hneighbors; // 2 elements, first down, second up 20 20 21 /*FUNCTION constructors, destructors {{{ 1*/21 /*FUNCTION constructors, destructors {{{*/ 22 22 PentaHook(); 23 23 PentaHook(int in_numanalyses,int matice_id, IoModel* iomodel); -
issm/trunk/src/c/objects/Elements/PentaRef.cpp
r10628 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 26 26 27 27 /*Object constructors and destructor*/ 28 /*FUNCTION PentaRef::PentaRef(){{{ 1*/28 /*FUNCTION PentaRef::PentaRef(){{{*/ 29 29 PentaRef::PentaRef(){ 30 30 this->element_type_list=NULL; 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION PentaRef::PentaRef(int* types,int nummodels){{{ 1*/33 /*FUNCTION PentaRef::PentaRef(int* types,int nummodels){{{*/ 34 34 PentaRef::PentaRef(const int nummodels){ 35 35 36 36 /*Only allocate pointer*/ 37 element_type_list= (int*)xmalloc(nummodels*sizeof(int));38 39 } 40 /*}}}*/ 41 /*FUNCTION PentaRef::~PentaRef(){{{ 1*/37 element_type_list=xNew<int>(nummodels); 38 39 } 40 /*}}}*/ 41 /*FUNCTION PentaRef::~PentaRef(){{{*/ 42 42 PentaRef::~PentaRef(){ 43 x free((void**)&element_type_list);43 xDelete<int>(element_type_list); 44 44 } 45 45 /*}}}*/ 46 46 47 47 /*Management*/ 48 /*FUNCTION PentaRef::SetElementType{{{ 1*/48 /*FUNCTION PentaRef::SetElementType{{{*/ 49 49 void PentaRef::SetElementType(int type,int type_counter){ 50 50 … … 57 57 58 58 /*Reference Element numerics*/ 59 /*FUNCTION PentaRef::GetBMacAyealPattyn {{{ 1*/60 void PentaRef::GetBMacAyealPattyn( double* B, double* xyz_list, GaussPenta* gauss){59 /*FUNCTION PentaRef::GetBMacAyealPattyn {{{*/ 60 void PentaRef::GetBMacAyealPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){ 61 61 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 62 62 * For node i, Bi can be expressed in the actual coordinate system … … 70 70 */ 71 71 72 double dbasis[3][NUMNODESP1];72 IssmDouble dbasis[3][NUMNODESP1]; 73 73 74 74 /*Get dbasis in actual coordinate system: */ … … 88 88 } 89 89 /*}}}*/ 90 /*FUNCTION PentaRef::GetBMacAyealStokes{{{ 1*/91 void PentaRef::GetBMacAyealStokes( double* B, double* xyz_list, GaussPenta* gauss){90 /*FUNCTION PentaRef::GetBMacAyealStokes{{{*/ 91 void PentaRef::GetBMacAyealStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){ 92 92 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 93 93 * For node i, Bi can be expressed in the actual coordinate system … … 103 103 104 104 int i; 105 double dh1dh7[3][NUMNODESMINI];106 double l1l6[NUMNODESP1];105 IssmDouble dh1dh7[3][NUMNODESMINI]; 106 IssmDouble l1l6[NUMNODESP1]; 107 107 108 108 /*Get dh1dh6 in actual coordinate system: */ … … 134 134 } 135 135 /*}}}*/ 136 /*FUNCTION PentaRef::GetBPattyn {{{ 1*/137 void PentaRef::GetBPattyn( double* B, double* xyz_list, GaussPenta* gauss){136 /*FUNCTION PentaRef::GetBPattyn {{{*/ 137 void PentaRef::GetBPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){ 138 138 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 139 139 * For node i, Bi can be expressed in the actual coordinate system … … 149 149 */ 150 150 151 double dbasis[3][NUMNODESP1];151 IssmDouble dbasis[3][NUMNODESP1]; 152 152 153 153 /*Get dbasis in actual coordinate system: */ … … 174 174 } 175 175 /*}}}*/ 176 /*FUNCTION PentaRef::GetBprimePattyn {{{ 1*/177 void PentaRef::GetBprimePattyn( double* B, double* xyz_list, GaussPenta* gauss_coord){176 /*FUNCTION PentaRef::GetBprimePattyn {{{*/ 177 void PentaRef::GetBprimePattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss_coord){ 178 178 /*Compute B prime matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF2. 179 179 * For node i, Bi can be expressed in the actual coordinate system … … 188 188 * We assume B has been allocated already, of size: 5x(NDOF2*NUMNODESP1) 189 189 */ 190 double dbasis[3][NUMNODESP1];190 IssmDouble dbasis[3][NUMNODESP1]; 191 191 192 192 /*Get dbasis in actual coordinate system: */ … … 212 212 } 213 213 /*}}}*/ 214 /*FUNCTION PentaRef::GetBprimeMacAyealStokes{{{ 1*/215 void PentaRef::GetBprimeMacAyealStokes( double* Bprime, double* xyz_list, GaussPenta* gauss){214 /*FUNCTION PentaRef::GetBprimeMacAyealStokes{{{*/ 215 void PentaRef::GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussPenta* gauss){ 216 216 /*Compute Bprime matrix. Bprime=[Bprime1 Bprime2 Bprime3 Bprime4 Bprime5 Bprime6] where Bprimei is of size 5*NDOF2. 217 217 * For node i, Bprimei can be expressed in the actual coordinate system … … 226 226 227 227 int i; 228 double dh1dh7[3][NUMNODESMINI];228 IssmDouble dh1dh7[3][NUMNODESMINI]; 229 229 230 230 /*Get dh1dh6 in actual coordinate system: */ … … 252 252 } 253 253 /*}}}*/ 254 /*FUNCTION PentaRef::GetBStokes {{{ 1*/255 void PentaRef::GetBStokes( double* B, double* xyz_list, GaussPenta* gauss){254 /*FUNCTION PentaRef::GetBStokes {{{*/ 255 void PentaRef::GetBStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){ 256 256 257 257 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 3*NDOF4. … … 271 271 int i; 272 272 273 double dh1dh7[3][NUMNODESMINI];274 double l1l6[NUMNODESP1];273 IssmDouble dh1dh7[3][NUMNODESMINI]; 274 IssmDouble l1l6[NUMNODESP1]; 275 275 276 276 /*Get dh1dh7 in actual coordinate system: */ … … 319 319 } 320 320 /*}}}*/ 321 /*FUNCTION PentaRef::GetBprimeStokes {{{ 1*/322 void PentaRef::GetBprimeStokes( double* B_prime, double* xyz_list, GaussPenta* gauss){321 /*FUNCTION PentaRef::GetBprimeStokes {{{*/ 322 void PentaRef::GetBprimeStokes(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss){ 323 323 /* Compute B' matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 324 324 * For node i, Bi' can be expressed in the actual coordinate system … … 338 338 339 339 int i; 340 double dh1dh7[3][NUMNODESMINI];341 double l1l6[NUMNODESP1];340 IssmDouble dh1dh7[3][NUMNODESMINI]; 341 IssmDouble l1l6[NUMNODESP1]; 342 342 343 343 /*Get dh1dh7 in actual coordinate system: */ … … 386 386 } 387 387 /*}}}*/ 388 /*FUNCTION PentaRef::GetBAdvec{{{ 1*/389 void PentaRef::GetBAdvec( double* B_advec, double* xyz_list, GaussPenta* gauss){388 /*FUNCTION PentaRef::GetBAdvec{{{*/ 389 void PentaRef::GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, GaussPenta* gauss){ 390 390 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 391 391 * For node i, Bi' can be expressed in the actual coordinate system … … 400 400 401 401 /*Same thing in the actual coordinate system: */ 402 double l1l6[6];402 IssmDouble l1l6[6]; 403 403 404 404 /*Get dh1dh2dh3 in actual coordinates system : */ … … 413 413 } 414 414 /*}}}*/ 415 /*FUNCTION PentaRef::GetBConduct{{{ 1*/416 void PentaRef::GetBConduct( double* B_conduct, double* xyz_list, GaussPenta* gauss){415 /*FUNCTION PentaRef::GetBConduct{{{*/ 416 void PentaRef::GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, GaussPenta* gauss){ 417 417 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 418 418 * For node i, Bi' can be expressed in the actual coordinate system … … 427 427 428 428 /*Same thing in the actual coordinate system: */ 429 double dh1dh6[3][NUMNODESP1];429 IssmDouble dh1dh6[3][NUMNODESP1]; 430 430 431 431 /*Get dh1dh2dh3 in actual coordinates system : */ … … 440 440 } 441 441 /*}}}*/ 442 /*FUNCTION PentaRef::GetBVert{{{ 1*/443 void PentaRef::GetBVert( double* B, double* xyz_list, GaussPenta* gauss){442 /*FUNCTION PentaRef::GetBVert{{{*/ 443 void PentaRef::GetBVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){ 444 444 /* Compute B matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz]; 445 445 where hi is the interpolation function for node i.*/ 446 446 447 447 int i; 448 double dh1dh6[3][NUMNODESP1];448 IssmDouble dh1dh6[3][NUMNODESP1]; 449 449 450 450 /*Get dh1dh6 in actual coordinate system: */ … … 458 458 } 459 459 /*}}}*/ 460 /*FUNCTION PentaRef::GetBprimeAdvec{{{ 1*/461 void PentaRef::GetBprimeAdvec( double* Bprime_advec, double* xyz_list, GaussPenta* gauss){460 /*FUNCTION PentaRef::GetBprimeAdvec{{{*/ 461 void PentaRef::GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, GaussPenta* gauss){ 462 462 /*Compute B matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size 5*NDOF1. 463 463 * For node i, Bi' can be expressed in the actual coordinate system … … 472 472 473 473 /*Same thing in the actual coordinate system: */ 474 double dh1dh6[3][NUMNODESP1];474 IssmDouble dh1dh6[3][NUMNODESP1]; 475 475 476 476 /*Get dh1dh2dh3 in actual coordinates system : */ … … 485 485 } 486 486 /*}}}*/ 487 /*FUNCTION PentaRef::GetBprimeVert{{{ 1*/488 void PentaRef::GetBprimeVert( double* B, double* xyz_list, GaussPenta* gauss){487 /*FUNCTION PentaRef::GetBprimeVert{{{*/ 488 void PentaRef::GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){ 489 489 /* Compute Bprime matrix. Bprime=[L1 L2 L3 L4 L5 L6] where Li is the nodal function for node i*/ 490 490 … … 493 493 } 494 494 /*}}}*/ 495 /*FUNCTION PentaRef::GetL{{{ 1*/496 void PentaRef::GetL( double* L, GaussPenta* gauss, int numdof){495 /*FUNCTION PentaRef::GetL{{{*/ 496 void PentaRef::GetL(IssmDouble* L, GaussPenta* gauss, int numdof){ 497 497 /*Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. 498 498 ** For node i, Li can be expressed in the actual coordinate system … … 509 509 510 510 int i; 511 double l1l6[6];511 IssmDouble l1l6[6]; 512 512 513 513 /*Get l1l6 in actual coordinate system: */ … … 530 530 } 531 531 /*}}}*/ 532 /*FUNCTION PentaRef::GetLStokes{{{ 1*/533 void PentaRef::GetLStokes( double* LStokes, GaussPenta* gauss){532 /*FUNCTION PentaRef::GetLStokes{{{*/ 533 void PentaRef::GetLStokes(IssmDouble* LStokes, GaussPenta* gauss){ 534 534 /* 535 535 * Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. … … 544 544 545 545 const int num_dof=4; 546 double l1l2l3[NUMNODESP1_2d];546 IssmDouble l1l2l3[NUMNODESP1_2d]; 547 547 548 548 /*Get l1l2l3 in actual coordinate system: */ … … 565 565 } 566 566 /*}}}*/ 567 /*FUNCTION PentaRef::GetLprimeStokes {{{ 1*/568 void PentaRef::GetLprimeStokes( double* LprimeStokes, double* xyz_list, GaussPenta* gauss){567 /*FUNCTION PentaRef::GetLprimeStokes {{{*/ 568 void PentaRef::GetLprimeStokes(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss){ 569 569 570 570 /* … … 606 606 int num_dof=4; 607 607 608 double l1l2l3[NUMNODESP1_2d];609 double dh1dh6[3][NUMNODESP1];608 IssmDouble l1l2l3[NUMNODESP1_2d]; 609 IssmDouble dh1dh6[3][NUMNODESP1]; 610 610 611 611 /*Get l1l2l3 in actual coordinate system: */ … … 677 677 } 678 678 /*}}}*/ 679 /*FUNCTION PentaRef::GetLMacAyealStokes {{{ 1*/680 void PentaRef::GetLMacAyealStokes( double* LStokes, GaussPenta* gauss){679 /*FUNCTION PentaRef::GetLMacAyealStokes {{{*/ 680 void PentaRef::GetLMacAyealStokes(IssmDouble* LStokes, GaussPenta* gauss){ 681 681 /* 682 682 * Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. … … 697 697 int num_dof=2; 698 698 699 double l1l2l3[NUMNODESP1_2d];699 IssmDouble l1l2l3[NUMNODESP1_2d]; 700 700 701 701 … … 727 727 } 728 728 /*}}}*/ 729 /*FUNCTION PentaRef::GetLprimeMacAyealStokes {{{ 1*/730 void PentaRef::GetLprimeMacAyealStokes( double* LprimeStokes, double* xyz_list, GaussPenta* gauss){729 /*FUNCTION PentaRef::GetLprimeMacAyealStokes {{{*/ 730 void PentaRef::GetLprimeMacAyealStokes(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss){ 731 731 732 732 /* … … 747 747 int num_dof=4; 748 748 749 double l1l2l3[NUMNODESP1_2d];750 double dh1dh6[3][NUMNODESP1];749 IssmDouble l1l2l3[NUMNODESP1_2d]; 750 IssmDouble dh1dh6[3][NUMNODESP1]; 751 751 752 752 /*Get l1l2l3 in actual coordinate system: */ … … 794 794 } 795 795 /*}}}*/ 796 /*FUNCTION PentaRef::GetLStokesMacAyeal {{{ 1*/797 void PentaRef::GetLStokesMacAyeal( double* LStokes, GaussPenta* gauss){796 /*FUNCTION PentaRef::GetLStokesMacAyeal {{{*/ 797 void PentaRef::GetLStokesMacAyeal(IssmDouble* LStokes, GaussPenta* gauss){ 798 798 /* 799 799 * Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. … … 810 810 int num_dof=4; 811 811 812 double l1l2l3[NUMNODESP1_2d];812 IssmDouble l1l2l3[NUMNODESP1_2d]; 813 813 814 814 … … 840 840 } 841 841 /*}}}*/ 842 /*FUNCTION PentaRef::GetLprimeStokesMacAyeal {{{ 1*/843 void PentaRef::GetLprimeStokesMacAyeal( double* LprimeStokes, double* xyz_list, GaussPenta* gauss){842 /*FUNCTION PentaRef::GetLprimeStokesMacAyeal {{{*/ 843 void PentaRef::GetLprimeStokesMacAyeal(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss){ 844 844 845 845 /* … … 856 856 int num_dof=2; 857 857 858 double l1l2l3[NUMNODESP1_2d];859 double dh1dh6[3][NUMNODESP1];858 IssmDouble l1l2l3[NUMNODESP1_2d]; 859 IssmDouble dh1dh6[3][NUMNODESP1]; 860 860 861 861 /*Get l1l2l3 in actual coordinate system: */ … … 879 879 } 880 880 /*}}}*/ 881 /*FUNCTION PentaRef::GetJacobian {{{ 1*/882 void PentaRef::GetJacobian( double* J, double* xyz_list,GaussPenta* gauss){881 /*FUNCTION PentaRef::GetJacobian {{{*/ 882 void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussPenta* gauss){ 883 883 884 884 int i,j; … … 887 887 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 888 888 889 double A1,A2,A3; //area coordinates890 double xi,eta,zi; //parametric coordinates891 892 double x1,x2,x3,x4,x5,x6;893 double y1,y2,y3,y4,y5,y6;894 double z1,z2,z3,z4,z5,z6;889 IssmDouble A1,A2,A3; //area coordinates 890 IssmDouble xi,eta,zi; //parametric coordinates 891 892 IssmDouble x1,x2,x3,x4,x5,x6; 893 IssmDouble y1,y2,y3,y4,y5,y6; 894 IssmDouble z1,z2,z3,z4,z5,z6; 895 895 896 896 /*Figure out xi,eta and zi (parametric coordinates), for this gaussian point: */ … … 938 938 } 939 939 /*}}}*/ 940 /*FUNCTION PentaRef::GetJacobianDeterminant {{{ 1*/941 void PentaRef::GetJacobianDeterminant( double* Jdet, double* xyz_list,GaussPenta* gauss){940 /*FUNCTION PentaRef::GetJacobianDeterminant {{{*/ 941 void PentaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss){ 942 942 /*On a penta, Jacobian varies according to coordinates. We need to get the Jacobian, and take 943 943 * the determinant of it: */ 944 double J[3][3];944 IssmDouble J[3][3]; 945 945 946 946 /*Get Jacobian*/ … … 949 949 /*Get Determinant*/ 950 950 Matrix3x3Determinant(Jdet,&J[0][0]); 951 if(*Jdet<0) _error _("negative jacobian determinant!");952 953 } 954 /*}}}*/ 955 /*FUNCTION PentaRef::GetTriaJacobianDeterminant{{{ 1*/956 void PentaRef::GetTriaJacobianDeterminant( double* Jdet, double* xyz_list,GaussPenta* gauss){951 if(*Jdet<0) _error2_("negative jacobian determinant!"); 952 953 } 954 /*}}}*/ 955 /*FUNCTION PentaRef::GetTriaJacobianDeterminant{{{*/ 956 void PentaRef::GetTriaJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss){ 957 957 /*The Jacobian determinant is constant over the element, discard the gaussian points. 958 958 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 959 959 960 double x1,x2,x3,y1,y2,y3,z1,z2,z3;960 IssmDouble x1,x2,x3,y1,y2,y3,z1,z2,z3; 961 961 962 962 x1=*(xyz_list+3*0+0); … … 972 972 /*Jdet = norm( AB ^ AC ) / (2 * area of the reference triangle), with areaRef=sqrt(3) */ 973 973 *Jdet=SQRT3/6.0*pow(pow(((y2-y1)*(z3-z1)-(z2-z1)*(y3-y1)),2.0)+pow(((z2-z1)*(x3-x1)-(x2-x1)*(z3-z1)),2.0)+pow(((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)),2.0),0.5); 974 if(*Jdet<0) _error _("negative jacobian determinant!");975 } 976 /*}}}*/ 977 /*FUNCTION PentaRef::GetSegmentJacobianDeterminant{{{ 1*/978 void PentaRef::GetSegmentJacobianDeterminant( double* Jdet, double* xyz_list,GaussPenta* gauss){974 if(*Jdet<0) _error2_("negative jacobian determinant!"); 975 } 976 /*}}}*/ 977 /*FUNCTION PentaRef::GetSegmentJacobianDeterminant{{{*/ 978 void PentaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss){ 979 979 /*The Jacobian determinant is constant over the element, discard the gaussian points. 980 980 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 981 981 982 double x1,x2,y1,y2,z1,z2;982 IssmDouble x1,x2,y1,y2,z1,z2; 983 983 984 984 x1=*(xyz_list+3*0+0); … … 990 990 991 991 *Jdet=1.0/2.0*sqrt(pow(x2-x1,2.) + pow(y2-y1,2.) + pow(z2-z1,2.)); 992 if(*Jdet<0) _error _("negative jacobian determinant!");993 994 } 995 /*}}}*/ 996 /*FUNCTION PentaRef::GetJacobianInvert {{{ 1*/997 void PentaRef::GetJacobianInvert( double* Jinv, double* xyz_list,GaussPenta* gauss){992 if(*Jdet<0) _error2_("negative jacobian determinant!"); 993 994 } 995 /*}}}*/ 996 /*FUNCTION PentaRef::GetJacobianInvert {{{*/ 997 void PentaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussPenta* gauss){ 998 998 999 999 /*Jacobian*/ 1000 double J[3][3];1000 IssmDouble J[3][3]; 1001 1001 1002 1002 /*Call Jacobian routine to get the jacobian:*/ … … 1007 1007 } 1008 1008 /*}}}*/ 1009 /*FUNCTION PentaRef::GetNodalFunctionsMINI{{{ 1*/1010 void PentaRef::GetNodalFunctionsMINI( double* l1l7, GaussPenta* gauss){1009 /*FUNCTION PentaRef::GetNodalFunctionsMINI{{{*/ 1010 void PentaRef::GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss){ 1011 1011 /*This routine returns the values of the nodal functions at the gaussian point.*/ 1012 1012 … … 1021 1021 } 1022 1022 /*}}}*/ 1023 /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivatives{{{ 1*/1024 void PentaRef::GetNodalFunctionsMINIDerivatives( double* dh1dh7,double* xyz_list, GaussPenta* gauss){1023 /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivatives{{{*/ 1024 void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, GaussPenta* gauss){ 1025 1025 1026 1026 /*This routine returns the values of the nodal functions derivatives (with respect to the … … 1028 1028 1029 1029 int i; 1030 double dh1dh7_ref[3][NUMNODESMINI];1031 double Jinv[3][3];1030 IssmDouble dh1dh7_ref[3][NUMNODESMINI]; 1031 IssmDouble Jinv[3][3]; 1032 1032 1033 1033 /*Get derivative values with respect to parametric coordinate system: */ … … 1052 1052 } 1053 1053 /*}}}*/ 1054 /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivativesReference{{{ 1*/1055 void PentaRef::GetNodalFunctionsMINIDerivativesReference( double* dl1dl7,GaussPenta* gauss){1054 /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivativesReference{{{*/ 1055 void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,GaussPenta* gauss){ 1056 1056 1057 1057 /*This routine returns the values of the nodal functions derivatives (with respect to the 1058 1058 * natural coordinate system) at the gaussian point. */ 1059 double r=gauss->coord2-gauss->coord1;1060 double s=-3.0/SQRT3*(gauss->coord1+gauss->coord2-2.0/3.0);1061 double zeta=gauss->coord4;1059 IssmDouble r=gauss->coord2-gauss->coord1; 1060 IssmDouble s=-3.0/SQRT3*(gauss->coord1+gauss->coord2-2.0/3.0); 1061 IssmDouble zeta=gauss->coord4; 1062 1062 1063 1063 /*First nodal function: */ … … 1098 1098 } 1099 1099 /*}}}*/ 1100 /*FUNCTION PentaRef::GetNodalFunctionsP1 {{{ 1*/1101 void PentaRef::GetNodalFunctionsP1( double* l1l6, GaussPenta* gauss){1100 /*FUNCTION PentaRef::GetNodalFunctionsP1 {{{*/ 1101 void PentaRef::GetNodalFunctionsP1(IssmDouble* l1l6, GaussPenta* gauss){ 1102 1102 /*This routine returns the values of the nodal functions at the gaussian point.*/ 1103 1103 … … 1111 1111 } 1112 1112 /*}}}*/ 1113 /*FUNCTION PentaRef::GetNodalFunctionsP1Derivatives {{{ 1*/1114 void PentaRef::GetNodalFunctionsP1Derivatives( double* dh1dh6,double* xyz_list, GaussPenta* gauss){1113 /*FUNCTION PentaRef::GetNodalFunctionsP1Derivatives {{{*/ 1114 void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, GaussPenta* gauss){ 1115 1115 1116 1116 /*This routine returns the values of the nodal functions derivatives (with respect to the 1117 1117 * actual coordinate system): */ 1118 double dh1dh6_ref[NDOF3][NUMNODESP1];1119 double Jinv[NDOF3][NDOF3];1118 IssmDouble dh1dh6_ref[NDOF3][NUMNODESP1]; 1119 IssmDouble Jinv[NDOF3][NDOF3]; 1120 1120 1121 1121 /*Get derivative values with respect to parametric coordinate system: */ … … 1140 1140 } 1141 1141 /*}}}*/ 1142 /*FUNCTION PentaRef::GetNodalFunctionsP1DerivativesReference {{{ 1*/1143 void PentaRef::GetNodalFunctionsP1DerivativesReference( double* dl1dl6,GaussPenta* gauss){1142 /*FUNCTION PentaRef::GetNodalFunctionsP1DerivativesReference {{{*/ 1143 void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,GaussPenta* gauss){ 1144 1144 1145 1145 /*This routine returns the values of the nodal functions derivatives (with respect to the 1146 1146 * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */ 1147 1147 1148 double A1,A2,A3,z;1148 IssmDouble A1,A2,A3,z; 1149 1149 1150 1150 A1=gauss->coord1; _assert_(A1>=0 && A1<=1);//first area coordinate value. In term of xi and eta: A1=(1-xi)/2-eta/(2*SQRT3); … … 1184 1184 } 1185 1185 /*}}}*/ 1186 /*FUNCTION PentaRef::GetQuadNodalFunctions {{{ 1*/1187 void PentaRef::GetQuadNodalFunctions( double* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4){1186 /*FUNCTION PentaRef::GetQuadNodalFunctions {{{*/ 1187 void PentaRef::GetQuadNodalFunctions(IssmDouble* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4){ 1188 1188 /*This routine returns the values of the nodal functions at the gaussian point.*/ 1189 1189 1190 double BasisFunctions[6];1190 IssmDouble BasisFunctions[6]; 1191 1191 1192 1192 GetNodalFunctionsP1(&BasisFunctions[0],gauss); … … 1204 1204 } 1205 1205 /*}}}*/ 1206 /*FUNCTION PentaRef::GetQuadJacobianDeterminant{{{ 1*/1207 void PentaRef::GetQuadJacobianDeterminant( double* Jdet,double xyz_list[4][3],GaussPenta* gauss){1206 /*FUNCTION PentaRef::GetQuadJacobianDeterminant{{{*/ 1207 void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble xyz_list[4][3],GaussPenta* gauss){ 1208 1208 /*This routine returns the values of the nodal functions at the gaussian point.*/ 1209 1209 1210 double x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4;1210 IssmDouble x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4; 1211 1211 1212 1212 x1=xyz_list[0][0]; … … 1226 1226 /*Area of a trabezoid = altitude * (base1 + base2)/2 */ 1227 1227 *Jdet= pow(pow(x2-x1,2.) + pow(y2-y1,2.),0.5) * (z4-z1 + z3-z2)/8; 1228 if(*Jdet<0) _error _("negative jacobian determinant!");1229 1230 } 1231 /*}}}*/ 1232 /*FUNCTION PentaRef::GetInputValue{{{ 1*/1233 void PentaRef::GetInputValue( double* pvalue,double* plist,GaussPenta* gauss){1228 if(*Jdet<0) _error2_("negative jacobian determinant!"); 1229 1230 } 1231 /*}}}*/ 1232 /*FUNCTION PentaRef::GetInputValue{{{*/ 1233 void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,GaussPenta* gauss){ 1234 1234 /*P1 interpolation on Gauss point*/ 1235 1235 1236 1236 /*intermediary*/ 1237 double l1l6[6];1237 IssmDouble l1l6[6]; 1238 1238 1239 1239 /*nodal functions: */ … … 1245 1245 } 1246 1246 /*}}}*/ 1247 /*FUNCTION PentaRef::GetInputDerivativeValue{{{ 1*/1248 void PentaRef::GetInputDerivativeValue( double* p, double* plist,double* xyz_list, GaussPenta* gauss){1247 /*FUNCTION PentaRef::GetInputDerivativeValue{{{*/ 1248 void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussPenta* gauss){ 1249 1249 /*From node values of parameter p (p_list[0], p_list[1], p_list[2], p_list[3], p_list[4] and p_list[4]), return parameter derivative value at gaussian point specified by gauss_coord: 1250 1250 * dp/dx=p_list[0]*dh1/dx+p_list[1]*dh2/dx+p_list[2]*dh3/dx+p_list[3]*dh4/dx+p_list[4]*dh5/dx+p_list[5]*dh6/dx; … … 1254 1254 * p is a vector of size 3x1 already allocated. 1255 1255 */ 1256 double dh1dh6[3][NUMNODESP1];1256 IssmDouble dh1dh6[3][NUMNODESP1]; 1257 1257 1258 1258 /*Get nodal funnctions derivatives in actual coordinate system: */ -
issm/trunk/src/c/objects/Elements/PentaRef.h
r10628 r12706 23 23 24 24 /*Numerics*/ 25 void GetNodalFunctionsP1( double* l1l6, GaussPenta* gauss);26 void GetNodalFunctionsMINI( double* l1l7, GaussPenta* gauss);27 void GetNodalFunctionsP1Derivatives( double* dh1dh6,double* xyz_list, GaussPenta* gauss);28 void GetNodalFunctionsMINIDerivatives( double* dh1dh7,double* xyz_list, GaussPenta* gauss);29 void GetNodalFunctionsP1DerivativesReference( double* dl1dl6,GaussPenta* gauss);30 void GetNodalFunctionsMINIDerivativesReference( double* dl1dl7,GaussPenta* gauss);31 void GetQuadNodalFunctions( double* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4);32 void GetQuadJacobianDeterminant( double* Jdet, double xyz_list[4][3],GaussPenta* gauss);33 void GetJacobian( double* J, double* xyz_list,GaussPenta* gauss);34 void GetJacobianDeterminant( double* Jdet, double* xyz_list,GaussPenta* gauss);35 void GetTriaJacobianDeterminant( double* Jdet, double* xyz_list,GaussPenta* gauss);36 void GetSegmentJacobianDeterminant( double* Jdet, double* xyz_list,GaussPenta* gauss);37 void GetJacobianInvert( double* Jinv, double* xyz_list,GaussPenta* gauss);38 void GetBMacAyealPattyn( double* B, double* xyz_list, GaussPenta* gauss);39 void GetBMacAyealStokes( double* B, double* xyz_list, GaussPenta* gauss);40 void GetBPattyn( double* B, double* xyz_list, GaussPenta* gauss);41 void GetBStokes( double* B, double* xyz_list, GaussPenta* gauss);42 void GetBprimeMacAyealStokes( double* Bprime, double* xyz_list, GaussPenta* gauss);43 void GetBprimePattyn( double* B, double* xyz_list, GaussPenta* gauss);44 void GetBprimeStokes( double* B_prime, double* xyz_list, GaussPenta* gauss);45 void GetBprimeVert( double* B, double* xyz_list, GaussPenta* gauss);46 void GetBAdvec( double* B_advec, double* xyz_list, GaussPenta* gauss);47 void GetBConduct( double* B_conduct, double* xyz_list, GaussPenta* gauss);48 void GetBVert( double* B, double* xyz_list, GaussPenta* gauss);49 void GetBprimeAdvec( double* Bprime_advec, double* xyz_list, GaussPenta* gauss);50 void GetL( double* L, GaussPenta* gauss,int numdof);51 void GetLStokes( double* LStokes, GaussPenta* gauss);52 void GetLprimeStokes( double* LprimeStokes, double* xyz_list, GaussPenta* gauss);53 void GetLMacAyealStokes( double* LMacAyealStokes, GaussPenta* gauss);54 void GetLprimeMacAyealStokes( double* LprimeMacAyealStokes, double* xyz_list, GaussPenta* gauss);55 void GetLStokesMacAyeal( double* LStokesMacAyeal, GaussPenta* gauss);56 void GetLprimeStokesMacAyeal( double* LprimeStokesMacAyeal, double* xyz_list, GaussPenta* gauss);57 void GetInputValue( double* pvalue,double* plist, GaussPenta* gauss);58 void GetInputValue( double* pvalue,double* plist,GaussTria* gauss){_error_("only PentaGauss are supported");};59 void GetInputDerivativeValue( double* pvalues, double* plist,double* xyz_list, GaussPenta* gauss);60 void GetInputDerivativeValue( double* pvalues, double* plist,double* xyz_list, GaussTria* gauss){_error_("only PentaGauss are supported");};25 void GetNodalFunctionsP1(IssmDouble* l1l6, GaussPenta* gauss); 26 void GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss); 27 void GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, GaussPenta* gauss); 28 void GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, GaussPenta* gauss); 29 void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,GaussPenta* gauss); 30 void GetNodalFunctionsMINIDerivativesReference(IssmDouble* dl1dl7,GaussPenta* gauss); 31 void GetQuadNodalFunctions(IssmDouble* l1l4,GaussPenta* gauss,int index1,int index2,int index3,int index4); 32 void GetQuadJacobianDeterminant(IssmDouble* Jdet, IssmDouble xyz_list[4][3],GaussPenta* gauss); 33 void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussPenta* gauss); 34 void GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss); 35 void GetTriaJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss); 36 void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussPenta* gauss); 37 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussPenta* gauss); 38 void GetBMacAyealPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 39 void GetBMacAyealStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 40 void GetBPattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 41 void GetBStokes(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 42 void GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussPenta* gauss); 43 void GetBprimePattyn(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 44 void GetBprimeStokes(IssmDouble* B_prime, IssmDouble* xyz_list, GaussPenta* gauss); 45 void GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 46 void GetBAdvec(IssmDouble* B_advec, IssmDouble* xyz_list, GaussPenta* gauss); 47 void GetBConduct(IssmDouble* B_conduct, IssmDouble* xyz_list, GaussPenta* gauss); 48 void GetBVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss); 49 void GetBprimeAdvec(IssmDouble* Bprime_advec, IssmDouble* xyz_list, GaussPenta* gauss); 50 void GetL(IssmDouble* L, GaussPenta* gauss,int numdof); 51 void GetLStokes(IssmDouble* LStokes, GaussPenta* gauss); 52 void GetLprimeStokes(IssmDouble* LprimeStokes, IssmDouble* xyz_list, GaussPenta* gauss); 53 void GetLMacAyealStokes(IssmDouble* LMacAyealStokes, GaussPenta* gauss); 54 void GetLprimeMacAyealStokes(IssmDouble* LprimeMacAyealStokes, IssmDouble* xyz_list, GaussPenta* gauss); 55 void GetLStokesMacAyeal(IssmDouble* LStokesMacAyeal, GaussPenta* gauss); 56 void GetLprimeStokesMacAyeal(IssmDouble* LprimeStokesMacAyeal, IssmDouble* xyz_list, GaussPenta* gauss); 57 void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, GaussPenta* gauss); 58 void GetInputValue(IssmDouble* pvalue,IssmDouble* plist,GaussTria* gauss){_error2_("only PentaGauss are supported");}; 59 void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, GaussPenta* gauss); 60 void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss){_error2_("only PentaGauss are supported");}; 61 61 62 62 }; -
issm/trunk/src/c/objects/Elements/Tria.cpp
r12643 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 23 23 24 24 /*Constructors/destructor/copy*/ 25 /*FUNCTION Tria::Tria(){{{ 1*/25 /*FUNCTION Tria::Tria(){{{*/ 26 26 Tria::Tria(){ 27 27 … … 38 38 } 39 39 /*}}}*/ 40 /*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{ 1*/40 /*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/ 41 41 Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels) 42 42 :TriaRef(nummodels) … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION Tria::~Tria(){{{ 1*/68 /*FUNCTION Tria::~Tria(){{{*/ 69 69 Tria::~Tria(){ 70 70 delete inputs; … … 73 73 } 74 74 /*}}}*/ 75 /*FUNCTION Tria::copy {{{ 1*/75 /*FUNCTION Tria::copy {{{*/ 76 76 Object* Tria::copy() { 77 77 … … 82 82 83 83 //deal with TriaRef mother class 84 tria->element_type_list= (int*)xmalloc(this->numanalyses*sizeof(int));84 tria->element_type_list=xNew<int>(this->numanalyses); 85 85 for(i=0;i<this->numanalyses;i++) tria->element_type_list[i]=this->element_type_list[i]; 86 86 … … 111 111 112 112 /*recover objects: */ 113 tria->nodes= (Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.113 tria->nodes=xNew<Node*>(3); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 114 114 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 115 115 tria->matice=(Matice*)tria->hmatice->delivers(); … … 124 124 125 125 /*Other*/ 126 /*FUNCTION Tria::AverageOntoPartition {{{ 1*/127 void Tria::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas, double* vertex_response,double* qmu_part){126 /*FUNCTION Tria::AverageOntoPartition {{{*/ 127 void Tria::AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){ 128 128 129 129 bool already=false; … … 132 132 int offsetsid[NUMVERTICES]; 133 133 int offsetdof[NUMVERTICES]; 134 double area;135 double mean;136 double values[3];134 IssmDouble area; 135 IssmDouble mean; 136 IssmDouble values[3]; 137 137 138 138 /*First, get the area: */ … … 144 144 mean=0; 145 145 for(i=0;i<NUMVERTICES;i++){ 146 partition[i]= (int)qmu_part[offsetsid[i]];146 partition[i]=reCast<int>(qmu_part[offsetsid[i]]); 147 147 mean=mean+1.0/NUMVERTICES*vertex_response[offsetdof[i]]; 148 148 } … … 164 164 } 165 165 /*}}}*/ 166 /*FUNCTION Tria::CreateKMatrix {{{ 1*/166 /*FUNCTION Tria::CreateKMatrix {{{*/ 167 167 void Tria::CreateKMatrix(Matrix* Kff, Matrix* Kfs,Vector* df){ 168 168 … … 172 172 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 173 173 174 /*Checks in debugging mode{{{ 2*/174 /*Checks in debugging mode{{{*/ 175 175 _assert_(this->nodes && this->matice && this->matpar && this->parameters && this->inputs); 176 176 /*}}}*/ … … 214 214 #endif 215 215 default: 216 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));216 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 217 217 } 218 218 … … 224 224 } 225 225 /*}}}*/ 226 /*FUNCTION Tria::CreateKMatrixMelting {{{ 1*/226 /*FUNCTION Tria::CreateKMatrixMelting {{{*/ 227 227 ElementMatrix* Tria::CreateKMatrixMelting(void){ 228 228 … … 232 232 /*Intermediaries */ 233 233 int i,j,ig; 234 double heatcapacity,latentheat;235 double Jdet,D_scalar;236 double xyz_list[NUMVERTICES][3];237 double L[3];234 IssmDouble heatcapacity,latentheat; 235 IssmDouble Jdet,D_scalar; 236 IssmDouble xyz_list[NUMVERTICES][3]; 237 IssmDouble L[3]; 238 238 GaussTria *gauss=NULL; 239 239 … … 268 268 } 269 269 /*}}}*/ 270 /*FUNCTION Tria::CreateKMatrixPrognostic {{{ 1*/270 /*FUNCTION Tria::CreateKMatrixPrognostic {{{*/ 271 271 ElementMatrix* Tria::CreateKMatrixPrognostic(void){ 272 272 … … 277 277 return CreateKMatrixPrognostic_DG(); 278 278 default: 279 _error _("Element type %s not supported yet",EnumToStringx(GetElementType()));280 } 281 282 } 283 /*}}}*/ 284 /*FUNCTION Tria::CreateKMatrixPrognostic_CG {{{ 1*/279 _error2_("Element type " << EnumToStringx(GetElementType()) << " not supported yet"); 280 } 281 282 } 283 /*}}}*/ 284 /*FUNCTION Tria::CreateKMatrixPrognostic_CG {{{*/ 285 285 ElementMatrix* Tria::CreateKMatrixPrognostic_CG(void){ 286 286 … … 291 291 int stabilization; 292 292 int i,j,ig,dim; 293 double Jdettria,DL_scalar,dt,h;294 double vel,vx,vy,dvxdx,dvydy;295 double dvx[2],dvy[2];296 double v_gauss[2]={0.0};297 double xyz_list[NUMVERTICES][3];298 double L[NUMVERTICES];299 double B[2][NUMVERTICES];300 double Bprime[2][NUMVERTICES];301 double K[2][2] ={0.0};302 double KDL[2][2] ={0.0};303 double DL[2][2] ={0.0};304 double DLprime[2][2] ={0.0};293 IssmDouble Jdettria,DL_scalar,dt,h; 294 IssmDouble vel,vx,vy,dvxdx,dvydy; 295 IssmDouble dvx[2],dvy[2]; 296 IssmDouble v_gauss[2]={0.0}; 297 IssmDouble xyz_list[NUMVERTICES][3]; 298 IssmDouble L[NUMVERTICES]; 299 IssmDouble B[2][NUMVERTICES]; 300 IssmDouble Bprime[2][NUMVERTICES]; 301 IssmDouble K[2][2] ={0.0}; 302 IssmDouble KDL[2][2] ={0.0}; 303 IssmDouble DL[2][2] ={0.0}; 304 IssmDouble DLprime[2][2] ={0.0}; 305 305 GaussTria *gauss=NULL; 306 306 … … 402 402 } 403 403 /*}}}*/ 404 /*FUNCTION Tria::CreateKMatrixPrognostic_DG {{{ 1*/404 /*FUNCTION Tria::CreateKMatrixPrognostic_DG {{{*/ 405 405 ElementMatrix* Tria::CreateKMatrixPrognostic_DG(void){ 406 406 … … 410 410 /*Intermediaries */ 411 411 int i,j,ig,dim; 412 double xyz_list[NUMVERTICES][3];413 double Jdettria,dt,vx,vy;414 double L[NUMVERTICES];415 double B[2][NUMVERTICES];416 double Bprime[2][NUMVERTICES];417 double DL[2][2]={0.0};418 double DLprime[2][2]={0.0};419 double DL_scalar;412 IssmDouble xyz_list[NUMVERTICES][3]; 413 IssmDouble Jdettria,dt,vx,vy; 414 IssmDouble L[NUMVERTICES]; 415 IssmDouble B[2][NUMVERTICES]; 416 IssmDouble Bprime[2][NUMVERTICES]; 417 IssmDouble DL[2][2]={0.0}; 418 IssmDouble DLprime[2][2]={0.0}; 419 IssmDouble DL_scalar; 420 420 GaussTria *gauss=NULL; 421 421 … … 477 477 } 478 478 /*}}}*/ 479 /*FUNCTION Tria::CreateKMatrixSlope {{{ 1*/479 /*FUNCTION Tria::CreateKMatrixSlope {{{*/ 480 480 ElementMatrix* Tria::CreateKMatrixSlope(void){ 481 481 … … 485 485 /* Intermediaries */ 486 486 int i,j,ig; 487 double DL_scalar,Jdet;488 double xyz_list[NUMVERTICES][3];489 double L[1][3];487 IssmDouble DL_scalar,Jdet; 488 IssmDouble xyz_list[NUMVERTICES][3]; 489 IssmDouble L[1][3]; 490 490 GaussTria *gauss = NULL; 491 491 … … 517 517 } 518 518 /*}}}*/ 519 /*FUNCTION Tria::CreatePVector {{{ 1*/519 /*FUNCTION Tria::CreatePVector {{{*/ 520 520 void Tria::CreatePVector(Vector* pf){ 521 521 … … 568 568 #endif 569 569 default: 570 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));570 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 571 571 } 572 572 … … 578 578 } 579 579 /*}}}*/ 580 /*FUNCTION Tria::CreatePVectorPrognostic{{{ 1*/580 /*FUNCTION Tria::CreatePVectorPrognostic{{{*/ 581 581 ElementVector* Tria::CreatePVectorPrognostic(void){ 582 582 … … 587 587 return CreatePVectorPrognostic_DG(); 588 588 default: 589 _error _("Element type %s not supported yet",EnumToStringx(GetElementType()));590 } 591 } 592 /*}}}*/ 593 /*FUNCTION Tria::CreatePVectorPrognostic_CG {{{ 1*/589 _error2_("Element type " << EnumToStringx(GetElementType()) << " not supported yet"); 590 } 591 } 592 /*}}}*/ 593 /*FUNCTION Tria::CreatePVectorPrognostic_CG {{{*/ 594 594 ElementVector* Tria::CreatePVectorPrognostic_CG(void){ 595 595 … … 599 599 /*Intermediaries */ 600 600 int i,j,ig; 601 double Jdettria,dt;602 double surface_mass_balance_g,basal_melting_g,basal_melting_correction_g,thickness_g;603 double xyz_list[NUMVERTICES][3];604 double L[NUMVERTICES];601 IssmDouble Jdettria,dt; 602 IssmDouble surface_mass_balance_g,basal_melting_g,basal_melting_correction_g,thickness_g; 603 IssmDouble xyz_list[NUMVERTICES][3]; 604 IssmDouble L[NUMVERTICES]; 605 605 GaussTria* gauss=NULL; 606 606 … … 642 642 } 643 643 /*}}}*/ 644 /*FUNCTION Tria::CreatePVectorPrognostic_DG {{{ 1*/644 /*FUNCTION Tria::CreatePVectorPrognostic_DG {{{*/ 645 645 ElementVector* Tria::CreatePVectorPrognostic_DG(void){ 646 646 … … 650 650 /*Intermediaries */ 651 651 int i,j,ig; 652 double Jdettria,dt;653 double surface_mass_balance_g,basal_melting_g,thickness_g;654 double xyz_list[NUMVERTICES][3];655 double L[NUMVERTICES];652 IssmDouble Jdettria,dt; 653 IssmDouble surface_mass_balance_g,basal_melting_g,thickness_g; 654 IssmDouble xyz_list[NUMVERTICES][3]; 655 IssmDouble L[NUMVERTICES]; 656 656 GaussTria* gauss=NULL; 657 657 … … 687 687 } 688 688 /*}}}*/ 689 /*FUNCTION Tria::CreatePVectorSlope {{{ 1*/689 /*FUNCTION Tria::CreatePVectorSlope {{{*/ 690 690 ElementVector* Tria::CreatePVectorSlope(void){ 691 691 … … 696 696 int i,j,ig; 697 697 int analysis_type; 698 double Jdet;699 double xyz_list[NUMVERTICES][3];700 double slope[2];701 double basis[3];698 IssmDouble Jdet; 699 IssmDouble xyz_list[NUMVERTICES][3]; 700 IssmDouble slope[2]; 701 IssmDouble basis[3]; 702 702 GaussTria* gauss=NULL; 703 703 … … 740 740 } 741 741 /*}}}*/ 742 /*FUNCTION Tria::CreateJacobianMatrix{{{ 1*/742 /*FUNCTION Tria::CreateJacobianMatrix{{{*/ 743 743 void Tria::CreateJacobianMatrix(Matrix* Jff){ 744 744 … … 748 748 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 749 749 750 /*Checks in debugging {{{ 2*/750 /*Checks in debugging {{{*/ 751 751 _assert_(this->nodes && this->matice && this->matpar && this->parameters && this->inputs); 752 752 /*}}}*/ … … 763 763 #endif 764 764 default: 765 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));765 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 766 766 } 767 767 … … 773 773 } 774 774 /*}}}*/ 775 /*FUNCTION Tria::ComputeBasalStress {{{ 1*/775 /*FUNCTION Tria::ComputeBasalStress {{{*/ 776 776 void Tria::ComputeBasalStress(Vector* eps){ 777 _error _("Not Implemented yet");778 } 779 /*}}}*/ 780 /*FUNCTION Tria::ComputeStrainRate {{{ 1*/777 _error2_("Not Implemented yet"); 778 } 779 /*}}}*/ 780 /*FUNCTION Tria::ComputeStrainRate {{{*/ 781 781 void Tria::ComputeStrainRate(Vector* eps){ 782 _error _("Not Implemented yet");783 } 784 /*}}}*/ 785 /*FUNCTION Tria::ComputeStressTensor {{{ 1*/782 _error2_("Not Implemented yet"); 783 } 784 /*}}}*/ 785 /*FUNCTION Tria::ComputeStressTensor {{{*/ 786 786 void Tria::ComputeStressTensor(){ 787 787 788 788 int iv; 789 double xyz_list[NUMVERTICES][3];790 double pressure,viscosity;791 double epsilon[3]; /* epsilon=[exx,eyy,exy];*/792 double sigma_xx[NUMVERTICES];793 double sigma_yy[NUMVERTICES];794 double sigma_zz[NUMVERTICES]={0,0,0};795 double sigma_xy[NUMVERTICES];796 double sigma_xz[NUMVERTICES]={0,0,0};797 double sigma_yz[NUMVERTICES]={0,0,0};789 IssmDouble xyz_list[NUMVERTICES][3]; 790 IssmDouble pressure,viscosity; 791 IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 792 IssmDouble sigma_xx[NUMVERTICES]; 793 IssmDouble sigma_yy[NUMVERTICES]; 794 IssmDouble sigma_zz[NUMVERTICES]={0,0,0}; 795 IssmDouble sigma_xy[NUMVERTICES]; 796 IssmDouble sigma_xz[NUMVERTICES]={0,0,0}; 797 IssmDouble sigma_yz[NUMVERTICES]={0,0,0}; 798 798 GaussTria* gauss=NULL; 799 799 … … 834 834 } 835 835 /*}}}*/ 836 /*FUNCTION Tria::Configure {{{ 1*/836 /*FUNCTION Tria::Configure {{{*/ 837 837 void Tria::Configure(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 838 838 … … 864 864 } 865 865 /*}}}*/ 866 /*FUNCTION Tria::DeepEcho{{{ 1*/866 /*FUNCTION Tria::DeepEcho{{{*/ 867 867 void Tria::DeepEcho(void){ 868 868 869 printf("Tria:\n");870 printf(" id: %i\n",id);869 _printLine_("Tria:"); 870 _printLine_(" id: " << id); 871 871 if(nodes){ 872 872 nodes[0]->DeepEcho(); … … 874 874 nodes[2]->DeepEcho(); 875 875 } 876 else printf("nodes = NULL\n");876 else _printLine_("nodes = NULL"); 877 877 878 878 if (matice) matice->DeepEcho(); 879 else printf("matice = NULL\n");879 else _printLine_("matice = NULL"); 880 880 881 881 if (matpar) matpar->DeepEcho(); 882 else printf("matpar = NULL\n");883 884 printf(" parameters\n");882 else _printLine_("matpar = NULL"); 883 884 _printLine_(" parameters"); 885 885 if (parameters) parameters->DeepEcho(); 886 else printf("parameters = NULL\n");887 888 printf(" inputs\n");886 else _printLine_("parameters = NULL"); 887 888 _printLine_(" inputs"); 889 889 if (inputs) inputs->DeepEcho(); 890 else printf("inputs=NULL\n");890 else _printLine_("inputs=NULL"); 891 891 892 892 if (results) results->DeepEcho(); 893 else printf("results=NULL\n");894 895 printf("neighboor sids: \n");896 printf(" %i %i %i\n",horizontalneighborsids[0],horizontalneighborsids[1],horizontalneighborsids[2]);893 else _printLine_("results=NULL"); 894 895 _printLine_("neighboor sids: "); 896 _printLine_(" " << horizontalneighborsids[0] << " " << horizontalneighborsids[1] << " " << horizontalneighborsids[2]); 897 897 898 898 return; 899 899 } 900 900 /*}}}*/ 901 /*FUNCTION Tria::DeleteResults {{{ 1*/901 /*FUNCTION Tria::DeleteResults {{{*/ 902 902 void Tria::DeleteResults(void){ 903 903 … … 908 908 } 909 909 /*}}}*/ 910 /*FUNCTION Tria::Echo{{{ 1*/910 /*FUNCTION Tria::Echo{{{*/ 911 911 void Tria::Echo(void){ 912 printf("Tria:\n");913 printf(" id: %i\n",id);912 _printLine_("Tria:"); 913 _printLine_(" id: " << id); 914 914 if(nodes){ 915 915 nodes[0]->Echo(); … … 917 917 nodes[2]->Echo(); 918 918 } 919 else printf("nodes = NULL\n");919 else _printLine_("nodes = NULL"); 920 920 921 921 if (matice) matice->Echo(); 922 else printf("matice = NULL\n");922 else _printLine_("matice = NULL"); 923 923 924 924 if (matpar) matpar->Echo(); 925 else printf("matpar = NULL\n");926 927 printf(" parameters\n");925 else _printLine_("matpar = NULL"); 926 927 _printLine_(" parameters"); 928 928 if (parameters) parameters->Echo(); 929 else printf("parameters = NULL\n");930 931 printf(" inputs\n");929 else _printLine_("parameters = NULL"); 930 931 _printLine_(" inputs"); 932 932 if (inputs) inputs->Echo(); 933 else printf("inputs=NULL\n");933 else _printLine_("inputs=NULL"); 934 934 935 935 if (results) results->Echo(); 936 else printf("results=NULL\n");937 938 printf("neighboor sids: \n");939 printf(" %i %i %i\n",horizontalneighborsids[0],horizontalneighborsids[1],horizontalneighborsids[2]);940 } 941 /*}}}*/ 942 /*FUNCTION Tria::ObjectEnum{{{ 1*/936 else _printLine_("results=NULL"); 937 938 _printLine_("neighboor sids: "); 939 _printLine_(" " << horizontalneighborsids[0] << " " << horizontalneighborsids[1] << " " << horizontalneighborsids[2]); 940 } 941 /*}}}*/ 942 /*FUNCTION Tria::ObjectEnum{{{*/ 943 943 int Tria::ObjectEnum(void){ 944 944 … … 947 947 } 948 948 /*}}}*/ 949 /*FUNCTION Tria::GetArea {{{ 1*/950 double Tria::GetArea(void){951 952 double area=0;953 double xyz_list[NUMVERTICES][3];954 double x1,y1,x2,y2,x3,y3;949 /*FUNCTION Tria::GetArea {{{*/ 950 IssmDouble Tria::GetArea(void){ 951 952 IssmDouble area=0; 953 IssmDouble xyz_list[NUMVERTICES][3]; 954 IssmDouble x1,y1,x2,y2,x3,y3; 955 955 956 956 /*Get xyz list: */ … … 964 964 } 965 965 /*}}}*/ 966 /*FUNCTION Tria::GetDofList {{{ 1*/966 /*FUNCTION Tria::GetDofList {{{*/ 967 967 void Tria::GetDofList(int** pdoflist, int approximation_enum,int setenum){ 968 968 … … 974 974 /*First, figure out size of doflist and create it: */ 975 975 for(i=0;i<3;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 976 doflist= (int*)xmalloc(numberofdofs*sizeof(int));976 doflist=xNew<int>(numberofdofs); 977 977 978 978 /*Populate: */ … … 987 987 } 988 988 /*}}}*/ 989 /*FUNCTION Tria::GetDofList1 {{{ 1*/989 /*FUNCTION Tria::GetDofList1 {{{*/ 990 990 void Tria::GetDofList1(int* doflist){ 991 991 … … 995 995 } 996 996 /*}}}*/ 997 /*FUNCTION Tria::GetElementType {{{ 1*/997 /*FUNCTION Tria::GetElementType {{{*/ 998 998 int Tria::GetElementType(){ 999 999 … … 1003 1003 } 1004 1004 /*}}}*/ 1005 /*FUNCTION Tria::GetHorizontalNeighboorSids {{{ 1*/1005 /*FUNCTION Tria::GetHorizontalNeighboorSids {{{*/ 1006 1006 int* Tria::GetHorizontalNeighboorSids(){ 1007 1007 … … 1011 1011 } 1012 1012 /*}}}*/ 1013 /*FUNCTION Tria::GetNodeIndex {{{ 1*/1013 /*FUNCTION Tria::GetNodeIndex {{{*/ 1014 1014 int Tria::GetNodeIndex(Node* node){ 1015 1015 … … 1019 1019 return i; 1020 1020 } 1021 _error _("Node provided not found among element nodes");1022 } 1023 /*}}}*/ 1024 /*FUNCTION Tria::GetInputListOnVertices( double* pvalue,int enumtype) {{{1*/1025 void Tria::GetInputListOnVertices( double* pvalue,int enumtype){1021 _error2_("Node provided not found among element nodes"); 1022 } 1023 /*}}}*/ 1024 /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/ 1025 void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){ 1026 1026 1027 1027 /*Intermediaries*/ 1028 double value[NUMVERTICES];1028 IssmDouble value[NUMVERTICES]; 1029 1029 GaussTria *gauss = NULL; 1030 1030 1031 1031 /*Recover input*/ 1032 1032 Input* input=inputs->GetInput(enumtype); 1033 if (!input) _error _("Input %s not found in element",EnumToStringx(enumtype));1033 if (!input) _error2_("Input " << EnumToStringx(enumtype) << " not found in element"); 1034 1034 1035 1035 /*Checks in debugging mode*/ … … 1047 1047 } 1048 1048 /*}}}*/ 1049 /*FUNCTION Tria::GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue) {{{1*/1050 void Tria::GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue){1051 1052 double value[NUMVERTICES];1049 /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue) {{{*/ 1050 void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){ 1051 1052 IssmDouble value[NUMVERTICES]; 1053 1053 GaussTria *gauss = NULL; 1054 1054 Input *input = inputs->GetInput(enumtype); … … 1073 1073 } 1074 1074 /*}}}*/ 1075 /*FUNCTION Tria::GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue,int index) TO BE REMOVED{{{1*/1076 void Tria::GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue,int index){1077 1078 double value[NUMVERTICES];1075 /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index) TO BE REMOVED{{{*/ 1076 void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index){ 1077 1078 IssmDouble value[NUMVERTICES]; 1079 1079 GaussTria *gauss = NULL; 1080 1080 Input *input = inputs->GetInput(enumtype); … … 1099 1099 } 1100 1100 /*}}}*/ 1101 /*FUNCTION Tria::GetInputValue( double* pvalue,Node* node,int enumtype) {{{1*/1102 void Tria::GetInputValue( double* pvalue,Node* node,int enumtype){1101 /*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/ 1102 void Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){ 1103 1103 1104 1104 Input* input=inputs->GetInput(enumtype); 1105 if(!input) _error _("No input of type %s found in tria",EnumToStringx(enumtype));1105 if(!input) _error2_("No input of type " << EnumToStringx(enumtype) << " found in tria"); 1106 1106 1107 1107 GaussTria* gauss=new GaussTria(); … … 1112 1112 } 1113 1113 /*}}}*/ 1114 /*FUNCTION Tria::GetSidList {{{ 1*/1114 /*FUNCTION Tria::GetSidList {{{*/ 1115 1115 void Tria::GetSidList(int* sidlist){ 1116 1116 for(int i=0;i<NUMVERTICES;i++) sidlist[i]=nodes[i]->GetSidList(); 1117 1117 } 1118 1118 /*}}}*/ 1119 /*FUNCTION Tria::GetConnectivityList {{{ 1*/1119 /*FUNCTION Tria::GetConnectivityList {{{*/ 1120 1120 void Tria::GetConnectivityList(int* connectivity){ 1121 1121 for(int i=0;i<NUMVERTICES;i++) connectivity[i]=nodes[i]->GetConnectivity(); 1122 1122 } 1123 1123 /*}}}*/ 1124 /*FUNCTION Tria::GetSolutionFromInputs{{{ 1*/1124 /*FUNCTION Tria::GetSolutionFromInputs{{{*/ 1125 1125 void Tria::GetSolutionFromInputs(Vector* solution){ 1126 1126 … … 1145 1145 #endif 1146 1146 default: 1147 _error _("analysis: %s not supported yet",EnumToStringx(analysis_type));1148 } 1149 1150 } 1151 /*}}}*/ 1152 /*FUNCTION Tria::GetStrainRate2d( double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{1*/1153 void Tria::GetStrainRate2d( double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){1147 _error2_("analysis: " << EnumToStringx(analysis_type) << " not supported yet"); 1148 } 1149 1150 } 1151 /*}}}*/ 1152 /*FUNCTION Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){{{*/ 1153 void Tria::GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input){ 1154 1154 /*Compute the 2d Strain Rate (3 components): 1155 1155 * epsilon=[exx eyy exy] */ 1156 1156 1157 1157 int i; 1158 double epsilonvx[3];1159 double epsilonvy[3];1158 IssmDouble epsilonvx[3]; 1159 IssmDouble epsilonvy[3]; 1160 1160 1161 1161 /*Check that both inputs have been found*/ 1162 1162 if (!vx_input || !vy_input){ 1163 _error _("Input missing. Here are the input pointers we have for vx: %p, vy: %p\n",vx_input,vy_input);1163 _error2_("Input missing. Here are the input pointers we have for vx: " << vx_input << ", vy: " << vy_input << "\n"); 1164 1164 } 1165 1165 … … 1172 1172 } 1173 1173 /*}}}*/ 1174 /*FUNCTION Tria::GetVectorFromInputs{{{ 1*/1174 /*FUNCTION Tria::GetVectorFromInputs{{{*/ 1175 1175 void Tria::GetVectorFromInputs(Vector* vector,int input_enum){ 1176 1176 … … 1185 1185 /*Get input (either in element or material)*/ 1186 1186 Input* input=inputs->GetInput(input_enum); 1187 if(!input) _error _("Input %s not found in element",EnumToStringx(input_enum));1187 if(!input) _error2_("Input " << EnumToStringx(input_enum) << " not found in element"); 1188 1188 1189 1189 /*We found the enum. Use its values to fill into the vector, using the vertices ids: */ … … 1191 1191 } 1192 1192 /*}}}*/ 1193 /*FUNCTION Tria::GetVectorFromResults{{{ 1*/1193 /*FUNCTION Tria::GetVectorFromResults{{{*/ 1194 1194 void Tria::GetVectorFromResults(Vector* vector,int offset,int enum_in,int interp){ 1195 1195 … … 1210 1210 } 1211 1211 else{ 1212 printf("Interpolation %s not supported\n",EnumToStringx(interp));1213 } 1214 } 1215 /*}}}*/ 1216 /*FUNCTION Tria::Id {{{ 1*/1212 _printLine_("Interpolation " << EnumToStringx(interp) << " not supported"); 1213 } 1214 } 1215 /*}}}*/ 1216 /*FUNCTION Tria::Id {{{*/ 1217 1217 int Tria::Id(){ 1218 1218 … … 1221 1221 } 1222 1222 /*}}}*/ 1223 /*FUNCTION Tria::Sid {{{ 1*/1223 /*FUNCTION Tria::Sid {{{*/ 1224 1224 int Tria::Sid(){ 1225 1225 … … 1228 1228 } 1229 1229 /*}}}*/ 1230 /*FUNCTION Tria::InputArtificialNoise{{{ 1*/1231 void Tria::InputArtificialNoise(int enum_type, double min,double max){1230 /*FUNCTION Tria::InputArtificialNoise{{{*/ 1231 void Tria::InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max){ 1232 1232 1233 1233 Input* input=NULL; … … 1235 1235 /*Make a copy of the original input: */ 1236 1236 input=(Input*)this->inputs->GetInput(enum_type); 1237 if(!input)_error _(" could not find old input with enum: %s",EnumToStringx(enum_type));1237 if(!input)_error2_("could not find old input with enum: " << EnumToStringx(enum_type)); 1238 1238 1239 1239 /*ArtificialNoise: */ … … 1241 1241 } 1242 1242 /*}}}*/ 1243 /*FUNCTION Tria::InputConvergence{{{ 1*/1244 bool Tria::InputConvergence( double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums){1243 /*FUNCTION Tria::InputConvergence{{{*/ 1244 bool Tria::InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums){ 1245 1245 1246 1246 bool converged=true; … … 1249 1249 Input** old_inputs=NULL; 1250 1250 1251 new_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the new inputs1252 old_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the old inputs1251 new_inputs=xNew<Input*>(num_enums/2); //half the enums are for the new inputs 1252 old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs 1253 1253 1254 1254 for(i=0;i<num_enums/2;i++){ 1255 1255 new_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+0]); 1256 1256 old_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+1]); 1257 if(!new_inputs[i])_error _("%s%s"," could not find input with enum ",EnumToStringx(enums[2*i+0]));1258 if(!old_inputs[i])_error _("%s%s"," could not find input with enum ",EnumToStringx(enums[2*i+0]));1257 if(!new_inputs[i])_error2_("could not find input with enum " << EnumToStringx(enums[2*i+0])); 1258 if(!old_inputs[i])_error2_("could not find input with enum " << EnumToStringx(enums[2*i+0])); 1259 1259 } 1260 1260 … … 1266 1266 1267 1267 /*clean up and return*/ 1268 x free((void**)&new_inputs);1269 x free((void**)&old_inputs);1268 xDelete<Input*>(new_inputs); 1269 xDelete<Input*>(old_inputs); 1270 1270 return converged; 1271 1271 } 1272 1272 /*}}}*/ 1273 /*FUNCTION Tria::InputDepthAverageAtBase {{{ 1*/1273 /*FUNCTION Tria::InputDepthAverageAtBase {{{*/ 1274 1274 void Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){ 1275 1275 … … 1284 1284 oldinput=(Input*)this->matice->inputs->GetInput(enum_type); 1285 1285 else 1286 _error _("object %s not supported yet",EnumToStringx(object_enum));1287 if(!oldinput)_error _("%s%s"," could not find old input with enum: ",EnumToStringx(enum_type));1286 _error2_("object " << EnumToStringx(object_enum) << " not supported yet"); 1287 if(!oldinput)_error2_("could not find old input with enum: " << EnumToStringx(enum_type)); 1288 1288 newinput=(Input*)oldinput->copy(); 1289 1289 … … 1297 1297 this->matice->inputs->AddInput((Input*)newinput); 1298 1298 else 1299 _error _("object %s not supported yet",EnumToStringx(object_enum));1300 } 1301 /*}}}*/ 1302 /*FUNCTION Tria::InputDuplicate{{{ 1*/1299 _error2_("object " << EnumToStringx(object_enum) << " not supported yet"); 1300 } 1301 /*}}}*/ 1302 /*FUNCTION Tria::InputDuplicate{{{*/ 1303 1303 void Tria::InputDuplicate(int original_enum,int new_enum){ 1304 1304 … … 1308 1308 } 1309 1309 /*}}}*/ 1310 /*FUNCTION Tria::InputScale{{{ 1*/1311 void Tria::InputScale(int enum_type, double scale_factor){1310 /*FUNCTION Tria::InputScale{{{*/ 1311 void Tria::InputScale(int enum_type,IssmDouble scale_factor){ 1312 1312 1313 1313 Input* input=NULL; … … 1315 1315 /*Make a copy of the original input: */ 1316 1316 input=(Input*)this->inputs->GetInput(enum_type); 1317 if(!input)_error _(" could not find old input with enum: %s",EnumToStringx(enum_type));1317 if(!input)_error2_("could not find old input with enum: " << EnumToStringx(enum_type)); 1318 1318 1319 1319 /*Scale: */ … … 1321 1321 } 1322 1322 /*}}}*/ 1323 /*FUNCTION Tria::InputToResult{{{ 1*/1324 void Tria::InputToResult(int enum_type,int step, double time){1323 /*FUNCTION Tria::InputToResult{{{*/ 1324 void Tria::InputToResult(int enum_type,int step,IssmDouble time){ 1325 1325 1326 1326 int i; … … 1330 1330 if (enum_type==MaterialsRheologyBbarEnum) input=this->matice->inputs->GetInput(enum_type); 1331 1331 else input=this->inputs->GetInput(enum_type); 1332 //if (!input) _error _("Input %s not found in tria->inputs",EnumToStringx(enum_type));1332 //if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found in tria->inputs"); 1333 1333 if(!input)return; 1334 1334 … … 1344 1344 } 1345 1345 /*}}}*/ 1346 /*FUNCTION Tria::InputUpdateFromConstant(int value, int name);{{{ 1*/1346 /*FUNCTION Tria::InputUpdateFromConstant(int value, int name);{{{*/ 1347 1347 void Tria::InputUpdateFromConstant(int constant, int name){ 1348 1348 /*Check that name is an element input*/ … … 1353 1353 } 1354 1354 /*}}}*/ 1355 /*FUNCTION Tria::InputUpdateFromConstant( double value, int name);{{{1*/1356 void Tria::InputUpdateFromConstant( double constant, int name){1355 /*FUNCTION Tria::InputUpdateFromConstant(IssmDouble value, int name);{{{*/ 1356 void Tria::InputUpdateFromConstant(IssmDouble constant, int name){ 1357 1357 /*Check that name is an element input*/ 1358 1358 if (!IsInput(name)) return; … … 1362 1362 } 1363 1363 /*}}}*/ 1364 /*FUNCTION Tria::InputUpdateFromConstant(bool value, int name);{{{ 1*/1364 /*FUNCTION Tria::InputUpdateFromConstant(bool value, int name);{{{*/ 1365 1365 void Tria::InputUpdateFromConstant(bool constant, int name){ 1366 1366 /*Check that name is an element input*/ … … 1371 1371 } 1372 1372 /*}}}*/ 1373 /*FUNCTION Tria::InputUpdateFromIoModel{{{ 1*/1373 /*FUNCTION Tria::InputUpdateFromIoModel{{{*/ 1374 1374 void Tria::InputUpdateFromIoModel(int index, IoModel* iomodel){ //i is the element index 1375 1375 … … 1377 1377 int i,j; 1378 1378 int tria_vertex_ids[3]; 1379 double nodeinputs[3];1380 double cmmininputs[3];1381 double cmmaxinputs[3];1379 IssmDouble nodeinputs[3]; 1380 IssmDouble cmmininputs[3]; 1381 IssmDouble cmmaxinputs[3]; 1382 1382 bool control_analysis=false; 1383 1383 int num_control_type; 1384 double yts;1384 IssmDouble yts; 1385 1385 int num_cm_responses; 1386 1386 … … 1393 1393 /*Recover vertices ids needed to initialize inputs*/ 1394 1394 for(i=0;i<3;i++){ 1395 tria_vertex_ids[i]= (int)iomodel->Data(MeshElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab1395 tria_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[3*index+i]); //ids for vertices are in the elements array from Matlab 1396 1396 } 1397 1397 … … 1436 1436 /*Matice will take care of it*/ break; 1437 1437 default: 1438 _error _("Control %s not implemented yet",EnumToStringx((int)iomodel->Data(InversionControlParametersEnum)[i]));1438 _error2_("Control " << EnumToStringx((int)iomodel->Data(InversionControlParametersEnum)[i]) << " not implemented yet"); 1439 1439 } 1440 1440 } … … 1457 1457 } 1458 1458 /*}}}*/ 1459 /*FUNCTION Tria::InputUpdateFromSolution {{{ 1*/1460 void Tria::InputUpdateFromSolution( double* solution){1459 /*FUNCTION Tria::InputUpdateFromSolution {{{*/ 1460 void Tria::InputUpdateFromSolution(IssmDouble* solution){ 1461 1461 1462 1462 /*retrive parameters: */ … … 1508 1508 break; 1509 1509 default: 1510 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));1511 } 1512 } 1513 /*}}}*/ 1514 /*FUNCTION Tria::InputUpdateFromSolutionOneDof{{{ 1*/1515 void Tria::InputUpdateFromSolutionOneDof( double* solution,int enum_type){1510 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 1511 } 1512 } 1513 /*}}}*/ 1514 /*FUNCTION Tria::InputUpdateFromSolutionOneDof{{{*/ 1515 void Tria::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){ 1516 1516 1517 1517 const int numdof = NDOF1*NUMVERTICES; 1518 1518 1519 1519 int* doflist=NULL; 1520 double values[numdof];1520 IssmDouble values[numdof]; 1521 1521 1522 1522 /*Get dof list: */ … … 1526 1526 for(int i=0;i<numdof;i++){ 1527 1527 values[i]=solution[doflist[i]]; 1528 if( isnan(values[i])) _error_("NaN found in solution vector");1528 if(xIsNan<IssmDouble>(values[i])) _error2_("NaN found in solution vector"); 1529 1529 } 1530 1530 … … 1533 1533 1534 1534 /*Free ressources:*/ 1535 x free((void**)&doflist);1536 } 1537 /*}}}*/ 1538 /*FUNCTION Tria::InputUpdateFromSolutionPrognostic{{{ 1*/1539 void Tria::InputUpdateFromSolutionPrognostic( double* solution){1535 xDelete<int>(doflist); 1536 } 1537 /*}}}*/ 1538 /*FUNCTION Tria::InputUpdateFromSolutionPrognostic{{{*/ 1539 void Tria::InputUpdateFromSolutionPrognostic(IssmDouble* solution){ 1540 1540 1541 1541 /*Intermediaries*/ … … 1544 1544 int i,hydroadjustment; 1545 1545 int* doflist=NULL; 1546 double rho_ice,rho_water,minthickness;1547 double newthickness[numdof];1548 double newbed[numdof];1549 double newsurface[numdof];1550 double oldbed[NUMVERTICES];1551 double oldsurface[NUMVERTICES];1552 double oldthickness[NUMVERTICES];1546 IssmDouble rho_ice,rho_water,minthickness; 1547 IssmDouble newthickness[numdof]; 1548 IssmDouble newbed[numdof]; 1549 IssmDouble newsurface[numdof]; 1550 IssmDouble oldbed[NUMVERTICES]; 1551 IssmDouble oldsurface[NUMVERTICES]; 1552 IssmDouble oldthickness[NUMVERTICES]; 1553 1553 1554 1554 /*Get dof list: */ … … 1559 1559 for(i=0;i<numdof;i++){ 1560 1560 newthickness[i]=solution[doflist[i]]; 1561 if( isnan(newthickness[i])) _error_("NaN found in solution vector");1561 if(xIsNan<IssmDouble>(newthickness[i])) _error2_("NaN found in solution vector"); 1562 1562 /*Constrain thickness to be at least 1m*/ 1563 1563 if(newthickness[i]<minthickness) newthickness[i]=minthickness; … … 1590 1590 newbed[i]=oldbed[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i]); //bed = oldbed + di * dH 1591 1591 } 1592 else _error _("Hydrostatic adjustment %i (%s) not supported yet",hydroadjustment,EnumToStringx(hydroadjustment));1592 else _error2_("Hydrostatic adjustment " << hydroadjustment << " (" << EnumToStringx(hydroadjustment) << ") not supported yet"); 1593 1593 } 1594 1594 } … … 1600 1600 1601 1601 /*Free ressources:*/ 1602 x free((void**)&doflist);1603 } 1604 /*}}}*/ 1605 /*FUNCTION Tria::InputUpdateFromVector( double* vector, int name, int type);{{{1*/1606 void Tria::InputUpdateFromVector( double* vector, int name, int type){1602 xDelete<int>(doflist); 1603 } 1604 /*}}}*/ 1605 /*FUNCTION Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/ 1606 void Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 1607 1607 1608 1608 /*Check that name is an element input*/ … … 1611 1611 switch(type){ 1612 1612 1613 case VertexEnum: 1613 case VertexEnum: { 1614 1614 1615 1615 /*New TriaP1Input*/ 1616 double values[3];1616 IssmDouble values[3]; 1617 1617 1618 1618 /*Get values on the 3 vertices*/ … … 1629 1629 } 1630 1630 return; 1631 1631 } 1632 1632 default: 1633 _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));1634 } 1635 } 1636 /*}}}*/ 1637 /*FUNCTION Tria::InputUpdateFromVector(int* vector, int name, int type);{{{ 1*/1633 _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 1634 } 1635 } 1636 /*}}}*/ 1637 /*FUNCTION Tria::InputUpdateFromVector(int* vector, int name, int type);{{{*/ 1638 1638 void Tria::InputUpdateFromVector(int* vector, int name, int type){ 1639 _error _("not supported yet!");1640 } 1641 /*}}}*/ 1642 /*FUNCTION Tria::InputUpdateFromVector(bool* vector, int name, int type);{{{ 1*/1639 _error2_("not supported yet!"); 1640 } 1641 /*}}}*/ 1642 /*FUNCTION Tria::InputUpdateFromVector(bool* vector, int name, int type);{{{*/ 1643 1643 void Tria::InputUpdateFromVector(bool* vector, int name, int type){ 1644 _error _("not supported yet!");1645 } 1646 /*}}}*/ 1647 /*FUNCTION Tria::InputCreate( double scalar,int enum,int code);{{{1*/1648 void Tria::InputCreate( double scalar,int name,int code){1644 _error2_("not supported yet!"); 1645 } 1646 /*}}}*/ 1647 /*FUNCTION Tria::InputCreate(IssmDouble scalar,int enum,int code);{{{*/ 1648 void Tria::InputCreate(IssmDouble scalar,int name,int code){ 1649 1649 1650 1650 /*Check that name is an element input*/ … … 1652 1652 1653 1653 if ((code==5) || (code==1)){ //boolean 1654 this->inputs->AddInput(new BoolInput(name, (bool)scalar));1654 this->inputs->AddInput(new BoolInput(name,reCast<bool>(scalar))); 1655 1655 } 1656 1656 else if ((code==6) || (code==2)){ //integer 1657 this->inputs->AddInput(new IntInput(name, (int)scalar));1658 } 1659 else if ((code==7) || (code==3)){ // double1660 this->inputs->AddInput(new DoubleInput(name, (int)scalar));1661 } 1662 else _error _("%s%i"," could not recognize nature of vector from code ",code);1663 1664 } 1665 /*}}}*/ 1666 /*FUNCTION Tria::InputCreate( double* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{1*/1667 void Tria::InputCreate( double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements1657 this->inputs->AddInput(new IntInput(name,reCast<int>(scalar))); 1658 } 1659 else if ((code==7) || (code==3)){ //IssmDouble 1660 this->inputs->AddInput(new DoubleInput(name,reCast<int>(scalar))); 1661 } 1662 else _error2_("could not recognize nature of vector from code " << code); 1663 1664 } 1665 /*}}}*/ 1666 /*FUNCTION Tria::InputCreate(IssmDouble* vector,int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/ 1667 void Tria::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements 1668 1668 1669 1669 /*Intermediaries*/ … … 1671 1671 int tria_vertex_ids[3]; 1672 1672 int row; 1673 double nodeinputs[3];1674 double time;1673 IssmDouble nodeinputs[3]; 1674 IssmDouble time; 1675 1675 TransientInput* transientinput=NULL; 1676 1676 int numberofvertices; 1677 1677 int numberofelements; 1678 double yts;1678 IssmDouble yts; 1679 1679 1680 1680 … … 1689 1689 /*Recover vertices ids needed to initialize inputs*/ 1690 1690 for(i=0;i<3;i++){ 1691 tria_vertex_ids[i]= (int)iomodel->Data(MeshElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab1691 tria_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[3*index+i]); //ids for vertices are in the elements array from Matlab 1692 1692 } 1693 1693 … … 1696 1696 1697 1697 /*create input values: */ 1698 for(i=0;i<3;i++)nodeinputs[i]=( double)vector[tria_vertex_ids[i]-1];1698 for(i=0;i<3;i++)nodeinputs[i]=(IssmDouble)vector[tria_vertex_ids[i]-1]; 1699 1699 1700 1700 /*process units: */ … … 1711 1711 for(i=0;i<3;i++){ 1712 1712 row=tria_vertex_ids[i]-1; 1713 nodeinputs[i]=( double)vector[N*row+t];1713 nodeinputs[i]=(IssmDouble)vector[N*row+t]; 1714 1714 } 1715 1715 … … 1718 1718 1719 1719 /*time? :*/ 1720 time=( double)vector[(M-1)*N+t]*yts;1720 time=(IssmDouble)vector[(M-1)*N+t]*yts; 1721 1721 1722 1722 if(t==0) transientinput=new TransientInput(vector_enum); … … 1725 1725 this->inputs->AddInput(transientinput); 1726 1726 } 1727 else _error _("nodal vector is either numberofnodes or numberofnodes+1 long. Field provided (%s) is %i long",EnumToStringx(vector_enum),M);1727 else _error2_("nodal vector is either numberofnodes or numberofnodes+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long"); 1728 1728 } 1729 1729 else if(vector_type==2){ //element vector … … 1734 1734 1735 1735 if (code==5){ //boolean 1736 this->inputs->AddInput(new BoolInput(vector_enum, (bool)vector[index]));1736 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[index]))); 1737 1737 } 1738 1738 else if (code==6){ //integer 1739 this->inputs->AddInput(new IntInput(vector_enum, (int)vector[index]));1739 this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[index]))); 1740 1740 } 1741 else if (code==7){ // double1742 this->inputs->AddInput(new DoubleInput(vector_enum, (double)vector[index]));1741 else if (code==7){ //IssmDouble 1742 this->inputs->AddInput(new DoubleInput(vector_enum,vector[index])); 1743 1743 } 1744 else _error _("%s%i"," could not recognize nature of vector from code ",code);1744 else _error2_("could not recognize nature of vector from code " << code); 1745 1745 } 1746 1746 else { 1747 _error _("transient elementary inputs not supported yet!");1747 _error2_("transient elementary inputs not supported yet!"); 1748 1748 } 1749 1749 } 1750 1750 else{ 1751 _error _("Cannot add input for vector type %i (not supported)",vector_type);1752 } 1753 1754 } 1755 /*}}}*/ 1756 /*FUNCTION Tria::IsInput{{{ 1*/1751 _error2_("Cannot add input for vector type " << vector_type << " (not supported)"); 1752 } 1753 1754 } 1755 /*}}}*/ 1756 /*FUNCTION Tria::IsInput{{{*/ 1757 1757 bool Tria::IsInput(int name){ 1758 1758 if ( … … 1788 1788 } 1789 1789 /*}}}*/ 1790 /*FUNCTION Tria::IsOnBed {{{ 1*/1790 /*FUNCTION Tria::IsOnBed {{{*/ 1791 1791 bool Tria::IsOnBed(){ 1792 1792 … … 1796 1796 } 1797 1797 /*}}}*/ 1798 /*FUNCTION Tria::IsFloating {{{ 1*/1798 /*FUNCTION Tria::IsFloating {{{*/ 1799 1799 bool Tria::IsFloating(){ 1800 1800 … … 1804 1804 } 1805 1805 /*}}}*/ 1806 /*FUNCTION Tria::IsNodeOnShelf {{{ 1*/1806 /*FUNCTION Tria::IsNodeOnShelf {{{*/ 1807 1807 bool Tria::IsNodeOnShelf(){ 1808 1808 … … 1819 1819 } 1820 1820 /*}}}*/ 1821 /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{ 1*/1822 bool Tria::IsNodeOnShelfFromFlags( double* flags){1821 /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/ 1822 bool Tria::IsNodeOnShelfFromFlags(IssmDouble* flags){ 1823 1823 1824 1824 int i; … … 1826 1826 1827 1827 for(i=0;i<NUMVERTICES;i++){ 1828 if ( flags[nodes[i]->Sid()]){1828 if (reCast<bool>(flags[nodes[i]->Sid()])){ 1829 1829 shelf=true; 1830 1830 break; … … 1834 1834 } 1835 1835 /*}}}*/ 1836 /*FUNCTION Tria::IsOnWater {{{ 1*/1836 /*FUNCTION Tria::IsOnWater {{{*/ 1837 1837 bool Tria::IsOnWater(){ 1838 1838 … … 1843 1843 /*}}}*/ 1844 1844 /*FUNCTION Tria::ListResultsInfo{{{*/ 1845 void Tria::ListResultsInfo(int** in_resultsenums,int** in_resultssizes, double** in_resultstimes,int** in_resultssteps,int* in_num_results){1845 void Tria::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,IssmDouble** in_resultstimes,int** in_resultssteps,int* in_num_results){ 1846 1846 1847 1847 /*Intermediaries*/ … … 1850 1850 int *resultsenums = NULL; 1851 1851 int *resultssizes = NULL; 1852 double *resultstimes = NULL;1852 IssmDouble *resultstimes = NULL; 1853 1853 int *resultssteps = NULL; 1854 1854 … … 1865 1865 1866 1866 /*Allocate output*/ 1867 resultsenums= (int*)xmalloc(numberofresults*sizeof(int));1868 resultssizes= (int*)xmalloc(numberofresults*sizeof(int));1869 resultstimes= (double*)xmalloc(numberofresults*sizeof(double));1870 resultssteps= (int*)xmalloc(numberofresults*sizeof(int));1867 resultsenums=xNew<int>(numberofresults); 1868 resultssizes=xNew<int>(numberofresults); 1869 resultstimes=xNew<IssmDouble>(numberofresults); 1870 resultssteps=xNew<int>(numberofresults); 1871 1871 1872 1872 /*populate enums*/ … … 1893 1893 1894 1894 }/*}}}*/ 1895 /*FUNCTION Tria::MigrateGroundingLine{{{ 1*/1896 void Tria::MigrateGroundingLine( double* old_floating_ice,double* sheet_ungrounding){1895 /*FUNCTION Tria::MigrateGroundingLine{{{*/ 1896 void Tria::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){ 1897 1897 1898 1898 int i,migration_style,unground; 1899 1899 bool elementonshelf = false; 1900 double bed_hydro,yts,gl_melting_rate;1901 double rho_water,rho_ice,density;1902 double melting[NUMVERTICES];1903 double h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];1900 IssmDouble bed_hydro,yts,gl_melting_rate; 1901 IssmDouble rho_water,rho_ice,density; 1902 IssmDouble melting[NUMVERTICES]; 1903 IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES]; 1904 1904 1905 1905 /*Recover info at the vertices: */ … … 1917 1917 for(i=0;i<NUMVERTICES;i++){ 1918 1918 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */ 1919 if( old_floating_ice[nodes[i]->Sid()]){1919 if(reCast<bool>(old_floating_ice[nodes[i]->Sid()])){ 1920 1920 if(b[i]<=ba[i]){ 1921 1921 b[i]=ba[i]; … … 1937 1937 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 1938 1938 } 1939 else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){1939 else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){ 1940 1940 s[i]=(1-density)*h[i]; 1941 1941 b[i]=-density*h[i]; … … 1969 1969 } 1970 1970 /*}}}*/ 1971 /*FUNCTION Tria::MyRank {{{ 1*/1971 /*FUNCTION Tria::MyRank {{{*/ 1972 1972 int Tria::MyRank(void){ 1973 1973 extern int my_rank; … … 1975 1975 } 1976 1976 /*}}}*/ 1977 /*FUNCTION Tria::NodalValue {{{ 1*/1978 int Tria::NodalValue( double* pvalue, int index, int natureofdataenum,bool process_units){1977 /*FUNCTION Tria::NodalValue {{{*/ 1978 int Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units){ 1979 1979 1980 1980 int i; 1981 1981 int found=0; 1982 double value;1982 IssmDouble value; 1983 1983 Input* data=NULL; 1984 1984 GaussTria *gauss = NULL; … … 2006 2006 } 2007 2007 /*}}}*/ 2008 /*FUNCTION Tria::PatchFill{{{ 1*/2008 /*FUNCTION Tria::PatchFill{{{*/ 2009 2009 void Tria::PatchFill(int* prow, Patch* patch){ 2010 2010 … … 2033 2033 } 2034 2034 /*}}}*/ 2035 /*FUNCTION Tria::PatchSize{{{ 1*/2035 /*FUNCTION Tria::PatchSize{{{*/ 2036 2036 void Tria::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes){ 2037 2037 … … 2057 2057 } 2058 2058 /*}}}*/ 2059 /*FUNCTION Tria::PotentialSheetUngrounding{{{ 1*/2059 /*FUNCTION Tria::PotentialSheetUngrounding{{{*/ 2060 2060 void Tria::PotentialSheetUngrounding(Vector* potential_sheet_ungrounding){ 2061 2061 2062 2062 int i; 2063 double h[NUMVERTICES],ba[NUMVERTICES];2064 double bed_hydro;2065 double rho_water,rho_ice,density;2063 IssmDouble h[NUMVERTICES],ba[NUMVERTICES]; 2064 IssmDouble bed_hydro; 2065 IssmDouble rho_water,rho_ice,density; 2066 2066 bool elementonshelf = false; 2067 2067 … … 2086 2086 } 2087 2087 /*}}}*/ 2088 /*FUNCTION Tria::PositiveDegreeDay{{{ 1*/2089 void Tria::PositiveDegreeDay( double* pdds,double* pds,double signorm){2090 2091 double agd[NUMVERTICES]; // surface mass balance2092 double monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];2093 double h[NUMVERTICES],s[NUMVERTICES]; // ,b2094 double rho_water,rho_ice;2088 /*FUNCTION Tria::PositiveDegreeDay{{{*/ 2089 void Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){ 2090 2091 IssmDouble agd[NUMVERTICES]; // surface mass balance 2092 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12]; 2093 IssmDouble h[NUMVERTICES],s[NUMVERTICES]; // ,b 2094 IssmDouble rho_water,rho_ice; 2095 2095 2096 2096 /*Recover monthly temperatures and precipitation*/ … … 2098 2098 Input* input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2); 2099 2099 GaussTria* gauss=new GaussTria(); 2100 double time,yts;2100 IssmDouble time,yts; 2101 2101 this->parameters->FindParam(&time,TimeEnum); 2102 2102 this->parameters->FindParam(&yts,ConstantsYtsEnum); … … 2129 2129 } 2130 2130 /*}}}*/ 2131 /*FUNCTION Tria::ProcessResultsUnits{{{ 1*/2131 /*FUNCTION Tria::ProcessResultsUnits{{{*/ 2132 2132 void Tria::ProcessResultsUnits(void){ 2133 2133 … … 2140 2140 } 2141 2141 /*}}}*/ 2142 /*FUNCTION Tria::RequestedOutput{{{ 1*/2143 void Tria::RequestedOutput(int output_enum,int step, double time){2142 /*FUNCTION Tria::RequestedOutput{{{*/ 2143 void Tria::RequestedOutput(int output_enum,int step,IssmDouble time){ 2144 2144 2145 2145 if(IsInput(output_enum)){ … … 2168 2168 } 2169 2169 /*}}}*/ 2170 /*FUNCTION Tria::SetClone {{{ 1*/2170 /*FUNCTION Tria::SetClone {{{*/ 2171 2171 void Tria::SetClone(int* minranks){ 2172 2172 2173 _error_("not implemented yet"); 2174 } 2175 /*}}}1*/ 2176 /*FUNCTION Tria::SmearFunction {{{1*/ 2177 void Tria::SmearFunction(Vector* smearedvector,double (*WeightFunction)(double distance,double radius),double radius){ 2178 _error_("not implemented yet"); 2179 2180 } 2181 /*}}}1*/ 2182 /*FUNCTION Tria::SetCurrentConfiguration {{{1*/ 2173 _error2_("not implemented yet"); 2174 } 2175 /*}}}*/ 2176 /*FUNCTION Tria::SmearFunction {{{*/ 2177 void Tria::SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){ 2178 _error2_("not implemented yet"); 2179 2180 } 2181 /*}}}*/ 2182 /*FUNCTION Tria::SmbGradients{{{*/ 2183 void Tria::SmbGradients(void){ 2184 2185 int i; 2186 2187 // input 2188 IssmDouble h[NUMVERTICES]; // ice thickness (m) 2189 IssmDouble s[NUMVERTICES]; // surface elevation (m) 2190 IssmDouble a_pos[NUMVERTICES]; // Hs-SMB relation parameter 2191 IssmDouble b_pos[NUMVERTICES]; // Hs-SMB relation parameter 2192 IssmDouble a_neg[NUMVERTICES]; // Hs-SMB relation parameter 2193 IssmDouble b_neg[NUMVERTICES]; // Hs-SMB relation paremeter 2194 IssmDouble Hc[NUMVERTICES]; // elevation of transition between accumulation regime and ablation regime 2195 IssmDouble smb_pos_max[NUMVERTICES]; // maximum SMB value in the accumulation regime 2196 IssmDouble smb_pos_min[NUMVERTICES]; // minimum SMB value in the accumulation regime 2197 IssmDouble rho_water; // density of fresh water 2198 IssmDouble rho_ice; // density of ice 2199 2200 // output 2201 IssmDouble smb[NUMVERTICES]; // surface mass balance (m/yr ice) 2202 2203 /*Recover SmbGradients*/ 2204 GetInputListOnVertices(&Hc[0],SurfaceforcingsHcEnum); 2205 GetInputListOnVertices(&smb_pos_max[0],SurfaceforcingsSmbPosMaxEnum); 2206 GetInputListOnVertices(&smb_pos_min[0],SurfaceforcingsSmbPosMinEnum); 2207 GetInputListOnVertices(&a_pos[0],SurfaceforcingsAPosEnum); 2208 GetInputListOnVertices(&b_pos[0],SurfaceforcingsBPosEnum); 2209 GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum); 2210 GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum); 2211 2212 /*Recover surface elevatio at vertices: */ 2213 GetInputListOnVertices(&h[0],ThicknessEnum); 2214 GetInputListOnVertices(&s[0],SurfaceEnum); 2215 2216 /*Get material parameters :*/ 2217 rho_ice=matpar->GetRhoIce(); 2218 rho_water=matpar->GetRhoFreshwater(); 2219 2220 // loop over all vertices 2221 for(i=0;i<NUMVERTICES;i++){ 2222 if(s[i]>Hc[i]){ 2223 smb[i]=a_pos[i]+b_pos[i]*s[i]; 2224 if(smb[i]>smb_pos_max[i]){smb[i]=smb_pos_max[i];} 2225 if(smb[i]<smb_pos_min[i]){smb[i]=smb_pos_min[i];} 2226 } 2227 else{ 2228 smb[i]=a_neg[i]+b_neg[i]*s[i]; 2229 } 2230 smb[i]=smb[i]/rho_ice; // SMB in m/y ice 2231 } //end of the loop over the vertices 2232 /*Update inputs*/ 2233 this->inputs->AddInput(new TriaP1Input(SurfaceforcingsMassBalanceEnum,&smb[0])); 2234 } 2235 /*}}}*/ 2236 /*FUNCTION Tria::SetCurrentConfiguration {{{*/ 2183 2237 void Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, DataSet* nodesin, Materials* materialsin, Parameters* parametersin){ 2184 2238 … … 2196 2250 } 2197 2251 /*}}}*/ 2198 /*FUNCTION Tria::SurfaceArea {{{ 1*/2199 double Tria::SurfaceArea(void){2252 /*FUNCTION Tria::SurfaceArea {{{*/ 2253 IssmDouble Tria::SurfaceArea(void){ 2200 2254 2201 2255 int i; 2202 double S;2203 double normal[3];2204 double v13[3],v23[3];2205 double xyz_list[NUMVERTICES][3];2256 IssmDouble S; 2257 IssmDouble normal[3]; 2258 IssmDouble v13[3],v23[3]; 2259 IssmDouble xyz_list[NUMVERTICES][3]; 2206 2260 2207 2261 /*If on water, return 0: */ … … 2219 2273 normal[2]=v13[0]*v23[1]-v13[1]*v23[0]; 2220 2274 2221 S = 0.5 * sqrt(pow(normal[0],( double)2)+pow(normal[1],(double)2)+pow(normal[2],(double)2));2275 S = 0.5 * sqrt(pow(normal[0],(IssmDouble)2)+pow(normal[1],(IssmDouble)2)+pow(normal[2],(IssmDouble)2)); 2222 2276 2223 2277 /*Return: */ … … 2225 2279 } 2226 2280 /*}}}*/ 2227 /*FUNCTION Tria::SurfaceNormal{{{ 1*/2228 void Tria::SurfaceNormal( double* surface_normal, double xyz_list[3][3]){2281 /*FUNCTION Tria::SurfaceNormal{{{*/ 2282 void Tria::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){ 2229 2283 2230 2284 int i; 2231 double v13[3],v23[3];2232 double normal[3];2233 double normal_norm;2285 IssmDouble v13[3],v23[3]; 2286 IssmDouble normal[3]; 2287 IssmDouble normal_norm; 2234 2288 2235 2289 for (i=0;i<3;i++){ … … 2242 2296 normal[2]=v13[0]*v23[1]-v13[1]*v23[0]; 2243 2297 2244 normal_norm=sqrt( pow(normal[0],( double)2)+pow(normal[1],(double)2)+pow(normal[2],(double)2) );2298 normal_norm=sqrt( pow(normal[0],(IssmDouble)2)+pow(normal[1],(IssmDouble)2)+pow(normal[2],(IssmDouble)2) ); 2245 2299 2246 2300 *(surface_normal)=normal[0]/normal_norm; … … 2249 2303 } 2250 2304 /*}}}*/ 2251 /*FUNCTION Tria::TimeAdapt{{{ 1*/2252 double Tria::TimeAdapt(void){2305 /*FUNCTION Tria::TimeAdapt{{{*/ 2306 IssmDouble Tria::TimeAdapt(void){ 2253 2307 2254 2308 /*intermediary: */ 2255 2309 int i; 2256 double C,dt;2257 double dx,dy;2258 double maxx,minx;2259 double maxy,miny;2260 double maxabsvx,maxabsvy;2261 double xyz_list[NUMVERTICES][3];2310 IssmDouble C,dt; 2311 IssmDouble dx,dy; 2312 IssmDouble maxx,minx; 2313 IssmDouble maxy,miny; 2314 IssmDouble maxabsvx,maxabsvy; 2315 IssmDouble xyz_list[NUMVERTICES][3]; 2262 2316 2263 2317 /*get CFL coefficient:*/ … … 2269 2323 this->MaxAbsVy(&maxabsvy,false); 2270 2324 #else 2271 _error _("ISSM was not compiled with responses compiled in, exiting!");2325 _error2_("ISSM was not compiled with responses compiled in, exiting!"); 2272 2326 #endif 2273 2327 … … 2295 2349 } 2296 2350 /*}}}*/ 2297 /*FUNCTION Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type){{{ 1*/2351 /*FUNCTION Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type){{{*/ 2298 2352 void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index 2299 2353 … … 2303 2357 int tria_vertex_ids[3]; 2304 2358 int tria_type; 2305 double nodeinputs[3];2306 double yts;2359 IssmDouble nodeinputs[3]; 2360 IssmDouble yts; 2307 2361 int progstabilization,balancestabilization; 2308 2362 bool dakota_analysis; 2309 2363 2310 2364 /*Checks if debuging*/ 2311 /*{{{ 2*/2365 /*{{{*/ 2312 2366 _assert_(iomodel->Data(MeshElementsEnum)); 2313 2367 /*}}}*/ … … 2332 2386 /*Recover vertices ids needed to initialize inputs*/ 2333 2387 for(i=0;i<3;i++){ 2334 tria_vertex_ids[i]= (int)iomodel->Data(MeshElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab2388 tria_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[3*index+i]); //ids for vertices are in the elements array from Matlab 2335 2389 } 2336 2390 … … 2345 2399 /*Continuous Galerkin*/ 2346 2400 for(i=0;i<3;i++){ 2347 tria_node_ids[i]=iomodel->nodecounter+ (int)*(iomodel->Data(MeshElementsEnum)+3*index+i); //ids for vertices are in the elements array from Matlab2401 tria_node_ids[i]=iomodel->nodecounter+reCast<int,IssmDouble>(*(iomodel->Data(MeshElementsEnum)+3*index+i)); //ids for vertices are in the elements array from Matlab 2348 2402 } 2349 2403 } … … 2395 2449 } 2396 2450 /*}}}*/ 2397 /*FUNCTION Tria::UpdatePotentialSheetUngrounding{{{ 1*/2398 int Tria::UpdatePotentialSheetUngrounding( double* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf){2451 /*FUNCTION Tria::UpdatePotentialSheetUngrounding{{{*/ 2452 int Tria::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){ 2399 2453 2400 2454 int i; … … 2403 2457 /*Go through nodes, and whoever is on the potential_sheet_ungrounding, ends up in nodes_on_iceshelf: */ 2404 2458 for(i=0;i<3;i++){ 2405 if ( vertices_potentially_ungrounding[nodes[i]->Sid()]){2459 if (reCast<bool>(vertices_potentially_ungrounding[nodes[i]->Sid()])){ 2406 2460 vec_nodes_on_iceshelf->SetValue(nodes[i]->Sid(),1,INS_VAL); 2407 2461 … … 2417 2471 2418 2472 #ifdef _HAVE_RESPONSES_ 2419 /*FUNCTION Tria::IceVolume {{{ 1*/2420 double Tria::IceVolume(void){2473 /*FUNCTION Tria::IceVolume {{{*/ 2474 IssmDouble Tria::IceVolume(void){ 2421 2475 2422 2476 /*The volume of a troncated prism is base * 1/3 sum(length of edges)*/ 2423 double base,surface,bed;2424 double xyz_list[NUMVERTICES][3];2477 IssmDouble base,surface,bed; 2478 IssmDouble xyz_list[NUMVERTICES][3]; 2425 2479 2426 2480 if(IsOnWater())return 0; … … 2443 2497 } 2444 2498 /*}}}*/ 2445 /*FUNCTION Tria::MassFlux {{{ 1*/2446 double Tria::MassFlux( double* segment,bool process_units){2499 /*FUNCTION Tria::MassFlux {{{*/ 2500 IssmDouble Tria::MassFlux( IssmDouble* segment,bool process_units){ 2447 2501 2448 2502 const int numdofs=2; 2449 2503 2450 2504 int i,dim; 2451 double mass_flux=0;2452 double xyz_list[NUMVERTICES][3];2453 double normal[2];2454 double length,rho_ice;2455 double x1,y1,x2,y2,h1,h2;2456 double vx1,vx2,vy1,vy2;2505 IssmDouble mass_flux=0; 2506 IssmDouble xyz_list[NUMVERTICES][3]; 2507 IssmDouble normal[2]; 2508 IssmDouble length,rho_ice; 2509 IssmDouble x1,y1,x2,y2,h1,h2; 2510 IssmDouble vx1,vx2,vy1,vy2; 2457 2511 GaussTria* gauss_1=NULL; 2458 2512 GaussTria* gauss_2=NULL; … … 2462 2516 2463 2517 /*First off, check that this segment belongs to this element: */ 2464 if ((int)*(segment+4)!=this->id)_error _("%s%i%s%i","error message: segment with id ",(int)*(segment+4)," does not belong to element with id:",this->id);2518 if ((int)*(segment+4)!=this->id)_error2_("error message: segment with id " << (int)*(segment+4) << " does not belong to element with id:" << this->id); 2465 2519 2466 2520 /*Recover segment node locations: */ … … 2515 2569 } 2516 2570 /*}}}*/ 2517 /*FUNCTION Tria::MaxAbsVx{{{ 1*/2518 void Tria::MaxAbsVx( double* pmaxabsvx, bool process_units){2571 /*FUNCTION Tria::MaxAbsVx{{{*/ 2572 void Tria::MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units){ 2519 2573 2520 2574 /*Get maximum:*/ 2521 double maxabsvx=this->inputs->MaxAbs(VxEnum);2575 IssmDouble maxabsvx=this->inputs->MaxAbs(VxEnum); 2522 2576 2523 2577 /*process units if requested: */ … … 2528 2582 } 2529 2583 /*}}}*/ 2530 /*FUNCTION Tria::MaxAbsVy{{{ 1*/2531 void Tria::MaxAbsVy( double* pmaxabsvy, bool process_units){2584 /*FUNCTION Tria::MaxAbsVy{{{*/ 2585 void Tria::MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units){ 2532 2586 2533 2587 /*Get maximum:*/ 2534 double maxabsvy=this->inputs->MaxAbs(VyEnum);2588 IssmDouble maxabsvy=this->inputs->MaxAbs(VyEnum); 2535 2589 2536 2590 /*process units if requested: */ … … 2541 2595 } 2542 2596 /*}}}*/ 2543 /*FUNCTION Tria::MaxAbsVz{{{ 1*/2544 void Tria::MaxAbsVz( double* pmaxabsvz, bool process_units){2597 /*FUNCTION Tria::MaxAbsVz{{{*/ 2598 void Tria::MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units){ 2545 2599 2546 2600 /*Get maximum:*/ 2547 double maxabsvz=this->inputs->MaxAbs(VzEnum);2601 IssmDouble maxabsvz=this->inputs->MaxAbs(VzEnum); 2548 2602 2549 2603 /*process units if requested: */ … … 2554 2608 } 2555 2609 /*}}}*/ 2556 /*FUNCTION Tria::MaxVel{{{ 1*/2557 void Tria::MaxVel( double* pmaxvel, bool process_units){2610 /*FUNCTION Tria::MaxVel{{{*/ 2611 void Tria::MaxVel(IssmDouble* pmaxvel, bool process_units){ 2558 2612 2559 2613 /*Get maximum:*/ 2560 double maxvel=this->inputs->Max(VelEnum);2614 IssmDouble maxvel=this->inputs->Max(VelEnum); 2561 2615 2562 2616 /*process units if requested: */ … … 2567 2621 } 2568 2622 /*}}}*/ 2569 /*FUNCTION Tria::MaxVx{{{ 1*/2570 void Tria::MaxVx( double* pmaxvx, bool process_units){2623 /*FUNCTION Tria::MaxVx{{{*/ 2624 void Tria::MaxVx(IssmDouble* pmaxvx, bool process_units){ 2571 2625 2572 2626 /*Get maximum:*/ 2573 double maxvx=this->inputs->Max(VxEnum);2627 IssmDouble maxvx=this->inputs->Max(VxEnum); 2574 2628 2575 2629 /*process units if requested: */ … … 2580 2634 } 2581 2635 /*}}}*/ 2582 /*FUNCTION Tria::MaxVy{{{ 1*/2583 void Tria::MaxVy( double* pmaxvy, bool process_units){2636 /*FUNCTION Tria::MaxVy{{{*/ 2637 void Tria::MaxVy(IssmDouble* pmaxvy, bool process_units){ 2584 2638 2585 2639 /*Get maximum:*/ 2586 double maxvy=this->inputs->Max(VyEnum);2640 IssmDouble maxvy=this->inputs->Max(VyEnum); 2587 2641 2588 2642 /*process units if requested: */ … … 2594 2648 } 2595 2649 /*}}}*/ 2596 /*FUNCTION Tria::MaxVz{{{ 1*/2597 void Tria::MaxVz( double* pmaxvz, bool process_units){2650 /*FUNCTION Tria::MaxVz{{{*/ 2651 void Tria::MaxVz(IssmDouble* pmaxvz, bool process_units){ 2598 2652 2599 2653 /*Get maximum:*/ 2600 double maxvz=this->inputs->Max(VzEnum);2654 IssmDouble maxvz=this->inputs->Max(VzEnum); 2601 2655 2602 2656 /*process units if requested: */ … … 2607 2661 } 2608 2662 /*}}}*/ 2609 /*FUNCTION Tria::MinVel{{{ 1*/2610 void Tria::MinVel( double* pminvel, bool process_units){2663 /*FUNCTION Tria::MinVel{{{*/ 2664 void Tria::MinVel(IssmDouble* pminvel, bool process_units){ 2611 2665 2612 2666 /*Get minimum:*/ 2613 double minvel=this->inputs->Min(VelEnum);2667 IssmDouble minvel=this->inputs->Min(VelEnum); 2614 2668 2615 2669 /*process units if requested: */ … … 2620 2674 } 2621 2675 /*}}}*/ 2622 /*FUNCTION Tria::MinVx{{{ 1*/2623 void Tria::MinVx( double* pminvx, bool process_units){2676 /*FUNCTION Tria::MinVx{{{*/ 2677 void Tria::MinVx(IssmDouble* pminvx, bool process_units){ 2624 2678 2625 2679 /*Get minimum:*/ 2626 double minvx=this->inputs->Min(VxEnum);2680 IssmDouble minvx=this->inputs->Min(VxEnum); 2627 2681 2628 2682 /*process units if requested: */ … … 2633 2687 } 2634 2688 /*}}}*/ 2635 /*FUNCTION Tria::MinVy{{{ 1*/2636 void Tria::MinVy( double* pminvy, bool process_units){2689 /*FUNCTION Tria::MinVy{{{*/ 2690 void Tria::MinVy(IssmDouble* pminvy, bool process_units){ 2637 2691 2638 2692 /*Get minimum:*/ 2639 double minvy=this->inputs->Min(VyEnum);2693 IssmDouble minvy=this->inputs->Min(VyEnum); 2640 2694 2641 2695 /*process units if requested: */ … … 2646 2700 } 2647 2701 /*}}}*/ 2648 /*FUNCTION Tria::MinVz{{{ 1*/2649 void Tria::MinVz( double* pminvz, bool process_units){2702 /*FUNCTION Tria::MinVz{{{*/ 2703 void Tria::MinVz(IssmDouble* pminvz, bool process_units){ 2650 2704 2651 2705 /*Get minimum:*/ 2652 double minvz=this->inputs->Min(VzEnum);2706 IssmDouble minvz=this->inputs->Min(VzEnum); 2653 2707 2654 2708 /*process units if requested: */ … … 2659 2713 } 2660 2714 /*}}}*/ 2661 /*FUNCTION Tria::ElementResponse{{{ 1*/2662 void Tria::ElementResponse( double* presponse,int response_enum,bool process_units){2715 /*FUNCTION Tria::ElementResponse{{{*/ 2716 void Tria::ElementResponse(IssmDouble* presponse,int response_enum,bool process_units){ 2663 2717 2664 2718 switch(response_enum){ … … 2669 2723 2670 2724 /*Get input:*/ 2671 double vel;2725 IssmDouble vel; 2672 2726 Input* vel_input; 2673 2727 … … 2681 2735 *presponse=vel; 2682 2736 default: 2683 _error _("Response type %s not supported yet!",EnumToStringx(response_enum));2737 _error2_("Response type " << EnumToStringx(response_enum) << " not supported yet!"); 2684 2738 } 2685 2739 … … 2689 2743 2690 2744 #ifdef _HAVE_DIAGNOSTIC_ 2691 /*FUNCTION Tria::CreateKMatrixDiagnosticMacAyeal {{{ 1*/2745 /*FUNCTION Tria::CreateKMatrixDiagnosticMacAyeal {{{*/ 2692 2746 ElementMatrix* Tria::CreateKMatrixDiagnosticMacAyeal(void){ 2693 2747 … … 2703 2757 } 2704 2758 /*}}}*/ 2705 /*FUNCTION Tria::CreateKMatrixDiagnosticMacAyealViscous{{{ 1*/2759 /*FUNCTION Tria::CreateKMatrixDiagnosticMacAyealViscous{{{*/ 2706 2760 ElementMatrix* Tria::CreateKMatrixDiagnosticMacAyealViscous(void){ 2707 2761 … … 2711 2765 /*Intermediaries*/ 2712 2766 int i,j,ig; 2713 double xyz_list[NUMVERTICES][3];2714 double viscosity,newviscosity,oldviscosity;2715 double viscosity_overshoot,thickness,Jdet;2716 double epsilon[3],oldepsilon[3]; /* epsilon=[exx,eyy,exy]; */2717 double B[3][numdof];2718 double Bprime[3][numdof];2719 double D[3][3] = {0.0};2720 double D_scalar;2767 IssmDouble xyz_list[NUMVERTICES][3]; 2768 IssmDouble viscosity,newviscosity,oldviscosity; 2769 IssmDouble viscosity_overshoot,thickness,Jdet; 2770 IssmDouble epsilon[3],oldepsilon[3]; /* epsilon=[exx,eyy,exy]; */ 2771 IssmDouble B[3][numdof]; 2772 IssmDouble Bprime[3][numdof]; 2773 IssmDouble D[3][3] = {0.0}; 2774 IssmDouble D_scalar; 2721 2775 GaussTria *gauss = NULL; 2722 2776 … … 2767 2821 } 2768 2822 /*}}}*/ 2769 /*FUNCTION Tria::CreateKMatrixDiagnosticMacAyealFriction {{{ 1*/2823 /*FUNCTION Tria::CreateKMatrixDiagnosticMacAyealFriction {{{*/ 2770 2824 ElementMatrix* Tria::CreateKMatrixDiagnosticMacAyealFriction(void){ 2771 2825 … … 2776 2830 int i,j,ig; 2777 2831 int analysis_type; 2778 double MAXSLOPE = .06; // 6 %2779 double MOUNTAINKEXPONENT = 10;2780 double slope_magnitude,alpha2;2781 double Jdet;2782 double L[2][numdof];2783 double DL[2][2] = {{ 0,0 },{0,0}};2784 double DL_scalar;2785 double slope[2] = {0.0,0.0};2786 double xyz_list[NUMVERTICES][3];2832 IssmDouble MAXSLOPE = .06; // 6 % 2833 IssmDouble MOUNTAINKEXPONENT = 10; 2834 IssmDouble slope_magnitude,alpha2; 2835 IssmDouble Jdet; 2836 IssmDouble L[2][numdof]; 2837 IssmDouble DL[2][2] = {{ 0,0 },{0,0}}; 2838 IssmDouble DL_scalar; 2839 IssmDouble slope[2] = {0.0,0.0}; 2840 IssmDouble xyz_list[NUMVERTICES][3]; 2787 2841 Friction *friction = NULL; 2788 2842 GaussTria *gauss = NULL; … … 2813 2867 surface_input->GetInputDerivativeValue(&slope[0],&xyz_list[0][0],gauss); 2814 2868 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2)); 2815 if(slope_magnitude>MAXSLOPE) alpha2=pow(( double)10,MOUNTAINKEXPONENT);2869 if(slope_magnitude>MAXSLOPE) alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT); 2816 2870 else friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum); 2817 2871 … … 2836 2890 } 2837 2891 /*}}}*/ 2838 /*FUNCTION Tria::CreateKMatrixDiagnosticHutter{{{ 1*/2892 /*FUNCTION Tria::CreateKMatrixDiagnosticHutter{{{*/ 2839 2893 ElementMatrix* Tria::CreateKMatrixDiagnosticHutter(void){ 2840 2894 … … 2849 2903 for(i=0;i<NUMVERTICES;i++){ 2850 2904 connectivity=nodes[i]->GetConnectivity(); 2851 Ke->values[(2*i)*numdof +(2*i) ]=1/( double)connectivity;2852 Ke->values[(2*i+1)*numdof+(2*i+1)]=1/( double)connectivity;2905 Ke->values[(2*i)*numdof +(2*i) ]=1/(IssmDouble)connectivity; 2906 Ke->values[(2*i+1)*numdof+(2*i+1)]=1/(IssmDouble)connectivity; 2853 2907 } 2854 2908 … … 2857 2911 } 2858 2912 /*}}}*/ 2859 /*FUNCTION Tria::CreatePVectorDiagnosticMacAyeal {{{ 1*/2913 /*FUNCTION Tria::CreatePVectorDiagnosticMacAyeal {{{*/ 2860 2914 ElementVector* Tria::CreatePVectorDiagnosticMacAyeal(){ 2861 2915 … … 2865 2919 /*Intermediaries */ 2866 2920 int i,j,ig; 2867 double driving_stress_baseline,thickness;2868 double Jdet;2869 double xyz_list[NUMVERTICES][3];2870 double slope[2];2871 double basis[3];2872 double pe_g_gaussian[numdof];2921 IssmDouble driving_stress_baseline,thickness; 2922 IssmDouble Jdet; 2923 IssmDouble xyz_list[NUMVERTICES][3]; 2924 IssmDouble slope[2]; 2925 IssmDouble basis[3]; 2926 IssmDouble pe_g_gaussian[numdof]; 2873 2927 GaussTria* gauss=NULL; 2874 2928 … … 2911 2965 } 2912 2966 /*}}}*/ 2913 /*FUNCTION Tria::CreatePVectorDiagnosticHutter{{{ 1*/2967 /*FUNCTION Tria::CreatePVectorDiagnosticHutter{{{*/ 2914 2968 ElementVector* Tria::CreatePVectorDiagnosticHutter(void){ 2915 2969 2916 2970 /*Intermediaries */ 2917 2971 int i,connectivity; 2918 double constant_part,ub,vb;2919 double rho_ice,gravity,n,B;2920 double slope2,thickness;2921 double slope[2];2972 IssmDouble constant_part,ub,vb; 2973 IssmDouble rho_ice,gravity,n,B; 2974 IssmDouble slope2,thickness; 2975 IssmDouble slope[2]; 2922 2976 GaussTria* gauss=NULL; 2923 2977 … … 2949 3003 constant_part=-2*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2)); 2950 3004 2951 ub=-1.58*pow(( double)10.0,(double)-10.0)*rho_ice*gravity*thickness*slope[0];2952 vb=-1.58*pow(( double)10.0,(double)-10.0)*rho_ice*gravity*thickness*slope[1];2953 2954 pe->values[2*i] =(ub-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/( double)connectivity;2955 pe->values[2*i+1]=(vb-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/( double)connectivity;3005 ub=-1.58*pow((IssmDouble)10.0,(IssmDouble)-10.0)*rho_ice*gravity*thickness*slope[0]; 3006 vb=-1.58*pow((IssmDouble)10.0,(IssmDouble)-10.0)*rho_ice*gravity*thickness*slope[1]; 3007 3008 pe->values[2*i] =(ub-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/(IssmDouble)connectivity; 3009 pe->values[2*i+1]=(vb-2.0*pow(rho_ice*gravity,n)*pow(slope2,((n-1)/2.0))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/(IssmDouble)connectivity; 2956 3010 } 2957 3011 … … 2961 3015 } 2962 3016 /*}}}*/ 2963 /*FUNCTION Tria::CreateJacobianDiagnosticMacayeal{{{ 1*/3017 /*FUNCTION Tria::CreateJacobianDiagnosticMacayeal{{{*/ 2964 3018 ElementMatrix* Tria::CreateJacobianDiagnosticMacayeal(void){ 2965 3019 … … 2969 3023 /*Intermediaries */ 2970 3024 int i,j,ig; 2971 double xyz_list[NUMVERTICES][3];2972 double Jdet,thickness;2973 double eps1dotdphii,eps1dotdphij;2974 double eps2dotdphii,eps2dotdphij;2975 double mu_prime;2976 double epsilon[3];/* epsilon=[exx,eyy,exy];*/2977 double eps1[2],eps2[2];2978 double phi[NUMVERTICES];2979 double dphi[2][NUMVERTICES];3025 IssmDouble xyz_list[NUMVERTICES][3]; 3026 IssmDouble Jdet,thickness; 3027 IssmDouble eps1dotdphii,eps1dotdphij; 3028 IssmDouble eps2dotdphii,eps2dotdphij; 3029 IssmDouble mu_prime; 3030 IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];*/ 3031 IssmDouble eps1[2],eps2[2]; 3032 IssmDouble phi[NUMVERTICES]; 3033 IssmDouble dphi[2][NUMVERTICES]; 2980 3034 GaussTria *gauss=NULL; 2981 3035 … … 3027 3081 } 3028 3082 /*}}}*/ 3029 /*FUNCTION Tria::GetSolutionFromInputsDiagnosticHoriz{{{ 1*/3083 /*FUNCTION Tria::GetSolutionFromInputsDiagnosticHoriz{{{*/ 3030 3084 void Tria::GetSolutionFromInputsDiagnosticHoriz(Vector* solution){ 3031 3085 … … 3034 3088 int i; 3035 3089 int* doflist=NULL; 3036 double vx,vy;3037 double values[numdof];3090 IssmDouble vx,vy; 3091 IssmDouble values[numdof]; 3038 3092 GaussTria* gauss=NULL; 3039 3093 … … 3063 3117 /*Free ressources:*/ 3064 3118 delete gauss; 3065 x free((void**)&doflist);3066 } 3067 /*}}}*/ 3068 /*FUNCTION Tria::GetSolutionFromInputsDiagnosticHutter{{{ 1*/3119 xDelete<int>(doflist); 3120 } 3121 /*}}}*/ 3122 /*FUNCTION Tria::GetSolutionFromInputsDiagnosticHutter{{{*/ 3069 3123 void Tria::GetSolutionFromInputsDiagnosticHutter(Vector* solution){ 3070 3124 … … 3072 3126 3073 3127 int i; 3074 double vx,vy;3075 double values[numdof];3128 IssmDouble vx,vy; 3129 IssmDouble values[numdof]; 3076 3130 int *doflist = NULL; 3077 3131 GaussTria *gauss = NULL; … … 3102 3156 /*Free ressources:*/ 3103 3157 delete gauss; 3104 x free((void**)&doflist);3105 } 3106 /*}}}*/ 3107 /*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHoriz {{{ 1*/3108 void Tria::InputUpdateFromSolutionDiagnosticHoriz( double* solution){3158 xDelete<int>(doflist); 3159 } 3160 /*}}}*/ 3161 /*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHoriz {{{*/ 3162 void Tria::InputUpdateFromSolutionDiagnosticHoriz(IssmDouble* solution){ 3109 3163 3110 3164 const int numdof=NDOF2*NUMVERTICES; … … 3112 3166 int i; 3113 3167 int* doflist=NULL; 3114 double rho_ice,g;3115 double values[numdof];3116 double vx[NUMVERTICES];3117 double vy[NUMVERTICES];3118 double vz[NUMVERTICES];3119 double vel[NUMVERTICES];3120 double pressure[NUMVERTICES];3121 double thickness[NUMVERTICES];3168 IssmDouble rho_ice,g; 3169 IssmDouble values[numdof]; 3170 IssmDouble vx[NUMVERTICES]; 3171 IssmDouble vy[NUMVERTICES]; 3172 IssmDouble vz[NUMVERTICES]; 3173 IssmDouble vel[NUMVERTICES]; 3174 IssmDouble pressure[NUMVERTICES]; 3175 IssmDouble thickness[NUMVERTICES]; 3122 3176 3123 3177 /*Get dof list: */ … … 3136 3190 3137 3191 /*Check solution*/ 3138 if( isnan(vx[i])) _error_("NaN found in solution vector");3139 if( isnan(vy[i])) _error_("NaN found in solution vector");3192 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 3193 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 3140 3194 } 3141 3195 … … 3164 3218 3165 3219 /*Free ressources:*/ 3166 x free((void**)&doflist);3167 3168 } 3169 /*}}}*/ 3170 /*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHutter {{{ 1*/3171 void Tria::InputUpdateFromSolutionDiagnosticHutter( double* solution){3220 xDelete<int>(doflist); 3221 3222 } 3223 /*}}}*/ 3224 /*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHutter {{{*/ 3225 void Tria::InputUpdateFromSolutionDiagnosticHutter(IssmDouble* solution){ 3172 3226 3173 3227 const int numdof=NDOF2*NUMVERTICES; … … 3175 3229 int i; 3176 3230 int* doflist=NULL; 3177 double rho_ice,g;3178 double values[numdof];3179 double vx[NUMVERTICES];3180 double vy[NUMVERTICES];3181 double vz[NUMVERTICES];3182 double vel[NUMVERTICES];3183 double pressure[NUMVERTICES];3184 double thickness[NUMVERTICES];3231 IssmDouble rho_ice,g; 3232 IssmDouble values[numdof]; 3233 IssmDouble vx[NUMVERTICES]; 3234 IssmDouble vy[NUMVERTICES]; 3235 IssmDouble vz[NUMVERTICES]; 3236 IssmDouble vel[NUMVERTICES]; 3237 IssmDouble pressure[NUMVERTICES]; 3238 IssmDouble thickness[NUMVERTICES]; 3185 3239 3186 3240 /*Get dof list: */ … … 3196 3250 3197 3251 /*Check solution*/ 3198 if( isnan(vx[i])) _error_("NaN found in solution vector");3199 if( isnan(vy[i])) _error_("NaN found in solution vector");3252 if(xIsNan<IssmDouble>(vx[i])) _error2_("NaN found in solution vector"); 3253 if(xIsNan<IssmDouble>(vy[i])) _error2_("NaN found in solution vector"); 3200 3254 } 3201 3255 … … 3224 3278 3225 3279 /*Free ressources:*/ 3226 x free((void**)&doflist);3280 xDelete<int>(doflist); 3227 3281 } 3228 3282 /*}}}*/ … … 3230 3284 3231 3285 #ifdef _HAVE_CONTROL_ 3232 /*FUNCTION Tria::InputControlUpdate{{{ 1*/3233 void Tria::InputControlUpdate( double scalar,bool save_parameter){3286 /*FUNCTION Tria::InputControlUpdate{{{*/ 3287 void Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){ 3234 3288 3235 3289 /*Intermediary*/ … … 3252 3306 3253 3307 if (input->ObjectEnum()!=ControlInputEnum){ 3254 _error _("input %s is not a ControlInput",EnumToStringx(control_type[i]));3308 _error2_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput"); 3255 3309 } 3256 3310 … … 3262 3316 3263 3317 /*Clean up and return*/ 3264 x free((void**)&control_type);3265 } 3266 /*}}}*/ 3267 /*FUNCTION Tria::ControlInputGetGradient{{{ 1*/3318 xDelete<int>(control_type); 3319 } 3320 /*}}}*/ 3321 /*FUNCTION Tria::ControlInputGetGradient{{{*/ 3268 3322 void Tria::ControlInputGetGradient(Vector* gradient,int enum_type,int control_index){ 3269 3323 … … 3277 3331 input=inputs->GetInput(enum_type); 3278 3332 } 3279 if (!input) _error _("Input %s not found",EnumToStringx(enum_type));3280 if (input->ObjectEnum()!=ControlInputEnum) _error _("Input %s is not a ControlInput",EnumToStringx(enum_type));3333 if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found"); 3334 if (input->ObjectEnum()!=ControlInputEnum) _error2_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); 3281 3335 3282 3336 GradientIndexing(&doflist1[0],control_index); … … 3284 3338 3285 3339 }/*}}}*/ 3286 /*FUNCTION Tria::ControlInputScaleGradient{{{ 1*/3287 void Tria::ControlInputScaleGradient(int enum_type, double scale){3340 /*FUNCTION Tria::ControlInputScaleGradient{{{*/ 3341 void Tria::ControlInputScaleGradient(int enum_type,IssmDouble scale){ 3288 3342 3289 3343 Input* input=NULL; … … 3295 3349 input=inputs->GetInput(enum_type); 3296 3350 } 3297 if (!input) _error _("Input %s not found",EnumToStringx(enum_type));3298 if (input->ObjectEnum()!=ControlInputEnum) _error _("Input %s is not a ControlInput",EnumToStringx(enum_type));3351 if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found"); 3352 if (input->ObjectEnum()!=ControlInputEnum) _error2_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); 3299 3353 3300 3354 ((ControlInput*)input)->ScaleGradient(scale); 3301 3355 }/*}}}*/ 3302 /*FUNCTION Tria::ControlInputSetGradient{{{ 1*/3303 void Tria::ControlInputSetGradient( double* gradient,int enum_type,int control_index){3356 /*FUNCTION Tria::ControlInputSetGradient{{{*/ 3357 void Tria::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){ 3304 3358 3305 3359 int doflist1[NUMVERTICES]; 3306 double grad_list[NUMVERTICES];3360 IssmDouble grad_list[NUMVERTICES]; 3307 3361 Input* grad_input=NULL; 3308 3362 Input* input=NULL; … … 3314 3368 input=inputs->GetInput(enum_type); 3315 3369 } 3316 if (!input) _error _("Input %s not found",EnumToStringx(enum_type));3317 if (input->ObjectEnum()!=ControlInputEnum) _error _("Input %s is not a ControlInput",EnumToStringx(enum_type));3370 if (!input) _error2_("Input " << EnumToStringx(enum_type) << " not found"); 3371 if (input->ObjectEnum()!=ControlInputEnum) _error2_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); 3318 3372 3319 3373 GradientIndexing(&doflist1[0],control_index); … … 3324 3378 3325 3379 }/*}}}*/ 3326 /*FUNCTION Tria::Gradj {{{ 1*/3380 /*FUNCTION Tria::Gradj {{{*/ 3327 3381 void Tria::Gradj(Vector* gradient,int control_type,int control_index){ 3328 3382 /*dJ/dalpha = ∂L/∂alpha = ∂J/∂alpha + ∂/∂alpha(KU-F)*/ … … 3349 3403 break; 3350 3404 default: 3351 _error _("%s%i","control type not supported yet: ",control_type);3405 _error2_("control type not supported yet: " << control_type); 3352 3406 } 3353 3407 … … 3377 3431 break; 3378 3432 default: 3379 _error _("response %s not supported yet",EnumToStringx(responses[resp]));3380 } 3381 3382 x free((void**)&responses);3383 } 3384 /*}}}*/ 3385 /*FUNCTION Tria::GradjBGradient{{{ 1*/3433 _error2_("response " << EnumToStringx(responses[resp]) << " not supported yet"); 3434 } 3435 3436 xDelete<int>(responses); 3437 } 3438 /*}}}*/ 3439 /*FUNCTION Tria::GradjBGradient{{{*/ 3386 3440 void Tria::GradjBGradient(Vector* gradient,int weight_index,int control_index){ 3387 3441 3388 3442 int i,ig; 3389 3443 int doflist1[NUMVERTICES]; 3390 double Jdet,weight;3391 double xyz_list[NUMVERTICES][3];3392 double dbasis[NDOF2][NUMVERTICES];3393 double dk[NDOF2];3394 double grade_g[NUMVERTICES]={0.0};3444 IssmDouble Jdet,weight; 3445 IssmDouble xyz_list[NUMVERTICES][3]; 3446 IssmDouble dbasis[NDOF2][NUMVERTICES]; 3447 IssmDouble dk[NDOF2]; 3448 IssmDouble grade_g[NUMVERTICES]={0.0}; 3395 3449 GaussTria *gauss=NULL; 3396 3450 … … 3423 3477 } 3424 3478 /*}}}*/ 3425 /*FUNCTION Tria::GradjBMacAyeal{{{ 1*/3479 /*FUNCTION Tria::GradjBMacAyeal{{{*/ 3426 3480 void Tria::GradjBMacAyeal(Vector* gradient,int control_index){ 3427 3481 … … 3429 3483 int i,ig; 3430 3484 int doflist[NUMVERTICES]; 3431 double vx,vy,lambda,mu,thickness,Jdet;3432 double viscosity_complement;3433 double dvx[NDOF2],dvy[NDOF2],dadjx[NDOF2],dadjy[NDOF2],dB[NDOF2];3434 double xyz_list[NUMVERTICES][3];3435 double basis[3],epsilon[3];3436 double grad[NUMVERTICES]={0.0};3485 IssmDouble vx,vy,lambda,mu,thickness,Jdet; 3486 IssmDouble viscosity_complement; 3487 IssmDouble dvx[NDOF2],dvy[NDOF2],dadjx[NDOF2],dadjy[NDOF2],dB[NDOF2]; 3488 IssmDouble xyz_list[NUMVERTICES][3]; 3489 IssmDouble basis[3],epsilon[3]; 3490 IssmDouble grad[NUMVERTICES]={0.0}; 3437 3491 GaussTria *gauss = NULL; 3438 3492 … … 3480 3534 } 3481 3535 /*}}}*/ 3482 /*FUNCTION Tria::GradjDragMacAyeal {{{ 1*/3536 /*FUNCTION Tria::GradjDragMacAyeal {{{*/ 3483 3537 void Tria::GradjDragMacAyeal(Vector* gradient,int control_index){ 3484 3538 … … 3487 3541 int doflist1[NUMVERTICES]; 3488 3542 int connectivity[NUMVERTICES]; 3489 double vx,vy,lambda,mu,alpha_complement,Jdet;3490 double bed,thickness,Neff,drag;3491 double xyz_list[NUMVERTICES][3];3492 double dk[NDOF2];3493 double grade_g[NUMVERTICES]={0.0};3494 double grade_g_gaussian[NUMVERTICES];3495 double basis[3];3496 double epsilon[3]; /* epsilon=[exx,eyy,exy];*/3543 IssmDouble vx,vy,lambda,mu,alpha_complement,Jdet; 3544 IssmDouble bed,thickness,Neff,drag; 3545 IssmDouble xyz_list[NUMVERTICES][3]; 3546 IssmDouble dk[NDOF2]; 3547 IssmDouble grade_g[NUMVERTICES]={0.0}; 3548 IssmDouble grade_g_gaussian[NUMVERTICES]; 3549 IssmDouble basis[3]; 3550 IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 3497 3551 Friction* friction=NULL; 3498 3552 GaussTria *gauss=NULL; … … 3542 3596 /*Add gradje_g_gaussian vector to gradje_g: */ 3543 3597 for(i=0;i<NUMVERTICES;i++){ 3544 _assert_(! isnan(grade_g[i]));3598 _assert_(!xIsNan<IssmDouble>(grade_g[i])); 3545 3599 grade_g[i]+=grade_g_gaussian[i]; 3546 3600 } … … 3557 3611 // vx_input->GetInputValue(&vx,gauss); 3558 3612 // vy_input->GetInputValue(&vy,gauss); 3559 // grade_g[iv] = -2*1.e+7*drag*alpha_complement*(lambda*vx+mu*vy)/(( double)connectivity[iv]);3613 // grade_g[iv] = -2*1.e+7*drag*alpha_complement*(lambda*vx+mu*vy)/((IssmDouble)connectivity[iv]); 3560 3614 //} 3561 3615 /*End Analytical gradient*/ … … 3568 3622 } 3569 3623 /*}}}*/ 3570 /*FUNCTION Tria::GradjDragGradient{{{ 1*/3624 /*FUNCTION Tria::GradjDragGradient{{{*/ 3571 3625 void Tria::GradjDragGradient(Vector* gradient, int weight_index,int control_index){ 3572 3626 3573 3627 int i,ig; 3574 3628 int doflist1[NUMVERTICES]; 3575 double Jdet,weight;3576 double xyz_list[NUMVERTICES][3];3577 double dbasis[NDOF2][NUMVERTICES];3578 double dk[NDOF2];3579 double grade_g[NUMVERTICES]={0.0};3629 IssmDouble Jdet,weight; 3630 IssmDouble xyz_list[NUMVERTICES][3]; 3631 IssmDouble dbasis[NDOF2][NUMVERTICES]; 3632 IssmDouble dk[NDOF2]; 3633 IssmDouble grade_g[NUMVERTICES]={0.0}; 3580 3634 GaussTria *gauss=NULL; 3581 3635 … … 3603 3657 for (i=0;i<NUMVERTICES;i++){ 3604 3658 grade_g[i]+=-weight*Jdet*gauss->weight*(dbasis[0][i]*dk[0]+dbasis[1][i]*dk[1]); 3605 _assert_(! isnan(grade_g[i]));3659 _assert_(!xIsNan<IssmDouble>(grade_g[i])); 3606 3660 } 3607 3661 } … … 3612 3666 } 3613 3667 /*}}}*/ 3614 /*FUNCTION Tria::GradjDhDtBalancedthickness{{{ 1*/3668 /*FUNCTION Tria::GradjDhDtBalancedthickness{{{*/ 3615 3669 void Tria::GradjDhDtBalancedthickness(Vector* gradient,int control_index){ 3616 3670 3617 3671 /*Intermediaries*/ 3618 3672 int doflist1[NUMVERTICES]; 3619 double lambda[NUMVERTICES];3620 double gradient_g[NUMVERTICES];3673 IssmDouble lambda[NUMVERTICES]; 3674 IssmDouble gradient_g[NUMVERTICES]; 3621 3675 3622 3676 /*Compute Gradient*/ … … 3628 3682 } 3629 3683 /*}}}*/ 3630 /*FUNCTION Tria::GradjVxBalancedthickness{{{ 1*/3684 /*FUNCTION Tria::GradjVxBalancedthickness{{{*/ 3631 3685 void Tria::GradjVxBalancedthickness(Vector* gradient,int control_index){ 3632 3686 … … 3634 3688 int i,ig; 3635 3689 int doflist1[NUMVERTICES]; 3636 double thickness,Jdet;3637 double basis[3];3638 double Dlambda[2],dp[2];3639 double xyz_list[NUMVERTICES][3];3640 double grade_g[NUMVERTICES] = {0.0};3690 IssmDouble thickness,Jdet; 3691 IssmDouble basis[3]; 3692 IssmDouble Dlambda[2],dp[2]; 3693 IssmDouble xyz_list[NUMVERTICES][3]; 3694 IssmDouble grade_g[NUMVERTICES] = {0.0}; 3641 3695 GaussTria *gauss = NULL; 3642 3696 … … 3671 3725 } 3672 3726 /*}}}*/ 3673 /*FUNCTION Tria::GradjVyBalancedthickness{{{ 1*/3727 /*FUNCTION Tria::GradjVyBalancedthickness{{{*/ 3674 3728 void Tria::GradjVyBalancedthickness(Vector* gradient,int control_index){ 3675 3729 … … 3677 3731 int i,ig; 3678 3732 int doflist1[NUMVERTICES]; 3679 double thickness,Jdet;3680 double basis[3];3681 double Dlambda[2],dp[2];3682 double xyz_list[NUMVERTICES][3];3683 double grade_g[NUMVERTICES] = {0.0};3733 IssmDouble thickness,Jdet; 3734 IssmDouble basis[3]; 3735 IssmDouble Dlambda[2],dp[2]; 3736 IssmDouble xyz_list[NUMVERTICES][3]; 3737 IssmDouble grade_g[NUMVERTICES] = {0.0}; 3684 3738 GaussTria *gauss = NULL; 3685 3739 … … 3713 3767 } 3714 3768 /*}}}*/ 3715 /*FUNCTION Tria::GradientIndexing{{{ 1*/3769 /*FUNCTION Tria::GradientIndexing{{{*/ 3716 3770 void Tria::GradientIndexing(int* indexing,int control_index){ 3717 3771 … … 3727 3781 } 3728 3782 /*}}}*/ 3729 /*FUNCTION Tria::RheologyBbarAbsGradient{{{ 1*/3730 double Tria::RheologyBbarAbsGradient(bool process_units,int weight_index){3783 /*FUNCTION Tria::RheologyBbarAbsGradient{{{*/ 3784 IssmDouble Tria::RheologyBbarAbsGradient(bool process_units,int weight_index){ 3731 3785 3732 3786 /* Intermediaries */ 3733 3787 int ig; 3734 double Jelem = 0;3735 double weight;3736 double Jdet;3737 double xyz_list[NUMVERTICES][3];3738 double dp[NDOF2];3788 IssmDouble Jelem = 0; 3789 IssmDouble weight; 3790 IssmDouble Jdet; 3791 IssmDouble xyz_list[NUMVERTICES][3]; 3792 IssmDouble dp[NDOF2]; 3739 3793 GaussTria *gauss = NULL; 3740 3794 … … 3771 3825 } 3772 3826 /*}}}*/ 3773 /*FUNCTION Tria::SurfaceAverageVelMisfit {{{ 1*/3774 double Tria::SurfaceAverageVelMisfit(bool process_units,int weight_index){3827 /*FUNCTION Tria::SurfaceAverageVelMisfit {{{*/ 3828 IssmDouble Tria::SurfaceAverageVelMisfit(bool process_units,int weight_index){ 3775 3829 3776 3830 const int numdof=2*NUMVERTICES; 3777 3831 3778 3832 int i,ig; 3779 double Jelem=0,S,Jdet;3780 double misfit;3781 double vx,vy,vxobs,vyobs,weight;3782 double xyz_list[NUMVERTICES][3];3833 IssmDouble Jelem=0,S,Jdet; 3834 IssmDouble misfit; 3835 IssmDouble vx,vy,vxobs,vyobs,weight; 3836 IssmDouble xyz_list[NUMVERTICES][3]; 3783 3837 GaussTria *gauss=NULL; 3784 3838 … … 3832 3886 } 3833 3887 /*}}}*/ 3834 /*FUNCTION Tria::SurfaceLogVelMisfit {{{ 1*/3835 double Tria::SurfaceLogVelMisfit(bool process_units,int weight_index){3888 /*FUNCTION Tria::SurfaceLogVelMisfit {{{*/ 3889 IssmDouble Tria::SurfaceLogVelMisfit(bool process_units,int weight_index){ 3836 3890 3837 3891 const int numdof=NDOF2*NUMVERTICES; 3838 3892 3839 3893 int i,ig; 3840 double Jelem=0;3841 double misfit,Jdet;3842 double epsvel=2.220446049250313e-16;3843 double meanvel=3.170979198376458e-05; /*1000 m/yr*/3844 double velocity_mag,obs_velocity_mag;3845 double xyz_list[NUMVERTICES][3];3846 double vx,vy,vxobs,vyobs,weight;3894 IssmDouble Jelem=0; 3895 IssmDouble misfit,Jdet; 3896 IssmDouble epsvel=2.220446049250313e-16; 3897 IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/ 3898 IssmDouble velocity_mag,obs_velocity_mag; 3899 IssmDouble xyz_list[NUMVERTICES][3]; 3900 IssmDouble vx,vy,vxobs,vyobs,weight; 3847 3901 GaussTria *gauss=NULL; 3848 3902 … … 3897 3951 } 3898 3952 /*}}}*/ 3899 /*FUNCTION Tria::SurfaceLogVxVyMisfit {{{ 1*/3900 double Tria::SurfaceLogVxVyMisfit(bool process_units,int weight_index){3953 /*FUNCTION Tria::SurfaceLogVxVyMisfit {{{*/ 3954 IssmDouble Tria::SurfaceLogVxVyMisfit(bool process_units,int weight_index){ 3901 3955 3902 3956 const int numdof=NDOF2*NUMVERTICES; … … 3904 3958 int i,ig; 3905 3959 int fit=-1; 3906 double Jelem=0, S=0;3907 double epsvel=2.220446049250313e-16;3908 double meanvel=3.170979198376458e-05; /*1000 m/yr*/3909 double misfit, Jdet;3910 double vx,vy,vxobs,vyobs,weight;3911 double xyz_list[NUMVERTICES][3];3960 IssmDouble Jelem=0, S=0; 3961 IssmDouble epsvel=2.220446049250313e-16; 3962 IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/ 3963 IssmDouble misfit, Jdet; 3964 IssmDouble vx,vy,vxobs,vyobs,weight; 3965 IssmDouble xyz_list[NUMVERTICES][3]; 3912 3966 GaussTria *gauss=NULL; 3913 3967 … … 3963 4017 } 3964 4018 /*}}}*/ 3965 /*FUNCTION Tria::SurfaceAbsVelMisfit {{{ 1*/3966 double Tria::SurfaceAbsVelMisfit(bool process_units,int weight_index){4019 /*FUNCTION Tria::SurfaceAbsVelMisfit {{{*/ 4020 IssmDouble Tria::SurfaceAbsVelMisfit(bool process_units,int weight_index){ 3967 4021 3968 4022 const int numdof=NDOF2*NUMVERTICES; 3969 4023 3970 4024 int i,ig; 3971 double Jelem=0;3972 double misfit,Jdet;3973 double vx,vy,vxobs,vyobs,weight;3974 double xyz_list[NUMVERTICES][3];4025 IssmDouble Jelem=0; 4026 IssmDouble misfit,Jdet; 4027 IssmDouble vx,vy,vxobs,vyobs,weight; 4028 IssmDouble xyz_list[NUMVERTICES][3]; 3975 4029 GaussTria *gauss=NULL; 3976 4030 … … 4024 4078 } 4025 4079 /*}}}*/ 4026 /*FUNCTION Tria::SurfaceRelVelMisfit {{{ 1*/4027 double Tria::SurfaceRelVelMisfit(bool process_units,int weight_index){4080 /*FUNCTION Tria::SurfaceRelVelMisfit {{{*/ 4081 IssmDouble Tria::SurfaceRelVelMisfit(bool process_units,int weight_index){ 4028 4082 const int numdof=2*NUMVERTICES; 4029 4083 4030 4084 int i,ig; 4031 double Jelem=0;4032 double scalex=1,scaley=1;4033 double misfit,Jdet;4034 double epsvel=2.220446049250313e-16;4035 double meanvel=3.170979198376458e-05; /*1000 m/yr*/4036 double vx,vy,vxobs,vyobs,weight;4037 double xyz_list[NUMVERTICES][3];4085 IssmDouble Jelem=0; 4086 IssmDouble scalex=1,scaley=1; 4087 IssmDouble misfit,Jdet; 4088 IssmDouble epsvel=2.220446049250313e-16; 4089 IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/ 4090 IssmDouble vx,vy,vxobs,vyobs,weight; 4091 IssmDouble xyz_list[NUMVERTICES][3]; 4038 4092 GaussTria *gauss=NULL; 4039 4093 … … 4088 4142 } 4089 4143 /*}}}*/ 4090 /*FUNCTION Tria::ThicknessAbsGradient{{{ 1*/4091 double Tria::ThicknessAbsGradient(bool process_units,int weight_index){4144 /*FUNCTION Tria::ThicknessAbsGradient{{{*/ 4145 IssmDouble Tria::ThicknessAbsGradient(bool process_units,int weight_index){ 4092 4146 4093 4147 /* Intermediaries */ 4094 4148 int ig; 4095 double Jelem = 0;4096 double weight;4097 double Jdet;4098 double xyz_list[NUMVERTICES][3];4099 double dp[NDOF2];4149 IssmDouble Jelem = 0; 4150 IssmDouble weight; 4151 IssmDouble Jdet; 4152 IssmDouble xyz_list[NUMVERTICES][3]; 4153 IssmDouble dp[NDOF2]; 4100 4154 GaussTria *gauss = NULL; 4101 4155 … … 4132 4186 } 4133 4187 /*}}}*/ 4134 /*FUNCTION Tria::ThicknessAbsMisfit {{{ 1*/4135 double Tria::ThicknessAbsMisfit(bool process_units,int weight_index){4188 /*FUNCTION Tria::ThicknessAbsMisfit {{{*/ 4189 IssmDouble Tria::ThicknessAbsMisfit(bool process_units,int weight_index){ 4136 4190 4137 4191 /*Intermediaries*/ 4138 4192 int i,ig; 4139 double thickness,thicknessobs,weight;4140 double Jdet;4141 double Jelem = 0;4142 double xyz_list[NUMVERTICES][3];4193 IssmDouble thickness,thicknessobs,weight; 4194 IssmDouble Jdet; 4195 IssmDouble Jelem = 0; 4196 IssmDouble xyz_list[NUMVERTICES][3]; 4143 4197 GaussTria *gauss = NULL; 4144 double dH[2];4198 IssmDouble dH[2]; 4145 4199 4146 4200 /*If on water, return 0: */ … … 4177 4231 } 4178 4232 /*}}}*/ 4179 /*FUNCTION Tria::CreatePVectorAdjointBalancethickness{{{ 1*/4233 /*FUNCTION Tria::CreatePVectorAdjointBalancethickness{{{*/ 4180 4234 ElementVector* Tria::CreatePVectorAdjointBalancethickness(void){ 4181 4235 … … 4185 4239 /*Intermediaries */ 4186 4240 int i,ig,resp; 4187 double Jdet;4188 double thickness,thicknessobs,weight;4241 IssmDouble Jdet; 4242 IssmDouble thickness,thicknessobs,weight; 4189 4243 int *responses = NULL; 4190 4244 int num_responses; 4191 double xyz_list[NUMVERTICES][3];4192 double basis[3];4193 double dbasis[NDOF2][NUMVERTICES];4194 double dH[2];4245 IssmDouble xyz_list[NUMVERTICES][3]; 4246 IssmDouble basis[3]; 4247 IssmDouble dbasis[NDOF2][NUMVERTICES]; 4248 IssmDouble dH[2]; 4195 4249 GaussTria* gauss=NULL; 4196 4250 … … 4233 4287 break; 4234 4288 default: 4235 _error _("response %s not supported yet",EnumToStringx(responses[resp]));4289 _error2_("response " << EnumToStringx(responses[resp]) << " not supported yet"); 4236 4290 } 4237 4291 } … … 4239 4293 /*Clean up and return*/ 4240 4294 delete gauss; 4241 x free((void**)&responses);4295 xDelete<int>(responses); 4242 4296 return pe; 4243 4297 } 4244 4298 /*}}}*/ 4245 /*FUNCTION Tria::CreatePVectorAdjointHoriz{{{ 1*/4299 /*FUNCTION Tria::CreatePVectorAdjointHoriz{{{*/ 4246 4300 ElementVector* Tria::CreatePVectorAdjointHoriz(void){ 4247 4301 … … 4253 4307 int *responses=NULL; 4254 4308 int num_responses; 4255 double Jdet;4256 double obs_velocity_mag,velocity_mag;4257 double dux,duy;4258 double epsvel=2.220446049250313e-16;4259 double meanvel=3.170979198376458e-05; /*1000 m/yr*/4260 double scalex=0,scaley=0,scale=0,S=0;4261 double vx,vy,vxobs,vyobs,weight;4262 double xyz_list[NUMVERTICES][3];4263 double basis[3];4309 IssmDouble Jdet; 4310 IssmDouble obs_velocity_mag,velocity_mag; 4311 IssmDouble dux,duy; 4312 IssmDouble epsvel=2.220446049250313e-16; 4313 IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/ 4314 IssmDouble scalex=0,scaley=0,scale=0,S=0; 4315 IssmDouble vx,vy,vxobs,vyobs,weight; 4316 IssmDouble xyz_list[NUMVERTICES][3]; 4317 IssmDouble basis[3]; 4264 4318 GaussTria* gauss=NULL; 4265 4319 … … 4411 4465 break; 4412 4466 default: 4413 _error _("response %s not supported yet",EnumToStringx(responses[resp]));4467 _error2_("response " << EnumToStringx(responses[resp]) << " not supported yet"); 4414 4468 } 4415 4469 } … … 4418 4472 /*Clean up and return*/ 4419 4473 delete gauss; 4420 x free((void**)&responses);4474 xDelete<int>(responses); 4421 4475 return pe; 4422 4476 } 4423 4477 /*}}}*/ 4424 /*FUNCTION Tria::CreatePVectorAdjointStokes{{{ 1*/4478 /*FUNCTION Tria::CreatePVectorAdjointStokes{{{*/ 4425 4479 ElementVector* Tria::CreatePVectorAdjointStokes(void){ 4426 4480 … … 4429 4483 int *responses=NULL; 4430 4484 int num_responses; 4431 double Jdet;4432 double obs_velocity_mag,velocity_mag;4433 double dux,duy;4434 double epsvel=2.220446049250313e-16;4435 double meanvel=3.170979198376458e-05; /*1000 m/yr*/4436 double scalex=0,scaley=0,scale=0,S=0;4437 double vx,vy,vxobs,vyobs,weight;4438 double xyz_list[NUMVERTICES][3];4439 double basis[3];4485 IssmDouble Jdet; 4486 IssmDouble obs_velocity_mag,velocity_mag; 4487 IssmDouble dux,duy; 4488 IssmDouble epsvel=2.220446049250313e-16; 4489 IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/ 4490 IssmDouble scalex=0,scaley=0,scale=0,S=0; 4491 IssmDouble vx,vy,vxobs,vyobs,weight; 4492 IssmDouble xyz_list[NUMVERTICES][3]; 4493 IssmDouble basis[3]; 4440 4494 GaussTria* gauss=NULL; 4441 4495 … … 4588 4642 break; 4589 4643 default: 4590 _error _("response %s not supported yet",EnumToStringx(responses[resp]));4644 _error2_("response " << EnumToStringx(responses[resp]) << " not supported yet"); 4591 4645 } 4592 4646 } … … 4595 4649 /*Clean up and return*/ 4596 4650 delete gauss; 4597 x free((void**)&responses);4651 xDelete<int>(responses); 4598 4652 return pe; 4599 4653 } 4600 4654 /*}}}*/ 4601 /*FUNCTION Tria::DragCoefficientAbsGradient{{{ 1*/4602 double Tria::DragCoefficientAbsGradient(bool process_units,int weight_index){4655 /*FUNCTION Tria::DragCoefficientAbsGradient{{{*/ 4656 IssmDouble Tria::DragCoefficientAbsGradient(bool process_units,int weight_index){ 4603 4657 4604 4658 /* Intermediaries */ 4605 4659 int ig; 4606 double Jelem = 0;4607 double weight;4608 double Jdet;4609 double xyz_list[NUMVERTICES][3];4610 double dp[NDOF2];4660 IssmDouble Jelem = 0; 4661 IssmDouble weight; 4662 IssmDouble Jdet; 4663 IssmDouble xyz_list[NUMVERTICES][3]; 4664 IssmDouble dp[NDOF2]; 4611 4665 GaussTria *gauss = NULL; 4612 4666 … … 4643 4697 } 4644 4698 /*}}}*/ 4645 /*FUNCTION Tria::CreateKMatrixAdjointBalancethickness {{{ 1*/4699 /*FUNCTION Tria::CreateKMatrixAdjointBalancethickness {{{*/ 4646 4700 ElementMatrix* Tria::CreateKMatrixAdjointBalancethickness(void){ 4647 4701 … … 4657 4711 break; 4658 4712 default: 4659 _error _("Element type %s not supported yet",EnumToStringx(GetElementType()));4713 _error2_("Element type " << EnumToStringx(GetElementType()) << " not supported yet"); 4660 4714 } 4661 4715 … … 4665 4719 } 4666 4720 /*}}}*/ 4667 /*FUNCTION Tria::CreateKMatrixAdjointMacAyeal{{{ 1*/4721 /*FUNCTION Tria::CreateKMatrixAdjointMacAyeal{{{*/ 4668 4722 ElementMatrix* Tria::CreateKMatrixAdjointMacAyeal(void){ 4669 4723 … … 4674 4728 int i,j,ig; 4675 4729 bool incomplete_adjoint; 4676 double xyz_list[NUMVERTICES][3];4677 double Jdet,thickness;4678 double eps1dotdphii,eps1dotdphij;4679 double eps2dotdphii,eps2dotdphij;4680 double mu_prime;4681 double epsilon[3];/* epsilon=[exx,eyy,exy];*/4682 double eps1[2],eps2[2];4683 double phi[NUMVERTICES];4684 double dphi[2][NUMVERTICES];4730 IssmDouble xyz_list[NUMVERTICES][3]; 4731 IssmDouble Jdet,thickness; 4732 IssmDouble eps1dotdphii,eps1dotdphij; 4733 IssmDouble eps2dotdphii,eps2dotdphij; 4734 IssmDouble mu_prime; 4735 IssmDouble epsilon[3];/* epsilon=[exx,eyy,exy];*/ 4736 IssmDouble eps1[2],eps2[2]; 4737 IssmDouble phi[NUMVERTICES]; 4738 IssmDouble dphi[2][NUMVERTICES]; 4685 4739 GaussTria *gauss=NULL; 4686 4740 … … 4735 4789 } 4736 4790 /*}}}*/ 4737 /*FUNCTION Tria::InputUpdateFromSolutionAdjointHoriz {{{ 1*/4738 void Tria::InputUpdateFromSolutionAdjointHoriz( double* solution){4791 /*FUNCTION Tria::InputUpdateFromSolutionAdjointHoriz {{{*/ 4792 void Tria::InputUpdateFromSolutionAdjointHoriz(IssmDouble* solution){ 4739 4793 4740 4794 const int numdof=NDOF2*NUMVERTICES; … … 4742 4796 int i; 4743 4797 int* doflist=NULL; 4744 double values[numdof];4745 double lambdax[NUMVERTICES];4746 double lambday[NUMVERTICES];4798 IssmDouble values[numdof]; 4799 IssmDouble lambdax[NUMVERTICES]; 4800 IssmDouble lambday[NUMVERTICES]; 4747 4801 4748 4802 /*Get dof list: */ … … 4758 4812 4759 4813 /*Check solution*/ 4760 if( isnan(lambdax[i])) _error_("NaN found in solution vector");4761 if( isnan(lambday[i])) _error_("NaN found in solution vector");4814 if(xIsNan<IssmDouble>(lambdax[i])) _error2_("NaN found in solution vector"); 4815 if(xIsNan<IssmDouble>(lambday[i])) _error2_("NaN found in solution vector"); 4762 4816 } 4763 4817 … … 4767 4821 4768 4822 /*Free ressources:*/ 4769 xfree((void**)&doflist); 4770 } 4771 /*}}}*/ 4772 4773 /*FUNCTION Tria::InputUpdateFromSolutionAdjointBalancethickness {{{1*/ 4774 void Tria::InputUpdateFromSolutionAdjointBalancethickness(double* solution){ 4823 xDelete<int>(doflist); 4824 } 4825 /*}}}*/ 4826 /*FUNCTION Tria::InputUpdateFromSolutionAdjointBalancethickness {{{*/ 4827 void Tria::InputUpdateFromSolutionAdjointBalancethickness(IssmDouble* solution){ 4775 4828 4776 4829 const int numdof=NDOF1*NUMVERTICES; … … 4778 4831 int i; 4779 4832 int* doflist=NULL; 4780 double values[numdof];4781 double lambda[NUMVERTICES];4833 IssmDouble values[numdof]; 4834 IssmDouble lambda[NUMVERTICES]; 4782 4835 4783 4836 /*Get dof list: */ … … 4790 4843 for(i=0;i<numdof;i++){ 4791 4844 lambda[i]=values[i]; 4792 if( isnan(lambda[i])) _error_("NaN found in solution vector");4845 if(xIsNan<IssmDouble>(lambda[i])) _error2_("NaN found in solution vector"); 4793 4846 } 4794 4847 … … 4797 4850 4798 4851 /*Free ressources:*/ 4799 x free((void**)&doflist);4800 } 4801 /*}}}*/ 4802 /*FUNCTION Tria::GetVectorFromControlInputs{{{ 1*/4852 xDelete<int>(doflist); 4853 } 4854 /*}}}*/ 4855 /*FUNCTION Tria::GetVectorFromControlInputs{{{*/ 4803 4856 void Tria::GetVectorFromControlInputs(Vector* vector,int control_enum,int control_index,const char* data){ 4804 4857 … … 4822 4875 /*Check that it is a ControlInput*/ 4823 4876 if (input->ObjectEnum()!=ControlInputEnum){ 4824 _error _("input %s is not a ControlInput",EnumToStringx(control_enum));4877 _error2_("input " << EnumToStringx(control_enum) << " is not a ControlInput"); 4825 4878 } 4826 4879 … … 4828 4881 } 4829 4882 /*}}}*/ 4830 /*FUNCTION Tria::SetControlInputsFromVector{{{ 1*/4831 void Tria::SetControlInputsFromVector( double* vector,int control_enum,int control_index){4832 4833 double values[NUMVERTICES];4883 /*FUNCTION Tria::SetControlInputsFromVector{{{*/ 4884 void Tria::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){ 4885 4886 IssmDouble values[NUMVERTICES]; 4834 4887 int doflist1[NUMVERTICES]; 4835 4888 Input *input = NULL; … … 4856 4909 4857 4910 if (input->ObjectEnum()!=ControlInputEnum){ 4858 _error _("input %s is not a ControlInput",EnumToStringx(control_enum));4911 _error2_("input " << EnumToStringx(control_enum) << " is not a ControlInput"); 4859 4912 } 4860 4913 … … 4865 4918 4866 4919 #ifdef _HAVE_HYDROLOGY_ 4867 /*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{ 1*/4920 /*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{*/ 4868 4921 void Tria::CreateHydrologyWaterVelocityInput(void){ 4869 4922 4870 4923 /*material parameters: */ 4871 double mu_water;4872 double VelocityFactor; // This factor represents the number 12 in laminar flow velocity which can vary by differnt hydrology.CR4873 double n_man,CR;4874 double w;4875 double rho_ice, rho_water, g;4876 double dsdx,dsdy,dbdx,dbdy;4877 double vx[NUMVERTICES];4878 double vy[NUMVERTICES];4924 IssmDouble mu_water; 4925 IssmDouble VelocityFactor; // This factor represents the number 12 in laminar flow velocity which can vary by differnt hydrology.CR 4926 IssmDouble n_man,CR; 4927 IssmDouble w; 4928 IssmDouble rho_ice, rho_water, g; 4929 IssmDouble dsdx,dsdy,dbdx,dbdy; 4930 IssmDouble vx[NUMVERTICES]; 4931 IssmDouble vy[NUMVERTICES]; 4879 4932 GaussTria *gauss = NULL; 4880 4933 … … 4920 4973 } 4921 4974 /*}}}*/ 4922 /*FUNCTION Tria::CreateKMatrixHydrology{{{ 1*/4975 /*FUNCTION Tria::CreateKMatrixHydrology{{{*/ 4923 4976 ElementMatrix* Tria::CreateKMatrixHydrology(void){ 4924 4977 … … 4927 4980 4928 4981 /*Intermediaries */ 4929 double diffusivity;4982 IssmDouble diffusivity; 4930 4983 int i,j,ig; 4931 double Jdettria,DL_scalar,dt,h;4932 double vx,vy,vel,dvxdx,dvydy;4933 double dvx[2],dvy[2];4934 double v_gauss[2]={0.0};4935 double xyz_list[NUMVERTICES][3];4936 double L[NUMVERTICES];4937 double B[2][NUMVERTICES];4938 double Bprime[2][NUMVERTICES];4939 double K[2][2] ={0.0};4940 double KDL[2][2] ={0.0};4941 double DL[2][2] ={0.0};4942 double DLprime[2][2] ={0.0};4984 IssmDouble Jdettria,DL_scalar,dt,h; 4985 IssmDouble vx,vy,vel,dvxdx,dvydy; 4986 IssmDouble dvx[2],dvy[2]; 4987 IssmDouble v_gauss[2]={0.0}; 4988 IssmDouble xyz_list[NUMVERTICES][3]; 4989 IssmDouble L[NUMVERTICES]; 4990 IssmDouble B[2][NUMVERTICES]; 4991 IssmDouble Bprime[2][NUMVERTICES]; 4992 IssmDouble K[2][2] ={0.0}; 4993 IssmDouble KDL[2][2] ={0.0}; 4994 IssmDouble DL[2][2] ={0.0}; 4995 IssmDouble DLprime[2][2] ={0.0}; 4943 4996 GaussTria *gauss=NULL; 4944 4997 … … 5025 5078 } 5026 5079 /*}}}*/ 5027 /*FUNCTION Tria::CreatePVectorHydrology {{{ 1*/5080 /*FUNCTION Tria::CreatePVectorHydrology {{{*/ 5028 5081 ElementVector* Tria::CreatePVectorHydrology(void){ 5029 5082 … … 5033 5086 /*Intermediaries */ 5034 5087 int i,j,ig; 5035 double Jdettria,dt;5036 double basal_melting_g;5037 double old_watercolumn_g;5038 double xyz_list[NUMVERTICES][3];5039 double basis[numdof];5088 IssmDouble Jdettria,dt; 5089 IssmDouble basal_melting_g; 5090 IssmDouble old_watercolumn_g; 5091 IssmDouble xyz_list[NUMVERTICES][3]; 5092 IssmDouble basis[numdof]; 5040 5093 GaussTria* gauss=NULL; 5041 5094 … … 5074 5127 } 5075 5128 /*}}}*/ 5076 /*FUNCTION Tria::GetSolutionFromInputsHydrology{{{ 1*/5129 /*FUNCTION Tria::GetSolutionFromInputsHydrology{{{*/ 5077 5130 void Tria::GetSolutionFromInputsHydrology(Vector* solution){ 5078 5131 … … 5081 5134 int i; 5082 5135 int* doflist=NULL; 5083 double watercolumn;5084 double values[numdof];5136 IssmDouble watercolumn; 5137 IssmDouble values[numdof]; 5085 5138 GaussTria* gauss=NULL; 5086 5139 … … 5107 5160 /*Free ressources:*/ 5108 5161 delete gauss; 5109 x free((void**)&doflist);5110 } 5111 /*}}}*/ 5112 /*FUNCTION Tria::InputUpdateFromSolutionHydrology{{{ 1*/5113 void Tria::InputUpdateFromSolutionHydrology( double* solution){5162 xDelete<int>(doflist); 5163 } 5164 /*}}}*/ 5165 /*FUNCTION Tria::InputUpdateFromSolutionHydrology{{{*/ 5166 void Tria::InputUpdateFromSolutionHydrology(IssmDouble* solution){ 5114 5167 5115 5168 /*Intermediaries*/ … … 5118 5171 int i; 5119 5172 int* doflist=NULL; 5120 double values[numdof];5173 IssmDouble values[numdof]; 5121 5174 5122 5175 /*Get dof list: */ … … 5126 5179 for(i=0;i<numdof;i++){ 5127 5180 values[i]=solution[doflist[i]]; 5128 if( isnan(values[i])) _error_("NaN found in solution vector");5129 if (values[i]<pow(( double)10,(double)-10))values[i]=pow((double)10,(double)-10); //correcting the water column to positive values5181 if(xIsNan<IssmDouble>(values[i])) _error2_("NaN found in solution vector"); 5182 if (values[i]<pow((IssmDouble)10,(IssmDouble)-10))values[i]=pow((IssmDouble)10,(IssmDouble)-10); //correcting the water column to positive values 5130 5183 5131 5184 } … … 5135 5188 5136 5189 /*Free ressources:*/ 5137 x free((void**)&doflist);5190 xDelete<int>(doflist); 5138 5191 } 5139 5192 /*}}}*/ … … 5141 5194 5142 5195 #ifdef _HAVE_DAKOTA_ 5143 /*FUNCTION Tria::InputUpdateFromVectorDakota( double* vector, int name, int type);{{{1*/5144 void Tria::InputUpdateFromVectorDakota( double* vector, int name, int type){5196 /*FUNCTION Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/ 5197 void Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 5145 5198 5146 5199 int i,j; … … 5154 5207 5155 5208 /*New TriaP1Input*/ 5156 double values[3];5209 IssmDouble values[3]; 5157 5210 5158 5211 /*Get values on the 3 vertices*/ … … 5164 5217 switch(name){ 5165 5218 case ThicknessEnum: 5166 /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{2*/ 5167 double thickness[3]; 5168 double thickness_init[3]; 5169 double hydrostatic_ratio[3]; 5170 double surface[3]; 5171 double bed[3]; 5219 IssmDouble thickness[3]; 5220 IssmDouble thickness_init[3]; 5221 IssmDouble hydrostatic_ratio[3]; 5222 IssmDouble surface[3]; 5223 IssmDouble bed[3]; 5172 5224 5173 5225 /*retrieve inputs: */ … … 5177 5229 GetInputListOnVertices(&surface[0],SurfaceEnum); 5178 5230 5179 /*build new thickness: */5180 // for(j=0;j<3;j++)thickness[j]=values[j];5181 5182 5231 /*build new bed and surface: */ 5183 5232 if (this->IsFloating()){ 5184 5233 /*hydrostatic equilibrium: */ 5185 double rho_ice,rho_water,di; 5186 rho_ice=this->matpar->GetRhoIce(); 5187 rho_water=this->matpar->GetRhoWater(); 5188 5189 di=rho_ice/rho_water; 5234 IssmDouble rho_ice,rho_water,di; 5235 rho_ice = this->matpar->GetRhoIce(); 5236 rho_water = this->matpar->GetRhoWater(); 5237 di = rho_ice/rho_water; 5190 5238 5191 5239 /*build new thickness: */ 5192 5240 for (j=0; j<3; j++) { 5193 /* for observed/interpolated/hydrostatic thickness, remove scaling from any hydrostatic thickness */5194 if (hydrostatic_ratio[j] >= 0.)5241 /* for observed/interpolated/hydrostatic thickness, remove scaling from any hydrostatic thickness */ 5242 if (hydrostatic_ratio[j] >= 0.) 5195 5243 thickness[j]=values[j]-(values[j]/thickness_init[j]-1.)*hydrostatic_ratio[j]*surface[j]/(1.-di); 5196 /* for minimum thickness, don't scale */5244 /* for minimum thickness, don't scale */ 5197 5245 else 5198 5246 thickness[j]=thickness_init[j]; 5199 5247 5200 /* check the computed thickness and update bed */ 5201 if (thickness[j] < 0.) 5202 thickness[j]=1./(1.-di); 5248 /* check the computed thickness and update bed*/ 5249 if (thickness[j] < 0.) thickness[j]=1./(1.-di); 5203 5250 bed[j]=surface[j]-thickness[j]; 5204 5251 } 5205 5206 // for(j=0;j<3;j++){5207 // surface[j]=(1-di)*thickness[j];5208 // bed[j]=-di*thickness[j];5209 // }5210 5252 } 5211 5253 else{ 5212 5254 /*build new thickness: */ 5213 5255 for (j=0; j<3; j++) { 5214 /* for observed thickness, use scaled value */5256 /* for observed thickness, use scaled value */ 5215 5257 if (hydrostatic_ratio[j] >= 0.) 5216 5258 thickness[j]=values[j]; 5217 /* for minimum thickness, don't scale */5259 /* for minimum thickness, don't scale */ 5218 5260 else 5219 5261 thickness[j]=thickness_init[j]; … … 5221 5263 5222 5264 /*update bed on grounded ice: */ 5223 // for(j=0;j<3;j++)surface[j]=bed[j]+thickness[j];5224 5265 for(j=0;j<3;j++)bed[j]=surface[j]-thickness[j]; 5225 5266 } … … 5230 5271 this->inputs->AddInput(new TriaP1Input(SurfaceEnum,surface)); 5231 5272 5232 /*}}}*/5233 5273 break; 5234 5274 default: … … 5238 5278 5239 5279 default: 5240 _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));5241 } 5242 5243 } 5244 /*}}}*/ 5245 /*FUNCTION Tria::InputUpdateFromVectorDakota(int* vector, int name, int type);{{{ 1*/5280 _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 5281 } 5282 5283 } 5284 /*}}}*/ 5285 /*FUNCTION Tria::InputUpdateFromVectorDakota(int* vector, int name, int type);{{{*/ 5246 5286 void Tria::InputUpdateFromVectorDakota(int* vector, int name, int type){ 5247 _error _("not supported yet!");5248 } 5249 /*}}}*/ 5250 /*FUNCTION Tria::InputUpdateFromVectorDakota(bool* vector, int name, int type);{{{ 1*/5287 _error2_("not supported yet!"); 5288 } 5289 /*}}}*/ 5290 /*FUNCTION Tria::InputUpdateFromVectorDakota(bool* vector, int name, int type);{{{*/ 5251 5291 void Tria::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 5252 _error _("not supported yet!");5253 } 5254 /*}}}*/ 5255 /*FUNCTION Tria::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type);{{{1*/5256 void Tria::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){5292 _error2_("not supported yet!"); 5293 } 5294 /*}}}*/ 5295 /*FUNCTION Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/ 5296 void Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 5257 5297 5258 5298 int i,j,t; 5259 5299 TransientInput* transientinput=NULL; 5260 double values[3];5261 double time;5300 IssmDouble values[3]; 5301 IssmDouble time; 5262 5302 int row; 5263 double yts;5303 IssmDouble yts; 5264 5304 5265 5305 /*Check that name is an element input*/ … … 5278 5318 for(i=0;i<3;i++){ 5279 5319 row=this->nodes[i]->GetSidList(); 5280 values[i]=( double)matrix[ncols*row+t];5320 values[i]=(IssmDouble)matrix[ncols*row+t]; 5281 5321 } 5282 5322 5283 5323 /*time? :*/ 5284 time=( double)matrix[(nrows-1)*ncols+t]*yts;5324 time=(IssmDouble)matrix[(nrows-1)*ncols+t]*yts; 5285 5325 5286 5326 if(t==0) transientinput=new TransientInput(name); … … 5292 5332 5293 5333 default: 5294 _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));5334 _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 5295 5335 } 5296 5336 … … 5300 5340 5301 5341 #ifdef _HAVE_BALANCED_ 5302 /*FUNCTION Tria::CreateKMatrixBalancethickness {{{ 1*/5342 /*FUNCTION Tria::CreateKMatrixBalancethickness {{{*/ 5303 5343 ElementMatrix* Tria::CreateKMatrixBalancethickness(void){ 5304 5344 … … 5309 5349 return CreateKMatrixBalancethickness_DG(); 5310 5350 default: 5311 _error _("Element type %s not supported yet",EnumToStringx(GetElementType()));5312 } 5313 5314 } 5315 /*}}}*/ 5316 /*FUNCTION Tria::CreateKMatrixBalancethickness_CG {{{ 1*/5351 _error2_("Element type " << EnumToStringx(GetElementType()) << " not supported yet"); 5352 } 5353 5354 } 5355 /*}}}*/ 5356 /*FUNCTION Tria::CreateKMatrixBalancethickness_CG {{{*/ 5317 5357 ElementMatrix* Tria::CreateKMatrixBalancethickness_CG(void){ 5318 5358 … … 5323 5363 int stabilization; 5324 5364 int i,j,ig,dim; 5325 double Jdettria,vx,vy,dvxdx,dvydy,vel,h;5326 double dvx[2],dvy[2];5327 double xyz_list[NUMVERTICES][3];5328 double L[NUMVERTICES];5329 double B[2][NUMVERTICES];5330 double Bprime[2][NUMVERTICES];5331 double K[2][2] = {0.0};5332 double KDL[2][2] = {0.0};5333 double DL[2][2] = {0.0};5334 double DLprime[2][2] = {0.0};5335 double DL_scalar;5365 IssmDouble Jdettria,vx,vy,dvxdx,dvydy,vel,h; 5366 IssmDouble dvx[2],dvy[2]; 5367 IssmDouble xyz_list[NUMVERTICES][3]; 5368 IssmDouble L[NUMVERTICES]; 5369 IssmDouble B[2][NUMVERTICES]; 5370 IssmDouble Bprime[2][NUMVERTICES]; 5371 IssmDouble K[2][2] = {0.0}; 5372 IssmDouble KDL[2][2] = {0.0}; 5373 IssmDouble DL[2][2] = {0.0}; 5374 IssmDouble DLprime[2][2] = {0.0}; 5375 IssmDouble DL_scalar; 5336 5376 GaussTria *gauss = NULL; 5337 5377 … … 5424 5464 } 5425 5465 /*}}}*/ 5426 /*FUNCTION Tria::CreateKMatrixBalancethickness_DG {{{ 1*/5466 /*FUNCTION Tria::CreateKMatrixBalancethickness_DG {{{*/ 5427 5467 ElementMatrix* Tria::CreateKMatrixBalancethickness_DG(void){ 5428 5468 … … 5432 5472 /*Intermediaries*/ 5433 5473 int i,j,ig,dim; 5434 double vx,vy,Jdettria;5435 double xyz_list[NUMVERTICES][3];5436 double B[2][NUMVERTICES];5437 double Bprime[2][NUMVERTICES];5438 double DL[2][2]={0.0};5439 double DL_scalar;5474 IssmDouble vx,vy,Jdettria; 5475 IssmDouble xyz_list[NUMVERTICES][3]; 5476 IssmDouble B[2][NUMVERTICES]; 5477 IssmDouble Bprime[2][NUMVERTICES]; 5478 IssmDouble DL[2][2]={0.0}; 5479 IssmDouble DL_scalar; 5440 5480 GaussTria *gauss=NULL; 5441 5481 … … 5478 5518 } 5479 5519 /*}}}*/ 5480 /*FUNCTION Tria::CreatePVectorBalancethickness{{{ 1*/5520 /*FUNCTION Tria::CreatePVectorBalancethickness{{{*/ 5481 5521 ElementVector* Tria::CreatePVectorBalancethickness(void){ 5482 5522 … … 5488 5528 return CreatePVectorBalancethickness_DG(); 5489 5529 default: 5490 _error _("Element type %s not supported yet",EnumToStringx(GetElementType()));5491 } 5492 } 5493 /*}}}*/ 5494 /*FUNCTION Tria::CreatePVectorBalancethickness_CG{{{ 1*/5530 _error2_("Element type " << EnumToStringx(GetElementType()) << " not supported yet"); 5531 } 5532 } 5533 /*}}}*/ 5534 /*FUNCTION Tria::CreatePVectorBalancethickness_CG{{{*/ 5495 5535 ElementVector* Tria::CreatePVectorBalancethickness_CG(void){ 5496 5536 … … 5500 5540 /*Intermediaries */ 5501 5541 int i,j,ig; 5502 double xyz_list[NUMVERTICES][3];5503 double dhdt_g,basal_melting_g,surface_mass_balance_g,Jdettria;5504 double L[NUMVERTICES];5542 IssmDouble xyz_list[NUMVERTICES][3]; 5543 IssmDouble dhdt_g,basal_melting_g,surface_mass_balance_g,Jdettria; 5544 IssmDouble L[NUMVERTICES]; 5505 5545 GaussTria* gauss=NULL; 5506 5546 … … 5535 5575 } 5536 5576 /*}}}*/ 5537 /*FUNCTION Tria::CreatePVectorBalancethickness_DG {{{ 1*/5577 /*FUNCTION Tria::CreatePVectorBalancethickness_DG {{{*/ 5538 5578 ElementVector* Tria::CreatePVectorBalancethickness_DG(void){ 5539 5579 … … 5543 5583 /*Intermediaries */ 5544 5584 int i,j,ig; 5545 double xyz_list[NUMVERTICES][3];5546 double basal_melting_g,surface_mass_balance_g,dhdt_g,Jdettria;5547 double L[NUMVERTICES];5585 IssmDouble xyz_list[NUMVERTICES][3]; 5586 IssmDouble basal_melting_g,surface_mass_balance_g,dhdt_g,Jdettria; 5587 IssmDouble L[NUMVERTICES]; 5548 5588 GaussTria* gauss=NULL; 5549 5589 -
issm/trunk/src/c/objects/Elements/Tria.h
r12630 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Element.h" 11 11 #include "./TriaHook.h" … … 41 41 Results *results; 42 42 43 /*Tria constructors, destructors {{{ 1*/43 /*Tria constructors, destructors {{{*/ 44 44 Tria(); 45 45 Tria(int tria_id,int tria_sid,int i, IoModel* iomodel,int nummodels); 46 46 ~Tria(); 47 47 /*}}}*/ 48 /*Object virtual functions definitions:{{{ 1*/48 /*Object virtual functions definitions:{{{ */ 49 49 void Echo(); 50 50 void DeepEcho(); … … 54 54 Object* copy(); 55 55 /*}}}*/ 56 /*Update virtual functions resolution: {{{ 1*/57 void InputUpdateFromSolution( double* solutiong);58 void InputUpdateFromVector( double* vector, int name, int type);56 /*Update virtual functions resolution: {{{*/ 57 void InputUpdateFromSolution(IssmDouble* solutiong); 58 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 59 59 void InputUpdateFromVector(int* vector, int name, int type); 60 60 void InputUpdateFromVector(bool* vector, int name, int type); 61 61 #ifdef _HAVE_DAKOTA_ 62 void InputUpdateFromVectorDakota( double* vector, int name, int type);62 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 63 63 void InputUpdateFromVectorDakota(int* vector, int name, int type); 64 64 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 65 void InputUpdateFromMatrixDakota( double* matrix, int nows, int ncols, int name, int type);66 #endif 67 void InputUpdateFromConstant( double constant, int name);65 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type); 66 #endif 67 void InputUpdateFromConstant(IssmDouble constant, int name); 68 68 void InputUpdateFromConstant(int constant, int name); 69 69 void InputUpdateFromConstant(bool constant, int name); 70 70 void InputUpdateFromIoModel(int index, IoModel* iomodel); 71 71 /*}}}*/ 72 /*Element virtual functions definitions: {{{ 1*/73 void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas, double* vertex_response,double* qmu_part);72 /*Element virtual functions definitions: {{{*/ 73 void AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part); 74 74 void ComputeBasalStress(Vector* sigma_b); 75 75 void ComputeStrainRate(Vector* eps); … … 85 85 bool IsFloating(); 86 86 bool IsNodeOnShelf(); 87 bool IsNodeOnShelfFromFlags( double* flags);87 bool IsNodeOnShelfFromFlags(IssmDouble* flags); 88 88 bool IsOnWater(); 89 89 void GetSolutionFromInputs(Vector* solution); 90 90 void GetVectorFromInputs(Vector* vector, int name_enum); 91 91 void GetVectorFromResults(Vector* vector,int offset,int enum_in,int interp); 92 void InputArtificialNoise(int enum_type, double min, double max);93 bool InputConvergence( double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums);94 void InputCreate( double scalar,int name,int code);95 void InputCreate( double* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);92 void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max); 93 bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums); 94 void InputCreate(IssmDouble scalar,int name,int code); 95 void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 96 96 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum); 97 97 void InputDuplicate(int original_enum,int new_enum); 98 void InputScale(int enum_type, double scale_factor);99 void InputToResult(int enum_type,int step, double time);98 void InputScale(int enum_type,IssmDouble scale_factor); 99 void InputToResult(int enum_type,int step,IssmDouble time); 100 100 void DeleteResults(void); 101 void MaterialUpdateFromTemperature(void){_error _("not implemented yet");};102 void MigrateGroundingLine( double* oldfloating,double* sheet_ungrounding);103 int NodalValue( double* pvalue, int index, int natureofdataenum,bool process_units);101 void MaterialUpdateFromTemperature(void){_error2_("not implemented yet");}; 102 void MigrateGroundingLine(IssmDouble* oldfloating,IssmDouble* sheet_ungrounding); 103 int NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units); 104 104 void PotentialSheetUngrounding(Vector* potential_sheet_ungrounding); 105 void PositiveDegreeDay( double* pdds,double* pds,double signorm);106 void RequestedOutput(int output_enum,int step, double time);107 void ListResultsInfo(int** results_enums,int** results_size, double** results_times,int** results_steps,int* num_results);105 void PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm); 106 void RequestedOutput(int output_enum,int step,IssmDouble time); 107 void ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results); 108 108 void PatchFill(int* pcount, Patch* patch); 109 109 void PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes); 110 110 void ProcessResultsUnits(void); 111 void ResetCoordinateSystem(void){_error_("not implemented yet");}; 112 double SurfaceArea(void); 111 void ResetCoordinateSystem(void){_error2_("not implemented yet");}; 112 void SmbGradients(); 113 IssmDouble SurfaceArea(void); 113 114 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type); 114 int UpdatePotentialSheetUngrounding( double* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,double* nodes_on_iceshelf);115 double TimeAdapt();115 int UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf); 116 IssmDouble TimeAdapt(); 116 117 int* GetHorizontalNeighboorSids(void); 117 void SmearFunction(Vector* smearedvector, double (*WeightFunction)(double distance,double radius),double radius);118 void SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius); 118 119 119 120 #ifdef _HAVE_RESPONSES_ 120 double IceVolume(void);121 void MinVel( double* pminvel, bool process_units);122 void MinVx( double* pminvx, bool process_units);123 void MinVy( double* pminvy, bool process_units);124 void MinVz( double* pminvz, bool process_units);125 double MassFlux(double* segment,bool process_units);126 void MaxAbsVx( double* pmaxabsvx, bool process_units);127 void MaxAbsVy( double* pmaxabsvy, bool process_units);128 void MaxAbsVz( double* pmaxabsvz, bool process_units);129 void ElementResponse( double* presponse,int response_enum,bool process_units);130 void MaxVel( double* pmaxvel, bool process_units);131 void MaxVx( double* pmaxvx, bool process_units);132 void MaxVy( double* pmaxvy, bool process_units);133 void MaxVz( double* pmaxvz, bool process_units);121 IssmDouble IceVolume(void); 122 void MinVel(IssmDouble* pminvel, bool process_units); 123 void MinVx(IssmDouble* pminvx, bool process_units); 124 void MinVy(IssmDouble* pminvy, bool process_units); 125 void MinVz(IssmDouble* pminvz, bool process_units); 126 IssmDouble MassFlux(IssmDouble* segment,bool process_units); 127 void MaxAbsVx(IssmDouble* pmaxabsvx, bool process_units); 128 void MaxAbsVy(IssmDouble* pmaxabsvy, bool process_units); 129 void MaxAbsVz(IssmDouble* pmaxabsvz, bool process_units); 130 void ElementResponse(IssmDouble* presponse,int response_enum,bool process_units); 131 void MaxVel(IssmDouble* pmaxvel, bool process_units); 132 void MaxVx(IssmDouble* pmaxvx, bool process_units); 133 void MaxVy(IssmDouble* pmaxvy, bool process_units); 134 void MaxVz(IssmDouble* pmaxvz, bool process_units); 134 135 #endif 135 136 136 137 137 138 #ifdef _HAVE_CONTROL_ 138 double DragCoefficientAbsGradient(bool process_units,int weight_index);139 IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index); 139 140 void GradientIndexing(int* indexing,int control_index); 140 141 void Gradj(Vector* gradient,int control_type,int control_index); … … 148 149 void GradjVyBalancedthickness(Vector* gradient,int control_index); 149 150 void GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data); 150 void SetControlInputsFromVector( double* vector,int control_enum,int control_index);151 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index); 151 152 void ControlInputGetGradient(Vector* gradient,int enum_type,int control_index); 152 void ControlInputScaleGradient(int enum_type, double scale);153 void ControlInputSetGradient( double* gradient,int enum_type,int control_index);154 double RheologyBbarAbsGradient(bool process_units,int weight_index);155 double ThicknessAbsMisfit( bool process_units,int weight_index);156 double SurfaceAbsVelMisfit( bool process_units,int weight_index);157 double ThicknessAbsGradient(bool process_units,int weight_index);158 double SurfaceRelVelMisfit( bool process_units,int weight_index);159 double SurfaceLogVelMisfit( bool process_units,int weight_index);160 double SurfaceLogVxVyMisfit( bool process_units,int weight_index);161 double SurfaceAverageVelMisfit(bool process_units,int weight_index);162 void InputControlUpdate( double scalar,bool save_parameter);163 #endif 164 165 /*}}}*/ 166 /*Tria specific routines:{{{ 1*/153 void ControlInputScaleGradient(int enum_type,IssmDouble scale); 154 void ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index); 155 IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index); 156 IssmDouble ThicknessAbsMisfit( bool process_units,int weight_index); 157 IssmDouble SurfaceAbsVelMisfit( bool process_units,int weight_index); 158 IssmDouble ThicknessAbsGradient(bool process_units,int weight_index); 159 IssmDouble SurfaceRelVelMisfit( bool process_units,int weight_index); 160 IssmDouble SurfaceLogVelMisfit( bool process_units,int weight_index); 161 IssmDouble SurfaceLogVxVyMisfit( bool process_units,int weight_index); 162 IssmDouble SurfaceAverageVelMisfit(bool process_units,int weight_index); 163 void InputControlUpdate(IssmDouble scalar,bool save_parameter); 164 #endif 165 166 /*}}}*/ 167 /*Tria specific routines:{{{*/ 167 168 ElementMatrix* CreateKMatrixBalancethickness(void); 168 169 ElementMatrix* CreateKMatrixBalancethickness_DG(void); … … 180 181 ElementVector* CreatePVectorPrognostic_DG(void); 181 182 ElementVector* CreatePVectorSlope(void); 182 double GetArea(void);183 IssmDouble GetArea(void); 183 184 int GetElementType(void); 184 185 void GetDofList(int** pdoflist,int approximation_enum,int setenum); … … 186 187 void GetSidList(int* sidlist); 187 188 void GetConnectivityList(int* connectivity); 188 void GetInputListOnVertices( double* pvalue,int enumtype);189 void GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue);190 void GetInputListOnVertices( double* pvalue,int enumtype,double defaultvalue,int index); //TO BE REMOVED191 void GetInputValue( double* pvalue,Node* node,int enumtype);192 void GetStrainRate2d( double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);193 void InputUpdateFromSolutionOneDof( double* solution,int enum_type);194 void InputUpdateFromSolutionPrognostic( double* solution);189 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype); 190 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue); 191 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue,int index); //TO BE REMOVED 192 void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype); 193 void GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input); 194 void InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type); 195 void InputUpdateFromSolutionPrognostic(IssmDouble* solution); 195 196 bool IsInput(int name); 196 197 void SetClone(int* minranks); 197 void SurfaceNormal( double* surface_normal, double xyz_list[3][3]);198 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]); 198 199 199 200 #ifdef _HAVE_DIAGNOSTIC_ … … 207 208 void GetSolutionFromInputsDiagnosticHoriz(Vector* solution); 208 209 void GetSolutionFromInputsDiagnosticHutter(Vector* solution); 209 void InputUpdateFromSolutionDiagnosticHoriz( double* solution);210 void InputUpdateFromSolutionDiagnosticHutter( double* solution);210 void InputUpdateFromSolutionDiagnosticHoriz( IssmDouble* solution); 211 void InputUpdateFromSolutionDiagnosticHutter( IssmDouble* solution); 211 212 #endif 212 213 … … 217 218 ElementVector* CreatePVectorAdjointStokes(void); 218 219 ElementVector* CreatePVectorAdjointBalancethickness(void); 219 void InputUpdateFromSolutionAdjointBalancethickness( double* solution);220 void InputUpdateFromSolutionAdjointHoriz( double* solution);220 void InputUpdateFromSolutionAdjointBalancethickness( IssmDouble* solution); 221 void InputUpdateFromSolutionAdjointHoriz( IssmDouble* solution); 221 222 #endif 222 223 … … 226 227 void CreateHydrologyWaterVelocityInput(void); 227 228 void GetSolutionFromInputsHydrology(Vector* solution); 228 void InputUpdateFromSolutionHydrology( double* solution);229 void InputUpdateFromSolutionHydrology(IssmDouble* solution); 229 230 #endif 230 231 #ifdef _HAVE_BALANCED_ -
issm/trunk/src/c/objects/Elements/TriaHook.cpp
r9725 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Object constructors and destructor*/ 23 /*FUNCTION TriaHook::TriaHook(){{{ 1*/23 /*FUNCTION TriaHook::TriaHook(){{{*/ 24 24 TriaHook::TriaHook(){ 25 25 numanalyses=UNDEF; … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION TriaHook::~TriaHook(){{{ 1*/31 /*FUNCTION TriaHook::~TriaHook(){{{*/ 32 32 TriaHook::~TriaHook(){ 33 33 int i; … … 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION TriaHook::TriaHook(int in_numanalyses,int matice_id, int matpar_id){{{ 1*/44 /*FUNCTION TriaHook::TriaHook(int in_numanalyses,int matice_id, int matpar_id){{{*/ 45 45 TriaHook::TriaHook(int in_numanalyses,int matice_id, IoModel* iomodel){ 46 46 … … 64 64 /*}}}*/ 65 65 66 /*FUNCTION TriaHook::SetHookNodes{{{ 1*/66 /*FUNCTION TriaHook::SetHookNodes{{{*/ 67 67 void TriaHook::SetHookNodes(int* node_ids,int analysis_counter){ 68 68 -
issm/trunk/src/c/objects/Elements/TriaHook.h
r9356 r12706 18 18 19 19 20 /*FUNCTION constructors, destructors {{{ 1*/20 /*FUNCTION constructors, destructors {{{*/ 21 21 TriaHook(); 22 22 TriaHook(int in_numanalyses,int matice_id, IoModel* iomodel); -
issm/trunk/src/c/objects/Elements/TriaRef.cpp
r10135 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 24 24 25 25 /*Object constructors and destructor*/ 26 /*FUNCTION TriaRef::TriaRef(){{{ 1*/26 /*FUNCTION TriaRef::TriaRef(){{{*/ 27 27 TriaRef::TriaRef(){ 28 28 this->element_type_list=NULL; 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION TriaRef::TriaRef(int* types,int nummodels){{{ 1*/31 /*FUNCTION TriaRef::TriaRef(int* types,int nummodels){{{*/ 32 32 33 33 TriaRef::TriaRef(const int nummodels){ 34 34 35 35 /*Only allocate pointer*/ 36 element_type_list= (int*)xmalloc(nummodels*sizeof(int));37 38 } 39 /*}}}*/ 40 /*FUNCTION TriaRef::~TriaRef(){{{ 1*/36 element_type_list=xNew<int>(nummodels); 37 38 } 39 /*}}}*/ 40 /*FUNCTION TriaRef::~TriaRef(){{{*/ 41 41 TriaRef::~TriaRef(){ 42 x free((void**)&element_type_list);42 xDelete<int>(element_type_list); 43 43 } 44 44 /*}}}*/ 45 45 46 46 /*Management*/ 47 /*FUNCTION TriaRef::SetElementType{{{ 1*/47 /*FUNCTION TriaRef::SetElementType{{{*/ 48 48 void TriaRef::SetElementType(int type,int type_counter){ 49 49 … … 56 56 57 57 /*Reference Element numerics*/ 58 /*FUNCTION TriaRef::GetBMacAyeal {{{ 1*/59 void TriaRef::GetBMacAyeal( double* B, double* xyz_list, GaussTria* gauss){58 /*FUNCTION TriaRef::GetBMacAyeal {{{*/ 59 void TriaRef::GetBMacAyeal(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){ 60 60 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 61 61 * For node i, Bi can be expressed in the actual coordinate system … … 70 70 71 71 int i; 72 double dbasis[NDOF2][NUMNODES];72 IssmDouble dbasis[NDOF2][NUMNODES]; 73 73 74 74 /*Get dh1dh2dh3 in actual coordinate system: */ … … 86 86 } 87 87 /*}}}*/ 88 /*FUNCTION TriaRef::GetBMacAyealStokes {{{ 1*/89 void TriaRef::GetBMacAyealStokes( double* B, double* xyz_list, GaussTria* gauss){88 /*FUNCTION TriaRef::GetBMacAyealStokes {{{*/ 89 void TriaRef::GetBMacAyealStokes(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss){ 90 90 91 91 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. … … 101 101 102 102 /*Same thing in the actual coordinate system: */ 103 double dbasis[NDOF2][NUMNODES];103 IssmDouble dbasis[NDOF2][NUMNODES]; 104 104 105 105 /*Get dh1dh2dh3 in actual coordinates system : */ … … 117 117 } 118 118 /*}}}*/ 119 /*FUNCTION TriaRef::GetSegmentBFlux{{{ 1*/120 void TriaRef::GetSegmentBFlux( double* B,GaussTria* gauss, int index1,int index2){119 /*FUNCTION TriaRef::GetSegmentBFlux{{{*/ 120 void TriaRef::GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2){ 121 121 /*Compute B matrix. B=[phi1 phi2 -phi3 -phi4] 122 122 * … … 126 126 */ 127 127 128 double l1l3[NUMNODES];128 IssmDouble l1l3[NUMNODES]; 129 129 130 130 GetNodalFunctions(&l1l3[0],gauss); … … 136 136 } 137 137 /*}}}*/ 138 /*FUNCTION TriaRef::GetSegmentBprimeFlux{{{ 1*/139 void TriaRef::GetSegmentBprimeFlux( double* Bprime,GaussTria* gauss, int index1,int index2){138 /*FUNCTION TriaRef::GetSegmentBprimeFlux{{{*/ 139 void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2){ 140 140 /*Compute Bprime matrix. Bprime=[phi1 phi2 phi3 phi4] 141 141 * … … 145 145 */ 146 146 147 double l1l3[NUMNODES];147 IssmDouble l1l3[NUMNODES]; 148 148 149 149 GetNodalFunctions(&l1l3[0],gauss); … … 155 155 } 156 156 /*}}}*/ 157 /*FUNCTION TriaRef::GetBPrognostic{{{ 1*/158 void TriaRef::GetBPrognostic( double* B_prog, double* xyz_list, GaussTria* gauss){157 /*FUNCTION TriaRef::GetBPrognostic{{{*/ 158 void TriaRef::GetBPrognostic(IssmDouble* B_prog, IssmDouble* xyz_list, GaussTria* gauss){ 159 159 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 160 160 * For node i, Bi can be expressed in the actual coordinate system … … 167 167 */ 168 168 169 double basis[NUMNODES];169 IssmDouble basis[NUMNODES]; 170 170 171 171 /*Get dh1dh2dh3 in actual coordinate system: */ … … 179 179 } 180 180 /*}}}*/ 181 /*FUNCTION TriaRef::GetBprimeMacAyeal {{{ 1*/182 void TriaRef::GetBprimeMacAyeal( double* Bprime, double* xyz_list, GaussTria* gauss){181 /*FUNCTION TriaRef::GetBprimeMacAyeal {{{*/ 182 void TriaRef::GetBprimeMacAyeal(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){ 183 183 184 184 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. … … 194 194 195 195 /*Same thing in the actual coordinate system: */ 196 double dbasis[NDOF2][NUMNODES];196 IssmDouble dbasis[NDOF2][NUMNODES]; 197 197 198 198 /*Get dh1dh2dh3 in actual coordinates system : */ … … 210 210 } 211 211 /*}}}*/ 212 /*FUNCTION TriaRef::GetBprimeMacAyealStokes {{{ 1*/213 void TriaRef::GetBprimeMacAyealStokes( double* Bprime, double* xyz_list, GaussTria* gauss){212 /*FUNCTION TriaRef::GetBprimeMacAyealStokes {{{*/ 213 void TriaRef::GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){ 214 214 215 215 /*Compute Bprime matrix. Bprime=[Bprime1 Bprime2 Bprime3] where Bprimei is of size 3*NDOF2. … … 226 226 227 227 /*Same thing in the actual coordinate system: */ 228 double dbasis[NDOF2][NUMNODES];228 IssmDouble dbasis[NDOF2][NUMNODES]; 229 229 230 230 /*Get dh1dh2dh3 in actual coordinates system : */ … … 244 244 } 245 245 /*}}}*/ 246 /*FUNCTION TriaRef::GetBprimePrognostic{{{ 1*/247 void TriaRef::GetBprimePrognostic( double* Bprime_prog, double* xyz_list, GaussTria* gauss){246 /*FUNCTION TriaRef::GetBprimePrognostic{{{*/ 247 void TriaRef::GetBprimePrognostic(IssmDouble* Bprime_prog, IssmDouble* xyz_list, GaussTria* gauss){ 248 248 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 249 249 * For node i, Bi' can be expressed in the actual coordinate system … … 257 257 258 258 /*Same thing in the actual coordinate system: */ 259 double dbasis[NDOF2][NUMNODES];259 IssmDouble dbasis[NDOF2][NUMNODES]; 260 260 261 261 /*Get dh1dh2dh3 in actual coordinates system : */ … … 269 269 } 270 270 /*}}}*/ 271 /*FUNCTION TriaRef::GetL{{{ 1*/272 void TriaRef::GetL( double* L, double* xyz_list,GaussTria* gauss,int numdof){271 /*FUNCTION TriaRef::GetL{{{*/ 272 void TriaRef::GetL(IssmDouble* L, IssmDouble* xyz_list,GaussTria* gauss,int numdof){ 273 273 /*Compute L matrix. L=[L1 L2 L3] where Li is square and of size numdof. 274 274 * For node i, Li can be expressed in the actual coordinate system … … 285 285 286 286 int i; 287 double basis[3];287 IssmDouble basis[3]; 288 288 289 289 /*Get basis in actual coordinate system: */ … … 306 306 } 307 307 /*}}}*/ 308 /*FUNCTION TriaRef::GetJacobian{{{ 1*/309 void TriaRef::GetJacobian( double* J, double* xyz_list,GaussTria* gauss){308 /*FUNCTION TriaRef::GetJacobian{{{*/ 309 void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTria* gauss){ 310 310 /*The Jacobian is constant over the element, discard the gaussian points. 311 311 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 312 double x1,y1,x2,y2,x3,y3;312 IssmDouble x1,y1,x2,y2,x3,y3; 313 313 314 314 x1=*(xyz_list+NUMNODES*0+0); … … 326 326 } 327 327 /*}}}*/ 328 /*FUNCTION TriaRef::GetSegmentJacobianDeterminant{{{ 1*/329 void TriaRef::GetSegmentJacobianDeterminant( double* Jdet, double* xyz_list,GaussTria* gauss){328 /*FUNCTION TriaRef::GetSegmentJacobianDeterminant{{{*/ 329 void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){ 330 330 /*The Jacobian determinant is constant over the element, discard the gaussian points. 331 331 * J is assumed to have been allocated*/ 332 double x1,y1,x2,y2;332 IssmDouble x1,y1,x2,y2; 333 333 334 334 x1=*(xyz_list+3*0+0); … … 338 338 339 339 *Jdet=1.0/2.0*sqrt(pow(x2-x1,2.) + pow(y2-y1,2.)); 340 if(*Jdet<0) _error _("negative jacobian determinant!");341 342 } 343 /*}}}*/ 344 /*FUNCTION TriaRef::GetJacobianDeterminant2d{{{ 1*/345 void TriaRef::GetJacobianDeterminant2d( double* Jdet, double* xyz_list,GaussTria* gauss){340 if(*Jdet<0) _error2_("negative jacobian determinant!"); 341 342 } 343 /*}}}*/ 344 /*FUNCTION TriaRef::GetJacobianDeterminant2d{{{*/ 345 void TriaRef::GetJacobianDeterminant2d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){ 346 346 /*The Jacobian determinant is constant over the element, discard the gaussian points. 347 347 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 348 double J[2][2];348 IssmDouble J[2][2]; 349 349 350 350 /*Get Jacobian*/ … … 353 353 /*Get Determinant*/ 354 354 Matrix2x2Determinant(Jdet,&J[0][0]); 355 if(*Jdet<0) _error _("negative jacobian determinant!");356 357 } 358 /*}}}*/ 359 /*FUNCTION TriaRef::GetJacobianDeterminant3d {{{ 1*/360 void TriaRef::GetJacobianDeterminant3d( double* Jdet, double* xyz_list,GaussTria* gauss){355 if(*Jdet<0) _error2_("negative jacobian determinant!"); 356 357 } 358 /*}}}*/ 359 /*FUNCTION TriaRef::GetJacobianDeterminant3d {{{*/ 360 void TriaRef::GetJacobianDeterminant3d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss){ 361 361 /*The Jacobian determinant is constant over the element, discard the gaussian points. 362 362 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 363 363 364 double x1,x2,x3,y1,y2,y3,z1,z2,z3;364 IssmDouble x1,x2,x3,y1,y2,y3,z1,z2,z3; 365 365 366 366 x1=*(xyz_list+3*0+0); … … 375 375 376 376 *Jdet=SQRT3/6.0*pow(pow(((y2-y1)*(z3-z1)-(z2-z1)*(y3-y1)),2.0)+pow(((z2-z1)*(x3-x1)-(x2-x1)*(z3-z1)),2.0)+pow(((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)),2.0),0.5); 377 if(*Jdet<0) _error _("negative jacobian determinant!");378 379 } 380 /*}}}*/ 381 /*FUNCTION TriaRef::GetJacobianInvert{{{ 1*/382 void TriaRef::GetJacobianInvert( double* Jinv, double* xyz_list,GaussTria* gauss){377 if(*Jdet<0) _error2_("negative jacobian determinant!"); 378 379 } 380 /*}}}*/ 381 /*FUNCTION TriaRef::GetJacobianInvert{{{*/ 382 void TriaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTria* gauss){ 383 383 384 384 /*Jacobian*/ 385 double J[2][2];385 IssmDouble J[2][2]; 386 386 387 387 /*Call Jacobian routine to get the jacobian:*/ … … 393 393 } 394 394 /*}}}*/ 395 /*FUNCTION TriaRef::GetNodalFunctions{{{ 1*/396 void TriaRef::GetNodalFunctions( double* basis,GaussTria* gauss){395 /*FUNCTION TriaRef::GetNodalFunctions{{{*/ 396 void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){ 397 397 /*This routine returns the values of the nodal functions at the gaussian point.*/ 398 398 … … 403 403 } 404 404 /*}}}*/ 405 /*FUNCTION TriaRef::GetSegmentNodalFunctions{{{ 1*/406 void TriaRef::GetSegmentNodalFunctions( double* basis,GaussTria* gauss,int index1,int index2){405 /*FUNCTION TriaRef::GetSegmentNodalFunctions{{{*/ 406 void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,GaussTria* gauss,int index1,int index2){ 407 407 /*This routine returns the values of the nodal functions at the gaussian point.*/ 408 408 409 double BasisFunctions[3];409 IssmDouble BasisFunctions[3]; 410 410 411 411 GetNodalFunctions(&BasisFunctions[0],gauss); … … 417 417 } 418 418 /*}}}*/ 419 /*FUNCTION TriaRef::GetNodalFunctionsDerivatives{{{ 1*/420 void TriaRef::GetNodalFunctionsDerivatives( double* dbasis,double* xyz_list, GaussTria* gauss){419 /*FUNCTION TriaRef::GetNodalFunctionsDerivatives{{{*/ 420 void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss){ 421 421 422 422 /*This routine returns the values of the nodal functions derivatives (with respect to the 423 423 * actual coordinate system): */ 424 424 int i; 425 double dbasis_ref[NDOF2][NUMNODES];426 double Jinv[NDOF2][NDOF2];425 IssmDouble dbasis_ref[NDOF2][NUMNODES]; 426 IssmDouble Jinv[NDOF2][NDOF2]; 427 427 428 428 /*Get derivative values with respect to parametric coordinate system: */ … … 444 444 } 445 445 /*}}}*/ 446 /*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference{{{ 1*/447 void TriaRef::GetNodalFunctionsDerivativesReference( double* dl1dl3,GaussTria* gauss){446 /*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference{{{*/ 447 void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dl1dl3,GaussTria* gauss){ 448 448 /*This routine returns the values of the nodal functions derivatives (with respect to the 449 449 * natural coordinate system) at the gaussian point. */ … … 463 463 } 464 464 /*}}}*/ 465 /*FUNCTION TriaRef::GetInputDerivativeValue{{{ 1*/466 void TriaRef::GetInputDerivativeValue( double* p, double* plist,double* xyz_list, GaussTria* gauss){465 /*FUNCTION TriaRef::GetInputDerivativeValue{{{*/ 466 void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss){ 467 467 468 468 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian … … 475 475 476 476 /*Nodal Derivatives*/ 477 double dbasis[2][3]; //nodal derivative functions in actual coordinate system.477 IssmDouble dbasis[2][3]; //nodal derivative functions in actual coordinate system. 478 478 479 479 /*Get dh1dh2dh3 in actual coordinate system: */ … … 486 486 } 487 487 /*}}}*/ 488 /*FUNCTION TriaRef::GetInputValue{{{ 1*/489 void TriaRef::GetInputValue( double* p, double* plist, GaussTria* gauss){488 /*FUNCTION TriaRef::GetInputValue{{{*/ 489 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){ 490 490 491 491 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter value at gaussian … … 493 493 494 494 /*nodal functions annd output: */ 495 double basis[3];495 IssmDouble basis[3]; 496 496 497 497 /*Get nodal functions*/ -
issm/trunk/src/c/objects/Elements/TriaRef.h
r10135 r12706 25 25 26 26 /*Numerics*/ 27 void GetBMacAyeal( double* B, double* xyz_list, GaussTria* gauss);28 void GetBMacAyealStokes( double* B , double* xyz_list, GaussTria* gauss);29 void GetBprimeMacAyeal( double* Bprime, double* xyz_list, GaussTria* gauss);30 void GetBprimeMacAyealStokes( double* Bprime, double* xyz_list, GaussTria* gauss);31 void GetBprimePrognostic( double* Bprime_prog, double* xyz_list, GaussTria* gauss);32 void GetBPrognostic( double* B_prog, double* xyz_list, GaussTria* gauss);33 void GetL( double* L, double* xyz_list,GaussTria* gauss,int numdof);34 void GetJacobian( double* J, double* xyz_list,GaussTria* gauss);35 void GetSegmentJacobianDeterminant( double* Jdet, double* xyz_list,GaussTria* gauss);36 void GetJacobianDeterminant2d( double* Jdet, double* xyz_list,GaussTria* gauss);37 void GetJacobianDeterminant3d( double* Jdet, double* xyz_list,GaussTria* gauss);38 void GetJacobianInvert( double* Jinv, double* xyz_list,GaussTria* gauss);39 void GetNodalFunctions( double* l1l2l3,GaussTria* gauss);40 void GetSegmentNodalFunctions( double* l1l2l3,GaussTria* gauss, int index1,int index2);41 void GetSegmentBFlux( double* B,GaussTria* gauss, int index1,int index2);42 void GetSegmentBprimeFlux( double* Bprime,GaussTria* gauss, int index1,int index2);43 void GetNodalFunctionsDerivatives( double* l1l2l3,double* xyz_list, GaussTria* gauss);44 void GetNodalFunctionsDerivativesReference( double* dl1dl3,GaussTria* gauss);45 void GetInputValue( double* pp, double* plist, GaussTria* gauss);46 void GetInputDerivativeValue( double* pp, double* plist,double* xyz_list, GaussTria* gauss);27 void GetBMacAyeal(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss); 28 void GetBMacAyealStokes(IssmDouble* B , IssmDouble* xyz_list, GaussTria* gauss); 29 void GetBprimeMacAyeal(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss); 30 void GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss); 31 void GetBprimePrognostic(IssmDouble* Bprime_prog, IssmDouble* xyz_list, GaussTria* gauss); 32 void GetBPrognostic(IssmDouble* B_prog, IssmDouble* xyz_list, GaussTria* gauss); 33 void GetL(IssmDouble* L, IssmDouble* xyz_list,GaussTria* gauss,int numdof); 34 void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTria* gauss); 35 void GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss); 36 void GetJacobianDeterminant2d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss); 37 void GetJacobianDeterminant3d(IssmDouble* Jdet, IssmDouble* xyz_list,GaussTria* gauss); 38 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTria* gauss); 39 void GetNodalFunctions(IssmDouble* l1l2l3,GaussTria* gauss); 40 void GetSegmentNodalFunctions(IssmDouble* l1l2l3,GaussTria* gauss, int index1,int index2); 41 void GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2); 42 void GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2); 43 void GetNodalFunctionsDerivatives(IssmDouble* l1l2l3,IssmDouble* xyz_list, GaussTria* gauss); 44 void GetNodalFunctionsDerivativesReference(IssmDouble* dl1dl3,GaussTria* gauss); 45 void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss); 46 void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss); 47 47 48 48 }; -
issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*BoolExternalResult constructors and destructor*/ 23 /*FUNCTION BoolExternalResult::BoolExternalResult(){{{ 1*/23 /*FUNCTION BoolExternalResult::BoolExternalResult(){{{*/ 24 24 BoolExternalResult::BoolExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION BoolExternalResult::BoolExternalResult(int enum_type,bool value){{{ 1*/29 BoolExternalResult::BoolExternalResult(int in_id, int in_enum_type,bool in_value,int in_step, double in_time){28 /*FUNCTION BoolExternalResult::BoolExternalResult(int enum_type,bool value){{{*/ 29 BoolExternalResult::BoolExternalResult(int in_id, int in_enum_type,bool in_value,int in_step, IssmDouble in_time){ 30 30 31 31 id=in_id; … … 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION BoolExternalResult::~BoolExternalResult(){{{ 1*/38 /*FUNCTION BoolExternalResult::~BoolExternalResult(){{{*/ 39 39 BoolExternalResult::~BoolExternalResult(){ 40 40 return; … … 43 43 44 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION BoolExternalResult::Echo {{{ 1*/45 /*FUNCTION BoolExternalResult::Echo {{{*/ 46 46 void BoolExternalResult::Echo(void){ 47 47 this->DeepEcho(); 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION BoolExternalResult::DeepEcho{{{ 1*/50 /*FUNCTION BoolExternalResult::DeepEcho{{{*/ 51 51 void BoolExternalResult::DeepEcho(void){ 52 52 53 printf("BoolExternalResult:\n");54 printf(" id: %i\n",this->id);55 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));56 printf(" value: %s\n",this->value?"true":"false");57 printf(" step: %i\n",this->step);58 printf(" time: %g\n",this->time);53 _printLine_("BoolExternalResult:"); 54 _printLine_(" id: " << this->id); 55 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 56 _printLine_(" value: " <<(this->value?"true":"false")); 57 _printLine_(" step: " << this->step); 58 _printLine_(" time: " << this->time); 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION BoolExternalResult::Id{{{ 1*/61 /*FUNCTION BoolExternalResult::Id{{{*/ 62 62 int BoolExternalResult::Id(void){ return -1; } 63 63 /*}}}*/ 64 /*FUNCTION BoolExternalResult::MyRank{{{ 1*/64 /*FUNCTION BoolExternalResult::MyRank{{{*/ 65 65 int BoolExternalResult::MyRank(void){ 66 66 extern int my_rank; … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION BoolExternalResult::ObjectEnum{{{ 1*/70 /*FUNCTION BoolExternalResult::ObjectEnum{{{*/ 71 71 int BoolExternalResult::ObjectEnum(void){ 72 72 … … 75 75 } 76 76 /*}}}*/ 77 /*FUNCTION BoolExternalResult::copy{{{ 1*/77 /*FUNCTION BoolExternalResult::copy{{{*/ 78 78 Object* BoolExternalResult::copy() { 79 79 … … 84 84 85 85 /*BoolExternalResult management: */ 86 /*FUNCTION BoolExternalResult::WriteData{{{ 1*/86 /*FUNCTION BoolExternalResult::WriteData{{{*/ 87 87 void BoolExternalResult::WriteData(FILE* fid,bool io_gather){ 88 88 … … 90 90 int type; 91 91 int size; 92 double boolean;92 IssmPDouble passiveDouble; 93 93 extern int my_rank; 94 94 char* name = NULL; … … 102 102 fwrite(&length,sizeof(int),1,fid); 103 103 fwrite(name,length,1,fid); 104 x free((void**)&name);104 xDelete<char>(name); 105 105 106 106 /*Now write time and step: */ 107 fwrite(&time,sizeof(double),1,fid); 107 passiveDouble=reCast<IssmPDouble>(time); 108 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 108 109 fwrite(&step,sizeof(int),1,fid); 109 110 110 /*Now write bool, after casting it: */ 111 boolean=(double)this->value; 112 113 /*writing a double, type is 1, size is 1: */ 111 /*writing a IssmDouble, type is 1, size is 1: */ 114 112 type=1; 115 113 size=1; 116 114 fwrite(&type,sizeof(int),1,fid); 117 115 fwrite(&size,sizeof(int),1,fid); 118 fwrite(&boolean,size*sizeof(double),1,fid); 116 /*Now write bool, after casting it: */ 117 passiveDouble=reCast<IssmPDouble>(this->value); 118 fwrite(&passiveDouble,size*sizeof(IssmPDouble),1,fid); 119 119 120 120 } 121 /*}}} 1*/122 /*FUNCTION BoolExternalResult::GetResultName{{{ 1*/121 /*}}}*/ 122 /*FUNCTION BoolExternalResult::GetResultName{{{*/ 123 123 void BoolExternalResult::GetResultName(char** pname){ 124 124 EnumToStringx(pname,this->enum_type); 125 125 } 126 126 /*}}}*/ 127 /*FUNCTION BoolExternalResult::GetStep{{{ 1*/127 /*FUNCTION BoolExternalResult::GetStep{{{*/ 128 128 int BoolExternalResult::GetStep(void){ 129 129 -
issm/trunk/src/c/objects/ExternalResults/BoolExternalResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 30 30 bool value; 31 31 int step; 32 double time;32 IssmDouble time; 33 33 34 /*BoolExternalResult constructors, destructors: {{{ 1*/34 /*BoolExternalResult constructors, destructors: {{{*/ 35 35 BoolExternalResult(); 36 BoolExternalResult(int id, int enum_type,bool value,int step, double time);36 BoolExternalResult(int id, int enum_type,bool value,int step,IssmDouble time); 37 37 ~BoolExternalResult(); 38 38 /*}}}*/ 39 /*Object virtual functions definitions:{{{ 1*/39 /*Object virtual functions definitions:{{{ */ 40 40 void Echo(); 41 41 void DeepEcho(); … … 45 45 Object* copy(); 46 46 /*}}}*/ 47 /*ExternalResult management: {{{ 1*/47 /*ExternalResult management: {{{*/ 48 48 int InstanceEnum(){return enum_type;} 49 49 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*DoubleExternalResult constructors and destructor*/ 23 /*FUNCTION DoubleExternalResult::DoubleExternalResult(){{{ 1*/23 /*FUNCTION DoubleExternalResult::DoubleExternalResult(){{{*/ 24 24 DoubleExternalResult::DoubleExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION DoubleExternalResult::DoubleExternalResult(int enum_type, double value){{{1*/29 DoubleExternalResult::DoubleExternalResult(int in_id, int in_enum_type, double in_value,int in_step, double in_time){28 /*FUNCTION DoubleExternalResult::DoubleExternalResult(int enum_type,IssmDouble value){{{*/ 29 DoubleExternalResult::DoubleExternalResult(int in_id, int in_enum_type,IssmDouble in_value,int in_step, IssmDouble in_time){ 30 30 31 31 id=in_id; … … 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION DoubleExternalResult::~DoubleExternalResult(){{{ 1*/38 /*FUNCTION DoubleExternalResult::~DoubleExternalResult(){{{*/ 39 39 DoubleExternalResult::~DoubleExternalResult(){ 40 40 return; … … 43 43 44 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION DoubleExternalResult::Echo {{{ 1*/45 /*FUNCTION DoubleExternalResult::Echo {{{*/ 46 46 void DoubleExternalResult::Echo(void){ 47 47 this->DeepEcho(); 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION DoubleExternalResult::DeepEcho{{{ 1*/50 /*FUNCTION DoubleExternalResult::DeepEcho{{{*/ 51 51 void DoubleExternalResult::DeepEcho(void){ 52 52 53 printf("DoubleExternalResult:\n");54 printf(" id: %i\n",this->id);55 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));56 printf(" value: %g\n",this->value);57 printf(" step: %i\n",this->step);58 printf(" time: %g\n",this->time);53 _printLine_("DoubleExternalResult:"); 54 _printLine_(" id: " << this->id); 55 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 56 _printLine_(" value: " << this->value); 57 _printLine_(" step: " << this->step); 58 _printLine_(" time: " << this->time); 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION DoubleExternalResult::Id{{{ 1*/61 /*FUNCTION DoubleExternalResult::Id{{{*/ 62 62 int DoubleExternalResult::Id(void){ return -1; } 63 63 /*}}}*/ 64 /*FUNCTION DoubleExternalResult::MyRank{{{ 1*/64 /*FUNCTION DoubleExternalResult::MyRank{{{*/ 65 65 int DoubleExternalResult::MyRank(void){ 66 66 extern int my_rank; … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION DoubleExternalResult::ObjectEnum{{{ 1*/70 /*FUNCTION DoubleExternalResult::ObjectEnum{{{*/ 71 71 int DoubleExternalResult::ObjectEnum(void){ 72 72 … … 75 75 } 76 76 /*}}}*/ 77 /*FUNCTION DoubleExternalResult::copy{{{ 1*/77 /*FUNCTION DoubleExternalResult::copy{{{*/ 78 78 Object* DoubleExternalResult::copy() { 79 79 … … 84 84 85 85 /*DoubleExternalResult management: */ 86 /*FUNCTION DoubleExternalResult::WriteData{{{ 1*/86 /*FUNCTION DoubleExternalResult::WriteData{{{*/ 87 87 void DoubleExternalResult::WriteData(FILE* fid,bool io_gather){ 88 88 … … 92 92 char *name = NULL; 93 93 extern int my_rank; 94 IssmPDouble passiveDouble; 94 95 95 96 /*return if now on cpu 0: */ … … 101 102 fwrite(&length,sizeof(int),1,fid); 102 103 fwrite(name,length,1,fid); 103 x free((void**)&name);104 xDelete<char>(name); 104 105 105 106 /*Now write time and step: */ 106 fwrite(&time,sizeof(double),1,fid); 107 passiveDouble=reCast<IssmPDouble>(time); 108 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 107 109 fwrite(&step,sizeof(int),1,fid); 108 110 109 /*writing a double, type is 1, size is 1: */111 /*writing a IssmDouble, type is 1, size is 1: */ 110 112 type=1; 111 113 size=1; 112 114 fwrite(&type,sizeof(int),1,fid); 113 115 fwrite(&size,sizeof(int),1,fid); 114 fwrite(&this->value,size*sizeof(double),1,fid); 116 passiveDouble=reCast<IssmPDouble>(this->value); 117 fwrite(&passiveDouble,size*sizeof(IssmPDouble),1,fid); 115 118 116 119 } 117 /*}}} 1*/118 /*FUNCTION DoubleExternalResult::GetResultName{{{ 1*/120 /*}}}*/ 121 /*FUNCTION DoubleExternalResult::GetResultName{{{*/ 119 122 void DoubleExternalResult::GetResultName(char** pname){ 120 123 EnumToStringx(pname,this->enum_type); 121 124 } 122 125 /*}}}*/ 123 /*FUNCTION DoubleExternalResult::GetStep{{{ 1*/126 /*FUNCTION DoubleExternalResult::GetStep{{{*/ 124 127 int DoubleExternalResult::GetStep(void){ 125 128 -
issm/trunk/src/c/objects/ExternalResults/DoubleExternalResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 29 29 int id; 30 30 int enum_type; 31 double value;31 IssmDouble value; 32 32 int step; 33 double time;33 IssmDouble time; 34 34 35 35 36 /*DoubleExternalResult constructors, destructors: {{{ 1*/36 /*DoubleExternalResult constructors, destructors: {{{*/ 37 37 DoubleExternalResult(); 38 DoubleExternalResult(int id,int enum_type, double value,int step,double time);38 DoubleExternalResult(int id,int enum_type,IssmDouble value,int step,IssmDouble time); 39 39 ~DoubleExternalResult(); 40 40 /*}}}*/ 41 /*Object virtual functions definitions:{{{ 1*/41 /*Object virtual functions definitions:{{{ */ 42 42 void Echo(); 43 43 void DeepEcho(); … … 47 47 Object* copy(); 48 48 /*}}}*/ 49 /*ExternalResult management: {{{ 1*/49 /*ExternalResult management: {{{*/ 50 50 int InstanceEnum(){return enum_type;} 51 51 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*DoubleMatExternalResult constructors and destructor*/ 23 /*FUNCTION DoubleMatExternalResult::DoubleMatExternalResult(){{{ 1*/23 /*FUNCTION DoubleMatExternalResult::DoubleMatExternalResult(){{{*/ 24 24 DoubleMatExternalResult::DoubleMatExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION DoubleMatExternalResult::DoubleMatExternalResult(int in_id, int enum_type,IssmDoubleMat values,int M,int N,int in_step, double in_time){{{1*/29 DoubleMatExternalResult::DoubleMatExternalResult(int in_id, int in_enum_type, double* in_values, int in_M,int in_N,int in_step,double in_time){28 /*FUNCTION DoubleMatExternalResult::DoubleMatExternalResult(int in_id, int enum_type,IssmDoubleMat values,int M,int N,int in_step,IssmDouble in_time){{{*/ 29 DoubleMatExternalResult::DoubleMatExternalResult(int in_id, int in_enum_type,IssmDouble* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){ 30 30 31 31 id=in_id; … … 36 36 /*Copy result in values*/ 37 37 if(M*N){ 38 values= (double*)xmalloc(M*N*sizeof(double));39 memcpy(values,in_values,M*N*sizeof(double));38 values=xNew<IssmDouble>(M*N); 39 xMemCpy<IssmDouble>(values,in_values,M*N); 40 40 } 41 41 else values=NULL; … … 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION DoubleMatExternalResult::~DoubleMatExternalResult(){{{ 1*/47 /*FUNCTION DoubleMatExternalResult::~DoubleMatExternalResult(){{{*/ 48 48 DoubleMatExternalResult::~DoubleMatExternalResult(){ 49 49 50 x free((void**)&this->values);50 xDelete<IssmDouble>(this->values); 51 51 return; 52 52 } … … 54 54 55 55 /*Object virtual functions definitions:*/ 56 /*FUNCTION DoubleMatExternalResult::Echo {{{ 1*/56 /*FUNCTION DoubleMatExternalResult::Echo {{{*/ 57 57 void DoubleMatExternalResult::Echo(void){ 58 58 59 printf("DoubleMatExternalResult:\n");60 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));61 printf(" step: %i\n",this->step);62 printf(" time: %g\n",this->time);63 printf(" matrix size: %i-%i\n",this->M,this->N);59 _printLine_("DoubleMatExternalResult:"); 60 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 61 _printLine_(" step: " << this->step); 62 _printLine_(" time: " << this->time); 63 _printLine_(" matrix size: " << this->M << "-" << this->N); 64 64 65 65 } 66 66 /*}}}*/ 67 /*FUNCTION DoubleMatExternalResult::DeepEcho{{{ 1*/67 /*FUNCTION DoubleMatExternalResult::DeepEcho{{{*/ 68 68 void DoubleMatExternalResult::DeepEcho(void){ 69 69 70 70 int i,j; 71 71 72 printf("DoubleMatExternalResult:\n");73 printf(" id: %i\n",this->id);74 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));75 printf(" step: %i\n",this->step);76 printf(" time: %g\n",this->time);77 printf(" matrix size: %i-%i\n",this->M,this->N);72 _printLine_("DoubleMatExternalResult:"); 73 _printLine_(" id: " << this->id); 74 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 75 _printLine_(" step: " << this->step); 76 _printLine_(" time: " << this->time); 77 _printLine_(" matrix size: " << this->M << "-" << this->N); 78 78 for (i=0;i<this->M;i++){ 79 printf(" [ ");79 _printString_(" [ "); 80 80 for (j=0;j<this->N;j++){ 81 printf(" %12.6g ",this->values[i*this->N+j]);81 _printString_( " " << setw(11) << setprecision (5) << this->values[i*this->N+j]); 82 82 } 83 printf(" ]\n");83 _printLine_(" ]"); 84 84 } 85 printf("\n");86 85 87 86 } 88 87 /*}}}*/ 89 /*FUNCTION DoubleMatExternalResult::Id{{{ 1*/88 /*FUNCTION DoubleMatExternalResult::Id{{{*/ 90 89 int DoubleMatExternalResult::Id(void){ return -1; } 91 90 /*}}}*/ 92 /*FUNCTION DoubleMatExternalResult::MyRank{{{ 1*/91 /*FUNCTION DoubleMatExternalResult::MyRank{{{*/ 93 92 int DoubleMatExternalResult::MyRank(void){ 94 93 extern int my_rank; … … 96 95 } 97 96 /*}}}*/ 98 /*FUNCTION DoubleMatExternalResult::ObjectEnum{{{ 1*/97 /*FUNCTION DoubleMatExternalResult::ObjectEnum{{{*/ 99 98 int DoubleMatExternalResult::ObjectEnum(void){ 100 99 … … 103 102 } 104 103 /*}}}*/ 105 /*FUNCTION DoubleMatExternalResult::copy{{{ 1*/104 /*FUNCTION DoubleMatExternalResult::copy{{{*/ 106 105 Object* DoubleMatExternalResult::copy() { 107 106 … … 112 111 113 112 /*DoubleMatExternalResult management: */ 114 /*FUNCTION DoubleMatExternalResult::WriteData{{{ 1*/113 /*FUNCTION DoubleMatExternalResult::WriteData{{{*/ 115 114 void DoubleMatExternalResult::WriteData(FILE* fid,bool io_gather){ 116 115 … … 120 119 char *name = NULL; 121 120 extern int my_rank; 121 IssmPDouble *passiveDouble_p=NULL; 122 IssmPDouble passiveDouble; 122 123 123 124 if(io_gather){ … … 126 127 } 127 128 129 passiveDouble_p=xNew<IssmPDouble>(M*N); 130 128 131 /*First write enum: */ 129 132 EnumToStringx(&name,this->enum_type); … … 131 134 fwrite(&length,sizeof(int),1,fid); 132 135 fwrite(name,length,1,fid); 133 x free((void**)&name);136 xDelete<char>(name); 134 137 135 138 /*Now write time and step: */ 136 fwrite(&time,sizeof(double),1,fid); 139 passiveDouble=reCast<IssmPDouble>(time); 140 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 137 141 fwrite(&step,sizeof(int),1,fid); 138 142 139 /*writing a double array, type is 3:*/143 /*writing a IssmDouble array, type is 3:*/ 140 144 type=3; 141 145 fwrite(&type,sizeof(int),1,fid); … … 144 148 cols=this->N; 145 149 fwrite(&cols,sizeof(int),1,fid); 146 fwrite(this->values,cols*rows*sizeof(double),1,fid); 150 for (int i=0; i<N*M; ++i) passiveDouble_p[i]=reCast<IssmPDouble>(values[i]); 151 fwrite(passiveDouble_p,cols*rows*sizeof(IssmPDouble),1,fid); 152 xDelete(passiveDouble_p); 147 153 148 154 } 149 /*}}} 1*/150 /*FUNCTION DoubleMatExternalResult::GetResultName{{{ 1*/155 /*}}}*/ 156 /*FUNCTION DoubleMatExternalResult::GetResultName{{{*/ 151 157 void DoubleMatExternalResult::GetResultName(char** pname){ 152 158 EnumToStringx(pname,this->enum_type); 153 159 } 154 160 /*}}}*/ 155 /*FUNCTION DoubleMatExternalResult::GetStep{{{ 1*/161 /*FUNCTION DoubleMatExternalResult::GetStep{{{*/ 156 162 int DoubleMatExternalResult::GetStep(void){ 157 163 -
issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 11 11 #ifdef HAVE_CONFIG_H … … 27 27 int id; 28 28 int enum_type; 29 double* values;29 IssmDouble* values; 30 30 int M; 31 31 int N; 32 32 int step; 33 double time;33 IssmDouble time; 34 34 35 35 public: 36 /*DoubleMatExternalResult constructors, destructors: {{{ 1*/36 /*DoubleMatExternalResult constructors, destructors: {{{*/ 37 37 DoubleMatExternalResult(); 38 DoubleMatExternalResult(int id,int enum_type, double* values,int M,int N,int step, double time);38 DoubleMatExternalResult(int id,int enum_type,IssmDouble* values,int M,int N,int step, IssmDouble time); 39 39 ~DoubleMatExternalResult(); 40 40 /*}}}*/ 41 /*Object virtual functions definitions:{{{ 1*/41 /*Object virtual functions definitions:{{{ */ 42 42 void Echo(); 43 43 void DeepEcho(); … … 47 47 Object* copy(); 48 48 /*}}}*/ 49 /*ExternalResult managemnet: {{{ 1*/49 /*ExternalResult managemnet: {{{*/ 50 50 int InstanceEnum(){return enum_type;} 51 51 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*DoubleVecExternalResult constructors and destructor*/ 23 /*FUNCTION DoubleVecExternalResult::DoubleVecExternalResult(){{{ 1*/23 /*FUNCTION DoubleVecExternalResult::DoubleVecExternalResult(){{{*/ 24 24 DoubleVecExternalResult::DoubleVecExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION DoubleVecExternalResult::DoubleVecExternalResult(int enum_type,IssmDoubleVec values,int M,int in_step, double in_time){{{1*/29 DoubleVecExternalResult::DoubleVecExternalResult(int in_id, int in_enum_type, double* in_values, int in_M,int in_step,double in_time){28 /*FUNCTION DoubleVecExternalResult::DoubleVecExternalResult(int enum_type,IssmDoubleVec values,int M,int in_step,IssmDouble in_time){{{*/ 29 DoubleVecExternalResult::DoubleVecExternalResult(int in_id, int in_enum_type,IssmDouble* in_values, int in_M,int in_step,IssmDouble in_time){ 30 30 31 31 id=in_id; … … 34 34 35 35 if(M){ 36 values= (double*)xmalloc(M*sizeof(double));37 memcpy(values,in_values,M*sizeof(double));36 values=xNew<IssmDouble>(M); 37 xMemCpy<IssmDouble>(values,in_values,M); 38 38 } 39 39 else values=NULL; … … 43 43 } 44 44 /*}}}*/ 45 /*FUNCTION DoubleVecExternalResult::~DoubleVecExternalResult(){{{ 1*/45 /*FUNCTION DoubleVecExternalResult::~DoubleVecExternalResult(){{{*/ 46 46 DoubleVecExternalResult::~DoubleVecExternalResult(){ 47 x free((void**)&values);47 xDelete<IssmDouble>(values); 48 48 return; 49 49 } … … 51 51 52 52 /*Object virtual functions definitions:*/ 53 /*FUNCTION DoubleVecExternalResult::Echo {{{ 1*/53 /*FUNCTION DoubleVecExternalResult::Echo {{{*/ 54 54 void DoubleVecExternalResult::Echo(void){ 55 55 56 printf("DoubleVecExternalResult:\n");57 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));58 printf(" vector size: %i\n",this->M);59 printf(" step: %i\n",this->step);60 printf(" time: %g\n",this->time);56 _printLine_("DoubleVecExternalResult:"); 57 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 58 _printLine_(" vector size: " << this->M); 59 _printLine_(" step: " << this->step); 60 _printLine_(" time: " << this->time); 61 61 62 62 } 63 63 /*}}}*/ 64 /*FUNCTION DoubleVecExternalResult::DeepEcho{{{ 1*/64 /*FUNCTION DoubleVecExternalResult::DeepEcho{{{*/ 65 65 void DoubleVecExternalResult::DeepEcho(void){ 66 66 67 67 int i; 68 68 69 printf("DoubleVecExternalResult:\n");70 printf(" id: %i\n",this->id);71 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));72 printf(" vector size: %i\n",this->M);69 _printLine_("DoubleVecExternalResult:"); 70 _printLine_(" id: " << this->id); 71 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 72 _printLine_(" vector size: " << this->M); 73 73 for(i=0;i<this->M;i++){ 74 printf("%i %g\n",i,this->values[i]);74 _printLine_(i << " " << this->values[i]); 75 75 } 76 printf(" step: %i\n",this->step);77 printf(" time: %g\n",this->time);76 _printLine_(" step: " << this->step); 77 _printLine_(" time: " << this->time); 78 78 } 79 79 /*}}}*/ 80 /*FUNCTION DoubleVecExternalResult::Id{{{ 1*/80 /*FUNCTION DoubleVecExternalResult::Id{{{*/ 81 81 int DoubleVecExternalResult::Id(void){ return -1; } 82 82 /*}}}*/ 83 /*FUNCTION DoubleVecExternalResult::MyRank{{{ 1*/83 /*FUNCTION DoubleVecExternalResult::MyRank{{{*/ 84 84 int DoubleVecExternalResult::MyRank(void){ 85 85 extern int my_rank; … … 87 87 } 88 88 /*}}}*/ 89 /*FUNCTION DoubleVecExternalResult::ObjectEnum{{{ 1*/89 /*FUNCTION DoubleVecExternalResult::ObjectEnum{{{*/ 90 90 int DoubleVecExternalResult::ObjectEnum(void){ 91 91 … … 94 94 } 95 95 /*}}}*/ 96 /*FUNCTION DoubleVecExternalResult::copy{{{ 1*/96 /*FUNCTION DoubleVecExternalResult::copy{{{*/ 97 97 Object* DoubleVecExternalResult::copy() { 98 98 … … 103 103 104 104 /*DoubleVecExternalResult management: */ 105 /*FUNCTION DoubleVecExternalResult::WriteData{{{ 1*/105 /*FUNCTION DoubleVecExternalResult::WriteData{{{*/ 106 106 void DoubleVecExternalResult::WriteData(FILE* fid,bool io_gather){ 107 107 … … 111 111 char *name = NULL; 112 112 extern int my_rank; 113 IssmPDouble *passiveDouble_p=NULL; 114 IssmPDouble passiveDouble; 113 115 114 116 /*return if now on cpu 0: */ 115 117 if(my_rank)return; 116 118 119 passiveDouble_p=xNew<IssmPDouble>(M); 117 120 /*First write enum: */ 118 121 EnumToStringx(&name,this->enum_type); … … 120 123 fwrite(&length,sizeof(int),1,fid); 121 124 fwrite(name,length,1,fid); 122 x free((void**)&name);125 xDelete<char>(name); 123 126 124 127 /*Now write time and step: */ 125 fwrite(&time,sizeof(double),1,fid); 128 passiveDouble=reCast<IssmPDouble>(time); 129 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 126 130 fwrite(&step,sizeof(int),1,fid); 127 131 128 /*writing a double, type is 1, size is 1: */132 /*writing a IssmDouble, type is 1, size is 1: */ 129 133 type=1; 130 134 size=this->M; 131 135 fwrite(&type,sizeof(int),1,fid); 132 136 fwrite(&size,sizeof(int),1,fid); 133 fwrite(this->values,size*sizeof(double),1,fid); 134 137 for (int i=0; i<M; ++i) passiveDouble_p[i]=reCast<IssmPDouble>(values[i]); 138 fwrite(passiveDouble_p,size*sizeof(IssmPDouble),1,fid); 139 xDelete(passiveDouble_p); 135 140 } 136 /*}}} 1*/137 /*FUNCTION DoubleVecExternalResult::GetResultName{{{ 1*/141 /*}}}*/ 142 /*FUNCTION DoubleVecExternalResult::GetResultName{{{*/ 138 143 void DoubleVecExternalResult::GetResultName(char** pname){ 139 144 EnumToStringx(pname,this->enum_type); 140 145 } 141 146 /*}}}*/ 142 /*FUNCTION DoubleVecExternalResult::GetStep{{{ 1*/147 /*FUNCTION DoubleVecExternalResult::GetStep{{{*/ 143 148 int DoubleVecExternalResult::GetStep(void){ 144 149 -
issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 11 11 #ifdef HAVE_CONFIG_H … … 27 27 int id; 28 28 int enum_type; 29 double* values;29 IssmDouble* values; 30 30 int M; 31 31 int step; 32 double time;32 IssmDouble time; 33 33 34 34 public: 35 /*DoubleVecExternalResult constructors, destructors: {{{ 1*/35 /*DoubleVecExternalResult constructors, destructors: {{{*/ 36 36 DoubleVecExternalResult(); 37 DoubleVecExternalResult(int id,int enum_type, double* values,int M,int step, double time);37 DoubleVecExternalResult(int id,int enum_type,IssmDouble* values,int M,int step, IssmDouble time); 38 38 ~DoubleVecExternalResult(); 39 39 /*}}}*/ 40 /*Object virtual functions definitions:{{{ 1*/40 /*Object virtual functions definitions:{{{ */ 41 41 void Echo(); 42 42 void DeepEcho(); … … 46 46 Object* copy(); 47 47 /*}}}*/ 48 /*ExternalResult management: {{{ 1*/48 /*ExternalResult management: {{{*/ 49 49 int InstanceEnum(){return enum_type;} 50 50 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/ExternalResults/ExternalResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 25 25 26 26 virtual ~ExternalResult(){}; 27 /*Virtual functions:{{{ 1*/27 /*Virtual functions:{{{*/ 28 28 virtual int InstanceEnum()=0; 29 29 virtual void WriteData(FILE* fid,bool io_gather)=0; -
issm/trunk/src/c/objects/ExternalResults/IntExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*IntExternalResult constructors and destructor*/ 23 /*FUNCTION IntExternalResult::IntExternalResult(){{{ 1*/23 /*FUNCTION IntExternalResult::IntExternalResult(){{{*/ 24 24 IntExternalResult::IntExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION IntExternalResult::IntExternalResult(int in_id, int in_enum_type,int in_value,int in_step, double in_time){{{1*/29 IntExternalResult::IntExternalResult(int in_id, int in_enum_type,int in_value,int in_step, double in_time){28 /*FUNCTION IntExternalResult::IntExternalResult(int in_id, int in_enum_type,int in_value,int in_step, IssmDouble in_time){{{*/ 29 IntExternalResult::IntExternalResult(int in_id, int in_enum_type,int in_value,int in_step, IssmDouble in_time){ 30 30 31 31 id=in_id; … … 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION IntExternalResult::~IntExternalResult(){{{ 1*/38 /*FUNCTION IntExternalResult::~IntExternalResult(){{{*/ 39 39 IntExternalResult::~IntExternalResult(){ 40 40 return; … … 43 43 44 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION IntExternalResult::Echo {{{ 1*/45 /*FUNCTION IntExternalResult::Echo {{{*/ 46 46 void IntExternalResult::Echo(void){ 47 47 this->DeepEcho(); 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION IntExternalResult::DeepEcho{{{ 1*/50 /*FUNCTION IntExternalResult::DeepEcho{{{*/ 51 51 void IntExternalResult::DeepEcho(void){ 52 52 53 printf("IntExternalResult:\n");54 printf(" id: %i\n",this->id);55 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));56 printf(" value: %i\n",this->value);57 printf(" step: %i\n",this->step);58 printf(" time: %g\n",this->time);53 _printLine_("IntExternalResult:"); 54 _printLine_(" id: " << this->id); 55 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 56 _printLine_(" value: " << this->value); 57 _printLine_(" step: " << this->step); 58 _printLine_(" time: " << this->time); 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION IntExternalResult::Id{{{ 1*/61 /*FUNCTION IntExternalResult::Id{{{*/ 62 62 int IntExternalResult::Id(void){ return -1; } 63 63 /*}}}*/ 64 /*FUNCTION IntExternalResult::MyRank{{{ 1*/64 /*FUNCTION IntExternalResult::MyRank{{{*/ 65 65 int IntExternalResult::MyRank(void){ 66 66 extern int my_rank; … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION IntExternalResult::ObjectEnum{{{ 1*/70 /*FUNCTION IntExternalResult::ObjectEnum{{{*/ 71 71 int IntExternalResult::ObjectEnum(void){ 72 72 … … 75 75 } 76 76 /*}}}*/ 77 /*FUNCTION IntExternalResult::copy{{{ 1*/77 /*FUNCTION IntExternalResult::copy{{{*/ 78 78 Object* IntExternalResult::copy() { 79 79 … … 84 84 85 85 /*IntExternalResult management: */ 86 /*FUNCTION IntExternalResult::WriteData{{{ 1*/86 /*FUNCTION IntExternalResult::WriteData{{{*/ 87 87 void IntExternalResult::WriteData(FILE* fid,bool io_gather){ 88 88 … … 91 91 int size; 92 92 char *name = NULL; 93 double integer;93 IssmPDouble passiveDouble; 94 94 extern int my_rank; 95 95 … … 102 102 fwrite(&length,sizeof(int),1,fid); 103 103 fwrite(name,length,1,fid); 104 x free((void**)&name);104 xDelete<char>(name); 105 105 106 106 /*Now write time and step: */ 107 fwrite(&time,sizeof(double),1,fid); 107 passiveDouble=reCast<IssmPDouble>(time); 108 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 108 109 fwrite(&step,sizeof(int),1,fid); 109 110 110 /*cast to a double: */ 111 integer=(double)this->value; 112 113 /*writing a double, type is 1, size is 1: */ 111 /*writing a IssmPDouble, type is 1, size is 1: */ 114 112 type=1; 115 113 size=1; 116 114 fwrite(&type,sizeof(int),1,fid); 117 115 fwrite(&size,sizeof(int),1,fid); 118 fwrite(&integer,size*sizeof(double),1,fid); 116 /*cast to a IssmPDouble: */ 117 passiveDouble=reCast<IssmPDouble>(value); 118 fwrite(&passiveDouble,size*sizeof(IssmPDouble),1,fid); 119 119 120 120 } 121 /*}}} 1*/122 /*FUNCTION IntExternalResult::GetResultName{{{ 1*/121 /*}}}*/ 122 /*FUNCTION IntExternalResult::GetResultName{{{*/ 123 123 void IntExternalResult::GetResultName(char** pname){ 124 124 EnumToStringx(pname,this->enum_type); 125 125 } 126 126 /*}}}*/ 127 /*FUNCTION IntExternalResult::GetStep{{{ 1*/127 /*FUNCTION IntExternalResult::GetStep{{{*/ 128 128 int IntExternalResult::GetStep(void){ 129 129 -
issm/trunk/src/c/objects/ExternalResults/IntExternalResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 28 28 int value; 29 29 int step; 30 double time;30 IssmDouble time; 31 31 32 32 33 /*IntExternalResult constructors, destructors: {{{ 1*/33 /*IntExternalResult constructors, destructors: {{{*/ 34 34 IntExternalResult(); 35 IntExternalResult(int id,int enum_type,int value,int step, double time);35 IntExternalResult(int id,int enum_type,int value,int step,IssmDouble time); 36 36 ~IntExternalResult(); 37 37 38 38 /*}}}*/ 39 /*Object virtual functions definitions:{{{ 1*/39 /*Object virtual functions definitions:{{{ */ 40 40 void Echo(); 41 41 void DeepEcho(); … … 45 45 Object* copy(); 46 46 /*}}}*/ 47 /*ExternalResult managemnet: {{{ 1*/47 /*ExternalResult managemnet: {{{*/ 48 48 int InstanceEnum(){return enum_type;} 49 49 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*PetscVecExternalResult constructors and destructor*/ 23 /*FUNCTION PetscVecExternalResult::PetscVecExternalResult(){{{ 1*/23 /*FUNCTION PetscVecExternalResult::PetscVecExternalResult(){{{*/ 24 24 PetscVecExternalResult::PetscVecExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION PetscVecExternalResult::PetscVecExternalResult(int enum_type,IssmPetscVec value){{{ 1*/29 PetscVecExternalResult::PetscVecExternalResult(int in_id, int in_enum_type,Vector* in_value,int in_step, double in_time){28 /*FUNCTION PetscVecExternalResult::PetscVecExternalResult(int enum_type,IssmPetscVec value){{{*/ 29 PetscVecExternalResult::PetscVecExternalResult(int in_id, int in_enum_type,Vector* in_value,int in_step, IssmDouble in_time){ 30 30 31 31 id=in_id; … … 44 44 } 45 45 /*}}}*/ 46 /*FUNCTION PetscVecExternalResult::~PetscVecExternalResult(){{{ 1*/46 /*FUNCTION PetscVecExternalResult::~PetscVecExternalResult(){{{*/ 47 47 PetscVecExternalResult::~PetscVecExternalResult(){ 48 48 VecFree(&value); … … 51 51 52 52 /*Object virtual functions definitions:*/ 53 /*FUNCTION PetscVecExternalResult::Echo {{{ 1*/53 /*FUNCTION PetscVecExternalResult::Echo {{{*/ 54 54 void PetscVecExternalResult::Echo(void){ 55 55 56 printf("PetscVecExternalResult:\n");57 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));56 _printLine_("PetscVecExternalResult:"); 57 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 58 58 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION PetscVecExternalResult::DeepEcho{{{ 1*/61 /*FUNCTION PetscVecExternalResult::DeepEcho{{{*/ 62 62 void PetscVecExternalResult::DeepEcho(void){ 63 63 64 64 int i; 65 printf("PetscVecExternalResult:\n");66 printf(" id: %i\n",this->id);67 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));68 printf(" step: %i\n",this->step);69 printf(" time: %g\n",this->time);65 _printLine_("PetscVecExternalResult:"); 66 _printLine_(" id: " << this->id); 67 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 68 _printLine_(" step: " << this->step); 69 _printLine_(" time: " << this->time); 70 70 VecView(value,PETSC_VIEWER_STDOUT_WORLD); 71 71 } 72 72 /*}}}*/ 73 /*FUNCTION PetscVecExternalResult::Id{{{ 1*/73 /*FUNCTION PetscVecExternalResult::Id{{{*/ 74 74 int PetscVecExternalResult::Id(void){ return -1; } 75 75 /*}}}*/ 76 /*FUNCTION PetscVecExternalResult::MyRank{{{ 1*/76 /*FUNCTION PetscVecExternalResult::MyRank{{{*/ 77 77 int PetscVecExternalResult::MyRank(void){ 78 78 extern int my_rank; … … 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION PetscVecExternalResult::ObjectEnum{{{ 1*/82 /*FUNCTION PetscVecExternalResult::ObjectEnum{{{*/ 83 83 int PetscVecExternalResult::ObjectEnum(void){ 84 84 … … 87 87 } 88 88 /*}}}*/ 89 /*FUNCTION PetscVecExternalResult::copy{{{ 1*/89 /*FUNCTION PetscVecExternalResult::copy{{{*/ 90 90 Object* PetscVecExternalResult::copy() { 91 91 … … 96 96 97 97 /*PetscVecExternalResult management: */ 98 /*FUNCTION PetscVecExternalResult::WriteData{{{ 1*/98 /*FUNCTION PetscVecExternalResult::WriteData{{{*/ 99 99 void PetscVecExternalResult::WriteData(FILE* fid,bool io_gather){ 100 100 … … 103 103 int size; 104 104 char *name = NULL; 105 double *serialvec = NULL;105 IssmPDouble *serialvec = NULL; 106 106 extern int my_rank; 107 IssmPDouble passiveDouble; 107 108 108 109 /*serialize: */ … … 118 119 fwrite(&length,sizeof(int),1,fid); 119 120 fwrite(name,length,1,fid); 120 x free((void**)&name);121 xDelete<char>(name); 121 122 122 123 /*Now write time and step: */ 123 fwrite(&time,sizeof(double),1,fid); 124 passiveDouble=reCast<IssmPDouble>(time); 125 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 124 126 fwrite(&step,sizeof(int),1,fid); 125 127 126 /*writing a double, type is 1, size is 1: */128 /*writing a IssmDouble, type is 1, size is 1: */ 127 129 type=1; 128 130 129 131 fwrite(&type,sizeof(int),1,fid); 130 132 fwrite(&size,sizeof(int),1,fid); 131 fwrite(serialvec,size*sizeof( double),1,fid);133 fwrite(serialvec,size*sizeof(IssmPDouble),1,fid); 132 134 133 135 /*Free ressources:*/ 134 x free((void**)&serialvec);136 xDelete<IssmPDouble>(serialvec); 135 137 } 136 /*}}} 1*/137 /*FUNCTION PetscVecExternalResult::GetResultName{{{ 1*/138 /*}}}*/ 139 /*FUNCTION PetscVecExternalResult::GetResultName{{{*/ 138 140 void PetscVecExternalResult::GetResultName(char**pname){ 139 141 EnumToStringx(pname,this->enum_type); 140 142 } 141 143 /*}}}*/ 142 /*FUNCTION PetscVecExternalResult::GetStep{{{ 1*/144 /*FUNCTION PetscVecExternalResult::GetStep{{{*/ 143 145 int PetscVecExternalResult::GetStep(void){ 144 146 -
issm/trunk/src/c/objects/ExternalResults/PetscVecExternalResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 30 30 Vector* value; 31 31 int step; 32 double time;32 IssmDouble time; 33 33 34 34 public: 35 /*PetscVecExternalResult constructors, destructors: {{{ 1*/35 /*PetscVecExternalResult constructors, destructors: {{{*/ 36 36 PetscVecExternalResult(); 37 PetscVecExternalResult(int id,int enum_type,Vector* value, int step, double time);37 PetscVecExternalResult(int id,int enum_type,Vector* value, int step, IssmDouble time); 38 38 ~PetscVecExternalResult(); 39 39 /*}}}*/ 40 /*Object virtual functions definitions:{{{ 1*/40 /*Object virtual functions definitions:{{{ */ 41 41 void Echo(); 42 42 void DeepEcho(); … … 46 46 Object* copy(); 47 47 /*}}}*/ 48 /*ExternalResult management: {{{ 1*/48 /*ExternalResult management: {{{*/ 49 49 int InstanceEnum(){return enum_type;} 50 50 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/ExternalResults/StringExternalResult.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*StringExternalResult constructors and destructor*/ 23 /*FUNCTION StringExternalResult::StringExternalResult(){{{ 1*/23 /*FUNCTION StringExternalResult::StringExternalResult(){{{*/ 24 24 StringExternalResult::StringExternalResult(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION StringExternalResult::StringExternalResult(int enum_type,IssmString value){{{ 1*/29 StringExternalResult::StringExternalResult(int in_id, int in_enum_type,char* in_value,int in_step, double in_time){28 /*FUNCTION StringExternalResult::StringExternalResult(int enum_type,IssmString value){{{*/ 29 StringExternalResult::StringExternalResult(int in_id, int in_enum_type,char* in_value,int in_step, IssmDouble in_time){ 30 30 31 31 id=in_id; 32 32 enum_type=in_enum_type; 33 value=(char*)xmalloc((strlen(in_value)+1)*sizeof(char)); 34 memcpy(value,in_value,(strlen(in_value)+1)*sizeof(char)); 35 33 value=xNew<char>(strlen(in_value)+1); 34 xMemCpy<char>(value,in_value,(strlen(in_value)+1)); 36 35 step=in_step; 37 36 time=in_time; … … 39 38 } 40 39 /*}}}*/ 41 /*FUNCTION StringExternalResult::~StringExternalResult(){{{ 1*/40 /*FUNCTION StringExternalResult::~StringExternalResult(){{{*/ 42 41 StringExternalResult::~StringExternalResult(){ 43 x free((void**)&value);42 xDelete<char>(value); 44 43 } 45 44 /*}}}*/ 46 45 47 46 /*Object virtual functions definitions:*/ 48 /*FUNCTION StringExternalResult::Echo {{{ 1*/47 /*FUNCTION StringExternalResult::Echo {{{*/ 49 48 void StringExternalResult::Echo(void){ 50 49 this->DeepEcho(); 51 50 } 52 51 /*}}}*/ 53 /*FUNCTION StringExternalResult::DeepEcho{{{ 1*/52 /*FUNCTION StringExternalResult::DeepEcho{{{*/ 54 53 void StringExternalResult::DeepEcho(void){ 55 54 56 printf("StringExternalResult:\n");57 printf(" id: %i\n",this->id);58 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));59 printf(" value: %s\n",this->value);60 printf(" step: %i\n",this->step);61 printf(" time: %g\n",this->time);55 _printLine_("StringExternalResult:"); 56 _printLine_(" id: " << this->id); 57 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 58 _printLine_(" value: " << this->value); 59 _printLine_(" step: " << this->step); 60 _printLine_(" time: " << this->time); 62 61 } 63 62 /*}}}*/ 64 /*FUNCTION StringExternalResult::Id{{{ 1*/63 /*FUNCTION StringExternalResult::Id{{{*/ 65 64 int StringExternalResult::Id(void){ return -1; } 66 65 /*}}}*/ 67 /*FUNCTION StringExternalResult::MyRank{{{ 1*/66 /*FUNCTION StringExternalResult::MyRank{{{*/ 68 67 int StringExternalResult::MyRank(void){ 69 68 extern int my_rank; … … 71 70 } 72 71 /*}}}*/ 73 /*FUNCTION StringExternalResult::ObjectEnum{{{ 1*/72 /*FUNCTION StringExternalResult::ObjectEnum{{{*/ 74 73 int StringExternalResult::ObjectEnum(void){ 75 74 … … 78 77 } 79 78 /*}}}*/ 80 /*FUNCTION StringExternalResult::copy{{{ 1*/79 /*FUNCTION StringExternalResult::copy{{{*/ 81 80 Object* StringExternalResult::copy() { 82 81 … … 87 86 88 87 /*StringExternalResult management: */ 89 /*FUNCTION StringExternalResult::WriteData{{{ 1*/88 /*FUNCTION StringExternalResult::WriteData{{{*/ 90 89 void StringExternalResult::WriteData(FILE* fid,bool io_gather){ 91 90 … … 94 93 char *name = NULL; 95 94 extern int my_rank; 95 IssmPDouble passiveDouble; 96 96 97 97 /*return if now on cpu 0: */ … … 103 103 fwrite(&length,sizeof(int),1,fid); 104 104 fwrite(name,length,1,fid); 105 x free((void**)&name);105 xDelete<char>(name); 106 106 107 107 /*Now write time and step: */ 108 fwrite(&time,sizeof(double),1,fid); 108 passiveDouble=reCast<IssmPDouble>(time); 109 fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid); 109 110 fwrite(&step,sizeof(int),1,fid); 110 111 … … 118 119 119 120 } 120 /*}}} 1*/121 /*FUNCTION StringExternalResult::GetResultName{{{ 1*/121 /*}}}*/ 122 /*FUNCTION StringExternalResult::GetResultName{{{*/ 122 123 void StringExternalResult::GetResultName(char**pname){ 123 124 EnumToStringx(pname,this->enum_type); 124 125 } 125 126 /*}}}*/ 126 /*FUNCTION StringExternalResult::GetStep{{{ 1*/127 /*FUNCTION StringExternalResult::GetStep{{{*/ 127 128 int StringExternalResult::GetStep(void){ 128 129 -
issm/trunk/src/c/objects/ExternalResults/StringExternalResult.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 30 30 char* value; 31 31 int step; 32 double time;32 IssmDouble time; 33 33 34 34 public: 35 /*StringExternalResult constructors, destructors: {{{ 1*/35 /*StringExternalResult constructors, destructors: {{{*/ 36 36 StringExternalResult(); 37 StringExternalResult(int id,int enum_type,char* value,int step, double time);37 StringExternalResult(int id,int enum_type,char* value,int step, IssmDouble time); 38 38 ~StringExternalResult(); 39 39 /*}}}*/ 40 /*Object virtual functions definitions:{{{ 1*/40 /*Object virtual functions definitions:{{{ */ 41 41 void Echo(); 42 42 void DeepEcho(); … … 46 46 Object* copy(); 47 47 /*}}}*/ 48 /*ExternalResult management: {{{ 1*/48 /*ExternalResult management: {{{*/ 49 49 int InstanceEnum(){return enum_type;} 50 50 void WriteData(FILE* fid,bool io_gather); -
issm/trunk/src/c/objects/FemModel.cpp
r12330 r12706 20 20 21 21 /*Object constructors and destructor*/ 22 /*FUNCTION FemModel::constructor {{{ 1*/22 /*FUNCTION FemModel::constructor {{{*/ 23 23 FemModel::FemModel(char* inputfilename, char* outputfilename, const int in_solution_type,const int* analyses,const int nummodels){ 24 24 25 25 /*intermediary*/ 26 int i;27 int analysis_type;28 FILE * IOMODEL;29 extern int my_rank;26 int i; 27 int analysis_type; 28 FILE *IOMODEL = NULL; 29 extern int my_rank; 30 30 31 31 /*Open input file on cpu 0: */ 32 if(my_rank==0) IOMODEL = pfopen(inputfilename ,"rb");32 if(my_rank==0) IOMODEL = pfopen(inputfilename ,"rb"); 33 33 34 34 /*Initialize internal data: */ … … 39 39 40 40 /*Dynamically allocate whatever is a list of length nummodels: */ 41 analysis_type_list= (int*)xmalloc(nummodels*sizeof(int));41 analysis_type_list=xNew<int>(nummodels); 42 42 43 43 /*Initialize: */ … … 50 50 for(i=0;i<nummodels;i++){ 51 51 52 _printf_(VerboseMProcessor()," Processing finite element model of analysis %s:\n",EnumToStringx(analysis_type_list[i]));52 if(VerboseMProcessor()) _pprintLine_(" Processing finite element model of analysis " << EnumToStringx(analysis_type_list[i]) << ":"); 53 53 analysis_type=analysis_type_list[i]; 54 54 this->SetCurrentConfiguration(analysis_type); 55 55 56 56 if(i==0){ 57 _printf_(VerboseMProcessor()," creating vertex degrees of freedom\n");57 if(VerboseMProcessor()) _pprintLine_(" creating vertex degrees of freedom"); 58 58 VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices 59 59 } 60 60 61 _printf_(VerboseMProcessor()," resolving node constraints\n");61 if(VerboseMProcessor()) _pprintLine_(" resolving node constraints"); 62 62 SpcNodesx(nodes,constraints,parameters,analysis_type); 63 63 64 _printf_(VerboseMProcessor()," creating nodal degrees of freedom\n");64 if(VerboseMProcessor()) _pprintLine_(" creating nodal degrees of freedom"); 65 65 NodesDofx(nodes,parameters,analysis_type); 66 66 67 _printf_(VerboseMProcessor()," configuring element and loads\n");67 if(VerboseMProcessor()) _pprintLine_(" configuring element and loads"); 68 68 ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters); 69 69 } … … 77 77 } 78 78 79 /*}}} 1*/80 /*FUNCTION FemModel::destructor {{{ 1*/79 /*}}}*/ 80 /*FUNCTION FemModel::destructor {{{*/ 81 81 FemModel::~FemModel(){ 82 82 … … 85 85 86 86 /*Delete all the datasets: */ 87 x free((void**)&analysis_type_list);87 xDelete<int>(analysis_type_list); 88 88 delete elements; 89 89 delete nodes; … … 96 96 97 97 } 98 /*}}} 1*/98 /*}}}*/ 99 99 100 100 /*Object management*/ 101 /*FUNCTION FemModel::Echo {{{ 1*/101 /*FUNCTION FemModel::Echo {{{*/ 102 102 void FemModel::Echo(void){ 103 103 104 printf("FemModel echo: \n");105 printf(" number of fem models: %i\n",nummodels);106 printf(" analysis_type_list: \n");107 for(int i=0;i<nummodels;i++) printf(" %i: %s\n",i,EnumToStringx(analysis_type_list[i]));108 printf(" current analysis_type: \n");109 printf(" %i: %s\n",analysis_counter,EnumToStringx(analysis_type_list[analysis_counter]));104 _printLine_("FemModel echo: "); 105 _printLine_(" number of fem models: " << nummodels); 106 _printLine_(" analysis_type_list: "); 107 for(int i=0;i<nummodels;i++)_printLine_(" " << i << ": " << EnumToStringx(analysis_type_list[i])); 108 _printLine_(" current analysis_type: "); 109 _printLine_(" " << analysis_counter << ": " << EnumToStringx(analysis_type_list[analysis_counter])); 110 110 111 111 } … … 113 113 114 114 /*Numerics: */ 115 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{ 1*/115 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{*/ 116 116 void FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){ 117 117 … … 129 129 } 130 130 if(found!=-1) analysis_counter=found; 131 else _error _("Could not find alias for analysis_type %s in list of FemModel analyses",EnumToStringx(configuration_type));131 else _error2_("Could not find alias for analysis_type " << EnumToStringx(configuration_type) << " in list of FemModel analyses"); 132 132 133 133 /*Now, plug analysis_counter and analysis_type inside the parameters: */ … … 145 145 if(this->parameters->Exist(PetscOptionsStringsEnum)){ 146 146 PetscOptionsFromAnalysis(this->parameters,analysis_type); 147 _printf_(VerboseSolver()," petsc Options set for analysis type: %s\n",EnumToStringx(analysis_type));147 if(VerboseSolver()) _pprintLine_(" petsc Options set for analysis type: " << EnumToStringx(analysis_type)); 148 148 } 149 149 #endif 150 150 151 151 } 152 /*}}} 1*/153 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type){{{ 1*/152 /*}}}*/ 153 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type){{{*/ 154 154 void FemModel::SetCurrentConfiguration(int configuration_type){ 155 155 … … 157 157 this->SetCurrentConfiguration(configuration_type,configuration_type); 158 158 } 159 /*}}} 1*/159 /*}}}*/ -
issm/trunk/src/c/objects/FemModel.h
r8800 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Object.h" 11 11 #include "../toolkits/toolkits.h" -
issm/trunk/src/c/objects/Gauss/GaussPenta.cpp
r8416 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #include "./../objects.h" 7 7 /*}}}*/ 8 8 9 9 /*GaussPenta constructors and destructors:*/ 10 /*FUNCTION GaussPenta::GaussPenta() {{{ 1*/10 /*FUNCTION GaussPenta::GaussPenta() {{{*/ 11 11 GaussPenta::GaussPenta(){ 12 12 … … 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{ 1*/28 /*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{*/ 29 29 GaussPenta::GaussPenta(int order_horiz,int order_vert){ 30 30 … … 47 47 /*Allocate GaussPenta fields*/ 48 48 numgauss=numgauss_horiz*numgauss_vert; 49 coords1= (double*)xmalloc(numgauss*sizeof(double));50 coords2= (double*)xmalloc(numgauss*sizeof(double));51 coords3= (double*)xmalloc(numgauss*sizeof(double));52 coords4= (double*)xmalloc(numgauss*sizeof(double));53 weights= (double*)xmalloc(numgauss*sizeof(double));49 coords1=xNew<double>(numgauss); 50 coords2=xNew<double>(numgauss); 51 coords3=xNew<double>(numgauss); 52 coords4=xNew<double>(numgauss); 53 weights=xNew<double>(numgauss); 54 54 55 55 /*Combine Horizontal and vertical points*/ … … 72 72 73 73 /*Clean up*/ 74 x free((void**)&coords1_horiz);75 x free((void**)&coords2_horiz);76 x free((void**)&coords3_horiz);77 x free((void**)&coords_vert);78 x free((void**)&weights_horiz);79 x free((void**)&weights_vert);80 } 81 /*}}}*/ 82 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int order){{{ 1*/74 xDelete<double>(coords1_horiz); 75 xDelete<double>(coords2_horiz); 76 xDelete<double>(coords3_horiz); 77 xDelete<double>(coords_vert); 78 xDelete<double>(weights_horiz); 79 xDelete<double>(weights_vert); 80 } 81 /*}}}*/ 82 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int order){{{*/ 83 83 GaussPenta::GaussPenta(int index1, int index2,int order){ 84 84 … … 93 93 94 94 /*Allocate GaussPenta fields*/ 95 coords1= (double*)xmalloc(numgauss*sizeof(double));96 coords2= (double*)xmalloc(numgauss*sizeof(double));97 coords3= (double*)xmalloc(numgauss*sizeof(double));98 coords4= (double*)xmalloc(numgauss*sizeof(double));99 weights= (double*)xmalloc(numgauss*sizeof(double));95 coords1=xNew<double>(numgauss); 96 coords2=xNew<double>(numgauss); 97 coords3=xNew<double>(numgauss); 98 coords4=xNew<double>(numgauss); 99 weights=xNew<double>(numgauss); 100 100 101 101 if(index1==0 && index2==3){ … … 121 121 } 122 122 else{ 123 _error _("Penta not supported yet");123 _error2_("Penta not supported yet"); 124 124 } 125 125 … … 132 132 133 133 /*clean up*/ 134 x free((void**)&seg_coords);135 x free((void**)&seg_weights);136 137 } 138 /*}}}*/ 139 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int order){{{ 1*/134 xDelete<double>(seg_coords); 135 xDelete<double>(seg_weights); 136 137 } 138 /*}}}*/ 139 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int order){{{*/ 140 140 GaussPenta::GaussPenta(int index1, int index2, int index3, int order){ 141 141 … … 147 147 148 148 /*compute z coordinate*/ 149 coords4= (double*)xmalloc(numgauss*sizeof(double));149 coords4=xNew<double>(numgauss); 150 150 for(int i=0;i<numgauss;i++) coords4[i]=-1.0; 151 151 } … … 157 157 158 158 /*compute z coordinate*/ 159 coords4= (double*)xmalloc(numgauss*sizeof(double));159 coords4=xNew<double>(numgauss); 160 160 for(int i=0;i<numgauss;i++) coords4[i]=1.0; 161 161 } 162 162 else{ 163 _error _("Tria not supported yet");164 } 165 166 } 167 /*}}}*/ 168 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){{{ 1*/163 _error2_("Tria not supported yet"); 164 } 165 166 } 167 /*}}}*/ 168 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){{{*/ 169 169 GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){ 170 170 … … 182 182 /*Allocate GaussPenta fields*/ 183 183 numgauss=order_horiz*order_vert; 184 coords1= (double*)xmalloc(numgauss*sizeof(double));185 coords2= (double*)xmalloc(numgauss*sizeof(double));186 coords3= (double*)xmalloc(numgauss*sizeof(double));187 coords4= (double*)xmalloc(numgauss*sizeof(double));188 weights= (double*)xmalloc(numgauss*sizeof(double));184 coords1=xNew<double>(numgauss); 185 coords2=xNew<double>(numgauss); 186 coords3=xNew<double>(numgauss); 187 coords4=xNew<double>(numgauss); 188 weights=xNew<double>(numgauss); 189 189 190 190 /*Quads: get the gauss points using the product of two line rules */ … … 223 223 } 224 224 else{ 225 _error _("Tria not supported yet (user provided indices %i %i %i %i)",index1,index2,index3,index4);225 _error2_("Tria not supported yet (user provided indices " << index1 << " " << index2 << " " << index3 << " " << index4 << ")"); 226 226 } 227 227 228 228 /*clean-up*/ 229 x free((void**)&seg_horiz_coords);230 x free((void**)&seg_horiz_weights);231 x free((void**)&seg_vert_coords);232 x free((void**)&seg_vert_weights);233 } 234 /*}}}*/ 235 /*FUNCTION GaussPenta::~GaussPenta(){{{ 1*/229 xDelete<double>(seg_horiz_coords); 230 xDelete<double>(seg_horiz_weights); 231 xDelete<double>(seg_vert_coords); 232 xDelete<double>(seg_vert_weights); 233 } 234 /*}}}*/ 235 /*FUNCTION GaussPenta::~GaussPenta(){{{*/ 236 236 GaussPenta::~GaussPenta(){ 237 x free((void**)&weights);238 x free((void**)&coords1);239 x free((void**)&coords2);240 x free((void**)&coords3);241 x free((void**)&coords4);237 xDelete<double>(weights); 238 xDelete<double>(coords1); 239 xDelete<double>(coords2); 240 xDelete<double>(coords3); 241 xDelete<double>(coords4); 242 242 } 243 243 /*}}}*/ 244 244 245 245 /*Methods*/ 246 /*FUNCTION GaussPenta::Echo{{{ 1*/246 /*FUNCTION GaussPenta::Echo{{{*/ 247 247 void GaussPenta::Echo(void){ 248 248 249 printf("GaussPenta:\n");250 printf(" numgauss: %i\n",numgauss);249 _printLine_("GaussPenta:"); 250 _printLine_(" numgauss: " << numgauss); 251 251 252 252 if (weights){ 253 printf(" weights = [");254 for(int i=0;i<numgauss;i++) printf(" %g\n",weights[i]);255 printf("]\n");256 } 257 else printf("weights = NULL\n");253 _printString_(" weights = ["); 254 for(int i=0;i<numgauss;i++) _printLine_(" " << weights[i]); 255 _printLine_("]"); 256 } 257 else _printLine_("weights = NULL"); 258 258 if (coords1){ 259 printf(" coords1 = [");260 for(int i=0;i<numgauss;i++) printf(" %g\n",coords1[i]);261 printf("]\n");262 } 263 else printf("coords1 = NULL\n");259 _printString_(" coords1 = ["); 260 for(int i=0;i<numgauss;i++) _printLine_(" " << coords1[i]); 261 _printLine_("]"); 262 } 263 else _printLine_("coords1 = NULL"); 264 264 if (coords2){ 265 printf(" coords2 = [");266 for(int i=0;i<numgauss;i++) printf(" %g\n",coords2[i]);267 printf("]\n");268 } 269 else printf("coords2 = NULL\n");265 _printString_(" coords2 = ["); 266 for(int i=0;i<numgauss;i++) _printLine_(" " << coords2[i]); 267 _printLine_("]"); 268 } 269 else _printLine_("coords2 = NULL"); 270 270 if (coords3){ 271 printf(" coords3 = [");272 for(int i=0;i<numgauss;i++) printf(" %g\n",coords3[i]);273 printf("]\n");274 } 275 else printf("coords3 = NULL\n");271 _printString_(" coords3 = ["); 272 for(int i=0;i<numgauss;i++) _printLine_(" " << coords3[i]); 273 _printLine_("]"); 274 } 275 else _printLine_("coords3 = NULL"); 276 276 if (coords4){ 277 printf(" coords4 = [");278 for(int i=0;i<numgauss;i++) printf(" %g\n",coords4[i]);279 printf("]\n");280 } 281 else printf("coords4 = NULL\n");282 283 printf(" weight = %g\n",weight);284 printf(" coord1 = %g\n",coord1);285 printf(" coord2 = %g\n",coord2);286 printf(" coord3 = %g\n",coord3);287 printf(" coord4 = %g\n",coord4);288 289 } 290 /*}}}*/ 291 /*FUNCTION GaussPenta::GaussCenter{{{ 1*/277 _printString_(" coords4 = ["); 278 for(int i=0;i<numgauss;i++) _printLine_(" " << coords4[i]); 279 _printLine_("]"); 280 } 281 else _printLine_("coords4 = NULL"); 282 283 _printLine_(" weight = " << weight); 284 _printLine_(" coord1 = " << coord1); 285 _printLine_(" coord2 = " << coord2); 286 _printLine_(" coord3 = " << coord3); 287 _printLine_(" coord4 = " << coord4); 288 289 } 290 /*}}}*/ 291 /*FUNCTION GaussPenta::GaussCenter{{{*/ 292 292 void GaussPenta::GaussCenter(void){ 293 293 … … 300 300 } 301 301 /*}}}*/ 302 /*FUNCTION GaussPenta::GaussPoint{{{ 1*/302 /*FUNCTION GaussPenta::GaussPoint{{{*/ 303 303 void GaussPenta::GaussPoint(int ig){ 304 304 … … 315 315 } 316 316 /*}}}*/ 317 /*FUNCTION GaussPenta::GaussVertex{{{ 1*/317 /*FUNCTION GaussPenta::GaussVertex{{{*/ 318 318 void GaussPenta::GaussVertex(int iv){ 319 319 … … 342 342 break; 343 343 default: 344 _error _("vertex index should be in [0 5]");345 346 } 347 348 } 349 /*}}}*/ 350 /*FUNCTION GaussPenta::GaussFaceTria{{{ 1*/344 _error2_("vertex index should be in [0 5]"); 345 346 } 347 348 } 349 /*}}}*/ 350 /*FUNCTION GaussPenta::GaussFaceTria{{{*/ 351 351 void GaussPenta::GaussFaceTria(int index1, int index2, int index3, int order){ 352 352 … … 357 357 if(index1==0 && index2==1 && index3==2){ 358 358 GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order); 359 coords4= (double*)xmalloc(numgauss*sizeof(double));359 coords4=xNew<double>(numgauss); 360 360 for(int i=0;i<numgauss;i++) coords4[i]=-1.0; 361 361 } 362 362 else{ 363 _error _("Tria not supported yet");364 } 365 366 } 367 /*}}}*/ 368 /*FUNCTION GaussPenta::begin{{{ 1*/363 _error2_("Tria not supported yet"); 364 } 365 366 } 367 /*}}}*/ 368 /*FUNCTION GaussPenta::begin{{{*/ 369 369 int GaussPenta::begin(void){ 370 370 … … 381 381 } 382 382 /*}}}*/ 383 /*FUNCTION GaussPenta::end{{{ 1*/383 /*FUNCTION GaussPenta::end{{{*/ 384 384 int GaussPenta::end(void){ 385 385 … … 396 396 } 397 397 /*}}}*/ 398 /*FUNCTION GaussPenta::SynchronizeGaussTria{{{ 1*/398 /*FUNCTION GaussPenta::SynchronizeGaussTria{{{*/ 399 399 void GaussPenta::SynchronizeGaussTria(GaussTria* gauss_tria){ 400 400 -
issm/trunk/src/c/objects/Gauss/GaussPenta.h
r5797 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./../../shared/shared.h" 11 11 class GaussTria; -
issm/trunk/src/c/objects/Gauss/GaussTria.cpp
r6412 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #include "./../objects.h" 7 7 /*}}}*/ 8 8 9 9 /*GaussTria constructors and destructors:*/ 10 /*FUNCTION GaussTria::GaussTria() {{{ 1*/10 /*FUNCTION GaussTria::GaussTria() {{{*/ 11 11 GaussTria::GaussTria(){ 12 12 … … 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION GaussTria::GaussTria(int order) {{{ 1*/26 /*FUNCTION GaussTria::GaussTria(int order) {{{*/ 27 27 GaussTria::GaussTria(int order){ 28 28 … … 38 38 } 39 39 /*}}}*/ 40 /*FUNCTION GaussTria::GaussTria(int index1,int index2,int order) {{{ 1*/40 /*FUNCTION GaussTria::GaussTria(int index1,int index2,int order) {{{*/ 41 41 GaussTria::GaussTria(int index1,int index2,int order){ 42 42 43 43 /*Intermediaties*/ 44 double *seg_coords = NULL;45 double *seg_weights = NULL;44 IssmPDouble *seg_coords = NULL; 45 IssmPDouble *seg_weights = NULL; 46 46 int i,index3; 47 47 … … 51 51 52 52 /*Allocate GaussTria fields*/ 53 coords1= (double*)xmalloc(numgauss*sizeof(double));54 coords2= (double*)xmalloc(numgauss*sizeof(double));55 coords3= (double*)xmalloc(numgauss*sizeof(double));56 weights= (double*)xmalloc(numgauss*sizeof(double));53 coords1=xNew<IssmPDouble>(numgauss); 54 coords2=xNew<IssmPDouble>(numgauss); 55 coords3=xNew<IssmPDouble>(numgauss); 56 weights=xNew<IssmPDouble>(numgauss); 57 57 58 58 /*Reverse index1 and 2 if necessary*/ … … 71 71 else if (index1==0 && index2==2){ 72 72 for(i=0;i<numgauss;i++) coords1[i]= 0.5*(1-seg_coords[i]); 73 for(i=0;i<numgauss;i++) coords2[i]= 0;73 for(i=0;i<numgauss;i++) coords2[i]= 0 ; 74 74 for(i=0;i<numgauss;i++) coords3[i]=1-0.5*(1.-seg_coords[i]); 75 75 for(i=0;i<numgauss;i++) weights[i]=seg_weights[i]; … … 82 82 } 83 83 else 84 _error _("The 2 indices provided are not supported yet (user provided %i and %i)",index1,index2);84 _error2_("The 2 indices provided are not supported yet (user provided " << index1 << " and " << index2 << ")"); 85 85 86 86 /*Initialize static fields as undefined*/ … … 91 91 92 92 /*clean up*/ 93 x free((void**)&seg_coords);94 x free((void**)&seg_weights);95 } 96 /*}}}*/ 97 /*FUNCTION GaussTria::~GaussTria(){{{ 1*/93 xDelete<double>(seg_coords); 94 xDelete<double>(seg_weights); 95 } 96 /*}}}*/ 97 /*FUNCTION GaussTria::~GaussTria(){{{*/ 98 98 GaussTria::~GaussTria(){ 99 x free((void**)&weights);100 x free((void**)&coords1);101 x free((void**)&coords2);102 x free((void**)&coords3);99 xDelete<IssmPDouble>(weights); 100 xDelete<IssmPDouble>(coords1); 101 xDelete<IssmPDouble>(coords2); 102 xDelete<IssmPDouble>(coords3); 103 103 } 104 104 /*}}}*/ 105 105 106 106 /*Methods*/ 107 /*FUNCTION GaussTria::Echo{{{ 1*/107 /*FUNCTION GaussTria::Echo{{{*/ 108 108 void GaussTria::Echo(void){ 109 109 110 printf("GaussTria:\n");111 printf(" numgauss: %i\n",numgauss);110 _printLine_("GaussTria:"); 111 _printLine_(" numgauss: " << numgauss); 112 112 113 113 if (weights){ 114 printf(" weights = [");115 for(int i=0;i<numgauss;i++) printf(" %g\n",weights[i]);116 printf("]\n");117 } 118 else printf("weights = NULL\n");114 _printString_(" weights = ["); 115 for(int i=0;i<numgauss;i++) _printLine_(" " << weights[i]); 116 _printLine_("]"); 117 } 118 else _printLine_("weights = NULL"); 119 119 if (coords1){ 120 printf(" coords1 = [");121 for(int i=0;i<numgauss;i++) printf(" %g\n",coords1[i]);122 printf("]\n");123 } 124 else printf("coords1 = NULL\n");120 _printString_(" coords1 = ["); 121 for(int i=0;i<numgauss;i++) _printLine_(" " << coords1[i]); 122 _printLine_("]"); 123 } 124 else _printLine_("coords1 = NULL"); 125 125 if (coords2){ 126 printf(" coords2 = [");127 for(int i=0;i<numgauss;i++) printf(" %g\n",coords2[i]);128 printf("]\n");129 } 130 else printf("coords2 = NULL\n");126 _printString_(" coords2 = ["); 127 for(int i=0;i<numgauss;i++) _printLine_(" " << coords2[i]); 128 _printLine_("]"); 129 } 130 else _printLine_("coords2 = NULL"); 131 131 if (coords3){ 132 printf(" coords3 = [");133 for(int i=0;i<numgauss;i++) printf(" %g\n",coords3[i]);134 printf("]\n");135 } 136 else printf("coords3 = NULL\n");137 138 printf(" weight = %g\n",weight);139 printf(" coord1 = %g\n",coord1);140 printf(" coord2 = %g\n",coord2);141 printf(" coord3 = %g\n",coord3);142 143 } 144 /*}}}*/ 145 /*FUNCTION GaussTria::GaussCenter{{{ 1*/132 _printString_(" coords3 = ["); 133 for(int i=0;i<numgauss;i++) _printLine_(" " << coords3[i]); 134 _printLine_("]"); 135 } 136 else _printLine_("coords3 = NULL"); 137 138 _printLine_(" weight = " << weight); 139 _printLine_(" coord1 = " << coord1); 140 _printLine_(" coord2 = " << coord2); 141 _printLine_(" coord3 = " << coord3); 142 143 } 144 /*}}}*/ 145 /*FUNCTION GaussTria::GaussCenter{{{*/ 146 146 void GaussTria::GaussCenter(void){ 147 147 … … 153 153 } 154 154 /*}}}*/ 155 /*FUNCTION GaussTria::GaussEdgeCenter{{{ 1*/155 /*FUNCTION GaussTria::GaussEdgeCenter{{{*/ 156 156 void GaussTria::GaussEdgeCenter(int index1,int index2){ 157 157 … … 180 180 } 181 181 else 182 _error _("The 2 indices provided are not supported yet (user provided %i and %i)",index1,index2);183 184 } 185 /*}}}*/ 186 /*FUNCTION GaussTria::GaussPoint{{{ 1*/182 _error2_("The 2 indices provided are not supported yet (user provided " << index1 << " and " << index2 << ")"); 183 184 } 185 /*}}}*/ 186 /*FUNCTION GaussTria::GaussPoint{{{*/ 187 187 void GaussTria::GaussPoint(int ig){ 188 188 … … 198 198 } 199 199 /*}}}*/ 200 /*FUNCTION GaussTria::GaussFromCoords{{{ 1*/201 void GaussTria::GaussFromCoords( double x,double y,double* xyz_list){200 /*FUNCTION GaussTria::GaussFromCoords{{{*/ 201 void GaussTria::GaussFromCoords(IssmPDouble x,IssmPDouble y,IssmPDouble* xyz_list){ 202 202 203 203 /*Intermediaries*/ 204 double area = 0;205 double x1,y1,x2,y2,x3,y3;204 IssmPDouble area = 0; 205 IssmPDouble x1,y1,x2,y2,x3,y3; 206 206 207 207 /*in debugging mode: check that the default constructor has been called*/ … … 225 225 } 226 226 /*}}}*/ 227 /*FUNCTION GaussTria::GaussVertex{{{ 1*/227 /*FUNCTION GaussTria::GaussVertex{{{*/ 228 228 void GaussTria::GaussVertex(int iv){ 229 229 … … 243 243 break; 244 244 default: 245 _error _("vertex index should be in [0 2]");246 247 } 248 249 } 250 /*}}}*/ 251 /*FUNCTION GaussTria::begin{{{ 1*/245 _error2_("vertex index should be in [0 2]"); 246 247 } 248 249 } 250 /*}}}*/ 251 /*FUNCTION GaussTria::begin{{{*/ 252 252 int GaussTria::begin(void){ 253 253 … … 263 263 } 264 264 /*}}}*/ 265 /*FUNCTION GaussTria::end{{{ 1*/265 /*FUNCTION GaussTria::end{{{*/ 266 266 int GaussTria::end(void){ 267 267 -
issm/trunk/src/c/objects/Gauss/GaussTria.h
r5739 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./../../shared/shared.h" 11 11 /*}}}*/ … … 15 15 private: 16 16 int numgauss; 17 double* weights;18 double* coords1;19 double* coords2;20 double* coords3;17 IssmPDouble* weights; 18 IssmPDouble* coords1; 19 IssmPDouble* coords2; 20 IssmPDouble* coords3; 21 21 22 22 public: 23 double weight;24 double coord1;25 double coord2;26 double coord3;23 IssmPDouble weight; 24 IssmPDouble coord1; 25 IssmPDouble coord2; 26 IssmPDouble coord3; 27 27 28 28 public: … … 38 38 int end(void); 39 39 void Echo(void); 40 void GaussFromCoords( double x1,double y1,double* xyz_list);40 void GaussFromCoords(IssmPDouble x1,IssmPDouble y1,IssmPDouble* xyz_list); 41 41 void GaussPoint(int ig); 42 42 void GaussVertex(int iv); -
issm/trunk/src/c/objects/Hook.cpp
r12330 r12706 20 20 21 21 /*Constructor/Destructors*/ 22 /*FUNCTION Hook::Hook(){{{ 1*/22 /*FUNCTION Hook::Hook(){{{*/ 23 23 Hook::Hook(){ 24 24 this->num=0; … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION Hook::Hook(int* ids, int num){{{ 1*/31 /*FUNCTION Hook::Hook(int* ids, int num){{{*/ 32 32 Hook::Hook(int* in_ids, int in_num){ 33 33 … … 47 47 else{ 48 48 /*Allocate: */ 49 this->objects= (Object**)xmalloc(this->num*sizeof(Object*));50 this->ids= (int*)xmalloc(this->num*sizeof(int));51 this->offsets= (int*)xmalloc(this->num*sizeof(int));49 this->objects=xNew<Object*>(this->num); 50 this->ids=xNew<int>(this->num); 51 this->offsets=xNew<int>(this->num); 52 52 53 53 /*Copy ids: */ … … 60 60 } 61 61 /*}}}*/ 62 /*FUNCTION Hook::~Hook(){{{ 1*/62 /*FUNCTION Hook::~Hook(){{{*/ 63 63 Hook::~Hook(){ 64 64 /*deallocate: */ 65 x free((void**)&this->objects);66 x free((void**)&this->ids);67 x free((void**)&this->offsets);65 xDelete<Object*>(this->objects); 66 xDelete<int>(this->ids); 67 xDelete<int>(this->offsets); 68 68 return; 69 69 } … … 71 71 72 72 /*Some of the Object functionality: */ 73 /*FUNCTION Hook::Echo{{{ 1*/73 /*FUNCTION Hook::Echo{{{*/ 74 74 void Hook::Echo(void){ 75 75 76 76 int i; 77 77 if (num){ 78 printf(" Hook: \n");79 printf(" num=%i\n",this->num);80 printf(" ids: ");81 for (i=0;i<this->num;i++) printf("%i ",this->ids[i]);82 printf("\n");83 printf(" offsets: ");84 for (i=0;i<this->num;i++) printf("%i ",this->offsets[i]);85 printf("\n");78 _printLine_(" Hook: "); 79 _printLine_(" num=" << this->num); 80 _printString_(" ids: "); 81 for (i=0;i<this->num;i++) _printString_(this->ids[i] << " "); 82 _printLine_(""); 83 _printString_(" offsets: "); 84 for (i=0;i<this->num;i++) _printString_(this->offsets[i] << " "); 85 _printLine_(""); 86 86 } 87 87 else{ 88 printf(" Hook: num=0 \n");89 } 90 } 91 /*}}}*/ 92 /*FUNCTION Hook::DeepEcho{{{ 1*/88 _printLine_(" Hook: num=0 "); 89 } 90 } 91 /*}}}*/ 92 /*FUNCTION Hook::DeepEcho{{{*/ 93 93 void Hook::DeepEcho(void){ 94 94 95 95 int i; 96 96 if (num){ 97 printf(" Hook: \n");98 printf(" num=%i\n",this->num);99 printf(" ids: ");100 for (i=0;i<this->num;i++) printf("%i ",this->ids[i]);101 printf("\n");102 printf(" offsets: ");103 for (i=0;i<this->num;i++) printf("%i ",this->offsets[i]);104 printf("\n");105 if (!objects) printf(" warning: object not hooked yet\n");97 _printLine_(" Hook: "); 98 _printLine_(" num=" << this->num); 99 _printString_(" ids: "); 100 for (i=0;i<this->num;i++) _printString_(this->ids[i] << " "); 101 _printLine_(""); 102 _printString_(" offsets: "); 103 for (i=0;i<this->num;i++) _printString_(this->offsets[i] << " "); 104 _printLine_(""); 105 if (!objects) _printLine_(" warning: object not hooked yet"); 106 106 else{ 107 printf(" objects:\n ");107 _printString_(" objects:\n "); 108 108 for (i=0;i<this->num;i++){ 109 printf(" object %i\n",i);109 _printLine_(" object " << i); 110 110 if(objects[i]) objects[i]->DeepEcho(); 111 else printf(" no object hooked yet (not configured)\n");111 else _printLine_(" no object hooked yet (not configured)"); 112 112 } 113 113 } 114 114 } 115 115 else{ 116 printf(" Hook: num=0 \n");117 } 118 } 119 /*}}}*/ 120 /*FUNCTION Hook::copy {{{ 1*/116 _printLine_(" Hook: num=0 "); 117 } 118 } 119 /*}}}*/ 120 /*FUNCTION Hook::copy {{{*/ 121 121 Object* Hook::copy(void){ 122 122 … … 132 132 output->num=this->num; 133 133 if(output->num){ 134 output->objects= (Object**)xmalloc(output->num*sizeof(Object*));135 output->ids= (int*)xmalloc(output->num*sizeof(int));136 output->offsets= (int*)xmalloc(output->num*sizeof(int));134 output->objects=xNew<Object*>(output->num); 135 output->ids=xNew<int>(output->num); 136 output->offsets=xNew<int>(output->num); 137 137 } 138 138 … … 148 148 149 149 /*Hook management: */ 150 /*FUNCTION Hook::configure{{{ 1*/150 /*FUNCTION Hook::configure{{{*/ 151 151 void Hook::configure(DataSet* dataset){ 152 152 … … 185 185 this->objects[i]=(Object*)dataset->GetObjectById(this->offsets+i,this->ids[i]); //remember the offset for later on. 186 186 /*check the id is correct!: */ 187 if (this->objects[i]->Id()!=this->ids[i]) _error _("%s%i%s%i%s"," wrong id: ",this->objects[i]->Id()," vs ",this->ids[i]," in resolved pointer!");188 } 189 } 190 } 191 /*}}}*/ 192 /*FUNCTION Hook::delivers{{{ 1*/187 if (this->objects[i]->Id()!=this->ids[i]) _error2_("wrong id: " << this->objects[i]->Id() << " vs " << this->ids[i] << " in resolved pointer!"); 188 } 189 } 190 } 191 /*}}}*/ 192 /*FUNCTION Hook::delivers{{{*/ 193 193 Object* Hook::delivers(void){ 194 194 195 195 /*first, check that we only have one T object in our object list: */ 196 if (this->num!=1) _error _("%s%i%s\n"," trying to delivery a single hook object when hook holds ",this->num," objects");196 if (this->num!=1) _error2_("trying to delivery a single hook object when hook holds " << this->num << " objects" << "\n"); 197 197 198 198 /*check NULL: */ 199 if (this->objects==NULL) _error _("hook is not pointing to any object, objects pointer is NULL");199 if (this->objects==NULL) _error2_("hook is not pointing to any object, objects pointer is NULL"); 200 200 201 201 return *objects; … … 203 203 204 204 /*}}}*/ 205 /*FUNCTION Hook::deliverp{{{ 1*/205 /*FUNCTION Hook::deliverp{{{*/ 206 206 Object** Hook::deliverp(void){ 207 207 return objects; 208 208 } 209 209 /*}}}*/ 210 /*FUNCTION Hook::Ids{{{ 1*/210 /*FUNCTION Hook::Ids{{{*/ 211 211 int* Hook::Ids(void){ 212 212 return this->ids; 213 213 } 214 214 /*}}}*/ 215 /*FUNCTION Hook::GetNum{{{ 1*/215 /*FUNCTION Hook::GetNum{{{*/ 216 216 int Hook::GetNum(void){ 217 217 return this->num; 218 218 } 219 219 /*}}}*/ 220 /*FUNCTION Hook::GetObjects{{{ 1*/220 /*FUNCTION Hook::GetObjects{{{*/ 221 221 Object** Hook::GetObjects(void){ 222 222 return this->objects; 223 223 } 224 224 /*}}}*/ 225 /*FUNCTION Hook::GetOffsets{{{ 1*/225 /*FUNCTION Hook::GetOffsets{{{*/ 226 226 int* Hook::GetOffsets(void){ 227 227 return this->offsets; 228 228 } 229 229 /*}}}*/ 230 /*FUNCTION Hook::Spawn{{{ 1*/230 /*FUNCTION Hook::Spawn{{{*/ 231 231 Hook* Hook::Spawn(int* indices, int numindices){ 232 232 … … 246 246 247 247 /*Else, check that we are requesting a half of num*/ 248 if (numindices>this->num) _error _("Cannot spawn hook with %i objects from a Hook of %i objects",numindices,this->num);248 if (numindices>this->num) _error2_("Cannot spawn hook with " << numindices << " objects from a Hook of " << this->num << " objects"); 249 249 250 250 /*go pickup the correct objects, ids and offsets :*/ 251 251 output->num=numindices; 252 if(output->num<1) _error _("Trying to spawn an empty ElementProperties!");253 254 output->objects= (Object**)xmalloc(output->num*sizeof(Object*));255 output->ids= (int*)xmalloc(output->num*sizeof(int));256 output->offsets= (int*)xmalloc(output->num*sizeof(int));252 if(output->num<1) _error2_("Trying to spawn an empty ElementProperties!"); 253 254 output->objects=xNew<Object*>(output->num); 255 output->ids=xNew<int>(output->num); 256 output->offsets=xNew<int>(output->num); 257 257 258 258 for(i=0;i<output->num;i++){ -
issm/trunk/src/c/objects/Hook.h
r12330 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 #include "./Object.h" 14 14 class DataSet; … … 31 31 ~Hook(); 32 32 /*}}}*/ 33 /*Object like functionality:{{{ 1*/33 /*Object like functionality:{{{*/ 34 34 void Echo(void); 35 35 void DeepEcho(void); 36 36 Object* copy(void); 37 37 /*}}}*/ 38 /*Hook management: {{{ 1*/38 /*Hook management: {{{*/ 39 39 Object* delivers(void); //single object deliver 40 40 Object** deliverp(void); //deliver all objects -
issm/trunk/src/c/objects/Inputs/BoolInput.cpp
r12330 r12706 18 18 19 19 /*BoolInput constructors and destructor*/ 20 /*FUNCTION BoolInput::BoolInput(){{{ 1*/20 /*FUNCTION BoolInput::BoolInput(){{{*/ 21 21 BoolInput::BoolInput(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION BoolInput::BoolInput( double* values){{{1*/25 /*FUNCTION BoolInput::BoolInput(IssmDouble* values){{{*/ 26 26 BoolInput::BoolInput(int in_enum_type,IssmBool in_value){ 27 27 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION BoolInput::~BoolInput(){{{ 1*/32 /*FUNCTION BoolInput::~BoolInput(){{{*/ 33 33 BoolInput::~BoolInput(){ 34 34 return; … … 37 37 38 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION BoolInput::Echo {{{ 1*/39 /*FUNCTION BoolInput::Echo {{{*/ 40 40 void BoolInput::Echo(void){ 41 41 this->DeepEcho(); 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION BoolInput::DeepEcho{{{ 1*/44 /*FUNCTION BoolInput::DeepEcho{{{*/ 45 45 void BoolInput::DeepEcho(void){ 46 46 47 printf("BoolInput:\n");48 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));49 printf(" value: %s\n",value?"true":"false");47 _printLine_("BoolInput:"); 48 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 49 _printLine_(" value: " <<(value?"true":"false")); 50 50 } 51 51 /*}}}*/ 52 /*FUNCTION BoolInput::Id{{{ 1*/52 /*FUNCTION BoolInput::Id{{{*/ 53 53 int BoolInput::Id(void){ return -1; } 54 54 /*}}}*/ 55 /*FUNCTION BoolInput::MyRank{{{ 1*/55 /*FUNCTION BoolInput::MyRank{{{*/ 56 56 int BoolInput::MyRank(void){ 57 57 extern int my_rank; … … 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION BoolInput::ObjectEnum{{{ 1*/61 /*FUNCTION BoolInput::ObjectEnum{{{*/ 62 62 int BoolInput::ObjectEnum(void){ 63 63 … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION BoolInput::copy{{{ 1*/68 /*FUNCTION BoolInput::copy{{{*/ 69 69 Object* BoolInput::copy() { 70 70 … … 75 75 76 76 /*BoolInput management*/ 77 /*FUNCTION BoolInput::InstanceEnum{{{ 1*/77 /*FUNCTION BoolInput::InstanceEnum{{{*/ 78 78 int BoolInput::InstanceEnum(void){ 79 79 … … 82 82 } 83 83 /*}}}*/ 84 /*FUNCTION BoolInput::SpawnTriaInput{{{ 1*/84 /*FUNCTION BoolInput::SpawnTriaInput{{{*/ 85 85 Input* BoolInput::SpawnTriaInput(int* indices){ 86 86 … … 97 97 } 98 98 /*}}}*/ 99 /*FUNCTION BoolInput::SpawnResult{{{ 1*/100 ElementResult* BoolInput::SpawnResult(int step, double time){99 /*FUNCTION BoolInput::SpawnResult{{{*/ 100 ElementResult* BoolInput::SpawnResult(int step, IssmDouble time){ 101 101 102 102 return new BoolElementResult(this->enum_type,this->value,step,time); … … 106 106 107 107 /*Object functions*/ 108 /*FUNCTION BoolInput::GetInputValue(bool* pvalue) {{{ 1*/108 /*FUNCTION BoolInput::GetInputValue(bool* pvalue) {{{*/ 109 109 void BoolInput::GetInputValue(bool* pvalue){ 110 110 *pvalue=value; 111 111 } 112 112 /*}}}*/ 113 /*FUNCTION BoolInput::GetInputValue(int* pvalue){{{ 1*/114 void BoolInput::GetInputValue(int* pvalue){_error _("not supported yet!");}113 /*FUNCTION BoolInput::GetInputValue(int* pvalue){{{*/ 114 void BoolInput::GetInputValue(int* pvalue){_error2_("not supported yet!");} 115 115 /*}}}*/ 116 /*FUNCTION BoolInput::GetInputValue( double* pvalue){{{1*/117 void BoolInput::GetInputValue( double* pvalue){_error_("not supported yet!");}116 /*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue){{{*/ 117 void BoolInput::GetInputValue(IssmDouble* pvalue){_error2_("not supported yet!");} 118 118 /*}}}*/ 119 /*FUNCTION BoolInput::GetInputValue( double* pvalue,GaussTria* gauss){{{1*/120 void BoolInput::GetInputValue( double* pvalue,GaussTria* gauss){_error_("not supported yet!");}119 /*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ 120 void BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not supported yet!");} 121 121 /*}}}*/ 122 /*FUNCTION BoolInput::GetInputValue( double* pvalue,GaussPenta* gauss){{{1*/123 void BoolInput::GetInputValue( double* pvalue,GaussPenta* gauss){_error_("not supported yet!");}122 /*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ 123 void BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not supported yet!");} 124 124 /*}}}*/ 125 /*FUNCTION BoolInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){{{1*/126 void BoolInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){_error_("not supported yet!");}125 /*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ 126 void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");} 127 127 /*}}}*/ 128 /*FUNCTION BoolInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){{{1*/129 void BoolInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}128 /*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 129 void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");} 130 130 /*}}}*/ 131 /*FUNCTION BoolInput::ChangeEnum{{{ 1*/131 /*FUNCTION BoolInput::ChangeEnum{{{*/ 132 132 void BoolInput::ChangeEnum(int newenumtype){ 133 133 this->enum_type=newenumtype; 134 134 } 135 135 /*}}}*/ 136 /*FUNCTION BoolInput::SquareMin{{{ 1*/137 void BoolInput::SquareMin( double* psquaremin, bool process_units,Parameters* parameters){136 /*FUNCTION BoolInput::SquareMin{{{*/ 137 void BoolInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ 138 138 /*square of a bool is the bool itself: */ 139 139 *psquaremin=value; 140 140 } 141 141 /*}}}*/ 142 /*FUNCTION BoolInput::Scale{{{ 1*/143 void BoolInput::Scale( double scale_factor){142 /*FUNCTION BoolInput::Scale{{{*/ 143 void BoolInput::Scale(IssmDouble scale_factor){ 144 144 /*a bool cannot be scaled: */ 145 145 } 146 146 /*}}}*/ 147 /*FUNCTION BoolInput::AXPY{{{ 1*/148 void BoolInput::AXPY(Input* xinput, double scalar){147 /*FUNCTION BoolInput::AXPY{{{*/ 148 void BoolInput::AXPY(Input* xinput,IssmDouble scalar){ 149 149 150 150 BoolInput* xboolinput=NULL; … … 157 157 158 158 case BoolInputEnum: 159 this->value= (bool)(this->value+scalar*xboolinput->value);159 this->value=reCast<bool,IssmDouble>(this->value+scalar*xboolinput->value); 160 160 return; 161 161 162 162 default: 163 _error _("not implemented yet");163 _error2_("not implemented yet"); 164 164 } 165 165 166 166 } 167 167 /*}}}*/ 168 /*FUNCTION BoolInput::Constrain{{{1*/ 169 void BoolInput::Constrain(double cm_min, double cm_max){ 170 171 if(!isnan(cm_min)) if (this->value<cm_min)this->value=cm_min; 172 if(!isnan(cm_max)) if (this->value>cm_max)this->value=cm_max; 173 174 } 175 /*}}}*/ 176 /*FUNCTION BoolInput::Extrude{{{1*/ 168 /*FUNCTION BoolInput::Extrude{{{*/ 177 169 void BoolInput::Extrude(void){ 178 170 … … 181 173 } 182 174 /*}}}*/ 183 /*FUNCTION BoolInput::GetVectorFromInputs{{{ 1*/175 /*FUNCTION BoolInput::GetVectorFromInputs{{{*/ 184 176 void BoolInput::GetVectorFromInputs(Vector* vector,int* doflist){ 185 177 186 _error _("not supporte yet!");178 _error2_("not supporte yet!"); 187 179 188 180 } 189 181 /*}}}*/ 190 /*FUNCTION BoolInput::GetValuesPtr{{{ 1*/191 void BoolInput::GetValuesPtr( double** pvalues,int* pnum_values){182 /*FUNCTION BoolInput::GetValuesPtr{{{*/ 183 void BoolInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ 192 184 193 _error _("not supported yet!");185 _error2_("not supported yet!"); 194 186 195 187 } 196 188 /*}}}*/ 197 /*FUNCTION BoolInput::Configure{{{ 1*/189 /*FUNCTION BoolInput::Configure{{{*/ 198 190 void BoolInput::Configure(Parameters* parameters){ 199 191 /*do nothing: */ -
issm/trunk/src/c/objects/Inputs/BoolInput.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../../include/include.h" … … 21 21 IssmBool value; 22 22 23 /*BoolInput constructors, destructors: {{{ 1*/23 /*BoolInput constructors, destructors: {{{*/ 24 24 BoolInput(); 25 25 BoolInput(int enum_type,IssmBool value); 26 26 ~BoolInput(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{ */ 29 29 void Echo(); 30 30 void DeepEcho(); … … 34 34 Object* copy(); 35 35 /*}}}*/ 36 /*BoolInput management: {{{ 1*/36 /*BoolInput management: {{{*/ 37 37 int InstanceEnum(); 38 38 Input* SpawnTriaInput(int* indices); 39 Input* PointwiseDivide(Input* inputB){_error _("not implemented yet");};40 Input* PointwiseMin(Input* inputB){_error _("not implemented yet");};41 Input* PointwiseMax(Input* inputB){_error _("not implemented yet");};42 ElementResult* SpawnResult(int step, double time);39 Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; 40 Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; 41 Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; 42 ElementResult* SpawnResult(int step, IssmDouble time); 43 43 void Configure(Parameters* parameters); 44 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};44 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 45 45 /*}}}*/ 46 /*numerics: {{{ 1*/46 /*numerics: {{{*/ 47 47 void GetInputValue(bool* pvalue); 48 48 void GetInputValue(int* pvalue); 49 void GetInputValue( double* pvalue);50 void GetInputValue( double* pvalue,GaussTria* gauss);51 void GetInputValue( double* pvalue,GaussPenta* gauss);52 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};53 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};54 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};55 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};56 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss);57 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss);58 void GetInputAverage( double* pvalue){_error_("not implemented yet");};59 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};60 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};61 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};62 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};63 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};64 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};65 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};49 void GetInputValue(IssmDouble* pvalue); 50 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); 51 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 55 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); 58 void GetInputAverage(IssmDouble* pvalue){_error2_("not implemented yet");}; 59 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 60 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 61 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 62 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 63 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 64 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 65 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 66 66 void ChangeEnum(int newenumtype); 67 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters);68 void ConstrainMin( double minimum){_error_("not implemented yet");};69 double InfinityNorm(void){_error_("InfinityNorm not implemented for booleans");};70 double Max(void){_error_("Max not implemented for booleans");};71 double MaxAbs(void){_error_("Max not implemented for booleans");};72 double Min(void){_error_("Min not implemented for booleans");};73 double MinAbs(void){_error_("Min not implemented for booleans");};74 void Scale( double scale_factor);75 void ArtificialNoise( double min,double max){_error_("not implemented yet");};76 void AXPY(Input* xinput, double scalar);77 void Constrain( double cm_min, double cm_max);67 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); 68 void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; 69 IssmDouble InfinityNorm(void){_error2_("InfinityNorm not implemented for booleans");}; 70 IssmDouble Max(void){_error2_("Max not implemented for booleans");}; 71 IssmDouble MaxAbs(void){_error2_("Max not implemented for booleans");}; 72 IssmDouble Min(void){_error2_("Min not implemented for booleans");}; 73 IssmDouble MinAbs(void){_error2_("Min not implemented for booleans");}; 74 void Scale(IssmDouble scale_factor); 75 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 76 void AXPY(Input* xinput,IssmDouble scalar); 77 void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error2_("Constrain not implemented for booleans");}; 78 78 void Extrude(void); 79 void VerticallyIntegrate(Input* thickness_input){_error _("not supported yet");};79 void VerticallyIntegrate(Input* thickness_input){_error2_("not supported yet");}; 80 80 void GetVectorFromInputs(Vector* vector,int* doflist); 81 void GetValuesPtr( double** pvalues,int* pnum_values);81 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); 82 82 /*}}}*/ 83 83 -
issm/trunk/src/c/objects/Inputs/ControlInput.cpp
r12330 r12706 18 18 19 19 /*ControlInput constructors and destructor*/ 20 /*FUNCTION ControlInput::ControlInput(){{{ 1*/20 /*FUNCTION ControlInput::ControlInput(){{{*/ 21 21 ControlInput::ControlInput(){ 22 22 control_id = 0; … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION ControlInput::ControlInput(int enum_type,int enum_input, double* pvalues,double* pmin,double* pmax,int id){{{1*/31 ControlInput::ControlInput(int in_enum_type,int enum_input, double* pvalues,double* pmin,double* pmax,int id){30 /*FUNCTION ControlInput::ControlInput(int enum_type,int enum_input,IssmDouble* pvalues,IssmDouble* pmin,IssmDouble* pmax,int id){{{*/ 31 ControlInput::ControlInput(int in_enum_type,int enum_input,IssmDouble* pvalues,IssmDouble* pmin,IssmDouble* pmax,int id){ 32 32 33 33 control_id=id; … … 48 48 break; 49 49 default: 50 _error _("Input of Enum %s not supported yet by ControlInput",EnumToStringx(enum_input));50 _error2_("Input of Enum " << EnumToStringx(enum_input) << " not supported yet by ControlInput"); 51 51 } 52 52 gradient =NULL; 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION ControlInput::~ControlInput(){{{ 1*/55 /*FUNCTION ControlInput::~ControlInput(){{{*/ 56 56 ControlInput::~ControlInput(){ 57 57 delete values; … … 64 64 65 65 /*Object virtual functions definitions:*/ 66 /*FUNCTION ControlInput::Echo {{{ 1*/66 /*FUNCTION ControlInput::Echo {{{*/ 67 67 void ControlInput::Echo(void){ 68 68 this->DeepEcho(); 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION ControlInput::DeepEcho{{{ 1*/71 /*FUNCTION ControlInput::DeepEcho{{{*/ 72 72 void ControlInput::DeepEcho(void){ 73 73 74 printf("ControlInput:\n");75 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));76 printf("---values: \n"); if (values) values->Echo();77 printf("---savedvalues: \n");if (savedvalues) savedvalues->Echo();78 printf("---minvalues: \n"); if (minvalues) minvalues->Echo();79 printf("---maxvalues: \n"); if (maxvalues) maxvalues->Echo();80 printf("---gradient: \n"); if (gradient) gradient->Echo();81 } 82 /*}}}*/ 83 /*FUNCTION ControlInput::Id{{{ 1*/74 _printLine_("ControlInput:"); 75 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 76 _printLine_("---values: "); if (values) values->Echo(); 77 _printLine_("---savedvalues: ");if (savedvalues) savedvalues->Echo(); 78 _printLine_("---minvalues: "); if (minvalues) minvalues->Echo(); 79 _printLine_("---maxvalues: "); if (maxvalues) maxvalues->Echo(); 80 _printLine_("---gradient: "); if (gradient) gradient->Echo(); 81 } 82 /*}}}*/ 83 /*FUNCTION ControlInput::Id{{{*/ 84 84 int ControlInput::Id(void){ return -1; } 85 85 /*}}}*/ 86 /*FUNCTION ControlInput::MyRank{{{ 1*/86 /*FUNCTION ControlInput::MyRank{{{*/ 87 87 int ControlInput::MyRank(void){ 88 88 extern int my_rank; … … 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION ControlInput::ObjectEnum{{{ 1*/92 /*FUNCTION ControlInput::ObjectEnum{{{*/ 93 93 int ControlInput::ObjectEnum(void){ 94 94 … … 97 97 } 98 98 /*}}}*/ 99 /*FUNCTION ControlInput::copy{{{ 1*/99 /*FUNCTION ControlInput::copy{{{*/ 100 100 Object* ControlInput::copy() { 101 101 … … 117 117 118 118 /*ControlInput management*/ 119 /*FUNCTION ControlInput::InstanceEnum{{{ 1*/119 /*FUNCTION ControlInput::InstanceEnum{{{*/ 120 120 int ControlInput::InstanceEnum(void){ 121 121 … … 126 126 127 127 /*Object functions*/ 128 /*FUNCTION ControlInput::Constrain(){{{ 1*/128 /*FUNCTION ControlInput::Constrain(){{{*/ 129 129 void ControlInput::Constrain(void){ 130 130 … … 136 136 delete values; this->values=newvalues; 137 137 }/*}}}*/ 138 /*FUNCTION ControlInput::Constrain( double min, double max){{{1*/139 void ControlInput::Constrain( double min, double max){138 /*FUNCTION ControlInput::Constrain(IssmDouble min, IssmDouble max){{{*/ 139 void ControlInput::Constrain(IssmDouble min, IssmDouble max){ 140 140 values->Constrain(min,max); 141 141 }/*}}}*/ 142 /*FUNCTION ControlInput::Extrude{{{ 1*/142 /*FUNCTION ControlInput::Extrude{{{*/ 143 143 void ControlInput::Extrude(void){ 144 144 values->Extrude(); … … 146 146 //gradient->Extrude(); 147 147 }/*}}}*/ 148 /*FUNCTION ControlInput::GetGradient{{{ 1*/148 /*FUNCTION ControlInput::GetGradient{{{*/ 149 149 void ControlInput::GetGradient(Vector* gradient_vec,int* doflist){ 150 150 if(gradient) gradient->GetVectorFromInputs(gradient_vec,doflist); 151 151 }/*}}}*/ 152 /*FUNCTION ControlInput::ScaleGradient{{{ 1*/153 void ControlInput::ScaleGradient( double scaling_factor){154 if(!gradient) _error _("Gradient of ControlInput %s not found",EnumToStringx(enum_type));152 /*FUNCTION ControlInput::ScaleGradient{{{*/ 153 void ControlInput::ScaleGradient(IssmDouble scaling_factor){ 154 if(!gradient) _error2_("Gradient of ControlInput " << EnumToStringx(enum_type) << " not found"); 155 155 gradient->Scale(scaling_factor); 156 156 }/*}}}*/ 157 /*FUNCTION ControlInput::SetGradient{{{ 1*/157 /*FUNCTION ControlInput::SetGradient{{{*/ 158 158 void ControlInput::SetGradient(Input* gradient_in){ 159 159 … … 170 170 break; 171 171 default: 172 _error _("more than 3 controls not implemented yet (Gradient %i was requested). EnumDefinitions.h needs to be updated.",this->control_id);172 _error2_("more than 3 controls not implemented yet (Gradient " << this->control_id << " was requested). EnumDefinitions.h needs to be updated."); 173 173 } 174 174 … … 178 178 179 179 }/*}}}*/ 180 /*FUNCTION ControlInput::SetInput{{{ 1*/180 /*FUNCTION ControlInput::SetInput{{{*/ 181 181 void ControlInput::SetInput(Input* in_input){ 182 182 … … 185 185 186 186 }/*}}}*/ 187 /*FUNCTION ControlInput::SpawnResult{{{ 1*/188 ElementResult* ControlInput::SpawnResult(int step, double time){187 /*FUNCTION ControlInput::SpawnResult{{{*/ 188 ElementResult* ControlInput::SpawnResult(int step, IssmDouble time){ 189 189 return savedvalues->SpawnResult(step,time); 190 190 }/*}}}*/ 191 /*FUNCTION ControlInput::SpawnTriaInput{{{ 1*/191 /*FUNCTION ControlInput::SpawnTriaInput{{{*/ 192 192 Input* ControlInput::SpawnTriaInput(int* indices){ 193 193 return values->SpawnTriaInput(indices); 194 194 }/*}}}*/ 195 /*FUNCTION ControlInput::SpawnGradient{{{ 1*/196 ElementResult* ControlInput::SpawnGradient(int step, double time){195 /*FUNCTION ControlInput::SpawnGradient{{{*/ 196 ElementResult* ControlInput::SpawnGradient(int step, IssmDouble time){ 197 197 _assert_(gradient); 198 198 return gradient->SpawnResult(step,time); 199 199 }/*}}}*/ 200 /*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){{{ 1*/200 /*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){{{*/ 201 201 void ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){ 202 202 values->GetVectorFromInputs(vector,doflist); 203 203 }/*}}}*/ 204 /*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){{{ 1*/204 /*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){{{*/ 205 205 void ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){ 206 206 if(strcmp(data,"value")==0){ … … 221 221 } 222 222 else{ 223 _error _("Data %s not supported yet",data);224 } 225 }/*}}}*/ 226 /*FUNCTION ControlInput::GetInputAverage( double* pvalue){{{1*/227 void ControlInput::GetInputAverage( double* pvalue){223 _error2_("Data " << data << " not supported yet"); 224 } 225 }/*}}}*/ 226 /*FUNCTION ControlInput::GetInputAverage(IssmDouble* pvalue){{{*/ 227 void ControlInput::GetInputAverage(IssmDouble* pvalue){ 228 228 values->GetInputAverage(pvalue); 229 229 }/*}}}*/ 230 /*FUNCTION ControlInput::GetInputValue(bool* pvalue){{{ 1*/230 /*FUNCTION ControlInput::GetInputValue(bool* pvalue){{{*/ 231 231 void ControlInput::GetInputValue(bool* pvalue){ 232 232 values->GetInputValue(pvalue); 233 233 }/*}}}*/ 234 /*FUNCTION ControlInput::GetInputValue(int* pvalue){{{ 1*/234 /*FUNCTION ControlInput::GetInputValue(int* pvalue){{{*/ 235 235 void ControlInput::GetInputValue(int* pvalue){ 236 236 values->GetInputValue(pvalue); 237 237 }/*}}}*/ 238 /*FUNCTION ControlInput::GetInputValue( double* pvalue){{{1*/239 void ControlInput::GetInputValue( double* pvalue){238 /*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/ 239 void ControlInput::GetInputValue(IssmDouble* pvalue){ 240 240 values->GetInputValue(pvalue); 241 241 }/*}}}*/ 242 /*FUNCTION ControlInput::GetInputValue( double* pvalue){{{1*/243 void ControlInput::GetInputValue( double* pvalue,GaussTria* gauss){242 /*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/ 243 void ControlInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){ 244 244 values->GetInputValue(pvalue,gauss); 245 245 }/*}}}*/ 246 /*FUNCTION ControlInput::GetInputValue( double* pvalue){{{1*/247 void ControlInput::GetInputValue( double* pvalue,GaussPenta* gauss){246 /*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/ 247 void ControlInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){ 248 248 values->GetInputValue(pvalue,gauss); 249 249 }/*}}}*/ 250 /*FUNCTION ControlInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){{{1*/251 void ControlInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){250 /*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ 251 void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){ 252 252 values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss); 253 253 }/*}}}*/ 254 /*FUNCTION ControlInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){{{1*/255 void ControlInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){254 /*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 255 void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){ 256 256 values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss); 257 257 }/*}}}*/ 258 /*FUNCTION ControlInput::SaveValue{{{ 1*/258 /*FUNCTION ControlInput::SaveValue{{{*/ 259 259 void ControlInput::SaveValue(void){ 260 if(!values) _error _("Values of %s not found",EnumToStringx(this->enum_type));260 if(!values) _error2_("Values of " << EnumToStringx(this->enum_type) << " not found"); 261 261 262 262 if(savedvalues) delete this->savedvalues; 263 263 this->savedvalues=(Input*)this->values->copy(); 264 264 }/*}}}*/ 265 /*FUNCTION ControlInput::UpdateValue{{{ 1*/266 void ControlInput::UpdateValue( double scalar){267 if(!gradient) _error _("Gradient of %s not found",EnumToStringx(this->enum_type));268 if(!savedvalues) _error _("Values of %s not found",EnumToStringx(this->enum_type));265 /*FUNCTION ControlInput::UpdateValue{{{*/ 266 void ControlInput::UpdateValue(IssmDouble scalar){ 267 if(!gradient) _error2_("Gradient of " << EnumToStringx(this->enum_type) << " not found"); 268 if(!savedvalues) _error2_("Values of " << EnumToStringx(this->enum_type) << " not found"); 269 269 270 270 if(values) delete this->values; … … 272 272 this->values->AXPY(gradient,scalar); 273 273 }/*}}}*/ 274 /*FUNCTION ControlInput::VerticallyIntegrate{{{ 1*/274 /*FUNCTION ControlInput::VerticallyIntegrate{{{*/ 275 275 void ControlInput::VerticallyIntegrate(Input* thickness_input){ 276 276 values->VerticallyIntegrate(thickness_input); 277 277 }/*}}}*/ 278 /*FUNCTION ControlInput::Configure{{{ 1*/278 /*FUNCTION ControlInput::Configure{{{*/ 279 279 void ControlInput::Configure(Parameters* parameters){ 280 280 /*do nothing: */ -
issm/trunk/src/c/objects/Inputs/ControlInput.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../../include/include.h" … … 25 25 Input* gradient; 26 26 27 /*ControlInput constructors, destructors: {{{ 1*/27 /*ControlInput constructors, destructors: {{{*/ 28 28 ControlInput(); 29 ControlInput(int enum_type,int enum_input, double* pvalues,double* pmin,double* pmax,int id);29 ControlInput(int enum_type,int enum_input,IssmDouble* pvalues,IssmDouble* pmin,IssmDouble* pmax,int id); 30 30 ~ControlInput(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{ */ 33 33 void Echo(); 34 34 void DeepEcho(); … … 38 38 Object* copy(); 39 39 /*}}}*/ 40 /*ControlInput management: {{{ 1*/40 /*ControlInput management: {{{*/ 41 41 int InstanceEnum(); 42 42 Input* SpawnTriaInput(int* indices); 43 Input* PointwiseDivide(Input* inputB){_error _("not implemented yet");};44 Input* PointwiseMin(Input* inputB){_error _("not implemented yet");};45 Input* PointwiseMax(Input* inputB){_error _("not implemented yet");};46 ElementResult* SpawnResult(int step, double time);47 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};43 Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; 44 Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; 45 Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; 46 ElementResult* SpawnResult(int step, IssmDouble time); 47 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 48 48 void Configure(Parameters* parameters); 49 49 /*}}}*/ 50 /*numerics: {{{ 1*/50 /*numerics: {{{*/ 51 51 void SetInput(Input* in_input); 52 52 void GetInputValue(bool* pvalue); 53 53 void GetInputValue(int* pvalue); 54 void GetInputValue( double* pvalue);55 void GetInputValue( double* pvalue,GaussTria* gauss);56 void GetInputValue( double* pvalue,GaussPenta* gauss);57 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};58 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};59 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};60 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};61 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss);62 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss);63 void GetInputAverage( double* pvalue);64 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};65 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};66 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};67 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};68 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};69 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};70 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};71 void ChangeEnum(int newenumtype){_error _("not implemented yet");};72 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters){_error_("not implemented yet");};73 void ConstrainMin( double minimum){_error_("not implemented yet");};74 void Scale( double scale_factor){_error_("not implemented yet");};75 void ArtificialNoise( double min,double max){_error_("not implemented yet");};76 void AXPY(Input* xinput, double scalar){_error_("not implemented yet");};54 void GetInputValue(IssmDouble* pvalue); 55 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); 56 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); 57 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 58 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 59 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 60 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 61 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 62 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); 63 void GetInputAverage(IssmDouble* pvalue); 64 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 65 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 66 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 67 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 68 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 69 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 70 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 71 void ChangeEnum(int newenumtype){_error2_("not implemented yet");}; 72 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){_error2_("not implemented yet");}; 73 void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; 74 void Scale(IssmDouble scale_factor){_error2_("not implemented yet");}; 75 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 76 void AXPY(Input* xinput,IssmDouble scalar){_error2_("not implemented yet");}; 77 77 void Constrain(void); 78 void Constrain( double min,double max);79 double InfinityNorm(void){_error_("not implemented yet");};80 double Max(void){_error_("not implemented yet");};81 double MaxAbs(void){_error_("not implemented yet");};82 double Min(void){_error_("not implemented yet");};83 double MinAbs(void){_error_("not implemented yet");};78 void Constrain(IssmDouble min,IssmDouble max); 79 IssmDouble InfinityNorm(void){_error2_("not implemented yet");}; 80 IssmDouble Max(void){_error2_("not implemented yet");}; 81 IssmDouble MaxAbs(void){_error2_("not implemented yet");}; 82 IssmDouble Min(void){_error2_("not implemented yet");}; 83 IssmDouble MinAbs(void){_error2_("not implemented yet");}; 84 84 void Extrude(void); 85 85 void VerticallyIntegrate(Input* thickness_input); 86 86 void GetVectorFromInputs(Vector* vector,int* doflist,const char* data); 87 87 void GetVectorFromInputs(Vector* vector,int* doflist); 88 void GetValuesPtr( double** pvalues,int* pnum_values){_error_("not implemented yet");};89 ElementResult* SpawnGradient(int step, double time);88 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error2_("not implemented yet");}; 89 ElementResult* SpawnGradient(int step, IssmDouble time); 90 90 void GetGradient(Vector* gradient_vec,int* doflist); 91 void ScaleGradient( double scale);91 void ScaleGradient(IssmDouble scale); 92 92 void SetGradient(Input* gradient_in); 93 void UpdateValue( double scalar);93 void UpdateValue(IssmDouble scalar); 94 94 void SaveValue(void); 95 95 /*}}}*/ -
issm/trunk/src/c/objects/Inputs/DatasetInput.cpp
r12330 r12706 2 2 * \brief: implementation of the datasetinput object 3 3 */ 4 /*Headers{{{ 1*/4 /*Headers{{{*/ 5 5 #ifdef HAVE_CONFIG_H 6 6 #include <config.h> … … 19 19 20 20 /*DatasetInput constructors and destructor*/ 21 /*FUNCTION DatasetInput::DatasetInput(){{{ 1*/21 /*FUNCTION DatasetInput::DatasetInput(){{{*/ 22 22 DatasetInput::DatasetInput(){ 23 23 enum_type=UNDEF; … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{ 1*/27 /*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{*/ 28 28 DatasetInput::DatasetInput(int in_enum_type){ 29 29 … … 32 32 } 33 33 /*}}}*/ 34 /*FUNCTION DatasetInput::~DatasetInput(){{{ 1*/34 /*FUNCTION DatasetInput::~DatasetInput(){{{*/ 35 35 DatasetInput::~DatasetInput(){ 36 36 delete inputs; … … 39 39 40 40 /*Object virtual functions definitions:*/ 41 /*FUNCTION DatasetInput::Echo {{{ 1*/41 /*FUNCTION DatasetInput::Echo {{{*/ 42 42 void DatasetInput::Echo(void){ 43 43 this->DeepEcho(); 44 44 } 45 45 /*}}}*/ 46 /*FUNCTION DatasetInput::DeepEcho{{{ 1*/46 /*FUNCTION DatasetInput::DeepEcho{{{*/ 47 47 void DatasetInput::DeepEcho(void){ 48 48 49 printf("DatasetInput:\n");50 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));51 printf("---inputs: \n"); inputs->Echo();49 _printLine_("DatasetInput:"); 50 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 51 _printLine_("---inputs: "); inputs->Echo(); 52 52 } 53 53 /*}}}*/ 54 /*FUNCTION DatasetInput::Id{{{ 1*/54 /*FUNCTION DatasetInput::Id{{{*/ 55 55 int DatasetInput::Id(void){ return -1; } 56 56 /*}}}*/ 57 /*FUNCTION DatasetInput::MyRank{{{ 1*/57 /*FUNCTION DatasetInput::MyRank{{{*/ 58 58 int DatasetInput::MyRank(void){ 59 59 extern int my_rank; … … 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION DatasetInput::ObjectEnum{{{ 1*/63 /*FUNCTION DatasetInput::ObjectEnum{{{*/ 64 64 int DatasetInput::ObjectEnum(void){ 65 65 … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION DatasetInput::copy{{{ 1*/70 /*FUNCTION DatasetInput::copy{{{*/ 71 71 Object* DatasetInput::copy() { 72 72 … … 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION DatasetInput::SpawnTriaInput{{{ 1*/82 /*FUNCTION DatasetInput::SpawnTriaInput{{{*/ 83 83 Input* DatasetInput::SpawnTriaInput(int* indices){ 84 84 … … 97 97 98 98 /*DatasetInput management*/ 99 /*FUNCTION DatasetInput::InstanceEnum{{{ 1*/99 /*FUNCTION DatasetInput::InstanceEnum{{{*/ 100 100 int DatasetInput::InstanceEnum(void){ 101 101 … … 106 106 107 107 /*Object functions*/ 108 /*FUNCTION DatasetInput::Configure{{{ 1*/108 /*FUNCTION DatasetInput::Configure{{{*/ 109 109 void DatasetInput::Configure(Parameters* parameters){ 110 110 /*do nothing: */ 111 111 } 112 112 /*}}}*/ 113 /*FUNCTION DatasetInput::GetInputValue( double* pvalue,GaussTria* gauss,int index){{{1*/114 void DatasetInput::GetInputValue( double* pvalue,GaussTria* gauss,int index){113 /*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){{{*/ 114 void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){ 115 115 116 116 /*Get requested input within dataset*/ 117 if(index<0 || index > inputs->Size()-1) _error _("index requested (%i) exceeds dataset size (%i)",index,inputs->Size());117 if(index<0 || index > inputs->Size()-1) _error2_("index requested (" << index << ") exceeds dataset size (" << inputs->Size() << ")"); 118 118 Input* input=(Input*)this->inputs->GetObjectByOffset(index); 119 119 -
issm/trunk/src/c/objects/Inputs/DatasetInput.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../../include/include.h" … … 21 21 Inputs* inputs; 22 22 23 /*DatasetInput constructors, destructors: {{{ 1*/23 /*DatasetInput constructors, destructors: {{{*/ 24 24 DatasetInput(); 25 25 DatasetInput(int enum_type); 26 26 ~DatasetInput(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{ */ 29 29 void Echo(); 30 30 void DeepEcho(); … … 34 34 Object* copy(); 35 35 /*}}}*/ 36 /*DatasetInput management: {{{ 1*/36 /*DatasetInput management: {{{*/ 37 37 int InstanceEnum(); 38 38 Input* SpawnTriaInput(int* indices); 39 Input* PointwiseDivide(Input* inputB){_error _("not implemented yet");};40 Input* PointwiseMin(Input* inputB){_error _("not implemented yet");};41 Input* PointwiseMax(Input* inputB){_error _("not implemented yet");};42 ElementResult* SpawnResult(int step, double time){_error_("not implemented yet");};43 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};39 Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; 40 Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; 41 Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; 42 ElementResult* SpawnResult(int step, IssmDouble time){_error2_("not implemented yet");}; 43 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 44 44 void Configure(Parameters* parameters); 45 45 /*}}}*/ 46 /*numeri ics: {{{1*/47 void GetInputValue(bool* pvalue){_error _("not implemented yet");};48 void GetInputValue(int* pvalue){_error _("not implemented yet");};49 void GetInputValue( double* pvalue){_error_("not implemented yet");};50 void GetInputValue( double* pvalue,GaussTria* gauss){_error_("not implemented yet");};51 void GetInputValue( double* pvalue,GaussPenta* gauss){_error_("not implemented yet");};52 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};53 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};54 void GetInputValue( double* pvalue,GaussTria* gauss ,int index);55 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};56 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};57 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};58 void GetInputAverage( double* pvalue){_error_("not implemented yet");};59 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};60 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};61 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};62 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};63 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};64 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};65 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};66 void ChangeEnum(int newenumtype){_error _("not implemented yet");};67 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters){_error_("not implemented yet");};68 void ConstrainMin( double minimum){_error_("not implemented yet");};69 void Scale( double scale_factor){_error_("not implemented yet");};70 void ArtificialNoise( double min,double max){_error_("not implemented yet");};71 void AXPY(Input* xinput, double scalar){_error_("not implemented yet");};72 void Constrain(void){_error _("not implemented yet");};73 void Constrain( double min,double max){_error_("not implemented yet");};74 double InfinityNorm(void){_error_("not implemented yet");};75 double Max(void){_error_("not implemented yet");};76 double MaxAbs(void){_error_("not implemented yet");};77 double Min(void){_error_("not implemented yet");};78 double MinAbs(void){_error_("not implemented yet");};79 void Extrude(void){_error _("not implemented yet");};80 void VerticallyIntegrate(Input* thickness_input){_error _("not implemented yet");};81 void GetVectorFromInputs(Vector* vector,int* doflist){_error _("not implemented yet");};82 void GetValuesPtr( double** pvalues,int* pnum_values){_error_("not implemented yet");};83 ElementResult* SpawnGradient(int step, double time){_error_("not implemented yet");};84 void GetGradient(Vector* gradient_vec,int* doflist){_error _("not implemented yet");};85 void ScaleGradient( double scale){_error_("not implemented yet");};86 void SetGradient(Input* gradient_in){_error _("not implemented yet");};87 void UpdateValue( double scalar){_error_("not implemented yet");};88 void SaveValue(void){_error _("not implemented yet");};46 /*numerics: {{{*/ 47 void GetInputValue(bool* pvalue){_error2_("not implemented yet");}; 48 void GetInputValue(int* pvalue){_error2_("not implemented yet");}; 49 void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");}; 50 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not implemented yet");}; 51 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not implemented yet");}; 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index); 55 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 58 void GetInputAverage(IssmDouble* pvalue){_error2_("not implemented yet");}; 59 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 60 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 61 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 62 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 63 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 64 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 65 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 66 void ChangeEnum(int newenumtype){_error2_("not implemented yet");}; 67 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){_error2_("not implemented yet");}; 68 void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; 69 void Scale(IssmDouble scale_factor){_error2_("not implemented yet");}; 70 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 71 void AXPY(Input* xinput,IssmDouble scalar){_error2_("not implemented yet");}; 72 void Constrain(void){_error2_("not implemented yet");}; 73 void Constrain(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 74 IssmDouble InfinityNorm(void){_error2_("not implemented yet");}; 75 IssmDouble Max(void){_error2_("not implemented yet");}; 76 IssmDouble MaxAbs(void){_error2_("not implemented yet");}; 77 IssmDouble Min(void){_error2_("not implemented yet");}; 78 IssmDouble MinAbs(void){_error2_("not implemented yet");}; 79 void Extrude(void){_error2_("not implemented yet");}; 80 void VerticallyIntegrate(Input* thickness_input){_error2_("not implemented yet");}; 81 void GetVectorFromInputs(Vector* vector,int* doflist){_error2_("not implemented yet");}; 82 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error2_("not implemented yet");}; 83 ElementResult* SpawnGradient(int step, IssmDouble time){_error2_("not implemented yet");}; 84 void GetGradient(Vector* gradient_vec,int* doflist){_error2_("not implemented yet");}; 85 void ScaleGradient(IssmDouble scale){_error2_("not implemented yet");}; 86 void SetGradient(Input* gradient_in){_error2_("not implemented yet");}; 87 void UpdateValue(IssmDouble scalar){_error2_("not implemented yet");}; 88 void SaveValue(void){_error2_("not implemented yet");}; 89 89 /*}}}*/ 90 90 -
issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
r12330 r12706 18 18 19 19 /*DoubleInput constructors and destructor*/ 20 /*FUNCTION DoubleInput::DoubleInput(){{{ 1*/20 /*FUNCTION DoubleInput::DoubleInput(){{{*/ 21 21 DoubleInput::DoubleInput(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION DoubleInput::DoubleInput( double value){{{1*/25 /*FUNCTION DoubleInput::DoubleInput(IssmDouble value){{{*/ 26 26 DoubleInput::DoubleInput(int in_enum_type,IssmDouble in_value){ 27 27 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION DoubleInput::~DoubleInput(){{{ 1*/32 /*FUNCTION DoubleInput::~DoubleInput(){{{*/ 33 33 DoubleInput::~DoubleInput(){ 34 34 return; … … 37 37 38 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION DoubleInput::Echo {{{ 1*/39 /*FUNCTION DoubleInput::Echo {{{*/ 40 40 void DoubleInput::Echo(void){ 41 41 this->DeepEcho(); 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION DoubleInput::DeepEcho{{{ 1*/44 /*FUNCTION DoubleInput::DeepEcho{{{*/ 45 45 void DoubleInput::DeepEcho(void){ 46 46 47 printf("DoubleInput:\n");48 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));49 printf(" value: %g\n",this->value);50 } 51 /*}}}*/ 52 /*FUNCTION DoubleInput::Id{{{ 1*/47 _printLine_("DoubleInput:"); 48 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 49 _printLine_(" value: " << this->value); 50 } 51 /*}}}*/ 52 /*FUNCTION DoubleInput::Id{{{*/ 53 53 int DoubleInput::Id(void){ return -1; } 54 54 /*}}}*/ 55 /*FUNCTION DoubleInput::MyRank{{{ 1*/55 /*FUNCTION DoubleInput::MyRank{{{*/ 56 56 int DoubleInput::MyRank(void){ 57 57 extern int my_rank; … … 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION DoubleInput::ObjectEnum{{{ 1*/61 /*FUNCTION DoubleInput::ObjectEnum{{{*/ 62 62 int DoubleInput::ObjectEnum(void){ 63 63 … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION DoubleInput::copy{{{ 1*/68 /*FUNCTION DoubleInput::copy{{{*/ 69 69 Object* DoubleInput::copy() { 70 70 … … 75 75 76 76 /*DoubleInput management*/ 77 /*FUNCTION DoubleInput::InstanceEnum{{{ 1*/77 /*FUNCTION DoubleInput::InstanceEnum{{{*/ 78 78 int DoubleInput::InstanceEnum(void){ 79 79 … … 82 82 } 83 83 /*}}}*/ 84 /*FUNCTION DoubleInput::SpawnTriaInput{{{ 1*/84 /*FUNCTION DoubleInput::SpawnTriaInput{{{*/ 85 85 Input* DoubleInput::SpawnTriaInput(int* indices){ 86 86 … … 97 97 } 98 98 /*}}}*/ 99 /*FUNCTION DoubleInput::SpawnResult{{{ 1*/100 ElementResult* DoubleInput::SpawnResult(int step, double time){99 /*FUNCTION DoubleInput::SpawnResult{{{*/ 100 ElementResult* DoubleInput::SpawnResult(int step, IssmDouble time){ 101 101 102 102 return new DoubleElementResult(this->enum_type,this->value,step,time); … … 106 106 107 107 /*Object functions*/ 108 /*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{ 1*/108 /*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{*/ 109 109 void DoubleInput::GetInputValue(bool* pvalue){ 110 _error _("Double input of enum %s cannot return a boolean",EnumToStringx(enum_type));111 112 } 113 /*}}}*/ 114 /*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{ 1*/110 _error2_("Double input of enum " << EnumToStringx(enum_type) << " cannot return a boolean"); 111 112 } 113 /*}}}*/ 114 /*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{*/ 115 115 void DoubleInput::GetInputValue(int* pvalue){ 116 _error _("Double input of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));117 118 } 119 /*}}}*/ 120 /*FUNCTION DoubleInput::GetInputValue( double* pvalue){{{1*/121 void DoubleInput::GetInputValue( double* pvalue){116 _error2_("Double input of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer"); 117 118 } 119 /*}}}*/ 120 /*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue){{{*/ 121 void DoubleInput::GetInputValue(IssmDouble* pvalue){ 122 122 123 123 /*return value*/ … … 125 125 } 126 126 /*}}}*/ 127 /*FUNCTION DoubleInput::GetInputValue( double* pvalue,GaussTria* gauss){{{1*/128 void DoubleInput::GetInputValue( double* pvalue,GaussTria* gauss){*pvalue=this->value;}129 /*}}}*/ 130 /*FUNCTION DoubleInput::GetInputValue( double* pvalue,GaussPenta* gauss){{{1*/131 void DoubleInput::GetInputValue( double* pvalue,GaussPenta* gauss){*pvalue=this->value;}132 /*}}}*/ 133 /*FUNCTION DoubleInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){{{1*/134 void DoubleInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){_error_("not supported yet!");}135 /*}}}*/ 136 /*FUNCTION DoubleInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){{{1*/137 void DoubleInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}138 /*}}}*/ 139 /*FUNCTION DoubleInput::GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){{{1*/140 void DoubleInput::GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){127 /*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ 128 void DoubleInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){*pvalue=this->value;} 129 /*}}}*/ 130 /*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ 131 void DoubleInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){*pvalue=this->value;} 132 /*}}}*/ 133 /*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ 134 void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");} 135 /*}}}*/ 136 /*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 137 void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");} 138 /*}}}*/ 139 /*FUNCTION DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){{{*/ 140 void DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){ 141 141 /*Epsilon is zero as vx is constant over the element*/ 142 142 for(int i=0;i<3;i++) epsilonvx[i]=0; 143 143 } 144 144 /*}}}*/ 145 /*FUNCTION DoubleInput::GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){{{1*/146 void DoubleInput::GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){145 /*FUNCTION DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){{{*/ 146 void DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){ 147 147 /*Epsilon is zero as vy is constant over the element*/ 148 148 for(int i=0;i<3;i++) epsilonvy[i]=0; 149 149 } 150 150 /*}}}*/ 151 /*FUNCTION DoubleInput::GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){{{1*/152 void DoubleInput::GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){151 /*FUNCTION DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 152 void DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ 153 153 /*Epsilon is zero as vx is constant over the element*/ 154 154 for(int i=0;i<6;i++) epsilonvx[i]=0; 155 155 } 156 156 /*}}}*/ 157 /*FUNCTION DoubleInput::GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){{{1*/158 void DoubleInput::GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){157 /*FUNCTION DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 158 void DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ 159 159 /*Epsilon is zero as vy is constant over the element*/ 160 160 for(int i=0;i<6;i++) epsilonvy[i]=0; 161 161 } 162 162 /*}}}*/ 163 /*FUNCTION DoubleInput::GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){{{1*/164 void DoubleInput::GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){163 /*FUNCTION DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 164 void DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){ 165 165 /*Epsilon is zero as vz is constant over the element*/ 166 166 for(int i=0;i<6;i++) epsilonvz[i]=0; 167 167 } 168 168 /*}}}*/ 169 /*FUNCTION DoubleInput::GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){{{1*/170 void DoubleInput::GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){169 /*FUNCTION DoubleInput::GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 170 void DoubleInput::GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ 171 171 /*Epsilon is zero as vx is constant over the element*/ 172 172 for(int i=0;i<5;i++) epsilonvx[i]=0; 173 173 } 174 174 /*}}}*/ 175 /*FUNCTION DoubleInput::GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){{{1*/176 void DoubleInput::GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){175 /*FUNCTION DoubleInput::GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 176 void DoubleInput::GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ 177 177 /*Epsilon is zero as vy is constant over the element*/ 178 178 for(int i=0;i<5;i++) epsilonvy[i]=0; 179 179 } 180 180 /*}}}*/ 181 /*FUNCTION DoubleInput::ChangeEnum{{{ 1*/181 /*FUNCTION DoubleInput::ChangeEnum{{{*/ 182 182 void DoubleInput::ChangeEnum(int newenumtype){ 183 183 this->enum_type=newenumtype; 184 184 } 185 185 /*}}}*/ 186 /*FUNCTION DoubleInput::SquareMin{{{ 1*/187 void DoubleInput::SquareMin( double* psquaremin, bool process_units,Parameters* parameters){188 189 /*square min of a double is the square of the double itself: */186 /*FUNCTION DoubleInput::SquareMin{{{*/ 187 void DoubleInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ 188 189 /*square min of a IssmDouble is the square of the IssmDouble itself: */ 190 190 *psquaremin=pow(value,2); 191 191 } 192 192 /*}}}*/ 193 /*FUNCTION DoubleInput::Scale{{{ 1*/194 void DoubleInput::Scale( double scale_factor){193 /*FUNCTION DoubleInput::Scale{{{*/ 194 void DoubleInput::Scale(IssmDouble scale_factor){ 195 195 value=value*scale_factor; 196 196 } 197 197 /*}}}*/ 198 /*FUNCTION DoubleInput::ConstrainMin{{{ 1*/199 void DoubleInput::ConstrainMin( double minimum){198 /*FUNCTION DoubleInput::ConstrainMin{{{*/ 199 void DoubleInput::ConstrainMin(IssmDouble minimum){ 200 200 if (value<minimum) value=minimum; 201 201 } 202 202 /*}}}*/ 203 /*FUNCTION DoubleInput::AXPY{{{ 1*/204 void DoubleInput::AXPY(Input* xinput, double scalar){205 206 DoubleInput* x doubleinput=NULL;203 /*FUNCTION DoubleInput::AXPY{{{*/ 204 void DoubleInput::AXPY(Input* xinput,IssmDouble scalar){ 205 206 DoubleInput* xIssmDoubleinput=NULL; 207 207 208 208 /*xinput is of the same type, so cast it: */ 209 x doubleinput=(DoubleInput*)xinput;209 xIssmDoubleinput=(DoubleInput*)xinput; 210 210 211 211 /*Carry out the AXPY operation depending on type:*/ … … 213 213 214 214 case DoubleInputEnum: 215 this->value=this->value+scalar*x doubleinput->value;215 this->value=this->value+scalar*xIssmDoubleinput->value; 216 216 return; 217 217 218 218 default: 219 _error _("not implemented yet");219 _error2_("not implemented yet"); 220 220 } 221 221 222 222 } 223 223 /*}}}*/ 224 /*FUNCTION DoubleInput::Constrain{{{ 1*/225 void DoubleInput::Constrain( double cm_min, double cm_max){226 227 if(! isnan(cm_min)) if (this->value<cm_min)this->value=cm_min;228 if(! isnan(cm_max)) if (this->value>cm_max)this->value=cm_max;229 230 } 231 /*}}}*/ 232 /*FUNCTION DoubleInput::Max{{{ 1*/233 double DoubleInput::Max(void){224 /*FUNCTION DoubleInput::Constrain{{{*/ 225 void DoubleInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){ 226 227 if(!xIsNan<IssmDouble>(cm_min)) if (this->value<cm_min)this->value=cm_min; 228 if(!xIsNan<IssmDouble>(cm_max)) if (this->value>cm_max)this->value=cm_max; 229 230 } 231 /*}}}*/ 232 /*FUNCTION DoubleInput::Max{{{*/ 233 IssmDouble DoubleInput::Max(void){ 234 234 return this->value; 235 235 } 236 236 /*}}}*/ 237 /*FUNCTION DoubleInput::MaxAbs{{{ 1*/238 double DoubleInput::MaxAbs(void){237 /*FUNCTION DoubleInput::MaxAbs{{{*/ 238 IssmDouble DoubleInput::MaxAbs(void){ 239 239 return fabs(this->value); 240 240 } 241 241 /*}}}*/ 242 /*FUNCTION DoubleInput::Min{{{ 1*/243 double DoubleInput::Min(void){242 /*FUNCTION DoubleInput::Min{{{*/ 243 IssmDouble DoubleInput::Min(void){ 244 244 return this->value; 245 245 } 246 246 /*}}}*/ 247 /*FUNCTION DoubleInput::MinAbs{{{ 1*/248 double DoubleInput::MinAbs(void){247 /*FUNCTION DoubleInput::MinAbs{{{*/ 248 IssmDouble DoubleInput::MinAbs(void){ 249 249 return fabs(this->value); 250 250 } 251 251 /*}}}*/ 252 /*FUNCTION DoubleInput::GetVectorFromInputs{{{ 1*/252 /*FUNCTION DoubleInput::GetVectorFromInputs{{{*/ 253 253 void DoubleInput::GetVectorFromInputs(Vector* vector,int* doflist){ 254 254 255 _error _("not supporte yet!");256 257 } 258 /*}}}*/ 259 /*FUNCTION DoubleInput::GetValuesPtr{{{ 1*/260 void DoubleInput::GetValuesPtr( double** pvalues,int* pnum_values){261 262 _error _("not supported yet!");263 264 } 265 /*}}}*/ 266 /*FUNCTION DoubleInput::GetInputAverage{{{ 1*/267 void DoubleInput::GetInputAverage( double* pvalue){255 _error2_("not supporte yet!"); 256 257 } 258 /*}}}*/ 259 /*FUNCTION DoubleInput::GetValuesPtr{{{*/ 260 void DoubleInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ 261 262 _error2_("not supported yet!"); 263 264 } 265 /*}}}*/ 266 /*FUNCTION DoubleInput::GetInputAverage{{{*/ 267 void DoubleInput::GetInputAverage(IssmDouble* pvalue){ 268 268 *pvalue=value; 269 269 } 270 270 /*}}}*/ 271 /*FUNCTION DoubleInput::VerticallyIntegrate{{{ 1*/271 /*FUNCTION DoubleInput::VerticallyIntegrate{{{*/ 272 272 void DoubleInput::VerticallyIntegrate(Input* thickness_input){ 273 273 274 274 /*Intermediaries*/ 275 double thickness_value;275 IssmDouble thickness_value; 276 276 277 277 /*Check that input provided is a thickness*/ 278 if (thickness_input->InstanceEnum()!=ThicknessEnum) _error _("Input provided is not a Thickness (enum_type is %s)",EnumToStringx(thickness_input->InstanceEnum()));278 if (thickness_input->InstanceEnum()!=ThicknessEnum) _error2_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")"); 279 279 280 280 /*vertically integrate depending on type:*/ … … 287 287 288 288 default: 289 _error _("not implemented yet");289 _error2_("not implemented yet"); 290 290 } 291 291 } 292 292 /*}}}*/ 293 /*FUNCTION DoubleInput::PointwiseDivide{{{ 1*/293 /*FUNCTION DoubleInput::PointwiseDivide{{{*/ 294 294 Input* DoubleInput::PointwiseDivide(Input* inputB){ 295 295 … … 298 298 299 299 /*Intermediaries*/ 300 double Bvalue;300 IssmDouble Bvalue; 301 301 302 302 /*Check that inputB is of the same type*/ … … 311 311 } 312 312 /*}}}*/ 313 /*FUNCTION DoubleInput::PointwiseMin{{{ 1*/313 /*FUNCTION DoubleInput::PointwiseMin{{{*/ 314 314 Input* DoubleInput::PointwiseMin(Input* input){ 315 315 … … 318 318 319 319 /*Intermediaries*/ 320 double min;320 IssmDouble min; 321 321 322 322 /*Check that inputB is of the same type*/ … … 332 332 } 333 333 /*}}}*/ 334 /*FUNCTION DoubleInput::PointwiseMax{{{ 1*/334 /*FUNCTION DoubleInput::PointwiseMax{{{*/ 335 335 Input* DoubleInput::PointwiseMax(Input* input){ 336 336 … … 339 339 340 340 /*Intermediaries*/ 341 double max;341 IssmDouble max; 342 342 343 343 /*Check that inputB is of the same type*/ … … 353 353 } 354 354 /*}}}*/ 355 /*FUNCTION DoubleInput::Configure{{{ 1*/355 /*FUNCTION DoubleInput::Configure{{{*/ 356 356 void DoubleInput::Configure(Parameters* parameters){ 357 357 /*do nothing: */ -
issm/trunk/src/c/objects/Inputs/DoubleInput.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../../include/include.h" … … 18 18 public: 19 19 int enum_type; 20 double value;20 IssmDouble value; 21 21 22 /*DoubleInput constructors, destructors: {{{ 1*/22 /*DoubleInput constructors, destructors: {{{*/ 23 23 DoubleInput(); 24 24 DoubleInput(int enum_type,IssmDouble value); 25 25 ~DoubleInput(); 26 26 /*}}}*/ 27 /*Object virtual functions definitions:{{{ 1*/27 /*Object virtual functions definitions:{{{ */ 28 28 void Echo(); 29 29 void DeepEcho(); … … 33 33 Object* copy(); 34 34 /*}}}*/ 35 /*DoubleInput management: {{{ 1*/35 /*DoubleInput management: {{{*/ 36 36 int InstanceEnum(); 37 37 Input* SpawnTriaInput(int* indices); … … 39 39 Input* PointwiseMin(Input* inputB); 40 40 Input* PointwiseMax(Input* inputB); 41 ElementResult* SpawnResult(int step, double time);42 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};41 ElementResult* SpawnResult(int step, IssmDouble time); 42 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 43 43 void Configure(Parameters* parameters); 44 44 /*}}}*/ 45 /*numerics: {{{ 1*/45 /*numerics: {{{*/ 46 46 void GetInputValue(bool* pvalue); 47 47 void GetInputValue(int* pvalue); 48 void GetInputValue( double* pvalue);49 void GetInputValue( double* pvalue,GaussTria* gauss);50 void GetInputValue( double* pvalue,GaussPenta* gauss);51 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};52 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};53 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};54 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};55 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss);56 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss);57 void GetInputAverage( double* pvalue);58 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss);59 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss);60 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss);61 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss);62 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss);63 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss);64 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss);48 void GetInputValue(IssmDouble* pvalue); 49 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); 50 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); 51 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 52 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 53 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 55 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); 57 void GetInputAverage(IssmDouble* pvalue); 58 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss); 59 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss); 60 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss); 61 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss); 62 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss); 63 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss); 64 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss); 65 65 void ChangeEnum(int newenumtype); 66 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters);67 void ConstrainMin( double minimum);68 void Scale( double scale_factor);69 void ArtificialNoise( double min,double max){_error_("not implemented yet");};70 void AXPY(Input* xinput, double scalar);71 void Constrain( double cm_min, double cm_max);72 double InfinityNorm(void){_error_("not implemented yet");};73 double Max(void);74 double MaxAbs(void);75 double Min(void);76 double MinAbs(void);77 void Extrude(void){_error _("not supported yet");};66 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); 67 void ConstrainMin(IssmDouble minimum); 68 void Scale(IssmDouble scale_factor); 69 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 70 void AXPY(Input* xinput,IssmDouble scalar); 71 void Constrain(IssmDouble cm_min, IssmDouble cm_max); 72 IssmDouble InfinityNorm(void){_error2_("not implemented yet");}; 73 IssmDouble Max(void); 74 IssmDouble MaxAbs(void); 75 IssmDouble Min(void); 76 IssmDouble MinAbs(void); 77 void Extrude(void){_error2_("not supported yet");}; 78 78 void VerticallyIntegrate(Input* thickness_input); 79 79 void GetVectorFromInputs(Vector* vector,int* doflist); 80 void GetValuesPtr( double** pvalues,int* pnum_values);80 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); 81 81 /*}}}*/ 82 82 -
issm/trunk/src/c/objects/Inputs/Input.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "../Object.h" 12 12 class Node; … … 21 21 22 22 virtual ~Input(){}; 23 23 24 virtual int InstanceEnum()=0; 24 25 virtual void GetInputValue(bool* pvalue)=0; 25 26 virtual void GetInputValue(int* pvalue)=0; 26 virtual void GetInputValue( double* pvalue)=0;27 virtual void GetInputValue( double* pvalue,GaussTria* gauss)=0;28 virtual void GetInputValue( double* pvalue,GaussPenta* gauss)=0;29 virtual void GetInputValue( double* pvalue,GaussTria* gauss,double time)=0;30 virtual void GetInputValue( double* pvalue,GaussPenta* gauss,double time)=0;31 virtual void GetInputValue( double* pvalue,GaussTria* gauss ,int index)=0;32 virtual void GetInputValue( double* pvalue,GaussPenta* gauss,int index)=0;33 virtual void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss)=0;34 virtual void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss)=0;35 virtual void GetInputAverage( double* pvalue)=0;36 virtual void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss)=0;37 virtual void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss)=0;38 virtual void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss)=0;39 virtual void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss)=0;40 virtual void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss)=0;41 virtual void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss)=0;42 virtual void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss)=0;27 virtual void GetInputValue(IssmDouble* pvalue)=0; 28 virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss)=0; 29 virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss)=0; 30 virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time)=0; 31 virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time)=0; 32 virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index)=0; 33 virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index)=0; 34 virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss)=0; 35 virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss)=0; 36 virtual void GetInputAverage(IssmDouble* pvalue)=0; 37 virtual void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss)=0; 38 virtual void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss)=0; 39 virtual void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss)=0; 40 virtual void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss)=0; 41 virtual void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss)=0; 42 virtual void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss)=0; 43 virtual void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss)=0; 43 44 virtual void ChangeEnum(int newenumtype)=0; 44 45 virtual void Configure(Parameters* parameters)=0; 45 46 46 virtual void SquareMin( double* psquaremin, bool process_units,Parameters* parameters)=0;47 virtual void ConstrainMin( double minimum)=0;48 virtual double InfinityNorm(void)=0;49 virtual double MaxAbs(void)=0;50 virtual double MinAbs(void)=0;51 virtual double Max(void)=0;52 virtual double Min(void)=0;53 virtual void Scale( double scale_factor)=0;54 virtual void ArtificialNoise( double min,double max)=0;55 virtual void AXPY(Input* xinput, double scalar)=0;56 virtual void Constrain( double cm_min, double cm_max)=0;47 virtual void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters)=0; 48 virtual void ConstrainMin(IssmDouble minimum)=0; 49 virtual IssmDouble InfinityNorm(void)=0; 50 virtual IssmDouble MaxAbs(void)=0; 51 virtual IssmDouble MinAbs(void)=0; 52 virtual IssmDouble Max(void)=0; 53 virtual IssmDouble Min(void)=0; 54 virtual void Scale(IssmDouble scale_factor)=0; 55 virtual void ArtificialNoise(IssmDouble min,IssmDouble max)=0; 56 virtual void AXPY(Input* xinput,IssmDouble scalar)=0; 57 virtual void Constrain(IssmDouble cm_min, IssmDouble cm_max)=0; 57 58 virtual void VerticallyIntegrate(Input* thickness_input)=0; 58 59 virtual void Extrude()=0; 59 60 virtual void GetVectorFromInputs(Vector* vector,int* doflist)=0; 60 virtual void GetValuesPtr( double** pvalues,int* pnum_values)=0;61 virtual void GetValuesPtr(IssmDouble** pvalues,int* pnum_values)=0; 61 62 62 63 virtual Input* SpawnTriaInput(int* indices)=0; … … 64 65 virtual Input* PointwiseMax(Input* inputmax)=0; 65 66 virtual Input* PointwiseMin(Input* inputmin)=0; 66 virtual ElementResult* SpawnResult(int step, double time)=0;67 virtual ElementResult* SpawnResult(int step, IssmDouble time)=0; 67 68 }; 68 69 #endif -
issm/trunk/src/c/objects/Inputs/IntInput.cpp
r12330 r12706 18 18 19 19 /*IntInput constructors and destructor*/ 20 /*FUNCTION IntInput::IntInput(){{{ 1*/20 /*FUNCTION IntInput::IntInput(){{{*/ 21 21 IntInput::IntInput(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION IntInput::IntInput( double* values){{{1*/25 /*FUNCTION IntInput::IntInput(IssmDouble* values){{{*/ 26 26 IntInput::IntInput(int in_enum_type,IssmInt in_value){ 27 27 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION IntInput::~IntInput(){{{ 1*/32 /*FUNCTION IntInput::~IntInput(){{{*/ 33 33 IntInput::~IntInput(){ 34 34 return; … … 37 37 38 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION IntInput::DeepEcho{{{ 1*/39 /*FUNCTION IntInput::DeepEcho{{{*/ 40 40 void IntInput::DeepEcho(void){ 41 41 42 printf("IntInput:\n");43 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));44 printf(" value: %i\n",(int)this->value);42 _printLine_("IntInput:"); 43 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 44 _printLine_(" value: " << (int)this->value); 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION IntInput::Id{{{ 1*/47 /*FUNCTION IntInput::Id{{{*/ 48 48 int IntInput::Id(void){ return -1; } 49 49 /*}}}*/ 50 /*FUNCTION IntInput::MyRank{{{ 1*/50 /*FUNCTION IntInput::MyRank{{{*/ 51 51 int IntInput::MyRank(void){ 52 52 extern int my_rank; … … 54 54 } 55 55 /*}}}*/ 56 /*FUNCTION IntInput::ObjectEnum{{{ 1*/56 /*FUNCTION IntInput::ObjectEnum{{{*/ 57 57 int IntInput::ObjectEnum(void){ 58 58 … … 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION IntInput::copy{{{ 1*/63 /*FUNCTION IntInput::copy{{{*/ 64 64 Object* IntInput::copy() { 65 65 … … 70 70 71 71 /*IntInput management*/ 72 /*FUNCTION IntInput::Echo {{{ 1*/72 /*FUNCTION IntInput::Echo {{{*/ 73 73 void IntInput::Echo(void){ 74 74 this->DeepEcho(); 75 75 } 76 76 /*}}}*/ 77 /*FUNCTION IntInput::InstanceEnum{{{ 1*/77 /*FUNCTION IntInput::InstanceEnum{{{*/ 78 78 int IntInput::InstanceEnum(void){ 79 79 … … 82 82 } 83 83 /*}}}*/ 84 /*FUNCTION IntInput::SpawnTriaInput{{{ 1*/84 /*FUNCTION IntInput::SpawnTriaInput{{{*/ 85 85 Input* IntInput::SpawnTriaInput(int* indices){ 86 86 … … 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION IntInput::SpawnResult{{{ 1*/99 ElementResult* IntInput::SpawnResult(int step, double time){98 /*FUNCTION IntInput::SpawnResult{{{*/ 99 ElementResult* IntInput::SpawnResult(int step, IssmDouble time){ 100 100 101 _error _("not supported yet!");101 _error2_("not supported yet!"); 102 102 103 103 } … … 105 105 106 106 /*Object functions*/ 107 /*FUNCTION IntInput::GetInputValue(bool* pvalue) {{{ 1*/108 void IntInput::GetInputValue(bool* pvalue){_error _("not supported yet!");}107 /*FUNCTION IntInput::GetInputValue(bool* pvalue) {{{*/ 108 void IntInput::GetInputValue(bool* pvalue){_error2_("not supported yet!");} 109 109 /*}}}*/ 110 /*FUNCTION IntInput::GetInputValue(int* pvalue){{{ 1*/110 /*FUNCTION IntInput::GetInputValue(int* pvalue){{{*/ 111 111 void IntInput::GetInputValue(int* pvalue){ 112 112 *pvalue=value; 113 113 } 114 114 /*}}}*/ 115 /*FUNCTION IntInput::GetInputValue( double* pvalue){{{1*/116 void IntInput::GetInputValue( double* pvalue){117 _error _("IntInput cannot return a double in parallel");115 /*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue){{{*/ 116 void IntInput::GetInputValue(IssmDouble* pvalue){ 117 _error2_("IntInput cannot return a IssmDouble in parallel"); 118 118 } 119 119 /*}}}*/ 120 /*FUNCTION IntInput::GetInputValue( double* pvalue,GaussTria* gauss){{{1*/121 void IntInput::GetInputValue( double* pvalue,GaussTria* gauss){_error_("not supported yet!");}120 /*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ 121 void IntInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not supported yet!");} 122 122 /*}}}*/ 123 /*FUNCTION IntInput::GetInputValue( double* pvalue,GaussPenta* gauss){{{1*/124 void IntInput::GetInputValue( double* pvalue,GaussPenta* gauss){_error_("not supported yet!");}123 /*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ 124 void IntInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not supported yet!");} 125 125 /*}}}*/ 126 /*FUNCTION IntInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){{{1*/127 void IntInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){_error_("not supported yet!");}126 /*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ 127 void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");} 128 128 /*}}}*/ 129 /*FUNCTION IntInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){{{1*/130 void IntInput::GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}129 /*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 130 void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");} 131 131 /*}}}*/ 132 /*FUNCTION IntInput::ChangeEnum{{{ 1*/132 /*FUNCTION IntInput::ChangeEnum{{{*/ 133 133 void IntInput::ChangeEnum(int newenumtype){ 134 134 this->enum_type=newenumtype; 135 135 } 136 136 /*}}}*/ 137 /*FUNCTION IntInput::SquareMin{{{ 1*/138 void IntInput::SquareMin( double* psquaremin, bool process_units,Parameters* parameters){137 /*FUNCTION IntInput::SquareMin{{{*/ 138 void IntInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ 139 139 140 140 /*square min of an integer is the square of the integer itself: */ 141 *psquaremin=pow(( double)value,2);141 *psquaremin=pow((IssmDouble)value,2); 142 142 } 143 143 /*}}}*/ 144 /*FUNCTION IntInput::Scale{{{ 1*/145 void IntInput::Scale( double scale_factor){146 double dvalue=(double)value*scale_factor;147 value= (int)dvalue;144 /*FUNCTION IntInput::Scale{{{*/ 145 void IntInput::Scale(IssmDouble scale_factor){ 146 IssmDouble dvalue=(IssmDouble)value*scale_factor; 147 value=reCast<int>(dvalue); 148 148 } 149 149 /*}}}*/ 150 /*FUNCTION IntInput::AXPY{{{ 1*/151 void IntInput::AXPY(Input* xinput, double scalar){150 /*FUNCTION IntInput::AXPY{{{*/ 151 void IntInput::AXPY(Input* xinput,IssmDouble scalar){ 152 152 153 double dvalue;153 IssmDouble dvalue; 154 154 IntInput* xintinput=NULL; 155 155 … … 161 161 162 162 case IntInputEnum: 163 dvalue=( double)this->value+scalar*(double)xintinput->value;164 this->value= (int)dvalue;163 dvalue=(IssmDouble)this->value+scalar*(IssmDouble)xintinput->value; 164 this->value=reCast<int>(dvalue); 165 165 return; 166 166 167 167 default: 168 _error _("not implemented yet");168 _error2_("not implemented yet"); 169 169 } 170 170 171 171 } 172 172 /*}}}*/ 173 /*FUNCTION IntInput::Constrain{{{ 1*/174 void IntInput::Constrain( double cm_min, double cm_max){173 /*FUNCTION IntInput::Constrain{{{*/ 174 void IntInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){ 175 175 176 if(! isnan(cm_min)) if (this->value<cm_min)this->value=(int)cm_min;177 if(! isnan(cm_max)) if (this->value>cm_max)this->value=(int)cm_max;176 if(!xIsNan<IssmDouble>(cm_min)) if (this->value<cm_min)this->value=reCast<int>(cm_min); 177 if(!xIsNan<IssmDouble>(cm_max)) if (this->value>cm_max)this->value=reCast<int>(cm_max); 178 178 179 179 } 180 180 /*}}}*/ 181 /*FUNCTION IntInput::GetVectorFromInputs{{{ 1*/181 /*FUNCTION IntInput::GetVectorFromInputs{{{*/ 182 182 void IntInput::GetVectorFromInputs(Vector* vector,int* doflist){ 183 183 184 _error _("not supporte yet!");184 _error2_("not supporte yet!"); 185 185 186 186 } 187 187 /*}}}*/ 188 /*FUNCTION IntInput::GetValuesPtr{{{ 1*/189 void IntInput::GetValuesPtr( double** pvalues,int* pnum_values){188 /*FUNCTION IntInput::GetValuesPtr{{{*/ 189 void IntInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ 190 190 191 _error _("not supported yet!");191 _error2_("not supported yet!"); 192 192 193 193 } 194 194 /*}}}*/ 195 /*FUNCTION IntInput::Configure{{{ 1*/195 /*FUNCTION IntInput::Configure{{{*/ 196 196 void IntInput::Configure(Parameters* parameters){ 197 197 /*do nothing: */ -
issm/trunk/src/c/objects/Inputs/IntInput.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../../include/include.h" … … 21 21 IssmInt value; 22 22 23 /*IntInput constructors, destructors: {{{ 1*/23 /*IntInput constructors, destructors: {{{*/ 24 24 IntInput(); 25 25 IntInput(int enum_type,IssmInt value); 26 26 ~IntInput(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{ */ 29 29 void Echo(); 30 30 void DeepEcho(); … … 34 34 Object* copy(); 35 35 /*}}}*/ 36 /*IntInput management: {{{ 1*/36 /*IntInput management: {{{*/ 37 37 int InstanceEnum(); 38 38 Input* SpawnTriaInput(int* indices); 39 Input* PointwiseDivide(Input* inputB){_error _("not implemented yet");};40 Input* PointwiseMin(Input* inputB){_error _("not implemented yet");};41 Input* PointwiseMax(Input* inputB){_error _("not implemented yet");};42 ElementResult* SpawnResult(int step, double time);43 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};39 Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; 40 Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; 41 Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; 42 ElementResult* SpawnResult(int step, IssmDouble time); 43 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 44 44 void Configure(Parameters* parameters); 45 45 /*}}}*/ 46 /*numerics: {{{ 1*/46 /*numerics: {{{*/ 47 47 void GetInputValue(bool* pvalue); 48 48 void GetInputValue(int* pvalue); 49 void GetInputValue( double* pvalue);50 void GetInputValue( double* pvalue,GaussTria* gauss);51 void GetInputValue( double* pvalue,GaussPenta* gauss);52 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};53 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};54 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};55 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};56 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss);57 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss);58 void GetInputAverage( double* pvalue){_error_("not implemented yet");};59 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};60 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};61 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};62 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};63 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};64 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};65 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};49 void GetInputValue(IssmDouble* pvalue); 50 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); 51 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 55 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); 58 void GetInputAverage(IssmDouble* pvalue){_error2_("not implemented yet");}; 59 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 60 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 61 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 62 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 63 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 64 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 65 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 66 66 void ChangeEnum(int newenumtype); 67 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters);68 void ConstrainMin( double minimum){_error_("not implemented yet");};69 void Scale( double scale_factor);70 void ArtificialNoise( double min,double max){_error_("not implemented yet");};71 void AXPY(Input* xinput, double scalar);72 void Constrain( double cm_min, double cm_max);73 double InfinityNorm(void){_error_("InfinityNorm not implemented for integers");};74 double Max(void){_error_("Max not implemented for integers");};75 double MaxAbs(void){_error_("Max not implemented for integers");};76 double Min(void){_error_("Min not implemented for integers");};77 double MinAbs(void){_error_("Min not implemented for integers");};78 void Extrude(void){_error _("not supported yet");};79 void VerticallyIntegrate(Input* thickness_input){_error _("not supported yet");};67 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); 68 void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; 69 void Scale(IssmDouble scale_factor); 70 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 71 void AXPY(Input* xinput,IssmDouble scalar); 72 void Constrain(IssmDouble cm_min, IssmDouble cm_max); 73 IssmDouble InfinityNorm(void){_error2_("InfinityNorm not implemented for integers");}; 74 IssmDouble Max(void){_error2_("Max not implemented for integers");}; 75 IssmDouble MaxAbs(void){_error2_("Max not implemented for integers");}; 76 IssmDouble Min(void){_error2_("Min not implemented for integers");}; 77 IssmDouble MinAbs(void){_error2_("Min not implemented for integers");}; 78 void Extrude(void){_error2_("not supported yet");}; 79 void VerticallyIntegrate(Input* thickness_input){_error2_("not supported yet");}; 80 80 void GetVectorFromInputs(Vector* vector,int* doflist); 81 void GetValuesPtr( double** pvalues,int* pnum_values);81 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); 82 82 /*}}}*/ 83 83 -
issm/trunk/src/c/objects/Inputs/PentaP1Input.cpp
r12330 r12706 18 18 19 19 /*PentaP1Input constructors and destructor*/ 20 /*FUNCTION PentaP1Input::PentaP1Input(){{{ 1*/20 /*FUNCTION PentaP1Input::PentaP1Input(){{{*/ 21 21 PentaP1Input::PentaP1Input(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION PentaP1Input::PentaP1Input(int in_enum_type, double* values){{{1*/26 PentaP1Input::PentaP1Input(int in_enum_type, double* in_values)25 /*FUNCTION PentaP1Input::PentaP1Input(int in_enum_type,IssmDouble* values){{{*/ 26 PentaP1Input::PentaP1Input(int in_enum_type,IssmDouble* in_values) 27 27 :PentaRef(1) 28 28 { … … 41 41 } 42 42 /*}}}*/ 43 /*FUNCTION PentaP1Input::~PentaP1Input(){{{ 1*/43 /*FUNCTION PentaP1Input::~PentaP1Input(){{{*/ 44 44 PentaP1Input::~PentaP1Input(){ 45 45 return; … … 48 48 49 49 /*Object virtual functions definitions:*/ 50 /*FUNCTION PentaP1Input::Echo {{{ 1*/50 /*FUNCTION PentaP1Input::Echo {{{*/ 51 51 void PentaP1Input::Echo(void){ 52 52 this->DeepEcho(); 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION PentaP1Input::DeepEcho{{{ 1*/55 /*FUNCTION PentaP1Input::DeepEcho{{{*/ 56 56 void PentaP1Input::DeepEcho(void){ 57 57 58 printf("PentaP1Input:\n");59 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));60 printf(" values: [%g %g %g %g %g %g]\n",this->values[0],this->values[1],this->values[2],this->values[3],this->values[4],this->values[5]);61 } 62 /*}}}*/ 63 /*FUNCTION PentaP1Input::Id{{{ 1*/58 _printLine_("PentaP1Input:"); 59 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 60 _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << " " << this->values[3] << " " << this->values[4] << " " << this->values[5] << "]"); 61 } 62 /*}}}*/ 63 /*FUNCTION PentaP1Input::Id{{{*/ 64 64 int PentaP1Input::Id(void){ return -1; } 65 65 /*}}}*/ 66 /*FUNCTION PentaP1Input::MyRank{{{ 1*/66 /*FUNCTION PentaP1Input::MyRank{{{*/ 67 67 int PentaP1Input::MyRank(void){ 68 68 extern int my_rank; … … 70 70 } 71 71 /*}}}*/ 72 /*FUNCTION PentaP1Input::ObjectEnum{{{ 1*/72 /*FUNCTION PentaP1Input::ObjectEnum{{{*/ 73 73 int PentaP1Input::ObjectEnum(void){ 74 74 … … 79 79 80 80 /*PentaP1Input management*/ 81 /*FUNCTION PentaP1Input::copy{{{ 1*/81 /*FUNCTION PentaP1Input::copy{{{*/ 82 82 Object* PentaP1Input::copy() { 83 83 … … 86 86 } 87 87 /*}}}*/ 88 /*FUNCTION PentaP1Input::InstanceEnum{{{ 1*/88 /*FUNCTION PentaP1Input::InstanceEnum{{{*/ 89 89 int PentaP1Input::InstanceEnum(void){ 90 90 … … 93 93 } 94 94 /*}}}*/ 95 /*FUNCTION PentaP1Input::SpawnTriaInput{{{ 1*/95 /*FUNCTION PentaP1Input::SpawnTriaInput{{{*/ 96 96 Input* PentaP1Input::SpawnTriaInput(int* indices){ 97 97 98 98 /*output*/ 99 99 TriaP1Input* outinput=NULL; 100 double newvalues[3];100 IssmDouble newvalues[3]; 101 101 102 102 /*Loop over the new indices*/ … … 118 118 } 119 119 /*}}}*/ 120 /*FUNCTION PentaP1Input::SpawnResult{{{ 1*/121 ElementResult* PentaP1Input::SpawnResult(int step, double time){120 /*FUNCTION PentaP1Input::SpawnResult{{{*/ 121 ElementResult* PentaP1Input::SpawnResult(int step, IssmDouble time){ 122 122 123 123 return new PentaP1ElementResult(this->enum_type,this->values,step,time); … … 127 127 128 128 /*Object functions*/ 129 /*FUNCTION PentaP1Input::GetInputValue( double* pvalue,GaussPenta* gauss){{{1*/130 void PentaP1Input::GetInputValue( double* pvalue,GaussPenta* gauss){129 /*FUNCTION PentaP1Input::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ 130 void PentaP1Input::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){ 131 131 132 132 /*Call PentaRef function*/ … … 135 135 } 136 136 /*}}}*/ 137 /*FUNCTION PentaP1Input::GetInputDerivativeValue( double* p, double* xyz_list, GaussPenta* gauss){{{1*/138 void PentaP1Input::GetInputDerivativeValue( double* p, double* xyz_list, GaussPenta* gauss){137 /*FUNCTION PentaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ 138 void PentaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussPenta* gauss){ 139 139 140 140 /*Call PentaRef function*/ … … 142 142 } 143 143 /*}}}*/ 144 /*FUNCTION PentaP1Input::GetVxStrainRate3d{{{ 1*/145 void PentaP1Input::GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){144 /*FUNCTION PentaP1Input::GetVxStrainRate3d{{{*/ 145 void PentaP1Input::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ 146 146 int i,j; 147 147 148 148 const int numnodes=6; 149 149 const int DOFVELOCITY=3; 150 double B[8][27];151 double B_reduced[6][DOFVELOCITY*numnodes];152 double velocity[numnodes][DOFVELOCITY];150 IssmDouble B[8][27]; 151 IssmDouble B_reduced[6][DOFVELOCITY*numnodes]; 152 IssmDouble velocity[numnodes][DOFVELOCITY]; 153 153 154 154 /*Get B matrix: */ … … 187 187 } 188 188 /*}}}*/ 189 /*FUNCTION PentaP1Input::GetVyStrainRate3d{{{ 1*/190 void PentaP1Input::GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){189 /*FUNCTION PentaP1Input::GetVyStrainRate3d{{{*/ 190 void PentaP1Input::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ 191 191 int i,j; 192 192 193 193 const int numnodes=6; 194 194 const int DOFVELOCITY=3; 195 double B[8][27];196 double B_reduced[6][DOFVELOCITY*numnodes];197 double velocity[numnodes][DOFVELOCITY];195 IssmDouble B[8][27]; 196 IssmDouble B_reduced[6][DOFVELOCITY*numnodes]; 197 IssmDouble velocity[numnodes][DOFVELOCITY]; 198 198 199 199 /*Get B matrix: */ … … 232 232 } 233 233 /*}}}*/ 234 /*FUNCTION PentaP1Input::GetVzStrainRate3d{{{ 1*/235 void PentaP1Input::GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){234 /*FUNCTION PentaP1Input::GetVzStrainRate3d{{{*/ 235 void PentaP1Input::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){ 236 236 int i,j; 237 237 238 238 const int numnodes=6; 239 239 const int DOFVELOCITY=3; 240 double B[8][27];241 double B_reduced[6][DOFVELOCITY*numnodes];242 double velocity[numnodes][DOFVELOCITY];240 IssmDouble B[8][27]; 241 IssmDouble B_reduced[6][DOFVELOCITY*numnodes]; 242 IssmDouble velocity[numnodes][DOFVELOCITY]; 243 243 244 244 /*Get B matrix: */ … … 278 278 } 279 279 /*}}}*/ 280 /*FUNCTION PentaP1Input::GetVxStrainRate3dPattyn{{{ 1*/281 void PentaP1Input::GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){282 283 int i; 284 const int numnodes=6; 285 double B[5][NDOF2*numnodes];286 double velocity[numnodes][NDOF2];280 /*FUNCTION PentaP1Input::GetVxStrainRate3dPattyn{{{*/ 281 void PentaP1Input::GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ 282 283 int i; 284 const int numnodes=6; 285 IssmDouble B[5][NDOF2*numnodes]; 286 IssmDouble velocity[numnodes][NDOF2]; 287 287 288 288 /*Get B matrix: */ … … 302 302 } 303 303 /*}}}*/ 304 /*FUNCTION PentaP1Input::GetVyStrainRate3dPattyn{{{ 1*/305 void PentaP1Input::GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){306 307 int i; 308 const int numnodes=6; 309 double B[5][NDOF2*numnodes];310 double velocity[numnodes][NDOF2];304 /*FUNCTION PentaP1Input::GetVyStrainRate3dPattyn{{{*/ 305 void PentaP1Input::GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ 306 307 int i; 308 const int numnodes=6; 309 IssmDouble B[5][NDOF2*numnodes]; 310 IssmDouble velocity[numnodes][NDOF2]; 311 311 312 312 /*Get B matrix: */ … … 326 326 } 327 327 /*}}}*/ 328 /*FUNCTION PentaP1Input::ChangeEnum{{{ 1*/328 /*FUNCTION PentaP1Input::ChangeEnum{{{*/ 329 329 void PentaP1Input::ChangeEnum(int newenumtype){ 330 330 this->enum_type=newenumtype; 331 331 } 332 332 /*}}}*/ 333 /*FUNCTION PentaP1Input::GetInputAverage{{{ 1*/334 void PentaP1Input::GetInputAverage( double* pvalue){333 /*FUNCTION PentaP1Input::GetInputAverage{{{*/ 334 void PentaP1Input::GetInputAverage(IssmDouble* pvalue){ 335 335 *pvalue=1./6.*(values[0]+values[1]+values[2]+values[3]+values[4]+values[5]); 336 336 } … … 338 338 339 339 /*Intermediary*/ 340 /*FUNCTION PentaP1Input::SquareMin{{{ 1*/341 void PentaP1Input::SquareMin( double* psquaremin, bool process_units,Parameters* parameters){342 343 int i; 344 const int numnodes=6; 345 double valuescopy[numnodes];346 double squaremin;340 /*FUNCTION PentaP1Input::SquareMin{{{*/ 341 void PentaP1Input::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ 342 343 int i; 344 const int numnodes=6; 345 IssmDouble valuescopy[numnodes]; 346 IssmDouble squaremin; 347 347 348 348 /*First, copy values, to process units if requested: */ … … 361 361 } 362 362 /*}}}*/ 363 /*FUNCTION PentaP1Input::ConstrainMin{{{ 1*/364 void PentaP1Input::ConstrainMin( double minimum){363 /*FUNCTION PentaP1Input::ConstrainMin{{{*/ 364 void PentaP1Input::ConstrainMin(IssmDouble minimum){ 365 365 366 366 int i; … … 370 370 } 371 371 /*}}}*/ 372 /*FUNCTION PentaP1Input::InfinityNorm{{{ 1*/373 double PentaP1Input::InfinityNorm(void){372 /*FUNCTION PentaP1Input::InfinityNorm{{{*/ 373 IssmDouble PentaP1Input::InfinityNorm(void){ 374 374 375 375 /*Output*/ 376 376 const int numnodes=6; 377 double norm=0;377 IssmDouble norm=0; 378 378 379 379 for(int i=0;i<numnodes;i++) if(fabs(values[i])>norm) norm=fabs(values[i]); … … 381 381 } 382 382 /*}}}*/ 383 /*FUNCTION PentaP1Input::Max{{{ 1*/384 double PentaP1Input::Max(void){385 386 const int numnodes=6; 387 double max=values[0];383 /*FUNCTION PentaP1Input::Max{{{*/ 384 IssmDouble PentaP1Input::Max(void){ 385 386 const int numnodes=6; 387 IssmDouble max=values[0]; 388 388 389 389 for(int i=1;i<numnodes;i++){ … … 393 393 } 394 394 /*}}}*/ 395 /*FUNCTION PentaP1Input::MaxAbs{{{ 1*/396 double PentaP1Input::MaxAbs(void){397 398 const int numnodes=6; 399 double max=fabs(values[0]);395 /*FUNCTION PentaP1Input::MaxAbs{{{*/ 396 IssmDouble PentaP1Input::MaxAbs(void){ 397 398 const int numnodes=6; 399 IssmDouble max=fabs(values[0]); 400 400 401 401 for(int i=1;i<numnodes;i++){ … … 405 405 } 406 406 /*}}}*/ 407 /*FUNCTION PentaP1Input::Min{{{ 1*/408 double PentaP1Input::Min(void){409 410 const int numnodes=6; 411 double min=values[0];407 /*FUNCTION PentaP1Input::Min{{{*/ 408 IssmDouble PentaP1Input::Min(void){ 409 410 const int numnodes=6; 411 IssmDouble min=values[0]; 412 412 413 413 for(int i=1;i<numnodes;i++){ … … 417 417 } 418 418 /*}}}*/ 419 /*FUNCTION PentaP1Input::MinAbs{{{ 1*/420 double PentaP1Input::MinAbs(void){421 422 const int numnodes=6; 423 double min=fabs(values[0]);419 /*FUNCTION PentaP1Input::MinAbs{{{*/ 420 IssmDouble PentaP1Input::MinAbs(void){ 421 422 const int numnodes=6; 423 IssmDouble min=fabs(values[0]); 424 424 425 425 for(int i=1;i<numnodes;i++){ … … 429 429 } 430 430 /*}}}*/ 431 /*FUNCTION PentaP1Input::Scale{{{ 1*/432 void PentaP1Input::Scale( double scale_factor){431 /*FUNCTION PentaP1Input::Scale{{{*/ 432 void PentaP1Input::Scale(IssmDouble scale_factor){ 433 433 434 434 int i; … … 438 438 } 439 439 /*}}}*/ 440 /*FUNCTION PentaP1Input::AXPY{{{ 1*/441 void PentaP1Input::AXPY(Input* xinput, double scalar){440 /*FUNCTION PentaP1Input::AXPY{{{*/ 441 void PentaP1Input::AXPY(Input* xinput,IssmDouble scalar){ 442 442 443 443 int i; … … 455 455 case ControlInputEnum:{ 456 456 ControlInput* cont_input=(ControlInput*)xinput; 457 if(cont_input->values->ObjectEnum()!=PentaP1InputEnum) _error _("not supported yet");457 if(cont_input->values->ObjectEnum()!=PentaP1InputEnum) _error2_("not supported yet"); 458 458 PentaP1Input* cast_input=(PentaP1Input*)cont_input->values; 459 459 for(i=0;i<numnodes;i++)this->values[i]=this->values[i]+scalar*(cast_input->values[i]);} 460 460 return; 461 461 default: 462 _error _("not implemented yet");463 } 464 465 } 466 /*}}}*/ 467 /*FUNCTION PentaP1Input::Constrain{{{ 1*/468 void PentaP1Input::Constrain( double cm_min, double cm_max){462 _error2_("not implemented yet"); 463 } 464 465 } 466 /*}}}*/ 467 /*FUNCTION PentaP1Input::Constrain{{{*/ 468 void PentaP1Input::Constrain(IssmDouble cm_min, IssmDouble cm_max){ 469 469 470 470 int i; 471 471 const int numnodes=6; 472 472 473 if(! isnan(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min;474 if(! isnan(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max;475 476 } 477 /*}}}*/ 478 /*FUNCTION PentaP1Input::Extrude{{{ 1*/473 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min; 474 if(!xIsNan<IssmDouble>(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max; 475 476 } 477 /*}}}*/ 478 /*FUNCTION PentaP1Input::Extrude{{{*/ 479 479 void PentaP1Input::Extrude(void){ 480 480 … … 485 485 } 486 486 /*}}}*/ 487 /*FUNCTION PentaP1Input::VerticallyIntegrate{{{ 1*/487 /*FUNCTION PentaP1Input::VerticallyIntegrate{{{*/ 488 488 void PentaP1Input::VerticallyIntegrate(Input* thickness_input){ 489 489 … … 492 492 const int numnodes = 6; 493 493 int num_thickness_values; 494 double *thickness_values = NULL;494 IssmDouble *thickness_values = NULL; 495 495 496 496 /*Check that input provided is a thickness*/ 497 if (thickness_input->InstanceEnum()!=ThicknessEnum) _error _("Input provided is not a Thickness (enum_type is %s)",EnumToStringx(thickness_input->InstanceEnum()));497 if (thickness_input->InstanceEnum()!=ThicknessEnum) _error2_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")"); 498 498 499 499 /*Get Thickness value pointer*/ … … 511 511 512 512 default: 513 _error _("not implemented yet");514 } 515 } 516 /*}}}*/ 517 /*FUNCTION PentaP1Input::PointwiseDivide{{{ 1*/513 _error2_("not implemented yet"); 514 } 515 } 516 /*}}}*/ 517 /*FUNCTION PentaP1Input::PointwiseDivide{{{*/ 518 518 Input* PentaP1Input::PointwiseDivide(Input* inputB){ 519 519 … … 526 526 int B_numvalues; 527 527 const int numnodes = 6; 528 double AdotBvalues[numnodes];528 IssmDouble AdotBvalues[numnodes]; 529 529 530 530 /*Check that inputB is of the same type*/ 531 if (inputB->ObjectEnum()!=PentaP1InputEnum) _error _("Operation not permitted because inputB is of type %s",EnumToStringx(inputB->ObjectEnum()));531 if (inputB->ObjectEnum()!=PentaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 532 532 xinputB=(PentaP1Input*)inputB; 533 533 … … 546 546 } 547 547 /*}}}*/ 548 /*FUNCTION PentaP1Input::PointwiseMin{{{ 1*/548 /*FUNCTION PentaP1Input::PointwiseMin{{{*/ 549 549 Input* PentaP1Input::PointwiseMin(Input* inputB){ 550 550 … … 557 557 int B_numvalues; 558 558 const int numnodes = 6; 559 double minvalues[numnodes];559 IssmDouble minvalues[numnodes]; 560 560 561 561 /*Check that inputB is of the same type*/ 562 if (inputB->ObjectEnum()!=PentaP1InputEnum) _error _("Operation not permitted because inputB is of type %s",EnumToStringx(inputB->ObjectEnum()));562 if (inputB->ObjectEnum()!=PentaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 563 563 xinputB=(PentaP1Input*)inputB; 564 564 … … 577 577 } 578 578 /*}}}*/ 579 /*FUNCTION PentaP1Input::PointwiseMax{{{ 1*/579 /*FUNCTION PentaP1Input::PointwiseMax{{{*/ 580 580 Input* PentaP1Input::PointwiseMax(Input* inputB){ 581 581 … … 588 588 int B_numvalues; 589 589 const int numnodes = 6; 590 double maxvalues[numnodes];590 IssmDouble maxvalues[numnodes]; 591 591 592 592 /*Check that inputB is of the same type*/ 593 if (inputB->ObjectEnum()!=PentaP1InputEnum) _error _("Operation not permitted because inputB is of type %s",EnumToStringx(inputB->ObjectEnum()));593 if (inputB->ObjectEnum()!=PentaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 594 594 xinputB=(PentaP1Input*)inputB; 595 595 … … 608 608 } 609 609 /*}}}*/ 610 /*FUNCTION PentaP1Input::GetVectorFromInputs{{{ 1*/610 /*FUNCTION PentaP1Input::GetVectorFromInputs{{{*/ 611 611 void PentaP1Input::GetVectorFromInputs(Vector* vector,int* doflist){ 612 612 … … 615 615 616 616 } /*}}}*/ 617 /*FUNCTION PentaP1Input::GetValuesPtr{{{ 1*/618 void PentaP1Input::GetValuesPtr( double** pvalues,int* pnum_values){617 /*FUNCTION PentaP1Input::GetValuesPtr{{{*/ 618 void PentaP1Input::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ 619 619 620 620 *pvalues=this->values; … … 623 623 } 624 624 /*}}}*/ 625 /*FUNCTION PentaP1Input::Configure{{{ 1*/625 /*FUNCTION PentaP1Input::Configure{{{*/ 626 626 void PentaP1Input::Configure(Parameters* parameters){ 627 627 /*do nothing: */ -
issm/trunk/src/c/objects/Inputs/PentaP1Input.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../Elements/PentaRef.h" … … 19 19 /*just hold 6 values for 6 vertices: */ 20 20 int enum_type; 21 double values[6];21 IssmDouble values[6]; 22 22 23 /*PentaP1Input constructors, destructors: {{{ 1*/23 /*PentaP1Input constructors, destructors: {{{*/ 24 24 PentaP1Input(); 25 PentaP1Input(int enum_type, double* values);25 PentaP1Input(int enum_type,IssmDouble* values); 26 26 ~PentaP1Input(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{ */ 29 29 void Echo(); 30 30 void DeepEcho(); … … 34 34 Object* copy(); 35 35 /*}}}*/ 36 /*PentaP1Input management: {{{ 1*/36 /*PentaP1Input management: {{{*/ 37 37 int InstanceEnum(); 38 38 Input* SpawnTriaInput(int* indices); … … 40 40 Input* PointwiseMin(Input* inputB); 41 41 Input* PointwiseMax(Input* inputB); 42 ElementResult* SpawnResult(int step, double time);43 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};42 ElementResult* SpawnResult(int step, IssmDouble time); 43 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 44 44 void Configure(Parameters* parameters); 45 45 /*}}}*/ 46 /*numerics: {{{ 1*/47 void GetInputValue(bool* pvalue){_error _("not implemented yet");};48 void GetInputValue(int* pvalue){_error _("not implemented yet");};49 void GetInputValue( double* pvalue){_error_("not implemented yet");};50 void GetInputValue( double* pvalue,GaussTria* gauss){_error_("not implemented yet");};51 void GetInputValue( double* pvalue,GaussPenta* gauss);52 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};53 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};54 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};55 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};56 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};57 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss);58 void GetInputAverage( double* pvalue);59 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};60 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};61 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss);62 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss);63 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss);64 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss);65 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss);46 /*numerics: {{{*/ 47 void GetInputValue(bool* pvalue){_error2_("not implemented yet");}; 48 void GetInputValue(int* pvalue){_error2_("not implemented yet");}; 49 void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");}; 50 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not implemented yet");}; 51 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 55 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); 58 void GetInputAverage(IssmDouble* pvalue); 59 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 60 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 61 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss); 62 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss); 63 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss); 64 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss); 65 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss); 66 66 void ChangeEnum(int newenumtype); 67 67 68 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters);69 void ConstrainMin( double minimum);70 void Scale( double scale_factor);71 void ArtificialNoise( double min,double max){_error_("not implemented yet");};72 void AXPY(Input* xinput, double scalar);73 void Constrain( double cm_min, double cm_max);74 double InfinityNorm(void);75 double Max(void);76 double MaxAbs(void);77 double Min(void);78 double MinAbs(void);68 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); 69 void ConstrainMin(IssmDouble minimum); 70 void Scale(IssmDouble scale_factor); 71 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 72 void AXPY(Input* xinput,IssmDouble scalar); 73 void Constrain(IssmDouble cm_min, IssmDouble cm_max); 74 IssmDouble InfinityNorm(void); 75 IssmDouble Max(void); 76 IssmDouble MaxAbs(void); 77 IssmDouble Min(void); 78 IssmDouble MinAbs(void); 79 79 void Extrude(void); 80 80 void VerticallyIntegrate(Input* thickness_input); 81 81 void GetVectorFromInputs(Vector* vector,int* doflist); 82 void GetValuesPtr( double** pvalues,int* pnum_values);82 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); 83 83 /*}}}*/ 84 84 -
issm/trunk/src/c/objects/Inputs/TransientInput.cpp
r12358 r12706 46 46 /*FUNCTION TransientInput::~TransientInput{{{*/ 47 47 TransientInput::~TransientInput(){ 48 x free((void**)&this->timesteps);48 xDelete<IssmDouble>(this->timesteps); 49 49 this->timesteps=NULL; 50 50 this->numtimesteps=0; … … 66 66 int i; 67 67 68 printf("TransientInput:\n");69 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));70 printf(" numtimesteps: %i\n",this->numtimesteps);71 printf("---inputs: \n");68 _printLine_("TransientInput:"); 69 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 70 _printLine_(" numtimesteps: " << this->numtimesteps); 71 _printLine_("---inputs: "); 72 72 for(i=0;i<this->numtimesteps;i++){ 73 printf(" time: %g \n",this->timesteps[i]);73 _printLine_(" time: " << this->timesteps[i] << " "); 74 74 ((Input*)this->inputs->GetObjectByOffset(i))->Echo(); 75 75 } … … 100 100 output->enum_type=this->enum_type; 101 101 output->numtimesteps=this->numtimesteps; 102 output->timesteps= (double*)xmalloc(this->numtimesteps*sizeof(double));103 memcpy(output->timesteps,this->timesteps,this->numtimesteps*sizeof( double));102 output->timesteps=xNew<IssmDouble>(this->numtimesteps); 103 memcpy(output->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmDouble)); 104 104 output->inputs=(Inputs*)this->inputs->Copy(); 105 105 output->parameters=this->parameters; … … 128 128 outinput->enum_type=this->enum_type; 129 129 outinput->numtimesteps=this->numtimesteps; 130 outinput->timesteps= (double*)xmalloc(this->numtimesteps*sizeof(double));131 memcpy(outinput->timesteps,this->timesteps,this->numtimesteps*sizeof( double));130 outinput->timesteps=xNew<IssmDouble>(this->numtimesteps); 131 memcpy(outinput->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmDouble)); 132 132 outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices); 133 133 outinput->parameters=this->parameters; … … 139 139 /*}}}*/ 140 140 /*FUNCTION TransientInput::SpawnResult{{{*/ 141 ElementResult* TransientInput::SpawnResult(int step, double time){141 ElementResult* TransientInput::SpawnResult(int step, IssmDouble time){ 142 142 143 143 ElementResult* elementresult=NULL; … … 156 156 157 157 /*Object functions*/ 158 /*FUNCTION TransientInput::GetInputValue( double* pvalue,GaussTria* gauss){{{*/159 void TransientInput::GetInputValue( double* pvalue,GaussTria* gauss){160 double time;158 /*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ 159 void TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){ 160 IssmDouble time; 161 161 162 162 /*First, recover current time from parameters: */ … … 172 172 } 173 173 /*}}}*/ 174 /*FUNCTION TransientInput::GetInputValue( double* pvalue,GaussPenta* gauss){{{*/175 void TransientInput::GetInputValue( double* pvalue,GaussPenta* gauss){176 double time;174 /*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ 175 void TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){ 176 IssmDouble time; 177 177 178 178 /*First, recover current time from parameters: */ … … 188 188 } 189 189 /*}}}*/ 190 /*FUNCTION TransientInput::GetInputValue( double* pvalue,GaussTria* gauss,double time){{{*/191 void TransientInput::GetInputValue( double* pvalue,GaussTria* gauss,double time){190 /*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){{{*/ 191 void TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){ 192 192 193 193 /*Retrieve interpolated values for this time step: */ … … 200 200 } 201 201 /*}}}*/ 202 /*FUNCTION TransientInput::GetInputValue( double* pvalue,GaussPenta* gauss,double time){{{*/203 void TransientInput::GetInputValue( double* pvalue,GaussPenta* gauss,double time){202 /*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){{{*/ 203 void TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){ 204 204 205 205 /*Retrieve interpolated values for this time step: */ … … 212 212 } 213 213 /*}}}*/ 214 /*FUNCTION TransientInput::GetInputDerivativeValue( double* p, double* xyz_list, GaussTria* gauss){{{*/215 void TransientInput::GetInputDerivativeValue( double* p, double* xyz_list, GaussTria* gauss){216 217 double time;214 /*FUNCTION TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/ 215 void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){ 216 217 IssmDouble time; 218 218 219 219 /*First, recover current time from parameters: */ … … 236 236 /*}}}*/ 237 237 /*FUNCTION TransientInput::GetInputAverage{{{*/ 238 void TransientInput::GetInputAverage( double* pvalue){238 void TransientInput::GetInputAverage(IssmDouble* pvalue){ 239 239 240 double time;240 IssmDouble time; 241 241 242 242 /*First, recover current time from parameters: */ … … 256 256 /*Intermediary*/ 257 257 /*FUNCTION TransientInput::AddTimeInput{{{*/ 258 void TransientInput::AddTimeInput(Input* input, double time){258 void TransientInput::AddTimeInput(Input* input,IssmDouble time){ 259 259 260 260 /*insert values at time step: */ … … 262 262 263 263 //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input); 264 double* old_timesteps=NULL;264 IssmDouble* old_timesteps=NULL; 265 265 266 266 if (this->numtimesteps > 0){ 267 old_timesteps= (double*)xmalloc(this->numtimesteps*sizeof(double));268 memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof( double));269 x free((void**)&this->timesteps);267 old_timesteps=xNew<IssmDouble>(this->numtimesteps); 268 memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(IssmDouble)); 269 xDelete<IssmDouble>(this->timesteps); 270 270 } 271 271 272 272 this->numtimesteps=this->numtimesteps+1; 273 this->timesteps= (double*)xmalloc(this->numtimesteps*sizeof(double));273 this->timesteps=xNew<IssmDouble>(this->numtimesteps); 274 274 275 275 if (this->numtimesteps > 1){ 276 memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof( double));277 x free((void**)&old_timesteps);276 memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(IssmDouble)); 277 xDelete<IssmDouble>(old_timesteps); 278 278 } 279 279 … … 285 285 /*}}}*/ 286 286 /*FUNCTION TransientInput::SquareMin{{{*/ 287 void TransientInput::SquareMin( double* psquaremin, bool process_units,Parameters* parameters){288 289 double time;287 void TransientInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ 288 289 IssmDouble time; 290 290 291 291 /*First, recover current time from parameters: */ … … 303 303 /*}}}*/ 304 304 /*FUNCTION TransientInput::InfinityNorm{{{*/ 305 double TransientInput::InfinityNorm(void){306 307 double time;308 double infnorm;305 IssmDouble TransientInput::InfinityNorm(void){ 306 307 IssmDouble time; 308 IssmDouble infnorm; 309 309 310 310 /*First, recover current time from parameters: */ … … 323 323 /*}}}*/ 324 324 /*FUNCTION TransientInput::Max{{{*/ 325 double TransientInput::Max(void){326 327 double time;328 double max;325 IssmDouble TransientInput::Max(void){ 326 327 IssmDouble time; 328 IssmDouble max; 329 329 330 330 /*First, recover current time from parameters: */ … … 343 343 /*}}}*/ 344 344 /*FUNCTION TransientInput::MaxAbs{{{*/ 345 double TransientInput::MaxAbs(void){346 347 double time;348 double maxabs;345 IssmDouble TransientInput::MaxAbs(void){ 346 347 IssmDouble time; 348 IssmDouble maxabs; 349 349 350 350 /*First, recover current time from parameters: */ … … 364 364 /*}}}*/ 365 365 /*FUNCTION TransientInput::Min{{{*/ 366 double TransientInput::Min(void){367 368 double time;369 double min;366 IssmDouble TransientInput::Min(void){ 367 368 IssmDouble time; 369 IssmDouble min; 370 370 371 371 /*First, recover current time from parameters: */ … … 385 385 /*}}}*/ 386 386 /*FUNCTION TransientInput::MinAbs{{{*/ 387 double TransientInput::MinAbs(void){388 389 double time;390 double minabs;387 IssmDouble TransientInput::MinAbs(void){ 388 389 IssmDouble time; 390 IssmDouble minabs; 391 391 392 392 /*First, recover current time from parameters: */ … … 407 407 void TransientInput::GetVectorFromInputs(Vector* vector,int* doflist){ 408 408 409 double time;409 IssmDouble time; 410 410 411 411 /*First, recover current time from parameters: */ … … 422 422 } /*}}}*/ 423 423 /*FUNCTION TransientInput::GetTimeInput{{{*/ 424 Input* TransientInput::GetTimeInput( double intime){424 Input* TransientInput::GetTimeInput(IssmDouble intime){ 425 425 426 426 int i,j; 427 double deltat;428 double alpha1,alpha2;427 IssmDouble deltat; 428 IssmDouble alpha1,alpha2; 429 429 bool found=false; 430 430 Input* input=NULL; … … 474 474 } 475 475 } 476 if(!found)_error _("did not find time interval on which to interpolate forcing values!");476 if(!found)_error2_("did not find time interval on which to interpolate forcing values!"); 477 477 478 478 /*Assign output pointer*/ -
issm/trunk/src/c/objects/Inputs/TransientInput.h
r12359 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 class GaussTria; … … 20 20 int numtimesteps; 21 21 Inputs* inputs; 22 double* timesteps;22 IssmDouble* timesteps; 23 23 Parameters* parameters; //to find current time. 24 24 25 /*TransientInput constructors, destructors: {{{ 1*/25 /*TransientInput constructors, destructors: {{{*/ 26 26 TransientInput(); 27 27 TransientInput(int enum_type); 28 28 ~TransientInput(); 29 void AddTimeInput(Input* input, double time);29 void AddTimeInput(Input* input,IssmDouble time); 30 30 /*}}}*/ 31 /*Object virtual functions definitions:{{{ 1*/31 /*Object virtual functions definitions:{{{*/ 32 32 void Echo(); 33 33 void DeepEcho(); … … 37 37 Object* copy(); 38 38 /*}}}*/ 39 /*TransientInput management: {{{ 1*/39 /*TransientInput management: {{{*/ 40 40 int InstanceEnum(); 41 41 Input* SpawnTriaInput(int* indices); 42 Input* PointwiseDivide(Input* forcingB){_error _("not implemented yet");};43 Input* PointwiseMin(Input* forcingB){_error _("not implemented yet");};44 Input* PointwiseMax(Input* forcingB){_error _("not implemented yet");};45 ElementResult* SpawnResult(int step, double time);42 Input* PointwiseDivide(Input* forcingB){_error2_("not implemented yet");}; 43 Input* PointwiseMin(Input* forcingB){_error2_("not implemented yet");}; 44 Input* PointwiseMax(Input* forcingB){_error2_("not implemented yet");}; 45 ElementResult* SpawnResult(int step, IssmDouble time); 46 46 void Configure(Parameters* parameters); 47 47 /*}}}*/ 48 /*numerics: {{{ 1*/49 void GetInputValue(bool* pvalue){_error _("not implemented yet");};50 void GetInputValue(int* pvalue){_error _("not implemented yet");};51 void GetInputValue( double* pvalue){_error_("not implemented yet");};52 void GetInputValue( double* pvalue,GaussTria* gauss);53 void GetInputValue( double* pvalue,GaussPenta* gauss);54 void GetInputValue( double* pvalue,GaussTria* gauss,double time);55 void GetInputValue( double* pvalue,GaussPenta* gauss,double time);56 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};57 void GetInputValue( double* pvalue,GaussPenta* gauss ,int index){_error_("not implemented yet");};58 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss);59 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};60 void GetInputAverage( double* pvalue);61 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};62 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){_error_("not implemented yet");};63 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};64 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};65 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};66 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};67 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};48 /*numerics: {{{*/ 49 void GetInputValue(bool* pvalue){_error2_("not implemented yet");}; 50 void GetInputValue(int* pvalue){_error2_("not implemented yet");}; 51 void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");}; 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time); 55 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 56 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 57 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; 58 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 59 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 60 void GetInputAverage(IssmDouble* pvalue); 61 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 62 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; 63 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 64 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 65 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 66 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 67 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 68 68 void ChangeEnum(int newenumtype); 69 69 70 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters);71 void ConstrainMin( double minimum){_error_("not implemented yet");};72 void Scale( double scale_factor){_error_("not implemented yet");};73 void ArtificialNoise( double min,double max){_error_("not implemented yet");};74 void AXPY(Input* xforcing, double scalar){_error_("not implemented yet");};75 void Constrain( double cm_min, double cm_max){_error_("not implemented yet");};76 double InfinityNorm(void);77 double Max(void);78 double MaxAbs(void);79 double Min(void);80 double MinAbs(void);81 void Extrude(void){_error _("not supported yet");}82 void VerticallyIntegrate(Input* thickness_forcing){_error _("not supported yet");};70 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); 71 void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; 72 void Scale(IssmDouble scale_factor){_error2_("not implemented yet");}; 73 void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; 74 void AXPY(Input* xforcing,IssmDouble scalar){_error2_("not implemented yet");}; 75 void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error2_("not implemented yet");}; 76 IssmDouble InfinityNorm(void); 77 IssmDouble Max(void); 78 IssmDouble MaxAbs(void); 79 IssmDouble Min(void); 80 IssmDouble MinAbs(void); 81 void Extrude(void){_error2_("not supported yet");} 82 void VerticallyIntegrate(Input* thickness_forcing){_error2_("not supported yet");}; 83 83 void GetVectorFromInputs(Vector* vector,int* doflist); 84 void GetValuesPtr( double** pvalues,int* pnum_values){_error_("not supported yet");};85 void GetTimeValues( double* values,double time){_error_("not implemented yet");};86 Input* GetTimeInput( double time);84 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error2_("not supported yet");}; 85 void GetTimeValues(IssmDouble* values,IssmDouble time){_error2_("not implemented yet");}; 86 Input* GetTimeInput(IssmDouble time); 87 87 /*}}}*/ 88 88 -
issm/trunk/src/c/objects/Inputs/TriaP1Input.cpp
r12330 r12706 18 18 19 19 /*TriaP1Input constructors and destructor*/ 20 /*FUNCTION TriaP1Input::TriaP1Input(){{{ 1*/20 /*FUNCTION TriaP1Input::TriaP1Input(){{{*/ 21 21 TriaP1Input::TriaP1Input(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION TriaP1Input::TriaP1Input(int in_enum_type, double* values){{{1*/26 TriaP1Input::TriaP1Input(int in_enum_type, double* in_values)25 /*FUNCTION TriaP1Input::TriaP1Input(int in_enum_type,IssmDouble* values){{{*/ 26 TriaP1Input::TriaP1Input(int in_enum_type,IssmDouble* in_values) 27 27 :TriaRef(1) 28 28 { … … 41 41 } 42 42 /*}}}*/ 43 /*FUNCTION TriaP1Input::~TriaP1Input(){{{ 1*/43 /*FUNCTION TriaP1Input::~TriaP1Input(){{{*/ 44 44 TriaP1Input::~TriaP1Input(){ 45 45 return; … … 48 48 49 49 /*Object virtual functions definitions:*/ 50 /*FUNCTION TriaP1Input::Echo {{{ 1*/50 /*FUNCTION TriaP1Input::Echo {{{*/ 51 51 void TriaP1Input::Echo(void){ 52 52 this->DeepEcho(); 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION TriaP1Input::DeepEcho{{{ 1*/55 /*FUNCTION TriaP1Input::DeepEcho{{{*/ 56 56 void TriaP1Input::DeepEcho(void){ 57 57 58 printf("TriaP1Input:\n");59 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));60 printf(" values: [%g %g %g]\n",this->values[0],this->values[1],this->values[2]);61 } 62 /*}}}*/ 63 /*FUNCTION TriaP1Input::Id{{{ 1*/58 _printLine_("TriaP1Input:"); 59 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 60 _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << "]"); 61 } 62 /*}}}*/ 63 /*FUNCTION TriaP1Input::Id{{{*/ 64 64 int TriaP1Input::Id(void){ return -1; } 65 65 /*}}}*/ 66 /*FUNCTION TriaP1Input::MyRank{{{ 1*/66 /*FUNCTION TriaP1Input::MyRank{{{*/ 67 67 int TriaP1Input::MyRank(void){ 68 68 extern int my_rank; … … 70 70 } 71 71 /*}}}*/ 72 /*FUNCTION TriaP1Input::ObjectEnum{{{ 1*/72 /*FUNCTION TriaP1Input::ObjectEnum{{{*/ 73 73 int TriaP1Input::ObjectEnum(void){ 74 74 … … 77 77 } 78 78 /*}}}*/ 79 /*FUNCTION TriaP1Input::copy{{{ 1*/79 /*FUNCTION TriaP1Input::copy{{{*/ 80 80 Object* TriaP1Input::copy() { 81 81 … … 86 86 87 87 /*TriaP1Input management*/ 88 /*FUNCTION TriaP1Input::InstanceEnum{{{ 1*/88 /*FUNCTION TriaP1Input::InstanceEnum{{{*/ 89 89 int TriaP1Input::InstanceEnum(void){ 90 90 … … 93 93 } 94 94 /*}}}*/ 95 /*FUNCTION TriaP1Input::SpawnTriaInput{{{ 1*/95 /*FUNCTION TriaP1Input::SpawnTriaInput{{{*/ 96 96 Input* TriaP1Input::SpawnTriaInput(int* indices){ 97 97 … … 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION TriaP1Input::SpawnResult{{{ 1*/110 ElementResult* TriaP1Input::SpawnResult(int step, double time){109 /*FUNCTION TriaP1Input::SpawnResult{{{*/ 110 ElementResult* TriaP1Input::SpawnResult(int step, IssmDouble time){ 111 111 112 112 return new TriaP1ElementResult(this->enum_type,this->values,step,time); … … 116 116 117 117 /*Object functions*/ 118 /*FUNCTION TriaP1Input::GetInputValue( double* pvalue,GaussTria* gauss){{{1*/119 void TriaP1Input::GetInputValue( double* pvalue,GaussTria* gauss){118 /*FUNCTION TriaP1Input::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ 119 void TriaP1Input::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){ 120 120 121 121 /*Call TriaRef function*/ … … 124 124 } 125 125 /*}}}*/ 126 /*FUNCTION TriaP1Input::GetInputDerivativeValue( double* p, double* xyz_list, GaussTria* gauss){{{1*/127 void TriaP1Input::GetInputDerivativeValue( double* p, double* xyz_list, GaussTria* gauss){126 /*FUNCTION TriaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/ 127 void TriaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){ 128 128 129 129 /*Call TriaRef function*/ … … 131 131 } 132 132 /*}}}*/ 133 /*FUNCTION TriaP1Input::GetVxStrainRate2d{{{ 1*/134 void TriaP1Input::GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss){133 /*FUNCTION TriaP1Input::GetVxStrainRate2d{{{*/ 134 void TriaP1Input::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){ 135 135 136 136 /*Intermediary*/ 137 137 int i; 138 138 const int numnodes=3; 139 double B[3][NDOF2*numnodes];140 double velocity[3][NDOF2];139 IssmDouble B[3][NDOF2*numnodes]; 140 IssmDouble velocity[3][NDOF2]; 141 141 142 142 /*Get B matrix: */ … … 154 154 } 155 155 /*}}}*/ 156 /*FUNCTION TriaP1Input::GetVyStrainRate2d{{{ 1*/157 void TriaP1Input::GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss){156 /*FUNCTION TriaP1Input::GetVyStrainRate2d{{{*/ 157 void TriaP1Input::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){ 158 158 159 159 /*Intermediary*/ 160 160 int i; 161 161 const int numnodes=3; 162 double B[3][NDOF2*numnodes];163 double velocity[3][NDOF2];162 IssmDouble B[3][NDOF2*numnodes]; 163 IssmDouble velocity[3][NDOF2]; 164 164 165 165 /*Get B matrix: */ … … 177 177 } 178 178 /*}}}*/ 179 /*FUNCTION TriaP1Input::ChangeEnum{{{ 1*/179 /*FUNCTION TriaP1Input::ChangeEnum{{{*/ 180 180 void TriaP1Input::ChangeEnum(int newenumtype){ 181 181 this->enum_type=newenumtype; 182 182 } 183 183 /*}}}*/ 184 /*FUNCTION TriaP1Input::GetInputAverage{{{ 1*/185 void TriaP1Input::GetInputAverage( double* pvalue){184 /*FUNCTION TriaP1Input::GetInputAverage{{{*/ 185 void TriaP1Input::GetInputAverage(IssmDouble* pvalue){ 186 186 *pvalue=1./3.*(values[0]+values[1]+values[2]); 187 187 } … … 189 189 190 190 /*Intermediary*/ 191 /*FUNCTION TriaP1Input::SquareMin{{{ 1*/192 void TriaP1Input::SquareMin( double* psquaremin, bool process_units,Parameters* parameters){193 194 int i; 195 const int numnodes=3; 196 double valuescopy[numnodes];197 double squaremin;191 /*FUNCTION TriaP1Input::SquareMin{{{*/ 192 void TriaP1Input::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ 193 194 int i; 195 const int numnodes=3; 196 IssmDouble valuescopy[numnodes]; 197 IssmDouble squaremin; 198 198 199 199 /*First, copy values, to process units if requested: */ … … 212 212 } 213 213 /*}}}*/ 214 /*FUNCTION TriaP1Input::ContrainMin{{{ 1*/215 void TriaP1Input::ConstrainMin( double minimum){214 /*FUNCTION TriaP1Input::ContrainMin{{{*/ 215 void TriaP1Input::ConstrainMin(IssmDouble minimum){ 216 216 217 217 int i; … … 221 221 } 222 222 /*}}}*/ 223 /*FUNCTION TriaP1Input::InfinityNorm{{{ 1*/224 double TriaP1Input::InfinityNorm(void){223 /*FUNCTION TriaP1Input::InfinityNorm{{{*/ 224 IssmDouble TriaP1Input::InfinityNorm(void){ 225 225 226 226 /*Output*/ 227 double norm=0;227 IssmDouble norm=0; 228 228 const int numnodes=3; 229 229 … … 232 232 } 233 233 /*}}}*/ 234 /*FUNCTION TriaP1Input::Max{{{ 1*/235 double TriaP1Input::Max(void){236 237 const int numnodes=3; 238 double max=values[0];234 /*FUNCTION TriaP1Input::Max{{{*/ 235 IssmDouble TriaP1Input::Max(void){ 236 237 const int numnodes=3; 238 IssmDouble max=values[0]; 239 239 240 240 for(int i=1;i<numnodes;i++){ … … 244 244 } 245 245 /*}}}*/ 246 /*FUNCTION TriaP1Input::MaxAbs{{{ 1*/247 double TriaP1Input::MaxAbs(void){248 249 const int numnodes=3; 250 double max=fabs(values[0]);246 /*FUNCTION TriaP1Input::MaxAbs{{{*/ 247 IssmDouble TriaP1Input::MaxAbs(void){ 248 249 const int numnodes=3; 250 IssmDouble max=fabs(values[0]); 251 251 252 252 for(int i=1;i<numnodes;i++){ … … 256 256 } 257 257 /*}}}*/ 258 /*FUNCTION TriaP1Input::Min{{{ 1*/259 double TriaP1Input::Min(void){260 261 const int numnodes=3; 262 double min=values[0];258 /*FUNCTION TriaP1Input::Min{{{*/ 259 IssmDouble TriaP1Input::Min(void){ 260 261 const int numnodes=3; 262 IssmDouble min=values[0]; 263 263 264 264 for(int i=1;i<numnodes;i++){ … … 268 268 } 269 269 /*}}}*/ 270 /*FUNCTION TriaP1Input::MinAbs{{{ 1*/271 double TriaP1Input::MinAbs(void){272 273 const int numnodes=3; 274 double min=fabs(values[0]);270 /*FUNCTION TriaP1Input::MinAbs{{{*/ 271 IssmDouble TriaP1Input::MinAbs(void){ 272 273 const int numnodes=3; 274 IssmDouble min=fabs(values[0]); 275 275 276 276 for(int i=1;i<numnodes;i++){ … … 280 280 } 281 281 /*}}}*/ 282 /*FUNCTION TriaP1Input::Scale{{{ 1*/283 void TriaP1Input::Scale( double scale_factor){282 /*FUNCTION TriaP1Input::Scale{{{*/ 283 void TriaP1Input::Scale(IssmDouble scale_factor){ 284 284 285 285 int i; … … 289 289 } 290 290 /*}}}*/ 291 /*FUNCTION TriaP1Input::ArtificialNoise{{{ 1*/292 void TriaP1Input::ArtificialNoise( double min,double max){293 294 int i; 295 const int numnodes=3; 296 double noise;291 /*FUNCTION TriaP1Input::ArtificialNoise{{{*/ 292 void TriaP1Input::ArtificialNoise(IssmDouble min,IssmDouble max){ 293 294 int i; 295 const int numnodes=3; 296 IssmDouble noise; 297 297 298 298 /*Compute random number between bounds: 299 299 * rand() outputs an integer in [0 RAND_MAX] 300 * ( double)rand()/RAND_MAX is in [0 1]300 * (IssmDouble)rand()/RAND_MAX is in [0 1] 301 301 */ 302 noise=min+(max-min)*( double)rand()/RAND_MAX;302 noise=min+(max-min)*(IssmDouble)rand()/RAND_MAX; 303 303 304 304 for(i=0;i<numnodes;i++)values[i]=values[i]+noise; 305 305 } 306 306 /*}}}*/ 307 /*FUNCTION TriaP1Input::AXPY{{{ 1*/308 void TriaP1Input::AXPY(Input* xinput, double scalar){307 /*FUNCTION TriaP1Input::AXPY{{{*/ 308 void TriaP1Input::AXPY(Input* xinput,IssmDouble scalar){ 309 309 310 310 int i; … … 323 323 324 324 default : 325 _error _("not implemented yet");326 } 327 328 } 329 /*}}}*/ 330 /*FUNCTION TriaP1Input::Constrain{{{ 1*/331 void TriaP1Input::Constrain( double cm_min, double cm_max){325 _error2_("not implemented yet"); 326 } 327 328 } 329 /*}}}*/ 330 /*FUNCTION TriaP1Input::Constrain{{{*/ 331 void TriaP1Input::Constrain(IssmDouble cm_min, IssmDouble cm_max){ 332 332 333 333 int i; 334 334 const int numnodes=3; 335 335 336 if(! isnan(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min;337 if(! isnan(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max;338 339 } 340 /*}}}*/ 341 /*FUNCTION TriaP1Input::GetVectorFromInputs{{{ 1*/336 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min; 337 if(!xIsNan<IssmDouble>(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max; 338 339 } 340 /*}}}*/ 341 /*FUNCTION TriaP1Input::GetVectorFromInputs{{{*/ 342 342 void TriaP1Input::GetVectorFromInputs(Vector* vector,int* doflist){ 343 343 … … 346 346 347 347 } /*}}}*/ 348 /*FUNCTION TriaP1Input::GetValuesPtr{{{ 1*/349 void TriaP1Input::GetValuesPtr( double** pvalues,int* pnum_values){348 /*FUNCTION TriaP1Input::GetValuesPtr{{{*/ 349 void TriaP1Input::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ 350 350 351 351 *pvalues=this->values; … … 354 354 } 355 355 /*}}}*/ 356 /*FUNCTION TriaP1Input::PointwiseMin{{{ 1*/356 /*FUNCTION TriaP1Input::PointwiseMin{{{*/ 357 357 Input* TriaP1Input::PointwiseMin(Input* inputB){ 358 358 … … 365 365 int B_numvalues; 366 366 const int numnodes = 3; 367 double minvalues[numnodes];367 IssmDouble minvalues[numnodes]; 368 368 369 369 /*Check that inputB is of the same type*/ 370 if (inputB->ObjectEnum()!=TriaP1InputEnum) _error _("Operation not permitted because inputB is of type %s",EnumToStringx(inputB->ObjectEnum()));370 if (inputB->ObjectEnum()!=TriaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 371 371 xinputB=(TriaP1Input*)inputB; 372 372 … … 385 385 } 386 386 /*}}}*/ 387 /*FUNCTION TriaP1Input::PointwiseMax{{{ 1*/387 /*FUNCTION TriaP1Input::PointwiseMax{{{*/ 388 388 Input* TriaP1Input::PointwiseMax(Input* inputB){ 389 389 … … 396 396 int B_numvalues; 397 397 const int numnodes = 3; 398 double maxvalues[numnodes];398 IssmDouble maxvalues[numnodes]; 399 399 400 400 /*Check that inputB is of the same type*/ 401 if (inputB->ObjectEnum()!=TriaP1InputEnum) _error _("Operation not permitted because inputB is of type %s",EnumToStringx(inputB->ObjectEnum()));401 if (inputB->ObjectEnum()!=TriaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); 402 402 xinputB=(TriaP1Input*)inputB; 403 403 … … 416 416 } 417 417 /*}}}*/ 418 /*FUNCTION TriaP1Input::Configure{{{ 1*/418 /*FUNCTION TriaP1Input::Configure{{{*/ 419 419 void TriaP1Input::Configure(Parameters* parameters){ 420 420 /*do nothing: */ -
issm/trunk/src/c/objects/Inputs/TriaP1Input.h
r12358 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #include "./Input.h" 12 12 #include "../Elements/TriaRef.h" … … 19 19 /*just hold 3 values for 3 vertices: */ 20 20 int enum_type; 21 double values[3];21 IssmDouble values[3]; 22 22 23 /*TriaP1Input constructors, destructors: {{{ 1*/23 /*TriaP1Input constructors, destructors: {{{*/ 24 24 TriaP1Input(); 25 TriaP1Input(int enum_type, double* values);25 TriaP1Input(int enum_type,IssmDouble* values); 26 26 ~TriaP1Input(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{ */ 29 29 void Echo(); 30 30 void DeepEcho(); … … 34 34 Object* copy(); 35 35 /*}}}*/ 36 /*TriaP1Input management: {{{ 1*/36 /*TriaP1Input management: {{{*/ 37 37 int InstanceEnum(); 38 38 Input* SpawnTriaInput(int* indices); 39 Input* PointwiseDivide(Input* inputB){_error _("not implemented yet");};39 Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; 40 40 Input* PointwiseMin(Input* inputB); 41 41 Input* PointwiseMax(Input* inputB); 42 ElementResult* SpawnResult(int step, double time);43 void AddTimeValues( double* values,int step,double time){_error_("not supported yet");};42 ElementResult* SpawnResult(int step, IssmDouble time); 43 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; 44 44 void Configure(Parameters* parameters); 45 45 /*}}}*/ 46 /*numerics: {{{ 1*/47 void GetInputValue(bool* pvalue){_error _("not implemented yet");}48 void GetInputValue(int* pvalue){_error _("not implemented yet");}49 void GetInputValue( double* pvalue){_error_("not implemented yet");}50 void GetInputValue( double* pvalue,GaussTria* gauss);51 void GetInputValue( double* pvalue,GaussPenta* gauss){_error_("not implemented yet");};52 void GetInputValue( double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};53 void GetInputValue( double* pvalue,GaussPenta* gauss,double time){_error_("not implemented yet");};54 void GetInputValue( double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};55 void GetInputValue( double* pvalue,GaussPenta* gauss,int index){_error_("not implemented yet");};56 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussTria* gauss);57 void GetInputDerivativeValue( double* derivativevalues, double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};58 void GetInputAverage( double* pvalue);59 void GetVxStrainRate2d( double* epsilonvx,double* xyz_list, GaussTria* gauss);60 void GetVyStrainRate2d( double* epsilonvy,double* xyz_list, GaussTria* gauss);61 void GetVxStrainRate3d( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};62 void GetVyStrainRate3d( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};63 void GetVzStrainRate3d( double* epsilonvz,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};64 void GetVxStrainRate3dPattyn( double* epsilonvx,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};65 void GetVyStrainRate3dPattyn( double* epsilonvy,double* xyz_list, GaussPenta* gauss){_error_("not implemented yet");};46 /*numerics: {{{*/ 47 void GetInputValue(bool* pvalue){_error2_("not implemented yet");} 48 void GetInputValue(int* pvalue){_error2_("not implemented yet");} 49 void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");} 50 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); 51 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not implemented yet");}; 52 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; 53 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; 54 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; 55 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index){_error2_("not implemented yet");}; 56 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); 57 void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 58 void GetInputAverage(IssmDouble* pvalue); 59 void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss); 60 void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss); 61 void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 62 void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 63 void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 64 void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 65 void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; 66 66 void ChangeEnum(int newenumtype); 67 67 68 void SquareMin( double* psquaremin, bool process_units,Parameters* parameters);69 void ConstrainMin( double minimum);70 void Scale( double scale_factor);71 void ArtificialNoise( double min,double max);72 void AXPY(Input* xinput, double scalar);73 void Constrain( double cm_min, double cm_max);74 double InfinityNorm(void);75 double Max(void);76 double MaxAbs(void);77 double Min(void);78 double MinAbs(void);79 void Extrude(void){_error _("not supported yet");};80 void VerticallyIntegrate(Input* thickness_input){_error _("not supported yet");};68 void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); 69 void ConstrainMin(IssmDouble minimum); 70 void Scale(IssmDouble scale_factor); 71 void ArtificialNoise(IssmDouble min,IssmDouble max); 72 void AXPY(Input* xinput,IssmDouble scalar); 73 void Constrain(IssmDouble cm_min, IssmDouble cm_max); 74 IssmDouble InfinityNorm(void); 75 IssmDouble Max(void); 76 IssmDouble MaxAbs(void); 77 IssmDouble Min(void); 78 IssmDouble MinAbs(void); 79 void Extrude(void){_error2_("not supported yet");}; 80 void VerticallyIntegrate(Input* thickness_input){_error2_("not supported yet");}; 81 81 void GetVectorFromInputs(Vector* vector,int* doflist); 82 void GetValuesPtr( double** pvalues,int* pnum_values);82 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); 83 83 /*}}}*/ 84 84 -
issm/trunk/src/c/objects/IoModel.cpp
r12330 r12706 22 22 #include "../include/include.h" 23 23 24 /*FUNCTION IoModel::IoModel(){{{ 1*/24 /*FUNCTION IoModel::IoModel(){{{*/ 25 25 IoModel::IoModel(){ 26 26 this->fid=NULL; … … 39 39 } 40 40 /*}}}*/ 41 /*FUNCTION IoModel::IoModel(FILE* iomodel_handle){{{ 1*/41 /*FUNCTION IoModel::IoModel(FILE* iomodel_handle){{{*/ 42 42 IoModel::IoModel(FILE* iomodel_handle){ 43 43 … … 50 50 /*Initialize and read constants:*/ 51 51 this->constants=new Parameters(); 52 this->FetchConstants(); /*this routine goes through the input file, and fetches bools, ints, doubles and strings only, nothing memory intensive*/52 this->FetchConstants(); /*this routine goes through the input file, and fetches bools, ints, IssmDoubles and strings only, nothing memory intensive*/ 53 53 54 54 /*Initialize data: */ 55 this->data= (double**)xmalloc(MaximumNumberOfEnums*sizeof(double*));55 this->data=xNew<IssmDouble*>(MaximumNumberOfEnums); 56 56 for(int i=0;i<MaximumNumberOfEnums;i++) this->data[i]=NULL; 57 57 … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION IoModel::~IoModel(){{{ 1*/70 /*FUNCTION IoModel::~IoModel(){{{*/ 71 71 IoModel::~IoModel(){ 72 72 73 delete this->constants;73 if(this->constants) delete this->constants; 74 74 75 75 /*Some checks in debugging mode*/ 76 76 #ifdef _ISSM_DEBUG_ 77 for(int i=0;i<MaximumNumberOfEnums;i++){ 78 if(this->data[i]){ 79 _printf_("Info: previous pointer of %s has not been freed (DeleteData has not been called)",EnumToStringx(i)); 77 if(this->data){ 78 for(int i=0;i<MaximumNumberOfEnums;i++){ 79 if(this->data[i]){ 80 _pprintLine_("Info: previous pointer of " << EnumToStringx(i) << " has not been freed (DeleteData has not been called)"); 81 } 80 82 } 81 83 } 82 84 #endif 83 85 84 xfree((void**)&this->data); 85 86 xfree((void**)&this->my_elements); 87 xfree((void**)&this->my_nodes); 88 xfree((void**)&this->my_vertices); 89 xfree((void**)&this->singlenodetoelementconnectivity); 90 xfree((void**)&this->numbernodetoelementconnectivity); 91 } 92 /*}}}*/ 93 94 /*FUNCTION IoModel::CheckEnumSync{{{1*/ 86 xDelete<IssmDouble*>(this->data); 87 xDelete<bool>(this->my_elements); 88 xDelete<bool>(this->my_nodes); 89 xDelete<int>(this->my_vertices); 90 xDelete<int>(this->singlenodetoelementconnectivity); 91 xDelete<int>(this->numbernodetoelementconnectivity); 92 } 93 /*}}}*/ 94 95 /*FUNCTION IoModel::CheckEnumSync{{{*/ 95 96 void IoModel::CheckEnumSync(void){ 96 97 … … 98 99 int record_enum = 0; 99 100 100 101 101 /*Check that some fields have been allocated*/ 102 102 _assert_(this->fid || my_rank); 103 103 104 105 104 /*Go find in the binary file, the position of the data we want to fetch: */ 106 105 if(my_rank==0){ //cpu 0 … … 111 110 /*Get first Enum*/ 112 111 if(fread(&record_enum,sizeof(int),1,this->fid)==0){ 113 _error _("Marshalled file is empty");112 _error2_("Marshalled file is empty"); 114 113 } 115 114 else{ 116 115 if(record_enum!=MaximumNumberOfEnums){ 117 printf("\n");118 printf("=========================================================================\n");119 printf(" Enums in marshalled file are not compatible with compiled code \n");120 printf(" \n");121 printf(" * If you are running ISSM on a remote cluster: \n");122 printf(" make sure that you are using the same version of ISSM on your local \n");123 printf(" machine and remote cluster (you might need to run svn update) \n");124 printf(" * If you are running ISSM on your local machine: \n");125 printf(" make sure that all the code is compiled (modules and executables) \n");126 printf(" * If you are a developer and just added a new Enum: \n");127 printf(" you might need to run ./Synchronize.sh in src/c/EnumDefinitions \n");128 printf(" and recompile \n");129 printf("=========================================================================\n");130 printf("\n");131 _error _("Enums not consistent (See error message above)");132 } 133 } 134 } 135 } 136 /*}}}*/ 137 /*FUNCTION IoModel::Constant(bool* poutput,int constant_enum){{{ 1*/116 _printLine_(""); 117 _printLine_("========================================================================="); 118 _printLine_(" Enums in marshalled file are not compatible with compiled code "); 119 _printLine_(" "); 120 _printLine_(" * If you are running ISSM on a remote cluster: "); 121 _printLine_(" make sure that you are using the same version of ISSM on your local "); 122 _printLine_(" machine and remote cluster (you might need to run svn update) "); 123 _printLine_(" * If you are running ISSM on your local machine: "); 124 _printLine_(" make sure that all the code is compiled (modules and executables) "); 125 _printLine_(" * If you are a developer and just added a new Enum: "); 126 _printLine_(" you might need to run ./Synchronize.sh in src/c/EnumDefinitions "); 127 _printLine_(" and recompile "); 128 _printLine_("========================================================================="); 129 _printLine_(""); 130 _error2_("Enums not consistent (See error message above)"); 131 } 132 } 133 } 134 } 135 /*}}}*/ 136 /*FUNCTION IoModel::Constant(bool* poutput,int constant_enum){{{*/ 138 137 void IoModel::Constant(bool* poutput,int constant_enum){ 139 138 … … 144 143 } 145 144 /*}}}*/ 146 /*FUNCTION IoModel::Constant(int* poutput,int constant_enum){{{ 1*/145 /*FUNCTION IoModel::Constant(int* poutput,int constant_enum){{{*/ 147 146 void IoModel::Constant(int* poutput,int constant_enum){ 148 147 … … 153 152 } 154 153 /*}}}*/ 155 /*FUNCTION IoModel::Constant( double* poutput,int constant_enum){{{1*/156 void IoModel::Constant( double* poutput,int constant_enum){154 /*FUNCTION IoModel::Constant(IssmDouble* poutput,int constant_enum){{{*/ 155 void IoModel::Constant(IssmDouble* poutput,int constant_enum){ 157 156 158 157 _assert_(constant_enum>=0); … … 162 161 } 163 162 /*}}}*/ 164 /*FUNCTION IoModel::Constant(char** poutput,int constant_enum){{{ 1*/163 /*FUNCTION IoModel::Constant(char** poutput,int constant_enum){{{*/ 165 164 void IoModel::Constant(char** poutput,int constant_enum){ 166 165 … … 171 170 } 172 171 /*}}}*/ 173 /*FUNCTION IoModel::CopyConstantObject{{{ 1*/172 /*FUNCTION IoModel::CopyConstantObject{{{*/ 174 173 Param* IoModel::CopyConstantObject(int constant_enum){ 175 174 … … 178 177 /*Find constant*/ 179 178 Param* param=(Param*)this->constants->FindParamObject(constant_enum); 180 if(!param) _error _("Constant %s not found in iomodel",EnumToStringx(constant_enum));179 if(!param) _error2_("Constant " << EnumToStringx(constant_enum) << " not found in iomodel"); 181 180 182 181 return (Param*)param->copy(); 183 182 } 184 183 /*}}}*/ 185 /*FUNCTION IoModel::Data{{{ 1*/186 double* IoModel::Data(int data_enum){184 /*FUNCTION IoModel::Data{{{*/ 185 IssmDouble* IoModel::Data(int data_enum){ 187 186 188 187 _assert_(data_enum<MaximumNumberOfEnums); … … 192 191 } 193 192 /*}}}*/ 194 /*FUNCTION IoModel::DeleteData{{{ 1*/193 /*FUNCTION IoModel::DeleteData{{{*/ 195 194 void IoModel::DeleteData(int num,...){ 196 195 … … 206 205 dataenum=va_arg(ap, int); 207 206 _assert_(dataenum<MaximumNumberOfEnums); 208 x free((void**)&this->data[dataenum]);207 xDelete<IssmDouble>(this->data[dataenum]); 209 208 } 210 209 va_end(ap); 211 210 } /*}}}*/ 212 /*FUNCTION IoModel::FetchConstants{{{ 1*/211 /*FUNCTION IoModel::FetchConstants{{{*/ 213 212 void IoModel::FetchConstants(void){ 214 213 … … 224 223 int booleanint=0; 225 224 int integer=0; 226 double scalar=0;225 IssmPDouble scalar=0; 227 226 char* string=NULL; 228 227 int string_size; … … 233 232 234 233 /*Go find in the binary file, the position of the data we want to fetch: */ 235 if(my_rank==0){ //cpu 0{{{ 2234 if(my_rank==0){ //cpu 0{{{ 236 235 237 236 /*First set FILE* position to the beginning of the file: */ 238 237 fseek(this->fid,0,SEEK_SET); 239 238 240 /*Now march through file looking for the correct data identifiers (bool,int, double or string): */239 /*Now march through file looking for the correct data identifiers (bool,int,IssmDouble or string): */ 241 240 for(;;){ 242 241 if(fread(&record_enum,sizeof(int),1,this->fid)==0){ … … 267 266 case 1: 268 267 /*Read the boolean and broadcast it to other cpus:*/ 269 if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error _("could not read boolean ");268 if(fread(&booleanint,sizeof(int),1,this->fid)!=1) _error2_("could not read boolean "); 270 269 #ifdef _HAVE_MPI_ 271 270 MPI_Bcast(&booleanint,1,MPI_INT,0,MPI_COMM_WORLD); … … 278 277 case 2: 279 278 /*Read the integer and broadcast it to other cpus:*/ 280 if(fread(&integer,sizeof(int),1,this->fid)!=1) _error _("could not read integer ");279 if(fread(&integer,sizeof(int),1,this->fid)!=1) _error2_("could not read integer "); 281 280 #ifdef _HAVE_MPI_ 282 281 MPI_Bcast(&integer,1,MPI_INT,0,MPI_COMM_WORLD); … … 289 288 case 3: 290 289 /*Read the scalar and broadcast it to other cpus:*/ 291 if(fread(&scalar,sizeof( double),1,this->fid)!=1) _error_("could not read scalar ");290 if(fread(&scalar,sizeof(IssmPDouble),1,this->fid)!=1) _error2_("could not read scalar "); 292 291 #ifdef _HAVE_MPI_ 293 292 MPI_Bcast(&scalar,1,MPI_DOUBLE,0,MPI_COMM_WORLD); … … 300 299 case 4: 301 300 /*We have to read a string from disk. First read the dimensions of the string, then the string: */ 302 if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error _("could not read length of string ");301 if(fread(&string_size,sizeof(int),1,this->fid)!=1) _error2_("could not read length of string "); 303 302 #ifdef _HAVE_MPI_ 304 303 MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD); … … 306 305 307 306 if(string_size){ 308 string= (char*)xmalloc((string_size+1)*sizeof(char));307 string=xNew<char>(string_size+1); 309 308 string[string_size]='\0'; 310 309 311 310 /*Read string, then broadcast: */ 312 if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error _("could not read string ");311 if(fread(string,string_size*sizeof(char),1,this->fid)!=1)_error2_(" could not read string "); 313 312 #ifdef _HAVE_MPI_ 314 313 MPI_Bcast(string,string_size,MPI_CHAR,0,MPI_COMM_WORLD); … … 316 315 } 317 316 else{ 318 string= (char*)xmalloc(sizeof(char));317 string=xNew<char>(1); 319 318 string[0]='\0'; 320 319 } … … 324 323 325 324 /*Free string*/ 326 x free((void**)&string);325 xDelete<char>(string); 327 326 328 327 break; … … 361 360 362 361 default: 363 _error _("%s%i","unknown record type:",record_code);362 _error2_("unknown record type:" << record_code); 364 363 break;; 365 364 } … … 368 367 } //}}} 369 368 #ifdef _HAVE_MPI_ 370 else{ //cpu ~0 {{{ 2369 else{ //cpu ~0 {{{ 371 370 for(;;){ //wait on cpu 0 372 371 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); /*get from cpu 0 what we are going to do: */ … … 405 404 MPI_Bcast(&string_size,1,MPI_INT,0,MPI_COMM_WORLD); 406 405 if(string_size){ 407 string= (char*)xmalloc((string_size+1)*sizeof(char));406 string=xNew<char>((string_size+1)); 408 407 string[string_size]='\0'; 409 408 … … 412 411 } 413 412 else{ 414 string= (char*)xmalloc(sizeof(char));413 string=xNew<char>(1); 415 414 string[0]='\0'; 416 415 } … … 419 418 420 419 /*Free string*/ 421 x free((void**)&string);420 xDelete<char>(string); 422 421 423 422 break; … … 429 428 430 429 default: 431 _error _("%s%i","unknown record type:",record_code);430 _error2_("unknown record type:" << record_code); 432 431 break;; 433 432 } … … 440 439 } 441 440 /*}}}*/ 442 /*FUNCTION IoModel::FetchData(bool* pbool,int data_enum){{{ 1*/441 /*FUNCTION IoModel::FetchData(bool* pbool,int data_enum){{{*/ 443 442 void IoModel::FetchData(bool* pboolean,int data_enum){ 444 443 … … 454 453 fid=this->SetFilePointerToData(&code,NULL,data_enum); 455 454 456 if(code!=1)_error _("expecting a boolean for enum %s",EnumToStringx(data_enum));455 if(code!=1)_error2_("expecting a boolean for enum " << EnumToStringx(data_enum)); 457 456 458 457 /*We have to read a boolean from disk. */ 459 458 if(my_rank==0){ 460 if(fread(&booleanint,sizeof(int),1,fid)!=1) _error _("could not read boolean ");459 if(fread(&booleanint,sizeof(int),1,fid)!=1) _error2_("could not read boolean "); 461 460 } 462 461 #ifdef _HAVE_MPI_ … … 470 469 } 471 470 /*}}}*/ 472 /*FUNCTION IoModel::FetchData(int* pinteger,int data_enum){{{ 1*/471 /*FUNCTION IoModel::FetchData(int* pinteger,int data_enum){{{*/ 473 472 void IoModel::FetchData(int* pinteger,int data_enum){ 474 473 475 474 extern int my_rank; 476 475 extern int num_procs; 477 478 476 479 477 /*output: */ … … 484 482 fid=this->SetFilePointerToData(&code,NULL,data_enum); 485 483 486 if(code!=2)_error _("expecting an integer for enum %s",EnumToStringx(data_enum));484 if(code!=2)_error2_("expecting an integer for enum " << EnumToStringx(data_enum)); 487 485 488 486 /*We have to read a integer from disk. First read the dimensions of the integer, then the integer: */ 489 487 if(my_rank==0){ 490 if(fread(&integer,sizeof(int),1,fid)!=1) _error _("could not read integer ");488 if(fread(&integer,sizeof(int),1,fid)!=1) _error2_("could not read integer "); 491 489 } 492 490 … … 497 495 /*Assign output pointers: */ 498 496 *pinteger=integer; 499 500 } 501 /*}}}*/ 502 /*FUNCTION IoModel::FetchData(double* pscalar,int data_enum){{{1*/ 503 void IoModel::FetchData(double* pscalar,int data_enum){ 497 } 498 /*}}}*/ 499 /*FUNCTION IoModel::FetchData(IssmDouble* pscalar,int data_enum){{{*/ 500 void IoModel::FetchData(IssmDouble* pscalar,int data_enum){ 504 501 505 502 … … 509 506 510 507 /*output: */ 511 double scalar;508 IssmPDouble scalar; 512 509 int code; 513 510 … … 515 512 fid=this->SetFilePointerToData(&code,NULL,data_enum); 516 513 517 if(code!=3)_error _("expecting a double for enum %s",EnumToStringx(data_enum));514 if(code!=3)_error2_("expecting a IssmDouble for enum " << EnumToStringx(data_enum)); 518 515 519 516 /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */ 520 517 if(my_rank==0){ 521 if(fread(&scalar,sizeof( double),1,fid)!=1)_error_("could not read scalar ");518 if(fread(&scalar,sizeof(IssmPDouble),1,fid)!=1)_error2_("could not read scalar "); 522 519 } 523 520 #ifdef _HAVE_MPI_ … … 530 527 } 531 528 /*}}}*/ 532 /*FUNCTION IoModel::FetchData(char** pstring,int data_enum){{{ 1*/529 /*FUNCTION IoModel::FetchData(char** pstring,int data_enum){{{*/ 533 530 void IoModel::FetchData(char** pstring,int data_enum){ 534 531 … … 545 542 fid=this->SetFilePointerToData(&code,NULL,data_enum); 546 543 547 if(code!=4)_error _("expecting a string for enum %s",EnumToStringx(data_enum));544 if(code!=4)_error2_("expecting a string for enum " << EnumToStringx(data_enum)); 548 545 549 546 /*Now fetch: */ … … 551 548 /*We have to read a string from disk. First read the dimensions of the string, then the string: */ 552 549 if(my_rank==0){ 553 if(fread(&string_size,sizeof(int),1,fid)!=1) _error _("could not read length of string ");550 if(fread(&string_size,sizeof(int),1,fid)!=1) _error2_("could not read length of string "); 554 551 } 555 552 … … 560 557 /*Now allocate string: */ 561 558 if(string_size){ 562 string= (char*)xmalloc((string_size+1)*sizeof(char));559 string=xNew<char>((string_size+1)); 563 560 string[string_size]='\0'; 564 561 565 562 /*Read string on node 0, then broadcast: */ 566 563 if(my_rank==0){ 567 if(fread(string,string_size*sizeof(char),1,fid)!=1)_error _("could not read string ");564 if(fread(string,string_size*sizeof(char),1,fid)!=1)_error2_(" could not read string "); 568 565 } 569 566 #ifdef _HAVE_MPI_ … … 572 569 } 573 570 else{ 574 string= (char*)xmalloc(sizeof(char));571 string=xNew<char>(1); 575 572 string[0]='\0'; 576 573 } … … 581 578 } 582 579 /*}}}*/ 583 /*FUNCTION IoModel::FetchData(int** pintegerematrix,int* pM,int* pN,int data_enum){{{1*/580 /*FUNCTION IoModel::FetchData(int** pintegerematrix,int* pM,int* pN,int data_enum){{{*/ 584 581 void IoModel::FetchData(int** pmatrix,int* pM,int* pN,int data_enum){ 585 582 … … 590 587 /*output: */ 591 588 int M,N; 592 double* matrix=NULL;589 IssmPDouble* matrix=NULL; 593 590 int* integer_matrix=NULL; 594 591 int code=0; … … 599 596 fid=this->SetFilePointerToData(&code,&vector_type,data_enum); 600 597 601 if((code!=5) && (code!=6) && (code!=7))_error _("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum));598 if((code!=5) && (code!=6) && (code!=7))_error2_("expecting a IssmDouble, integer or boolean matrix for enum " << EnumToStringx(data_enum)); 602 599 603 600 /*Now fetch: */ … … 606 603 /*numberofelements: */ 607 604 if(my_rank==0){ 608 if(fread(&M,sizeof(int),1,fid)!=1) _error _("could not read number of rows for matrix ");605 if(fread(&M,sizeof(int),1,fid)!=1) _error2_("could not read number of rows for matrix "); 609 606 } 610 607 … … 614 611 615 612 if(my_rank==0){ 616 if(fread(&N,sizeof(int),1,fid)!=1) _error _("could not read number of columns for matrix ");613 if(fread(&N,sizeof(int),1,fid)!=1) _error2_("could not read number of columns for matrix "); 617 614 } 618 615 #ifdef _HAVE_MPI_ … … 622 619 /*Now allocate matrix: */ 623 620 if(M*N){ 624 matrix= (double*)xmalloc(M*N*sizeof(double));621 matrix=xNew<IssmPDouble>(M*N); 625 622 626 623 /*Read matrix on node 0, then broadcast: */ 627 624 if(my_rank==0){ 628 if(fread(matrix,M*N*sizeof( double),1,fid)!=1) _error_("could not read matrix ");625 if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error2_("could not read matrix "); 629 626 } 630 627 … … 636 633 /*Now cast to integer: */ 637 634 if(M*N){ 638 integer_matrix= (int*)xmalloc(M*N*sizeof(int));635 integer_matrix=xNew<int>(M*N); 639 636 for (i=0;i<M;i++){ 640 637 for (j=0;j<N;j++){ … … 647 644 } 648 645 /*Free ressources:*/ 649 x free((void**)&matrix);646 xDelete<IssmPDouble>(matrix); 650 647 651 648 /*Assign output pointers: */ … … 656 653 } 657 654 /*}}}*/ 658 /*FUNCTION IoModel::FetchData( double** pdoublematrix,int* pM,int* pN,int data_enum){{{1*/659 void IoModel::FetchData( double** pmatrix,int* pM,int* pN,int data_enum){655 /*FUNCTION IoModel::FetchData(IssmDouble** pIssmDoublematrix,int* pM,int* pN,int data_enum){{{*/ 656 void IoModel::FetchData(IssmDouble** pmatrix,int* pM,int* pN,int data_enum){ 660 657 661 658 extern int my_rank; … … 664 661 /*output: */ 665 662 int M,N; 666 double* matrix=NULL;663 IssmPDouble* matrix=NULL; 667 664 int code=0; 668 665 int vector_type=0; … … 670 667 /*Set file pointer to beginning of the data: */ 671 668 fid=this->SetFilePointerToData(&code,&vector_type,data_enum); 672 if((code!=5) && (code!=6) && (code!=7))_error _("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum));669 if((code!=5) && (code!=6) && (code!=7))_error2_("expecting a IssmDouble, integer or boolean matrix for enum " << EnumToStringx(data_enum)); 673 670 674 671 /*Now fetch: */ … … 677 674 /*numberofelements: */ 678 675 if(my_rank==0){ 679 if(fread(&M,sizeof(int),1,fid)!=1) _error _("could not read number of rows for matrix ");676 if(fread(&M,sizeof(int),1,fid)!=1) _error2_("could not read number of rows for matrix "); 680 677 } 681 678 #ifdef _HAVE_MPI_ … … 684 681 685 682 if(my_rank==0){ 686 if(fread(&N,sizeof(int),1,fid)!=1) _error _("could not read number of columns for matrix ");683 if(fread(&N,sizeof(int),1,fid)!=1) _error2_("could not read number of columns for matrix "); 687 684 } 688 685 #ifdef _HAVE_MPI_ … … 692 689 /*Now allocate matrix: */ 693 690 if(M*N){ 694 matrix= (double*)xmalloc(M*N*sizeof(double));691 matrix=xNew<IssmPDouble>(M*N); 695 692 696 693 /*Read matrix on node 0, then broadcast: */ 697 694 if(my_rank==0){ 698 if(fread(matrix,M*N*sizeof( double),1,fid)!=1) _error_("could not read matrix ");695 if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error2_("could not read matrix "); 699 696 } 700 697 #ifdef _HAVE_MPI_ 701 698 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD); 702 699 #endif 703 } 704 700 *pmatrix=xNew<IssmDouble>(M*N); 701 for (int i=0;i<M*N;++i) (*pmatrix)[i]=matrix[i]; 702 xDelete<IssmPDouble>(matrix); 703 } 704 else 705 *pmatrix=NULL; 705 706 /*Assign output pointers: */ 706 *pmatrix=matrix;707 707 if (pM)*pM=M; 708 708 if (pN)*pN=N; 709 709 } 710 710 /*}}}*/ 711 /*FUNCTION IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){{{ 1*/711 /*FUNCTION IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){{{*/ 712 712 void IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){ 713 713 … … 729 729 fid=this->SetFilePointerToData(&code,NULL,data_enum); 730 730 731 if(code!=9)_error _("expecting a string array for enum %s",EnumToStringx(data_enum));731 if(code!=9)_error2_("expecting a string array for enum " << EnumToStringx(data_enum)); 732 732 733 733 /*We have to read a bunch of strings from disk. First read the number of strings, and allocate: */ 734 734 if(my_rank==0){ 735 if(fread(&numstrings,sizeof(int),1,fid)!=1) _error _("could not read length of string array");735 if(fread(&numstrings,sizeof(int),1,fid)!=1) _error2_("could not read length of string array"); 736 736 } 737 737 #ifdef _HAVE_MPI_ … … 741 741 /*Now allocate string array: */ 742 742 if(numstrings){ 743 strings= (char**)xmalloc(numstrings*sizeof(char*));743 strings=xNew<char*>(numstrings); 744 744 for(i=0;i<numstrings;i++)strings[i]=NULL; 745 745 … … 748 748 749 749 if(my_rank==0){ 750 if(fread(&string_size,sizeof(int),1,fid)!=1) _error _("could not read length of string ");750 if(fread(&string_size,sizeof(int),1,fid)!=1) _error2_("could not read length of string "); 751 751 } 752 752 #ifdef _HAVE_MPI_ … … 754 754 #endif 755 755 if(string_size){ 756 string= (char*)xmalloc((string_size+1)*sizeof(char));756 string=xNew<char>((string_size+1)); 757 757 string[string_size]='\0'; 758 758 759 759 /*Read string on node 0, then broadcast: */ 760 760 if(my_rank==0){ 761 if(fread(string,string_size*sizeof(char),1,fid)!=1)_error _("could not read string ");761 if(fread(string,string_size*sizeof(char),1,fid)!=1)_error2_(" could not read string "); 762 762 } 763 763 #ifdef _HAVE_MPI_ … … 766 766 } 767 767 else{ 768 string= (char*)xmalloc(sizeof(char));768 string=xNew<char>(1); 769 769 string[0]='\0'; 770 770 } … … 779 779 } 780 780 /*}}}*/ 781 /*FUNCTION IoModel::FetchData( double*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{1*/782 void IoModel::FetchData( double*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){781 /*FUNCTION IoModel::FetchData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{*/ 782 void IoModel::FetchData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){ 783 783 784 784 int i; … … 788 788 789 789 /*output: */ 790 double** matrices=NULL;790 IssmDouble** matrices=NULL; 791 791 int* mdims=NULL; 792 792 int* ndims=NULL; … … 795 795 /*intermediary: */ 796 796 int M, N; 797 double *matrix = NULL;797 IssmPDouble *matrix = NULL; 798 798 int code; 799 799 800 800 /*Set file pointer to beginning of the data: */ 801 801 fid=this->SetFilePointerToData(&code,NULL,data_enum); 802 if(code!=8)_error _("expecting a double mat array for enum %s",EnumToStringx(data_enum));802 if(code!=8)_error2_("expecting a IssmDouble mat array for enum " << EnumToStringx(data_enum)); 803 803 804 804 /*Now fetch: */ 805 805 if(my_rank==0){ 806 if(fread(&numrecords,sizeof(int),1,fid)!=1) _error _("could not read number of records in matrix array ");806 if(fread(&numrecords,sizeof(int),1,fid)!=1) _error2_("could not read number of records in matrix array "); 807 807 } 808 808 #ifdef _HAVE_MPI_ … … 813 813 814 814 /*Allocate matrices :*/ 815 matrices= (double**)xmalloc(numrecords*sizeof(double*));816 mdims= (int*)xmalloc(numrecords*sizeof(int));817 ndims= (int*)xmalloc(numrecords*sizeof(int));815 matrices=xNew<IssmDouble*>(numrecords); 816 mdims=xNew<int>(numrecords); 817 ndims=xNew<int>(numrecords); 818 818 819 819 for(i=0;i<numrecords;i++){ … … 827 827 828 828 if(my_rank==0){ 829 if(fread(&M,sizeof(int),1,fid)!=1) _error _("%s%i%s","could not read number of rows in ",i,"th matrix of matrix array");829 if(fread(&M,sizeof(int),1,fid)!=1) _error2_("could not read number of rows in " << i << "th matrix of matrix array"); 830 830 } 831 831 #ifdef _HAVE_MPI_ … … 834 834 835 835 if(my_rank==0){ 836 if(fread(&N,sizeof(int),1,fid)!=1) _error _("%s%i%s","could not read number of columns in ",i,"th matrix of matrix array");836 if(fread(&N,sizeof(int),1,fid)!=1) _error2_("could not read number of columns in " << i << "th matrix of matrix array"); 837 837 } 838 838 #ifdef _HAVE_MPI_ … … 842 842 /*Now allocate matrix: */ 843 843 if(M*N){ 844 matrix= (double*)xmalloc(M*N*sizeof(double));844 matrix=xNew<IssmPDouble>(M*N); 845 845 846 846 /*Read matrix on node 0, then broadcast: */ 847 847 if(my_rank==0){ 848 if(fread(matrix,M*N*sizeof( double),1,fid)!=1) _error_("could not read matrix ");848 if(fread(matrix,M*N*sizeof(IssmPDouble),1,fid)!=1) _error2_("could not read matrix "); 849 849 } 850 850 … … 852 852 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD); 853 853 #endif 854 } 855 854 matrices[i]=xNew<IssmDouble>(M*N); 855 for (int j=0;j<M*N;++j) {matrices[i][j]=matrix[j];} 856 xDelete<IssmPDouble>(matrix); 857 } 858 else 859 matrices[i]=NULL; 856 860 /*Assign: */ 857 matrices[i]=matrix;858 861 mdims[i]=M; 859 862 ndims[i]=N; … … 868 871 } 869 872 /*}}}*/ 870 /*FUNCTION IoModel::FetchData(int num,...){{{1*/ 873 /*FUNCTION IoModel::FetchData(Option** poption,int data_enum){{{*/ 874 void IoModel::FetchData(Option** poption,int index){ 875 876 extern int my_rank; 877 extern int num_procs; 878 879 /*output: */ 880 int code; 881 Option *option = NULL; 882 char *name = NULL; 883 884 /*First get option name*/ 885 this->FetchData(&name,index); 886 887 /*Get option value*/ 888 fid=this->SetFilePointerToData(&code,NULL,index+1); 889 switch(code){ 890 case 3: {//IssmDouble 891 IssmDouble *value = NULL; 892 value=xNew<IssmDouble>(1); 893 FetchData(value,index+1); 894 option = new OptionDouble(); 895 ((OptionDouble*)option)->values = value; 896 option->name = name; 897 option->numel = 1; 898 option->ndims = 1; 899 option->size = NULL; 900 break; 901 } 902 case 4: {//char 903 char* value = NULL; 904 FetchData(&value,index+1); 905 option = new OptionChar(); 906 ((OptionChar*)option)->values = value; 907 option->name = name; 908 option->numel = 1; 909 option->ndims = 1; 910 option->size = NULL; 911 break; 912 } 913 default: 914 _error2_("Option of format " << code << " not supported yet"); 915 } 916 917 /*Assign output pointers: */ 918 *poption=option; 919 } 920 /*}}}*/ 921 /*FUNCTION IoModel::FetchData(int num,...){{{*/ 871 922 void IoModel::FetchData(int num,...){ 872 923 873 924 va_list ap; 874 925 int dataenum; 875 double* matrix=NULL;926 IssmDouble* matrix=NULL; 876 927 int M,N; 877 928 int i; 878 929 879 930 /*Go through the entire list of enums and fetch the corresponding data. Add it to the iomodel->data dataset. Everything 880 *we fetch is a double* : */931 *we fetch is a IssmDouble* : */ 881 932 882 933 va_start(ap,num); … … 890 941 _assert_(dataenum<MaximumNumberOfEnums); 891 942 if(this->data[dataenum]){ 892 _error _("Info: trying to fetch %s but previous pointer has not been freed (DeleteData has not been called)",EnumToStringx(dataenum));943 _error2_("Info: trying to fetch " << EnumToStringx(dataenum) << " but previous pointer has not been freed (DeleteData has not been called)"); 893 944 } 894 945 #endif … … 903 954 } 904 955 /*}}}*/ 905 /*FUNCTION IoModel::FetchDataToInput{{{ 1*/906 void IoModel::FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum, double default_value){956 /*FUNCTION IoModel::FetchDataToInput{{{*/ 957 void IoModel::FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum,IssmDouble default_value){ 907 958 908 959 /*intermediary: */ … … 923 974 bool boolean; 924 975 int integer; 925 double scalar;976 IssmDouble scalar; 926 977 char *string = NULL; 927 double *doublevector = NULL;978 IssmDouble *IssmDoublevector = NULL; 928 979 int M,N; 929 980 … … 935 986 936 987 switch(code){ 937 case 1: //boolean constant. {{{ 2988 case 1: //boolean constant. {{{ 938 989 this->FetchData(&boolean,vector_enum); 939 990 … … 943 994 if(this->my_elements[i]){ 944 995 Element* element=(Element*)elements->GetObjectByOffset(counter); 945 element->InputCreate(( double)boolean,vector_enum,code);996 element->InputCreate((IssmDouble)boolean,vector_enum,code); 946 997 counter++; 947 998 } 948 999 } 949 1000 break; /*}}}*/ 950 case 2: //integer constant. {{{ 21001 case 2: //integer constant. {{{ 951 1002 this->FetchData(&integer,vector_enum); 952 1003 … … 956 1007 if(this->my_elements[i]){ 957 1008 Element* element=(Element*)elements->GetObjectByOffset(counter); 958 element->InputCreate(( double)integer,vector_enum,code);1009 element->InputCreate((IssmDouble)integer,vector_enum,code); 959 1010 counter++; 960 1011 } 961 1012 } 962 1013 break; /*}}}*/ 963 case 3: // double constant. {{{21014 case 3: //IssmDouble constant. {{{ 964 1015 this->FetchData(&scalar,vector_enum); 965 1016 966 /*Add double constant input to all elements: */1017 /*Add IssmDouble constant input to all elements: */ 967 1018 counter=0; 968 1019 for (i=0;i<numberofelements;i++){ … … 974 1025 } 975 1026 break; /*}}}*/ 976 case 5: //boolean vector. {{{ 21027 case 5: //boolean vector. {{{ 977 1028 978 1029 /*Fetch vector:*/ 979 this->FetchData(& doublevector,&M,&N,vector_enum); //we still have a doublevector, because it might include times in transient mode1030 this->FetchData(&IssmDoublevector,&M,&N,vector_enum); //we still have a IssmDoublevector, because it might include times in transient mode 980 1031 /*Check we got something, otherwise fetch default: */ 981 if( doublevector){1032 if(IssmDoublevector){ 982 1033 defaulting=false; //we are not defaulting, because we do have a vector 983 1034 } … … 986 1037 if(default_vector_enum!=NoneEnum){ 987 1038 /*yes. fetch it: */ 988 this->FetchData(& doublevector,&M,&N,default_vector_enum);989 if( doublevector){1039 this->FetchData(&IssmDoublevector,&M,&N,default_vector_enum); 1040 if(IssmDoublevector){ 990 1041 defaulting=false; //we are not defaulting, because we do have a vector 991 1042 } … … 1007 1058 Element* element=(Element*)elements->GetObjectByOffset(counter); 1008 1059 if(defaulting) element->InputCreate(default_value,vector_enum,code); 1009 else element->InputCreate( doublevector,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements.1060 else element->InputCreate(IssmDoublevector,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1010 1061 counter++; 1011 1062 } 1012 1063 } 1013 1064 break; /*}}}*/ 1014 case 6: //int vector . {{{21065 case 6: //int vector{{{ 1015 1066 1016 1067 /*Fetch vector:*/ 1017 this->FetchData(& doublevector,&M,&N,vector_enum); //we still have a doublevector, because it might include times in transient mode1068 this->FetchData(&IssmDoublevector,&M,&N,vector_enum); //we still have a IssmDoublevector, because it might include times in transient mode 1018 1069 /*Check we got something, otherwise fetch default: */ 1019 if( doublevector){1070 if(IssmDoublevector){ 1020 1071 defaulting=false; //we are not defaulting, because we do have a vector 1021 1072 } … … 1024 1075 if(default_vector_enum!=NoneEnum){ 1025 1076 /*yes. fetch it: */ 1026 this->FetchData(& doublevector,&M,&N,default_vector_enum);1027 if( doublevector){1077 this->FetchData(&IssmDoublevector,&M,&N,default_vector_enum); 1078 if(IssmDoublevector){ 1028 1079 defaulting=false; //we are not defaulting, because we do have a vector 1029 1080 } … … 1045 1096 Element* element=(Element*)elements->GetObjectByOffset(counter); 1046 1097 if(defaulting) element->InputCreate(default_value,vector_enum,code); 1047 else element->InputCreate( doublevector,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements.1098 else element->InputCreate(IssmDoublevector,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1048 1099 counter++; 1049 1100 } 1050 1101 } 1051 1102 break; /*}}}*/ 1052 case 7: // double vector. {{{21103 case 7: //IssmDouble vector{{{ 1053 1104 1054 1105 /*Fetch vector:*/ 1055 this->FetchData(& doublevector,&M,&N,vector_enum);1106 this->FetchData(&IssmDoublevector,&M,&N,vector_enum); 1056 1107 /*Check we got something, otherwise fetch default: */ 1057 if( doublevector){1108 if(IssmDoublevector){ 1058 1109 defaulting=false; //we are not defaulting, because we do have a vector 1059 1110 } … … 1062 1113 if(default_vector_enum!=NoneEnum){ 1063 1114 /*yes. fetch it: */ 1064 this->FetchData(& doublevector,&M,&N,default_vector_enum);1065 if( doublevector){1115 this->FetchData(&IssmDoublevector,&M,&N,default_vector_enum); 1116 if(IssmDoublevector){ 1066 1117 defaulting=false; //we are not defaulting, because we do have a vector 1067 1118 } … … 1083 1134 Element* element=(Element*)elements->GetObjectByOffset(counter); 1084 1135 if(defaulting) element->InputCreate(default_value,vector_enum,code); 1085 else element->InputCreate( doublevector,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements.1136 else element->InputCreate(IssmDoublevector,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1086 1137 counter++; 1087 1138 } … … 1089 1140 1090 1141 break; /*}}}*/ 1091 default: /*{{{ 2*/1092 _error _("%s%i%s","data code ",code," not supported yet!");1142 default: /*{{{*/ 1143 _error2_("data code " << code << " not supported yet!"); 1093 1144 break; 1094 1145 /*}}}*/ 1095 1146 } 1096 1147 /*Free ressources:*/ 1097 xfree((void**)&doublevector); 1098 xfree((void**)&string); 1099 } 1100 /*FUNCTION IoModel::SetFilePointerToData{{{1*/ 1148 xDelete<IssmDouble>(IssmDoublevector); 1149 xDelete<char>(string); 1150 } 1151 /*FUNCTION IoModel::LastIndex{{{*/ 1152 void IoModel::LastIndex(int *pindex){ 1153 1154 extern int my_rank; 1155 int lastindex,index; 1156 int record_length; 1157 1158 /*Go find in the binary file, the position of the data we want to fetch: */ 1159 if(my_rank==0){ 1160 1161 /*First set FILE* position to the beginning of the file: */ 1162 fseek(fid,0,SEEK_SET); 1163 1164 /*Now march through file looking for the correct data identifier: */ 1165 for(;;){ 1166 /*Read enum for this size of first string name: */ 1167 if(fread(&index,sizeof(int),1,fid)==0){ 1168 /*Ok, we have reached the end of the file. break: */ 1169 break; 1170 } 1171 1172 /*read the record length, and use it to skip this record: */ 1173 fread(&record_length,sizeof(int),1,fid); 1174 fseek(fid,record_length,SEEK_CUR); 1175 lastindex=index; 1176 } 1177 } 1178 /*Broadcast code and vector type: */ 1179 #ifdef _HAVE_MPI_ 1180 MPI_Bcast(&lastindex,1,MPI_INT,0,MPI_COMM_WORLD); 1181 #endif 1182 1183 /*Assign output pointers:*/ 1184 *pindex=lastindex; 1185 } 1186 /*FUNCTION IoModel::SetFilePointerToData{{{*/ 1101 1187 FILE* IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){ 1102 1188 1103 1189 extern int my_rank; 1104 1190 extern int num_procs; 1105 1191 1106 1192 int found=0; 1107 1193 int record_enum; … … 1109 1195 int record_code; //1 to 7 number 1110 1196 int vector_type; //nodal or elementary 1111 1197 1112 1198 /*Go find in the binary file, the position of the data we want to fetch: */ 1113 1199 if(my_rank==0){ 1114 1200 1115 1201 /*First set FILE* position to the beginning of the file: */ 1116 1202 fseek(fid,0,SEEK_SET); … … 1124 1210 break; 1125 1211 } 1126 1212 1127 1213 /*Is this the record sought for? : */ 1128 1214 if (data_enum==record_enum){ … … 1144 1230 } 1145 1231 } 1146 #ifdef _HAVE_MPI_1232 #ifdef _HAVE_MPI_ 1147 1233 MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD); 1148 if(!found)_error _("%s %s ","could not find data with name",EnumToStringx(data_enum));1149 #endif1234 if(!found)_error2_("could not find data with name" << " " << EnumToStringx(data_enum) << " "); 1235 #endif 1150 1236 1151 1237 /*Broadcast code and vector type: */ 1152 #ifdef _HAVE_MPI_1238 #ifdef _HAVE_MPI_ 1153 1239 MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); 1154 1240 MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD); 1155 1241 if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD); 1156 #endif1242 #endif 1157 1243 1158 1244 /*Assign output pointers:*/ -
issm/trunk/src/c/objects/IoModel.h
r12330 r12706 13 13 class Elements; 14 14 class Param; 15 15 class Option; 16 16 17 17 class IoModel { 18 18 19 19 private: 20 FILE *fid; //pointer to input file 21 IssmDouble **data; //this dataset holds temporary data, memory intensive. 20 IssmDouble **data; //this dataset holds temporary data, memory intensive. 22 21 Parameters *constants; //this dataset holds all IssmDouble, int, bool and char *parameters read in from the input file.* 23 22 24 23 public: 25 24 /*This data needs to stay memory resident at all time, even if it's memory intensive: */ 25 FILE *fid; //pointer to input file 26 26 bool *my_elements; 27 27 bool *my_nodes; … … 41 41 42 42 /*Input/Output*/ 43 void CheckEnumSync(void);44 void Constant(bool*poutput,int constant_enum);45 void Constant(int*poutput,int constant_enum);46 void Constant(IssmDouble *poutput,int constant_enum);47 void Constant(char**poutput,int constant_enum);48 Param *CopyConstantObject(int constant_enum);43 void CheckEnumSync(void); 44 void Constant(bool *poutput,int constant_enum); 45 void Constant(int *poutput,int constant_enum); 46 void Constant(IssmDouble *poutput,int constant_enum); 47 void Constant(char **poutput,int constant_enum); 48 Param *CopyConstantObject(int constant_enum); 49 49 IssmDouble *Data(int dataenum); 50 void DeleteData(int num,...); 51 void FetchConstants(void); 52 void FetchData(bool* pboolean,int data_enum); 53 void FetchData(int* pinteger,int data_enum); 54 void FetchData(IssmDouble* pscalar,int data_enum); 55 void FetchData(char** pstring,int data_enum); 56 void FetchData(int** pmatrix,int* pM,int* pN,int data_enum); 57 void FetchData(IssmDouble** pscalarmatrix,int* pM,int* pN,int data_enum); 58 void FetchData(char*** pstringarray,int* pnumstrings,int data_enum); 59 void FetchData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum); 60 void FetchData(int num,...); 61 void FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,IssmDouble default_value=0); 62 FILE* SetFilePointerToData(int* pcode,int* pvector_type, int data_enum); 50 void DeleteData(int num,...); 51 void FetchConstants(void); 52 void FetchData(bool* pboolean,int data_enum); 53 void FetchData(int* pinteger,int data_enum); 54 void FetchData(IssmDouble* pscalar,int data_enum); 55 void FetchData(char** pstring,int data_enum); 56 void FetchData(int** pmatrix,int* pM,int* pN,int data_enum); 57 void FetchData(IssmDouble** pscalarmatrix,int* pM,int* pN,int data_enum); 58 void FetchData(char*** pstringarray,int* pnumstrings,int data_enum); 59 void FetchData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum); 60 void FetchData(Option **poption,int data_enum); 61 void FetchData(int num,...); 62 void FetchDataToInput(Elements* elements,int vector_enum,int default_vector_enum=NoneEnum,IssmDouble default_value=0); 63 void LastIndex(int *pindex); 64 FILE* SetFilePointerToData(int* pcode,int* pvector_type, int data_enum); 63 65 }; 64 66 -
issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 /*}}}*/ 21 21 22 /*FUNCTION KMLFileToken(FILE* fid,int* pncom=NULL,char*** ppcom=NULL) {{{ 1*/22 /*FUNCTION KMLFileToken(FILE* fid,int* pncom=NULL,char*** ppcom=NULL) {{{*/ 23 23 char* KMLFileToken(FILE* fid, 24 24 int* pncom=NULL,char*** ppcom=NULL){ … … 127 127 128 128 // if (itag) 129 // _p rintf_(true,"tag buffer (length=%d):\n",ibuf);129 // _pprintLine_("tag buffer (length=" << ibuf << "):"); 130 130 // else if (ifield) 131 // _p rintf_(true,"field buffer (length=%d):\n",ibuf);132 // _p rintf_(true,"%s\n",buffer);131 // _pprintLine_("field buffer (length=" << ibuf << "):"); 132 // _pprintLine_(buffer); 133 133 134 134 if (!ibuf) … … 138 138 } 139 139 /*}}}*/ 140 141 /*FUNCTION KMLFileTokenComment(FILE* fid) {{{1*/ 140 /*FUNCTION KMLFileTokenComment(FILE* fid) {{{*/ 142 141 char* KMLFileTokenComment(FILE* fid){ 143 142 … … 194 193 } 195 194 196 // _p rintf_(true,"comment buffer (length=%d):\n",ibuf);197 // _p rintf_(true,"%s\n",buffer);195 // _pprintLine_("comment buffer (length=" << ibuf << "):"); 196 // _pprintLine_(buffer); 198 197 199 198 if (!ibuf) … … 203 202 } 204 203 /*}}}*/ 205 206 /*FUNCTION KMLFileTokenBuffer {{{1*/ 204 /*FUNCTION KMLFileTokenBuffer {{{*/ 207 205 void KMLFileTokenBuffer(char** pbuffer,int* pibuf,int* pbuflen, 208 206 int c, … … 228 226 } 229 227 /*}}}*/ 230 231 /*FUNCTION KMLFileTagName {{{1*/ 228 /*FUNCTION KMLFileTagName {{{*/ 232 229 char* KMLFileTagName(char* pname, 233 230 char* ktag){ … … 237 234 } 238 235 /*}}}*/ 239 240 /*FUNCTION KMLFileTagName {{{1*/ 236 /*FUNCTION KMLFileTagName {{{*/ 241 237 char* KMLFileTagName(char* pname,int *m,int maxlen, 242 238 char* ktag){ … … 248 244 249 245 if (strncmp(&ktag[0],"<" ,1) || strncmp(&ktag[strlen(ktag)-1],">",1)) 250 _error _("KMLFileTagName -- Missing tag delimiters in %s.\n",ktag);246 _error2_("KMLFileTagName -- Missing tag delimiters in " << ktag << ".\n"); 251 247 252 248 /* strtok modifies ktag, so work on copy */ … … 258 254 259 255 ktokn=strtok(ktagi,"< >"); 260 // _p rintf_(true,"KMLFileTagName -- initial token=\"%s\".\n",ktokn);256 // _pprintLine_("KMLFileTagName -- initial token=\"" << ktokn << "\"."); 261 257 262 258 if (!pname) { … … 268 264 269 265 if (maxlen && (maxlen < strlen(ktokn))) { 270 _p rintf_(true,"KMLFileTagName -- string field too short for %s.\n",ktag);271 _p rintf_(true,"KMLFileTagName -- \"%s\" truncated to %d characters.\n",ktokn,maxlen);266 _pprintLine_("KMLFileTagName -- string field too short for " << ktag << "."); 267 _pprintLine_("KMLFileTagName -- \"" << ktokn << "\" truncated to " << maxlen << " characters."); 272 268 strncpy(pname,ktokn,maxlen); 273 269 } … … 283 279 } 284 280 /*}}}*/ 285 286 /*FUNCTION KMLFileTagAttrib {{{1*/ 281 /*FUNCTION KMLFileTagAttrib {{{*/ 287 282 int KMLFileTagAttrib(KML_Object* kobj, 288 283 char* ktag){ … … 305 300 /* return first non blank and move past subsequent blank */ 306 301 ktokn=strtok(ktagi," "); 307 // _p rintf_(true,"KMLFileTagAttrib -- initial token=\"%s\".\n",ktokn);302 // _pprintLine_("KMLFileTagAttrib -- initial token=\"" << ktokn << "\"."); 308 303 309 304 /* return next non " =?/>" and move past subsequent " =?/>" */ … … 312 307 /* return next non quote and move past subsequent quote */ 313 308 ktokv=strtok(NULL,quote); 314 // _p rintf_(true,"KMLFileTagAttrib -- attribute %s=\"%s\".\n",ktokn,ktokv);309 // _pprintLine_("KMLFileTagAttrib -- attribute " << ktokn << "=\"" << ktokv << "\"."); 315 310 316 311 /* add the attribute to the dataset */ … … 328 323 (!strncmp(&ktag[0],"<" ,1) && !strncmp(&ktag[strlen(ktag)-2],"/>",2))) 329 324 isolo=1; 330 // _p rintf_(true,"KMLFileTagAttrib -- isolo=%d.\n",isolo);325 // _pprintLine_("KMLFileTagAttrib -- isolo=" << isolo << "."); 331 326 332 327 return(isolo); 333 328 } 334 329 /*}}}*/ 335 336 /*FUNCTION KMLFileTokenParse {{{1*/ 330 /*FUNCTION KMLFileTokenParse {{{*/ 337 331 int KMLFileTokenParse(int* pival, 338 332 char* ktag, … … 346 340 NULL,NULL)) || 347 341 (kstr[0] == '<')) 348 _error _("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);342 _error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); 349 343 350 344 sscanf(kstr,"%d",pival); … … 359 353 (kstr[1] != '/') || 360 354 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 361 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);355 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 362 356 else 363 357 xfree((void**)&kstr); 364 358 365 // _p rintf_(true,"KMLFileTokenParse -- %s=%d.\n",ktag,*pival);359 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pival << "."); 366 360 367 361 return(0); 368 362 } 369 363 /*}}}*/ 370 371 /*FUNCTION KMLFileTokenParse {{{1*/ 372 int KMLFileTokenParse(bool* pbval, 373 char* ktag, 374 FILE* fid){ 364 /*FUNCTION KMLFileTokenParse {{{*/ 365 int KMLFileTokenParse(bool* pbval, char* ktag, FILE* fid){ 375 366 376 367 int ival; … … 382 373 NULL,NULL)) || 383 374 (kstr[0] == '<')) 384 _error_("KMLFileTokenParse -- Missing bool field for %s.\n",ktag);375 {_error2_("KMLFileTokenParse -- Missing bool field for " << ktag << ".\n");} 385 376 386 377 sscanf(kstr,"%d",&ival); … … 396 387 (kstr[1] != '/') || 397 388 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 398 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);389 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 399 390 else 400 391 xfree((void**)&kstr); 401 392 402 // _p rintf_(true,"KMLFileTokenParse -- %s=%s.\n",ktag,(*pbval ? "true" : "false"));393 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << (*pbval ? "true" : "false") << "."); 403 394 404 395 return(0); 405 396 } 406 397 /*}}}*/ 407 408 /*FUNCTION KMLFileTokenParse {{{1*/ 398 /*FUNCTION KMLFileTokenParse {{{*/ 409 399 char* KMLFileTokenParse(char* pstr, 410 400 char* ktag, … … 416 406 } 417 407 /*}}}*/ 418 419 /*FUNCTION KMLFileTokenParse {{{1*/ 408 /*FUNCTION KMLFileTokenParse {{{*/ 420 409 char* KMLFileTokenParse(char* pstr,int *m,int maxlen, 421 410 char* ktag, … … 429 418 NULL,NULL)) || 430 419 (kstr[0] == '<')) 431 _error _("KMLFileTokenParse -- Missing string field for %s.\n",ktag);420 _error2_("KMLFileTokenParse -- Missing string field for " << ktag << ".\n"); 432 421 433 422 if (!pstr) { … … 439 428 440 429 if (maxlen && (maxlen < strlen(kstr))) { 441 _p rintf_(true,"KMLFileTokenParse -- string field too short for %s.\n",ktag);442 _p rintf_(true,"KMLFileTokenParse -- \"%s\" truncated to %d characters.\n",kstr,maxlen);430 _pprintLine_("KMLFileTokenParse -- string field too short for " << ktag << "."); 431 _pprintLine_("KMLFileTokenParse -- \"" << kstr << "\" truncated to " << maxlen << " characters."); 443 432 strncpy(pstr,kstr,maxlen); 444 433 } … … 459 448 (kstr[1] != '/') || 460 449 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 461 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);450 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 462 451 else 463 452 xfree((void**)&kstr); 464 453 465 // _p rintf_(true,"KMLFileTokenParse -- %s=\"%s\".\n",ktag,pstr);454 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=\"" << pstr << "\"."); 466 455 467 456 return(pstr); 468 457 } 469 458 /*}}}*/ 470 471 /*FUNCTION KMLFileTokenParse {{{1*/ 459 /*FUNCTION KMLFileTokenParse {{{*/ 472 460 int KMLFileTokenParse(float* pfval, 473 461 char* ktag, … … 481 469 NULL,NULL)) || 482 470 (kstr[0] == '<')) 483 _error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);471 {_error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n");} 484 472 485 473 sscanf(kstr,"%g",pfval); … … 494 482 (kstr[1] != '/') || 495 483 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 496 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);484 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 497 485 else 498 486 xfree((void**)&kstr); 499 487 500 // _p rintf_(true,"KMLFileTokenParse -- %s=%g.\n",ktag,*pfval);488 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pfval << "."); 501 489 502 490 return(0); 503 491 } 504 492 /*}}}*/ 505 506 /*FUNCTION KMLFileTokenParse {{{1*/ 493 /*FUNCTION KMLFileTokenParse {{{*/ 507 494 int KMLFileTokenParse(double* pdval, 508 495 char* ktag, … … 516 503 NULL,NULL)) || 517 504 (kstr[0] == '<')) 518 _error _("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);505 _error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); 519 506 520 507 sscanf(kstr,"%lg",pdval); … … 529 516 (kstr[1] != '/') || 530 517 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 531 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);518 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 532 519 else 533 520 xfree((void**)&kstr); 534 521 535 // _p rintf_(true,"KMLFileTokenParse -- %s=%g.\n",ktag,*pdval);522 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pdval << "."); 536 523 537 524 return(0); 538 525 } 539 526 /*}}}*/ 540 541 /*FUNCTION KMLFileTokenParse {{{1*/ 527 /*FUNCTION KMLFileTokenParse {{{*/ 542 528 int KMLFileTokenParse(double **pdval,int* m,int maxlen, 543 529 char* ktag, … … 554 540 NULL,NULL)) || 555 541 (kstr[0] == '<')) 556 _error _("KMLFileTokenParse -- Missing double [m] field for %s.\n",ktag);542 _error2_("KMLFileTokenParse -- Missing double [m] field for " << ktag << ".\n"); 557 543 558 544 if (!*pdval) … … 568 554 i++; 569 555 if (maxlen && (maxlen < i+1)) 570 _error _("KMLFileTokenParse -- Double [m] field too short for %s.\n",ktag);556 _error2_("KMLFileTokenParse -- Double [m] field too short for " << ktag << ".\n"); 571 557 sscanf(ktok,"%lg",&((*pdval)[i])); 572 558 ktok=strtok(NULL,delim); … … 588 574 (kstr[1] != '/') || 589 575 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 590 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);576 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 591 577 else 592 578 xfree((void**)&kstr); 593 579 594 // _p rintf_(true,"KMLFileTokenParse -- %s=...\n",ktag);580 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); 595 581 // for (j=0; j<=i; j++) 596 // _p rintf_(true," [%d]: %lg\n",j,(*pdval)[j]);582 // _pprintLine_(" [" << j << "]: " << (*pdval)[j] << "g"); 597 583 598 584 return(0); 599 585 } 600 586 /*}}}*/ 601 602 /*FUNCTION KMLFileTokenParse {{{1*/ 587 /*FUNCTION KMLFileTokenParse {{{*/ 603 588 int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen, 604 589 char* ktag, … … 615 600 NULL,NULL)) || 616 601 (kstr[0] == '<')) 617 _error _("KMLFileTokenParse -- Missing double [m x 3] field for %s.\n",ktag);602 _error2_("KMLFileTokenParse -- Missing double [m x 3] field for " << ktag << ".\n"); 618 603 619 604 if (!*pdval3) … … 632 617 j=0; 633 618 if (maxlen && (maxlen < i+1)) 634 _error _("KMLFileTokenParse -- Double [m x 3] field too short for %s.\n",ktag);619 _error2_("KMLFileTokenParse -- Double [m x 3] field too short for " << ktag << ".\n"); 635 620 } 636 621 sscanf(ktok,"%lg",&((*pdval3)[i][j])); … … 646 631 647 632 if (j != 2) 648 _p rintf_(true,"KMLFileTokenParse -- Double [m x 3] field for %s does not have multiple of 3 values.\n",ktag);633 _pprintLine_("KMLFileTokenParse -- Double [m x 3] field for " << ktag << " does not have multiple of 3 values."); 649 634 650 635 /* get additional token and compare to closing tag */ … … 656 641 (kstr[1] != '/') || 657 642 (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) 658 _error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);643 {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} 659 644 else 660 645 xfree((void**)&kstr); 661 646 662 // _p rintf_(true,"KMLFileTokenParse -- %s=...\n",ktag);647 // _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); 663 648 // for (j=0; j<=i; j++) 664 // _p rintf_(true," [%d][0-2]: %lg,%lg,%lg\n",j,(*pdval3)[j][0],(*pdval3)[j][1],(*pdval3)[j][2]);649 // _pprintLine_(" [" << j << "][0-2]: " << (*pdval3)[j][0] << "g," << (*pdval3)[j][1] << "g," << (*pdval3)[j][2] << "g"); 665 650 666 651 return(0); 667 652 } 668 653 /*}}}*/ 669 670 /*FUNCTION KMLFileTagSkip {{{1*/ 654 /*FUNCTION KMLFileTagSkip {{{*/ 671 655 int KMLFileTagSkip(char* ktag, 672 656 FILE* fid){ … … 677 661 opening tag, must find corresponding closing tag */ 678 662 679 _p rintf_(true,"KMLFileTagSkip -- input tag %s.\n",ktag);663 _pprintLine_("KMLFileTagSkip -- input tag " << ktag << "."); 680 664 681 665 /* if next token is a closing tag, compare to input */ … … 686 670 (kstr[1] == '/') && 687 671 (!strncmp(&(kstr[2]),&(ktag[1]),(strcspn(ktag," >")-1)/sizeof(char)))) { 688 _p rintf_(true,"KMLFileTagSkip -- closing tag %s.\n",kstr);672 _pprintLine_("KMLFileTagSkip -- closing tag " << kstr << "."); 689 673 xfree((void**)&kstr); 690 674 return(0); … … 695 679 else if ((kstr[0] == '<') && 696 680 (kstr[1] != '/')) { 697 _p rintf_(true,"KMLFileTagSkip -- opening tag %s.\n",kstr);681 _pprintLine_("KMLFileTagSkip -- opening tag " << kstr << "."); 698 682 KMLFileTagSkip(kstr, 699 683 fid); … … 704 688 else if ((kstr[0] == '<') && 705 689 (kstr[1] == '/')) { 706 _error _("KMLFileTagSkip -- Unexpected closing tag %s.\n",kstr);690 _error2_("KMLFileTagSkip -- Unexpected closing tag " << kstr << ".\n"); 707 691 } 708 692 … … 710 694 } 711 695 712 _error _("KMLFileTokenParse -- Corresponding closing tag for %s not found.\n",ktag);696 _error2_("KMLFileTokenParse -- Corresponding closing tag for " << ktag << " not found.\n"); 713 697 714 698 return(0); 715 699 } 716 700 /*}}}*/ 717 -
issm/trunk/src/c/objects/KML/KMLFileReadUtils.h
r11527 r12706 6 6 #define _KMLFILEREADUTILS_H 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" -
issm/trunk/src/c/objects/KML/KML_Attribute.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Attribute::KML_Attribute(){{{ 1*/23 /*FUNCTION KML_Attribute::KML_Attribute(){{{*/ 24 24 KML_Attribute::KML_Attribute(){ 25 25 … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION KML_Attribute::~KML_Attribute(){{{ 1*/31 /*FUNCTION KML_Attribute::~KML_Attribute(){{{*/ 32 32 KML_Attribute::~KML_Attribute(){ 33 33 … … 39 39 40 40 /*Other*/ 41 /*FUNCTION KML_Attribute::Echo {{{ 1*/41 /*FUNCTION KML_Attribute::Echo {{{*/ 42 42 void KML_Attribute::Echo(){ 43 43 … … 45 45 bool flag=true; 46 46 47 _printf_(flag," ");47 if(flag) _pprintString_(" "); 48 48 for (i=0;i<10-strlen(name);i++) 49 _printf_(flag," ");50 _printf_(flag,"%s: \"%s\"\n",name,value);49 if(flag) _pprintString_(" "); 50 if(flag) _pprintLine_(name << ": \"" << value << "\""); 51 51 52 52 return; 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION KML_Attribute::DeepEcho {{{ 1*/55 /*FUNCTION KML_Attribute::DeepEcho {{{*/ 56 56 void KML_Attribute::DeepEcho(){ 57 57 … … 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION KML_Attribute::DeepEcho {{{ 1*/65 /*FUNCTION KML_Attribute::DeepEcho {{{*/ 66 66 void KML_Attribute::DeepEcho(const char* indent){ 67 67 … … 69 69 bool flag=true; 70 70 71 _printf_(flag,"%s ",indent);71 if(flag) _pprintString_(indent << " "); 72 72 for (i=0;i<10-strlen(name);i++) 73 _printf_(flag," ");74 _printf_(flag,"%s: \"%s\"\n",name,value);73 if(flag) _pprintString_(" "); 74 if(flag) _pprintLine_(name << ": \"" << value << "\""); 75 75 76 76 return; 77 77 } 78 78 /*}}}*/ 79 /*FUNCTION KML_Attribute::Write {{{ 1*/79 /*FUNCTION KML_Attribute::Write {{{*/ 80 80 void KML_Attribute::Write(FILE* filout,const char* indent){ 81 81 … … 87 87 } 88 88 /*}}}*/ 89 /*FUNCTION KML_Attribute::Read {{{ 1*/89 /*FUNCTION KML_Attribute::Read {{{*/ 90 90 void KML_Attribute::Read(FILE* fid,char* kstr){ 91 91 … … 97 97 } 98 98 /*}}}*/ 99 /*FUNCTION KML_Attribute::Alloc {{{ 1*/99 /*FUNCTION KML_Attribute::Alloc {{{*/ 100 100 void KML_Attribute::Alloc(const char* namei,const char* valuei){ 101 101 … … 109 109 } 110 110 /*}}}*/ 111 /*FUNCTION KML_Attribute::Add {{{ 1*/111 /*FUNCTION KML_Attribute::Add {{{*/ 112 112 void KML_Attribute::Add(DataSet* attrib){ 113 113 … … 117 117 } 118 118 /*}}}*/ 119 /*FUNCTION KML_Attribute::Get {{{ 1*/119 /*FUNCTION KML_Attribute::Get {{{*/ 120 120 void KML_Attribute::Get(char** pvalueo,char* deflt){ 121 121 -
issm/trunk/src/c/objects/KML/KML_Attribute.h
r11237 r12706 6 6 #define _KML_ATTRIBUTE_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 22 22 char* value; 23 23 24 /*KML_Attribute constructors, destructors {{{ 1*/24 /*KML_Attribute constructors, destructors {{{*/ 25 25 KML_Attribute(); 26 26 ~KML_Attribute(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{*/ 29 29 virtual void Echo(); 30 30 virtual void DeepEcho(); 31 31 virtual void DeepEcho(const char* indent); 32 int Id(){_error _("Not implemented yet.");};33 int MyRank(){_error _("Not implemented yet.");};34 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};35 int MarshallSize(){_error _("Not implemented yet.");};36 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};37 int ObjectEnum(){_error _("Not implemented yet.");};38 Object* copy(){_error _("Not implemented yet.");};32 int Id(){_error2_("Not implemented yet.");}; 33 int MyRank(){_error2_("Not implemented yet.");}; 34 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 35 int MarshallSize(){_error2_("Not implemented yet.");}; 36 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 37 int ObjectEnum(){_error2_("Not implemented yet.");}; 38 Object* copy(){_error2_("Not implemented yet.");}; 39 39 /*}}}*/ 40 40 -
issm/trunk/src/c/objects/KML/KML_ColorStyle.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_ColorStyle::KML_ColorStyle(){{{ 1*/23 /*FUNCTION KML_ColorStyle::KML_ColorStyle(){{{*/ 24 24 KML_ColorStyle::KML_ColorStyle(){ 25 25 … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION KML_ColorStyle::~KML_ColorStyle(){{{ 1*/31 /*FUNCTION KML_ColorStyle::~KML_ColorStyle(){{{*/ 32 32 KML_ColorStyle::~KML_ColorStyle(){ 33 33 … … 38 38 39 39 /*Other*/ 40 /*FUNCTION KML_ColorStyle::Echo {{{ 1*/40 /*FUNCTION KML_ColorStyle::Echo {{{*/ 41 41 void KML_ColorStyle::Echo(){ 42 42 … … 45 45 KML_SubStyle::Echo(); 46 46 47 _printf_(flag," color: %s\n" ,color);48 _printf_(flag," colormode: %s\n" ,colormode);47 if(flag) _pprintLine_(" color: " << color); 48 if(flag) _pprintLine_(" colormode: " << colormode); 49 49 50 50 return; 51 51 } 52 52 /*}}}*/ 53 /*FUNCTION KML_ColorStyle::DeepEcho {{{ 1*/53 /*FUNCTION KML_ColorStyle::DeepEcho {{{*/ 54 54 void KML_ColorStyle::DeepEcho(){ 55 55 … … 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION KML_ColorStyle::DeepEcho {{{ 1*/63 /*FUNCTION KML_ColorStyle::DeepEcho {{{*/ 64 64 void KML_ColorStyle::DeepEcho(const char* indent){ 65 65 … … 68 68 KML_SubStyle::DeepEcho(indent); 69 69 70 _printf_(flag,"%s color: %s\n" ,indent,color); 71 _printf_(flag,"%s colormode: %s\n" ,indent,colormode); 72 73 return; 70 if(flag) _pprintLine_(indent << " color: " << color); 71 if(flag) _pprintLine_(indent << " colormode: " << colormode); 74 72 } 75 73 /*}}}*/ 76 /*FUNCTION KML_ColorStyle::Write {{{ 1*/74 /*FUNCTION KML_ColorStyle::Write {{{*/ 77 75 void KML_ColorStyle::Write(FILE* filout,const char* indent){ 78 76 … … 87 85 } 88 86 /*}}}*/ 89 /*FUNCTION KML_ColorStyle::Read {{{ 1*/87 /*FUNCTION KML_ColorStyle::Read {{{*/ 90 88 void KML_ColorStyle::Read(FILE* fid,char* kstr){ 91 89 … … 95 93 return; 96 94 else if (!strncmp(kstr,"</",2)) 97 _error_("KML_ColorStyle::Read -- Unexpected closing tag %s.\n",kstr);95 {_error2_("KML_ColorStyle::Read -- Unexpected closing tag " << kstr);} 98 96 else if (strncmp(kstr,"<",1)) 99 _error_("KML_ColorStyle::Read -- Unexpected field \"%s\".\n",kstr);97 {_error2_("KML_ColorStyle::Read -- Unexpected field \"" << kstr << "\"");} 100 98 101 99 else if (!strcmp(kstr,"<color>")) 102 KMLFileTokenParse( color ,NULL,KML_COLORSTYLE_COLOR_LENGTH, 103 kstr, 104 fid); 100 KMLFileTokenParse( color ,NULL,KML_COLORSTYLE_COLOR_LENGTH, kstr, fid); 105 101 else if (!strcmp(kstr,"<colorMode>")) 106 KMLFileTokenParse( colormode ,NULL,KML_COLORSTYLE_COLORMODE_LENGTH, 107 kstr, 108 fid); 102 KMLFileTokenParse( colormode ,NULL,KML_COLORSTYLE_COLORMODE_LENGTH, kstr, fid); 109 103 110 104 else if (!strncmp(kstr,"<",1)) -
issm/trunk/src/c/objects/KML/KML_ColorStyle.h
r11237 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 #include "../../include/include.h" 14 14 #include "../../shared/Exceptions/exceptions.h" … … 25 25 char colormode[KML_COLORSTYLE_COLORMODE_LENGTH+1]; 26 26 27 /*KML_ColorStyle constructors, destructors {{{ 1*/27 /*KML_ColorStyle constructors, destructors {{{*/ 28 28 KML_ColorStyle(); 29 29 ~KML_ColorStyle(); 30 30 /*}}}*/ 31 /*Object virtual functions definitions:{{{ 1*/31 /*Object virtual functions definitions:{{{*/ 32 32 void Echo(); 33 33 void DeepEcho(); … … 35 35 void Write(FILE* fid,const char* indent); 36 36 void Read(FILE* fid,char* kstr); 37 int Id(){_error _("Not implemented yet.");};38 int MyRank(){_error _("Not implemented yet.");};39 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};40 int MarshallSize(){_error _("Not implemented yet.");};41 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};42 int ObjectEnum(){_error _("Not implemented yet.");};43 Object* copy(){_error _("Not implemented yet.");};37 int Id(){_error2_("Not implemented yet.");}; 38 int MyRank(){_error2_("Not implemented yet.");}; 39 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 40 int MarshallSize(){_error2_("Not implemented yet.");}; 41 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 42 int ObjectEnum(){_error2_("Not implemented yet.");}; 43 Object* copy(){_error2_("Not implemented yet.");}; 44 44 /*}}}*/ 45 45 -
issm/trunk/src/c/objects/KML/KML_Comment.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Comment::KML_Comment(){{{ 1*/23 /*FUNCTION KML_Comment::KML_Comment(){{{*/ 24 24 KML_Comment::KML_Comment(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_Comment::~KML_Comment(){{{ 1*/30 /*FUNCTION KML_Comment::~KML_Comment(){{{*/ 31 31 KML_Comment::~KML_Comment(){ 32 32 … … 37 37 38 38 /*Other*/ 39 /*FUNCTION KML_Comment::Echo {{{ 1*/39 /*FUNCTION KML_Comment::Echo {{{*/ 40 40 void KML_Comment::Echo(){ 41 41 42 42 bool flag=true; 43 43 44 _printf_(flag," ");45 _printf_(flag,"%s\n",value);44 if(flag) _pprintString_(" "); 45 if(flag) _pprintLine_(value); 46 46 47 47 return; 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION KML_Comment::DeepEcho {{{ 1*/50 /*FUNCTION KML_Comment::DeepEcho {{{*/ 51 51 void KML_Comment::DeepEcho(){ 52 52 … … 58 58 } 59 59 /*}}}*/ 60 /*FUNCTION KML_Comment::DeepEcho {{{ 1*/60 /*FUNCTION KML_Comment::DeepEcho {{{*/ 61 61 void KML_Comment::DeepEcho(const char* indent){ 62 62 63 63 bool flag=true; 64 64 65 _printf_(flag,"%s ",indent);66 _printf_(flag,"%s\n",value);65 if(flag) _pprintString_(indent << " "); 66 if(flag) _pprintLine_(value); 67 67 68 68 return; 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION KML_Comment::Write {{{ 1*/71 /*FUNCTION KML_Comment::Write {{{*/ 72 72 void KML_Comment::Write(FILE* filout,const char* indent){ 73 73 … … 81 81 } 82 82 /*}}}*/ 83 /*FUNCTION KML_Comment::Read {{{ 1*/83 /*FUNCTION KML_Comment::Read {{{*/ 84 84 void KML_Comment::Read(FILE* fid,char* kstr){ 85 85 … … 91 91 } 92 92 /*}}}*/ 93 /*FUNCTION KML_Comment::Alloc {{{ 1*/93 /*FUNCTION KML_Comment::Alloc {{{*/ 94 94 void KML_Comment::Alloc(const char* valuei){ 95 95 … … 100 100 } 101 101 /*}}}*/ 102 /*FUNCTION KML_Comment::Add {{{ 1*/102 /*FUNCTION KML_Comment::Add {{{*/ 103 103 void KML_Comment::Add(DataSet* commnt){ 104 104 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION KML_Comment::Get {{{ 1*/110 /*FUNCTION KML_Comment::Get {{{*/ 111 111 void KML_Comment::Get(char** pvalueo){ 112 112 -
issm/trunk/src/c/objects/KML/KML_Comment.h
r11237 r12706 6 6 #define _KML_COMMENT_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 22 22 char* value; 23 23 24 /*KML_Comment constructors, destructors {{{ 1*/24 /*KML_Comment constructors, destructors {{{*/ 25 25 KML_Comment(); 26 26 ~KML_Comment(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{*/ 29 29 virtual void Echo(); 30 30 virtual void DeepEcho(); 31 31 virtual void DeepEcho(const char* indent); 32 int Id(){_error _("Not implemented yet.");};33 int MyRank(){_error _("Not implemented yet.");};34 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};35 int MarshallSize(){_error _("Not implemented yet.");};36 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};37 int ObjectEnum(){_error _("Not implemented yet.");};38 Object* copy(){_error _("Not implemented yet.");};32 int Id(){_error2_("Not implemented yet.");}; 33 int MyRank(){_error2_("Not implemented yet.");}; 34 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 35 int MarshallSize(){_error2_("Not implemented yet.");}; 36 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 37 int ObjectEnum(){_error2_("Not implemented yet.");}; 38 Object* copy(){_error2_("Not implemented yet.");}; 39 39 /*}}}*/ 40 40 -
issm/trunk/src/c/objects/KML/KML_Container.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Container::KML_Container(){{{ 1*/23 /*FUNCTION KML_Container::KML_Container(){{{*/ 24 24 KML_Container::KML_Container(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_Container::~KML_Container(){{{ 1*/30 /*FUNCTION KML_Container::~KML_Container(){{{*/ 31 31 KML_Container::~KML_Container(){ 32 32 … … 40 40 41 41 /*Other*/ 42 /*FUNCTION KML_Container::Echo {{{ 1*/42 /*FUNCTION KML_Container::Echo {{{*/ 43 43 void KML_Container::Echo(){ 44 44 … … 47 47 KML_Feature::Echo(); 48 48 49 _printf_(flag," feature: (size=%d)\n" ,feature->Size());49 if(flag) _pprintLine_(" feature: (size=" << feature->Size() << ")"); 50 50 51 51 return; 52 52 } 53 53 /*}}}*/ 54 /*FUNCTION KML_Container::DeepEcho {{{ 1*/54 /*FUNCTION KML_Container::DeepEcho {{{*/ 55 55 void KML_Container::DeepEcho(){ 56 56 … … 62 62 } 63 63 /*}}}*/ 64 /*FUNCTION KML_Container::DeepEcho {{{ 1*/64 /*FUNCTION KML_Container::DeepEcho {{{*/ 65 65 void KML_Container::DeepEcho(const char* indent){ 66 66 … … 78 78 if (feature->Size()) 79 79 for (i=0; i<feature->Size(); i++) { 80 _printf_(flag,"%s feature: -------- begin [%d] --------\n" ,indent,i);80 if(flag) _pprintLine_(indent << " feature: -------- begin [" << i << "] --------"); 81 81 ((KML_Feature *)feature->GetObjectByOffset(i))->DeepEcho(indent2); 82 _printf_(flag,"%s feature: -------- end [%d] --------\n" ,indent,i);82 if(flag) _pprintLine_(indent << " feature: -------- end [" << i << "] --------"); 83 83 } 84 84 else 85 _printf_(flag,"%s feature: [empty]\n" ,indent);85 if(flag) _pprintLine_(indent << " feature: [empty]"); 86 86 87 87 return; 88 88 } 89 89 /*}}}*/ 90 /*FUNCTION KML_Container::Write {{{ 1*/90 /*FUNCTION KML_Container::Write {{{*/ 91 91 void KML_Container::Write(FILE* filout,const char* indent){ 92 92 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION KML_Container::Read {{{ 1*/110 /*FUNCTION KML_Container::Read {{{*/ 111 111 void KML_Container::Read(FILE* fid,char* kstr){ 112 112 … … 120 120 } 121 121 else if (!strncmp(kstr,"</",2)) 122 _error_("KML_Container::Read -- Unexpected closing tag %s.\n",kstr);122 {_error2_("KML_Container::Read -- Unexpected closing tag " << kstr );} 123 123 else if (strncmp(kstr,"<",1)) 124 _error_("KML_Container::Read -- Unexpected field \"%s\".\n",kstr);124 {_error2_("KML_Container::Read -- Unexpected field \"" << kstr << "\"");} 125 125 126 126 else if (!strncmp(kstr,"<Placemark",10)) { … … 154 154 } 155 155 /*}}}*/ 156 /*FUNCTION KML_Container::WriteExp {{{ 1*/156 /*FUNCTION KML_Container::WriteExp {{{*/ 157 157 void KML_Container::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 158 158 -
issm/trunk/src/c/objects/KML/KML_Container.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 22 22 DataSet* feature; 23 23 24 /*KML_Container constructors, destructors {{{ 1*/24 /*KML_Container constructors, destructors {{{*/ 25 25 KML_Container(); 26 26 ~KML_Container(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{*/ 29 29 void Echo(); 30 30 void DeepEcho(); … … 33 33 void Read(FILE* fid,char* kstr); 34 34 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 35 int Id(){_error _("Not implemented yet.");};36 int MyRank(){_error _("Not implemented yet.");};37 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};38 int MarshallSize(){_error _("Not implemented yet.");};39 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};40 int ObjectEnum(){_error _("Not implemented yet.");};41 Object* copy(){_error _("Not implemented yet.");};35 int Id(){_error2_("Not implemented yet.");}; 36 int MyRank(){_error2_("Not implemented yet.");}; 37 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 38 int MarshallSize(){_error2_("Not implemented yet.");}; 39 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 40 int ObjectEnum(){_error2_("Not implemented yet.");}; 41 Object* copy(){_error2_("Not implemented yet.");}; 42 42 /*}}}*/ 43 43 -
issm/trunk/src/c/objects/KML/KML_Document.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Document::KML_Document(){{{ 1*/23 /*FUNCTION KML_Document::KML_Document(){{{*/ 24 24 KML_Document::KML_Document(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_Document::~KML_Document(){{{ 1*/30 /*FUNCTION KML_Document::~KML_Document(){{{*/ 31 31 KML_Document::~KML_Document(){ 32 32 … … 37 37 38 38 /*Other*/ 39 /*FUNCTION KML_Document::Echo {{{ 1*/39 /*FUNCTION KML_Document::Echo {{{*/ 40 40 void KML_Document::Echo(){ 41 41 42 42 bool flag=true; 43 43 44 _printf_(flag,"KML_Document:\n");44 if(flag) _pprintLine_("KML_Document:"); 45 45 KML_Container::Echo(); 46 46 … … 49 49 /*}}}*/ 50 50 51 /*FUNCTION KML_Document::DeepEcho {{{ 1*/51 /*FUNCTION KML_Document::DeepEcho {{{*/ 52 52 void KML_Document::DeepEcho(){ 53 53 … … 60 60 /*}}}*/ 61 61 62 /*FUNCTION KML_Document::DeepEcho {{{ 1*/62 /*FUNCTION KML_Document::DeepEcho {{{*/ 63 63 void KML_Document::DeepEcho(const char* indent){ 64 64 65 65 bool flag=true; 66 66 67 _printf_(flag,"%sKML_Document:\n",indent);67 if(flag) _pprintLine_(indent << "KML_Document:"); 68 68 KML_Container::DeepEcho(indent); 69 69 … … 72 72 /*}}}*/ 73 73 74 /*FUNCTION KML_Document::Write {{{ 1*/74 /*FUNCTION KML_Document::Write {{{*/ 75 75 void KML_Document::Write(FILE* filout,const char* indent){ 76 76 … … 88 88 /*}}}*/ 89 89 90 /*FUNCTION KML_Document::Read {{{ 1*/90 /*FUNCTION KML_Document::Read {{{*/ 91 91 void KML_Document::Read(FILE* fid,char* kstr){ 92 92 … … 110 110 } 111 111 else if (!strncmp(kstri,"</",2)) 112 _error_("KML_Document::Read -- Unexpected closing tag %s.\n",kstri);112 {_error2_("KML_Document::Read -- Unexpected closing tag " << kstri << ".\n");} 113 113 else if (strncmp(kstri,"<",1)) 114 _error_("KML_Document::Read -- Unexpected field \"%s\".\n",kstri);114 {_error2_("KML_Document::Read -- Unexpected field \"" << kstri << "\".\n");} 115 115 116 116 else if (!strncmp(kstri,"<",1)) -
issm/trunk/src/c/objects/KML/KML_Document.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 20 20 public: 21 21 22 /*KML_Document constructors, destructors {{{ 1*/22 /*KML_Document constructors, destructors {{{*/ 23 23 KML_Document(); 24 24 ~KML_Document(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{ */ 27 27 void Echo(); 28 28 void DeepEcho(); … … 30 30 void Write(FILE* fid,const char* indent); 31 31 void Read(FILE* fid,char* kstr); 32 int Id(){_error _("Not implemented yet.");};33 int MyRank(){_error _("Not implemented yet.");};34 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};35 int MarshallSize(){_error _("Not implemented yet.");};36 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};37 int ObjectEnum(){_error _("Not implemented yet.");};38 Object* copy(){_error _("Not implemented yet.");};32 int Id(){_error2_("Not implemented yet.");}; 33 int MyRank(){_error2_("Not implemented yet.");}; 34 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 35 int MarshallSize(){_error2_("Not implemented yet.");}; 36 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 37 int ObjectEnum(){_error2_("Not implemented yet.");}; 38 Object* copy(){_error2_("Not implemented yet.");}; 39 39 /*}}}*/ 40 40 -
issm/trunk/src/c/objects/KML/KML_Feature.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Feature::KML_Feature(){{{ 1*/23 /*FUNCTION KML_Feature::KML_Feature(){{{*/ 24 24 KML_Feature::KML_Feature(){ 25 25 … … 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION KML_Feature::~KML_Feature(){{{ 1*/37 /*FUNCTION KML_Feature::~KML_Feature(){{{*/ 38 38 KML_Feature::~KML_Feature(){ 39 39 … … 47 47 48 48 /*Other*/ 49 /*FUNCTION KML_Feature::Echo {{{ 1*/49 /*FUNCTION KML_Feature::Echo {{{*/ 50 50 void KML_Feature::Echo(){ 51 51 … … 54 54 KML_Object::Echo(); 55 55 56 _printf_(flag," name: \"%s\"\n" ,name);57 _printf_(flag," visibility: %s\n" ,(visibility ? "true" : "false"));58 _printf_(flag," open: %s\n" ,(open ? "true" : "false"));59 _printf_(flag," snippet: \"%s\"\n" ,snippet);60 _printf_(flag," descript: \"%s\"\n" ,descript);61 _printf_(flag," styleurl: \"%s\"\n" ,styleurl);62 _printf_(flag," style: (size=%d)\n" ,style->Size());56 if(flag) _pprintLine_(" name: \"" << name << "\""); 57 if(flag) _pprintLine_(" visibility: " << (visibility ? "true" : "false")); 58 if(flag) _pprintLine_(" open: " << (open ? "true" : "false")); 59 if(flag) _pprintLine_(" snippet: \"" << snippet << "\""); 60 if(flag) _pprintLine_(" descript: \"" << descript << "\""); 61 if(flag) _pprintLine_(" styleurl: \"" << styleurl << "\""); 62 if(flag) _pprintLine_(" style: (size=" << style->Size() << ")"); 63 63 64 64 return; 65 65 } 66 66 /*}}}*/ 67 68 /*FUNCTION KML_Feature::DeepEcho {{{1*/ 67 /*FUNCTION KML_Feature::DeepEcho {{{*/ 69 68 void KML_Feature::DeepEcho(){ 70 69 … … 76 75 } 77 76 /*}}}*/ 78 79 /*FUNCTION KML_Feature::DeepEcho {{{1*/ 77 /*FUNCTION KML_Feature::DeepEcho {{{*/ 80 78 void KML_Feature::DeepEcho(const char* indent){ 81 79 … … 86 84 KML_Object::DeepEcho(indent); 87 85 88 _printf_(flag,"%s name: \"%s\"\n" ,indent,name);89 _printf_(flag,"%s visibility: %s\n" ,indent,(visibility ? "true" : "false"));90 _printf_(flag,"%s open: %s\n" ,indent,(open ? "true" : "false"));91 _printf_(flag,"%s snippet: \"%s\"\n" ,indent,snippet);92 _printf_(flag,"%s descript: \"%s\"\n" ,indent,descript);93 _printf_(flag,"%s styleurl: \"%s\"\n" ,indent,styleurl);86 if(flag) _pprintLine_(indent << " name: \"" << name << "\""); 87 if(flag) _pprintLine_(indent << " visibility: " << (visibility ? "true" : "false")); 88 if(flag) _pprintLine_(indent << " open: " << (open ? "true" : "false")); 89 if(flag) _pprintLine_(indent << " snippet: \"" << snippet << "\""); 90 if(flag) _pprintLine_(indent << " descript: \"" << descript << "\""); 91 if(flag) _pprintLine_(indent << " styleurl: \"" << styleurl << "\""); 94 92 95 93 /* loop over any styles for the feature */ … … 100 98 if (style->Size()) 101 99 for (i=0; i<style->Size(); i++) { 102 _printf_(flag,"%s style: -------- begin [%d] --------\n" ,indent,i);100 if(flag) _pprintLine_(indent << " style: -------- begin [" << i << "] --------"); 103 101 ((KML_Style *)style->GetObjectByOffset(i))->DeepEcho(indent2); 104 _printf_(flag,"%s style: -------- end [%d] --------\n" ,indent,i);102 if(flag) _pprintLine_(indent << " style: -------- end [" << i << "] --------"); 105 103 } 106 104 else 107 _printf_(flag,"%s style: [empty]\n" ,indent);105 if(flag) _pprintLine_(indent << " style: [empty]"); 108 106 109 107 return; 110 108 } 111 109 /*}}}*/ 112 113 /*FUNCTION KML_Feature::Write {{{1*/ 110 /*FUNCTION KML_Feature::Write {{{*/ 114 111 void KML_Feature::Write(FILE* filout,const char* indent){ 115 112 … … 142 139 } 143 140 /*}}}*/ 144 145 /*FUNCTION KML_Feature::Read {{{1*/ 141 /*FUNCTION KML_Feature::Read {{{*/ 146 142 void KML_Feature::Read(FILE* fid,char* kstr){ 147 143 … … 153 149 return; 154 150 else if (!strncmp(kstr,"</",2)) 155 _error_("KML_Feature::Read -- Unexpected closing tag %s.\n",kstr);151 {_error2_("KML_Feature::Read -- Unexpected closing tag " << kstr);} 156 152 else if (strncmp(kstr,"<",1)) 157 _error_("KML_Feature::Read -- Unexpected field \"%s\".\n",kstr);153 {_error2_("KML_Feature::Read -- Unexpected field \"" << kstr << "\"");} 158 154 159 155 else if (!strncmp(kstr,"<Style", 6)) { … … 164 160 165 161 else if (!strcmp(kstr,"<name>")) 166 KMLFileTokenParse( name ,NULL,KML_FEATURE_NAME_LENGTH, 167 kstr, 168 fid); 162 KMLFileTokenParse( name ,NULL,KML_FEATURE_NAME_LENGTH, kstr, fid); 169 163 else if (!strcmp(kstr,"<visibility>")) 170 KMLFileTokenParse(&visibility, 171 kstr, 172 fid); 164 KMLFileTokenParse(&visibility, kstr, fid); 173 165 else if (!strcmp(kstr,"<open>")) 174 KMLFileTokenParse(&open , 175 kstr, 176 fid); 166 KMLFileTokenParse(&open , kstr, fid); 177 167 else if (!strncmp(kstr,"<snippet", 8)) 178 KMLFileTokenParse( snippet ,NULL,KML_FEATURE_SNIPPET_LENGTH, 179 kstr, 180 fid); 168 KMLFileTokenParse( snippet ,NULL,KML_FEATURE_SNIPPET_LENGTH, kstr, fid); 181 169 else if (!strcmp(kstr,"<description>")) 182 KMLFileTokenParse( descript ,NULL,KML_FEATURE_DESCRIPT_LENGTH, 183 kstr, 184 fid); 170 KMLFileTokenParse( descript ,NULL,KML_FEATURE_DESCRIPT_LENGTH, kstr, fid); 185 171 else if (!strcmp(kstr,"<styleUrl>")) 186 KMLFileTokenParse( styleurl ,NULL,KML_FEATURE_STYLEURL_LENGTH, 187 kstr, 188 fid); 172 KMLFileTokenParse( styleurl ,NULL,KML_FEATURE_STYLEURL_LENGTH, kstr, fid); 189 173 190 174 else if (!strncmp(kstr,"<",1)) … … 194 178 } 195 179 /*}}}*/ 196 -
issm/trunk/src/c/objects/KML/KML_Feature.h
r11237 r12706 12 12 13 13 /*Headers:*/ 14 /*{{{ 1*/14 /*{{{*/ 15 15 #include "../../include/include.h" 16 16 #include "../../shared/Exceptions/exceptions.h" … … 34 34 DataSet* style; 35 35 36 /*KML_Feature constructors, destructors {{{ 1*/36 /*KML_Feature constructors, destructors {{{*/ 37 37 KML_Feature(); 38 38 ~KML_Feature(); 39 39 /*}}}*/ 40 /*Object virtual functions definitions:{{{ 1*/40 /*Object virtual functions definitions:{{{*/ 41 41 void Echo(); 42 42 void DeepEcho(); … … 44 44 void Write(FILE* fid,const char* indent); 45 45 void Read(FILE* fid,char* kstr); 46 int Id(){_error _("Not implemented yet.");};47 int MyRank(){_error _("Not implemented yet.");};48 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};49 int MarshallSize(){_error _("Not implemented yet.");};50 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};51 int ObjectEnum(){_error _("Not implemented yet.");};52 Object* copy(){_error _("Not implemented yet.");};46 int Id(){_error2_("Not implemented yet.");}; 47 int MyRank(){_error2_("Not implemented yet.");}; 48 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 49 int MarshallSize(){_error2_("Not implemented yet.");}; 50 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 51 int ObjectEnum(){_error2_("Not implemented yet.");}; 52 Object* copy(){_error2_("Not implemented yet.");}; 53 53 /*}}}*/ 54 54 -
issm/trunk/src/c/objects/KML/KML_File.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_File::KML_File(){{{ 1*/23 /*FUNCTION KML_File::KML_File(){{{*/ 24 24 KML_File::KML_File(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_File::~KML_File(){{{ 1*/30 /*FUNCTION KML_File::~KML_File(){{{*/ 31 31 KML_File::~KML_File(){ 32 32 … … 37 37 38 38 /*Other*/ 39 /*FUNCTION KML_File::Echo {{{ 1*/39 /*FUNCTION KML_File::Echo {{{*/ 40 40 void KML_File::Echo(){ 41 41 42 42 bool flag=true; 43 43 44 _printf_(flag,"KML_File:\n");44 if(flag) _pprintLine_("KML_File:"); 45 45 KML_Object::Echo(); 46 46 … … 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION KML_File::DeepEcho {{{ 1*/50 /*FUNCTION KML_File::DeepEcho {{{*/ 51 51 void KML_File::DeepEcho(){ 52 52 … … 58 58 } 59 59 /*}}}*/ 60 /*FUNCTION KML_File::DeepEcho {{{ 1*/60 /*FUNCTION KML_File::DeepEcho {{{*/ 61 61 void KML_File::DeepEcho(const char* indent){ 62 62 63 63 bool flag=true; 64 64 65 _printf_(flag,"%sKML_File:\n",indent);65 if(flag) _pprintLine_(indent << "KML_File:"); 66 66 KML_Object::DeepEcho(indent); 67 67 … … 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION KML_File::Write {{{ 1*/71 /*FUNCTION KML_File::Write {{{*/ 72 72 void KML_File::Write(FILE* filout,const char* indent){ 73 73 … … 84 84 } 85 85 /*}}}*/ 86 /*FUNCTION KML_File::Read {{{ 1*/86 /*FUNCTION KML_File::Read {{{*/ 87 87 void KML_File::Read(FILE* fid,char* kstr){ 88 88 … … 107 107 } 108 108 else if (!strncmp(kstri,"</",2)) 109 _error_("KML_File::Read -- Unexpected closing tag %s.\n",kstri);109 {_error2_("KML_File::Read -- Unexpected closing tag " << kstri << ".");} 110 110 else if (strncmp(kstri,"<",1)) 111 _error_("KML_File::Read -- Unexpected field \"%s\".\n",kstri);111 {_error2_("KML_File::Read -- Unexpected field \"" << kstri << "\"");} 112 112 113 113 else if (!strncmp(kstri,"<",1)) … … 126 126 } 127 127 /*}}}*/ 128 /*FUNCTION KML_File::WriteExp {{{ 1*/128 /*FUNCTION KML_File::WriteExp {{{*/ 129 129 void KML_File::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 130 130 -
issm/trunk/src/c/objects/KML/KML_File.h
r11527 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 20 20 public: 21 21 22 /*KML_File constructors, destructors {{{ 1*/22 /*KML_File constructors, destructors {{{*/ 23 23 KML_File(); 24 24 ~KML_File(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{*/ 27 27 void Echo(); 28 28 void DeepEcho(); … … 31 31 void Read(FILE* fid,char* kstr); 32 32 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 33 int Id(){_error _("Not implemented yet.");};34 int MyRank(){_error _("Not implemented yet.");};35 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};36 int MarshallSize(){_error _("Not implemented yet.");};37 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};38 int ObjectEnum(){_error _("Not implemented yet.");};39 Object* copy(){_error _("Not implemented yet.");};33 int Id(){_error2_("Not implemented yet.");}; 34 int MyRank(){_error2_("Not implemented yet.");}; 35 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 36 int MarshallSize(){_error2_("Not implemented yet.");}; 37 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 38 int ObjectEnum(){_error2_("Not implemented yet.");}; 39 Object* copy(){_error2_("Not implemented yet.");}; 40 40 /*}}}*/ 41 41 -
issm/trunk/src/c/objects/KML/KML_Folder.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Folder::KML_Folder(){{{ 1*/23 /*FUNCTION KML_Folder::KML_Folder(){{{*/ 24 24 KML_Folder::KML_Folder(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_Folder::~KML_Folder(){{{ 1*/30 /*FUNCTION KML_Folder::~KML_Folder(){{{*/ 31 31 KML_Folder::~KML_Folder(){ 32 32 … … 37 37 38 38 /*Other*/ 39 /*FUNCTION KML_Folder::Echo {{{ 1*/39 /*FUNCTION KML_Folder::Echo {{{*/ 40 40 void KML_Folder::Echo(){ 41 41 42 42 bool flag=true; 43 43 44 _printf_(flag,"KML_Folder:\n");44 if(flag) _pprintLine_("KML_Folder:"); 45 45 KML_Container::Echo(); 46 46 … … 49 49 /*}}}*/ 50 50 51 /*FUNCTION KML_Folder::DeepEcho {{{ 1*/51 /*FUNCTION KML_Folder::DeepEcho {{{*/ 52 52 void KML_Folder::DeepEcho(){ 53 53 … … 60 60 /*}}}*/ 61 61 62 /*FUNCTION KML_Folder::DeepEcho {{{ 1*/62 /*FUNCTION KML_Folder::DeepEcho {{{*/ 63 63 void KML_Folder::DeepEcho(const char* indent){ 64 64 65 65 bool flag=true; 66 66 67 _printf_(flag,"%sKML_Folder:\n",indent);67 if(flag) _pprintLine_(indent << "KML_Folder:"); 68 68 KML_Container::DeepEcho(indent); 69 69 … … 72 72 /*}}}*/ 73 73 74 /*FUNCTION KML_Folder::Write {{{ 1*/74 /*FUNCTION KML_Folder::Write {{{*/ 75 75 void KML_Folder::Write(FILE* filout,const char* indent){ 76 76 … … 88 88 /*}}}*/ 89 89 90 /*FUNCTION KML_Folder::Read {{{ 1*/90 /*FUNCTION KML_Folder::Read {{{*/ 91 91 void KML_Folder::Read(FILE* fid,char* kstr){ 92 92 … … 110 110 } 111 111 else if (!strncmp(kstri,"</",2)) 112 _error_("KML_Folder::Read -- Unexpected closing tag %s.\n",kstri);112 {_error2_("KML_Folder::Read -- Unexpected closing tag " << kstri << ".\n");} 113 113 else if (strncmp(kstri,"<",1)) 114 _error_("KML_Folder::Read -- Unexpected field \"%s\".\n",kstri);114 {_error2_("KML_Folder::Read -- Unexpected field \"" << kstri << "\".\n");} 115 115 116 116 else if (!strncmp(kstri,"<",1)) -
issm/trunk/src/c/objects/KML/KML_Folder.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 20 20 public: 21 21 22 /*KML_Folder constructors, destructors {{{ 1*/22 /*KML_Folder constructors, destructors {{{*/ 23 23 KML_Folder(); 24 24 ~KML_Folder(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{ */ 27 27 void Echo(); 28 28 void DeepEcho(); … … 30 30 void Write(FILE* fid,const char* indent); 31 31 void Read(FILE* fid,char* kstr); 32 int Id(){_error _("Not implemented yet.");};33 int MyRank(){_error _("Not implemented yet.");};34 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};35 int MarshallSize(){_error _("Not implemented yet.");};36 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};37 int ObjectEnum(){_error _("Not implemented yet.");};38 Object* copy(){_error _("Not implemented yet.");};32 int Id(){_error2_("Not implemented yet.");}; 33 int MyRank(){_error2_("Not implemented yet.");}; 34 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 35 int MarshallSize(){_error2_("Not implemented yet.");}; 36 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 37 int ObjectEnum(){_error2_("Not implemented yet.");}; 38 Object* copy(){_error2_("Not implemented yet.");}; 39 39 /*}}}*/ 40 40 -
issm/trunk/src/c/objects/KML/KML_Geometry.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 21 21 /*Constructors/destructor/copy*/ 22 /*FUNCTION KML_Geometry::KML_Geometry(){{{ 1*/22 /*FUNCTION KML_Geometry::KML_Geometry(){{{*/ 23 23 KML_Geometry::KML_Geometry(){ 24 24 … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION KML_Geometry::~KML_Geometry(){{{ 1*/29 /*FUNCTION KML_Geometry::~KML_Geometry(){{{*/ 30 30 KML_Geometry::~KML_Geometry(){ 31 31 … … 36 36 37 37 /*Other*/ 38 /*FUNCTION KML_Geometry::Echo {{{ 1*/38 /*FUNCTION KML_Geometry::Echo {{{*/ 39 39 void KML_Geometry::Echo(){ 40 40 … … 45 45 /*}}}*/ 46 46 47 /*FUNCTION KML_Geometry::DeepEcho {{{ 1*/47 /*FUNCTION KML_Geometry::DeepEcho {{{*/ 48 48 void KML_Geometry::DeepEcho(){ 49 49 … … 56 56 /*}}}*/ 57 57 58 /*FUNCTION KML_Geometry::DeepEcho {{{ 1*/58 /*FUNCTION KML_Geometry::DeepEcho {{{*/ 59 59 void KML_Geometry::DeepEcho(const char* indent){ 60 60 … … 65 65 /*}}}*/ 66 66 67 /*FUNCTION KML_Geometry::Write {{{ 1*/67 /*FUNCTION KML_Geometry::Write {{{*/ 68 68 void KML_Geometry::Write(FILE* filout,const char* indent){ 69 69 … … 74 74 /*}}}*/ 75 75 76 /*FUNCTION KML_Geometry::Read {{{ 1*/76 /*FUNCTION KML_Geometry::Read {{{*/ 77 77 void KML_Geometry::Read(FILE* fid,char* kstr){ 78 78 … … 82 82 return; 83 83 else if (!strncmp(kstr,"</",2)) 84 _error_("KML_Geometry::Read -- Unexpected closing tag %s.\n",kstr);84 {_error2_("KML_Geometry::Read -- Unexpected closing tag " << kstr << ".\n");} 85 85 else if (strncmp(kstr,"<",1)) 86 _error_("KML_Geometry::Read -- Unexpected field \"%s\".\n",kstr);86 {_error2_("KML_Geometry::Read -- Unexpected field \"" << kstr << "\".\n");} 87 87 88 88 else if (!strncmp(kstr,"<",1)) -
issm/trunk/src/c/objects/KML/KML_Geometry.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 19 19 public: 20 20 21 /*KML_Geometry constructors, destructors {{{ 1*/21 /*KML_Geometry constructors, destructors {{{*/ 22 22 KML_Geometry(); 23 23 ~KML_Geometry(); 24 24 /*}}}*/ 25 /*Object virtual functions definitions:{{{ 1*/25 /*Object virtual functions definitions:{{{*/ 26 26 void Echo(); 27 27 void DeepEcho(); … … 29 29 void Write(FILE* fid,const char* indent); 30 30 void Read(FILE* fid,char* kstr); 31 int Id(){_error _("Not implemented yet.");};32 int MyRank(){_error _("Not implemented yet.");};33 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};34 int MarshallSize(){_error _("Not implemented yet.");};35 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};36 int ObjectEnum(){_error _("Not implemented yet.");};37 Object* copy(){_error _("Not implemented yet.");};31 int Id(){_error2_("Not implemented yet.");}; 32 int MyRank(){_error2_("Not implemented yet.");}; 33 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 34 int MarshallSize(){_error2_("Not implemented yet.");}; 35 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 36 int ObjectEnum(){_error2_("Not implemented yet.");}; 37 Object* copy(){_error2_("Not implemented yet.");}; 38 38 /*}}}*/ 39 39 -
issm/trunk/src/c/objects/KML/KML_GroundOverlay.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_GroundOverlay::KML_GroundOverlay(){{{ 1*/23 /*FUNCTION KML_GroundOverlay::KML_GroundOverlay(){{{*/ 24 24 KML_GroundOverlay::KML_GroundOverlay(){ 25 25 … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION KML_GroundOverlay::~KML_GroundOverlay(){{{ 1*/33 /*FUNCTION KML_GroundOverlay::~KML_GroundOverlay(){{{*/ 34 34 KML_GroundOverlay::~KML_GroundOverlay(){ 35 35 … … 43 43 44 44 /*Other*/ 45 /*FUNCTION KML_GroundOverlay::Echo {{{ 1*/45 /*FUNCTION KML_GroundOverlay::Echo {{{*/ 46 46 void KML_GroundOverlay::Echo(){ 47 47 48 bool flag=true; 49 50 _printf_(flag,"KML_GroundOverlay:\n"); 48 _printLine_("KML_GroundOverlay:"); 51 49 KML_Overlay::Echo(); 52 50 53 _printf_(flag," altitude: %0.16g\n" ,altitude); 54 _printf_(flag," altmode: \"%s\"\n" ,altmode); 55 _printf_(flag," llbox: %p\n" ,llbox); 56 57 return; 51 _printLine_(" altitude: " << altitude); 52 _printLine_(" altmode: " << altmode); 53 _printLine_(" llbox: " << llbox); 58 54 } 59 55 /*}}}*/ 60 61 /*FUNCTION KML_GroundOverlay::DeepEcho {{{1*/ 56 /*FUNCTION KML_GroundOverlay::DeepEcho {{{*/ 62 57 void KML_GroundOverlay::DeepEcho(){ 63 58 … … 69 64 } 70 65 /*}}}*/ 71 72 /*FUNCTION KML_GroundOverlay::DeepEcho {{{1*/ 66 /*FUNCTION KML_GroundOverlay::DeepEcho {{{*/ 73 67 void KML_GroundOverlay::DeepEcho(const char* indent){ 74 68 75 69 char indent2[81]; 76 bool flag=true;77 70 78 _print f_(flag,"%sKML_GroundOverlay:\n",indent);71 _printLine_(indent << "KML_GroundOverlay:"); 79 72 KML_Overlay::DeepEcho(indent); 80 73 … … 82 75 strcat(indent2," "); 83 76 84 _print f_(flag,"%s altitude: %0.16g\n" ,indent,altitude);85 _print f_(flag,"%s altmode: \"%s\"\n" ,indent,altmode);77 _printLine_(indent<<" altitude: " << altitude); 78 _printLine_(indent<<" altmode: " << altmode); 86 79 if (llbox) 87 llbox->DeepEcho(indent2);80 llbox->DeepEcho(indent2); 88 81 else 89 _printf_(flag,"%s llbox: %p\n" ,indent,llbox); 90 91 return; 82 _printLine_(indent<<" llbox: " << llbox); 92 83 } 93 84 /*}}}*/ 94 95 /*FUNCTION KML_GroundOverlay::Write {{{1*/ 85 /*FUNCTION KML_GroundOverlay::Write {{{*/ 96 86 void KML_GroundOverlay::Write(FILE* filout,const char* indent){ 97 87 … … 119 109 } 120 110 /*}}}*/ 121 122 /*FUNCTION KML_GroundOverlay::Read {{{1*/ 111 /*FUNCTION KML_GroundOverlay::Read {{{*/ 123 112 void KML_GroundOverlay::Read(FILE* fid,char* kstr){ 124 113 … … 142 131 } 143 132 else if (!strncmp(kstri,"</",2)) 144 _error_("KML_GroundOverlay::Read -- Unexpected closing tag %s.\n",kstri);133 {_error2_("KML_GroundOverlay::Read -- Unexpected closing tag " << kstri << ".\n");} 145 134 else if (strncmp(kstri,"<",1)) 146 _error_("KML_GroundOverlay::Read -- Unexpected field \"%s\".\n",kstri);135 {_error2_("KML_GroundOverlay::Read -- Unexpected field \"" << kstri << "\".\n");} 147 136 148 137 else if (!strcmp(kstri,"<altitude>")) … … 174 163 } 175 164 /*}}}*/ 176 -
issm/trunk/src/c/objects/KML/KML_GroundOverlay.h
r11237 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../../include/include.h" 13 13 #include "../../shared/Exceptions/exceptions.h" … … 26 26 KML_LatLonBox* llbox; 27 27 28 /*KML_GroundOverlay constructors, destructors {{{ 1*/28 /*KML_GroundOverlay constructors, destructors {{{*/ 29 29 KML_GroundOverlay(); 30 30 ~KML_GroundOverlay(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{*/ 33 33 void Echo(); 34 34 void DeepEcho(); … … 36 36 void Write(FILE* fid,const char* indent); 37 37 void Read(FILE* fid,char* kstr); 38 int Id(){_error _("Not implemented yet.");};39 int MyRank(){_error _("Not implemented yet.");};40 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};41 int MarshallSize(){_error _("Not implemented yet.");};42 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};43 int ObjectEnum(){_error _("Not implemented yet.");};44 Object* copy(){_error _("Not implemented yet.");};38 int Id(){_error2_("Not implemented yet.");}; 39 int MyRank(){_error2_("Not implemented yet.");}; 40 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 41 int MarshallSize(){_error2_("Not implemented yet.");}; 42 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 43 int ObjectEnum(){_error2_("Not implemented yet.");}; 44 Object* copy(){_error2_("Not implemented yet.");}; 45 45 /*}}}*/ 46 46 -
issm/trunk/src/c/objects/KML/KML_Icon.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Icon::KML_Icon(){{{ 1*/23 /*FUNCTION KML_Icon::KML_Icon(){{{*/ 24 24 KML_Icon::KML_Icon(){ 25 25 … … 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION KML_Icon::~KML_Icon(){{{ 1*/37 /*FUNCTION KML_Icon::~KML_Icon(){{{*/ 38 38 KML_Icon::~KML_Icon(){ 39 39 … … 44 44 45 45 /*Other*/ 46 /*FUNCTION KML_Icon::Echo {{{ 1*/46 /*FUNCTION KML_Icon::Echo {{{*/ 47 47 void KML_Icon::Echo(){ 48 48 49 49 bool flag=true; 50 50 51 _printf_(flag,"KML_Icon:\n");51 if(flag) _pprintLine_("KML_Icon:"); 52 52 KML_Object::Echo(); 53 53 54 _printf_(flag," href: \"%s\"\n" ,href);55 _printf_(flag," refmode: \"%s\"\n" ,refmode);56 _printf_(flag," refint: %g\n" ,refint);57 _printf_(flag," vrefmode: \"%s\"\n" ,vrefmode);58 _printf_(flag," vreftime: %g\n" ,vreftime);59 _printf_(flag," vboundsc: %g\n" ,vboundsc);60 _printf_(flag," vformat: \"%s\"\n" ,vformat);61 _printf_(flag," hquery: \"%s\"\n" ,hquery);54 if(flag) _pprintLine_(" href: \"" << href << "\""); 55 if(flag) _pprintLine_(" refmode: \"" << refmode << "\""); 56 if(flag) _pprintLine_(" refint: " << refint); 57 if(flag) _pprintLine_(" vrefmode: \"" << vrefmode << "\""); 58 if(flag) _pprintLine_(" vreftime: " << vreftime); 59 if(flag) _pprintLine_(" vboundsc: " << vboundsc); 60 if(flag) _pprintLine_(" vformat: \"" << vformat << "\""); 61 if(flag) _pprintLine_(" hquery: \"" << hquery << "\""); 62 62 63 63 return; 64 64 } 65 65 /*}}}*/ 66 67 /*FUNCTION KML_Icon::DeepEcho {{{1*/ 66 /*FUNCTION KML_Icon::DeepEcho {{{*/ 68 67 void KML_Icon::DeepEcho(){ 69 68 … … 75 74 } 76 75 /*}}}*/ 77 78 /*FUNCTION KML_Icon::DeepEcho {{{1*/ 76 /*FUNCTION KML_Icon::DeepEcho {{{*/ 79 77 void KML_Icon::DeepEcho(const char* indent){ 80 78 81 79 bool flag=true; 82 80 83 _printf_(flag,"%sKML_Icon:\n",indent);81 if(flag) _pprintLine_(indent << "KML_Icon:"); 84 82 KML_Object::DeepEcho(indent); 85 83 86 _printf_(flag,"%s href: \"%s\"\n" ,indent,href);87 _printf_(flag,"%s refmode: \"%s\"\n" ,indent,refmode);88 _printf_(flag,"%s refint: %g\n" ,indent,refint);89 _printf_(flag,"%s vrefmode: \"%s\"\n" ,indent,vrefmode);90 _printf_(flag,"%s vreftime: %g\n" ,indent,vreftime);91 _printf_(flag,"%s vboundsc: %g\n" ,indent,vboundsc);92 _printf_(flag,"%s vformat: \"%s\"\n" ,indent,vformat);93 _printf_(flag,"%s hquery: \"%s\"\n" ,indent,hquery);84 if(flag) _pprintLine_(indent << " href: \"" << href << "\""); 85 if(flag) _pprintLine_(indent << " refmode: \"" << refmode << "\""); 86 if(flag) _pprintLine_(indent << " refint: " << refint); 87 if(flag) _pprintLine_(indent << " vrefmode: \"" << vrefmode << "\""); 88 if(flag) _pprintLine_(indent << " vreftime: " << vreftime); 89 if(flag) _pprintLine_(indent << " vboundsc: " << vboundsc); 90 if(flag) _pprintLine_(indent << " vformat: \"" << vformat << "\""); 91 if(flag) _pprintLine_(indent << " hquery: \"" << hquery << "\""); 94 92 95 93 return; 96 94 } 97 95 /*}}}*/ 98 99 /*FUNCTION KML_Icon::Write {{{1*/ 96 /*FUNCTION KML_Icon::Write {{{*/ 100 97 void KML_Icon::Write(FILE* filout,const char* indent){ 101 98 … … 126 123 } 127 124 /*}}}*/ 128 129 /*FUNCTION KML_Icon::Read {{{1*/ 125 /*FUNCTION KML_Icon::Read {{{*/ 130 126 void KML_Icon::Read(FILE* fid,char* kstr){ 131 127 … … 149 145 } 150 146 else if (!strncmp(kstri,"</",2)) 151 _error_("KML_Icon::Read -- Unexpected closing tag %s.\n",kstri);147 {_error2_("KML_Icon::Read -- Unexpected closing tag " << kstri << ".\n");} 152 148 else if (strncmp(kstri,"<",1)) 153 _error_("KML_Icon::Read -- Unexpected field \"%s\".\n",kstri);149 {_error2_("KML_Icon::Read -- Unexpected field \"" << kstri << "\".\n");} 154 150 155 151 else if (!strcmp(kstri,"<href>")) 156 KMLFileTokenParse( href ,NULL,KML_ICON_HREF_LENGTH, 157 kstri, 158 fid); 152 KMLFileTokenParse( href ,NULL,KML_ICON_HREF_LENGTH, kstri, fid); 159 153 else if (!strcmp(kstri,"<refreshMode>")) 160 KMLFileTokenParse( refmode ,NULL,KML_ICON_REFMODE_LENGTH, 161 kstri, 162 fid); 154 KMLFileTokenParse( refmode ,NULL,KML_ICON_REFMODE_LENGTH, kstri, fid); 163 155 else if (!strcmp(kstri,"<refreshInterval>")) 164 KMLFileTokenParse(&refint , 165 kstri, 166 fid); 156 KMLFileTokenParse(&refint , kstri, fid); 167 157 else if (!strcmp(kstri,"<viewRefreshMode>")) 168 KMLFileTokenParse( vrefmode ,NULL,KML_ICON_VREFMODE_LENGTH, 169 kstri, 170 fid); 158 KMLFileTokenParse( vrefmode ,NULL,KML_ICON_VREFMODE_LENGTH, kstri, fid); 171 159 else if (!strcmp(kstri,"<viewRefreshTime>")) 172 KMLFileTokenParse(&vreftime , 173 kstri, 174 fid); 160 KMLFileTokenParse(&vreftime , kstri, fid); 175 161 else if (!strcmp(kstri,"<viewBoundScale>")) 176 KMLFileTokenParse(&vboundsc , 177 kstri, 178 fid); 162 KMLFileTokenParse(&vboundsc , kstri, fid); 179 163 else if (!strcmp(kstri,"<viewFormat>")) 180 KMLFileTokenParse( vformat ,NULL,KML_ICON_VFORMAT_LENGTH, 181 kstri, 182 fid); 164 KMLFileTokenParse( vformat ,NULL,KML_ICON_VFORMAT_LENGTH, kstri, fid); 183 165 else if (!strcmp(kstri,"<httpQuery>")) 184 KMLFileTokenParse( hquery ,NULL,KML_ICON_HQUERY_LENGTH, 185 kstri, 186 fid); 166 KMLFileTokenParse( hquery ,NULL,KML_ICON_HQUERY_LENGTH, kstri, fid); 187 167 188 168 else if (!strncmp(kstri,"<",1)) … … 201 181 } 202 182 /*}}}*/ 203 -
issm/trunk/src/c/objects/KML/KML_Icon.h
r11237 r12706 13 13 14 14 /*Headers:*/ 15 /*{{{ 1*/15 /*{{{*/ 16 16 #include "../../include/include.h" 17 17 #include "../../shared/Exceptions/exceptions.h" … … 34 34 char hquery[KML_ICON_HQUERY_LENGTH+1]; 35 35 36 /*KML_Icon constructors, destructors {{{ 1*/36 /*KML_Icon constructors, destructors {{{*/ 37 37 KML_Icon(); 38 38 ~KML_Icon(); 39 39 /*}}}*/ 40 /*Object virtual functions definitions:{{{ 1*/40 /*Object virtual functions definitions:{{{*/ 41 41 void Echo(); 42 42 void DeepEcho(); … … 44 44 void Write(FILE* fid,const char* indent); 45 45 void Read(FILE* fid,char* kstr); 46 int Id(){_error _("Not implemented yet.");};47 int MyRank(){_error _("Not implemented yet.");};48 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};49 int MarshallSize(){_error _("Not implemented yet.");};50 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};51 int ObjectEnum(){_error _("Not implemented yet.");};52 Object* copy(){_error _("Not implemented yet.");};46 int Id(){_error2_("Not implemented yet.");}; 47 int MyRank(){_error2_("Not implemented yet.");}; 48 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 49 int MarshallSize(){_error2_("Not implemented yet.");}; 50 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 51 int ObjectEnum(){_error2_("Not implemented yet.");}; 52 Object* copy(){_error2_("Not implemented yet.");}; 53 53 /*}}}*/ 54 54 -
issm/trunk/src/c/objects/KML/KML_LatLonBox.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_LatLonBox::KML_LatLonBox(){{{ 1*/23 /*FUNCTION KML_LatLonBox::KML_LatLonBox(){{{*/ 24 24 KML_LatLonBox::KML_LatLonBox(){ 25 25 … … 32 32 } 33 33 /*}}}*/ 34 /*FUNCTION KML_LatLonBox::~KML_LatLonBox(){{{ 1*/34 /*FUNCTION KML_LatLonBox::~KML_LatLonBox(){{{*/ 35 35 KML_LatLonBox::~KML_LatLonBox(){ 36 36 … … 41 41 42 42 /*Other*/ 43 /*FUNCTION KML_LatLonBox::Echo {{{ 1*/43 /*FUNCTION KML_LatLonBox::Echo {{{*/ 44 44 void KML_LatLonBox::Echo(){ 45 45 46 bool flag=true;47 46 48 _print f_(flag,"KML_LatLonBox:\n");47 _printLine_("KML_LatLonBox:"); 49 48 KML_Object::Echo(); 50 49 51 _printf_(flag," north: %0.16g\n" ,north); 52 _printf_(flag," south: %0.16g\n" ,south); 53 _printf_(flag," east: %0.16g\n" ,east); 54 _printf_(flag," west: %0.16g\n" ,west); 55 _printf_(flag," rotation: %0.16g\n" ,rotation); 56 57 return; 50 _printLine_(" north: " << north); 51 _printLine_(" south: " << south); 52 _printLine_(" east: " << east); 53 _printLine_(" west: " << west); 54 _printLine_(" rotation: " << rotation); 58 55 } 59 56 /*}}}*/ 60 61 /*FUNCTION KML_LatLonBox::DeepEcho {{{1*/ 57 /*FUNCTION KML_LatLonBox::DeepEcho {{{*/ 62 58 void KML_LatLonBox::DeepEcho(){ 63 59 … … 69 65 } 70 66 /*}}}*/ 71 72 /*FUNCTION KML_LatLonBox::DeepEcho {{{1*/ 67 /*FUNCTION KML_LatLonBox::DeepEcho {{{*/ 73 68 void KML_LatLonBox::DeepEcho(const char* indent){ 74 69 75 bool flag=true; 76 77 _printf_(flag,"%sKML_LatLonBox:\n",indent); 70 _printLine_(indent << "KML_LatLonBox:"); 78 71 KML_Object::DeepEcho(indent); 79 72 80 _printf_(flag,"%s north: %0.16g\n" ,indent,north); 81 _printf_(flag,"%s south: %0.16g\n" ,indent,south); 82 _printf_(flag,"%s east: %0.16g\n" ,indent,east); 83 _printf_(flag,"%s west: %0.16g\n" ,indent,west); 84 _printf_(flag,"%s rotation: %0.16g\n" ,indent,rotation); 85 86 return; 73 _printLine_(" north: " << north); 74 _printLine_(" south: " << south); 75 _printLine_(" east: " << east); 76 _printLine_(" west: " << west); 77 _printLine_(" rotation: " << rotation); 87 78 } 88 79 /*}}}*/ 89 90 /*FUNCTION KML_LatLonBox::Write {{{1*/ 80 /*FUNCTION KML_LatLonBox::Write {{{*/ 91 81 void KML_LatLonBox::Write(FILE* filout,const char* indent){ 92 82 … … 109 99 } 110 100 /*}}}*/ 111 112 /*FUNCTION KML_LatLonBox::Read {{{1*/ 101 /*FUNCTION KML_LatLonBox::Read {{{*/ 113 102 void KML_LatLonBox::Read(FILE* fid,char* kstr){ 114 103 … … 132 121 } 133 122 else if (!strncmp(kstri,"</",2)) 134 _error_("KML_LatLonBox::Read -- Unexpected closing tag %s.\n",kstri);123 {_error2_("KML_LatLonBox::Read -- Unexpected closing tag " << kstri << ".\n");} 135 124 else if (strncmp(kstri,"<",1)) 136 _error_("KML_LatLonBox::Read -- Unexpected field \"%s\".\n",kstri);125 {_error2_("KML_LatLonBox::Read -- Unexpected field \"" << kstri << "\".\n");} 137 126 138 127 else if (!strcmp(kstri,"<north>")) … … 172 161 } 173 162 /*}}}*/ 174 -
issm/trunk/src/c/objects/KML/KML_LatLonBox.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 25 25 double rotation; 26 26 27 /*KML_LatLonBox constructors, destructors {{{ 1*/27 /*KML_LatLonBox constructors, destructors {{{*/ 28 28 KML_LatLonBox(); 29 29 ~KML_LatLonBox(); 30 30 /*}}}*/ 31 /*Object virtual functions definitions:{{{ 1*/31 /*Object virtual functions definitions:{{{*/ 32 32 void Echo(); 33 33 void DeepEcho(); … … 35 35 void Write(FILE* fid,const char* indent); 36 36 void Read(FILE* fid,char* kstr); 37 int Id(){_error _("Not implemented yet.");};38 int MyRank(){_error _("Not implemented yet.");};39 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};40 int MarshallSize(){_error _("Not implemented yet.");};41 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};42 int ObjectEnum(){_error _("Not implemented yet.");};43 Object* copy(){_error _("Not implemented yet.");};37 int Id(){_error2_("Not implemented yet.");}; 38 int MyRank(){_error2_("Not implemented yet.");}; 39 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 40 int MarshallSize(){_error2_("Not implemented yet.");}; 41 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 42 int ObjectEnum(){_error2_("Not implemented yet.");}; 43 Object* copy(){_error2_("Not implemented yet.");}; 44 44 /*}}}*/ 45 45 -
issm/trunk/src/c/objects/KML/KML_LineString.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 22 22 23 23 /*Constructors/destructor/copy*/ 24 /*FUNCTION KML_LineString::KML_LineString(){{{ 1*/24 /*FUNCTION KML_LineString::KML_LineString(){{{*/ 25 25 KML_LineString::KML_LineString(){ 26 26 … … 34 34 } 35 35 /*}}}*/ 36 /*FUNCTION KML_LineString::~KML_LineString(){{{ 1*/36 /*FUNCTION KML_LineString::~KML_LineString(){{{*/ 37 37 KML_LineString::~KML_LineString(){ 38 38 39 if (coords) x free((void**)&coords);39 if (coords) xDelete<double>(coords); 40 40 41 41 coords =NULL; … … 46 46 47 47 /*Other*/ 48 /*FUNCTION KML_LineString::Echo {{{ 1*/48 /*FUNCTION KML_LineString::Echo {{{*/ 49 49 void KML_LineString::Echo(){ 50 50 51 51 bool flag=true; 52 52 53 _printf_(flag,"KML_LineString:\n");53 if(flag) _pprintLine_("KML_LineString:"); 54 54 KML_Geometry::Echo(); 55 55 56 _printf_(flag," extrude: %s\n" ,(extrude ? "true" : "false"));57 _printf_(flag," tessellate: %s\n" ,(tessellate ? "true" : "false"));58 _printf_(flag," altmode: \"%s\"\n" ,altmode);59 _printf_(flag," coords: (ncoord=%d)\n" ,ncoord);60 61 return; 62 } 63 /*}}}*/ 64 /*FUNCTION KML_LineString::DeepEcho {{{ 1*/56 if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); 57 if(flag) _pprintLine_(" tessellate: " << (tessellate ? "true" : "false")); 58 if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); 59 if(flag) _pprintLine_(" coords: (ncoord=" << ncoord << ")"); 60 61 return; 62 } 63 /*}}}*/ 64 /*FUNCTION KML_LineString::DeepEcho {{{*/ 65 65 void KML_LineString::DeepEcho(){ 66 66 … … 72 72 } 73 73 /*}}}*/ 74 /*FUNCTION KML_LineString::DeepEcho {{{ 1*/74 /*FUNCTION KML_LineString::DeepEcho {{{*/ 75 75 void KML_LineString::DeepEcho(const char* indent){ 76 76 … … 78 78 bool flag=true; 79 79 80 _printf_(flag,"%sKML_LineString:\n",indent);80 if(flag) _pprintLine_(indent << "KML_LineString:"); 81 81 KML_Geometry::DeepEcho(indent); 82 82 83 _printf_(flag,"%s extrude: %s\n" ,indent,(extrude ? "true" : "false"));84 _printf_(flag,"%s tessellate: %s\n" ,indent,(tessellate ? "true" : "false"));85 _printf_(flag,"%s altmode: \"%s\"\n" ,indent,altmode);86 _printf_(flag,"%s coords: (ncoord=%d)\n" ,indent,ncoord);83 if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); 84 if(flag) _pprintLine_(indent << " tessellate: " << (tessellate ? "true" : "false")); 85 if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); 86 if(flag) _pprintLine_(indent << " coords: (ncoord=" << ncoord << ")"); 87 87 for (i=0; i<ncoord; i++) 88 _printf_(flag,"%s (%g,%g,%g)\n" ,indent, 89 coords[i][0],coords[i][1],coords[i][2]); 90 91 return; 92 } 93 /*}}}*/ 94 /*FUNCTION KML_LineString::Write {{{1*/ 88 if(flag) _pprintLine_(indent << " (" << coords[3*i+0] << "," << coords[3*i+1] << "," << coords[3*i+2] << ")"); 89 90 return; 91 } 92 /*}}}*/ 93 /*FUNCTION KML_LineString::Write {{{*/ 95 94 void KML_LineString::Write(FILE* filout,const char* indent){ 96 95 … … 112 111 113 112 for (i=0; i<ncoord; i++) 114 fprintf(filout,"%s %0.16g,%0.16g,%0.16g\n",indent, 115 coords[i][0],coords[i][1],coords[i][2]); 113 fprintf(filout,"%s %0.16g,%0.16g,%0.16g\n",indent, coords[3*i+0],coords[3*i+1],coords[3*i+2]); 116 114 117 115 fprintf(filout,"%s </coordinates>\n",indent); … … 121 119 } 122 120 /*}}}*/ 123 /*FUNCTION KML_LineString::Read {{{ 1*/121 /*FUNCTION KML_LineString::Read {{{*/ 124 122 void KML_LineString::Read(FILE* fid,char* kstr){ 125 123 … … 143 141 } 144 142 else if (!strncmp(kstri,"</",2)) 145 _error_("KML_LineString::Read -- Unexpected closing tag %s.\n",kstri);143 {_error2_("KML_LineString::Read -- Unexpected closing tag " << kstri << ".\n");} 146 144 else if (strncmp(kstri,"<",1)) 147 _error_("KML_LineString::Read -- Unexpected field \"%s\".\n",kstri);145 {_error2_("KML_LineString::Read -- Unexpected field \"" << kstri << "\".\n");} 148 146 149 147 else if (!strcmp(kstri,"<extrude>")) … … 179 177 } 180 178 /*}}}*/ 181 /*FUNCTION KML_LineString::WriteExp {{{ 1*/179 /*FUNCTION KML_LineString::WriteExp {{{*/ 182 180 void KML_LineString::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 183 181 … … 191 189 lon=(double *) xmalloc(ncoord*sizeof(double)); 192 190 for (i=0; i<ncoord; i++) { 193 lon[i]=coords[ i][0];194 lat[i]=coords[ i][1];191 lon[i]=coords[3*i+0]; 192 lat[i]=coords[3*i+1]; 195 193 } 196 194 -
issm/trunk/src/c/objects/KML/KML_LineString.h
r11237 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../../include/include.h" 13 13 #include "../../shared/Exceptions/exceptions.h" … … 21 21 public: 22 22 23 bool extrude;24 bool tessellate;25 char altmode[KML_LINESTRING_ALTMODE_LENGTH+1];26 intncoord;27 double (*coords)[3];23 bool extrude; 24 bool tessellate; 25 char altmode[KML_LINESTRING_ALTMODE_LENGTH+1]; 26 int ncoord; 27 double *coords; 28 28 29 /*KML_LineString constructors, destructors {{{ 1*/29 /*KML_LineString constructors, destructors {{{*/ 30 30 KML_LineString(); 31 31 ~KML_LineString(); 32 32 /*}}}*/ 33 /*Object virtual functions definitions:{{{ 1*/33 /*Object virtual functions definitions:{{{*/ 34 34 void Echo(); 35 35 void DeepEcho(); … … 38 38 void Read(FILE* fid,char* kstr); 39 39 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 40 int Id(){_error _("Not implemented yet.");};41 int MyRank(){_error _("Not implemented yet.");};42 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};43 int MarshallSize(){_error _("Not implemented yet.");};44 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};45 int ObjectEnum(){_error _("Not implemented yet.");};46 Object* copy(){_error _("Not implemented yet.");};40 int Id(){_error2_("Not implemented yet.");}; 41 int MyRank(){_error2_("Not implemented yet.");}; 42 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 43 int MarshallSize(){_error2_("Not implemented yet.");}; 44 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 45 int ObjectEnum(){_error2_("Not implemented yet.");}; 46 Object* copy(){_error2_("Not implemented yet.");}; 47 47 /*}}}*/ 48 48 -
issm/trunk/src/c/objects/KML/KML_LineStyle.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_LineStyle::KML_LineStyle(){{{ 1*/23 /*FUNCTION KML_LineStyle::KML_LineStyle(){{{*/ 24 24 KML_LineStyle::KML_LineStyle(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_LineStyle::~KML_LineStyle(){{{ 1*/30 /*FUNCTION KML_LineStyle::~KML_LineStyle(){{{*/ 31 31 KML_LineStyle::~KML_LineStyle(){ 32 32 … … 37 37 38 38 /*Other*/ 39 /*FUNCTION KML_LineStyle::Echo {{{ 1*/39 /*FUNCTION KML_LineStyle::Echo {{{*/ 40 40 void KML_LineStyle::Echo(){ 41 41 42 42 bool flag=true; 43 43 44 _printf_(flag,"KML_LineStyle:\n");44 if(flag) _pprintLine_("KML_LineStyle:"); 45 45 KML_ColorStyle::Echo(); 46 46 47 _printf_(flag," width: %g\n" ,width);47 if(flag) _pprintLine_(" width: " << width); 48 48 49 49 return; 50 50 } 51 51 /*}}}*/ 52 53 /*FUNCTION KML_LineStyle::DeepEcho {{{1*/ 52 /*FUNCTION KML_LineStyle::DeepEcho {{{*/ 54 53 void KML_LineStyle::DeepEcho(){ 55 54 … … 61 60 } 62 61 /*}}}*/ 63 64 /*FUNCTION KML_LineStyle::DeepEcho {{{1*/ 62 /*FUNCTION KML_LineStyle::DeepEcho {{{*/ 65 63 void KML_LineStyle::DeepEcho(const char* indent){ 66 64 … … 68 66 bool flag=true; 69 67 70 _printf_(flag,"%sKML_LineStyle:\n",indent);68 if(flag) _pprintLine_(indent << "KML_LineStyle:"); 71 69 KML_ColorStyle::DeepEcho(indent); 72 70 73 _printf_(flag,"%s width: %g\n" ,indent,width);71 if(flag) _pprintLine_(indent << " width: " << width); 74 72 75 73 return; 76 74 } 77 75 /*}}}*/ 78 79 /*FUNCTION KML_LineStyle::Write {{{1*/ 76 /*FUNCTION KML_LineStyle::Write {{{*/ 80 77 void KML_LineStyle::Write(FILE* filout,const char* indent){ 81 78 … … 94 91 } 95 92 /*}}}*/ 96 97 /*FUNCTION KML_LineStyle::Read {{{1*/ 93 /*FUNCTION KML_LineStyle::Read {{{*/ 98 94 void KML_LineStyle::Read(FILE* fid,char* kstr){ 99 95 … … 117 113 } 118 114 else if (!strncmp(kstri,"</",2)) 119 _error_("KML_LineStyle::Read -- Unexpected closing tag %s.\n",kstri);115 {_error2_("KML_LineStyle::Read -- Unexpected closing tag " << kstri << ".\n");} 120 116 else if (strncmp(kstri,"<",1)) 121 _error_("KML_LineStyle::Read -- Unexpected field \"%s\".\n",kstri);117 {_error2_("KML_LineStyle::Read -- Unexpected field \"" << kstri << "\".\n");} 122 118 123 119 else if (!strcmp(kstri,"<width>")) … … 141 137 } 142 138 /*}}}*/ 143 -
issm/trunk/src/c/objects/KML/KML_LineStyle.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 21 21 float width; 22 22 23 /*KML_LineStyle constructors, destructors {{{ 1*/23 /*KML_LineStyle constructors, destructors {{{*/ 24 24 KML_LineStyle(); 25 25 ~KML_LineStyle(); 26 26 /*}}}*/ 27 /*Object virtual functions definitions:{{{ 1*/27 /*Object virtual functions definitions:{{{ */ 28 28 void Echo(); 29 29 void DeepEcho(); … … 31 31 void Write(FILE* fid,const char* indent); 32 32 void Read(FILE* fid,char* kstr); 33 int Id(){_error _("Not implemented yet.");};34 int MyRank(){_error _("Not implemented yet.");};35 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};36 int MarshallSize(){_error _("Not implemented yet.");};37 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};38 int ObjectEnum(){_error _("Not implemented yet.");};39 Object* copy(){_error _("Not implemented yet.");};33 int Id(){_error2_("Not implemented yet.");}; 34 int MyRank(){_error2_("Not implemented yet.");}; 35 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 36 int MarshallSize(){_error2_("Not implemented yet.");}; 37 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 38 int ObjectEnum(){_error2_("Not implemented yet.");}; 39 Object* copy(){_error2_("Not implemented yet.");}; 40 40 /*}}}*/ 41 41 -
issm/trunk/src/c/objects/KML/KML_LinearRing.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 22 22 23 23 /*Constructors/destructor/copy*/ 24 /*FUNCTION KML_LinearRing::KML_LinearRing(){{{ 1*/24 /*FUNCTION KML_LinearRing::KML_LinearRing(){{{*/ 25 25 KML_LinearRing::KML_LinearRing(){ 26 26 … … 34 34 } 35 35 /*}}}*/ 36 /*FUNCTION KML_LinearRing::~KML_LinearRing(){{{ 1*/36 /*FUNCTION KML_LinearRing::~KML_LinearRing(){{{*/ 37 37 KML_LinearRing::~KML_LinearRing(){ 38 38 39 if (coords) x free((void**)&coords);39 if (coords) xDelete<double>(coords); 40 40 41 41 coords =NULL; … … 46 46 47 47 /*Other*/ 48 /*FUNCTION KML_LinearRing::Echo {{{ 1*/48 /*FUNCTION KML_LinearRing::Echo {{{*/ 49 49 void KML_LinearRing::Echo(){ 50 50 51 51 bool flag=true; 52 52 53 _printf_(flag,"KML_LinearRing:\n");53 if(flag) _pprintLine_("KML_LinearRing:"); 54 54 KML_Geometry::Echo(); 55 55 56 _printf_(flag," extrude: %s\n" ,(extrude ? "true" : "false")); 57 _printf_(flag," tessellate: %s\n" ,(tessellate ? "true" : "false")); 58 _printf_(flag," altmode: \"%s\"\n" ,altmode); 59 _printf_(flag," coords: (ncoord=%d)\n" ,ncoord); 60 61 return; 62 } 63 /*}}}*/ 64 65 /*FUNCTION KML_LinearRing::DeepEcho {{{1*/ 56 if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); 57 if(flag) _pprintLine_(" tessellate: " << (tessellate ? "true" : "false")); 58 if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); 59 if(flag) _pprintLine_(" coords: (ncoord=" << ncoord << ")"); 60 61 return; 62 } 63 /*}}}*/ 64 /*FUNCTION KML_LinearRing::DeepEcho {{{*/ 66 65 void KML_LinearRing::DeepEcho(){ 67 66 … … 73 72 } 74 73 /*}}}*/ 75 76 /*FUNCTION KML_LinearRing::DeepEcho {{{1*/ 74 /*FUNCTION KML_LinearRing::DeepEcho {{{*/ 77 75 void KML_LinearRing::DeepEcho(const char* indent){ 78 76 … … 80 78 bool flag=true; 81 79 82 _printf_(flag,"%sKML_LinearRing:\n",indent);80 if(flag) _pprintLine_(indent << "KML_LinearRing:"); 83 81 KML_Geometry::DeepEcho(indent); 84 82 85 _printf_(flag,"%s extrude: %s\n" ,indent,(extrude ? "true" : "false"));86 _printf_(flag,"%s tessellate: %s\n" ,indent,(tessellate ? "true" : "false"));87 _printf_(flag,"%s altmode: \"%s\"\n" ,indent,altmode);88 _printf_(flag,"%s coords: (ncoord=%d)\n" ,indent,ncoord);83 if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); 84 if(flag) _pprintLine_(indent << " tessellate: " << (tessellate ? "true" : "false")); 85 if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); 86 if(flag) _pprintLine_(indent << " coords: (ncoord=" << ncoord << ")"); 89 87 for (i=0; i<ncoord; i++) 90 _printf_(flag,"%s (%g,%g,%g)\n" ,indent, 91 coords[i][0],coords[i][1],coords[i][2]); 92 93 return; 94 } 95 /*}}}*/ 96 97 /*FUNCTION KML_LinearRing::Write {{{1*/ 88 _printf_(flag,"%s (%g,%g,%g)\n",indent, 89 coords[3*i+0],coords[3*i+1],coords[3*i+2]); 90 91 return; 92 } 93 /*}}}*/ 94 /*FUNCTION KML_LinearRing::Write {{{*/ 98 95 void KML_LinearRing::Write(FILE* filout,const char* indent){ 99 96 … … 115 112 116 113 for (i=0; i<ncoord; i++) 117 fprintf(filout,"%s %0.16g,%0.16g,%0.16g\n",indent, 118 coords[i][0],coords[i][1],coords[i][2]); 114 fprintf(filout,"%s %0.16g,%0.16g,%0.16g\n",indent,coords[3*i+0],coords[3*i+1],coords[3*i+2]); 119 115 120 116 fprintf(filout,"%s </coordinates>\n",indent); … … 124 120 } 125 121 /*}}}*/ 126 127 /*FUNCTION KML_LinearRing::Read {{{1*/ 122 /*FUNCTION KML_LinearRing::Read {{{*/ 128 123 void KML_LinearRing::Read(FILE* fid,char* kstr){ 129 124 130 char * kstri;131 int ncom=0;132 char ** pcom=NULL;125 char *kstri = NULL; 126 int ncom = 0; 127 char **pcom = NULL; 133 128 134 129 /* get object attributes and check for solo tag */ 135 130 136 if (KMLFileTagAttrib(this, 137 kstr)) 138 return; 131 if (KMLFileTagAttrib(this,kstr)) return; 139 132 140 133 /* loop over and process fields within opening and closing tags */ 141 134 142 while (kstri=KMLFileToken(fid, 143 &ncom,&pcom)) { 144 if (!strncmp(kstri,"</LinearRing",12)) { 145 xfree((void**)&kstri); 135 while (kstri=KMLFileToken(fid,&ncom,&pcom)){ 136 if (!strncmp(kstri,"</LinearRing",12)){ 137 xDelete<char>(kstri); 146 138 break; 147 139 } 148 140 else if (!strncmp(kstri,"</",2)) 149 _error_("KML_LinearRing::Read -- Unexpected closing tag %s.\n",kstri);141 {_error2_("KML_LinearRing::Read -- Unexpected closing tag " << kstri << ".\n");} 150 142 else if (strncmp(kstri,"<",1)) 151 _error_("KML_LinearRing::Read -- Unexpected field \"%s\".\n",kstri);143 {_error2_("KML_LinearRing::Read -- Unexpected field \"" << kstri << "\".\n");} 152 144 153 145 else if (!strcmp(kstri,"<extrude>")) 154 KMLFileTokenParse(&extrude , 155 kstri, 156 fid); 146 KMLFileTokenParse(&extrude,kstri,fid); 157 147 else if (!strcmp(kstri,"<tessellate>")) 158 KMLFileTokenParse(&tessellate, 159 kstri, 160 fid); 148 KMLFileTokenParse(&tessellate,kstri,fid); 161 149 else if (!strcmp(kstri,"<altitudeMode>")) 162 KMLFileTokenParse( altmode ,NULL,KML_LINEARRING_ALTMODE_LENGTH, 163 kstri, 164 fid); 150 KMLFileTokenParse(altmode,NULL,KML_LINEARRING_ALTMODE_LENGTH,kstri,fid); 165 151 else if (!strcmp(kstri,"<coordinates>")) 166 KMLFileTokenParse(&coords ,&ncoord ,0, 167 kstri, 168 fid); 169 152 KMLFileTokenParse(&coords,&ncoord,0,kstri,fid); 170 153 else if (!strncmp(kstri,"<",1)) 171 154 KML_Geometry::Read(fid,kstri); 172 155 173 x free((void**)&kstri);156 xDelete<char>(kstri); 174 157 } 175 158 176 159 this->AddCommnt(ncom,pcom); 177 160 178 for (ncom; ncom>0; ncom--) 179 xfree((void**)&(pcom[ncom-1])); 180 xfree((void**)&pcom); 181 182 return; 183 } 184 /*}}}*/ 185 186 /*FUNCTION KML_LinearRing::WriteExp {{{1*/ 161 for(ncom;ncom>0;ncom--) xDelete<char>((pcom[ncom-1])); 162 xDelete<char*>(pcom); 163 164 return; 165 } 166 /*}}}*/ 167 /*FUNCTION KML_LinearRing::WriteExp {{{*/ 187 168 void KML_LinearRing::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 188 169 … … 193 174 /* extract latitude and longitude into vectors */ 194 175 195 lat= (double *) xmalloc(ncoord*sizeof(double));196 lon= (double *) xmalloc(ncoord*sizeof(double));176 lat=xNew<double>(ncoord); 177 lon=xNew<double>(ncoord); 197 178 for (i=0; i<ncoord; i++) { 198 lon[i]=coords[ i][0];199 lat[i]=coords[ i][1];179 lon[i]=coords[3*i+0]; 180 lat[i]=coords[3*i+1]; 200 181 } 201 182 202 183 /* convert latitude and longitude to x and y */ 203 184 204 x = (double *) xmalloc(ncoord*sizeof(double));205 y = (double *) xmalloc(ncoord*sizeof(double));185 x =xNew<double>(ncoord); 186 y =xNew<double>(ncoord); 206 187 Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 207 188 … … 233 214 fprintf(fid,"\n"); 234 215 235 xfree((void**)&y); 236 xfree((void**)&x); 237 xfree((void**)&lon); 238 xfree((void**)&lat); 239 240 return; 241 } 242 /*}}}*/ 243 216 xDelete<double>(y); 217 xDelete<double>(x); 218 xDelete<double>(lon); 219 xDelete<double>(lat); 220 221 return; 222 } 223 /*}}}*/ -
issm/trunk/src/c/objects/KML/KML_LinearRing.h
r11237 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../../include/include.h" 13 13 #include "../../shared/Exceptions/exceptions.h" … … 21 21 public: 22 22 23 bool extrude;24 bool tessellate;25 char altmode[KML_LINEARRING_ALTMODE_LENGTH+1];26 intncoord;27 double (*coords)[3];23 bool extrude; 24 bool tessellate; 25 char altmode[KML_LINEARRING_ALTMODE_LENGTH+1]; 26 int ncoord; 27 double *coords; 28 28 29 /*KML_LinearRing constructors, destructors {{{ 1*/29 /*KML_LinearRing constructors, destructors {{{*/ 30 30 KML_LinearRing(); 31 31 ~KML_LinearRing(); 32 32 /*}}}*/ 33 /*Object virtual functions definitions:{{{ 1*/33 /*Object virtual functions definitions:{{{*/ 34 34 void Echo(); 35 35 void DeepEcho(); … … 38 38 void Read(FILE* fid,char* kstr); 39 39 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 40 int Id(){_error _("Not implemented yet.");};41 int MyRank(){_error _("Not implemented yet.");};42 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};43 int MarshallSize(){_error _("Not implemented yet.");};44 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};45 int ObjectEnum(){_error _("Not implemented yet.");};46 Object* copy(){_error _("Not implemented yet.");};40 int Id(){_error2_("Not implemented yet.");}; 41 int MyRank(){_error2_("Not implemented yet.");}; 42 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 43 int MarshallSize(){_error2_("Not implemented yet.");}; 44 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 45 int ObjectEnum(){_error2_("Not implemented yet.");}; 46 Object* copy(){_error2_("Not implemented yet.");}; 47 47 /*}}}*/ 48 48 -
issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_MultiGeometry::KML_MultiGeometry(){{{ 1*/23 /*FUNCTION KML_MultiGeometry::KML_MultiGeometry(){{{*/ 24 24 KML_MultiGeometry::KML_MultiGeometry(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_MultiGeometry::~KML_MultiGeometry(){{{ 1*/30 /*FUNCTION KML_MultiGeometry::~KML_MultiGeometry(){{{*/ 31 31 KML_MultiGeometry::~KML_MultiGeometry(){ 32 32 … … 40 40 41 41 /*Other*/ 42 /*FUNCTION KML_MultiGeometry::Echo {{{ 1*/42 /*FUNCTION KML_MultiGeometry::Echo {{{*/ 43 43 void KML_MultiGeometry::Echo(){ 44 44 45 45 bool flag=true; 46 46 47 _printf_(flag,"KML_Multigeometry:\n");47 if(flag) _pprintLine_("KML_Multigeometry:"); 48 48 KML_Geometry::Echo(); 49 49 50 _printf_(flag," geometry: (size=%d)\n" ,geometry->Size()); 51 52 return; 53 } 54 /*}}}*/ 55 56 /*FUNCTION KML_MultiGeometry::DeepEcho {{{1*/ 50 if(flag) _pprintLine_(" geometry: (size=" << geometry->Size() << ")"); 51 52 return; 53 } 54 /*}}}*/ 55 /*FUNCTION KML_MultiGeometry::DeepEcho {{{*/ 57 56 void KML_MultiGeometry::DeepEcho(){ 58 57 … … 64 63 } 65 64 /*}}}*/ 66 67 /*FUNCTION KML_MultiGeometry::DeepEcho {{{1*/ 65 /*FUNCTION KML_MultiGeometry::DeepEcho {{{*/ 68 66 void KML_MultiGeometry::DeepEcho(const char* indent){ 69 67 … … 72 70 bool flag=true; 73 71 74 _printf_(flag,"%sKML_Multigeometry:\n",indent);72 if(flag) _pprintLine_(indent << "KML_Multigeometry:"); 75 73 KML_Geometry::DeepEcho(indent); 76 74 … … 82 80 if (geometry->Size()) 83 81 for (i=0; i<geometry->Size(); i++) { 84 _printf_(flag,"%s geometry: -------- begin [%d] --------\n" ,indent,i);82 if(flag) _pprintLine_(indent << " geometry: -------- begin [" << i << "] --------"); 85 83 ((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2); 86 _printf_(flag,"%s geometry: -------- end [%d] --------\n" ,indent,i);84 if(flag) _pprintLine_(indent << " geometry: -------- end [" << i << "] --------"); 87 85 } 88 86 else 89 _printf_(flag,"%s geometry: [empty]\n" ,indent); 90 91 return; 92 } 93 /*}}}*/ 94 95 /*FUNCTION KML_MultiGeometry::Write {{{1*/ 87 if(flag) _pprintLine_(indent << " geometry: [empty]"); 88 89 return; 90 } 91 /*}}}*/ 92 /*FUNCTION KML_MultiGeometry::Write {{{*/ 96 93 void KML_MultiGeometry::Write(FILE* filout,const char* indent){ 97 94 … … 120 117 } 121 118 /*}}}*/ 122 123 /*FUNCTION KML_MultiGeometry::Read {{{1*/ 119 /*FUNCTION KML_MultiGeometry::Read {{{*/ 124 120 void KML_MultiGeometry::Read(FILE* fid,char* kstr){ 125 121 … … 144 140 } 145 141 else if (!strncmp(kstri,"</",2)) 146 _error_("KML_MultiGeometry::Read -- Unexpected closing tag %s.\n",kstri);142 {_error2_("KML_MultiGeometry::Read -- Unexpected closing tag " << kstri << ".\n");} 147 143 else if (strncmp(kstri,"<",1)) 148 _error_("KML_MultiGeometry::Read -- Unexpected field \"%s\".\n",kstri);144 {_error2_("KML_MultiGeometry::Read -- Unexpected field \"" << kstri << "\".\n");} 149 145 150 146 else if (!strncmp(kstri,"<Point", 6)) { … … 193 189 } 194 190 /*}}}*/ 195 196 /*FUNCTION KML_MultiGeometry::WriteExp {{{1*/ 191 /*FUNCTION KML_MultiGeometry::WriteExp {{{*/ 197 192 void KML_MultiGeometry::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 198 193 … … 207 202 } 208 203 /*}}}*/ 209 -
issm/trunk/src/c/objects/KML/KML_MultiGeometry.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 23 23 DataSet* geometry; 24 24 25 /*KML_MultiGeometry constructors, destructors {{{ 1*/25 /*KML_MultiGeometry constructors, destructors {{{*/ 26 26 KML_MultiGeometry(); 27 27 ~KML_MultiGeometry(); 28 28 /*}}}*/ 29 /*Object virtual functions definitions:{{{ 1*/29 /*Object virtual functions definitions:{{{*/ 30 30 void Echo(); 31 31 void DeepEcho(); … … 34 34 void Read(FILE* fid,char* kstr); 35 35 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 36 int Id(){_error _("Not implemented yet.");};37 int MyRank(){_error _("Not implemented yet.");};38 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};39 int MarshallSize(){_error _("Not implemented yet.");};40 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};41 int ObjectEnum(){_error _("Not implemented yet.");};42 Object* copy(){_error _("Not implemented yet.");};36 int Id(){_error2_("Not implemented yet.");}; 37 int MyRank(){_error2_("Not implemented yet.");}; 38 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 39 int MarshallSize(){_error2_("Not implemented yet.");}; 40 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 41 int ObjectEnum(){_error2_("Not implemented yet.");}; 42 Object* copy(){_error2_("Not implemented yet.");}; 43 43 /*}}}*/ 44 44 -
issm/trunk/src/c/objects/KML/KML_Object.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Object::KML_Object(){{{ 1*/23 /*FUNCTION KML_Object::KML_Object(){{{*/ 24 24 KML_Object::KML_Object(){ 25 25 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION KML_Object::~KML_Object(){{{ 1*/32 /*FUNCTION KML_Object::~KML_Object(){{{*/ 33 33 KML_Object::~KML_Object(){ 34 34 … … 50 50 51 51 /*Other*/ 52 /*FUNCTION KML_Object::Echo {{{ 1*/52 /*FUNCTION KML_Object::Echo {{{*/ 53 53 void KML_Object::Echo(){ 54 54 55 55 bool flag=true; 56 56 57 _printf_(flag," attrib: (size=%d)\n" ,attrib->Size());58 _printf_(flag," commnt: (size=%d)\n" ,commnt->Size());59 _printf_(flag," kmlobj: (size=%d)\n" ,kmlobj->Size());60 61 return; 62 } 63 /*}}}*/ 64 /*FUNCTION KML_Object::DeepEcho {{{ 1*/57 if(flag) _pprintLine_(" attrib: (size=" << attrib->Size() << ")"); 58 if(flag) _pprintLine_(" commnt: (size=" << commnt->Size() << ")"); 59 if(flag) _pprintLine_(" kmlobj: (size=" << kmlobj->Size() << ")"); 60 61 return; 62 } 63 /*}}}*/ 64 /*FUNCTION KML_Object::DeepEcho {{{*/ 65 65 void KML_Object::DeepEcho(){ 66 66 … … 72 72 } 73 73 /*}}}*/ 74 /*FUNCTION KML_Object::DeepEcho {{{ 1*/74 /*FUNCTION KML_Object::DeepEcho {{{*/ 75 75 void KML_Object::DeepEcho(const char* indent){ 76 76 … … 86 86 } 87 87 else 88 _printf_(flag,"%s attrib: [empty]\n" ,indent);88 if(flag) _pprintLine_(indent << " attrib: [empty]"); 89 89 90 90 /* loop over the comments for the object */ … … 95 95 } 96 96 else 97 _printf_(flag,"%s commnt: [empty]\n" ,indent);97 if(flag) _pprintLine_(indent << " commnt: [empty]"); 98 98 99 99 /* loop over the unknown objects for the object */ … … 104 104 if (kmlobj->Size()) 105 105 for (i=0; i<kmlobj->Size(); i++) { 106 _printf_(flag,"%s kmlobj: -------- begin [%d] --------\n" ,indent,i);106 if(flag) _pprintLine_(indent << " kmlobj: -------- begin [" << i << "] --------"); 107 107 ((KML_Unknown *)kmlobj->GetObjectByOffset(i))->DeepEcho(indent2); 108 _printf_(flag,"%s kmlobj: -------- end [%d] --------\n" ,indent,i);108 if(flag) _pprintLine_(indent << " kmlobj: -------- end [" << i << "] --------"); 109 109 } 110 110 else 111 _printf_(flag,"%s kmlobj: [empty]\n" ,indent);112 113 return; 114 } 115 /*}}}*/ 116 /*FUNCTION KML_Object::Write {{{ 1*/111 if(flag) _pprintLine_(indent << " kmlobj: [empty]"); 112 113 return; 114 } 115 /*}}}*/ 116 /*FUNCTION KML_Object::Write {{{*/ 117 117 void KML_Object::Write(FILE* filout,const char* indent){ 118 118 … … 136 136 } 137 137 /*}}}*/ 138 /*FUNCTION KML_Object::Read {{{ 1*/138 /*FUNCTION KML_Object::Read {{{*/ 139 139 void KML_Object::Read(FILE* fid,char* kstr){ 140 140 … … 146 146 return; 147 147 else if (!strncmp(kstr,"</",2)) 148 _error_("KML_Object::Read -- Unexpected closing tag %s.\n",kstr);148 {_error2_("KML_Object::Read -- Unexpected closing tag " << kstr << ".\n");} 149 149 else if (strncmp(kstr,"<",1)) 150 _error_("KML_Object::Read -- Unexpected field \"%s\".\n",kstr);150 {_error2_("KML_Object::Read -- Unexpected field \"" << kstr << "\".\n");} 151 151 152 152 else if (!strncmp(kstr,"<Placemark",10)) { … … 253 253 254 254 else if (!strncmp(kstr,"<",1)) { 255 _p rintf_(true,"KML_Object::Read -- Unrecognized opening tag %s.\n",kstr);255 _pprintLine_("KML_Object::Read -- Unrecognized opening tag " << kstr << "."); 256 256 // KMLFileTagSkip(kstr, 257 257 // fid); … … 264 264 } 265 265 /*}}}*/ 266 /*FUNCTION KML_Object::WriteExp {{{ 1*/266 /*FUNCTION KML_Object::WriteExp {{{*/ 267 267 void KML_Object::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 268 268 … … 272 272 } 273 273 /*}}}*/ 274 /*FUNCTION KML_Object::AddAttrib {{{ 1*/274 /*FUNCTION KML_Object::AddAttrib {{{*/ 275 275 void KML_Object::AddAttrib(const char* name,const char* value){ 276 276 … … 284 284 } 285 285 /*}}}*/ 286 /*FUNCTION KML_Object::FindAttrib {{{ 1*/286 /*FUNCTION KML_Object::FindAttrib {{{*/ 287 287 void KML_Object::FindAttrib(char** pvalue,char* name,char* deflt){ 288 288 … … 311 311 } 312 312 /*}}}*/ 313 /*FUNCTION KML_Object::WriteAttrib {{{ 1*/313 /*FUNCTION KML_Object::WriteAttrib {{{*/ 314 314 void KML_Object::WriteAttrib(FILE* filout,const char* indent){ 315 315 … … 325 325 } 326 326 /*}}}*/ 327 /*FUNCTION KML_Object::AddCommnt {{{ 1*/327 /*FUNCTION KML_Object::AddCommnt {{{*/ 328 328 void KML_Object::AddCommnt(int ncom,char** pcom){ 329 329 … … 340 340 } 341 341 /*}}}*/ 342 /*FUNCTION KML_Object::AddCommnt {{{ 1*/342 /*FUNCTION KML_Object::AddCommnt {{{*/ 343 343 void KML_Object::AddCommnt(char* value){ 344 344 … … 352 352 } 353 353 /*}}}*/ 354 /*FUNCTION KML_Object::FindCommnt {{{ 1*/354 /*FUNCTION KML_Object::FindCommnt {{{*/ 355 355 void KML_Object::FindCommnt(char** pvalue,int inum){ 356 356 … … 370 370 } 371 371 /*}}}*/ 372 /*FUNCTION KML_Object::WriteCommnt {{{ 1*/372 /*FUNCTION KML_Object::WriteCommnt {{{*/ 373 373 void KML_Object::WriteCommnt(FILE* filout,const char* indent){ 374 374 -
issm/trunk/src/c/objects/KML/KML_Object.h
r11527 r12706 6 6 #define _KML_OBJECT_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 23 23 DataSet* kmlobj; 24 24 25 /*KML_Object constructors, destructors {{{ 1*/25 /*KML_Object constructors, destructors {{{*/ 26 26 KML_Object(); 27 27 ~KML_Object(); 28 28 /*}}}*/ 29 /*Object virtual functions definitions:{{{ 1*/29 /*Object virtual functions definitions:{{{*/ 30 30 virtual void Echo(); 31 31 virtual void DeepEcho(); 32 32 virtual void DeepEcho(const char* indent); 33 int Id(){_error _("Not implemented yet.");};34 int MyRank(){_error _("Not implemented yet.");};35 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};36 int MarshallSize(){_error _("Not implemented yet.");};37 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};38 int ObjectEnum(){_error _("Not implemented yet.");};39 Object* copy(){_error _("Not implemented yet.");};33 int Id(){_error2_("Not implemented yet.");}; 34 int MyRank(){_error2_("Not implemented yet.");}; 35 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 36 int MarshallSize(){_error2_("Not implemented yet.");}; 37 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 38 int ObjectEnum(){_error2_("Not implemented yet.");}; 39 Object* copy(){_error2_("Not implemented yet.");}; 40 40 /*}}}*/ 41 41 -
issm/trunk/src/c/objects/KML/KML_Overlay.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Overlay::KML_Overlay(){{{ 1*/23 /*FUNCTION KML_Overlay::KML_Overlay(){{{*/ 24 24 KML_Overlay::KML_Overlay(){ 25 25 … … 32 32 } 33 33 /*}}}*/ 34 /*FUNCTION KML_Overlay::~KML_Overlay(){{{ 1*/34 /*FUNCTION KML_Overlay::~KML_Overlay(){{{*/ 35 35 KML_Overlay::~KML_Overlay(){ 36 36 … … 44 44 45 45 /*Other*/ 46 /*FUNCTION KML_Overlay::Echo {{{ 1*/46 /*FUNCTION KML_Overlay::Echo {{{*/ 47 47 void KML_Overlay::Echo(){ 48 48 49 bool flag=true;50 51 49 KML_Feature::Echo(); 52 53 _printf_(flag," color: \"%s\"\n" ,color); 54 _printf_(flag," draword: %d\n" ,draword); 55 _printf_(flag," icon: %p\n" ,icon); 56 57 return; 50 _pprintLine_(" color: \"" << color << "\""); 51 _pprintLine_(" draword: " << draword); 52 _pprintLine_(" icon: " << icon); 58 53 } 59 54 /*}}}*/ 60 61 /*FUNCTION KML_Overlay::DeepEcho {{{1*/ 55 /*FUNCTION KML_Overlay::DeepEcho {{{*/ 62 56 void KML_Overlay::DeepEcho(){ 63 57 … … 69 63 } 70 64 /*}}}*/ 71 72 /*FUNCTION KML_Overlay::DeepEcho {{{1*/ 65 /*FUNCTION KML_Overlay::DeepEcho {{{*/ 73 66 void KML_Overlay::DeepEcho(const char* indent){ 74 67 75 68 char indent2[81]; 76 bool flag=true;77 78 69 KML_Feature::DeepEcho(indent); 79 70 … … 81 72 strcat(indent2," "); 82 73 83 _p rintf_(flag,"%s color: %s\n" ,indent,color);84 _p rintf_(flag,"%s draword: %d\n" ,indent,draword);74 _pprintLine_(indent << " color: " << color); 75 _pprintLine_(indent << " draword: " << draword); 85 76 if (icon) 86 77 icon->DeepEcho(indent2); 87 78 else 88 _printf_(flag,"%s icon: %p\n" ,indent,icon); 89 90 return; 79 _pprintLine_(indent << " icon: " << icon); 91 80 } 92 81 /*}}}*/ 93 94 /*FUNCTION KML_Overlay::Write {{{1*/ 82 /*FUNCTION KML_Overlay::Write {{{*/ 95 83 void KML_Overlay::Write(FILE* filout,const char* indent){ 96 84 … … 112 100 } 113 101 /*}}}*/ 114 115 /*FUNCTION KML_Overlay::Read {{{1*/ 102 /*FUNCTION KML_Overlay::Read {{{*/ 116 103 void KML_Overlay::Read(FILE* fid,char* kstr){ 117 104 … … 123 110 } 124 111 else if (!strncmp(kstr,"</",2)) 125 _error_("KML_Overlay::Read -- Unexpected closing tag %s.\n",kstr);112 {_error2_("KML_Overlay::Read -- Unexpected closing tag " << kstr << ".\n");} 126 113 else if (strncmp(kstr,"<",1)) 127 _error_("KML_Overlay::Read -- Unexpected field \"%s\".\n",kstr);114 {_error2_("KML_Overlay::Read -- Unexpected field \"" << kstr << "\".\n");} 128 115 129 116 else if (!strcmp(kstr,"<color>")) … … 147 134 } 148 135 /*}}}*/ 149 -
issm/trunk/src/c/objects/KML/KML_Overlay.h
r11237 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../../include/include.h" 13 13 #include "../../shared/Exceptions/exceptions.h" … … 26 26 KML_Icon* icon; 27 27 28 /*KML_Overlay constructors, destructors {{{ 1*/28 /*KML_Overlay constructors, destructors {{{*/ 29 29 KML_Overlay(); 30 30 ~KML_Overlay(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{*/ 33 33 void Echo(); 34 34 void DeepEcho(); … … 36 36 void Write(FILE* fid,const char* indent); 37 37 void Read(FILE* fid,char* kstr); 38 int Id(){_error _("Not implemented yet.");};39 int MyRank(){_error _("Not implemented yet.");};40 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};41 int MarshallSize(){_error _("Not implemented yet.");};42 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};43 int ObjectEnum(){_error _("Not implemented yet.");};44 Object* copy(){_error _("Not implemented yet.");};38 int Id(){_error2_("Not implemented yet.");}; 39 int MyRank(){_error2_("Not implemented yet.");}; 40 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 41 int MarshallSize(){_error2_("Not implemented yet.");}; 42 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 43 int ObjectEnum(){_error2_("Not implemented yet.");}; 44 Object* copy(){_error2_("Not implemented yet.");}; 45 45 /*}}}*/ 46 46 -
issm/trunk/src/c/objects/KML/KML_Placemark.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Placemark::KML_Placemark(){{{ 1*/23 /*FUNCTION KML_Placemark::KML_Placemark(){{{*/ 24 24 KML_Placemark::KML_Placemark(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION KML_Placemark::~KML_Placemark(){{{ 1*/30 /*FUNCTION KML_Placemark::~KML_Placemark(){{{*/ 31 31 KML_Placemark::~KML_Placemark(){ 32 32 … … 40 40 41 41 /*Other*/ 42 /*FUNCTION KML_Placemark::Echo {{{ 1*/42 /*FUNCTION KML_Placemark::Echo {{{*/ 43 43 void KML_Placemark::Echo(){ 44 44 45 45 bool flag=true; 46 46 47 _printf_(flag,"KML_Placemark:\n");47 if(flag) _pprintLine_("KML_Placemark:"); 48 48 KML_Feature::Echo(); 49 49 50 _printf_(flag," geometry: (size=%d)\n" ,geometry->Size());51 52 return; 53 } 54 /*}}}*/ 55 /*FUNCTION KML_Placemark::DeepEcho {{{ 1*/50 if(flag) _pprintLine_(" geometry: (size=" << geometry->Size() << ")"); 51 52 return; 53 } 54 /*}}}*/ 55 /*FUNCTION KML_Placemark::DeepEcho {{{*/ 56 56 void KML_Placemark::DeepEcho(){ 57 57 … … 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION KML_Placemark::DeepEcho {{{ 1*/65 /*FUNCTION KML_Placemark::DeepEcho {{{*/ 66 66 void KML_Placemark::DeepEcho(const char* indent){ 67 67 … … 70 70 bool flag=true; 71 71 72 _printf_(flag,"%sKML_Placemark:\n",indent);72 if(flag) _pprintLine_(indent << "KML_Placemark:"); 73 73 KML_Feature::DeepEcho(indent); 74 74 … … 80 80 if (geometry->Size()) 81 81 for (i=0; i<geometry->Size(); i++) { 82 _printf_(flag,"%s geometry: -------- begin [%d] --------\n" ,indent,i);82 if(flag) _pprintLine_(indent << " geometry: -------- begin [" << i << "] --------"); 83 83 ((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2); 84 _printf_(flag,"%s geometry: -------- end [%d] --------\n" ,indent,i);84 if(flag) _pprintLine_(indent << " geometry: -------- end [" << i << "] --------"); 85 85 } 86 86 else 87 _printf_(flag,"%s geometry: [empty]\n" ,indent);88 89 return; 90 } 91 /*}}}*/ 92 /*FUNCTION KML_Placemark::Write {{{ 1*/87 if(flag) _pprintLine_(indent << " geometry: [empty]"); 88 89 return; 90 } 91 /*}}}*/ 92 /*FUNCTION KML_Placemark::Write {{{*/ 93 93 void KML_Placemark::Write(FILE* filout,const char* indent){ 94 94 … … 117 117 } 118 118 /*}}}*/ 119 /*FUNCTION KML_Placemark::Read {{{ 1*/119 /*FUNCTION KML_Placemark::Read {{{*/ 120 120 void KML_Placemark::Read(FILE* fid,char* kstr){ 121 121 … … 140 140 } 141 141 else if (!strncmp(kstri,"</",2)) 142 _error_("KML_Placemark::Read -- Unexpected closing tag %s.\n",kstri);142 {_error2_("KML_Placemark::Read -- Unexpected closing tag " << kstri << ".\n");} 143 143 else if (strncmp(kstri,"<",1)) 144 _error_("KML_Placemark::Read -- Unexpected field \"%s\".\n",kstri);144 {_error2_("KML_Placemark::Read -- Unexpected field \"" << kstri << "\".\n");} 145 145 146 146 else if (!strncmp(kstri,"<Point", 6)) { … … 189 189 } 190 190 /*}}}*/ 191 /*FUNCTION KML_Placemark::WriteExp {{{ 1*/191 /*FUNCTION KML_Placemark::WriteExp {{{*/ 192 192 void KML_Placemark::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 193 193 -
issm/trunk/src/c/objects/KML/KML_Placemark.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 23 23 DataSet* geometry; 24 24 25 /*KML_Placemark constructors, destructors {{{ 1*/25 /*KML_Placemark constructors, destructors {{{*/ 26 26 KML_Placemark(); 27 27 ~KML_Placemark(); 28 28 /*}}}*/ 29 /*Object virtual functions definitions:{{{ 1*/29 /*Object virtual functions definitions:{{{*/ 30 30 void Echo(); 31 31 void DeepEcho(); … … 34 34 void Read(FILE* fid,char* kstr); 35 35 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 36 int Id(){_error _("Not implemented yet.");};37 int MyRank(){_error _("Not implemented yet.");};38 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};39 int MarshallSize(){_error _("Not implemented yet.");};40 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};41 int ObjectEnum(){_error _("Not implemented yet.");};42 Object* copy(){_error _("Not implemented yet.");};36 int Id(){_error2_("Not implemented yet.");}; 37 int MyRank(){_error2_("Not implemented yet.");}; 38 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 39 int MarshallSize(){_error2_("Not implemented yet.");}; 40 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 41 int ObjectEnum(){_error2_("Not implemented yet.");}; 42 Object* copy(){_error2_("Not implemented yet.");}; 43 43 /*}}}*/ 44 44 -
issm/trunk/src/c/objects/KML/KML_Point.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 22 22 23 23 /*Constructors/destructor/copy*/ 24 /*FUNCTION KML_Point::KML_Point(){{{ 1*/24 /*FUNCTION KML_Point::KML_Point(){{{*/ 25 25 KML_Point::KML_Point(){ 26 26 … … 34 34 } 35 35 /*}}}*/ 36 /*FUNCTION KML_Point::~KML_Point(){{{ 1*/36 /*FUNCTION KML_Point::~KML_Point(){{{*/ 37 37 KML_Point::~KML_Point(){ 38 38 … … 43 43 44 44 /*Other*/ 45 /*FUNCTION KML_Point::Echo {{{ 1*/45 /*FUNCTION KML_Point::Echo {{{*/ 46 46 void KML_Point::Echo(){ 47 47 48 48 bool flag=true; 49 49 50 _printf_(flag,"KML_Point:\n");50 if(flag) _pprintLine_("KML_Point:"); 51 51 KML_Geometry::Echo(); 52 52 53 _printf_(flag," extrude: %s\n" ,(extrude ? "true" : "false"));54 _printf_(flag," altmode: \"%s\"\n" ,altmode);55 _printf_(flag," coords: (%g,%g,%g)\n" ,coords[0],coords[1],coords[2]);53 if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); 54 if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); 55 if(flag) _pprintLine_(" coords: (" << coords[0] << "," << coords[1] << "," << coords[2] << ")"); 56 56 57 57 return; 58 58 } 59 59 /*}}}*/ 60 /*FUNCTION KML_Point::DeepEcho {{{ 1*/60 /*FUNCTION KML_Point::DeepEcho {{{*/ 61 61 void KML_Point::DeepEcho(){ 62 62 … … 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION KML_Point::DeepEcho {{{ 1*/70 /*FUNCTION KML_Point::DeepEcho {{{*/ 71 71 void KML_Point::DeepEcho(const char* indent){ 72 72 73 73 bool flag=true; 74 74 75 _printf_(flag,"%sKML_Point:\n",indent);75 if(flag) _pprintLine_(indent << "KML_Point:"); 76 76 KML_Geometry::DeepEcho(indent); 77 77 78 _printf_(flag,"%s extrude: %s\n" ,indent,(extrude ? "true" : "false"));79 _printf_(flag,"%s altmode: \"%s\"\n" ,indent,altmode);80 _printf_(flag,"%s coords: (%g,%g,%g)\n" ,indent,coords[0],coords[1],coords[2]);78 if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); 79 if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); 80 if(flag) _pprintLine_(indent << " coords: (" << coords[0] << "," << coords[1] << "," << coords[2] << ")"); 81 81 82 82 return; 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION KML_Point::Write {{{ 1*/85 /*FUNCTION KML_Point::Write {{{*/ 86 86 void KML_Point::Write(FILE* filout,const char* indent){ 87 87 … … 103 103 } 104 104 /*}}}*/ 105 /*FUNCTION KML_Point::Read {{{ 1*/105 /*FUNCTION KML_Point::Read {{{*/ 106 106 void KML_Point::Read(FILE* fid,char* kstr){ 107 107 … … 126 126 } 127 127 else if (!strncmp(kstri,"</",2)) 128 _error_("KML_Point::Read -- Unexpected closing tag %s.\n",kstri);128 {_error2_("KML_Point::Read -- Unexpected closing tag " << kstri << ".\n");} 129 129 else if (strncmp(kstri,"<",1)) 130 _error_("KML_Point::Read -- Unexpected field \"%s\".\n",kstri);130 {_error2_("KML_Point::Read -- Unexpected field \"" << kstri << "\".\n");} 131 131 132 132 else if (!strcmp(kstri,"<extrude>")) 133 KMLFileTokenParse(&extrude , 134 kstri, 135 fid); 133 KMLFileTokenParse(&extrude , kstri, fid); 136 134 else if (!strcmp(kstri,"<altitudeMode>")) 137 KMLFileTokenParse( altmode ,NULL,KML_POINT_ALTMODE_LENGTH, 138 kstri, 139 fid); 135 KMLFileTokenParse( altmode ,NULL,KML_POINT_ALTMODE_LENGTH, kstri, fid); 140 136 else if (!strcmp(kstri,"<coordinates>")) 141 KMLFileTokenParse(&pcoords ,NULL,3, 142 kstri, 143 fid); 137 KMLFileTokenParse(&pcoords ,NULL,3, kstri, fid); 144 138 145 139 else if (!strncmp(kstri,"<",1)) … … 158 152 } 159 153 /*}}}*/ 160 /*FUNCTION KML_Point::WriteExp {{{ 1*/154 /*FUNCTION KML_Point::WriteExp {{{*/ 161 155 void KML_Point::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 162 156 -
issm/trunk/src/c/objects/KML/KML_Point.h
r11237 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../../include/include.h" 13 13 #include "../../shared/Exceptions/exceptions.h" … … 25 25 double coords[3]; 26 26 27 /*KML_Point constructors, destructors {{{ 1*/27 /*KML_Point constructors, destructors {{{*/ 28 28 KML_Point(); 29 29 ~KML_Point(); 30 30 /*}}}*/ 31 /*Object virtual functions definitions:{{{ 1*/31 /*Object virtual functions definitions:{{{*/ 32 32 void Echo(); 33 33 void DeepEcho(); … … 36 36 void Read(FILE* fid,char* kstr); 37 37 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 38 int Id(){_error _("Not implemented yet.");};39 int MyRank(){_error _("Not implemented yet.");};40 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};41 int MarshallSize(){_error _("Not implemented yet.");};42 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};43 int ObjectEnum(){_error _("Not implemented yet.");};44 Object* copy(){_error _("Not implemented yet.");};38 int Id(){_error2_("Not implemented yet.");}; 39 int MyRank(){_error2_("Not implemented yet.");}; 40 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 41 int MarshallSize(){_error2_("Not implemented yet.");}; 42 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 43 int ObjectEnum(){_error2_("Not implemented yet.");}; 44 Object* copy(){_error2_("Not implemented yet.");}; 45 45 /*}}}*/ 46 46 -
issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_PolyStyle::KML_PolyStyle(){{{ 1*/23 /*FUNCTION KML_PolyStyle::KML_PolyStyle(){{{*/ 24 24 KML_PolyStyle::KML_PolyStyle(){ 25 25 … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION KML_PolyStyle::~KML_PolyStyle(){{{ 1*/31 /*FUNCTION KML_PolyStyle::~KML_PolyStyle(){{{*/ 32 32 KML_PolyStyle::~KML_PolyStyle(){ 33 33 … … 38 38 39 39 /*Other*/ 40 /*FUNCTION KML_PolyStyle::Echo {{{ 1*/40 /*FUNCTION KML_PolyStyle::Echo {{{*/ 41 41 void KML_PolyStyle::Echo(){ 42 42 43 43 bool flag=true; 44 44 45 _printf_(flag,"KML_PolyStyle:\n");45 if(flag) _pprintLine_("KML_PolyStyle:"); 46 46 KML_ColorStyle::Echo(); 47 47 48 _printf_(flag," fill: %d\n" ,fill);49 _printf_(flag," outline: %d\n" ,outline);48 if(flag) _pprintLine_(" fill: " << fill); 49 if(flag) _pprintLine_(" outline: " << outline); 50 50 51 51 return; 52 52 } 53 53 /*}}}*/ 54 55 /*FUNCTION KML_PolyStyle::DeepEcho {{{1*/ 54 /*FUNCTION KML_PolyStyle::DeepEcho {{{*/ 56 55 void KML_PolyStyle::DeepEcho(){ 57 56 … … 63 62 } 64 63 /*}}}*/ 65 66 /*FUNCTION KML_PolyStyle::DeepEcho {{{1*/ 64 /*FUNCTION KML_PolyStyle::DeepEcho {{{*/ 67 65 void KML_PolyStyle::DeepEcho(const char* indent){ 68 66 … … 70 68 bool flag=true; 71 69 72 _printf_(flag,"%sKML_PolyStyle:\n",indent);70 if(flag) _pprintLine_(indent << "KML_PolyStyle:"); 73 71 KML_ColorStyle::DeepEcho(indent); 74 72 75 _printf_(flag,"%s fill: %d\n" ,indent,fill);76 _printf_(flag,"%s outline: %d\n" ,indent,outline);73 if(flag) _pprintLine_(indent << " fill: " << fill); 74 if(flag) _pprintLine_(indent << " outline: " << outline); 77 75 78 76 return; 79 77 } 80 78 /*}}}*/ 81 82 /*FUNCTION KML_PolyStyle::Write {{{1*/ 79 /*FUNCTION KML_PolyStyle::Write {{{*/ 83 80 void KML_PolyStyle::Write(FILE* filout,const char* indent){ 84 81 … … 98 95 } 99 96 /*}}}*/ 100 101 /*FUNCTION KML_PolyStyle::Read {{{1*/ 97 /*FUNCTION KML_PolyStyle::Read {{{*/ 102 98 void KML_PolyStyle::Read(FILE* fid,char* kstr){ 103 99 … … 121 117 } 122 118 else if (!strncmp(kstri,"</",2)) 123 _error_("KML_PolyStyle::Read -- Unexpected closing tag %s.\n",kstri);119 {_error2_("KML_PolyStyle::Read -- Unexpected closing tag " << kstri << ".\n");} 124 120 else if (strncmp(kstri,"<",1)) 125 _error_("KML_PolyStyle::Read -- Unexpected field \"%s\".\n",kstri);121 {_error2_("KML_PolyStyle::Read -- Unexpected field \"" << kstri << "\".\n");} 126 122 127 123 else if (!strcmp(kstri,"<fill>")) … … 149 145 } 150 146 /*}}}*/ 151 -
issm/trunk/src/c/objects/KML/KML_PolyStyle.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 22 22 int outline; 23 23 24 /*KML_PolyStyle constructors, destructors {{{ 1*/24 /*KML_PolyStyle constructors, destructors {{{*/ 25 25 KML_PolyStyle(); 26 26 ~KML_PolyStyle(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{ */ 29 29 void Echo(); 30 30 void DeepEcho(); … … 32 32 void Write(FILE* fid,const char* indent); 33 33 void Read(FILE* fid,char* kstr); 34 int Id(){_error _("Not implemented yet.");};35 int MyRank(){_error _("Not implemented yet.");};36 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};37 int MarshallSize(){_error _("Not implemented yet.");};38 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};39 int ObjectEnum(){_error _("Not implemented yet.");};40 Object* copy(){_error _("Not implemented yet.");};34 int Id(){_error2_("Not implemented yet.");}; 35 int MyRank(){_error2_("Not implemented yet.");}; 36 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 37 int MarshallSize(){_error2_("Not implemented yet.");}; 38 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 39 int ObjectEnum(){_error2_("Not implemented yet.");}; 40 Object* copy(){_error2_("Not implemented yet.");}; 41 41 /*}}}*/ 42 42 -
issm/trunk/src/c/objects/KML/KML_Polygon.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Polygon::KML_Polygon(){{{ 1*/23 /*FUNCTION KML_Polygon::KML_Polygon(){{{*/ 24 24 KML_Polygon::KML_Polygon(){ 25 25 … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION KML_Polygon::~KML_Polygon(){{{ 1*/35 /*FUNCTION KML_Polygon::~KML_Polygon(){{{*/ 36 36 KML_Polygon::~KML_Polygon(){ 37 37 … … 50 50 51 51 /*Other*/ 52 /*FUNCTION KML_Polygon::Echo {{{ 1*/52 /*FUNCTION KML_Polygon::Echo {{{*/ 53 53 void KML_Polygon::Echo(){ 54 54 55 55 bool flag=true; 56 56 57 _printf_(flag,"KML_Polygon:\n");57 if(flag) _pprintLine_("KML_Polygon:"); 58 58 KML_Geometry::Echo(); 59 59 60 _printf_(flag," extrude: %s\n" ,(extrude ? "true" : "false"));61 _printf_(flag," tessellate: %s\n" ,(tessellate ? "true" : "false"));62 _printf_(flag," altmode: \"%s\"\n" ,altmode);63 _printf_(flag," outer: (size=%d)\n" ,outer->Size());64 _printf_(flag," inner: (size=%d)\n" ,inner->Size());65 66 return; 67 } 68 /*}}}*/ 69 /*FUNCTION KML_Polygon::DeepEcho {{{ 1*/60 if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); 61 if(flag) _pprintLine_(" tessellate: " << (tessellate ? "true" : "false")); 62 if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); 63 if(flag) _pprintLine_(" outer: (size=" << outer->Size() << ")"); 64 if(flag) _pprintLine_(" inner: (size=" << inner->Size() << ")"); 65 66 return; 67 } 68 /*}}}*/ 69 /*FUNCTION KML_Polygon::DeepEcho {{{*/ 70 70 void KML_Polygon::DeepEcho(){ 71 71 … … 77 77 } 78 78 /*}}}*/ 79 /*FUNCTION KML_Polygon::DeepEcho {{{ 1*/79 /*FUNCTION KML_Polygon::DeepEcho {{{*/ 80 80 void KML_Polygon::DeepEcho(const char* indent){ 81 81 … … 84 84 bool flag=true; 85 85 86 _printf_(flag,"%sKML_Polygon:\n",indent);86 if(flag) _pprintLine_(indent << "KML_Polygon:"); 87 87 KML_Geometry::DeepEcho(indent); 88 88 89 _printf_(flag,"%s extrude: %s\n" ,indent,(extrude ? "true" : "false"));90 _printf_(flag,"%s tessellate: %s\n" ,indent,(tessellate ? "true" : "false"));91 _printf_(flag,"%s altmode: \"%s\"\n" ,indent,altmode);89 if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); 90 if(flag) _pprintLine_(indent << " tessellate: " << (tessellate ? "true" : "false")); 91 if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); 92 92 93 93 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); … … 96 96 if (outer->Size()) 97 97 for (i=0; i<outer->Size(); i++) { 98 _printf_(flag,"%s outer: -------- begin [%d] --------\n" ,indent,i);98 if(flag) _pprintLine_(indent << " outer: -------- begin [" << i << "] --------"); 99 99 ((KML_LinearRing *)outer->GetObjectByOffset(i))->DeepEcho(indent2); 100 _printf_(flag,"%s outer: -------- end [%d] --------\n" ,indent,i);100 if(flag) _pprintLine_(indent << " outer: -------- end [" << i << "] --------"); 101 101 } 102 102 else 103 _printf_(flag,"%s outer: [empty]\n" ,indent);103 if(flag) _pprintLine_(indent << " outer: [empty]"); 104 104 105 105 if (inner->Size()) 106 106 for (i=0; i<inner->Size(); i++) { 107 _printf_(flag,"%s inner: -------- begin [%d] --------\n" ,indent,i);107 if(flag) _pprintLine_(indent << " inner: -------- begin [" << i << "] --------"); 108 108 ((KML_LinearRing *)inner->GetObjectByOffset(i))->DeepEcho(indent2); 109 _printf_(flag,"%s inner: -------- end [%d] --------\n" ,indent,i);109 if(flag) _pprintLine_(indent << " inner: -------- end [" << i << "] --------"); 110 110 } 111 111 else 112 _printf_(flag,"%s inner: [empty]\n" ,indent);113 114 return; 115 } 116 /*}}}*/ 117 /*FUNCTION KML_Polygon::Write {{{ 1*/112 if(flag) _pprintLine_(indent << " inner: [empty]"); 113 114 return; 115 } 116 /*}}}*/ 117 /*FUNCTION KML_Polygon::Write {{{*/ 118 118 void KML_Polygon::Write(FILE* filout,const char* indent){ 119 119 … … 155 155 } 156 156 /*}}}*/ 157 /*FUNCTION KML_Polygon::Read {{{ 1*/157 /*FUNCTION KML_Polygon::Read {{{*/ 158 158 void KML_Polygon::Read(FILE* fid,char* kstr){ 159 159 … … 179 179 } 180 180 else if (!strncmp(kstri,"</",2)) 181 _error_("KML_Polygon::Read -- Unexpected closing tag %s.\n",kstri);181 {_error2_("KML_Polygon::Read -- Unexpected closing tag " << kstri << ".\n");} 182 182 else if (strncmp(kstri,"<",1)) 183 _error_("KML_Polygon::Read -- Unexpected field \"%s\".\n",kstri);183 {_error2_("KML_Polygon::Read -- Unexpected field \"" << kstri << "\".\n");} 184 184 185 185 else if (!strcmp(kstri,"<extrude>")) … … 207 207 } 208 208 else if (!strncmp(kstrj,"</",2)) 209 _error_("KML_Polygon::Read -- Unexpected closing tag %s.\n",kstrj);209 {_error2_("KML_Polygon::Read -- Unexpected closing tag " << kstrj << ".\n");} 210 210 else if (strncmp(kstrj,"<",1)) 211 _error_("KML_Polygon::Read -- Unexpected field \"%s\".\n",kstrj);211 {_error2_("KML_Polygon::Read -- Unexpected field \"" << kstrj << "\".\n");} 212 212 213 213 else if (!strncmp(kstrj,"<LinearRing",11)) { … … 234 234 } 235 235 else if (!strncmp(kstrj,"</",2)) 236 _error_("KML_Polygon::Read -- Unexpected closing tag %s.\n",kstrj);236 {_error2_("KML_Polygon::Read -- Unexpected closing tag " << kstrj << ".\n");} 237 237 else if (strncmp(kstrj,"<",1)) 238 _error_("KML_Polygon::Read -- Unexpected field \"%s\".\n",kstrj);238 {_error2_("KML_Polygon::Read -- Unexpected field \"" << kstrj << "\".\n");} 239 239 240 240 else if (!strncmp(kstrj,"<LinearRing",11)) { … … 266 266 } 267 267 /*}}}*/ 268 /*FUNCTION KML_Polygon::WriteExp {{{ 1*/268 /*FUNCTION KML_Polygon::WriteExp {{{*/ 269 269 void KML_Polygon::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ 270 270 -
issm/trunk/src/c/objects/KML/KML_Polygon.h
r11237 r12706 9 9 10 10 /*Headers:*/ 11 /*{{{ 1*/11 /*{{{*/ 12 12 #include "../../include/include.h" 13 13 #include "../../shared/Exceptions/exceptions.h" … … 29 29 DataSet* inner; 30 30 31 /*KML_Polygon constructors, destructors {{{ 1*/31 /*KML_Polygon constructors, destructors {{{*/ 32 32 KML_Polygon(); 33 33 ~KML_Polygon(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{*/ 36 36 void Echo(); 37 37 void DeepEcho(); … … 40 40 void Read(FILE* fid,char* kstr); 41 41 void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); 42 int Id(){_error _("Not implemented yet.");};43 int MyRank(){_error _("Not implemented yet.");};44 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};45 int MarshallSize(){_error _("Not implemented yet.");};46 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};47 int ObjectEnum(){_error _("Not implemented yet.");};48 Object* copy(){_error _("Not implemented yet.");};42 int Id(){_error2_("Not implemented yet.");}; 43 int MyRank(){_error2_("Not implemented yet.");}; 44 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 45 int MarshallSize(){_error2_("Not implemented yet.");}; 46 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 47 int ObjectEnum(){_error2_("Not implemented yet.");}; 48 Object* copy(){_error2_("Not implemented yet.");}; 49 49 /*}}}*/ 50 50 -
issm/trunk/src/c/objects/KML/KML_Style.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Style::KML_Style(){{{ 1*/23 /*FUNCTION KML_Style::KML_Style(){{{*/ 24 24 KML_Style::KML_Style(){ 25 25 … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION KML_Style::~KML_Style(){{{ 1*/35 /*FUNCTION KML_Style::~KML_Style(){{{*/ 36 36 KML_Style::~KML_Style(){ 37 37 … … 69 69 70 70 /*Other*/ 71 /*FUNCTION KML_Style::Echo {{{ 1*/71 /*FUNCTION KML_Style::Echo {{{*/ 72 72 void KML_Style::Echo(){ 73 73 74 74 bool flag=true; 75 75 76 _printf_(flag,"KML_Style:\n");76 if(flag) _pprintLine_("KML_Style:"); 77 77 KML_StyleSelector::Echo(); 78 78 79 _printf_(flag," icon: %p\n" ,icon); 80 _printf_(flag," label: %p\n" ,label); 81 _printf_(flag," line: %p\n" ,line); 82 _printf_(flag," poly: %p\n" ,poly); 83 _printf_(flag," balloon: %p\n" ,balloon); 84 _printf_(flag," list: %p\n" ,list); 85 86 return; 87 } 88 /*}}}*/ 89 90 /*FUNCTION KML_Style::DeepEcho {{{1*/ 79 if(flag) _pprintLine_(" icon: " << icon); 80 if(flag) _pprintLine_(" label: " << label); 81 if(flag) _pprintLine_(" line: " << line); 82 if(flag) _pprintLine_(" poly: " << poly); 83 if(flag) _pprintLine_(" balloon: " << balloon); 84 if(flag) _pprintLine_(" list: " << list); 85 86 return; 87 } 88 /*}}}*/ 89 /*FUNCTION KML_Style::DeepEcho {{{*/ 91 90 void KML_Style::DeepEcho(){ 92 91 … … 98 97 } 99 98 /*}}}*/ 100 101 /*FUNCTION KML_Style::DeepEcho {{{1*/ 99 /*FUNCTION KML_Style::DeepEcho {{{*/ 102 100 void KML_Style::DeepEcho(const char* indent){ 103 101 … … 105 103 bool flag=true; 106 104 107 _printf_(flag,"%sKML_Style:\n",indent);105 if(flag) _pprintLine_(indent << "KML_Style:"); 108 106 KML_StyleSelector::DeepEcho(indent); 109 107 … … 114 112 // icon->DeepEcho(indent2); 115 113 // else 116 _printf_(flag,"%s icon: %p\n" ,indent,icon);114 if(flag) _pprintLine_(indent << " icon: " << icon); 117 115 // if (label) 118 116 // label->DeepEcho(indent2); 119 117 // else 120 _printf_(flag,"%s label: %p\n" ,indent,label);118 if(flag) _pprintLine_(indent << " label: " << label); 121 119 if (line) 122 120 line->DeepEcho(indent2); 123 121 else 124 _printf_(flag,"%s line: %p\n" ,indent,line);122 if(flag) _pprintLine_(indent << " line: " << line); 125 123 if (poly) 126 124 poly->DeepEcho(indent2); 127 125 else 128 _printf_(flag,"%s poly: %p\n" ,indent,poly);126 if(flag) _pprintLine_(indent << " poly: " << poly); 129 127 // if (balloon) 130 128 // balloon->DeepEcho(indent2); 131 129 // else 132 _printf_(flag,"%s balloon: %p\n" ,indent,balloon);130 if(flag) _pprintLine_(indent << " balloon: " << balloon); 133 131 // if (list) 134 132 // list->DeepEcho(indent2); 135 133 // else 136 _printf_(flag,"%s list: %p\n" ,indent,list); 137 138 return; 139 } 140 /*}}}*/ 141 142 /*FUNCTION KML_Style::Write {{{1*/ 134 if(flag) _pprintLine_(indent << " list: " << list); 135 136 return; 137 } 138 /*}}}*/ 139 /*FUNCTION KML_Style::Write {{{*/ 143 140 void KML_Style::Write(FILE* filout,const char* indent){ 144 141 … … 174 171 } 175 172 /*}}}*/ 176 177 /*FUNCTION KML_Style::Read {{{1*/ 173 /*FUNCTION KML_Style::Read {{{*/ 178 174 void KML_Style::Read(FILE* fid,char* kstr){ 179 175 … … 197 193 } 198 194 else if (!strncmp(kstri,"</",2)) 199 _error_("KML_Style::Read -- Unexpected closing tag %s.\n",kstri);195 {_error2_("KML_Style::Read -- Unexpected closing tag " << kstri << ".\n");} 200 196 else if (strncmp(kstri,"<",1)) 201 _error_("KML_Style::Read -- Unexpected field \"%s\".\n",kstri);197 {_error2_("KML_Style::Read -- Unexpected field \"" << kstri << "\".\n");} 202 198 203 199 // else if (!strncmp(kstri,"<IconStyle",10)) { … … 246 242 } 247 243 /*}}}*/ 248 -
issm/trunk/src/c/objects/KML/KML_Style.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 28 28 void* list; 29 29 30 /*KML_Style constructors, destructors {{{ 1*/30 /*KML_Style constructors, destructors {{{*/ 31 31 KML_Style(); 32 32 ~KML_Style(); 33 33 /*}}}*/ 34 /*Object virtual functions definitions:{{{ 1*/34 /*Object virtual functions definitions:{{{*/ 35 35 void Echo(); 36 36 void DeepEcho(); … … 38 38 void Write(FILE* fid,const char* indent); 39 39 void Read(FILE* fid,char* kstr); 40 int Id(){_error _("Not implemented yet.");};41 int MyRank(){_error _("Not implemented yet.");};42 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};43 int MarshallSize(){_error _("Not implemented yet.");};44 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};45 int ObjectEnum(){_error _("Not implemented yet.");};46 Object* copy(){_error _("Not implemented yet.");};40 int Id(){_error2_("Not implemented yet.");}; 41 int MyRank(){_error2_("Not implemented yet.");}; 42 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 43 int MarshallSize(){_error2_("Not implemented yet.");}; 44 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 45 int ObjectEnum(){_error2_("Not implemented yet.");}; 46 Object* copy(){_error2_("Not implemented yet.");}; 47 47 /*}}}*/ 48 48 -
issm/trunk/src/c/objects/KML/KML_StyleSelector.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 21 21 /*Constructors/destructor/copy*/ 22 /*FUNCTION KML_StyleSelector::KML_StyleSelector(){{{ 1*/22 /*FUNCTION KML_StyleSelector::KML_StyleSelector(){{{*/ 23 23 KML_StyleSelector::KML_StyleSelector(){ 24 24 … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION KML_StyleSelector::~KML_StyleSelector(){{{ 1*/29 /*FUNCTION KML_StyleSelector::~KML_StyleSelector(){{{*/ 30 30 KML_StyleSelector::~KML_StyleSelector(){ 31 31 … … 36 36 37 37 /*Other*/ 38 /*FUNCTION KML_StyleSelector::Echo {{{ 1*/38 /*FUNCTION KML_StyleSelector::Echo {{{*/ 39 39 void KML_StyleSelector::Echo(){ 40 40 … … 45 45 /*}}}*/ 46 46 47 /*FUNCTION KML_StyleSelector::DeepEcho {{{ 1*/47 /*FUNCTION KML_StyleSelector::DeepEcho {{{*/ 48 48 void KML_StyleSelector::DeepEcho(){ 49 49 … … 56 56 /*}}}*/ 57 57 58 /*FUNCTION KML_StyleSelector::DeepEcho {{{ 1*/58 /*FUNCTION KML_StyleSelector::DeepEcho {{{*/ 59 59 void KML_StyleSelector::DeepEcho(const char* indent){ 60 60 … … 65 65 /*}}}*/ 66 66 67 /*FUNCTION KML_StyleSelector::Write {{{ 1*/67 /*FUNCTION KML_StyleSelector::Write {{{*/ 68 68 void KML_StyleSelector::Write(FILE* filout,const char* indent){ 69 69 … … 74 74 /*}}}*/ 75 75 76 /*FUNCTION KML_StyleSelector::Read {{{ 1*/76 /*FUNCTION KML_StyleSelector::Read {{{*/ 77 77 void KML_StyleSelector::Read(FILE* fid,char* kstr){ 78 78 … … 82 82 return; 83 83 else if (!strncmp(kstr,"</",2)) 84 _error_("KML_StyleSelector::Read -- Unexpected closing tag %s.\n",kstr);84 {_error2_("KML_StyleSelector::Read -- Unexpected closing tag " << kstr << ".\n");} 85 85 else if (strncmp(kstr,"<",1)) 86 _error_("KML_StyleSelector::Read -- Unexpected field \"%s\".\n",kstr);86 {_error2_("KML_StyleSelector::Read -- Unexpected field \"" << kstr << "\".\n");} 87 87 88 88 else if (!strncmp(kstr,"<",1)) -
issm/trunk/src/c/objects/KML/KML_StyleSelector.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 19 19 public: 20 20 21 /*KML_StyleSelector constructors, destructors {{{ 1*/21 /*KML_StyleSelector constructors, destructors {{{*/ 22 22 KML_StyleSelector(); 23 23 ~KML_StyleSelector(); 24 24 /*}}}*/ 25 /*Object virtual functions definitions:{{{ 1*/25 /*Object virtual functions definitions:{{{*/ 26 26 void Echo(); 27 27 void DeepEcho(); … … 29 29 void Write(FILE* fid,const char* indent); 30 30 void Read(FILE* fid,char* kstr); 31 int Id(){_error _("Not implemented yet.");};32 int MyRank(){_error _("Not implemented yet.");};33 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};34 int MarshallSize(){_error _("Not implemented yet.");};35 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};36 int ObjectEnum(){_error _("Not implemented yet.");};37 Object* copy(){_error _("Not implemented yet.");};31 int Id(){_error2_("Not implemented yet.");}; 32 int MyRank(){_error2_("Not implemented yet.");}; 33 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 34 int MarshallSize(){_error2_("Not implemented yet.");}; 35 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 36 int ObjectEnum(){_error2_("Not implemented yet.");}; 37 Object* copy(){_error2_("Not implemented yet.");}; 38 38 /*}}}*/ 39 39 -
issm/trunk/src/c/objects/KML/KML_SubStyle.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 21 21 /*Constructors/destructor/copy*/ 22 /*FUNCTION KML_SubStyle::KML_SubStyle(){{{ 1*/22 /*FUNCTION KML_SubStyle::KML_SubStyle(){{{*/ 23 23 KML_SubStyle::KML_SubStyle(){ 24 24 … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION KML_SubStyle::~KML_SubStyle(){{{ 1*/29 /*FUNCTION KML_SubStyle::~KML_SubStyle(){{{*/ 30 30 KML_SubStyle::~KML_SubStyle(){ 31 31 … … 36 36 37 37 /*Other*/ 38 /*FUNCTION KML_SubStyle::Echo {{{ 1*/38 /*FUNCTION KML_SubStyle::Echo {{{*/ 39 39 void KML_SubStyle::Echo(){ 40 40 … … 45 45 /*}}}*/ 46 46 47 /*FUNCTION KML_SubStyle::DeepEcho {{{ 1*/47 /*FUNCTION KML_SubStyle::DeepEcho {{{*/ 48 48 void KML_SubStyle::DeepEcho(){ 49 49 … … 56 56 /*}}}*/ 57 57 58 /*FUNCTION KML_SubStyle::DeepEcho {{{ 1*/58 /*FUNCTION KML_SubStyle::DeepEcho {{{*/ 59 59 void KML_SubStyle::DeepEcho(const char* indent){ 60 60 … … 65 65 /*}}}*/ 66 66 67 /*FUNCTION KML_SubStyle::Write {{{ 1*/67 /*FUNCTION KML_SubStyle::Write {{{*/ 68 68 void KML_SubStyle::Write(FILE* filout,const char* indent){ 69 69 … … 74 74 /*}}}*/ 75 75 76 /*FUNCTION KML_SubStyle::Read {{{ 1*/76 /*FUNCTION KML_SubStyle::Read {{{*/ 77 77 void KML_SubStyle::Read(FILE* fid,char* kstr){ 78 78 … … 82 82 return; 83 83 else if (!strncmp(kstr,"</",2)) 84 _error_("KML_SubStyle::Read -- Unexpected closing tag %s.\n",kstr);84 {_error2_("KML_SubStyle::Read -- Unexpected closing tag " << kstr << ".\n");} 85 85 else if (strncmp(kstr,"<",1)) 86 _error_("KML_SubStyle::Read -- Unexpected field \"%s\".\n",kstr);86 {_error2_("KML_SubStyle::Read -- Unexpected field \"" << kstr << "\".\n");} 87 87 88 88 else if (!strncmp(kstr,"<",1)) -
issm/trunk/src/c/objects/KML/KML_SubStyle.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 19 19 public: 20 20 21 /*KML_SubStyle constructors, destructors {{{ 1*/21 /*KML_SubStyle constructors, destructors {{{*/ 22 22 KML_SubStyle(); 23 23 ~KML_SubStyle(); 24 24 /*}}}*/ 25 /*Object virtual functions definitions:{{{ 1*/25 /*Object virtual functions definitions:{{{*/ 26 26 void Echo(); 27 27 void DeepEcho(); … … 29 29 void Write(FILE* fid,const char* indent); 30 30 void Read(FILE* fid,char* kstr); 31 int Id(){_error _("Not implemented yet.");};32 int MyRank(){_error _("Not implemented yet.");};33 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};34 int MarshallSize(){_error _("Not implemented yet.");};35 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};36 int ObjectEnum(){_error _("Not implemented yet.");};37 Object* copy(){_error _("Not implemented yet.");};31 int Id(){_error2_("Not implemented yet.");}; 32 int MyRank(){_error2_("Not implemented yet.");}; 33 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 34 int MarshallSize(){_error2_("Not implemented yet.");}; 35 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 36 int ObjectEnum(){_error2_("Not implemented yet.");}; 37 Object* copy(){_error2_("Not implemented yet.");}; 38 38 /*}}}*/ 39 39 -
issm/trunk/src/c/objects/KML/KML_Unknown.cpp
r11527 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION KML_Unknown::KML_Unknown(){{{ 1*/23 /*FUNCTION KML_Unknown::KML_Unknown(){{{*/ 24 24 KML_Unknown::KML_Unknown(){ 25 25 … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION KML_Unknown::~KML_Unknown(){{{ 1*/31 /*FUNCTION KML_Unknown::~KML_Unknown(){{{*/ 32 32 KML_Unknown::~KML_Unknown(){ 33 33 … … 39 39 40 40 /*Other*/ 41 /*FUNCTION KML_Unknown::Echo {{{ 1*/41 /*FUNCTION KML_Unknown::Echo {{{*/ 42 42 void KML_Unknown::Echo(){ 43 43 44 44 bool flag=true; 45 45 46 _printf_(flag,"KML_Unknown %s:\n",name);46 if(flag) _pprintLine_("KML_Unknown " << name << ":"); 47 47 KML_Object::Echo(); 48 48 49 49 if (value ) 50 _printf_(flag," value: \"%s\"\n" ,value);50 if(flag) _pprintLine_(" value: \"" << value << "\""); 51 51 else 52 _printf_(flag," value: [none]\n");52 if(flag) _pprintLine_(" value: [none]"); 53 53 54 54 return; 55 55 } 56 56 /*}}}*/ 57 /*FUNCTION KML_Unknown::DeepEcho {{{ 1*/57 /*FUNCTION KML_Unknown::DeepEcho {{{*/ 58 58 void KML_Unknown::DeepEcho(){ 59 59 … … 65 65 } 66 66 /*}}}*/ 67 /*FUNCTION KML_Unknown::DeepEcho {{{ 1*/67 /*FUNCTION KML_Unknown::DeepEcho {{{*/ 68 68 void KML_Unknown::DeepEcho(const char* indent){ 69 69 … … 73 73 bool flag=true; 74 74 75 _printf_(flag,"%sKML_Unknown %s:\n",indent,name);75 if(flag) _pprintLine_(indent << "KML_Unknown " << name << ":"); 76 76 KML_Object::DeepEcho(indent); 77 77 … … 81 81 82 82 vtoken=strtok(valuei,nl); 83 _printf_(flag,"%s value: \"%s" ,indent,vtoken);83 if(flag) _pprintString_(indent << " value: \"" << vtoken); 84 84 85 85 while (vtoken=strtok(NULL,nl)) 86 _printf_(flag,"\n%s %s" ,indent,vtoken);87 _printf_(flag,"\"\n");86 if(flag) _pprintString_("\n" << indent << " " << vtoken); 87 if(flag) _pprintLine_("\""); 88 88 89 89 xfree((void**)&valuei); 90 90 } 91 91 else 92 _printf_(flag,"%s value: [none]\n" ,indent);92 if(flag) _pprintLine_(indent << " value: [none]"); 93 93 94 94 return; 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION KML_Unknown::Write {{{ 1*/97 /*FUNCTION KML_Unknown::Write {{{*/ 98 98 void KML_Unknown::Write(FILE* filout,const char* indent){ 99 99 … … 127 127 } 128 128 /*}}}*/ 129 /*FUNCTION KML_Unknown::Read {{{ 1*/129 /*FUNCTION KML_Unknown::Read {{{*/ 130 130 void KML_Unknown::Read(FILE* fid,char* kstr){ 131 131 … … 139 139 name=KMLFileTagName(NULL, 140 140 kstr); 141 // _p rintf_(true,"KML_Unknown::Read -- opening name=%s.\n",name);141 // _pprintLine_("KML_Unknown::Read -- opening name=" << name << "."); 142 142 143 143 /* get object attributes and check for solo tag */ … … 151 151 while (kstri=KMLFileToken(fid, 152 152 &ncom,&pcom)) { 153 // _p rintf_(true,"KML_Unknown::Read -- kstri=%s.\n",kstri);153 // _pprintLine_("KML_Unknown::Read -- kstri=" << kstri << "."); 154 154 if (!strncmp(&kstri[0],"</", 2) && 155 155 !strncmp(&kstri[2],name,strlen(name))) { 156 // _p rintf_(true,"KML_Unknown::Read -- closing name=%s.\n",name);156 // _pprintLine_("KML_Unknown::Read -- closing name=" << name << "."); 157 157 xfree((void**)&kstri); 158 158 break; 159 159 } 160 160 else if (!strncmp(kstri,"</",2)) 161 _error_("KML_Unknown::Read -- Unexpected closing tag %s.\n",kstri);161 {_error2_("KML_Unknown::Read -- Unexpected closing tag " << kstri << ".\n");} 162 162 163 163 else if (strncmp(kstri,"<",1)) { -
issm/trunk/src/c/objects/KML/KML_Unknown.h
r11527 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../../include/include.h" 11 11 #include "../../shared/Exceptions/exceptions.h" … … 22 22 char* value; 23 23 24 /*KML_Unknown constructors, destructors {{{ 1*/24 /*KML_Unknown constructors, destructors {{{*/ 25 25 KML_Unknown(); 26 26 ~KML_Unknown(); 27 27 /*}}}*/ 28 /*Object virtual functions definitions:{{{ 1*/28 /*Object virtual functions definitions:{{{*/ 29 29 void Echo(); 30 30 void DeepEcho(); … … 32 32 void Write(FILE* fid,const char* indent); 33 33 void Read(FILE* fid,char* kstr); 34 int Id(){_error _("Not implemented yet.");};35 int MyRank(){_error _("Not implemented yet.");};36 void Marshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};37 int MarshallSize(){_error _("Not implemented yet.");};38 void Demarshall(char** pmarshalled_dataset){_error _("Not implemented yet.");};39 int ObjectEnum(){_error _("Not implemented yet.");};40 Object* copy(){_error _("Not implemented yet.");};34 int Id(){_error2_("Not implemented yet.");}; 35 int MyRank(){_error2_("Not implemented yet.");}; 36 void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 37 int MarshallSize(){_error2_("Not implemented yet.");}; 38 void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; 39 int ObjectEnum(){_error2_("Not implemented yet.");}; 40 Object* copy(){_error2_("Not implemented yet.");}; 41 41 /*}}}*/ 42 42 -
issm/trunk/src/c/objects/Kriging/ExponentialVariogram.cpp
r12330 r12706 17 17 18 18 /*ExponentialVariogram constructors and destructor*/ 19 /*FUNCTION ExponentialVariogram::ExponentialVariogram(){{{ 1*/19 /*FUNCTION ExponentialVariogram::ExponentialVariogram(){{{*/ 20 20 ExponentialVariogram::ExponentialVariogram(){ 21 21 this->nugget = 0.2; … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION ExponentialVariogram::ExponentialVariogram(Options* options){{{ 1*/27 /*FUNCTION ExponentialVariogram::ExponentialVariogram(Options* options){{{*/ 28 28 ExponentialVariogram::ExponentialVariogram(Options* options){ 29 29 … … 39 39 40 40 /*Checks*/ 41 if(nugget==sill) _error _("nugget and sill cannot be equal (constant semivariogram not allowed)");41 if(nugget==sill) _error2_("nugget and sill cannot be equal (constant semivariogram not allowed)"); 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION ExponentialVariogram::~ExponentialVariogram(){{{ 1*/44 /*FUNCTION ExponentialVariogram::~ExponentialVariogram(){{{*/ 45 45 ExponentialVariogram::~ExponentialVariogram(){ 46 46 return; … … 49 49 50 50 /*Object virtual functions definitions:*/ 51 /*FUNCTION ExponentialVariogram::Echo {{{ 1*/51 /*FUNCTION ExponentialVariogram::Echo {{{*/ 52 52 void ExponentialVariogram::Echo(void){ 53 printf("ExponentialVariogram\n");54 printf(" nugget: %g\n",this->nugget);55 printf(" sill : %g\n",this->sill);56 printf(" range : %g\n",this->range);53 _printLine_("ExponentialVariogram"); 54 _printLine_(" nugget: " << this->nugget); 55 _printLine_(" sill : " << this->sill); 56 _printLine_(" range : " << this->range); 57 57 } 58 58 /*}}}*/ 59 59 60 60 /*Variogram function*/ 61 /*FUNCTION ExponentialVariogram::Covariance{{{ 1*/61 /*FUNCTION ExponentialVariogram::Covariance{{{*/ 62 62 double ExponentialVariogram::Covariance(double deltax,double deltay){ 63 63 /*The covariance can be deduced from the variogram from the following … … 71 71 h=sqrt(pow(deltax,2.)+pow(deltay,2.)); 72 72 73 /*return covariance*/ 73 /*If h is too small, return sill*/ 74 if(h<0.0000001) return sill; 75 76 /*compute covariance*/ 74 77 a = 1./3.; 75 78 cova = (sill-nugget)*exp(-h/(a*range)); … … 77 80 } 78 81 /*}}}*/ 79 /*FUNCTION ExponentialVariogram::SemiVariogram{{{ 1*/82 /*FUNCTION ExponentialVariogram::SemiVariogram{{{*/ 80 83 double ExponentialVariogram::SemiVariogram(double deltax,double deltay){ 81 84 /*http://en.wikipedia.org/wiki/Variogram*/ -
issm/trunk/src/c/objects/Kriging/ExponentialVariogram.h
r12330 r12706 23 23 /*Object virtual functions definitions*/ 24 24 void Echo(); 25 void DeepEcho(){_error _("Not implemented yet");};26 int Id(){_error _("Not implemented yet");};27 int MyRank(){_error _("Not implemented yet");};28 int ObjectEnum(){_error _("Not implemented yet");};29 Object* copy(){_error _("Not implemented yet");};25 void DeepEcho(){_error2_("Not implemented yet");}; 26 int Id(){_error2_("Not implemented yet");}; 27 int MyRank(){_error2_("Not implemented yet");}; 28 int ObjectEnum(){_error2_("Not implemented yet");}; 29 Object* copy(){_error2_("Not implemented yet");}; 30 30 31 31 /*Variogram functions*/ -
issm/trunk/src/c/objects/Kriging/GaussianVariogram.cpp
r12330 r12706 17 17 18 18 /*GaussianVariogram constructors and destructor*/ 19 /*FUNCTION GaussianVariogram::GaussianVariogram(){{{ 1*/19 /*FUNCTION GaussianVariogram::GaussianVariogram(){{{*/ 20 20 GaussianVariogram::GaussianVariogram(){ 21 21 this->nugget = 0.2; … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION GaussianVariogram::GaussianVariogram(Options* options){{{ 1*/27 /*FUNCTION GaussianVariogram::GaussianVariogram(Options* options){{{*/ 28 28 GaussianVariogram::GaussianVariogram(Options* options){ 29 29 … … 39 39 40 40 /*Checks*/ 41 if(nugget==sill) _error _("nugget and sill cannot be equal (constant semivariogram not allowed)");41 if(nugget==sill) _error2_("nugget and sill cannot be equal (constant semivariogram not allowed)"); 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION GaussianVariogram::~GaussianVariogram(){{{ 1*/44 /*FUNCTION GaussianVariogram::~GaussianVariogram(){{{*/ 45 45 GaussianVariogram::~GaussianVariogram(){ 46 46 return; … … 49 49 50 50 /*Object virtual functions definitions:*/ 51 /*FUNCTION GaussianVariogram::Echo {{{ 1*/51 /*FUNCTION GaussianVariogram::Echo {{{*/ 52 52 void GaussianVariogram::Echo(void){ 53 printf("GaussianVariogram\n");54 printf(" nugget: %g\n",this->nugget);55 printf(" sill : %g\n",this->sill);56 printf(" range : %g\n",this->range);53 _printLine_("GaussianVariogram"); 54 _printLine_(" nugget: " << this->nugget); 55 _printLine_(" sill : " << this->sill); 56 _printLine_(" range : " << this->range); 57 57 } 58 58 /*}}}*/ 59 59 60 60 /*Variogram function*/ 61 /*FUNCTION GaussianVariogram::Covariance{{{ 1*/61 /*FUNCTION GaussianVariogram::Covariance{{{*/ 62 62 double GaussianVariogram::Covariance(double deltax,double deltay){ 63 63 /*The covariance can be deduced from the variogram from the following … … 71 71 h2=pow(deltax,2.)+pow(deltay,2.); 72 72 73 /*return covariance*/ 73 /*If h is too small, return sill*/ 74 if(h2<0.0000001) return sill; 75 76 /*compute covariance*/ 74 77 a = 1./3.; 75 78 cova = (sill-nugget)*exp(-h2/(a*range*range)); 76 77 if(h2<0.0000001) cova = sill;78 79 79 80 return cova; 80 81 } 81 82 /*}}}*/ 82 /*FUNCTION GaussianVariogram::SemiVariogram{{{ 1*/83 /*FUNCTION GaussianVariogram::SemiVariogram{{{*/ 83 84 double GaussianVariogram::SemiVariogram(double deltax,double deltay){ 84 85 /*http://en.wikipedia.org/wiki/Variogram*/ … … 92 93 gamma = (sill-nugget)*(1.-exp(-h2/(a*range*range))) + nugget; 93 94 94 //if(h2>1000*1000) printf("gamma = %g h= %g\n",gamma,sqrt(h2));95 printf("h = %g gamma = %g\n",sqrt(h2),gamma);95 //if(h2>1000*1000) _printLine_("gamma = " << gamma << " h= " << sqrt(h2)); 96 _printLine_("h = " << sqrt(h2) << " gamma = " << gamma); 96 97 return gamma; 97 98 } -
issm/trunk/src/c/objects/Kriging/GaussianVariogram.h
r12330 r12706 23 23 /*Object virtual functions definitions*/ 24 24 void Echo(); 25 void DeepEcho(){_error _("Not implemented yet");};26 int Id(){_error _("Not implemented yet");};27 int MyRank(){_error _("Not implemented yet");};28 int ObjectEnum(){_error _("Not implemented yet");};29 Object* copy(){_error _("Not implemented yet");};25 void DeepEcho(){_error2_("Not implemented yet");}; 26 int Id(){_error2_("Not implemented yet");}; 27 int MyRank(){_error2_("Not implemented yet");}; 28 int ObjectEnum(){_error2_("Not implemented yet");}; 29 Object* copy(){_error2_("Not implemented yet");}; 30 30 31 31 /*Variogram functions*/ -
issm/trunk/src/c/objects/Kriging/Observation.cpp
r12330 r12706 7 7 8 8 /*Observation constructors and destructor*/ 9 /*FUNCTION Observation::Observation(){{{ 1*/9 /*FUNCTION Observation::Observation(){{{*/ 10 10 Observation::Observation(){ 11 11 return; 12 12 } 13 13 /*}}}*/ 14 /*FUNCTION Observation::Observation(double x,double y,int xi,int yi,int index,double value){{{ 1*/14 /*FUNCTION Observation::Observation(double x,double y,int xi,int yi,int index,double value){{{*/ 15 15 Observation::Observation(double x_in,double y_in,int xi_in,int yi_in,int index_in,double value_in){ 16 16 … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION Observation::~Observation(){{{ 1*/27 /*FUNCTION Observation::~Observation(){{{*/ 28 28 Observation::~Observation(){ 29 29 return; … … 32 32 33 33 /*Object virtual functions definitions:*/ 34 /*FUNCTION Observation::Echo {{{ 1*/34 /*FUNCTION Observation::Echo {{{*/ 35 35 void Observation::Echo(void){ 36 36 37 37 int bit; 38 38 39 printf("Observation\n");40 printf(" index : %i\n",this->index);41 printf(" x : %g\n",this->x);42 printf(" y : %g\n",this->y);43 printf(" xi : "); printbinary(this->xi); printf("\n");44 printf(" yi : "); printbinary(this->yi); printf("\n");45 printf(" weight: %g\n",this->weight);46 printf(" value : %g\n",this->value);39 _printLine_("Observation"); 40 _printLine_(" index : " << this->index); 41 _printLine_(" x : " << this->x); 42 _printLine_(" y : " << this->y); 43 _printLine_(" xi : "); printbinary(this->xi); _printLine_(""); 44 _printLine_(" yi : "); printbinary(this->yi); _printLine_(""); 45 _printLine_(" weight: " << this->weight); 46 _printLine_(" value : " << this->value); 47 47 } 48 48 /*}}}*/ 49 49 50 50 /*Observations functions*/ 51 /*FUNCTION Observation::WriteXYObs(double* px,double* py,double* pobs){{{ 1*/51 /*FUNCTION Observation::WriteXYObs(double* px,double* py,double* pobs){{{*/ 52 52 void Observation::WriteXYObs(double* px,double* py,double* pobs){ 53 53 *px = this->x; -
issm/trunk/src/c/objects/Kriging/Observation.h
r12330 r12706 24 24 /*Object virtual functions definitions*/ 25 25 void Echo(); 26 void DeepEcho() {_error _("Not implemented yet"); };27 int Id() {_error _("Not implemented yet"); };28 int MyRank() {_error _("Not implemented yet"); };29 int ObjectEnum(){_error _("Not implemented yet"); };30 Object *copy() {_error _("Not implemented yet"); };26 void DeepEcho() {_error2_("Not implemented yet"); }; 27 int Id() {_error2_("Not implemented yet"); }; 28 int MyRank() {_error2_("Not implemented yet"); }; 29 int ObjectEnum(){_error2_("Not implemented yet"); }; 30 Object *copy() {_error2_("Not implemented yet"); }; 31 31 32 32 /*Management*/ -
issm/trunk/src/c/objects/Kriging/PowerVariogram.cpp
r12330 r12706 17 17 18 18 /*PowerVariogram constructors and destructor*/ 19 /*FUNCTION PowerVariogram::PowerVariogram(){{{ 1*/19 /*FUNCTION PowerVariogram::PowerVariogram(){{{*/ 20 20 PowerVariogram::PowerVariogram(){ 21 21 this->nugget = 0.2; … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION PowerVariogram::PowerVariogram(Options* options){{{ 1*/27 /*FUNCTION PowerVariogram::PowerVariogram(Options* options){{{*/ 28 28 PowerVariogram::PowerVariogram(Options* options){ 29 29 … … 39 39 40 40 /*Checks*/ 41 if(power<=0 || power>=2) _error _("power must be betwwen 0 and 2 (0 < power < 2)");42 if(slope<=0) _error _("slope must be positive");41 if(power<=0 || power>=2) _error2_("power must be betwwen 0 and 2 (0 < power < 2)"); 42 if(slope<=0) _error2_("slope must be positive"); 43 43 } 44 44 /*}}}*/ 45 /*FUNCTION PowerVariogram::~PowerVariogram(){{{ 1*/45 /*FUNCTION PowerVariogram::~PowerVariogram(){{{*/ 46 46 PowerVariogram::~PowerVariogram(){ 47 47 return; … … 50 50 51 51 /*Object virtual functions definitions:*/ 52 /*FUNCTION PowerVariogram::Echo {{{ 1*/52 /*FUNCTION PowerVariogram::Echo {{{*/ 53 53 void PowerVariogram::Echo(void){ 54 printf("PowerVariogram\n");55 printf(" nugget: %g\n",this->nugget);56 printf(" slope : %g\n",this->slope);57 printf(" power : %g\n",this->power);54 _printLine_("PowerVariogram"); 55 _printLine_(" nugget: " << this->nugget); 56 _printLine_(" slope : " << this->slope); 57 _printLine_(" power : " << this->power); 58 58 } 59 59 /*}}}*/ 60 60 61 61 /*Variogram function*/ 62 /*FUNCTION PowerVariogram::Covariance{{{ 1*/62 /*FUNCTION PowerVariogram::Covariance{{{*/ 63 63 double PowerVariogram::Covariance(double deltax,double deltay){ 64 64 /*The covariance can be deduced from the variogram from the following … … 78 78 } 79 79 /*}}}*/ 80 /*FUNCTION PowerVariogram::SemiVariogram{{{ 1*/80 /*FUNCTION PowerVariogram::SemiVariogram{{{*/ 81 81 double PowerVariogram::SemiVariogram(double deltax,double deltay){ 82 82 /*http://en.wikipedia.org/wiki/Variogram*/ … … 89 89 gamma = this->nugget + this->slope*pow(h,this->power); 90 90 91 //if(h>1000) printf("gamma = %g h=%g\n",gamma,h);91 //if(h>1000) _printLine_("gamma = " << gamma << " h=" << h); 92 92 return gamma; 93 93 } -
issm/trunk/src/c/objects/Kriging/PowerVariogram.h
r12330 r12706 23 23 /*Object virtual functions definitions*/ 24 24 void Echo(); 25 void DeepEcho(){_error _("Not implemented yet");};26 int Id(){_error _("Not implemented yet");};27 int MyRank(){_error _("Not implemented yet");};28 int ObjectEnum(){_error _("Not implemented yet");};29 Object* copy(){_error _("Not implemented yet");};25 void DeepEcho(){_error2_("Not implemented yet");}; 26 int Id(){_error2_("Not implemented yet");}; 27 int MyRank(){_error2_("Not implemented yet");}; 28 int ObjectEnum(){_error2_("Not implemented yet");}; 29 Object* copy(){_error2_("Not implemented yet");}; 30 30 31 31 /*Variogram functions*/ -
issm/trunk/src/c/objects/Kriging/Quadtree.cpp
r12330 r12706 1 1 #include "../objects.h" 2 /*DOCUMENTATION What is a Quadtree? {{{1 2 3 /*DOCUMENTATION What is a Quadtree? {{{ 3 4 * A Quadtree is a very simple way to group vertices according 4 5 * to their locations. A square that holds all the points of the mesh … … 46 47 * Using binaries is therefore very easy to locate a vertex in a box: 47 48 * we just need to look at the bits from the left to the right (See ::Add) 48 }}} 1*/49 /*MACROS {{{ 1*/49 }}}*/ 50 /*MACROS {{{*/ 50 51 /* 51 52 * … … 80 81 81 82 /*Constructors/Destructors*/ 82 /*FUNCTION Quadtree::Quadtree(){{{ 1*/83 /*FUNCTION Quadtree::Quadtree(){{{*/ 83 84 Quadtree::Quadtree(){ 84 _error _("Constructor not supported");85 _error2_("Constructor not supported"); 85 86 86 87 } 87 /*}}} 1*/88 /*FUNCTION Quadtree::Quadtree(double xmin,double xmax,double ymin,double ymax,int maxdepth){{{ 1*/88 /*}}}*/ 89 /*FUNCTION Quadtree::Quadtree(double xmin,double xmax,double ymin,double ymax,int maxdepth){{{*/ 89 90 Quadtree::Quadtree(double xmin,double xmax,double ymin,double ymax,int maxdepth){ 90 91 … … 104 105 this->root=NewQuadtreeBox(xmin+length/2,ymin+length/2,length); 105 106 } 106 /*}}} 1*/107 /*FUNCTION Quadtree::~Quadtree(){{{ 1*/107 /*}}}*/ 108 /*FUNCTION Quadtree::~Quadtree(){{{*/ 108 109 Quadtree::~Quadtree(){ 109 110 … … 112 113 113 114 } 114 /*}}} 1*/115 /*}}}*/ 115 116 116 117 /*Methods*/ 117 /*FUNCTION Quadtree::Add{{{ 1*/118 /*FUNCTION Quadtree::Add{{{*/ 118 119 void Quadtree::Add(Observation* observation){ 119 120 … … 198 199 199 200 }/*}}}*/ 200 /*FUNCTION Quadtree::AddAndAverage{{{ 1*/201 /*FUNCTION Quadtree::AddAndAverage{{{*/ 201 202 void Quadtree::AddAndAverage(double x,double y,double value){ 202 203 … … 247 248 } 248 249 else{ 249 _error _("Box is not full");250 } 251 }/*}}}*/ 252 /*FUNCTION Quadtree::ClosestObs{{{ 1*/250 _error2_("Box is not full"); 251 } 252 }/*}}}*/ 253 /*FUNCTION Quadtree::ClosestObs{{{*/ 253 254 void Quadtree::ClosestObs(int *pindex,double x,double y){ 254 255 … … 293 294 *pindex=index; 294 295 }/*}}}*/ 295 /*FUNCTION Quadtree::Echo{{{ 1*/296 /*FUNCTION Quadtree::Echo{{{*/ 296 297 void Quadtree::Echo(void){ 297 298 298 printf("Quadtree:\n");299 printf(" MaxDepth = %i\n",this->MaxDepth);300 printf(" NbQuadtreeBox = %i\n",this->NbQuadtreeBox);301 printf(" NbObs = %i\n",this->NbObs);302 printf(" root = %p\n",this->root);303 304 }/*}}}*/ 305 /*FUNCTION Quadtree::DeepEcho{{{ 1*/299 _printLine_("Quadtree:"); 300 _printLine_(" MaxDepth = " << this->MaxDepth); 301 _printLine_(" NbQuadtreeBox = " << this->NbQuadtreeBox); 302 _printLine_(" NbObs = " << this->NbObs); 303 _printLine_(" root = " << this->root); 304 305 }/*}}}*/ 306 /*FUNCTION Quadtree::DeepEcho{{{*/ 306 307 void Quadtree::DeepEcho(void){ 307 308 308 printf("Quadtree:\n");309 printf(" MaxDepth = %i\n",this->MaxDepth);310 printf(" NbQuadtreeBox = %i\n",this->NbQuadtreeBox);311 printf(" NbObs = %i\n",this->NbObs);312 printf(" root = %p\n",this->root);309 _printLine_("Quadtree:"); 310 _printLine_(" MaxDepth = " << this->MaxDepth); 311 _printLine_(" NbQuadtreeBox = " << this->NbQuadtreeBox); 312 _printLine_(" NbObs = " << this->NbObs); 313 _printLine_(" root = " << this->root); 313 314 boxcontainer->Echo(); 314 315 315 316 }/*}}}*/ 316 /*FUNCTION Quadtree::IntergerCoordinates{{{ 1*/317 /*FUNCTION Quadtree::IntergerCoordinates{{{*/ 317 318 void Quadtree::IntergerCoordinates(int *xi,int *yi,double x,double y){ 318 319 … … 338 339 *yi=int(coefficient*(y - ymin)); 339 340 }/*}}}*/ 340 /*FUNCTION Quadtree::NewQuadtreeBox(double xcenter,double ycenter,double length){{{ 1*/341 /*FUNCTION Quadtree::NewQuadtreeBox(double xcenter,double ycenter,double length){{{*/ 341 342 Quadtree::QuadtreeBox* Quadtree::NewQuadtreeBox(double xcenter,double ycenter,double length){ 342 343 … … 362 363 return newbox; 363 364 }/*}}}*/ 364 /*FUNCTION Quadtree::NewQuadtreeBox(QuadtreeBox* master,int index) {{{ 1*/365 /*FUNCTION Quadtree::NewQuadtreeBox(QuadtreeBox* master,int index) {{{*/ 365 366 Quadtree::QuadtreeBox* Quadtree::NewQuadtreeBox(QuadtreeBox* master,int index){ 366 367 … … 396 397 break; 397 398 default: 398 _error _("Case %i not supported",index);399 _error2_("Case " << index << " not supported"); 399 400 } 400 401 newbox->length=master->length/2; … … 407 408 return newbox; 408 409 }/*}}}*/ 409 /*FUNCTION Quadtree::QuadtreeDepth{{{ 1*/410 /*FUNCTION Quadtree::QuadtreeDepth{{{*/ 410 411 void Quadtree::QuadtreeDepth(int* A,int xi,int yi){ 411 412 … … 435 436 *A=level; 436 437 }/*}}}*/ 437 /*FUNCTION Quadtree::QuadtreeDepth2{{{ 1*/438 /*FUNCTION Quadtree::QuadtreeDepth2{{{*/ 438 439 void Quadtree::QuadtreeDepth2(int* A,int xi,int yi){ 439 440 … … 488 489 *A=level; 489 490 }/*}}}*/ 490 /*FUNCTION Quadtree::RangeSearch{{{ 1*/491 /*FUNCTION Quadtree::RangeSearch{{{*/ 491 492 void Quadtree::RangeSearch(int **pindices,int *pnobs,double x,double y,double range){ 492 493 … … 496 497 497 498 /*Allocate indices (maximum by default*/ 498 if(this->NbObs) indices = (int*)xmalloc(this->NbObs*sizeof(int));499 if(this->NbObs) indices = xNew<int>(this->NbObs); 499 500 nobs = 0; 500 501 … … 508 509 509 510 /*QuadtreeBox methos*/ 510 /*FUNCTION QuadtreeBox::Echo{{{ 1*/511 /*FUNCTION QuadtreeBox::Echo{{{*/ 511 512 void Quadtree::QuadtreeBox::Echo(void){ 512 513 513 printf("QuadtreeBox:\n");514 printf(" nbitems = %i\n",this->nbitems);515 printf(" xcenter = %g\n",this->xcenter);516 printf(" ycenter = %g\n",this->ycenter);517 printf(" length = %g\n",this->length);518 519 }/*}}}*/ 520 /*FUNCTION QuadtreeBox::IsWithinRange{{{ 1*/514 _printLine_("QuadtreeBox:"); 515 _printLine_(" nbitems = " << this->nbitems); 516 _printLine_(" xcenter = " << this->xcenter); 517 _printLine_(" ycenter = " << this->ycenter); 518 _printLine_(" length = " << this->length); 519 520 }/*}}}*/ 521 /*FUNCTION QuadtreeBox::IsWithinRange{{{*/ 521 522 int Quadtree::QuadtreeBox::IsWithinRange(double x,double y,double range){ 522 523 … … 537 538 538 539 }/*}}}*/ 539 /*FUNCTION QuadtreeBox::RangeSearch{{{ 1*/540 /*FUNCTION QuadtreeBox::RangeSearch{{{*/ 540 541 void Quadtree::QuadtreeBox::RangeSearch(int* indices,int *pnobs,double x,double y,double range){ 541 542 … … 573 574 break; 574 575 default: 575 _error _("Case %i not supported",this->IsWithinRange(x,y,range));576 _error2_("Case " << this->IsWithinRange(x,y,range) << " not supported"); 576 577 } 577 578 … … 579 580 *pnobs=nobs; 580 581 }/*}}}*/ 581 /*FUNCTION QuadtreeBox::WriteObservations{{{ 1*/582 /*FUNCTION QuadtreeBox::WriteObservations{{{*/ 582 583 void Quadtree::QuadtreeBox::WriteObservations(int* indices,int *pnobs){ 583 584 -
issm/trunk/src/c/objects/Kriging/Quadtree.h
r12330 r12706 27 27 /*Object functions (Needed because the Quadtree uses a Container*/ 28 28 void Echo(); 29 void DeepEcho() {_error _("not implemented yet"); };30 int Id() {_error _("not implemented yet"); };31 int MyRank() {_error _("not implemented yet"); };32 int ObjectEnum(){_error _("not implemented yet"); };33 Object *copy() {_error _("not implemented yet"); };29 void DeepEcho() {_error2_("not implemented yet"); }; 30 int Id() {_error2_("not implemented yet"); }; 31 int MyRank() {_error2_("not implemented yet"); }; 32 int ObjectEnum(){_error2_("not implemented yet"); }; 33 Object *copy() {_error2_("not implemented yet"); }; 34 34 35 35 /*Methods*/ … … 46 46 int MaxDepth; // maximum number of subdivision 47 47 QuadtreeBox *root; // main box 48 longNbQuadtreeBox; // total number of boxes49 longNbObs; // number of points48 int NbQuadtreeBox; // total number of boxes 49 int NbObs; // number of points 50 50 51 51 Quadtree(); -
issm/trunk/src/c/objects/Kriging/SphericalVariogram.cpp
r12330 r12706 17 17 18 18 /*SphericalVariogram constructors and destructor*/ 19 /*FUNCTION SphericalVariogram::SphericalVariogram(){{{ 1*/19 /*FUNCTION SphericalVariogram::SphericalVariogram(){{{*/ 20 20 SphericalVariogram::SphericalVariogram(){ 21 21 this->nugget = 0.2; … … 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION SphericalVariogram::SphericalVariogram(Options* options){{{ 1*/27 /*FUNCTION SphericalVariogram::SphericalVariogram(Options* options){{{*/ 28 28 SphericalVariogram::SphericalVariogram(Options* options){ 29 29 … … 39 39 40 40 /*Checks*/ 41 if(nugget==sill) _error _("nugget and sill cannot be equal (constant semivariogram not allowed)");41 if(nugget==sill) _error2_("nugget and sill cannot be equal (constant semivariogram not allowed)"); 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION SphericalVariogram::~SphericalVariogram(){{{ 1*/44 /*FUNCTION SphericalVariogram::~SphericalVariogram(){{{*/ 45 45 SphericalVariogram::~SphericalVariogram(){ 46 46 return; … … 49 49 50 50 /*Object virtual functions definitions:*/ 51 /*FUNCTION SphericalVariogram::Echo {{{ 1*/51 /*FUNCTION SphericalVariogram::Echo {{{*/ 52 52 void SphericalVariogram::Echo(void){ 53 printf("SphericalVariogram\n");54 printf(" nugget: %g\n",this->nugget);55 printf(" sill : %g\n",this->sill);56 printf(" range : %g\n",this->range);53 _printLine_("SphericalVariogram"); 54 _printLine_(" nugget: " << this->nugget); 55 _printLine_(" sill : " << this->sill); 56 _printLine_(" range : " << this->range); 57 57 } 58 58 /*}}}*/ 59 59 60 60 /*Variogram function*/ 61 /*FUNCTION SphericalVariogram::Covariance{{{ 1*/61 /*FUNCTION SphericalVariogram::Covariance{{{*/ 62 62 double SphericalVariogram::Covariance(double deltax,double deltay){ 63 63 /*The covariance can be deduced from the variogram from the following … … 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION SphericalVariogram::SemiVariogram{{{ 1*/82 /*FUNCTION SphericalVariogram::SemiVariogram{{{*/ 83 83 double SphericalVariogram::SemiVariogram(double deltax,double deltay){ 84 84 /*http://en.wikipedia.org/wiki/Variogram*/ -
issm/trunk/src/c/objects/Kriging/SphericalVariogram.h
r12330 r12706 23 23 /*Object virtual functions definitions*/ 24 24 void Echo(); 25 void DeepEcho(){_error _("Not implemented yet");};26 int Id(){_error _("Not implemented yet");};27 int MyRank(){_error _("Not implemented yet");};28 int ObjectEnum(){_error _("Not implemented yet");};29 Object* copy(){_error _("Not implemented yet");};25 void DeepEcho(){_error2_("Not implemented yet");}; 26 int Id(){_error2_("Not implemented yet");}; 27 int MyRank(){_error2_("Not implemented yet");}; 28 int ObjectEnum(){_error2_("Not implemented yet");}; 29 Object* copy(){_error2_("Not implemented yet");}; 30 30 31 31 /*Variogram functions*/ -
issm/trunk/src/c/objects/Loads/Friction.cpp
r11237 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructors*/ 23 /*FUNCTION Friction::Friction() {{{ 1*/23 /*FUNCTION Friction::Friction() {{{*/ 24 24 Friction::Friction(){ 25 25 this->element_type=NULL; … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION Friction::Friction(const char* element_type, Inputs* inputs,Matpar* matpar,int analysis_type){{{ 1*/30 /*FUNCTION Friction::Friction(const char* element_type, Inputs* inputs,Matpar* matpar,int analysis_type){{{*/ 31 31 Friction::Friction(const char* element_type_in,Inputs* inputs_in,Matpar* matpar_in, int in_analysis_type){ 32 32 33 33 this->analysis_type=in_analysis_type; 34 34 this->inputs=inputs_in; 35 this->element_type= (char*)xmalloc((strlen(element_type_in)+1)*sizeof(char));36 memcpy(this->element_type,element_type_in,(strlen(element_type_in)+1)*sizeof(char));35 this->element_type=xNew<char>(strlen(element_type_in)+1); 36 xMemCpy<char>(this->element_type,element_type_in,(strlen(element_type_in)+1)); 37 37 38 38 this->matpar=matpar_in; 39 39 } 40 40 /*}}}*/ 41 /*FUNCTION Friction::~Friction() {{{ 1*/41 /*FUNCTION Friction::~Friction() {{{*/ 42 42 Friction::~Friction(){ 43 x free((void**)&element_type);43 xDelete<char>(element_type); 44 44 } 45 45 /*}}}*/ 46 46 47 47 /*methods: */ 48 /*FUNCTION Friction::Echo {{{ 1*/48 /*FUNCTION Friction::Echo {{{*/ 49 49 void Friction::Echo(void){ 50 printf("Friction:\n");51 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));52 printf(" element_type: %s\n",this->element_type);50 _printLine_("Friction:"); 51 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 52 _printLine_(" element_type: " << this->element_type); 53 53 inputs->Echo(); 54 54 matpar->Echo(); 55 55 } 56 56 /*}}}*/ 57 /*FUNCTION Friction::GetAlpha2( double* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum){{{1*/58 void Friction::GetAlpha2( double* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum){57 /*FUNCTION Friction::GetAlpha2(IssmDouble* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum){{{*/ 58 void Friction::GetAlpha2(IssmDouble* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum){ 59 59 60 60 /*This routine calculates the basal friction coefficient … … 62 62 63 63 /*diverse: */ 64 double r,s;65 double drag_p, drag_q;66 double gravity,rho_ice,rho_water;67 double Neff;68 double thickness,bed;69 double vx,vy,vz,vmag;70 double drag_coefficient;71 double alpha2;64 IssmDouble r,s; 65 IssmDouble drag_p, drag_q; 66 IssmDouble gravity,rho_ice,rho_water; 67 IssmDouble Neff; 68 IssmDouble thickness,bed; 69 IssmDouble vx,vy,vz,vmag; 70 IssmDouble drag_coefficient; 71 IssmDouble alpha2; 72 72 73 73 /*Recover parameters: */ … … 107 107 vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 108 108 } 109 else _error _("element_type %s not supported yet",element_type);109 else _error2_("element_type "<< element_type << " not supported yet"); 110 110 111 111 /*Checks that s-1>0 if v=0*/ 112 if(vmag==0 && (s-1)<0) _error_("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);112 if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf"); 113 113 114 114 alpha2=pow(drag_coefficient,2)*pow(Neff,r)*pow(vmag,(s-1)); 115 _assert_(! isnan(alpha2));115 _assert_(!xIsNan<IssmDouble>(alpha2)); 116 116 117 117 /*Assign output pointers:*/ … … 119 119 } 120 120 /*}}}*/ 121 /*FUNCTION Friction::GetAlpha2( double* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){{{1*/122 void Friction::GetAlpha2( double* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){121 /*FUNCTION Friction::GetAlpha2(IssmDouble* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){{{*/ 122 void Friction::GetAlpha2(IssmDouble* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){ 123 123 124 124 /*This routine calculates the basal friction coefficient … … 126 126 127 127 /*diverse: */ 128 double r,s;129 double drag_p, drag_q;130 double gravity,rho_ice,rho_water;131 double Neff;132 double thickness,bed;133 double vx,vy,vz,vmag;134 double drag_coefficient;135 double alpha2;128 IssmDouble r,s; 129 IssmDouble drag_p, drag_q; 130 IssmDouble gravity,rho_ice,rho_water; 131 IssmDouble Neff; 132 IssmDouble thickness,bed; 133 IssmDouble vx,vy,vz,vmag; 134 IssmDouble drag_coefficient; 135 IssmDouble alpha2; 136 136 137 137 /*Recover parameters: */ … … 171 171 vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 172 172 } 173 else _error _("element_type %s not supported yet",element_type);173 else _error2_("element_type "<< element_type << " not supported yet"); 174 174 175 175 /*Checks that s-1>0 if v=0*/ 176 if(vmag==0 && (s-1)<0) _error _("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);176 if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf"); 177 177 178 178 alpha2=pow(drag_coefficient,2)*pow(Neff,r)*pow(vmag,(s-1)); 179 _assert_(! isnan(alpha2));179 _assert_(!xIsNan<IssmDouble>(alpha2)); 180 180 181 181 /*Assign output pointers:*/ … … 183 183 } 184 184 /*}}}*/ 185 /*FUNCTION Friction::GetAlphaComplement( double* palpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum) {{{1*/186 void Friction::GetAlphaComplement( double* palpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum){185 /*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum) {{{*/ 186 void Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum){ 187 187 188 188 /* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. … … 192 192 /*diverse: */ 193 193 int i; 194 double r,s;195 double vx,vy,vz,vmag;196 double drag_p,drag_q;197 double Neff;198 double drag_coefficient;199 double bed,thickness;200 double gravity,rho_ice,rho_water;201 double alpha_complement;194 IssmDouble r,s; 195 IssmDouble vx,vy,vz,vmag; 196 IssmDouble drag_p,drag_q; 197 IssmDouble Neff; 198 IssmDouble drag_coefficient; 199 IssmDouble bed,thickness; 200 IssmDouble gravity,rho_ice,rho_water; 201 IssmDouble alpha_complement; 202 202 203 203 /*Recover parameters: */ … … 238 238 vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 239 239 } 240 else _error _("element_type %s not supported yet",element_type);240 else _error2_("element_type "<< element_type << " not supported yet"); 241 241 242 242 /*Checks that s-1>0 if v=0*/ 243 if(vmag==0 && (s-1)<0) _error _("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);244 245 alpha_complement=pow(Neff,r)*pow(vmag,(s-1)); _assert_(! isnan(alpha_complement));243 if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf"); 244 245 alpha_complement=pow(Neff,r)*pow(vmag,(s-1)); _assert_(!xIsNan<IssmDouble>(alpha_complement)); 246 246 247 247 /*Assign output pointers:*/ … … 249 249 } 250 250 /*}}}*/ 251 /*FUNCTION Friction::GetAlphaComplement( double* palpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum) {{{1*/252 void Friction::GetAlphaComplement( double* palpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){251 /*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum) {{{*/ 252 void Friction::GetAlphaComplement(IssmDouble* palpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum){ 253 253 254 254 /* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. … … 258 258 /*diverse: */ 259 259 int i; 260 double r,s;261 double vx,vy,vz,vmag;262 double drag_p,drag_q;263 double Neff;264 double drag_coefficient;265 double bed,thickness;266 double gravity,rho_ice,rho_water;267 double alpha_complement;260 IssmDouble r,s; 261 IssmDouble vx,vy,vz,vmag; 262 IssmDouble drag_p,drag_q; 263 IssmDouble Neff; 264 IssmDouble drag_coefficient; 265 IssmDouble bed,thickness; 266 IssmDouble gravity,rho_ice,rho_water; 267 IssmDouble alpha_complement; 268 268 269 269 /*Recover parameters: */ … … 304 304 vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2)); 305 305 } 306 else _error _("element_type %s not supported yet",element_type);306 else _error2_("element_type "<< element_type << " not supported yet"); 307 307 308 308 /*Checks that s-1>0 if v=0*/ 309 if(vmag==0 && (s-1)<0) _error _("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);310 311 alpha_complement=pow(Neff,r)*pow(vmag,(s-1)); _assert_(! isnan(alpha_complement));309 if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf"); 310 311 alpha_complement=pow(Neff,r)*pow(vmag,(s-1)); _assert_(!xIsNan<IssmDouble>(alpha_complement)); 312 312 313 313 /*Assign output pointers:*/ … … 315 315 } 316 316 /*}}}*/ 317 /*FUNCTION Friction::GetInputValue{{{ 1*/318 void Friction::GetInputValue( double* pvalue,GaussTria* gauss,int enum_type){317 /*FUNCTION Friction::GetInputValue{{{*/ 318 void Friction::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int enum_type){ 319 319 320 320 Input* input=inputs->GetInput(enum_type); 321 if(!input) _error _("input %s not found",EnumToStringx(enum_type));321 if(!input) _error2_("input " << EnumToStringx(enum_type) << " not found"); 322 322 input->GetInputValue(pvalue,gauss); 323 323 324 324 } 325 325 /*}}}*/ 326 /*FUNCTION Friction::GetInputValue{{{ 1*/327 void Friction::GetInputValue( double* pvalue,GaussPenta* gauss,int enum_type){326 /*FUNCTION Friction::GetInputValue{{{*/ 327 void Friction::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int enum_type){ 328 328 329 329 Input* input=inputs->GetInput(enum_type); 330 if(!input) _error _("input %s not found",EnumToStringx(enum_type));330 if(!input) _error2_("input " << EnumToStringx(enum_type) << " not found"); 331 331 input->GetInputValue(pvalue,gauss); 332 332 -
issm/trunk/src/c/objects/Loads/Friction.h
r11237 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 class Inputs; 11 11 class Matpar; … … 27 27 28 28 void Echo(void); 29 void GetAlpha2( double* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum);30 void GetAlpha2( double* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum);31 void GetAlphaComplement( double* alpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum);32 void GetAlphaComplement( double* alpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum);33 void GetInputValue( double* pvalue,GaussTria* gauss,int enum_type);34 void GetInputValue( double* pvalue,GaussPenta* gauss,int enum_type);29 void GetAlpha2(IssmDouble* palpha2, GaussTria* gauss,int vxenum,int vyenum,int vzenum); 30 void GetAlpha2(IssmDouble* palpha2, GaussPenta* gauss,int vxenum,int vyenum,int vzenum); 31 void GetAlphaComplement(IssmDouble* alpha_complement, GaussTria* gauss,int vxenum,int vyenum,int vzenum); 32 void GetAlphaComplement(IssmDouble* alpha_complement, GaussPenta* gauss,int vxenum,int vyenum,int vzenum); 33 void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int enum_type); 34 void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int enum_type); 35 35 36 36 }; -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 24 24 25 25 /*Icefront constructors and destructor*/ 26 /*FUNCTION Icefront::Icefront() {{{ 1*/26 /*FUNCTION Icefront::Icefront() {{{*/ 27 27 Icefront::Icefront(){ 28 28 … … 38 38 } 39 39 /*}}}*/ 40 /*FUNCTION Icefront::Icefront(int id, int i, IoModel* iomodel,int analysis_type) {{{ 1*/40 /*FUNCTION Icefront::Icefront(int id, int i, IoModel* iomodel,int analysis_type) {{{*/ 41 41 Icefront::Icefront(int icefront_id,int i, IoModel* iomodel,int in_icefront_type, int in_analysis_type){ 42 42 … … 65 65 } 66 66 _assert_(iomodel->Data(DiagnosticIcefrontEnum)); 67 element= (int)(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill)67 element=reCast<int,IssmDouble>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill) 68 68 69 69 /*Build ids for hook constructors: */ 70 icefront_eid= (int) *(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+segment_width-2); //matlab indexing70 icefront_eid=reCast<int,IssmDouble>( *(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+segment_width-2)); //matlab indexing 71 71 icefront_mparid=numberofelements+1; //matlab indexing 72 72 73 73 if (in_icefront_type==MacAyeal2dIceFrontEnum || in_icefront_type==MacAyeal3dIceFrontEnum){ 74 icefront_node_ids[0]=iomodel->nodecounter+ (int)*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0);75 icefront_node_ids[1]=iomodel->nodecounter+ (int)*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1);74 icefront_node_ids[0]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0)); 75 icefront_node_ids[1]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1)); 76 76 } 77 77 else if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum){ 78 icefront_node_ids[0]=iomodel->nodecounter+ (int)*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0);79 icefront_node_ids[1]=iomodel->nodecounter+ (int)*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1);80 icefront_node_ids[2]=iomodel->nodecounter+ (int)*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+2);81 icefront_node_ids[3]=iomodel->nodecounter+ (int)*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+3);82 } 83 else _error _("in_icefront_type %s not supported yet!",EnumToStringx(in_icefront_type));78 icefront_node_ids[0]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+0)); 79 icefront_node_ids[1]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+1)); 80 icefront_node_ids[2]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+2)); 81 icefront_node_ids[3]=iomodel->nodecounter+reCast<int>(*(iomodel->Data(DiagnosticIcefrontEnum)+segment_width*i+3)); 82 } 83 else _error2_("in_icefront_type " << EnumToStringx(in_icefront_type) << " not supported yet!"); 84 84 85 85 if (in_icefront_type==PattynIceFrontEnum || in_icefront_type==StokesIceFrontEnum) … … 89 89 90 90 /*Fill*/ 91 icefront_fill= (int)iomodel->Data(DiagnosticIcefrontEnum)[segment_width*i+segment_width-1];91 icefront_fill=reCast<int>(iomodel->Data(DiagnosticIcefrontEnum)[segment_width*i+segment_width-1]); 92 92 93 93 /*Ok, we have everything to build the object: */ … … 114 114 115 115 /*}}}*/ 116 /*FUNCTION Icefront::~Icefront() {{{ 1*/116 /*FUNCTION Icefront::~Icefront() {{{*/ 117 117 Icefront::~Icefront(){ 118 118 delete inputs; … … 125 125 126 126 /*Object virtual functions definitions:*/ 127 /*FUNCTION Icefront::Echo {{{ 1*/127 /*FUNCTION Icefront::Echo {{{*/ 128 128 void Icefront::Echo(void){ 129 printf("Icefront:\n");130 printf(" id: %i\n",id);131 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));129 _printLine_("Icefront:"); 130 _printLine_(" id: " << id); 131 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 132 132 hnodes->Echo(); 133 133 helement->Echo(); 134 134 hmatpar->Echo(); 135 printf(" parameters: %p\n",parameters);135 _printLine_(" parameters: " << parameters); 136 136 if(parameters)parameters->Echo(); 137 printf(" inputs: %p\n",inputs);137 _printLine_(" inputs: " << inputs); 138 138 if(inputs)inputs->Echo(); 139 139 } 140 140 /*}}}*/ 141 /*FUNCTION Icefront::DeepEcho{{{ 1*/141 /*FUNCTION Icefront::DeepEcho{{{*/ 142 142 void Icefront::DeepEcho(void){ 143 143 144 printf("Icefront:\n");145 printf(" id: %i\n",id);146 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));144 _printLine_("Icefront:"); 145 _printLine_(" id: " << id); 146 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 147 147 hnodes->DeepEcho(); 148 148 helement->DeepEcho(); 149 149 hmatpar->DeepEcho(); 150 printf(" parameters: %p\n",parameters);150 _printLine_(" parameters: " << parameters); 151 151 if(parameters)parameters->DeepEcho(); 152 printf(" inputs: %p\n",inputs);152 _printLine_(" inputs: " << inputs); 153 153 if(inputs)inputs->DeepEcho(); 154 154 } 155 155 /*}}}*/ 156 /*FUNCTION Icefront::Id {{{ 1*/156 /*FUNCTION Icefront::Id {{{*/ 157 157 int Icefront::Id(void){ return id; } 158 158 /*}}}*/ 159 /*FUNCTION Icefront::MyRank {{{ 1*/159 /*FUNCTION Icefront::MyRank {{{*/ 160 160 int Icefront::MyRank(void){ 161 161 extern int my_rank; … … 163 163 } 164 164 /*}}}*/ 165 /*FUNCTION Icefront::ObjectEnum{{{ 1*/165 /*FUNCTION Icefront::ObjectEnum{{{*/ 166 166 int Icefront::ObjectEnum(void){ 167 167 … … 170 170 } 171 171 /*}}}*/ 172 /*FUNCTION Icefront::copy {{{ 1*/172 /*FUNCTION Icefront::copy {{{*/ 173 173 Object* Icefront::copy() { 174 174 … … 205 205 206 206 /*Load virtual functions definitions:*/ 207 /*FUNCTION Icefront::Configure {{{ 1*/207 /*FUNCTION Icefront::Configure {{{*/ 208 208 void Icefront::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 209 209 … … 223 223 } 224 224 /*}}}*/ 225 /*FUNCTION Icefront::SetCurrentConfiguration {{{ 1*/225 /*FUNCTION Icefront::SetCurrentConfiguration {{{*/ 226 226 void Icefront::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 227 227 } 228 228 /*}}}*/ 229 /*FUNCTION Icefront::CreateKMatrix {{{ 1*/229 /*FUNCTION Icefront::CreateKMatrix {{{*/ 230 230 void Icefront::CreateKMatrix(Matrix* Kff, Matrix* Kfs){ 231 231 … … 235 235 } 236 236 /*}}}*/ 237 /*FUNCTION Icefront::CreatePVector {{{ 1*/237 /*FUNCTION Icefront::CreatePVector {{{*/ 238 238 void Icefront::CreatePVector(Vector* pf){ 239 239 240 240 /*Checks in debugging mode*/ 241 /*{{{ 2*/241 /*{{{*/ 242 242 _assert_(nodes); 243 243 _assert_(element); … … 263 263 #endif 264 264 default: 265 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));265 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 266 266 } 267 267 … … 273 273 } 274 274 /*}}}*/ 275 /*FUNCTION Icefront::CreateJacobianMatrix{{{ 1*/275 /*FUNCTION Icefront::CreateJacobianMatrix{{{*/ 276 276 void Icefront::CreateJacobianMatrix(Matrix* Jff){ 277 277 this->CreateKMatrix(Jff,NULL); 278 278 } 279 /*}}} 1*/280 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{ 1*/281 void Icefront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){279 /*}}}*/ 280 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{*/ 281 void Icefront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, IssmDouble kmax){ 282 282 /*do nothing: */ 283 283 return; 284 284 } 285 285 /*}}}*/ 286 /*FUNCTION Icefront::PenaltyCreatePVector{{{ 1*/287 void Icefront::PenaltyCreatePVector(Vector* pf, double kmax){286 /*FUNCTION Icefront::PenaltyCreatePVector{{{*/ 287 void Icefront::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 288 288 /*do nothing: */ 289 289 return; 290 290 } 291 291 /*}}}*/ 292 /*FUNCTION Icefront::PenaltyCreateJacobianMatrix{{{ 1*/293 void Icefront::PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){292 /*FUNCTION Icefront::PenaltyCreateJacobianMatrix{{{*/ 293 void Icefront::PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){ 294 294 this->PenaltyCreateKMatrix(Jff,NULL,kmax); 295 295 } 296 /*}}} 1*/297 /*FUNCTION Icefront::InAnalysis{{{ 1*/296 /*}}}*/ 297 /*FUNCTION Icefront::InAnalysis{{{*/ 298 298 bool Icefront::InAnalysis(int in_analysis_type){ 299 299 if (in_analysis_type==this->analysis_type)return true; … … 303 303 304 304 /*Update virtual functions definitions:*/ 305 /*FUNCTION Icefront::InputUpdateFromVector( double* vector, int name, int type) {{{1*/306 void Icefront::InputUpdateFromVector( double* vector, int name, int type){307 /*Nothing updated yet*/ 308 } 309 /*}}}*/ 310 /*FUNCTION Icefront::InputUpdateFromVector(int* vector, int name, int type) {{{ 1*/305 /*FUNCTION Icefront::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 306 void Icefront::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 307 /*Nothing updated yet*/ 308 } 309 /*}}}*/ 310 /*FUNCTION Icefront::InputUpdateFromVector(int* vector, int name, int type) {{{*/ 311 311 void Icefront::InputUpdateFromVector(int* vector, int name, int type){ 312 312 /*Nothing updated yet*/ 313 313 } 314 314 /*}}}*/ 315 /*FUNCTION Icefront::InputUpdateFromVector(bool* vector, int name, int type) {{{ 1*/315 /*FUNCTION Icefront::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ 316 316 void Icefront::InputUpdateFromVector(bool* vector, int name, int type){ 317 317 /*Nothing updated yet*/ 318 318 } 319 319 /*}}}*/ 320 /*FUNCTION Icefront::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type) {{{1*/321 void Icefront::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){322 /*Nothing updated yet*/ 323 } 324 /*}}}*/ 325 /*FUNCTION Icefront::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{1*/326 void Icefront::InputUpdateFromVectorDakota( double* vector, int name, int type){327 /*Nothing updated yet*/ 328 } 329 /*}}}*/ 330 /*FUNCTION Icefront::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{ 1*/320 /*FUNCTION Icefront::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type) {{{*/ 321 void Icefront::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 322 /*Nothing updated yet*/ 323 } 324 /*}}}*/ 325 /*FUNCTION Icefront::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 326 void Icefront::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 327 /*Nothing updated yet*/ 328 } 329 /*}}}*/ 330 /*FUNCTION Icefront::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ 331 331 void Icefront::InputUpdateFromVectorDakota(int* vector, int name, int type){ 332 332 /*Nothing updated yet*/ 333 333 } 334 334 /*}}}*/ 335 /*FUNCTION Icefront::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{ 1*/335 /*FUNCTION Icefront::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ 336 336 void Icefront::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 337 337 /*Nothing updated yet*/ 338 338 } 339 339 /*}}}*/ 340 /*FUNCTION Icefront::InputUpdateFromConstant( double constant, int name) {{{1*/341 void Icefront::InputUpdateFromConstant( double constant, int name){342 /*Nothing updated yet*/ 343 } 344 /*}}}*/ 345 /*FUNCTION Icefront::InputUpdateFromConstant(int constant, int name) {{{ 1*/340 /*FUNCTION Icefront::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 341 void Icefront::InputUpdateFromConstant(IssmDouble constant, int name){ 342 /*Nothing updated yet*/ 343 } 344 /*}}}*/ 345 /*FUNCTION Icefront::InputUpdateFromConstant(int constant, int name) {{{*/ 346 346 void Icefront::InputUpdateFromConstant(int constant, int name){ 347 347 /*Nothing updated yet*/ 348 348 } 349 349 /*}}}*/ 350 /*FUNCTION Icefront::InputUpdateFromConstant(bool constant, int name) {{{ 1*/350 /*FUNCTION Icefront::InputUpdateFromConstant(bool constant, int name) {{{*/ 351 351 void Icefront::InputUpdateFromConstant(bool constant, int name){ 352 352 /*Nothing updated yet*/ 353 353 } 354 354 /*}}}*/ 355 /*FUNCTION Icefront::InputUpdateFromSolution{{{ 1*/356 void Icefront::InputUpdateFromSolution( double* solution){355 /*FUNCTION Icefront::InputUpdateFromSolution{{{*/ 356 void Icefront::InputUpdateFromSolution(IssmDouble* solution){ 357 357 /*Nothing updated yet*/ 358 358 } … … 361 361 /*Icefront numerics: */ 362 362 #ifdef _HAVE_DIAGNOSTIC_ 363 /*FUNCTION Icefront::CreatePVectorDiagnosticHoriz {{{ 1*/363 /*FUNCTION Icefront::CreatePVectorDiagnosticHoriz {{{*/ 364 364 ElementVector* Icefront::CreatePVectorDiagnosticHoriz(void){ 365 365 … … 379 379 #endif 380 380 default: 381 _error _("Icefront type %s not supported yet",EnumToStringx(type));382 } 383 } 384 /*}}}*/ 385 /*FUNCTION Icefront::CreatePVectorDiagnosticMacAyeal2d{{{ 1*/381 _error2_("Icefront type " << EnumToStringx(type) << " not supported yet"); 382 } 383 } 384 /*}}}*/ 385 /*FUNCTION Icefront::CreatePVectorDiagnosticMacAyeal2d{{{*/ 386 386 ElementVector* Icefront::CreatePVectorDiagnosticMacAyeal2d(void){ 387 387 … … 392 392 /*Intermediary*/ 393 393 int ig,index1,index2,fill; 394 double Jdet;395 double thickness,bed,pressure,ice_pressure,rho_water,rho_ice,gravity;396 double water_pressure,air_pressure,surface_under_water,base_under_water;397 double xyz_list[numnodes][3];398 double normal[2];399 double L[2];394 IssmDouble Jdet; 395 IssmDouble thickness,bed,pressure,ice_pressure,rho_water,rho_ice,gravity; 396 IssmDouble water_pressure,air_pressure,surface_under_water,base_under_water; 397 IssmDouble xyz_list[numnodes][3]; 398 IssmDouble normal[2]; 399 IssmDouble L[2]; 400 400 GaussTria *gauss; 401 401 … … 441 441 break; 442 442 default: 443 _error _("fill type %s not supported yet",EnumToStringx(fill));443 _error2_("fill type " << EnumToStringx(fill) << " not supported yet"); 444 444 } 445 445 ice_pressure=1.0/2.0*gravity*rho_ice*pow(thickness,2); … … 467 467 468 468 #ifdef _HAVE_CONTROL_ 469 /*FUNCTION Icefront::CreatePVectorAdjointHoriz {{{ 1*/469 /*FUNCTION Icefront::CreatePVectorAdjointHoriz {{{*/ 470 470 ElementVector* Icefront::CreatePVectorAdjointHoriz(void){ 471 471 … … 476 476 #endif 477 477 #ifdef _HAVE_3D_ 478 /*FUNCTION Icefront::CreatePVectorDiagnosticMacAyeal3d{{{ 1*/478 /*FUNCTION Icefront::CreatePVectorDiagnosticMacAyeal3d{{{*/ 479 479 ElementVector* Icefront::CreatePVectorDiagnosticMacAyeal3d(void){ 480 480 … … 504 504 } 505 505 /*}}}*/ 506 /*FUNCTION Icefront::CreatePVectorDiagnosticPattyn{{{ 1*/506 /*FUNCTION Icefront::CreatePVectorDiagnosticPattyn{{{*/ 507 507 ElementVector* Icefront::CreatePVectorDiagnosticPattyn(void){ 508 508 … … 513 513 int i,j,ig,index1,index2,index3,index4; 514 514 int fill; 515 double surface,pressure,ice_pressure,rho_water,rho_ice,gravity;516 double water_pressure,air_pressure;517 double Jdet,z_g;518 double xyz_list[NUMVERTICESQUA][3];519 double normal[3];520 double l1l4[4];515 IssmDouble surface,pressure,ice_pressure,rho_water,rho_ice,gravity; 516 IssmDouble water_pressure,air_pressure; 517 IssmDouble Jdet,z_g; 518 IssmDouble xyz_list[NUMVERTICESQUA][3]; 519 IssmDouble normal[3]; 520 IssmDouble l1l4[4]; 521 521 GaussPenta *gauss = NULL; 522 522 … … 543 543 544 544 /* Start looping on the number of gaussian points: */ 545 double zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];546 double zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];545 IssmDouble zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2]; 546 IssmDouble zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2]; 547 547 if(zmax>0 && zmin<0) gauss=new GaussPenta(index1,index2,index3,index4,3,10); //refined in vertical because of the sea level discontinuity 548 548 else gauss=new GaussPenta(index1,index2,index3,index4,3,3); … … 564 564 break; 565 565 default: 566 _error _("fill type %s not supported yet",EnumToStringx(fill));566 _error2_("fill type " << EnumToStringx(fill) << " not supported yet"); 567 567 } 568 568 ice_pressure=rho_ice*gravity*(surface-z_g); … … 581 581 } 582 582 /*}}}*/ 583 /*FUNCTION Icefront::CreatePVectorDiagnosticStokes{{{ 1*/583 /*FUNCTION Icefront::CreatePVectorDiagnosticStokes{{{*/ 584 584 ElementVector* Icefront::CreatePVectorDiagnosticStokes(void){ 585 585 … … 590 590 int i,j,ig,index1,index2,index3,index4; 591 591 int fill; 592 double pressure,rho_water,gravity;593 double water_pressure,air_pressure;594 double Jdet,z_g;595 double xyz_list[NUMVERTICESQUA][3];596 double normal[3];597 double l1l4[4];592 IssmDouble pressure,rho_water,gravity; 593 IssmDouble water_pressure,air_pressure; 594 IssmDouble Jdet,z_g; 595 IssmDouble xyz_list[NUMVERTICESQUA][3]; 596 IssmDouble normal[3]; 597 IssmDouble l1l4[4]; 598 598 GaussPenta *gauss = NULL; 599 599 … … 618 618 619 619 /* Start looping on the number of gaussian points: */ 620 double zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];621 double zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];620 IssmDouble zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2]; 621 IssmDouble zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2]; 622 622 if(zmax>0 && zmin<0) gauss=new GaussPenta(index1,index2,index3,index4,3,30); //refined in vertical because of the sea level discontinuity 623 623 else gauss=new GaussPenta(index1,index2,index3,index4,3,3); … … 638 638 break; 639 639 default: 640 _error _("fill type %s not supported yet",EnumToStringx(fill));640 _error2_("fill type " << EnumToStringx(fill) << " not supported yet"); 641 641 } 642 642 air_pressure=0; … … 660 660 /*}}}*/ 661 661 #endif 662 /*FUNCTION Icefront::GetDofList {{{ 1*/662 /*FUNCTION Icefront::GetDofList {{{*/ 663 663 void Icefront::GetDofList(int** pdoflist,int approximation_enum,int setenum){ 664 664 … … 691 691 692 692 /*Allocate: */ 693 doflist= (int*)xmalloc(numberofdofs*sizeof(int));693 doflist=xNew<int>(numberofdofs); 694 694 695 695 /*Populate: */ … … 704 704 } 705 705 /*}}}*/ 706 /*FUNCTION Icefront::GetSegmentNormal {{{ 1*/707 void Icefront:: GetSegmentNormal( double* normal,double xyz_list[4][3]){706 /*FUNCTION Icefront::GetSegmentNormal {{{*/ 707 void Icefront:: GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){ 708 708 709 709 /*Build unit outward pointing vector*/ 710 710 const int numnodes=NUMVERTICESSEG; 711 double vector[2];712 double norm;711 IssmDouble vector[2]; 712 IssmDouble norm; 713 713 714 714 vector[0]=xyz_list[1][0] - xyz_list[0][0]; … … 721 721 } 722 722 /*}}}*/ 723 /*FUNCTION Icefront::GetQuadNormal {{{ 1*/724 void Icefront:: GetQuadNormal( double* normal,double xyz_list[4][3]){723 /*FUNCTION Icefront::GetQuadNormal {{{*/ 724 void Icefront:: GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){ 725 725 726 726 /*Build unit outward pointing vector*/ 727 double AB[3];728 double AC[3];729 double norm;727 IssmDouble AB[3]; 728 IssmDouble AC[3]; 729 IssmDouble norm; 730 730 731 731 AB[0]=xyz_list[1][0] - xyz_list[0][0]; -
issm/trunk/src/c/objects/Loads/Icefront.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Load.h" 11 11 class Hook; … … 39 39 Parameters* parameters; 40 40 41 /*Icefront constructors, destructors: {{{ 1*/41 /*Icefront constructors, destructors: {{{*/ 42 42 Icefront(); 43 43 Icefront(int icefront_id,int i, IoModel* iomodel,int in_icefront_type, int analysis_type); 44 44 ~Icefront(); 45 45 /*}}}*/ 46 /*Object virtual functions definitions:{{{ 1*/46 /*Object virtual functions definitions:{{{ */ 47 47 void Echo(); 48 48 void DeepEcho(); … … 52 52 Object* copy(); 53 53 /*}}}*/ 54 /*Update virtual functions definitions: {{{ 1*/55 void InputUpdateFromVector( double* vector, int name, int type);54 /*Update virtual functions definitions: {{{*/ 55 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 56 56 void InputUpdateFromVector(int* vector, int name, int type); 57 57 void InputUpdateFromVector(bool* vector, int name, int type); 58 void InputUpdateFromMatrixDakota( double* matrix,int ncols,int nrows, int name, int type);59 void InputUpdateFromVectorDakota( double* vector, int name, int type);58 void InputUpdateFromMatrixDakota(IssmDouble* matrix,int ncols,int nrows, int name, int type); 59 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 60 60 void InputUpdateFromVectorDakota(int* vector, int name, int type); 61 61 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 62 void InputUpdateFromConstant( double constant, int name);62 void InputUpdateFromConstant(IssmDouble constant, int name); 63 63 void InputUpdateFromConstant(int constant, int name); 64 64 void InputUpdateFromConstant(bool constant, int name); 65 void InputUpdateFromSolution( double* solution);66 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("not implemented yet");};65 void InputUpdateFromSolution(IssmDouble* solution); 66 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("not implemented yet");}; 67 67 /*}}}*/ 68 /*Load virtual functions definitions: {{{ 1*/68 /*Load virtual functions definitions: {{{*/ 69 69 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 70 70 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); … … 72 72 void CreatePVector(Vector* pf); 73 73 void CreateJacobianMatrix(Matrix* Jff); 74 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);75 void PenaltyCreatePVector(Vector* pf, double kmax);76 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax);74 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 75 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 76 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax); 77 77 bool InAnalysis(int analysis_type); 78 78 /*}}}*/ 79 /*Load management: {{{ 1*/79 /*Load management: {{{*/ 80 80 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 81 void GetSegmentNormal( double* normal,double xyz_list[2][3]);82 void GetQuadNormal( double* normal,double xyz_list[4][3]);81 void GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]); 82 void GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]); 83 83 #ifdef _HAVE_CONTROL_ 84 84 ElementVector* CreatePVectorAdjointHoriz(void); -
issm/trunk/src/c/objects/Loads/Load.h
r11995 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 class Object; 14 14 class Matrix; … … 26 26 virtual ~Load(){}; 27 27 28 /*Virtual functions: {{{ 1*/28 /*Virtual functions: {{{*/ 29 29 virtual void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0; 30 30 virtual void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0; … … 32 32 virtual void CreatePVector(Vector* pf)=0; 33 33 virtual void CreateJacobianMatrix(Matrix* Jff)=0; 34 virtual void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax)=0;35 virtual void PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax)=0;36 virtual void PenaltyCreatePVector(Vector* pf, double kmax)=0;34 virtual void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax)=0; 35 virtual void PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, IssmDouble kmax)=0; 36 virtual void PenaltyCreatePVector(Vector* pf, IssmDouble kmax)=0; 37 37 virtual bool InAnalysis(int analysis_type)=0; 38 38 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 24 24 25 25 /*Numericalflux constructors and destructor*/ 26 /*FUNCTION Numericalflux::Numericalflux(){{{ 1*/26 /*FUNCTION Numericalflux::Numericalflux(){{{*/ 27 27 Numericalflux::Numericalflux(){ 28 28 this->inputs=NULL; … … 34 34 } 35 35 /*}}}*/ 36 /*}}}*//*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{ 1*/36 /*}}}*//*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{*/ 37 37 Numericalflux::Numericalflux(int numericalflux_id,int i, IoModel* iomodel, int in_analysis_type){ 38 38 … … 59 59 numericalflux_mparid=numberofelements+1; //matlab indexing 60 60 61 /*First, see wether this is an internal or boundary edge (if e2= NaN)*/62 if (i snan((double)iomodel->Data(MeshEdgesEnum)[4*i+3])){ //edges are [node1 node2 elem1 elem2]61 /*First, see wether this is an internal or boundary edge (if e2=-1)*/ 62 if (iomodel->Data(MeshEdgesEnum)[4*i+3]==-1.){ //edges are [node1 node2 elem1 elem2] 63 63 /* Boundary edge, only one element */ 64 e1= (int)iomodel->Data(MeshEdgesEnum)[4*i+2];65 e2= (int)UNDEF;64 e1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+2]); 65 e2=reCast<int>(UNDEF); 66 66 num_elems=1; 67 67 num_nodes=2; 68 68 numericalflux_type=BoundaryEnum; 69 numericalflux_elem_ids[0]= (int)e1;69 numericalflux_elem_ids[0]=e1; 70 70 } 71 71 else{ 72 72 /* internal edge: connected to 2 elements */ 73 e1= (int)iomodel->Data(MeshEdgesEnum)[4*i+2];74 e2= (int)iomodel->Data(MeshEdgesEnum)[4*i+3];73 e1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+2]); 74 e2=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+3]); 75 75 num_elems=2; 76 76 num_nodes=4; 77 77 numericalflux_type=InternalEnum; 78 numericalflux_elem_ids[0]= (int)e1;79 numericalflux_elem_ids[1]= (int)e2;78 numericalflux_elem_ids[0]=e1; 79 numericalflux_elem_ids[1]=e2; 80 80 } 81 81 82 82 /*1: Get vertices ids*/ 83 i1= (int)iomodel->Data(MeshEdgesEnum)[4*i+0];84 i2= (int)iomodel->Data(MeshEdgesEnum)[4*i+1];83 i1=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+0]); 84 i2=reCast<int>(iomodel->Data(MeshEdgesEnum)[4*i+1]); 85 85 86 86 if (numericalflux_type==InternalEnum){ … … 139 139 } 140 140 /*}}}*/ 141 /*FUNCTION Numericalflux::~Numericalflux(){{{ 1*/141 /*FUNCTION Numericalflux::~Numericalflux(){{{*/ 142 142 Numericalflux::~Numericalflux(){ 143 143 delete inputs; … … 149 149 150 150 /*Object virtual functions definitions:*/ 151 /*FUNCTION Numericalflux::Echo {{{ 1*/151 /*FUNCTION Numericalflux::Echo {{{*/ 152 152 void Numericalflux::Echo(void){ 153 printf("Numericalflux:\n");154 printf(" id: %i\n",id);155 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));153 _printLine_("Numericalflux:"); 154 _printLine_(" id: " << id); 155 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 156 156 hnodes->Echo(); 157 157 helement->Echo(); 158 printf(" parameters: %p\n",parameters);159 printf(" inputs: %p\n",inputs);160 } 161 /*}}}*/ 162 /*FUNCTION Numericalflux::DeepEcho {{{ 1*/158 _printLine_(" parameters: " << parameters); 159 _printLine_(" inputs: " << inputs); 160 } 161 /*}}}*/ 162 /*FUNCTION Numericalflux::DeepEcho {{{*/ 163 163 void Numericalflux::DeepEcho(void){ 164 164 165 printf("Numericalflux:\n");166 printf(" id: %i\n",id);167 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));165 _printLine_("Numericalflux:"); 166 _printLine_(" id: " << id); 167 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 168 168 hnodes->DeepEcho(); 169 169 helement->DeepEcho(); 170 printf(" parameters\n");170 _printLine_(" parameters"); 171 171 if(parameters) 172 172 parameters->DeepEcho(); 173 173 else 174 printf(" NULL\n");175 printf(" inputs\n");174 _printLine_(" NULL"); 175 _printLine_(" inputs"); 176 176 inputs->DeepEcho(); 177 177 178 178 } 179 179 /*}}}*/ 180 /*FUNCTION Numericalflux::Id {{{ 1*/180 /*FUNCTION Numericalflux::Id {{{*/ 181 181 int Numericalflux::Id(void){ 182 182 return id; 183 183 } 184 184 /*}}}*/ 185 /*FUNCTION Numericalflux::MyRank {{{ 1*/185 /*FUNCTION Numericalflux::MyRank {{{*/ 186 186 int Numericalflux::MyRank(void){ 187 187 extern int my_rank; … … 189 189 } 190 190 /*}}}*/ 191 /*FUNCTION Numericalflux::ObjectEnum{{{ 1*/191 /*FUNCTION Numericalflux::ObjectEnum{{{*/ 192 192 int Numericalflux::ObjectEnum(void){ 193 193 … … 196 196 } 197 197 /*}}}*/ 198 /*FUNCTION Numericalflux::copy {{{ 1*/198 /*FUNCTION Numericalflux::copy {{{*/ 199 199 Object* Numericalflux::copy() { 200 200 … … 228 228 229 229 /*Load virtual functions definitions:*/ 230 /*FUNCTION Numericalflux::Configure {{{ 1*/230 /*FUNCTION Numericalflux::Configure {{{*/ 231 231 void Numericalflux::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 232 232 … … 245 245 } 246 246 /*}}}*/ 247 /*FUNCTION Numericalflux::SetCurrentConfiguration {{{ 1*/247 /*FUNCTION Numericalflux::SetCurrentConfiguration {{{*/ 248 248 void Numericalflux::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 249 249 250 250 } 251 251 /*}}}*/ 252 /*FUNCTION Numericalflux::CreateKMatrix {{{ 1*/252 /*FUNCTION Numericalflux::CreateKMatrix {{{*/ 253 253 void Numericalflux::CreateKMatrix(Matrix* Kff, Matrix* Kfs){ 254 254 … … 270 270 break; 271 271 default: 272 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));272 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 273 273 } 274 274 … … 281 281 } 282 282 /*}}}*/ 283 /*FUNCTION Numericalflux::CreatePVector {{{ 1*/283 /*FUNCTION Numericalflux::CreatePVector {{{*/ 284 284 void Numericalflux::CreatePVector(Vector* pf){ 285 285 … … 300 300 break; 301 301 default: 302 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));302 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 303 303 } 304 304 … … 311 311 } 312 312 /*}}}*/ 313 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{ 1*/314 void Numericalflux::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){313 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{*/ 314 void Numericalflux::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 315 315 316 316 /*No stiffness loads applied, do nothing: */ … … 319 319 } 320 320 /*}}}*/ 321 /*FUNCTION Numericalflux::PenaltyCreatePVector{{{ 1*/322 void Numericalflux::PenaltyCreatePVector(Vector* pf, double kmax){321 /*FUNCTION Numericalflux::PenaltyCreatePVector{{{*/ 322 void Numericalflux::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 323 323 324 324 /*No penalty loads applied, do nothing: */ … … 327 327 } 328 328 /*}}}*/ 329 /*FUNCTION Numericalflux::InAnalysis{{{ 1*/329 /*FUNCTION Numericalflux::InAnalysis{{{*/ 330 330 bool Numericalflux::InAnalysis(int in_analysis_type){ 331 331 if (in_analysis_type==this->analysis_type) return true; … … 335 335 336 336 /*Numericalflux management*/ 337 /*FUNCTION Numericalflux::CreateKMatrixPrognostic{{{ 1*/337 /*FUNCTION Numericalflux::CreateKMatrixPrognostic{{{*/ 338 338 ElementMatrix* Numericalflux::CreateKMatrixPrognostic(void){ 339 339 … … 347 347 return CreateKMatrixPrognosticBoundary(); 348 348 default: 349 _error _("type not supported yet");350 } 351 } 352 /*}}}*/ 353 /*FUNCTION Numericalflux::CreateKMatrixPrognosticInternal {{{ 1*/349 _error2_("type not supported yet"); 350 } 351 } 352 /*}}}*/ 353 /*FUNCTION Numericalflux::CreateKMatrixPrognosticInternal {{{*/ 354 354 ElementMatrix* Numericalflux::CreateKMatrixPrognosticInternal(void){ 355 355 … … 359 359 /* Intermediaries*/ 360 360 int i,j,ig,index1,index2; 361 double DL1,DL2,Jdet,dt,vx,vy,UdotN;362 double xyz_list[NUMVERTICES_INTERNAL][3];363 double normal[2];364 double B[numdof];365 double Bprime[numdof];366 double Ke_g1[numdof][numdof];367 double Ke_g2[numdof][numdof];361 IssmDouble DL1,DL2,Jdet,dt,vx,vy,UdotN; 362 IssmDouble xyz_list[NUMVERTICES_INTERNAL][3]; 363 IssmDouble normal[2]; 364 IssmDouble B[numdof]; 365 IssmDouble Bprime[numdof]; 366 IssmDouble Ke_g1[numdof][numdof]; 367 IssmDouble Ke_g2[numdof][numdof]; 368 368 GaussTria *gauss; 369 369 … … 416 416 } 417 417 /*}}}*/ 418 /*FUNCTION Numericalflux::CreateKMatrixPrognosticBoundary {{{ 1*/418 /*FUNCTION Numericalflux::CreateKMatrixPrognosticBoundary {{{*/ 419 419 ElementMatrix* Numericalflux::CreateKMatrixPrognosticBoundary(void){ 420 420 … … 424 424 /* Intermediaries*/ 425 425 int i,j,ig,index1,index2; 426 double DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN;427 double xyz_list[NUMVERTICES_BOUNDARY][3];428 double normal[2];429 double L[numdof];430 double Ke_g[numdof][numdof];426 IssmDouble DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN; 427 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 428 IssmDouble normal[2]; 429 IssmDouble L[numdof]; 430 IssmDouble Ke_g[numdof][numdof]; 431 431 GaussTria *gauss; 432 432 … … 488 488 } 489 489 /*}}}*/ 490 /*FUNCTION Numericalflux::CreateKMatrixBalancethickness{{{ 1*/490 /*FUNCTION Numericalflux::CreateKMatrixBalancethickness{{{*/ 491 491 ElementMatrix* Numericalflux::CreateKMatrixBalancethickness(void){ 492 492 … … 500 500 return CreateKMatrixBalancethicknessBoundary(); 501 501 default: 502 _error _("type not supported yet");503 } 504 } 505 /*}}}*/ 506 /*FUNCTION Numericalflux::CreateKMatrixBalancethicknessInternal {{{ 1*/502 _error2_("type not supported yet"); 503 } 504 } 505 /*}}}*/ 506 /*FUNCTION Numericalflux::CreateKMatrixBalancethicknessInternal {{{*/ 507 507 ElementMatrix* Numericalflux::CreateKMatrixBalancethicknessInternal(void){ 508 508 … … 512 512 /* Intermediaries*/ 513 513 int i,j,ig,index1,index2; 514 double DL1,DL2,Jdet,vx,vy,UdotN;515 double xyz_list[NUMVERTICES_INTERNAL][3];516 double normal[2];517 double B[numdof];518 double Bprime[numdof];519 double Ke_g1[numdof][numdof];520 double Ke_g2[numdof][numdof];514 IssmDouble DL1,DL2,Jdet,vx,vy,UdotN; 515 IssmDouble xyz_list[NUMVERTICES_INTERNAL][3]; 516 IssmDouble normal[2]; 517 IssmDouble B[numdof]; 518 IssmDouble Bprime[numdof]; 519 IssmDouble Ke_g1[numdof][numdof]; 520 IssmDouble Ke_g2[numdof][numdof]; 521 521 GaussTria *gauss; 522 522 … … 568 568 } 569 569 /*}}}*/ 570 /*FUNCTION Numericalflux::CreateKMatrixBalancethicknessBoundary {{{ 1*/570 /*FUNCTION Numericalflux::CreateKMatrixBalancethicknessBoundary {{{*/ 571 571 ElementMatrix* Numericalflux::CreateKMatrixBalancethicknessBoundary(void){ 572 572 … … 576 576 /* Intermediaries*/ 577 577 int i,j,ig,index1,index2; 578 double DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN;579 double xyz_list[NUMVERTICES_BOUNDARY][3];580 double normal[2];581 double L[numdof];582 double Ke_g[numdof][numdof];578 IssmDouble DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN; 579 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 580 IssmDouble normal[2]; 581 IssmDouble L[numdof]; 582 IssmDouble Ke_g[numdof][numdof]; 583 583 GaussTria *gauss; 584 584 … … 639 639 } 640 640 /*}}}*/ 641 /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethickness{{{ 1*/641 /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethickness{{{*/ 642 642 ElementMatrix* Numericalflux::CreateKMatrixAdjointBalancethickness(void){ 643 643 … … 651 651 return CreateKMatrixAdjointBalancethicknessBoundary(); 652 652 default: 653 _error _("type not supported yet");654 } 655 } 656 /*}}}*/ 657 /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethicknessInternal {{{ 1*/653 _error2_("type not supported yet"); 654 } 655 } 656 /*}}}*/ 657 /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethicknessInternal {{{*/ 658 658 ElementMatrix* Numericalflux::CreateKMatrixAdjointBalancethicknessInternal(void){ 659 659 … … 663 663 } 664 664 /*}}}*/ 665 /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethicknessBoundary {{{ 1*/665 /*FUNCTION Numericalflux::CreateKMatrixAdjointBalancethicknessBoundary {{{*/ 666 666 ElementMatrix* Numericalflux::CreateKMatrixAdjointBalancethicknessBoundary(void){ 667 667 … … 671 671 } 672 672 /*}}}*/ 673 /*FUNCTION Numericalflux::CreatePVectorPrognostic{{{ 1*/673 /*FUNCTION Numericalflux::CreatePVectorPrognostic{{{*/ 674 674 ElementVector* Numericalflux::CreatePVectorPrognostic(void){ 675 675 … … 683 683 return CreatePVectorPrognosticBoundary(); 684 684 default: 685 _error _("type not supported yet");686 } 687 } 688 /*}}}*/ 689 /*FUNCTION Numericalflux::CreatePVectorPrognosticInternal{{{ 1*/685 _error2_("type not supported yet"); 686 } 687 } 688 /*}}}*/ 689 /*FUNCTION Numericalflux::CreatePVectorPrognosticInternal{{{*/ 690 690 ElementVector* Numericalflux::CreatePVectorPrognosticInternal(void){ 691 691 … … 695 695 } 696 696 /*}}}*/ 697 /*FUNCTION Numericalflux::CreatePVectorPrognosticBoundary{{{ 1*/697 /*FUNCTION Numericalflux::CreatePVectorPrognosticBoundary{{{*/ 698 698 ElementVector* Numericalflux::CreatePVectorPrognosticBoundary(void){ 699 699 … … 703 703 /* Intermediaries*/ 704 704 int i,j,ig,index1,index2; 705 double DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN,thickness;706 double xyz_list[NUMVERTICES_BOUNDARY][3];707 double normal[2];708 double L[numdof];705 IssmDouble DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN,thickness; 706 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 707 IssmDouble normal[2]; 708 IssmDouble L[numdof]; 709 709 GaussTria *gauss; 710 710 … … 751 751 vyaverage_input->GetInputValue(&vy,gauss); 752 752 spcthickness_input->GetInputValue(&thickness,gauss); 753 if( isnan(thickness)) _error_("Cannot weakly apply constraint because NaN was provided");753 if(xIsNan<IssmDouble>(thickness)) _error2_("Cannot weakly apply constraint because NaN was provided"); 754 754 755 755 UdotN=vx*normal[0]+vy*normal[1]; … … 765 765 } 766 766 /*}}}*/ 767 /*FUNCTION Numericalflux::CreatePVectorBalancethickness{{{ 1*/767 /*FUNCTION Numericalflux::CreatePVectorBalancethickness{{{*/ 768 768 ElementVector* Numericalflux::CreatePVectorBalancethickness(void){ 769 769 … … 777 777 return CreatePVectorBalancethicknessBoundary(); 778 778 default: 779 _error _("type not supported yet");780 } 781 } 782 /*}}}*/ 783 /*FUNCTION Numericalflux::CreatePVectorBalancethicknessInternal{{{ 1*/779 _error2_("type not supported yet"); 780 } 781 } 782 /*}}}*/ 783 /*FUNCTION Numericalflux::CreatePVectorBalancethicknessInternal{{{*/ 784 784 ElementVector* Numericalflux::CreatePVectorBalancethicknessInternal(void){ 785 785 … … 789 789 } 790 790 /*}}}*/ 791 /*FUNCTION Numericalflux::CreatePVectorBalancethicknessBoundary{{{ 1*/791 /*FUNCTION Numericalflux::CreatePVectorBalancethicknessBoundary{{{*/ 792 792 ElementVector* Numericalflux::CreatePVectorBalancethicknessBoundary(void){ 793 793 … … 797 797 /* Intermediaries*/ 798 798 int i,j,ig,index1,index2; 799 double DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN,thickness;800 double xyz_list[NUMVERTICES_BOUNDARY][3];801 double normal[2];802 double L[numdof];799 IssmDouble DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN,thickness; 800 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 801 IssmDouble normal[2]; 802 IssmDouble L[numdof]; 803 803 GaussTria *gauss; 804 804 … … 856 856 } 857 857 /*}}}*/ 858 /*FUNCTION Numericalflux::CreatePVectorAdjointBalancethickness{{{ 1*/858 /*FUNCTION Numericalflux::CreatePVectorAdjointBalancethickness{{{*/ 859 859 ElementVector* Numericalflux::CreatePVectorAdjointBalancethickness(void){ 860 860 … … 863 863 } 864 864 /*}}}*/ 865 /*FUNCTION Numericalflux::GetNormal {{{ 1*/866 void Numericalflux:: GetNormal( double* normal,double xyz_list[4][3]){865 /*FUNCTION Numericalflux::GetNormal {{{*/ 866 void Numericalflux:: GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){ 867 867 868 868 /*Build unit outward pointing vector*/ 869 double vector[2];870 double norm;869 IssmDouble vector[2]; 870 IssmDouble norm; 871 871 872 872 vector[0]=xyz_list[1][0] - xyz_list[0][0]; -
issm/trunk/src/c/objects/Loads/Numericalflux.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Load.h" 11 11 class Hook; … … 35 35 36 36 37 /*Numericalflux constructors,destructors {{{ 1*/37 /*Numericalflux constructors,destructors {{{*/ 38 38 Numericalflux(); 39 39 Numericalflux(int numericalflux_id,int i, IoModel* iomodel,int analysis_type); 40 40 ~Numericalflux(); 41 41 /*}}}*/ 42 /*Object virtual functions definitions:{{{ 1*/42 /*Object virtual functions definitions:{{{ */ 43 43 void Echo(); 44 44 void DeepEcho(); … … 48 48 Object* copy(); 49 49 /*}}}*/ 50 /*Update virtual functions resolution: {{{ 1*/51 void InputUpdateFromVector( double* vector, int name, int type){/*Do nothing*/}52 void InputUpdateFromVector(int* vector, int name, int type){_error _("Not implemented yet!");}53 void InputUpdateFromVector(bool* vector, int name, int type){_error _("Not implemented yet!");}54 void InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){/*Do nothing*/}55 void InputUpdateFromVectorDakota( double* vector, int name, int type){/*Do nothing*/}56 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error _("Not implemented yet!");}57 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error _("Not implemented yet!");}58 void InputUpdateFromConstant( double constant, int name){/*Do nothing*/};50 /*Update virtual functions resolution: {{{*/ 51 void InputUpdateFromVector(IssmDouble* vector, int name, int type){/*Do nothing*/} 52 void InputUpdateFromVector(int* vector, int name, int type){_error2_("Not implemented yet!");} 53 void InputUpdateFromVector(bool* vector, int name, int type){_error2_("Not implemented yet!");} 54 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*Do nothing*/} 55 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*Do nothing*/} 56 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error2_("Not implemented yet!");} 57 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error2_("Not implemented yet!");} 58 void InputUpdateFromConstant(IssmDouble constant, int name){/*Do nothing*/}; 59 59 void InputUpdateFromConstant(int constant, int name){/*Do nothing*/}; 60 void InputUpdateFromConstant(bool constant, int name){_error _("Not implemented yet!");}61 void InputUpdateFromSolution( double* solution){_error_("Not implemented yet!");}62 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("not implemented yet");};60 void InputUpdateFromConstant(bool constant, int name){_error2_("Not implemented yet!");} 61 void InputUpdateFromSolution(IssmDouble* solution){_error2_("Not implemented yet!");} 62 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("not implemented yet");}; 63 63 /*}}}*/ 64 /*Load virtual functions definitions: {{{ 1*/64 /*Load virtual functions definitions: {{{*/ 65 65 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 66 66 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 67 67 void CreateKMatrix(Matrix* Kff, Matrix* Kfs); 68 68 void CreatePVector(Vector* pf); 69 void CreateJacobianMatrix(Matrix* Jff){_error _("Not implemented yet");};70 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){_error_("Not implemented yet");};71 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);72 void PenaltyCreatePVector(Vector* pf, double kmax);69 void CreateJacobianMatrix(Matrix* Jff){_error2_("Not implemented yet");}; 70 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error2_("Not implemented yet");}; 71 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 72 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 73 73 bool InAnalysis(int analysis_type); 74 74 /*}}}*/ 75 /*Numericalflux management:{{{ 1*/76 void GetNormal( double* normal,double xyz_list[4][3]);75 /*Numericalflux management:{{{*/ 76 void GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]); 77 77 ElementMatrix* CreateKMatrixPrognostic(void); 78 78 ElementMatrix* CreateKMatrixPrognosticInternal(void); -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r12330 r12706 4 4 5 5 /*Headers*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 24 24 25 25 /*Pengrid constructors and destructor*/ 26 /*FUNCTION Pengrid::Pengrid(){{{ 1*/26 /*FUNCTION Pengrid::Pengrid(){{{*/ 27 27 Pengrid::Pengrid(){ 28 28 this->inputs=NULL; … … 40 40 41 41 } 42 /*}}} 1*/43 /*FUNCTION Pengrid::Pengrid(int index, int id, IoModel* iomodel,int analysis_type){{{ 1*/42 /*}}}*/ 43 /*FUNCTION Pengrid::Pengrid(int index, int id, IoModel* iomodel,int analysis_type){{{*/ 44 44 Pengrid::Pengrid(int id, int index, IoModel* iomodel, int in_analysis_type){ //i is the element index 45 45 … … 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION Pengrid::~Pengrid(){{{ 1*/92 /*FUNCTION Pengrid::~Pengrid(){{{*/ 93 93 Pengrid::~Pengrid(){ 94 94 delete inputs; … … 98 98 return; 99 99 } 100 /*}}} 1*/100 /*}}}*/ 101 101 102 102 /*Object virtual functions definitions:*/ 103 /*FUNCTION Pengrid::Echo {{{ 1*/103 /*FUNCTION Pengrid::Echo {{{*/ 104 104 void Pengrid::Echo(void){ 105 105 this->DeepEcho(); 106 106 } 107 /*}}} 1*/108 /*FUNCTION Pengrid::DeepEcho{{{ 1*/107 /*}}}*/ 108 /*FUNCTION Pengrid::DeepEcho{{{*/ 109 109 void Pengrid::DeepEcho(void){ 110 110 111 printf("Pengrid:\n");112 printf(" id: %i\n",id);113 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));111 _printLine_("Pengrid:"); 112 _printLine_(" id: " << id); 113 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 114 114 hnode->DeepEcho(); 115 115 helement->DeepEcho(); 116 116 hmatpar->DeepEcho(); 117 printf(" active %i\n",this->active);118 printf(" zigzag_counter %i\n",this->zigzag_counter);119 printf(" parameters\n");117 _printLine_(" active " << this->active); 118 _printLine_(" zigzag_counter " << this->zigzag_counter); 119 _printLine_(" parameters"); 120 120 parameters->DeepEcho(); 121 printf(" inputs\n");121 _printLine_(" inputs"); 122 122 inputs->DeepEcho(); 123 123 } 124 124 /*}}}*/ 125 /*FUNCTION Pengrid::Id {{{ 1*/125 /*FUNCTION Pengrid::Id {{{*/ 126 126 int Pengrid::Id(void){ return id; } 127 /*}}} 1*/128 /*FUNCTION Pengrid::MyRank {{{ 1*/127 /*}}}*/ 128 /*FUNCTION Pengrid::MyRank {{{*/ 129 129 int Pengrid::MyRank(void){ 130 130 extern int my_rank; 131 131 return my_rank; 132 132 } 133 /*}}} 1*/134 /*FUNCTION Pengrid::ObjectEnum{{{ 1*/133 /*}}}*/ 134 /*FUNCTION Pengrid::ObjectEnum{{{*/ 135 135 int Pengrid::ObjectEnum(void){ 136 136 137 137 return PengridEnum; 138 138 } 139 /*}}} 1*/140 /*FUNCTION Icefront::copy {{{ 1*/139 /*}}}*/ 140 /*FUNCTION Icefront::copy {{{*/ 141 141 Object* Pengrid::copy() { 142 142 … … 177 177 178 178 /*Load virtual functions definitions:*/ 179 /*FUNCTION Pengrid::Configure {{{ 1*/179 /*FUNCTION Pengrid::Configure {{{*/ 180 180 void Pengrid::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 181 181 … … 194 194 this->parameters=parametersin; 195 195 } 196 /*}}} 1*/197 /*FUNCTION Pengrid::SetCurrentConfiguration {{{ 1*/196 /*}}}*/ 197 /*FUNCTION Pengrid::SetCurrentConfiguration {{{*/ 198 198 void Pengrid::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 199 199 200 200 } 201 /*}}} 1*/202 /*FUNCTION Pengrid::CreateKMatrix {{{ 1*/201 /*}}}*/ 202 /*FUNCTION Pengrid::CreateKMatrix {{{*/ 203 203 void Pengrid::CreateKMatrix(Matrix* Kff, Matrix* Kfs){ 204 204 … … 207 207 208 208 } 209 /*}}} 1*/210 /*FUNCTION Pengrid::CreatePVector {{{ 1*/209 /*}}}*/ 210 /*FUNCTION Pengrid::CreatePVector {{{*/ 211 211 void Pengrid::CreatePVector(Vector* pf){ 212 212 … … 215 215 216 216 } 217 /*}}} 1*/218 /*FUNCTION Pengrid::PenaltyCreateMatrix {{{ 1*/219 void Pengrid::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){217 /*}}}*/ 218 /*FUNCTION Pengrid::PenaltyCreateMatrix {{{*/ 219 void Pengrid::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 220 220 221 221 /*Retrieve parameters: */ … … 239 239 #endif 240 240 default: 241 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));241 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 242 242 } 243 243 … … 248 248 } 249 249 } 250 /*}}} 1*/251 /*FUNCTION Pengrid::PenaltyCreatePVector {{{ 1*/252 void Pengrid::PenaltyCreatePVector(Vector* pf, double kmax){250 /*}}}*/ 251 /*FUNCTION Pengrid::PenaltyCreatePVector {{{*/ 252 void Pengrid::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 253 253 254 254 /*Retrieve parameters: */ … … 271 271 #endif 272 272 default: 273 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));273 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 274 274 } 275 275 … … 280 280 } 281 281 } 282 /*}}} 1*/283 /*FUNCTION Pengrid::InAnalysis{{{ 1*/282 /*}}}*/ 283 /*FUNCTION Pengrid::InAnalysis{{{*/ 284 284 bool Pengrid::InAnalysis(int in_analysis_type){ 285 285 if (in_analysis_type==this->analysis_type)return true; … … 289 289 290 290 /*Update virtual functions definitions:*/ 291 /*FUNCTION Pengrid::InputUpdateFromVector( double* vector, int name, int type) {{{1*/292 void Pengrid::InputUpdateFromVector( double* vector, int name, int type){293 /*Nothing updated yet*/ 294 } 295 /*}}}*/ 296 /*FUNCTION Pengrid::InputUpdateFromVector(int* vector, int name, int type) {{{ 1*/291 /*FUNCTION Pengrid::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 292 void Pengrid::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 293 /*Nothing updated yet*/ 294 } 295 /*}}}*/ 296 /*FUNCTION Pengrid::InputUpdateFromVector(int* vector, int name, int type) {{{*/ 297 297 void Pengrid::InputUpdateFromVector(int* vector, int name, int type){ 298 298 /*Nothing updated yet*/ 299 299 } 300 300 /*}}}*/ 301 /*FUNCTION Pengrid::InputUpdateFromVector(bool* vector, int name, int type) {{{ 1*/301 /*FUNCTION Pengrid::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ 302 302 void Pengrid::InputUpdateFromVector(bool* vector, int name, int type){ 303 303 /*Nothing updated yet*/ 304 304 } 305 305 /*}}}*/ 306 /*FUNCTION Pengrid::InputUpdateFromMatrixDakota( double* vector, int nrows, int ncols, int name, int type) {{{1*/307 void Pengrid::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){308 /*Nothing updated yet*/ 309 } 310 /*}}}*/ 311 /*FUNCTION Pengrid::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{1*/312 void Pengrid::InputUpdateFromVectorDakota( double* vector, int name, int type){313 /*Nothing updated yet*/ 314 } 315 /*}}}*/ 316 /*FUNCTION Pengrid::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{ 1*/306 /*FUNCTION Pengrid::InputUpdateFromMatrixDakota(IssmDouble* vector, int nrows, int ncols, int name, int type) {{{*/ 307 void Pengrid::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 308 /*Nothing updated yet*/ 309 } 310 /*}}}*/ 311 /*FUNCTION Pengrid::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 312 void Pengrid::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 313 /*Nothing updated yet*/ 314 } 315 /*}}}*/ 316 /*FUNCTION Pengrid::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ 317 317 void Pengrid::InputUpdateFromVectorDakota(int* vector, int name, int type){ 318 318 /*Nothing updated yet*/ 319 319 } 320 320 /*}}}*/ 321 /*FUNCTION Pengrid::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{ 1*/321 /*FUNCTION Pengrid::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ 322 322 void Pengrid::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 323 323 /*Nothing updated yet*/ 324 324 } 325 325 /*}}}*/ 326 /*FUNCTION Pengrid::InputUpdateFromConstant( double constant, int name) {{{1*/327 void Pengrid::InputUpdateFromConstant( double constant, int name){326 /*FUNCTION Pengrid::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 327 void Pengrid::InputUpdateFromConstant(IssmDouble constant, int name){ 328 328 switch(name){ 329 329 … … 335 335 } 336 336 /*}}}*/ 337 /*FUNCTION Pengrid::InputUpdateFromConstant(int constant, int name) {{{ 1*/337 /*FUNCTION Pengrid::InputUpdateFromConstant(int constant, int name) {{{*/ 338 338 void Pengrid::InputUpdateFromConstant(int constant, int name){ 339 339 /*Nothing updated yet*/ 340 340 } 341 341 /*}}}*/ 342 /*FUNCTION Pengrid::InputUpdateFromConstant(bool constant, int name) {{{ 1*/342 /*FUNCTION Pengrid::InputUpdateFromConstant(bool constant, int name) {{{*/ 343 343 void Pengrid::InputUpdateFromConstant(bool constant, int name){ 344 344 … … 352 352 } 353 353 /*}}}*/ 354 /*FUNCTION Pengrid::InputUpdateFromSolution{{{ 1*/355 void Pengrid::InputUpdateFromSolution( double* solution){354 /*FUNCTION Pengrid::InputUpdateFromSolution{{{*/ 355 void Pengrid::InputUpdateFromSolution(IssmDouble* solution){ 356 356 /*Nothing updated yet*/ 357 357 } … … 359 359 360 360 /*Pengrid management:*/ 361 /*FUNCTION Pengrid::ConstraintActivate {{{ 1*/361 /*FUNCTION Pengrid::ConstraintActivate {{{*/ 362 362 void Pengrid::ConstraintActivate(int* punstable){ 363 363 … … 379 379 } 380 380 else{ 381 _error _("analysis: %s not supported yet",EnumToStringx(analysis_type));382 } 383 384 } 385 /*}}} 1*/386 /*FUNCTION Pengrid::ConstraintActivateThermal {{{ 1*/381 _error2_("analysis: " << EnumToStringx(analysis_type) << " not supported yet"); 382 } 383 384 } 385 /*}}}*/ 386 /*FUNCTION Pengrid::ConstraintActivateThermal {{{*/ 387 387 void Pengrid::ConstraintActivateThermal(int* punstable){ 388 388 … … 391 391 int found=0; 392 392 const int numnodes=1; 393 double pressure;394 double temperature;395 double t_pmp;393 IssmDouble pressure; 394 IssmDouble temperature; 395 IssmDouble t_pmp; 396 396 int new_active; 397 397 int unstable=0; … … 452 452 *punstable=unstable; 453 453 } 454 /*}}} 1*/454 /*}}}*/ 455 455 #ifdef _HAVE_DIAGNOSTIC_ 456 /*FUNCTION Pengrid::PenaltyCreateKMatrixDiagnosticStokes {{{ 1*/457 ElementMatrix* Pengrid::PenaltyCreateKMatrixDiagnosticStokes( double kmax){456 /*FUNCTION Pengrid::PenaltyCreateKMatrixDiagnosticStokes {{{*/ 457 ElementMatrix* Pengrid::PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax){ 458 458 459 459 const int numdof = NUMVERTICES *NDOF4; 460 double slope[2];461 double penalty_offset;460 IssmDouble slope[2]; 461 IssmDouble penalty_offset; 462 462 int approximation; 463 463 … … 475 475 476 476 /*Create elementary matrix: add penalty to constrain wb (wb=ub*db/dx+vb*db/dy)*/ 477 Ke->values[2*NDOF4+0]=-slope[0]*kmax*pow(( double)10.0,penalty_offset);478 Ke->values[2*NDOF4+1]=-slope[1]*kmax*pow(( double)10.0,penalty_offset);479 Ke->values[2*NDOF4+2]= kmax*pow(( double)10,penalty_offset);477 Ke->values[2*NDOF4+0]=-slope[0]*kmax*pow((IssmDouble)10.0,penalty_offset); 478 Ke->values[2*NDOF4+1]=-slope[1]*kmax*pow((IssmDouble)10.0,penalty_offset); 479 Ke->values[2*NDOF4+2]= kmax*pow((IssmDouble)10,penalty_offset); 480 480 481 481 /*Transform Coordinate System*/ … … 485 485 return Ke; 486 486 } 487 /*}}} 1*/487 /*}}}*/ 488 488 #endif 489 489 #ifdef _HAVE_THERMAL_ 490 /*FUNCTION Pengrid::PenaltyCreateKMatrixMelting {{{ 1*/491 ElementMatrix* Pengrid::PenaltyCreateKMatrixMelting( double kmax){490 /*FUNCTION Pengrid::PenaltyCreateKMatrixMelting {{{*/ 491 ElementMatrix* Pengrid::PenaltyCreateKMatrixMelting(IssmDouble kmax){ 492 492 493 493 const int numdof=NUMVERTICES*NDOF1; 494 double pressure,temperature,t_pmp;495 double penalty_factor;494 IssmDouble pressure,temperature,t_pmp; 495 IssmDouble penalty_factor; 496 496 497 497 Penta* penta=(Penta*)element; … … 511 511 /*Add penalty load*/ 512 512 if (temperature<t_pmp){ //If T<Tpmp, there must be no melting. Therefore, melting should be constrained to 0 when T<Tpmp, instead of using spcs, use penalties 513 Ke->values[0]=kmax*pow(( double)10,penalty_factor);513 Ke->values[0]=kmax*pow((IssmDouble)10,penalty_factor); 514 514 } 515 515 … … 517 517 return Ke; 518 518 } 519 /*}}} 1*/520 /*FUNCTION Pengrid::PenaltyCreateKMatrixThermal {{{ 1*/521 ElementMatrix* Pengrid::PenaltyCreateKMatrixThermal( double kmax){519 /*}}}*/ 520 /*FUNCTION Pengrid::PenaltyCreateKMatrixThermal {{{*/ 521 ElementMatrix* Pengrid::PenaltyCreateKMatrixThermal(IssmDouble kmax){ 522 522 523 523 const int numdof=NUMVERTICES*NDOF1; 524 double penalty_factor;524 IssmDouble penalty_factor; 525 525 526 526 /*Initialize Element matrix and return if necessary*/ … … 531 531 parameters->FindParam(&penalty_factor,ThermalPenaltyFactorEnum); 532 532 533 Ke->values[0]=kmax*pow(( double)10,penalty_factor);533 Ke->values[0]=kmax*pow((IssmDouble)10,penalty_factor); 534 534 535 535 /*Clean up and return*/ 536 536 return Ke; 537 537 } 538 /*}}} 1*/539 /*FUNCTION Pengrid::PenaltyCreatePVectorMelting {{{ 1*/540 ElementVector* Pengrid::PenaltyCreatePVectorMelting( double kmax){538 /*}}}*/ 539 /*FUNCTION Pengrid::PenaltyCreatePVectorMelting {{{*/ 540 ElementVector* Pengrid::PenaltyCreatePVectorMelting(IssmDouble kmax){ 541 541 542 542 const int numdof=NUMVERTICES*NDOF1; 543 double pressure;544 double temperature;545 double melting_offset;546 double t_pmp;547 double dt,penalty_factor;543 IssmDouble pressure; 544 IssmDouble temperature; 545 IssmDouble melting_offset; 546 IssmDouble t_pmp; 547 IssmDouble dt,penalty_factor; 548 548 549 549 /*recover pointers: */ … … 572 572 } 573 573 else{ 574 if (dt) pe->values[0]=melting_offset*pow(( double)10,penalty_factor)*(temperature-t_pmp)/dt;575 else pe->values[0]=melting_offset*pow(( double)10,penalty_factor)*(temperature-t_pmp);574 if (dt) pe->values[0]=melting_offset*pow((IssmDouble)10,penalty_factor)*(temperature-t_pmp)/dt; 575 else pe->values[0]=melting_offset*pow((IssmDouble)10,penalty_factor)*(temperature-t_pmp); 576 576 } 577 577 … … 579 579 return pe; 580 580 } 581 /*}}} 1*/582 /*FUNCTION Pengrid::PenaltyCreatePVectorThermal {{{ 1*/583 ElementVector* Pengrid::PenaltyCreatePVectorThermal( double kmax){581 /*}}}*/ 582 /*FUNCTION Pengrid::PenaltyCreatePVectorThermal {{{*/ 583 ElementVector* Pengrid::PenaltyCreatePVectorThermal(IssmDouble kmax){ 584 584 585 585 const int numdof=NUMVERTICES*NDOF1; 586 double pressure;587 double t_pmp;588 double penalty_factor;586 IssmDouble pressure; 587 IssmDouble t_pmp; 588 IssmDouble penalty_factor; 589 589 590 590 Penta* penta=(Penta*)element; … … 601 601 t_pmp=matpar->GetMeltingPoint()-matpar->GetBeta()*pressure; 602 602 603 pe->values[0]=kmax*pow(( double)10,penalty_factor)*t_pmp;603 pe->values[0]=kmax*pow((IssmDouble)10,penalty_factor)*t_pmp; 604 604 605 605 /*Clean up and return*/ 606 606 return pe; 607 607 } 608 /*}}} 1*/608 /*}}}*/ 609 609 #endif 610 /*FUNCTION Pengrid::ResetConstraint {{{ 1*/610 /*FUNCTION Pengrid::ResetConstraint {{{*/ 611 611 void Pengrid::ResetConstraint(void){ 612 612 active=0; 613 613 zigzag_counter=0; 614 614 } 615 /*}}} 1*/616 /*FUNCTION Pengrid::UpdateInputs {{{ 1*/617 void Pengrid::UpdateInputs( double* solution){618 _error _("not supported yet!");619 } 620 /*}}} 1*/615 /*}}}*/ 616 /*FUNCTION Pengrid::UpdateInputs {{{*/ 617 void Pengrid::UpdateInputs(IssmDouble* solution){ 618 _error2_("not supported yet!"); 619 } 620 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Pengrid.h
r12330 r12706 6 6 7 7 /*Headers:*/ 8 /*{{{ 1*/8 /*{{{*/ 9 9 #include "./Load.h" 10 10 class Hook; … … 40 40 public: 41 41 42 /*Pengrid constructors, destructors {{{ 1*/42 /*Pengrid constructors, destructors {{{*/ 43 43 Pengrid(); 44 44 Pengrid(int index, int id, IoModel* iomodel,int analysis_type); 45 45 ~Pengrid(); 46 46 /*}}}*/ 47 /*Object virtual functions definitions:{{{ 1*/47 /*Object virtual functions definitions:{{{ */ 48 48 void Echo(); 49 49 void DeepEcho(); … … 53 53 Object* copy(); 54 54 /*}}}*/ 55 /*Update virtual functions resolution: {{{ 1*/56 void InputUpdateFromVector( double* vector, int name, int type);55 /*Update virtual functions resolution: {{{*/ 56 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 57 57 void InputUpdateFromVector(int* vector, int name, int type); 58 58 void InputUpdateFromVector(bool* vector, int name, int type); 59 void InputUpdateFromMatrixDakota( double* matrix ,int nrows, int ncols, int name, int type);60 void InputUpdateFromVectorDakota( double* vector, int name, int type);59 void InputUpdateFromMatrixDakota(IssmDouble* matrix ,int nrows, int ncols, int name, int type); 60 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 61 61 void InputUpdateFromVectorDakota(int* vector, int name, int type); 62 62 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 63 void InputUpdateFromConstant( double constant, int name);63 void InputUpdateFromConstant(IssmDouble constant, int name); 64 64 void InputUpdateFromConstant(int constant, int name); 65 65 void InputUpdateFromConstant(bool constant, int name); 66 void InputUpdateFromSolution( double* solution);67 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("not implemented yet");};66 void InputUpdateFromSolution(IssmDouble* solution); 67 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("not implemented yet");}; 68 68 /*}}}*/ 69 /*Load virtual functions definitions: {{{ 1*/69 /*Load virtual functions definitions: {{{*/ 70 70 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 71 71 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 72 72 void CreateKMatrix(Matrix* Kff, Matrix* Kfs); 73 73 void CreatePVector(Vector* pf); 74 void CreateJacobianMatrix(Matrix* Jff){_error _("Not implemented yet");};75 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){_error_("Not implemented yet");};76 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);77 void PenaltyCreatePVector(Vector* pf, double kmax);74 void CreateJacobianMatrix(Matrix* Jff){_error2_("Not implemented yet");}; 75 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error2_("Not implemented yet");}; 76 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 77 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 78 78 bool InAnalysis(int analysis_type); 79 79 /*}}}*/ 80 /*Pengrid management {{{ 1*/80 /*Pengrid management {{{*/ 81 81 #ifdef _HAVE_DIAGNOSTIC_ 82 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes( double kmax);82 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax); 83 83 #endif 84 84 #ifdef _HAVE_THERMAL_ 85 ElementMatrix* PenaltyCreateKMatrixThermal( double kmax);86 ElementMatrix* PenaltyCreateKMatrixMelting( double kmax);87 ElementVector* PenaltyCreatePVectorThermal( double kmax);88 ElementVector* PenaltyCreatePVectorMelting( double kmax);85 ElementMatrix* PenaltyCreateKMatrixThermal(IssmDouble kmax); 86 ElementMatrix* PenaltyCreateKMatrixMelting(IssmDouble kmax); 87 ElementVector* PenaltyCreatePVectorThermal(IssmDouble kmax); 88 ElementVector* PenaltyCreatePVectorMelting(IssmDouble kmax); 89 89 #endif 90 90 void ConstraintActivate(int* punstable); 91 91 void ConstraintActivateThermal(int* punstable); 92 void UpdateInputs( double* solution);92 void UpdateInputs(IssmDouble* solution); 93 93 void ResetConstraint(void); 94 94 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Penpair.cpp
r12330 r12706 4 4 5 5 /*Headers*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 23 23 24 24 /*Penpair constructors and destructor*/ 25 /*FUNCTION Penpair::constructor {{{ 1*/25 /*FUNCTION Penpair::constructor {{{*/ 26 26 Penpair::Penpair(){ 27 27 … … 31 31 return; 32 32 } 33 /*}}} 1*/34 /*FUNCTION Penpair::creation {{{ 1*/33 /*}}}*/ 34 /*FUNCTION Penpair::creation {{{*/ 35 35 Penpair::Penpair(int penpair_id, int* penpair_node_ids,int in_analysis_type){ 36 36 … … 43 43 return; 44 44 } 45 /*}}} 1*/46 /*FUNCTION Penpair::destructor {{{ 1*/45 /*}}}*/ 46 /*FUNCTION Penpair::destructor {{{*/ 47 47 Penpair::~Penpair(){ 48 48 delete hnodes; 49 49 return; 50 50 } 51 /*}}} 1*/51 /*}}}*/ 52 52 53 53 /*Object virtual functions definitions:*/ 54 /*FUNCTION Penpair::Echo {{{ 1*/54 /*FUNCTION Penpair::Echo {{{*/ 55 55 void Penpair::Echo(void){ 56 56 57 57 int i; 58 58 59 printf("Penpair:\n");60 printf(" id: %i\n",id);61 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));59 _printLine_("Penpair:"); 60 _printLine_(" id: " << id); 61 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 62 62 hnodes->Echo(); 63 63 64 64 return; 65 65 } 66 /*}}} 1*/67 /*FUNCTION Penpair::DeepEcho {{{ 1*/66 /*}}}*/ 67 /*FUNCTION Penpair::DeepEcho {{{*/ 68 68 void Penpair::DeepEcho(void){ 69 69 70 printf("Penpair:\n");71 printf(" id: %i\n",id);72 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));70 _printLine_("Penpair:"); 71 _printLine_(" id: " << id); 72 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 73 73 hnodes->DeepEcho(); 74 74 75 75 return; 76 76 } 77 /*}}} 1*/78 /*FUNCTION Penpair::Id {{{ 1*/77 /*}}}*/ 78 /*FUNCTION Penpair::Id {{{*/ 79 79 int Penpair::Id(void){ return id; } 80 /*}}} 1*/81 /*FUNCTION Penpair::MyRank {{{ 1*/80 /*}}}*/ 81 /*FUNCTION Penpair::MyRank {{{*/ 82 82 int Penpair::MyRank(void){ 83 83 extern int my_rank; 84 84 return my_rank; 85 85 } 86 /*}}} 1*/87 /*FUNCTION Penpair::ObjectEnum{{{ 1*/86 /*}}}*/ 87 /*FUNCTION Penpair::ObjectEnum{{{*/ 88 88 int Penpair::ObjectEnum(void){ 89 89 90 90 return PenpairEnum; 91 91 } 92 /*}}} 1*/93 /*FUNCTION Penpair::copy {{{ 1*/92 /*}}}*/ 93 /*FUNCTION Penpair::copy {{{*/ 94 94 Object* Penpair::copy() { 95 95 … … 115 115 116 116 /*Load virtual functions definitions:*/ 117 /*FUNCTION Penpair::Configure {{{ 1*/117 /*FUNCTION Penpair::Configure {{{*/ 118 118 void Penpair::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 119 119 … … 129 129 130 130 } 131 /*}}} 1*/132 /*FUNCTION Penpair::SetCurrentConfiguration {{{ 1*/131 /*}}}*/ 132 /*FUNCTION Penpair::SetCurrentConfiguration {{{*/ 133 133 void Penpair::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 134 134 135 135 } 136 /*}}} 1*/137 /*FUNCTION Penpair::CreateKMatrix {{{ 1*/136 /*}}}*/ 137 /*FUNCTION Penpair::CreateKMatrix {{{*/ 138 138 void Penpair::CreateKMatrix(Matrix* Kff, Matrix* Kfs){ 139 139 /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/ … … 142 142 143 143 } 144 /*}}} 1*/145 /*FUNCTION Penpair::CreatePVector {{{ 1*/144 /*}}}*/ 145 /*FUNCTION Penpair::CreatePVector {{{*/ 146 146 void Penpair::CreatePVector(Vector* pf){ 147 147 … … 150 150 151 151 } 152 /*}}} 1*/153 /*FUNCTION Penpair::CreateJacobianMatrix{{{ 1*/152 /*}}}*/ 153 /*FUNCTION Penpair::CreateJacobianMatrix{{{*/ 154 154 void Penpair::CreateJacobianMatrix(Matrix* Jff){ 155 155 this->CreateKMatrix(Jff,NULL); 156 156 } 157 /*}}} 1*/158 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{ 1*/159 void Penpair::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){157 /*}}}*/ 158 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{*/ 159 void Penpair::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 160 160 161 161 /*Retrieve parameters: */ … … 172 172 break; 173 173 default: 174 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));174 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 175 175 } 176 176 … … 181 181 } 182 182 } 183 /*}}} 1*/184 /*FUNCTION Penpair::PenaltyCreatePVector {{{ 1*/185 void Penpair::PenaltyCreatePVector(Vector* pf, double kmax){183 /*}}}*/ 184 /*FUNCTION Penpair::PenaltyCreatePVector {{{*/ 185 void Penpair::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 186 186 /*No loads applied, do nothing: */ 187 187 return; 188 188 } 189 /*}}} 1*/190 /*FUNCTION Penpair::PenaltyCreateJacobianMatrix{{{ 1*/191 void Penpair::PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){189 /*}}}*/ 190 /*FUNCTION Penpair::PenaltyCreateJacobianMatrix{{{*/ 191 void Penpair::PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){ 192 192 this->PenaltyCreateKMatrix(Jff,NULL,kmax); 193 193 } 194 /*}}} 1*/195 /*FUNCTION Penpair::InAnalysis{{{ 1*/194 /*}}}*/ 195 /*FUNCTION Penpair::InAnalysis{{{*/ 196 196 bool Penpair::InAnalysis(int in_analysis_type){ 197 197 if (in_analysis_type==this->analysis_type)return true; … … 201 201 202 202 /*Update virtual functions definitions:*/ 203 /*FUNCTION Penpair::InputUpdateFromConstant( double constant, int name) {{{1*/204 void Penpair::InputUpdateFromConstant( double constant, int name){205 /*Nothing updated yet*/ 206 } 207 /*}}}*/ 208 /*FUNCTION Penpair::InputUpdateFromConstant(int constant, int name) {{{ 1*/203 /*FUNCTION Penpair::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 204 void Penpair::InputUpdateFromConstant(IssmDouble constant, int name){ 205 /*Nothing updated yet*/ 206 } 207 /*}}}*/ 208 /*FUNCTION Penpair::InputUpdateFromConstant(int constant, int name) {{{*/ 209 209 void Penpair::InputUpdateFromConstant(int constant, int name){ 210 210 /*Nothing updated yet*/ 211 211 } 212 212 /*}}}*/ 213 /*FUNCTION Penpair::InputUpdateFromConstant(bool constant, int name) {{{ 1*/213 /*FUNCTION Penpair::InputUpdateFromConstant(bool constant, int name) {{{*/ 214 214 void Penpair::InputUpdateFromConstant(bool constant, int name){ 215 215 /*Nothing updated yet*/ 216 216 } 217 217 /*}}}*/ 218 /*FUNCTION Penpair::InputUpdateFromVector( double* vector, int name, int type) {{{1*/219 void Penpair::InputUpdateFromVector( double* vector, int name, int type){220 /*Nothing updated yet*/ 221 } 222 /*}}}*/ 223 /*FUNCTION Penpair::InputUpdateFromVector(int* vector, int name, int type) {{{ 1*/218 /*FUNCTION Penpair::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 219 void Penpair::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 220 /*Nothing updated yet*/ 221 } 222 /*}}}*/ 223 /*FUNCTION Penpair::InputUpdateFromVector(int* vector, int name, int type) {{{*/ 224 224 void Penpair::InputUpdateFromVector(int* vector, int name, int type){ 225 225 /*Nothing updated yet*/ 226 226 } 227 227 /*}}}*/ 228 /*FUNCTION Penpair::InputUpdateFromVector(bool* vector, int name, int type) {{{ 1*/228 /*FUNCTION Penpair::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ 229 229 void Penpair::InputUpdateFromVector(bool* vector, int name, int type){ 230 230 /*Nothing updated yet*/ … … 233 233 234 234 /*Penpair management:*/ 235 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticHoriz{{{ 1*/236 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticHoriz( double kmax){235 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticHoriz{{{*/ 236 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax){ 237 237 238 238 int approximation0=nodes[0]->GetApproximation(); … … 244 244 case MacAyealApproximationEnum: return PenaltyCreateKMatrixDiagnosticMacAyealPattyn(kmax); 245 245 case PattynApproximationEnum: return PenaltyCreateKMatrixDiagnosticMacAyealPattyn(kmax); 246 default: _error _("not supported yet");246 default: _error2_("not supported yet"); 247 247 } 248 248 case PattynApproximationEnum: … … 250 250 case MacAyealApproximationEnum: return PenaltyCreateKMatrixDiagnosticMacAyealPattyn(kmax); 251 251 case PattynApproximationEnum: return PenaltyCreateKMatrixDiagnosticMacAyealPattyn(kmax); 252 default: _error _("not supported yet");252 default: _error2_("not supported yet"); 253 253 } 254 254 case StokesApproximationEnum: … … 256 256 case StokesApproximationEnum: return PenaltyCreateKMatrixDiagnosticStokes(kmax); 257 257 case NoneApproximationEnum: return PenaltyCreateKMatrixDiagnosticStokes(kmax); 258 default: _error _("not supported yet");258 default: _error2_("not supported yet"); 259 259 } 260 260 case NoneApproximationEnum: … … 262 262 case StokesApproximationEnum: return PenaltyCreateKMatrixDiagnosticStokes(kmax); 263 263 case NoneApproximationEnum: return PenaltyCreateKMatrixDiagnosticStokes(kmax); 264 default: _error _("not supported yet");264 default: _error2_("not supported yet"); 265 265 } 266 default: _error _("not supported yet");266 default: _error2_("not supported yet"); 267 267 } 268 268 } 269 /*}}} 1*/270 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn {{{ 1*/271 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn( double kmax){269 /*}}}*/ 270 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn {{{*/ 271 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn(IssmDouble kmax){ 272 272 273 273 const int numdof=NUMVERTICES*NDOF2; 274 double penalty_offset;274 IssmDouble penalty_offset; 275 275 276 276 /*Initialize Element vector and return if necessary*/ … … 281 281 282 282 //Create elementary matrix: add penalty to 283 Ke->values[0*numdof+0]=+kmax*pow(( double)10.0,penalty_offset);284 Ke->values[0*numdof+2]=-kmax*pow(( double)10.0,penalty_offset);285 Ke->values[2*numdof+0]=-kmax*pow(( double)10.0,penalty_offset);286 Ke->values[2*numdof+2]=+kmax*pow(( double)10.0,penalty_offset);287 288 Ke->values[1*numdof+1]=+kmax*pow(( double)10.0,penalty_offset);289 Ke->values[1*numdof+3]=-kmax*pow(( double)10.0,penalty_offset);290 Ke->values[3*numdof+1]=-kmax*pow(( double)10.0,penalty_offset);291 Ke->values[3*numdof+3]=+kmax*pow(( double)10.0,penalty_offset);283 Ke->values[0*numdof+0]=+kmax*pow((IssmDouble)10.0,penalty_offset); 284 Ke->values[0*numdof+2]=-kmax*pow((IssmDouble)10.0,penalty_offset); 285 Ke->values[2*numdof+0]=-kmax*pow((IssmDouble)10.0,penalty_offset); 286 Ke->values[2*numdof+2]=+kmax*pow((IssmDouble)10.0,penalty_offset); 287 288 Ke->values[1*numdof+1]=+kmax*pow((IssmDouble)10.0,penalty_offset); 289 Ke->values[1*numdof+3]=-kmax*pow((IssmDouble)10.0,penalty_offset); 290 Ke->values[3*numdof+1]=-kmax*pow((IssmDouble)10.0,penalty_offset); 291 Ke->values[3*numdof+3]=+kmax*pow((IssmDouble)10.0,penalty_offset); 292 292 293 293 /*Clean up and return*/ 294 294 return Ke; 295 295 } 296 /*}}} 1*/297 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticStokes {{{ 1*/298 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticStokes( double kmax){296 /*}}}*/ 297 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticStokes {{{*/ 298 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax){ 299 299 300 300 const int numdof=NUMVERTICES*NDOF4; 301 double penalty_offset;301 IssmDouble penalty_offset; 302 302 303 303 /*Initialize Element vector and return if necessary*/ … … 308 308 309 309 //Create elementary matrix: add penalty to 310 Ke->values[0*numdof+0]=+kmax*pow(( double)10.0,penalty_offset);311 Ke->values[0*numdof+4]=-kmax*pow(( double)10.0,penalty_offset);312 Ke->values[4*numdof+0]=-kmax*pow(( double)10.0,penalty_offset);313 Ke->values[4*numdof+4]=+kmax*pow(( double)10.0,penalty_offset);314 315 Ke->values[1*numdof+1]=+kmax*pow(( double)10.0,penalty_offset);316 Ke->values[1*numdof+5]=-kmax*pow(( double)10.0,penalty_offset);317 Ke->values[5*numdof+1]=-kmax*pow(( double)10.0,penalty_offset);318 Ke->values[5*numdof+5]=+kmax*pow(( double)10.0,penalty_offset);319 320 Ke->values[2*numdof+2]=+kmax*pow(( double)10.0,penalty_offset);321 Ke->values[2*numdof+6]=-kmax*pow(( double)10.0,penalty_offset);322 Ke->values[6*numdof+2]=-kmax*pow(( double)10.0,penalty_offset);323 Ke->values[6*numdof+6]=+kmax*pow(( double)10.0,penalty_offset);324 325 Ke->values[3*numdof+3]=+kmax*pow(( double)10.0,penalty_offset);326 Ke->values[3*numdof+7]=-kmax*pow(( double)10.0,penalty_offset);327 Ke->values[7*numdof+3]=-kmax*pow(( double)10.0,penalty_offset);328 Ke->values[7*numdof+7]=+kmax*pow(( double)10.0,penalty_offset);310 Ke->values[0*numdof+0]=+kmax*pow((IssmDouble)10.0,penalty_offset); 311 Ke->values[0*numdof+4]=-kmax*pow((IssmDouble)10.0,penalty_offset); 312 Ke->values[4*numdof+0]=-kmax*pow((IssmDouble)10.0,penalty_offset); 313 Ke->values[4*numdof+4]=+kmax*pow((IssmDouble)10.0,penalty_offset); 314 315 Ke->values[1*numdof+1]=+kmax*pow((IssmDouble)10.0,penalty_offset); 316 Ke->values[1*numdof+5]=-kmax*pow((IssmDouble)10.0,penalty_offset); 317 Ke->values[5*numdof+1]=-kmax*pow((IssmDouble)10.0,penalty_offset); 318 Ke->values[5*numdof+5]=+kmax*pow((IssmDouble)10.0,penalty_offset); 319 320 Ke->values[2*numdof+2]=+kmax*pow((IssmDouble)10.0,penalty_offset); 321 Ke->values[2*numdof+6]=-kmax*pow((IssmDouble)10.0,penalty_offset); 322 Ke->values[6*numdof+2]=-kmax*pow((IssmDouble)10.0,penalty_offset); 323 Ke->values[6*numdof+6]=+kmax*pow((IssmDouble)10.0,penalty_offset); 324 325 Ke->values[3*numdof+3]=+kmax*pow((IssmDouble)10.0,penalty_offset); 326 Ke->values[3*numdof+7]=-kmax*pow((IssmDouble)10.0,penalty_offset); 327 Ke->values[7*numdof+3]=-kmax*pow((IssmDouble)10.0,penalty_offset); 328 Ke->values[7*numdof+7]=+kmax*pow((IssmDouble)10.0,penalty_offset); 329 329 330 330 /*Clean up and return*/ 331 331 return Ke; 332 332 } 333 /*}}} 1*/334 /*FUNCTION Penpair::PenaltyCreateKMatrixPrognostic {{{ 1*/335 ElementMatrix* Penpair::PenaltyCreateKMatrixPrognostic( double kmax){333 /*}}}*/ 334 /*FUNCTION Penpair::PenaltyCreateKMatrixPrognostic {{{*/ 335 ElementMatrix* Penpair::PenaltyCreateKMatrixPrognostic(IssmDouble kmax){ 336 336 337 337 const int numdof=NUMVERTICES*NDOF1; 338 double penalty_factor;338 IssmDouble penalty_factor; 339 339 340 340 /*Initialize Element vector and return if necessary*/ … … 345 345 346 346 //Create elementary matrix: add penalty to 347 Ke->values[0*numdof+0]=+kmax*pow(( double)10.0,penalty_factor);348 Ke->values[0*numdof+1]=-kmax*pow(( double)10.0,penalty_factor);349 Ke->values[1*numdof+0]=-kmax*pow(( double)10.0,penalty_factor);350 Ke->values[1*numdof+1]=+kmax*pow(( double)10.0,penalty_factor);347 Ke->values[0*numdof+0]=+kmax*pow((IssmDouble)10.0,penalty_factor); 348 Ke->values[0*numdof+1]=-kmax*pow((IssmDouble)10.0,penalty_factor); 349 Ke->values[1*numdof+0]=-kmax*pow((IssmDouble)10.0,penalty_factor); 350 Ke->values[1*numdof+1]=+kmax*pow((IssmDouble)10.0,penalty_factor); 351 351 352 352 /*Clean up and return*/ 353 353 return Ke; 354 354 } 355 /*}}} 1*/355 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Penpair.h
r12330 r12706 6 6 7 7 /*Headers:*/ 8 /*{{{ 1*/8 /*{{{*/ 9 9 #include "./Load.h" 10 10 #include "../Node.h" … … 27 27 public: 28 28 29 /*Penpair constructors, destructors: {{{ 1*/29 /*Penpair constructors, destructors: {{{*/ 30 30 Penpair(); 31 31 Penpair(int penpair_id,int* penpair_node_ids,int analysis_type); 32 32 ~Penpair(); 33 33 /*}}}*/ 34 /*Object virtual functions definitions:{{{ 1*/34 /*Object virtual functions definitions:{{{ */ 35 35 void Echo(); 36 36 void DeepEcho(); … … 40 40 Object* copy(); 41 41 /*}}}*/ 42 /*Update virtual functions resolution: {{{ 1*/43 void InputUpdateFromVector( double* vector, int name, int type);42 /*Update virtual functions resolution: {{{*/ 43 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 44 44 void InputUpdateFromVector(int* vector, int name, int type); 45 45 void InputUpdateFromVector(bool* vector, int name, int type); 46 void InputUpdateFromMatrixDakota( double* matrix, int nrow, int ncols,int name, int type){_error_("Not implemented yet!");}47 void InputUpdateFromVectorDakota( double* vector, int name, int type){_error_("Not implemented yet!");}48 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error _("Not implemented yet!");}49 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error _("Not implemented yet!");}50 void InputUpdateFromConstant( double constant, int name);46 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrow, int ncols,int name, int type){_error2_("Not implemented yet!");} 47 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error2_("Not implemented yet!");} 48 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error2_("Not implemented yet!");} 49 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error2_("Not implemented yet!");} 50 void InputUpdateFromConstant(IssmDouble constant, int name); 51 51 void InputUpdateFromConstant(int constant, int name); 52 52 void InputUpdateFromConstant(bool constant, int name); 53 void InputUpdateFromSolution( double* solution){_error_("Not implemented yet!");}54 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("not implemented yet");};53 void InputUpdateFromSolution(IssmDouble* solution){_error2_("Not implemented yet!");} 54 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("not implemented yet");}; 55 55 /*}}}*/ 56 /*Load virtual functions definitions: {{{ 1*/56 /*Load virtual functions definitions: {{{*/ 57 57 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 58 58 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); … … 60 60 void CreatePVector(Vector* pf); 61 61 void CreateJacobianMatrix(Matrix* Jff); 62 void PenaltyCreateKMatrix(Matrix* Kff,Matrix* Kfs, double kmax);63 void PenaltyCreatePVector(Vector* pf, double kmax);64 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax);62 void PenaltyCreateKMatrix(Matrix* Kff,Matrix* Kfs,IssmDouble kmax); 63 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 64 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax); 65 65 bool InAnalysis(int analysis_type); 66 66 /*}}}*/ 67 /*Penpair management: {{{ 1*/68 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz( double kmax);69 ElementMatrix* PenaltyCreateKMatrixDiagnosticMacAyealPattyn( double kmax);70 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes( double kmax);71 ElementMatrix* PenaltyCreateKMatrixPrognostic( double kmax);67 /*Penpair management: {{{*/ 68 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax); 69 ElementMatrix* PenaltyCreateKMatrixDiagnosticMacAyealPattyn(IssmDouble kmax); 70 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax); 71 ElementMatrix* PenaltyCreateKMatrixPrognostic(IssmDouble kmax); 72 72 /*}}}*/ 73 73 }; -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 24 24 25 25 /*Riftfront constructors and destructor*/ 26 /*FUNCTION Riftfront::Riftfront(){{{ 1*/26 /*FUNCTION Riftfront::Riftfront(){{{*/ 27 27 Riftfront::Riftfront(){ 28 28 this->inputs=NULL; … … 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel,int analysis_type){{{ 1*/38 /*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel,int analysis_type){{{*/ 39 39 Riftfront::Riftfront(int riftfront_id,int i, IoModel* iomodel,int riftfront_analysis_type){ 40 40 … … 45 45 int riftfront_type; 46 46 int riftfront_fill; 47 double riftfront_friction;48 double riftfront_fractionincrement;47 IssmDouble riftfront_friction; 48 IssmDouble riftfront_fractionincrement; 49 49 bool riftfront_shelf; 50 50 int numberofelements; … … 117 117 118 118 } 119 /*}}} 1*/120 /*FUNCTION Riftfront::~Riftfront(){{{ 1*/119 /*}}}*/ 120 /*FUNCTION Riftfront::~Riftfront(){{{*/ 121 121 Riftfront::~Riftfront(){ 122 122 delete inputs; … … 130 130 131 131 /*Object virtual functions definitions:*/ 132 /*FUNCTION Riftfront::Echo {{{ 1*/132 /*FUNCTION Riftfront::Echo {{{*/ 133 133 void Riftfront::Echo(void){ 134 134 135 135 Input* input=NULL; 136 136 int fill; 137 double friction,fractionincrement;137 IssmDouble friction,fractionincrement; 138 138 139 139 … … 143 143 input=(Input*)this->inputs->GetInput(FractionIncrementEnum); input->GetInputValue(&fractionincrement); 144 144 145 printf("Riftfront:\n");146 printf(" id: %i\n",id);147 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));148 printf(" hnodes: %p\n",hnodes);149 printf(" helements: %p\n",helements);150 printf(" hmatpar: %p\n",hmatpar);151 printf(" parameters: %p\n",parameters);152 printf(" inputs: %p\n",inputs);153 printf(" internal parameters: \n");154 printf(" normal: %g|%g\n",normal[0],normal[1]);155 printf(" length: %g\n",length);156 printf(" penalty_lock: %i\n",penalty_lock);157 printf(" active: %s\n",active ? "true":"false");158 printf(" counter: %i\n",counter);159 printf(" prestable: %s\n",prestable ? "true":"false");160 printf(" material_converged: %s\n",material_converged ? "true":"false");161 printf(" fill: %i\n",fill);162 printf(" friction: %g\n",friction);163 printf(" fraction: %g\n",fraction);164 printf(" fractionincrement: %g\n",fractionincrement);165 printf(" state: %i\n",state);166 printf(" frozen: %s\n",frozen ? "true":"false");145 _printLine_("Riftfront:"); 146 _printLine_(" id: " << id); 147 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 148 _printLine_(" hnodes: " << hnodes); 149 _printLine_(" helements: " << helements); 150 _printLine_(" hmatpar: " << hmatpar); 151 _printLine_(" parameters: " << parameters); 152 _printLine_(" inputs: " << inputs); 153 _printLine_(" internal parameters: "); 154 _printLine_(" normal: " << normal[0] << "|" << normal[1]); 155 _printLine_(" length: " << length); 156 _printLine_(" penalty_lock: " << penalty_lock); 157 _printLine_(" active: " <<(active ? "true":"false")); 158 _printLine_(" counter: " << counter); 159 _printLine_(" prestable: " << (prestable ? "true":"false")); 160 _printLine_(" material_converged: " << (material_converged ? "true":"false")); 161 _printLine_(" fill: " << fill); 162 _printLine_(" friction: " << friction); 163 _printLine_(" fraction: " << fraction); 164 _printLine_(" fractionincrement: " << fractionincrement); 165 _printLine_(" state: " << state); 166 _printLine_(" frozen: " << (frozen ? "true":"false")); 167 167 168 168 } 169 /*}}} 1*/170 /*FUNCTION Riftfront::DeepEcho{{{ 1*/169 /*}}}*/ 170 /*FUNCTION Riftfront::DeepEcho{{{*/ 171 171 void Riftfront::DeepEcho(void){ 172 172 173 printf("Riftfront:\n");174 printf(" id: %i\n",id);175 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));173 _printLine_("Riftfront:"); 174 _printLine_(" id: " << id); 175 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 176 176 hnodes->DeepEcho(); 177 177 helements->DeepEcho(); 178 178 hmatpar->DeepEcho(); 179 printf(" parameters\n");179 _printLine_(" parameters"); 180 180 if(parameters)parameters->DeepEcho(); 181 printf(" inputs\n");181 _printLine_(" inputs"); 182 182 if(inputs)inputs->DeepEcho(); 183 183 } 184 184 /*}}}*/ 185 /*FUNCTION Riftfront::Id {{{ 1*/185 /*FUNCTION Riftfront::Id {{{*/ 186 186 int Riftfront::Id(void){ return id; } 187 /*}}} 1*/188 /*FUNCTION Riftfront::MyRank {{{ 1*/187 /*}}}*/ 188 /*FUNCTION Riftfront::MyRank {{{*/ 189 189 int Riftfront::MyRank(void){ 190 190 extern int my_rank; 191 191 return my_rank; 192 192 } 193 /*}}} 1*/194 /*FUNCTION Riftfront::ObjectEnum{{{ 1*/193 /*}}}*/ 194 /*FUNCTION Riftfront::ObjectEnum{{{*/ 195 195 int Riftfront::ObjectEnum(void){ 196 196 … … 198 198 199 199 } 200 /*}}} 1*/201 /*FUNCTION Riftfront::copy {{{ 1*/200 /*}}}*/ 201 /*FUNCTION Riftfront::copy {{{*/ 202 202 Object* Riftfront::copy() { 203 203 … … 247 247 248 248 /*Update virtual functions definitions:*/ 249 /*FUNCTION Riftfront::InputUpdateFromConstant(bool constant,int name) {{{ 1*/249 /*FUNCTION Riftfront::InputUpdateFromConstant(bool constant,int name) {{{*/ 250 250 void Riftfront::InputUpdateFromConstant(bool constant,int name){ 251 251 … … 258 258 } 259 259 /*}}}*/ 260 /*FUNCTION Riftfront::InputUpdateFromConstant( double constant,int name) {{{1*/261 void Riftfront::InputUpdateFromConstant( double constant,int name){260 /*FUNCTION Riftfront::InputUpdateFromConstant(IssmDouble constant,int name) {{{*/ 261 void Riftfront::InputUpdateFromConstant(IssmDouble constant,int name){ 262 262 263 263 /*Check that name is a Riftfront input*/ … … 269 269 } 270 270 /*}}}*/ 271 /*FUNCTION Riftfront::InputUpdateFromConstant( double* constant,int name) {{{1*/272 void Riftfront::InputUpdateFromVector( double* vector, int name, int type){271 /*FUNCTION Riftfront::InputUpdateFromConstant(IssmDouble* constant,int name) {{{*/ 272 void Riftfront::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 273 273 274 274 /*Check that name is a Riftfront input*/ … … 276 276 277 277 /*update input*/ 278 _error _("not implemented yet");278 _error2_("not implemented yet"); 279 279 //this->inputs->AddInput(new DoubleInput(name,constant)); 280 280 … … 284 284 285 285 /*Load virtual functions definitions:*/ 286 /*FUNCTION Riftfront::Configure {{{ 1*/286 /*FUNCTION Riftfront::Configure {{{*/ 287 287 void Riftfront::Configure(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 288 288 … … 303 303 } 304 304 /*}}}*/ 305 /*FUNCTION Riftfront::SetCurrentConfiguration {{{ 1*/305 /*FUNCTION Riftfront::SetCurrentConfiguration {{{*/ 306 306 void Riftfront::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 307 307 308 308 } 309 309 /*}}}*/ 310 /*FUNCTION Riftfront::PenaltyCreateKMatrix {{{ 1*/311 void Riftfront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){310 /*FUNCTION Riftfront::PenaltyCreateKMatrix {{{*/ 311 void Riftfront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 312 312 313 313 /*Retrieve parameters: */ … … 324 324 break; 325 325 default: 326 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));326 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 327 327 } 328 328 … … 333 333 } 334 334 } 335 /*}}} 1*/336 /*FUNCTION Riftfront::PenaltyCreatePVector {{{ 1*/337 void Riftfront::PenaltyCreatePVector(Vector* pf, double kmax){335 /*}}}*/ 336 /*FUNCTION Riftfront::PenaltyCreatePVector {{{*/ 337 void Riftfront::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 338 338 339 339 /*Retrieve parameters: */ … … 350 350 break; 351 351 default: 352 _error _("analysis %i (%s) not supported yet",analysis_type,EnumToStringx(analysis_type));352 _error2_("analysis " << analysis_type << " (" << EnumToStringx(analysis_type) << ") not supported yet"); 353 353 } 354 354 … … 359 359 } 360 360 } 361 /*}}} 1*/362 /*FUNCTION Riftfront::CreateKMatrix {{{ 1*/361 /*}}}*/ 362 /*FUNCTION Riftfront::CreateKMatrix {{{*/ 363 363 void Riftfront::CreateKMatrix(Matrix* Kff, Matrix* Kfs){ 364 364 /*do nothing: */ 365 365 return; 366 366 } 367 /*}}} 1*/368 /*FUNCTION Riftfront::CreatePVector {{{ 1*/367 /*}}}*/ 368 /*FUNCTION Riftfront::CreatePVector {{{*/ 369 369 void Riftfront::CreatePVector(Vector* pf){ 370 370 /*do nothing: */ 371 371 return; 372 372 } 373 /*}}} 1*/374 /*FUNCTION Riftfront::InAnalysis{{{ 1*/373 /*}}}*/ 374 /*FUNCTION Riftfront::InAnalysis{{{*/ 375 375 bool Riftfront::InAnalysis(int in_analysis_type){ 376 376 if (in_analysis_type==this->analysis_type) return true; … … 380 380 381 381 /*Riftfront numerics*/ 382 /*FUNCTION Riftfront::PenaltyCreateKMatrixDiagnosticHoriz {{{ 1*/383 ElementMatrix* Riftfront::PenaltyCreateKMatrixDiagnosticHoriz( double kmax){382 /*FUNCTION Riftfront::PenaltyCreateKMatrixDiagnosticHoriz {{{*/ 383 ElementMatrix* Riftfront::PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax){ 384 384 385 385 const int numdof = NDOF2*NUMVERTICES; 386 386 int i,j; 387 387 int dofs[1] = {0}; 388 double Ke_gg[4][4];389 double thickness;390 double h[2];391 double penalty_offset;392 double friction;388 IssmDouble Ke_gg[4][4]; 389 IssmDouble thickness; 390 IssmDouble h[2]; 391 IssmDouble penalty_offset; 392 IssmDouble friction; 393 393 394 394 /*Objects: */ … … 397 397 398 398 /*enum of element? */ 399 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");399 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 400 400 tria1=(Tria*)elements[0]; 401 401 tria2=(Tria*)elements[1]; … … 410 410 tria1->GetInputValue(&h[0],nodes[0],ThicknessEnum); 411 411 tria2->GetInputValue(&h[1],nodes[1],ThicknessEnum); 412 if (h[0]!=h[1])_error _("different thicknesses not supported for rift fronts");412 if (h[0]!=h[1])_error2_("different thicknesses not supported for rift fronts"); 413 413 thickness=h[0]; 414 414 … … 462 462 return Ke; 463 463 } 464 /*}}} 1*/465 /*FUNCTION Riftfront::PenaltyCreatePVectorDiagnosticHoriz {{{ 1*/466 ElementVector* Riftfront::PenaltyCreatePVectorDiagnosticHoriz( double kmax){464 /*}}}*/ 465 /*FUNCTION Riftfront::PenaltyCreatePVectorDiagnosticHoriz {{{*/ 466 ElementVector* Riftfront::PenaltyCreatePVectorDiagnosticHoriz(IssmDouble kmax){ 467 467 468 468 const int numdof = NDOF2*NUMVERTICES; 469 469 int i,j; 470 double rho_ice;471 double rho_water;472 double gravity;473 double thickness;474 double h[2];475 double bed;476 double b[2];477 double pressure;478 double pressure_litho;479 double pressure_air;480 double pressure_melange;481 double pressure_water;470 IssmDouble rho_ice; 471 IssmDouble rho_water; 472 IssmDouble gravity; 473 IssmDouble thickness; 474 IssmDouble h[2]; 475 IssmDouble bed; 476 IssmDouble b[2]; 477 IssmDouble pressure; 478 IssmDouble pressure_litho; 479 IssmDouble pressure_air; 480 IssmDouble pressure_melange; 481 IssmDouble pressure_water; 482 482 int fill; 483 483 bool shelf; … … 488 488 489 489 /*enum of element? */ 490 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");490 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 491 491 tria1=(Tria*)elements[0]; 492 492 tria2=(Tria*)elements[1]; … … 504 504 tria1->GetInputValue(&h[0],nodes[0],ThicknessEnum); 505 505 tria2->GetInputValue(&h[1],nodes[1],ThicknessEnum); 506 if (h[0]!=h[1])_error _("different thicknesses not supported for rift fronts");506 if (h[0]!=h[1])_error2_("different thicknesses not supported for rift fronts"); 507 507 thickness=h[0]; 508 508 tria1->GetInputValue(&b[0],nodes[0],BedEnum); 509 509 tria2->GetInputValue(&b[1],nodes[1],BedEnum); 510 if (b[0]!=b[1])_error _("different beds not supported for rift fronts");510 if (b[0]!=b[1])_error2_("different beds not supported for rift fronts"); 511 511 bed=b[0]; 512 512 … … 521 521 if(shelf){ 522 522 /*We are on an ice shelf, hydrostatic equilibrium is used to determine the pressure for water fill: */ 523 pressure=rho_ice*gravity*pow(thickness,( double)2)/(double)2 - rho_water*gravity*pow(bed,(double)2)/(double)2;523 pressure=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2 - rho_water*gravity*pow(bed,(IssmDouble)2)/(IssmDouble)2; 524 524 } 525 525 else{ 526 526 //We are on an icesheet, we assume the water column fills the entire front: */ 527 pressure=rho_ice*gravity*pow(thickness,( double)2)/(double)2 - rho_water*gravity*pow(thickness,(double)2)/(double)2;527 pressure=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2 - rho_water*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2; 528 528 } 529 529 } 530 530 else if(fill==AirEnum){ 531 pressure=rho_ice*gravity*pow(thickness,( double)2)/(double)2; //icefront on an ice sheet, pressure imbalance ice vs air.531 pressure=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2; //icefront on an ice sheet, pressure imbalance ice vs air. 532 532 } 533 533 else if(fill==IceEnum){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice) … … 536 536 else if(fill==MelangeEnum){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice) 537 537 538 if(!shelf) _error _("%s%i%s","fill type ",fill," not supported on ice sheets yet.");539 540 pressure_litho=rho_ice*gravity*pow(thickness,( double)2)/(double)2;538 if(!shelf) _error2_("fill type " << fill << " not supported on ice sheets yet."); 539 540 pressure_litho=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2; 541 541 pressure_air=0; 542 pressure_melange=rho_ice*gravity*pow(fraction*thickness,( double)2)/(double)2;542 pressure_melange=rho_ice*gravity*pow(fraction*thickness,(IssmDouble)2)/(IssmDouble)2; 543 543 pressure_water=1.0/2.0*rho_water*gravity* ( pow(bed,2.0)-pow(rho_ice/rho_water*fraction*thickness,2.0) ); 544 544 … … 546 546 } 547 547 else{ 548 _error _("%s%i%s","fill type ",fill," not supported yet.");548 _error2_("fill type " << fill << " not supported yet."); 549 549 } 550 550 … … 562 562 return pe; 563 563 } 564 /*}}} 1*/565 /*FUNCTION Riftfront::Constrain {{{ 1*/564 /*}}}*/ 565 /*FUNCTION Riftfront::Constrain {{{*/ 566 566 #define _ZIGZAGCOUNTER_ 567 567 … … 569 569 570 570 const int numnodes = 2; 571 double max_penetration;572 double penetration;571 IssmDouble max_penetration; 572 IssmDouble penetration; 573 573 int activate; 574 574 int found; 575 575 int unstable; 576 double vx1;577 double vy1;578 double vx2;579 double vy2;580 double fractionincrement;576 IssmDouble vx1; 577 IssmDouble vy1; 578 IssmDouble vx2; 579 IssmDouble vy2; 580 IssmDouble fractionincrement; 581 581 582 582 /*Objects: */ … … 585 585 586 586 /*enum of element? */ 587 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");587 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 588 588 589 589 /*recover elements on both side of rift: */ … … 632 632 /*increase melange fraction: */ 633 633 this->fraction+=fractionincrement; 634 if (this->fraction>1)this->fraction=( double)1.0;635 // printf("riftfront %i fraction: %g\n",this->Id(),this->fraction);634 if (this->fraction>1)this->fraction=(IssmDouble)1.0; 635 //_printLine_("riftfront " << this->Id() << " fraction: " << this->fraction); 636 636 } 637 637 … … 648 648 this->active=activate; 649 649 650 //if ((penetration>0) && (this->active==1)) printf("Riftfront %i wants to be released\n",Id());650 //if ((penetration>0) && (this->active==1))_printLine_("Riftfront " << Id() << " wants to be released"); 651 651 652 652 /*assign output pointer: */ … … 654 654 return 1; 655 655 } 656 /*}}} 1*/657 /*FUNCTION Riftfront::FreezeConstraints{{{ 1*/656 /*}}}*/ 657 /*FUNCTION Riftfront::FreezeConstraints{{{*/ 658 658 void Riftfront::FreezeConstraints(void){ 659 659 … … 662 662 663 663 } 664 /*}}} 1*/665 /*FUNCTION Riftfront::IsFrozen{{{ 1*/664 /*}}}*/ 665 /*FUNCTION Riftfront::IsFrozen{{{*/ 666 666 bool Riftfront::IsFrozen(void){ 667 667 … … 670 670 else return 0; 671 671 } 672 /*}}} 1*/673 /*FUNCTION Riftfront::IsMaterialStable {{{ 1*/672 /*}}}*/ 673 /*FUNCTION Riftfront::IsMaterialStable {{{*/ 674 674 int Riftfront::IsMaterialStable(void){ 675 675 676 676 int found=0; 677 double converged=0;677 IssmDouble converged=0; 678 678 679 679 this->inputs->GetInputValue(&converged,ConvergedEnum); … … 688 688 return this->material_converged; 689 689 } 690 /*}}} 1*/691 /*FUNCTION Riftfront::MaxPenetration {{{ 1*/692 int Riftfront::MaxPenetration( double* ppenetration){690 /*}}}*/ 691 /*FUNCTION Riftfront::MaxPenetration {{{*/ 692 int Riftfront::MaxPenetration(IssmDouble* ppenetration){ 693 693 694 694 const int numnodes=2; 695 double max_penetration;696 double penetration=0;695 IssmDouble max_penetration; 696 IssmDouble penetration=0; 697 697 int found; 698 double vx1;699 double vy1;700 double vx2;701 double vy2;698 IssmDouble vx1; 699 IssmDouble vy1; 700 IssmDouble vx2; 701 IssmDouble vy2; 702 702 703 703 /*Objects: */ … … 706 706 707 707 /*enum of element? */ 708 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");708 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 709 709 710 710 /*recover elements on both side of rift: */ … … 734 734 return 1; 735 735 } 736 /*}}} 1*/737 /*FUNCTION Riftfront::Penetration {{{ 1*/738 int Riftfront::Penetration( double* ppenetration){739 740 double vx1;741 double vy1;742 double vx2;743 double vy2;744 745 double penetration;736 /*}}}*/ 737 /*FUNCTION Riftfront::Penetration {{{*/ 738 int Riftfront::Penetration(IssmDouble* ppenetration){ 739 740 IssmDouble vx1; 741 IssmDouble vy1; 742 IssmDouble vx2; 743 IssmDouble vy2; 744 745 IssmDouble penetration; 746 746 int found; 747 747 … … 751 751 752 752 /*enum of element? */ 753 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");753 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 754 754 755 755 /*recover elements on both side of rift: */ … … 773 773 return 1; 774 774 } 775 /*}}} 1*/776 /*FUNCTION Riftfront::PotentialUnstableConstraint {{{ 1*/775 /*}}}*/ 776 /*FUNCTION Riftfront::PotentialUnstableConstraint {{{*/ 777 777 int Riftfront::PotentialUnstableConstraint(int* punstable){ 778 778 779 779 780 780 const int numnodes = 2; 781 double max_penetration;782 double penetration;781 IssmDouble max_penetration; 782 IssmDouble penetration; 783 783 int activate; 784 784 int unstable; 785 785 int found; 786 double vx1;787 double vy1;788 double vx2;789 double vy2;786 IssmDouble vx1; 787 IssmDouble vy1; 788 IssmDouble vx2; 789 IssmDouble vy2; 790 790 791 791 /*Objects: */ … … 794 794 795 795 /*enum of element? */ 796 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");796 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 797 797 798 798 /*recover elements on both side of rift: */ … … 826 826 return 1; 827 827 } 828 /*}}} 1*/829 /*FUNCTION Riftfront::PreConstrain {{{ 1*/828 /*}}}*/ 829 /*FUNCTION Riftfront::PreConstrain {{{*/ 830 830 int Riftfront::PreConstrain(int* punstable){ 831 831 832 832 const int numnodes = 2; 833 double penetration;833 IssmDouble penetration; 834 834 int unstable; 835 835 int found; 836 double vx1;837 double vy1;838 double vx2;839 double vy2;836 IssmDouble vx1; 837 IssmDouble vy1; 838 IssmDouble vx2; 839 IssmDouble vy2; 840 840 841 841 /*Objects: */ … … 844 844 845 845 /*enum of element? */ 846 if(elements[0]->ObjectEnum()!=TriaEnum)_error _("only Tria element allowed for Riftfront load!");846 if(elements[0]->ObjectEnum()!=TriaEnum)_error2_("only Tria element allowed for Riftfront load!"); 847 847 848 848 /*recover elements on both side of rift: */ … … 891 891 return 1; 892 892 } 893 /*}}} 1*/894 /*FUNCTION Riftfront::PreStable {{{ 1*/893 /*}}}*/ 894 /*FUNCTION Riftfront::PreStable {{{*/ 895 895 bool Riftfront::PreStable(){ 896 896 return prestable; 897 897 } 898 /*}}} 1*/899 /*FUNCTION Riftfront::SetPreStable {{{ 1*/898 /*}}}*/ 899 /*FUNCTION Riftfront::SetPreStable {{{*/ 900 900 void Riftfront::SetPreStable(){ 901 901 prestable=1; 902 902 } 903 /*}}} 1*/904 /*FUNCTION Riftfront::IsInput{{{ 1*/903 /*}}}*/ 904 /*FUNCTION Riftfront::IsInput{{{*/ 905 905 bool Riftfront::IsInput(int name){ 906 906 if ( -
issm/trunk/src/c/objects/Loads/Riftfront.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Load.h" 11 11 class Hook; … … 38 38 bool prestable; 39 39 bool material_converged; 40 double normal[2];41 double length;42 double fraction;40 IssmDouble normal[2]; 41 IssmDouble length; 42 IssmDouble fraction; 43 43 int state; 44 44 … … 47 47 48 48 49 /*Riftfrontconstructors,destructors: {{{ 1*/49 /*Riftfrontconstructors,destructors: {{{*/ 50 50 Riftfront(); 51 51 Riftfront(int riftfront_id,int i, IoModel* iomodel,int analysis_type); 52 52 ~Riftfront(); 53 53 /*}}}*/ 54 /*Object virtual functions definitions:{{{ 1*/54 /*Object virtual functions definitions:{{{ */ 55 55 void Echo(); 56 56 void DeepEcho(); … … 60 60 Object* copy(); 61 61 /*}}}*/ 62 /*Update virtual functions resolution: {{{ 1*/63 void InputUpdateFromVector( double* vector, int name, int type);64 void InputUpdateFromVector(int* vector, int name, int type){_error _("Not implemented yet!");}65 void InputUpdateFromVector(bool* vector, int name, int type){_error _("Not implemented yet!");}66 void InputUpdateFromMatrixDakota( double* matrix, int nrows,int ncols, int name, int type){_error_("Not implemented yet!");}67 void InputUpdateFromVectorDakota( double* vector, int name, int type){_error_("Not implemented yet!");}68 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error _("Not implemented yet!");}69 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error _("Not implemented yet!");}70 void InputUpdateFromConstant( double constant, int name);71 void InputUpdateFromConstant(int constant, int name){_error _("Not implemented yet!");}62 /*Update virtual functions resolution: {{{*/ 63 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 64 void InputUpdateFromVector(int* vector, int name, int type){_error2_("Not implemented yet!");} 65 void InputUpdateFromVector(bool* vector, int name, int type){_error2_("Not implemented yet!");} 66 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows,int ncols, int name, int type){_error2_("Not implemented yet!");} 67 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error2_("Not implemented yet!");} 68 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error2_("Not implemented yet!");} 69 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error2_("Not implemented yet!");} 70 void InputUpdateFromConstant(IssmDouble constant, int name); 71 void InputUpdateFromConstant(int constant, int name){_error2_("Not implemented yet!");} 72 72 void InputUpdateFromConstant(bool constant, int name); 73 void InputUpdateFromSolution( double* solution){_error_("Not implemented yet!");}74 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("not implemented yet");};73 void InputUpdateFromSolution(IssmDouble* solution){_error2_("Not implemented yet!");} 74 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("not implemented yet");}; 75 75 /*}}}*/ 76 /*Load virtual functions definitions: {{{ 1*/76 /*Load virtual functions definitions: {{{*/ 77 77 void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 78 78 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 79 79 void CreateKMatrix(Matrix* Kff, Matrix* Kfs); 80 80 void CreatePVector(Vector* pf); 81 void CreateJacobianMatrix(Matrix* Jff){_error _("Not implemented yet");};82 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){_error_("Not implemented yet");};83 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);84 void PenaltyCreatePVector(Vector* pf, double kmax);81 void CreateJacobianMatrix(Matrix* Jff){_error2_("Not implemented yet");}; 82 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error2_("Not implemented yet");}; 83 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 84 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 85 85 bool InAnalysis(int analysis_type); 86 86 /*}}}*/ 87 /*Riftfront specific routines: {{{ 1*/87 /*Riftfront specific routines: {{{*/ 88 88 bool PreStable(); 89 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz( double kmax);90 ElementVector* PenaltyCreatePVectorDiagnosticHoriz( double kmax);89 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax); 90 ElementVector* PenaltyCreatePVectorDiagnosticHoriz(IssmDouble kmax); 91 91 void SetPreStable(); 92 92 int PreConstrain(int* punstable); … … 94 94 void FreezeConstraints(void); 95 95 bool IsFrozen(void); 96 int Penetration( double* ppenetration);97 int MaxPenetration( double* ppenetration);96 int Penetration(IssmDouble* ppenetration); 97 int MaxPenetration(IssmDouble* ppenetration); 98 98 int PotentialUnstableConstraint(int* punstable); 99 99 int IsMaterialStable(void); -
issm/trunk/src/c/objects/Materials/Material.h
r11995 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 class Object; 12 12 #include "../Object.h" -
issm/trunk/src/c/objects/Materials/Matice.cpp
r12330 r12706 17 17 18 18 /*Matice constructors and destructor*/ 19 /*FUNCTION Matice::Matice(){{{ 1*/19 /*FUNCTION Matice::Matice(){{{*/ 20 20 Matice::Matice(){ 21 21 this->inputs=NULL; … … 24 24 } 25 25 /*}}}*/ 26 /*FUNCTION Matice::Matice(int id, int index, IoModel* iomodel, int num_vertices){{{ 1*/26 /*FUNCTION Matice::Matice(int id, int index, IoModel* iomodel, int num_vertices){{{*/ 27 27 Matice::Matice(int matice_mid,int index, IoModel* iomodel){ 28 28 … … 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION Matice::~Matice(){{{ 1*/50 /*FUNCTION Matice::~Matice(){{{*/ 51 51 Matice::~Matice(){ 52 52 delete helement; … … 57 57 58 58 /*Object virtual functions definitions:*/ 59 /*FUNCTION Matice::Echo {{{ 1*/59 /*FUNCTION Matice::Echo {{{*/ 60 60 void Matice::Echo(void){ 61 61 62 printf("Matice:\n");63 printf(" mid: %i\n",mid);64 printf(" inputs:\n");62 _printLine_("Matice:"); 63 _printLine_(" mid: " << mid); 64 _printLine_(" inputs:"); 65 65 inputs->Echo(); 66 printf(" element:\n");66 _printLine_(" element:"); 67 67 helement->Echo(); 68 68 } 69 69 /*}}}*/ 70 /*FUNCTION Matice::DeepEcho {{{ 1*/70 /*FUNCTION Matice::DeepEcho {{{*/ 71 71 void Matice::DeepEcho(void){ 72 72 73 printf("Matice:\n");74 printf(" mid: %i\n",mid);75 printf(" inputs:\n");73 _printLine_("Matice:"); 74 _printLine_(" mid: " << mid); 75 _printLine_(" inputs:"); 76 76 inputs->DeepEcho(); 77 printf(" element:\n");77 _printLine_(" element:"); 78 78 helement->Echo(); 79 79 } 80 80 /*}}}*/ 81 /*FUNCTION Matice::Id {{{ 1*/81 /*FUNCTION Matice::Id {{{*/ 82 82 int Matice::Id(void){ return mid; } 83 83 /*}}}*/ 84 /*FUNCTION Matice::MyRank {{{ 1*/84 /*FUNCTION Matice::MyRank {{{*/ 85 85 int Matice::MyRank(void){ 86 86 extern int my_rank; … … 88 88 } 89 89 /*}}}*/ 90 /*FUNCTION Matice::ObjectEnum{{{ 1*/90 /*FUNCTION Matice::ObjectEnum{{{*/ 91 91 int Matice::ObjectEnum(void){ 92 92 … … 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION Matice::copy {{{ 1*/97 /*FUNCTION Matice::copy {{{*/ 98 98 Object* Matice::copy() { 99 99 … … 115 115 116 116 /*Matice management*/ 117 /*FUNCTION Matice::Configure {{{ 1*/117 /*FUNCTION Matice::Configure {{{*/ 118 118 void Matice::Configure(Elements* elementsin){ 119 119 … … 123 123 } 124 124 /*}}}*/ 125 /*FUNCTION Matice::SetCurrentConfiguration {{{ 1*/125 /*FUNCTION Matice::SetCurrentConfiguration {{{*/ 126 126 void Matice::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ 127 127 128 128 } 129 129 /*}}}*/ 130 /*FUNCTION Matice::GetB {{{ 1*/131 double Matice::GetB(){130 /*FUNCTION Matice::GetB {{{*/ 131 IssmDouble Matice::GetB(){ 132 132 133 133 /*Output*/ 134 double B;134 IssmDouble B; 135 135 136 136 inputs->GetInputAverage(&B,MaterialsRheologyBEnum); … … 138 138 } 139 139 /*}}}*/ 140 /*FUNCTION Matice::GetBbar {{{ 1*/141 double Matice::GetBbar(){140 /*FUNCTION Matice::GetBbar {{{*/ 141 IssmDouble Matice::GetBbar(){ 142 142 143 143 /*Output*/ 144 double Bbar;144 IssmDouble Bbar; 145 145 146 146 inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum); … … 148 148 } 149 149 /*}}}*/ 150 /*FUNCTION Matice::GetN {{{ 1*/151 double Matice::GetN(){150 /*FUNCTION Matice::GetN {{{*/ 151 IssmDouble Matice::GetN(){ 152 152 153 153 /*Output*/ 154 double n;154 IssmDouble n; 155 155 156 156 inputs->GetInputAverage(&n,MaterialsRheologyNEnum); … … 158 158 } 159 159 /*}}}*/ 160 /*FUNCTION Matice::GetVectorFromInputs{{{ 1*/160 /*FUNCTION Matice::GetVectorFromInputs{{{*/ 161 161 void Matice::GetVectorFromInputs(Vector* vector,int input_enum){ 162 162 … … 180 180 /*Get input (either in element or material)*/ 181 181 Input* input=inputs->GetInput(input_enum); 182 if(!input) _error _("Input %s not found in material",EnumToStringx(input_enum));182 if(!input) _error2_("Input " << EnumToStringx(input_enum) << " not found in material"); 183 183 184 184 /*We found the enum. Use its values to fill into the vector, using the vertices ids: */ … … 186 186 break; 187 187 188 default: _error _("element %s not implemented yet",EnumToStringx(element->ObjectEnum()));189 } 190 } 191 /*}}}*/ 192 /*FUNCTION Matice::GetViscosity2d {{{ 1*/193 void Matice::GetViscosity2d( double* pviscosity, double* epsilon){188 default: _error2_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); 189 } 190 } 191 /*}}}*/ 192 /*FUNCTION Matice::GetViscosity2d {{{*/ 193 void Matice::GetViscosity2d(IssmDouble* pviscosity, IssmDouble* epsilon){ 194 194 /*From a string tensor and a material object, return viscosity, using Glen's flow law. 195 195 B … … 205 205 206 206 /*output: */ 207 double viscosity;207 IssmDouble viscosity; 208 208 209 209 /*input strain rate: */ 210 double exx,eyy,exy;210 IssmDouble exx,eyy,exy; 211 211 212 212 /*Intermediary: */ 213 double A,e;214 double B,n;213 IssmDouble A,e; 214 IssmDouble B,n; 215 215 216 216 /*Get B and n*/ … … 224 224 else{ 225 225 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ 226 viscosity=0.5*pow(( double)10,(double)14);226 viscosity=0.5*pow((IssmDouble)10,(IssmDouble)14); 227 227 } 228 228 else{ … … 236 236 if(A==0){ 237 237 /*Maxiviscositym viscosity for 0 shear areas: */ 238 viscosity=2.5*pow(( double)10,(double)17);238 viscosity=2.5*pow((IssmDouble)10,(IssmDouble)17); 239 239 } 240 240 else{ … … 246 246 247 247 /*Checks in debugging mode*/ 248 if(viscosity<=0) _error _("Negative viscosity");248 if(viscosity<=0) _error2_("Negative viscosity"); 249 249 _assert_(B>0); 250 250 _assert_(n>0); … … 254 254 } 255 255 /*}}}*/ 256 /*FUNCTION Matice::GetViscosity3d {{{ 1*/257 void Matice::GetViscosity3d( double* pviscosity3d, double* epsilon){256 /*FUNCTION Matice::GetViscosity3d {{{*/ 257 void Matice::GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* epsilon){ 258 258 259 259 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: … … 271 271 272 272 /*output: */ 273 double viscosity3d;273 IssmDouble viscosity3d; 274 274 275 275 /*input strain rate: */ 276 double exx,eyy,exy,exz,eyz;276 IssmDouble exx,eyy,exy,exz,eyz; 277 277 278 278 /*Intermediaries: */ 279 double A,e;280 double B,n;279 IssmDouble A,e; 280 IssmDouble B,n; 281 281 282 282 /*Get B and n*/ … … 291 291 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 292 292 (epsilon[3]==0) && (epsilon[4]==0)){ 293 viscosity3d=0.5*pow(( double)10,(double)14);293 viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); 294 294 } 295 295 else{ … … 306 306 if(A==0){ 307 307 /*Maxiviscosity3dm viscosity for 0 shear areas: */ 308 viscosity3d=2.25*pow(( double)10,(double)17);308 viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); 309 309 } 310 310 else{ … … 317 317 318 318 /*Checks in debugging mode*/ 319 if(viscosity3d<=0) _error _("Negative viscosity");319 if(viscosity3d<=0) _error2_("Negative viscosity"); 320 320 _assert_(B>0); 321 321 _assert_(n>0); … … 325 325 } 326 326 /*}}}*/ 327 /*FUNCTION Matice::GetViscosity3dStokes {{{ 1*/328 void Matice::GetViscosity3dStokes( double* pviscosity3d, double* epsilon){327 /*FUNCTION Matice::GetViscosity3dStokes {{{*/ 328 void Matice::GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon){ 329 329 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: 330 330 * … … 341 341 342 342 /*output: */ 343 double viscosity3d;343 IssmDouble viscosity3d; 344 344 345 345 /*input strain rate: */ 346 double exx,eyy,exy,exz,eyz,ezz;346 IssmDouble exx,eyy,exy,exz,eyz,ezz; 347 347 348 348 /*Intermediaries: */ 349 double A,e;350 double B,n;351 double eps0;349 IssmDouble A,e; 350 IssmDouble B,n; 351 IssmDouble eps0; 352 352 353 353 /*Get B and n*/ 354 eps0=pow(( double)10,(double)-27);354 eps0=pow((IssmDouble)10,(IssmDouble)-27); 355 355 B=GetB(); 356 356 n=GetN(); … … 363 363 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 364 364 (epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){ 365 viscosity3d=0.5*pow(( double)10,(double)14);365 viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); 366 366 } 367 367 else{ … … 379 379 if(A==0){ 380 380 /*Maxiviscosity3dm viscosity for 0 shear areas: */ 381 viscosity3d=2.25*pow(( double)10,(double)17);381 viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); 382 382 } 383 383 else{ … … 389 389 390 390 /*Checks in debugging mode*/ 391 if(viscosity3d<=0) _error _("Negative viscosity");391 if(viscosity3d<=0) _error2_("Negative viscosity"); 392 392 _assert_(B>0); 393 393 _assert_(n>0); … … 397 397 } 398 398 /*}}}*/ 399 /*FUNCTION Matice::GetViscosityComplement {{{ 1*/400 void Matice::GetViscosityComplement( double* pviscosity_complement, double* epsilon){399 /*FUNCTION Matice::GetViscosityComplement {{{*/ 400 void Matice::GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){ 401 401 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: 402 402 * … … 410 410 411 411 /*output: */ 412 double viscosity_complement;412 IssmDouble viscosity_complement; 413 413 414 414 /*input strain rate: */ 415 double exx,eyy,exy;415 IssmDouble exx,eyy,exy; 416 416 417 417 /*Intermediary value A and exponent e: */ 418 double A,e;419 double B,n;418 IssmDouble A,e; 419 IssmDouble B,n; 420 420 421 421 /*Get B and n*/ … … 432 432 if(A==0){ 433 433 /*Maximum viscosity_complement for 0 shear areas: */ 434 viscosity_complement=2.25*pow(( double)10,(double)17);434 viscosity_complement=2.25*pow((IssmDouble)10,(IssmDouble)17); 435 435 } 436 436 else{ … … 441 441 } 442 442 else{ 443 viscosity_complement=4.5*pow(( double)10,(double)17);443 viscosity_complement=4.5*pow((IssmDouble)10,(IssmDouble)17); 444 444 } 445 445 … … 453 453 } 454 454 /*}}}*/ 455 /*FUNCTION Matice::GetViscosityDerivativeEpsSquare{{{ 1*/456 void Matice::GetViscosityDerivativeEpsSquare( double* pmu_prime, double* epsilon){455 /*FUNCTION Matice::GetViscosityDerivativeEpsSquare{{{*/ 456 void Matice::GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ 457 457 458 458 /*output: */ 459 double mu_prime;460 double mu,n,eff2;459 IssmDouble mu_prime; 460 IssmDouble mu,n,eff2; 461 461 462 462 /*input strain rate: */ 463 double exx,eyy,exy,exz,eyz;463 IssmDouble exx,eyy,exy,exz,eyz; 464 464 465 465 /*Get visocisty and n*/ … … 469 469 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 470 470 (epsilon[3]==0) && (epsilon[4]==0)){ 471 mu_prime=0.5*pow(( double)10,(double)14);471 mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); 472 472 } 473 473 else{ … … 487 487 } 488 488 /*}}}*/ 489 /*FUNCTION Matice::GetViscosity2dDerivativeEpsSquare{{{ 1*/490 void Matice::GetViscosity2dDerivativeEpsSquare( double* pmu_prime, double* epsilon){489 /*FUNCTION Matice::GetViscosity2dDerivativeEpsSquare{{{*/ 490 void Matice::GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ 491 491 492 492 /*output: */ 493 double mu_prime;494 double mu,n,eff2;493 IssmDouble mu_prime; 494 IssmDouble mu,n,eff2; 495 495 496 496 /*input strain rate: */ 497 double exx,eyy,exy,exz;497 IssmDouble exx,eyy,exy,exz; 498 498 499 499 /*Get visocisty and n*/ … … 502 502 503 503 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ 504 mu_prime=0.5*pow(( double)10,(double)14);504 mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); 505 505 } 506 506 else{ … … 518 518 } 519 519 /*}}}*/ 520 /*FUNCTION Matice::InputDuplicate{{{ 1*/520 /*FUNCTION Matice::InputDuplicate{{{*/ 521 521 void Matice::InputDuplicate(int original_enum,int new_enum){ 522 522 … … 526 526 } 527 527 /*}}}*/ 528 /*FUNCTION Matice::InputUpdateFromVector( double* vector, int name, int type) {{{1*/529 void Matice::InputUpdateFromVector( double* vector, int name, int type){528 /*FUNCTION Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 529 void Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 530 530 531 531 /*Intermediaries*/ … … 544 544 switch(element->ObjectEnum()){ 545 545 546 case TriaEnum: 547 double values[3];546 case TriaEnum: { 547 IssmDouble values[3]; 548 548 for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetVertexDof()]; 549 549 this->inputs->AddInput(new TriaP1Input(name,values)); 550 550 return; 551 552 default: _error _("element %s not implemented yet",EnumToStringx(element->ObjectEnum()));553 } 554 default: _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));555 } 556 } 557 /*}}}*/ 558 /*FUNCTION Matice::InputUpdateFromVector(int* vector, int name, int type) {{{ 1*/551 } 552 default: _error2_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); 553 } 554 default: _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 555 } 556 } 557 /*}}}*/ 558 /*FUNCTION Matice::InputUpdateFromVector(int* vector, int name, int type) {{{*/ 559 559 void Matice::InputUpdateFromVector(int* vector, int name, int type){ 560 560 /*Nothing updated yet*/ 561 561 } 562 562 /*}}}*/ 563 /*FUNCTION Matice::InputUpdateFromVector(bool* vector, int name, int type) {{{ 1*/563 /*FUNCTION Matice::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ 564 564 void Matice::InputUpdateFromVector(bool* vector, int name, int type){ 565 565 /*Nothing updated yet*/ 566 566 } 567 567 /*}}}*/ 568 /*FUNCTION Matice::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{1*/569 void Matice::InputUpdateFromVectorDakota( double* vector, int name, int type){568 /*FUNCTION Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 569 void Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 570 570 571 571 /*Intermediaries*/ … … 586 586 switch(element->ObjectEnum()){ 587 587 588 case TriaEnum: 589 double values[3];588 case TriaEnum: { 589 IssmDouble values[3]; 590 590 for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetSidList()]; //use sid list, to index into serial oriented vector 591 591 this->inputs->AddInput(new TriaP1Input(name,values)); 592 /*Special case for rheology B in 2D: Pourave land for this solution{{{ 2*/592 /*Special case for rheology B in 2D: Pourave land for this solution{{{*/ 593 593 if(name==MaterialsRheologyBEnum){ 594 594 /*Are we in 2D?:*/ … … 607 607 /*}}}*/ 608 608 return; 609 610 default: _error _("element %s not implemented yet",EnumToStringx(element->ObjectEnum()));611 } 612 default: _error _("type %i (%s) not implemented yet",type,EnumToStringx(type));613 } 614 615 616 617 } 618 /*}}}*/ 619 /*FUNCTION Matice::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{ 1*/620 void Matice::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols,int name, int type){621 /*Nothing updated yet*/ 622 } 623 /*}}}*/ 624 /*FUNCTION Matice::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{ 1*/609 } 610 default: _error2_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); 611 } 612 default: _error2_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); 613 } 614 615 616 617 } 618 /*}}}*/ 619 /*FUNCTION Matice::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ 620 void Matice::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ 621 /*Nothing updated yet*/ 622 } 623 /*}}}*/ 624 /*FUNCTION Matice::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ 625 625 void Matice::InputUpdateFromVectorDakota(int* vector, int name, int type){ 626 626 /*Nothing updated yet*/ 627 627 } 628 628 /*}}}*/ 629 /*FUNCTION Matice::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{ 1*/629 /*FUNCTION Matice::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ 630 630 void Matice::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 631 631 /*Nothing updated yet*/ 632 632 } 633 633 /*}}}*/ 634 /*FUNCTION Matice::InputUpdateFromConstant( double constant, int name) {{{1*/635 void Matice::InputUpdateFromConstant( double constant, int name){636 /*Nothing updated yet*/ 637 } 638 /*}}}*/ 639 /*FUNCTION Matice::InputUpdateFromConstant(int constant, int name) {{{ 1*/634 /*FUNCTION Matice::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 635 void Matice::InputUpdateFromConstant(IssmDouble constant, int name){ 636 /*Nothing updated yet*/ 637 } 638 /*}}}*/ 639 /*FUNCTION Matice::InputUpdateFromConstant(int constant, int name) {{{*/ 640 640 void Matice::InputUpdateFromConstant(int constant, int name){ 641 641 /*Nothing updated yet*/ 642 642 } 643 643 /*}}}*/ 644 /*FUNCTION Matice::InputUpdateFromConstant(bool constant, int name) {{{ 1*/644 /*FUNCTION Matice::InputUpdateFromConstant(bool constant, int name) {{{*/ 645 645 void Matice::InputUpdateFromConstant(bool constant, int name){ 646 646 /*Nothing updated yet*/ 647 647 } 648 648 /*}}}*/ 649 /*FUNCTION Matice::InputUpdateFromSolution{{{ 1*/650 void Matice::InputUpdateFromSolution( double* solution){651 /*Nothing updated yet*/ 652 } 653 /*}}}*/ 654 /*FUNCTION Matice::InputUpdateFromIoModel{{{ 1*/649 /*FUNCTION Matice::InputUpdateFromSolution{{{*/ 650 void Matice::InputUpdateFromSolution(IssmDouble* solution){ 651 /*Nothing updated yet*/ 652 } 653 /*}}}*/ 654 /*FUNCTION Matice::InputUpdateFromIoModel{{{*/ 655 655 void Matice::InputUpdateFromIoModel(int index, IoModel* iomodel){ 656 656 … … 671 671 /*Intermediaries*/ 672 672 const int num_vertices = 3; //Tria has 3 vertices 673 double nodeinputs[num_vertices];674 double cmmininputs[num_vertices];675 double cmmaxinputs[num_vertices];673 IssmDouble nodeinputs[num_vertices]; 674 IssmDouble cmmininputs[num_vertices]; 675 IssmDouble cmmaxinputs[num_vertices]; 676 676 677 677 /*Get B*/ 678 678 if (iomodel->Data(MaterialsRheologyBEnum)) { 679 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[ int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)];679 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[reCast<int,IssmDouble>(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; 680 680 this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,nodeinputs)); 681 681 } … … 713 713 /*Intermediaries*/ 714 714 const int num_vertices = 6; //Penta has 6 vertices 715 double nodeinputs[num_vertices];716 double cmmininputs[num_vertices];717 double cmmaxinputs[num_vertices];715 IssmDouble nodeinputs[num_vertices]; 716 IssmDouble cmmininputs[num_vertices]; 717 IssmDouble cmmaxinputs[num_vertices]; 718 718 719 719 /*Get B*/ … … 750 750 #endif 751 751 else{ 752 _error _("Mesh type not supported yet!");752 _error2_("Mesh type not supported yet!"); 753 753 } 754 754 … … 756 756 } 757 757 /*}}}*/ 758 /*FUNCTION Matice::IsInput{{{ 1*/758 /*FUNCTION Matice::IsInput{{{*/ 759 759 bool Matice::IsInput(int name){ 760 760 if ( -
issm/trunk/src/c/objects/Materials/Matice.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Material.h" 11 11 class IoModel; … … 25 25 Inputs* inputs; 26 26 27 /*Matice constructors, destructors: {{{ 1*/27 /*Matice constructors, destructors: {{{*/ 28 28 Matice(); 29 29 Matice(int mid,int i, IoModel* iomodel); 30 30 ~Matice(); 31 31 /*}}}*/ 32 /*Object virtual functions definitions:{{{ 1*/32 /*Object virtual functions definitions:{{{ */ 33 33 void Echo(); 34 34 void DeepEcho(); … … 38 38 Object* copy(); 39 39 /*}}}*/ 40 /*Update virtual functions definitions: {{{ 1*/41 void InputUpdateFromVector( double* vector, int name, int type);40 /*Update virtual functions definitions: {{{*/ 41 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 42 42 void InputUpdateFromVector(int* vector, int name, int type); 43 43 void InputUpdateFromVector(bool* vector, int name, int type); 44 void InputUpdateFromMatrixDakota( double* matrix, int nrow, int ncols, int name, int type);45 void InputUpdateFromVectorDakota( double* vector, int name, int type);44 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrow, int ncols, int name, int type); 45 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 46 46 void InputUpdateFromVectorDakota(int* vector, int name, int type); 47 47 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 48 void InputUpdateFromConstant( double constant, int name);48 void InputUpdateFromConstant(IssmDouble constant, int name); 49 49 void InputUpdateFromConstant(int constant, int name); 50 50 void InputUpdateFromConstant(bool constant, int name); 51 void InputUpdateFromSolution( double* solution);51 void InputUpdateFromSolution(IssmDouble* solution); 52 52 void InputUpdateFromIoModel(int index, IoModel* iomodel); 53 53 /*}}}*/ 54 /*Material virtual functions resolution: {{{ 1*/54 /*Material virtual functions resolution: {{{*/ 55 55 void InputDuplicate(int original_enum,int new_enum); 56 56 void Configure(Elements* elements); 57 57 void GetVectorFromInputs(Vector* vector,int input_enum); 58 58 /*}}}*/ 59 /*Matice Numerics: {{{ 1*/59 /*Matice Numerics: {{{*/ 60 60 void SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin); 61 void GetViscosity2d( double* pviscosity, double* pepsilon);62 void GetViscosity3d( double* pviscosity3d, double* pepsilon);63 void GetViscosity3dStokes( double* pviscosity3d, double* epsilon);64 void GetViscosityComplement( double* pviscosity_complement, double* pepsilon);65 void GetViscosityDerivativeEpsSquare( double* pmu_prime, double* pepsilon);66 void GetViscosity2dDerivativeEpsSquare( double* pmu_prime, double* pepsilon);67 double GetB();68 double GetBbar();69 double GetN();61 void GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon); 62 void GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon); 63 void GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon); 64 void GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon); 65 void GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); 66 void GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); 67 IssmDouble GetB(); 68 IssmDouble GetBbar(); 69 IssmDouble GetN(); 70 70 bool IsInput(int name); 71 71 /*}}}*/ -
issm/trunk/src/c/objects/Materials/Matpar.cpp
r12330 r12706 17 17 18 18 /*Matpar constructors and destructor*/ 19 /*FUNCTION Matpar::Matpar() {{{ 1*/19 /*FUNCTION Matpar::Matpar() {{{*/ 20 20 Matpar::Matpar(){ 21 21 return; 22 22 } 23 /*}}} 1*/24 /*FUNCTION Matpar::Matpar(int matpar_mid,IoModel* iomodel){{{ 1*/23 /*}}}*/ 24 /*FUNCTION Matpar::Matpar(int matpar_mid,IoModel* iomodel){{{*/ 25 25 Matpar::Matpar(int matpar_mid, IoModel* iomodel){ 26 26 … … 46 46 iomodel->Constant(&this->hydro_q,HydrologyQEnum); 47 47 } 48 /*}}} 1*/49 /*FUNCTION Matpar::~Matpar() {{{ 1*/48 /*}}}*/ 49 /*FUNCTION Matpar::~Matpar() {{{*/ 50 50 Matpar::~Matpar(){ 51 51 return; 52 52 } 53 /*}}} 1*/53 /*}}}*/ 54 54 55 55 /*Object virtual functions definitions:*/ 56 /*FUNCTION Matpar::Echo {{{ 1*/56 /*FUNCTION Matpar::Echo {{{*/ 57 57 void Matpar::Echo(void){ 58 58 59 printf("Matpar:\n");60 printf(" mid: %i\n",mid);61 printf(" rho_ice: %g\n",rho_ice);62 printf(" rho_water: %g\n",rho_water);63 printf(" rho_freshwater: %g\n",rho_freshwater);64 printf(" mu_water: %g\n",mu_water);65 printf(" heatcapacity: %g\n",heatcapacity);66 printf(" thermalconductivity: %g\n",thermalconductivity);67 printf(" latentheat: %g\n",latentheat);68 printf(" beta: %g\n",beta);69 printf(" meltingpoint: %g\n",meltingpoint);70 printf(" referencetemperature: %g\n",referencetemperature);71 printf(" mixed_layer_capacity: %g\n",mixed_layer_capacity);72 printf(" thermal_exchange_velocity: %g\n",thermal_exchange_velocity);73 printf(" g: %g\n",g);59 _printLine_("Matpar:"); 60 _printLine_(" mid: " << mid); 61 _printLine_(" rho_ice: " << rho_ice); 62 _printLine_(" rho_water: " << rho_water); 63 _printLine_(" rho_freshwater: " << rho_freshwater); 64 _printLine_(" mu_water: " << mu_water); 65 _printLine_(" heatcapacity: " << heatcapacity); 66 _printLine_(" thermalconductivity: " << thermalconductivity); 67 _printLine_(" latentheat: " << latentheat); 68 _printLine_(" beta: " << beta); 69 _printLine_(" meltingpoint: " << meltingpoint); 70 _printLine_(" referencetemperature: " << referencetemperature); 71 _printLine_(" mixed_layer_capacity: " << mixed_layer_capacity); 72 _printLine_(" thermal_exchange_velocity: " << thermal_exchange_velocity); 73 _printLine_(" g: " << g); 74 74 return; 75 75 } 76 /*}}} 1*/77 /*FUNCTION Matpar::DeepEcho {{{ 1*/76 /*}}}*/ 77 /*FUNCTION Matpar::DeepEcho {{{*/ 78 78 void Matpar::DeepEcho(void){ 79 79 80 80 this->Echo(); 81 81 } 82 /*}}} 1*/83 /*FUNCTION Matpar::Id {{{ 1*/82 /*}}}*/ 83 /*FUNCTION Matpar::Id {{{*/ 84 84 int Matpar::Id(void){ return mid; } 85 /*}}} 1*/86 /*FUNCTION Matpar::MyRank {{{ 1*/85 /*}}}*/ 86 /*FUNCTION Matpar::MyRank {{{*/ 87 87 int Matpar::MyRank(void){ 88 88 extern int my_rank; 89 89 return my_rank; 90 90 } 91 /*}}} 1*/92 /*FUNCTION Matpar::ObjectEnum{{{ 1*/91 /*}}}*/ 92 /*FUNCTION Matpar::ObjectEnum{{{*/ 93 93 int Matpar::ObjectEnum(void){ 94 94 … … 96 96 97 97 } 98 /*}}} 1*/99 /*FUNCTION Matpar::copy {{{ 1*/98 /*}}}*/ 99 /*FUNCTION Matpar::copy {{{*/ 100 100 Object* Matpar::copy() { 101 101 return new Matpar(*this); 102 102 } 103 /*}}} 1*/103 /*}}}*/ 104 104 105 105 /*Update virtual functions definitions:*/ 106 /*FUNCTION Matpar::InputUpdateFromVector( double* vector, int name, int type) {{{1*/107 void Matpar::InputUpdateFromVector( double* vector, int name, int type){108 /*Nothing updated yet*/ 109 } 110 /*}}}*/ 111 /*FUNCTION Matpar::InputUpdateFromVector(int* vector, int name, int type) {{{ 1*/106 /*FUNCTION Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 107 void Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 108 /*Nothing updated yet*/ 109 } 110 /*}}}*/ 111 /*FUNCTION Matpar::InputUpdateFromVector(int* vector, int name, int type) {{{*/ 112 112 void Matpar::InputUpdateFromVector(int* vector, int name, int type){ 113 113 /*Nothing updated yet*/ 114 114 } 115 115 /*}}}*/ 116 /*FUNCTION Matpar::InputUpdateFromVector(bool* vector, int name, int type) {{{ 1*/116 /*FUNCTION Matpar::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ 117 117 void Matpar::InputUpdateFromVector(bool* vector, int name, int type){ 118 118 /*Nothing updated yet*/ 119 119 } 120 120 /*}}}*/ 121 /*FUNCTION Matpar::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{1*/122 void Matpar::InputUpdateFromVectorDakota( double* vector, int name, int type){123 /*Nothing updated yet*/ 124 } 125 /*}}}*/ 126 /*FUNCTION Matpar::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{ 1*/121 /*FUNCTION Matpar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 122 void Matpar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 123 /*Nothing updated yet*/ 124 } 125 /*}}}*/ 126 /*FUNCTION Matpar::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ 127 127 void Matpar::InputUpdateFromVectorDakota(int* vector, int name, int type){ 128 128 /*Nothing updated yet*/ 129 129 } 130 130 /*}}}*/ 131 /*FUNCTION Matpar::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{ 1*/131 /*FUNCTION Matpar::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ 132 132 void Matpar::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 133 133 /*Nothing updated yet*/ 134 134 } 135 135 /*}}}*/ 136 /*FUNCTION Matpar::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{ 1*/137 void Matpar::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols,int name, int type){138 /*Nothing updated yet*/ 139 } 140 /*}}}*/ 141 /*FUNCTION Matpar::InputUpdateFromConstant( double constant, int name) {{{1*/142 void Matpar::InputUpdateFromConstant( double constant, int name){136 /*FUNCTION Matpar::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ 137 void Matpar::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ 138 /*Nothing updated yet*/ 139 } 140 /*}}}*/ 141 /*FUNCTION Matpar::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 142 void Matpar::InputUpdateFromConstant(IssmDouble constant, int name){ 143 143 144 144 switch(name){ … … 188 188 } 189 189 /*}}}*/ 190 /*FUNCTION Matpar::InputUpdateFromConstant(int constant, int name) {{{ 1*/190 /*FUNCTION Matpar::InputUpdateFromConstant(int constant, int name) {{{*/ 191 191 void Matpar::InputUpdateFromConstant(int constant, int name){ 192 192 /*Nothing updated yet*/ 193 193 } 194 194 /*}}}*/ 195 /*FUNCTION Matpar::InputUpdateFromConstant(bool constant, int name) {{{ 1*/195 /*FUNCTION Matpar::InputUpdateFromConstant(bool constant, int name) {{{*/ 196 196 void Matpar::InputUpdateFromConstant(bool constant, int name){ 197 197 /*Nothing updated yet*/ 198 198 } 199 199 /*}}}*/ 200 /*FUNCTION Matpar::InputUpdateFromSolution{{{ 1*/201 void Matpar::InputUpdateFromSolution( double* solution){200 /*FUNCTION Matpar::InputUpdateFromSolution{{{*/ 201 void Matpar::InputUpdateFromSolution(IssmDouble* solution){ 202 202 /*Nothing updated yet*/ 203 203 } … … 205 205 206 206 /*Matpar management: */ 207 /*FUNCTION Matpar::Configure {{{ 1*/207 /*FUNCTION Matpar::Configure {{{*/ 208 208 void Matpar::Configure(Elements* elementsin){ 209 209 … … 212 212 } 213 213 /*}}}*/ 214 /*FUNCTION Matpar::GetBeta {{{ 1*/215 double Matpar::GetBeta(){214 /*FUNCTION Matpar::GetBeta {{{*/ 215 IssmDouble Matpar::GetBeta(){ 216 216 return beta; 217 217 } 218 /*}}} 1*/219 /*FUNCTION Matpar::GetG {{{ 1*/220 double Matpar::GetG(){218 /*}}}*/ 219 /*FUNCTION Matpar::GetG {{{*/ 220 IssmDouble Matpar::GetG(){ 221 221 return g; 222 222 } 223 /*}}} 1*/224 /*FUNCTION Matpar::GetHeatCapacity {{{ 1*/225 double Matpar::GetHeatCapacity(){223 /*}}}*/ 224 /*FUNCTION Matpar::GetHeatCapacity {{{*/ 225 IssmDouble Matpar::GetHeatCapacity(){ 226 226 return heatcapacity; 227 227 } 228 /*}}} 1*/229 /*FUNCTION Matpar::GetLatentHeat {{{ 1*/230 double Matpar::GetLatentHeat(){228 /*}}}*/ 229 /*FUNCTION Matpar::GetLatentHeat {{{*/ 230 IssmDouble Matpar::GetLatentHeat(){ 231 231 return latentheat; 232 232 } 233 /*}}} 1*/234 /*FUNCTION Matpar::GetMeltingPoint {{{ 1*/235 double Matpar::GetMeltingPoint(){233 /*}}}*/ 234 /*FUNCTION Matpar::GetMeltingPoint {{{*/ 235 IssmDouble Matpar::GetMeltingPoint(){ 236 236 return meltingpoint; 237 237 } 238 /*}}} 1*/239 /*FUNCTION Matpar::GetReferenceTemperature {{{ 1*/240 double Matpar::GetReferenceTemperature(){238 /*}}}*/ 239 /*FUNCTION Matpar::GetReferenceTemperature {{{*/ 240 IssmDouble Matpar::GetReferenceTemperature(){ 241 241 return referencetemperature; 242 242 } 243 /*}}} 1*/244 /*FUNCTION Matpar::GetMixedLayerCapacity {{{ 1*/245 double Matpar::GetMixedLayerCapacity(){243 /*}}}*/ 244 /*FUNCTION Matpar::GetMixedLayerCapacity {{{*/ 245 IssmDouble Matpar::GetMixedLayerCapacity(){ 246 246 return mixed_layer_capacity; 247 247 } 248 /*}}} 1*/249 /*FUNCTION Matpar::GetRhoIce {{{ 1*/250 double Matpar::GetRhoIce(){248 /*}}}*/ 249 /*FUNCTION Matpar::GetRhoIce {{{*/ 250 IssmDouble Matpar::GetRhoIce(){ 251 251 252 252 return rho_ice; 253 253 } 254 /*}}} 1*/255 /*FUNCTION Matpar::GetRhoWater {{{ 1*/256 double Matpar::GetRhoWater(){254 /*}}}*/ 255 /*FUNCTION Matpar::GetRhoWater {{{*/ 256 IssmDouble Matpar::GetRhoWater(){ 257 257 return rho_water; 258 258 } 259 /*}}} 1*/260 /*FUNCTION Matpar::GetRhoFreshwater {{{ 1*/261 double Matpar::GetRhoFreshwater(){259 /*}}}*/ 260 /*FUNCTION Matpar::GetRhoFreshwater {{{*/ 261 IssmDouble Matpar::GetRhoFreshwater(){ 262 262 return rho_freshwater; 263 263 } 264 /*}}} 1*/265 /*FUNCTION Matpar::GetMuWater {{{ 1*/266 double Matpar::GetMuWater(){264 /*}}}*/ 265 /*FUNCTION Matpar::GetMuWater {{{*/ 266 IssmDouble Matpar::GetMuWater(){ 267 267 return mu_water; 268 268 } 269 /*}}} 1*/270 /*FUNCTION Matpar::GetThermalConductivity {{{ 1*/271 double Matpar::GetThermalConductivity(){269 /*}}}*/ 270 /*FUNCTION Matpar::GetThermalConductivity {{{*/ 271 IssmDouble Matpar::GetThermalConductivity(){ 272 272 return thermalconductivity; 273 273 } 274 /*}}} 1*/275 /*FUNCTION Matpar::GetThermalExchangeVelocity {{{ 1*/276 double Matpar::GetThermalExchangeVelocity(){274 /*}}}*/ 275 /*FUNCTION Matpar::GetThermalExchangeVelocity {{{*/ 276 IssmDouble Matpar::GetThermalExchangeVelocity(){ 277 277 return thermal_exchange_velocity; 278 278 } 279 /*}}} 1*/280 /*FUNCTION Matpar::GetKn {{{ 1*/281 double Matpar::GetKn(){279 /*}}}*/ 280 /*FUNCTION Matpar::GetKn {{{*/ 281 IssmDouble Matpar::GetKn(){ 282 282 return kn; 283 283 } 284 /*}}} 1*/285 /*FUNCTION Matpar::GetHydrologyP {{{ 1*/286 double Matpar::GetHydrologyP(){284 /*}}}*/ 285 /*FUNCTION Matpar::GetHydrologyP {{{*/ 286 IssmDouble Matpar::GetHydrologyP(){ 287 287 return hydro_p; 288 288 } 289 /*}}} 1*/290 /*FUNCTION Matqar::GetHydrologyQ {{{ 1*/291 double Matpar::GetHydrologyQ(){289 /*}}}*/ 290 /*FUNCTION Matqar::GetHydrologyQ {{{*/ 291 IssmDouble Matpar::GetHydrologyQ(){ 292 292 return hydro_q; 293 293 } 294 /*}}} 1*/295 /*FUNCTION Matpar::GetHydrologyCR {{{ 1*/296 double Matpar::GetHydrologyCR(){294 /*}}}*/ 295 /*FUNCTION Matpar::GetHydrologyCR {{{*/ 296 IssmDouble Matpar::GetHydrologyCR(){ 297 297 return hydro_CR; 298 298 } 299 /*}}} 1*/300 /*FUNCTION Matpar::GetHydrologyN {{{ 1*/301 double Matpar::GetHydrologyN(){299 /*}}}*/ 300 /*FUNCTION Matpar::GetHydrologyN {{{*/ 301 IssmDouble Matpar::GetHydrologyN(){ 302 302 return hydro_n; 303 303 } 304 /*}}} 1*/305 /*FUNCTION Matpar::TMeltingPoint {{{ 1*/306 double Matpar::TMeltingPoint(double pressure){304 /*}}}*/ 305 /*FUNCTION Matpar::TMeltingPoint {{{*/ 306 IssmDouble Matpar::TMeltingPoint(IssmDouble pressure){ 307 307 return meltingpoint-beta*pressure; 308 308 } 309 /*}}} 1*/310 /*FUNCTION Matpar::PureIceEnthalpy{{{ 1*/311 double Matpar::PureIceEnthalpy(double pressure){309 /*}}}*/ 310 /*FUNCTION Matpar::PureIceEnthalpy{{{*/ 311 IssmDouble Matpar::PureIceEnthalpy(IssmDouble pressure){ 312 312 return heatcapacity*(TMeltingPoint(pressure)-referencetemperature); 313 313 } 314 /*}}} 1*/315 /*FUNCTION Matpar::GetEnthalpyDiffusionParameter{{{ 1*/316 double Matpar::GetEnthalpyDiffusionParameter(double enthalpy,double pressure){314 /*}}}*/ 315 /*FUNCTION Matpar::GetEnthalpyDiffusionParameter{{{*/ 316 IssmDouble Matpar::GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){ 317 317 if(enthalpy<PureIceEnthalpy(pressure)){ 318 318 return thermalconductivity/(rho_ice*heatcapacity); … … 322 322 } 323 323 } 324 /*}}} 1*/325 /*FUNCTION Matpar::EnthalpyToThermal {{{ 1*/326 void Matpar::EnthalpyToThermal( double* ptemperature,double* pwaterfraction,double enthalpy,double pressure){324 /*}}}*/ 325 /*FUNCTION Matpar::EnthalpyToThermal {{{*/ 326 void Matpar::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){ 327 327 328 328 /*Ouput*/ 329 double temperature,waterfraction;329 IssmDouble temperature,waterfraction; 330 330 331 331 if(enthalpy<PureIceEnthalpy(pressure)){ … … 342 342 *ptemperature=temperature; 343 343 } 344 /*}}} 1*/345 /*FUNCTION Matpar::ThermalToEnthalpy {{{ 1*/346 void Matpar::ThermalToEnthalpy( double * penthalpy,double temperature,double waterfraction,double pressure){344 /*}}}*/ 345 /*FUNCTION Matpar::ThermalToEnthalpy {{{*/ 346 void Matpar::ThermalToEnthalpy(IssmDouble * penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){ 347 347 348 348 /*Ouput*/ 349 double enthalpy;349 IssmDouble enthalpy; 350 350 351 351 if(temperature<TMeltingPoint(pressure)){ … … 359 359 *penthalpy=enthalpy; 360 360 } 361 /*}}} 1*/361 /*}}}*/ -
issm/trunk/src/c/objects/Materials/Matpar.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Material.h" 11 11 class IoModel; … … 16 16 private: 17 17 int mid; 18 double rho_ice;19 double rho_water;20 double rho_freshwater;21 double mu_water;22 double heatcapacity;23 double thermalconductivity;24 double latentheat;25 double beta;26 double meltingpoint;27 double referencetemperature;28 double mixed_layer_capacity;29 double thermal_exchange_velocity;30 double g;18 IssmDouble rho_ice; 19 IssmDouble rho_water; 20 IssmDouble rho_freshwater; 21 IssmDouble mu_water; 22 IssmDouble heatcapacity; 23 IssmDouble thermalconductivity; 24 IssmDouble latentheat; 25 IssmDouble beta; 26 IssmDouble meltingpoint; 27 IssmDouble referencetemperature; 28 IssmDouble mixed_layer_capacity; 29 IssmDouble thermal_exchange_velocity; 30 IssmDouble g; 31 31 32 32 /*hydrology: */ 33 double kn;34 double hydro_p;35 double hydro_q;36 double hydro_CR;37 double hydro_n;33 IssmDouble kn; 34 IssmDouble hydro_p; 35 IssmDouble hydro_q; 36 IssmDouble hydro_CR; 37 IssmDouble hydro_n; 38 38 39 39 public: … … 42 42 ~Matpar(); 43 43 44 /*Object virtual functions definitions:{{{ 1*/44 /*Object virtual functions definitions:{{{ */ 45 45 void Echo(); 46 46 void DeepEcho(); … … 50 50 Object* copy(); 51 51 /*}}}*/ 52 /*Update virtual functions resolution: {{{ 1*/53 void InputUpdateFromVector( double* vector, int name, int type);52 /*Update virtual functions resolution: {{{*/ 53 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 54 54 void InputUpdateFromVector(int* vector, int name, int type); 55 55 void InputUpdateFromVector(bool* vector, int name, int type); 56 void InputUpdateFromMatrixDakota( double* matrix,int nrows,int ncols, int name, int type);57 void InputUpdateFromVectorDakota( double* vector, int name, int type);56 void InputUpdateFromMatrixDakota(IssmDouble* matrix,int nrows,int ncols, int name, int type); 57 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 58 58 void InputUpdateFromVectorDakota(int* vector, int name, int type); 59 59 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 60 void InputUpdateFromConstant( double constant, int name);60 void InputUpdateFromConstant(IssmDouble constant, int name); 61 61 void InputUpdateFromConstant(int constant, int name); 62 62 void InputUpdateFromConstant(bool constant, int name); 63 void InputUpdateFromSolution( double* solution);64 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("not implemented yet");};63 void InputUpdateFromSolution(IssmDouble* solution); 64 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("not implemented yet");}; 65 65 /*}}}*/ 66 /*Material virtual functions resolution: {{{ 1*/67 void InputDuplicate(int original_enum,int new_enum){_error _("not implemented yet");};66 /*Material virtual functions resolution: {{{*/ 67 void InputDuplicate(int original_enum,int new_enum){_error2_("not implemented yet");}; 68 68 void Configure(Elements* elements); 69 69 void GetVectorFromInputs(Vector* vector,int input_enum){return;} 70 70 /*}}}*/ 71 /*Numerics: {{{ 1*/72 double GetG();73 double GetRhoIce();74 double GetRhoWater();75 double GetRhoFreshwater();76 double GetMuWater();77 double GetMixedLayerCapacity();78 double GetThermalExchangeVelocity();79 double GetHeatCapacity();80 double GetThermalConductivity();81 double GetLatentHeat();82 double GetBeta();83 double GetMeltingPoint();84 double GetReferenceTemperature();85 double GetKn();86 double GetHydrologyP();87 double GetHydrologyQ();88 double GetHydrologyCR();89 double GetHydrologyN();90 double TMeltingPoint(double pressure);91 double PureIceEnthalpy(double pressure);92 double GetEnthalpyDiffusionParameter(double enthalpy,double pressure);93 void EnthalpyToThermal( double* ptemperature,double* pwaterfraction,double enthalpy,double pressure);94 void ThermalToEnthalpy( double* penthalpy,double temperature,double waterfraction,double pressure);71 /*Numerics: {{{*/ 72 IssmDouble GetG(); 73 IssmDouble GetRhoIce(); 74 IssmDouble GetRhoWater(); 75 IssmDouble GetRhoFreshwater(); 76 IssmDouble GetMuWater(); 77 IssmDouble GetMixedLayerCapacity(); 78 IssmDouble GetThermalExchangeVelocity(); 79 IssmDouble GetHeatCapacity(); 80 IssmDouble GetThermalConductivity(); 81 IssmDouble GetLatentHeat(); 82 IssmDouble GetBeta(); 83 IssmDouble GetMeltingPoint(); 84 IssmDouble GetReferenceTemperature(); 85 IssmDouble GetKn(); 86 IssmDouble GetHydrologyP(); 87 IssmDouble GetHydrologyQ(); 88 IssmDouble GetHydrologyCR(); 89 IssmDouble GetHydrologyN(); 90 IssmDouble TMeltingPoint(IssmDouble pressure); 91 IssmDouble PureIceEnthalpy(IssmDouble pressure); 92 IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure); 93 void EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure); 94 void ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure); 95 95 /*}}}*/ 96 96 -
issm/trunk/src/c/objects/Node.cpp
r12330 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 21 21 22 22 /*Node constructors and destructors:*/ 23 /*FUNCTION Node::Node() default constructor {{{ 1*/23 /*FUNCTION Node::Node() default constructor {{{*/ 24 24 Node::Node(){ 25 25 this->inputs=NULL; … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION Node::Node(int node_id,int node_sid,int vertex_id,int io_index, IoModel* iomodel,int analysis_type) {{{ 1*/30 /*FUNCTION Node::Node(int node_id,int node_sid,int vertex_id,int io_index, IoModel* iomodel,int analysis_type) {{{*/ 31 31 Node::Node(int node_id,int node_sid,int vertex_id,int io_index, IoModel* iomodel,int analysis_type){ 32 32 … … 58 58 this->inputs=new Inputs(); 59 59 if (iomodel->Data(MeshVertexonbedEnum)) 60 this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum, (IssmBool)iomodel->Data(MeshVertexonbedEnum)[io_index]));60 this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum,reCast<IssmBool>(iomodel->Data(MeshVertexonbedEnum)[io_index]))); 61 61 if (iomodel->Data(MeshVertexonsurfaceEnum)) 62 this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum, (IssmBool)iomodel->Data(MeshVertexonsurfaceEnum)[io_index]));62 this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum,reCast<IssmBool>(iomodel->Data(MeshVertexonsurfaceEnum)[io_index]))); 63 63 if (iomodel->Data(MaskVertexonfloatingiceEnum)) 64 this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum, (IssmBool)iomodel->Data(MaskVertexonfloatingiceEnum)[io_index]));64 this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,reCast<IssmBool>(iomodel->Data(MaskVertexonfloatingiceEnum)[io_index]))); 65 65 if (iomodel->Data(MaskVertexongroundediceEnum)) 66 this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,(IssmBool)iomodel->Data(MaskVertexongroundediceEnum)[io_index]));66 this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,reCast<IssmBool>(iomodel->Data(MaskVertexongroundediceEnum)[io_index]))); 67 67 if (analysis_type==DiagnosticHorizAnalysisEnum) 68 this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->Data(FlowequationVertexEquationEnum)[io_index])); 69 68 this->inputs->AddInput(new IntInput(ApproximationEnum,reCast<IssmInt>(iomodel->Data(FlowequationVertexEquationEnum)[io_index]))); 70 69 /*set single point constraints: */ 71 70 72 71 /*spc all nodes on water*/ 73 if (!iomodel->Data(MaskVertexonwaterEnum)) _error _("iomodel->nodeonwater is NULL");74 if ( iomodel->Data(MaskVertexonwaterEnum)[io_index]){72 if (!iomodel->Data(MaskVertexonwaterEnum)) _error2_("iomodel->nodeonwater is NULL"); 73 if (reCast<IssmBool>(iomodel->Data(MaskVertexonwaterEnum)[io_index])){ 75 74 for(k=1;k<=gsize;k++){ 76 75 this->FreezeDof(k); … … 115 114 /*Diagnostic Hutter*/ 116 115 if (analysis_type==DiagnosticHutterAnalysisEnum){ 117 if (!iomodel->Data(FlowequationVertexEquationEnum)) _error _("iomodel->vertices_type is NULL");116 if (!iomodel->Data(FlowequationVertexEquationEnum)) _error2_("iomodel->vertices_type is NULL"); 118 117 /*Constrain all nodes that are not Hutter*/ 119 if ( !iomodel->Data(FlowequationVertexEquationEnum)[io_index]==HutterApproximationEnum){118 if (reCast<int>(iomodel->Data(FlowequationVertexEquationEnum)[io_index])!=HutterApproximationEnum){ 120 119 for(k=1;k<=gsize;k++){ 121 120 this->FreezeDof(k); … … 135 134 /*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */ 136 135 _assert_(iomodel->Data(MeshVertexonbedEnum)); 137 if (! iomodel->Data(MeshVertexonbedEnum)[io_index]){136 if (!(reCast<IssmBool>(iomodel->Data(MeshVertexonbedEnum)[io_index]))){ 138 137 for(k=1;k<=gsize;k++){ 139 138 this->FreezeDof(k); … … 145 144 } 146 145 /*}}}*/ 147 /*FUNCTION Node::~Node(){{{ 1*/146 /*FUNCTION Node::~Node(){{{*/ 148 147 Node::~Node(){ 149 148 delete inputs; … … 154 153 155 154 /*Object virtual functions definitions:*/ 156 /*FUNCTION Node::Echo{{{ 1*/155 /*FUNCTION Node::Echo{{{*/ 157 156 void Node::Echo(void){ 158 157 159 printf("Node:\n");160 printf(" id: %i\n",id);161 printf(" sid: %i\n",sid);162 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));158 _printLine_("Node:"); 159 _printLine_(" id: " << id); 160 _printLine_(" sid: " << sid); 161 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 163 162 indexing.Echo(); 164 printf(" hvertex: not displayed\n");165 printf(" inputs: %p\n",inputs);166 167 168 } 169 /*}}}*/ 170 /*FUNCTION Node::DeepEcho{{{ 1*/163 _printLine_(" hvertex: not displayed"); 164 _printLine_(" inputs: " << inputs); 165 166 167 } 168 /*}}}*/ 169 /*FUNCTION Node::DeepEcho{{{*/ 171 170 void Node::DeepEcho(void){ 172 171 173 printf("Node:\n");174 printf(" id: %i\n",id);175 printf(" sid: %i\n",sid);176 printf(" analysis_type: %s\n",EnumToStringx(analysis_type));172 _printLine_("Node:"); 173 _printLine_(" id: " << id); 174 _printLine_(" sid: " << sid); 175 _printLine_(" analysis_type: " << EnumToStringx(analysis_type)); 177 176 indexing.DeepEcho(); 178 printf("Vertex:\n");177 _printLine_("Vertex:"); 179 178 hvertex->DeepEcho(); 180 printf(" inputs\n");181 182 183 } 184 /*}}}*/ 185 /*FUNCTION Node::Id{{{ 1*/179 _printLine_(" inputs"); 180 181 182 } 183 /*}}}*/ 184 /*FUNCTION Node::Id{{{*/ 186 185 int Node::Id(void){ return id; } 187 186 /*}}}*/ 188 /*FUNCTION Node::MyRank{{{ 1*/187 /*FUNCTION Node::MyRank{{{*/ 189 188 int Node::MyRank(void){ 190 189 extern int my_rank; … … 193 192 } 194 193 /*}}}*/ 195 /*FUNCTION Node::ObjectEnum{{{ 1*/194 /*FUNCTION Node::ObjectEnum{{{*/ 196 195 int Node::ObjectEnum(void){ 197 196 … … 202 201 203 202 /*Node management:*/ 204 /*FUNCTION Node::Configure {{{ 1*/203 /*FUNCTION Node::Configure {{{*/ 205 204 void Node::Configure(DataSet* nodesin,Vertices* verticesin){ 206 205 … … 212 211 213 212 } 214 /*FUNCTION Node::SetCurrentConfiguration {{{ 1*/213 /*FUNCTION Node::SetCurrentConfiguration {{{*/ 215 214 void Node::SetCurrentConfiguration(DataSet* nodesin,Vertices* verticesin){ 216 215 217 216 } 218 /*FUNCTION Node::GetDof {{{ 1*/217 /*FUNCTION Node::GetDof {{{*/ 219 218 int Node::GetDof(int dofindex,int setenum){ 220 219 … … 231 230 return indexing.sdoflist[dofindex]; 232 231 } 233 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");234 235 } 236 /*}}}*/ 237 /*FUNCTION Node::GetDofList1{{{ 1*/232 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 233 234 } 235 /*}}}*/ 236 /*FUNCTION Node::GetDofList1{{{*/ 238 237 int Node::GetDofList1(void){ 239 238 … … 245 244 } 246 245 /*}}}*/ 247 /*FUNCTION Node::GetDofList{{{ 1*/246 /*FUNCTION Node::GetDofList{{{*/ 248 247 void Node::GetDofList(int* outdoflist,int approximation_enum,int setenum){ 249 248 int i; … … 303 302 else for(i=0;i<this->indexing.ssize;i++) outdoflist[i]=indexing.sdoflist[i]; 304 303 } 305 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");306 } 307 } 308 /*}}}*/ 309 /*FUNCTION Node::GetSidList{{{ 1*/304 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 305 } 306 } 307 /*}}}*/ 308 /*FUNCTION Node::GetSidList{{{*/ 310 309 int Node::GetSidList(void){ 311 310 … … 317 316 } 318 317 /*}}}*/ 319 /*FUNCTION Node::GetLocalDofList{{{ 1*/318 /*FUNCTION Node::GetLocalDofList{{{*/ 320 319 void Node::GetLocalDofList(int* outdoflist,int approximation_enum,int setenum){ 321 320 int i; … … 343 342 } 344 343 } 345 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");344 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 346 345 } 347 346 else{ … … 412 411 } 413 412 } 414 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");415 } 416 } 417 /*}}}*/ 418 /*FUNCTION Node::Sid{{{ 1*/413 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 414 } 415 } 416 /*}}}*/ 417 /*FUNCTION Node::Sid{{{*/ 419 418 int Node::Sid(void){ return sid; } 420 419 /*}}}*/ 421 /*FUNCTION Node::GetVertexId {{{ 1*/420 /*FUNCTION Node::GetVertexId {{{*/ 422 421 int Node::GetVertexId(void){ 423 422 … … 428 427 } 429 428 /*}}}*/ 430 /*FUNCTION Node::GetVertexDof {{{ 1*/429 /*FUNCTION Node::GetVertexDof {{{*/ 431 430 int Node::GetVertexDof(void){ 432 431 … … 438 437 /*}}}*/ 439 438 #ifdef _HAVE_DIAGNOSTIC_ 440 /*FUNCTION Node::GetCoordinateSystem{{{ 1*/441 void Node::GetCoordinateSystem( double* coord_system_out){439 /*FUNCTION Node::GetCoordinateSystem{{{*/ 440 void Node::GetCoordinateSystem(IssmDouble* coord_system_out){ 442 441 443 442 /*Copy coord_system*/ … … 447 446 /*}}}*/ 448 447 #endif 449 /*FUNCTION Node::SetVertexDof {{{ 1*/448 /*FUNCTION Node::SetVertexDof {{{*/ 450 449 void Node::SetVertexDof(int in_dof){ 451 450 … … 457 456 } 458 457 /*}}}*/ 459 /*FUNCTION Node::InAnalysis{{{ 1*/458 /*FUNCTION Node::InAnalysis{{{*/ 460 459 bool Node::InAnalysis(int in_analysis_type){ 461 460 if (in_analysis_type==this->analysis_type) return true; … … 465 464 466 465 /*Node numerics:*/ 467 /*FUNCTION Node::ApplyConstraints{{{ 1*/468 void Node::ApplyConstraint(int dof, double value){466 /*FUNCTION Node::ApplyConstraints{{{*/ 467 void Node::ApplyConstraint(int dof,IssmDouble value){ 469 468 470 469 int index; … … 476 475 } 477 476 /*}}}*/ 478 /*FUNCTION Node::RelaxConstraint{{{ 1*/477 /*FUNCTION Node::RelaxConstraint{{{*/ 479 478 void Node::RelaxConstraint(int dof){ 480 479 … … 484 483 } 485 484 /*}}}*/ 486 /*FUNCTION Node::CreateVecSets {{{ 1*/485 /*FUNCTION Node::CreateVecSets {{{*/ 487 486 void Node::CreateVecSets(Vector* pv_g,Vector* pv_f,Vector* pv_s){ 488 487 489 double gvalue=1.0; //all nodes are in the g set;490 double value;488 IssmDouble gvalue=1.0; //all nodes are in the g set; 489 IssmDouble value; 491 490 492 491 int i; … … 498 497 499 498 /*f set: */ 500 value=( double)this->indexing.f_set[i];499 value=(IssmDouble)this->indexing.f_set[i]; 501 500 pv_f->SetValue(indexing.gdoflist[i],value,INS_VAL); 502 501 503 502 /*s set: */ 504 value=( double)this->indexing.s_set[i];503 value=(IssmDouble)this->indexing.s_set[i]; 505 504 pv_s->SetValue(indexing.gdoflist[i],value,INS_VAL); 506 505 … … 510 509 } 511 510 /*}}}*/ 512 /*FUNCTION Node::CreateNodalConstraints{{{ 1*/511 /*FUNCTION Node::CreateNodalConstraints{{{*/ 513 512 void Node::CreateNodalConstraints(Vector* ys){ 514 513 515 514 int i; 516 double* values=NULL;515 IssmDouble* values=NULL; 517 516 int count; 518 517 519 518 /*Recover values for s set and plug them in constraints vector: */ 520 519 if(this->indexing.ssize){ 521 values= (double*)xmalloc(this->indexing.ssize*sizeof(double));520 values=xNew<IssmDouble>(this->indexing.ssize); 522 521 count=0; 523 522 for(i=0;i<this->indexing.gsize;i++){ 524 523 if(this->indexing.s_set[i]){ 525 524 values[count]=this->indexing.svalues[i]; 526 _assert_(! isnan(values[count]));525 _assert_(!xIsNan<IssmDouble>(values[count])); 527 526 count++; 528 527 } … … 534 533 535 534 /*Free ressources:*/ 536 x free((void**)&values);537 538 539 } 540 /*}}}*/ 541 /*FUNCTION Node::DofInSSet {{{ 1*/535 xDelete<IssmDouble>(values); 536 537 538 } 539 /*}}}*/ 540 /*FUNCTION Node::DofInSSet {{{*/ 542 541 void Node::DofInSSet(int dof){ 543 542 … … 549 548 } 550 549 /*}}}*/ 551 /*FUNCTION Node::DofInFSet {{{ 1*/550 /*FUNCTION Node::DofInFSet {{{*/ 552 551 void Node::DofInFSet(int dof){ 553 552 … … 559 558 } 560 559 /*}}}*/ 561 /*FUNCTION Node::FreezeDof{{{ 1*/560 /*FUNCTION Node::FreezeDof{{{*/ 562 561 void Node::FreezeDof(int dof){ 563 562 … … 566 565 } 567 566 /*}}}*/ 568 /*FUNCTION Node::GetApproximation {{{ 1*/567 /*FUNCTION Node::GetApproximation {{{*/ 569 568 int Node::GetApproximation(){ 570 569 … … 577 576 } 578 577 /*}}}*/ 579 /*FUNCTION Node::GetConnectivity {{{ 1*/578 /*FUNCTION Node::GetConnectivity {{{*/ 580 579 int Node::GetConnectivity(){ 581 580 … … 585 584 } 586 585 /*}}}*/ 587 /*FUNCTION Node::GetNumberOfDofs{{{ 1*/586 /*FUNCTION Node::GetNumberOfDofs{{{*/ 588 587 int Node::GetNumberOfDofs(int approximation_enum,int setenum){ 589 588 … … 598 597 else if (setenum==FsetEnum) numdofs=this->indexing.fsize; 599 598 else if (setenum==SsetEnum) numdofs=this->indexing.ssize; 600 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");599 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 601 600 } 602 601 else{ … … 628 627 else numdofs=this->indexing.ssize; 629 628 } 630 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");629 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 631 630 } 632 631 return numdofs; 633 632 } 634 633 /*}}}*/ 635 /*FUNCTION Node::GetSigma {{{ 1*/636 double Node::GetSigma(){634 /*FUNCTION Node::GetSigma {{{*/ 635 IssmDouble Node::GetSigma(){ 637 636 Vertex* vertex=NULL; 638 637 … … 641 640 } 642 641 /*}}}*/ 643 /*FUNCTION Node::GetX {{{ 1*/644 double Node::GetX(){642 /*FUNCTION Node::GetX {{{*/ 643 IssmDouble Node::GetX(){ 645 644 Vertex* vertex=NULL; 646 645 … … 649 648 } 650 649 /*}}}*/ 651 /*FUNCTION Node::GetY {{{ 1*/652 double Node::GetY(){650 /*FUNCTION Node::GetY {{{*/ 651 IssmDouble Node::GetY(){ 653 652 Vertex* vertex=NULL; 654 653 … … 657 656 } 658 657 /*}}}*/ 659 /*FUNCTION Node::GetZ {{{ 1*/660 double Node::GetZ(){658 /*FUNCTION Node::GetZ {{{*/ 659 IssmDouble Node::GetZ(){ 661 660 Vertex* vertex=NULL; 662 661 … … 665 664 } 666 665 /*}}}*/ 667 /*FUNCTION Node::IsClone {{{ 1*/666 /*FUNCTION Node::IsClone {{{*/ 668 667 int Node::IsClone(){ 669 668 … … 672 671 } 673 672 /*}}}*/ 674 /*FUNCTION Node::IsOnBed {{{ 1*/673 /*FUNCTION Node::IsOnBed {{{*/ 675 674 int Node::IsOnBed(){ 676 675 … … 683 682 } 684 683 /*}}}*/ 685 /*FUNCTION Node::IsGrounded {{{ 1*/684 /*FUNCTION Node::IsGrounded {{{*/ 686 685 int Node::IsGrounded(){ 687 686 … … 694 693 } 695 694 /*}}}*/ 696 /*FUNCTION Node::IsFloating {{{ 1*/695 /*FUNCTION Node::IsFloating {{{*/ 697 696 int Node::IsFloating(){ 698 697 … … 705 704 } 706 705 /*}}}*/ 707 /*FUNCTION Node::IsOnSurface {{{ 1*/706 /*FUNCTION Node::IsOnSurface {{{*/ 708 707 int Node::IsOnSurface(){ 709 708 … … 716 715 } 717 716 /*}}}*/ 718 /*FUNCTION Node::InputUpdateFromVector( double* vector, int name, int type){{{1*/719 void Node::InputUpdateFromVector( double* vector, int name, int type){717 /*FUNCTION Node::InputUpdateFromVector(IssmDouble* vector, int name, int type){{{*/ 718 void Node::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 720 719 721 720 /*Nothing updated yet*/ 722 721 } 723 722 /*}}}*/ 724 /*FUNCTION Node::InputUpdateFromVector(int* vector, int name, int type){{{ 1*/723 /*FUNCTION Node::InputUpdateFromVector(int* vector, int name, int type){{{*/ 725 724 void Node::InputUpdateFromVector(int* vector, int name, int type){ 726 725 … … 728 727 } 729 728 /*}}}*/ 730 /*FUNCTION Node::InputUpdateFromVector(bool* vector, int name, int type){{{ 1*/729 /*FUNCTION Node::InputUpdateFromVector(bool* vector, int name, int type){{{*/ 731 730 void Node::InputUpdateFromVector(bool* vector, int name, int type){ 732 731 … … 734 733 } 735 734 /*}}}*/ 736 /*FUNCTION Node::InputUpdateFromVectorDakota( double* vector, int name, int type){{{1*/737 void Node::InputUpdateFromVectorDakota( double* vector, int name, int type){735 /*FUNCTION Node::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){{{*/ 736 void Node::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 738 737 739 738 /*Nothing updated yet*/ 740 739 } 741 740 /*}}}*/ 742 /*FUNCTION Node::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){{{1*/743 void Node::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){741 /*FUNCTION Node::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){{{*/ 742 void Node::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 744 743 745 744 /*Nothing updated yet*/ 746 745 } 747 746 /*}}}*/ 748 /*FUNCTION Node::InputUpdateFromVectorDakota(int* vector, int name, int type){{{ 1*/747 /*FUNCTION Node::InputUpdateFromVectorDakota(int* vector, int name, int type){{{*/ 749 748 void Node::InputUpdateFromVectorDakota(int* vector, int name, int type){ 750 749 … … 752 751 } 753 752 /*}}}*/ 754 /*FUNCTION Node::InputUpdateFromVectorDakota(bool* vector, int name, int type){{{ 1*/753 /*FUNCTION Node::InputUpdateFromVectorDakota(bool* vector, int name, int type){{{*/ 755 754 void Node::InputUpdateFromVectorDakota(bool* vector, int name, int type){ 756 755 … … 758 757 } 759 758 /*}}}*/ 760 /*FUNCTION Node::InputUpdateFromConstant( double constant, int name){{{1*/761 void Node::InputUpdateFromConstant( double constant, int name){759 /*FUNCTION Node::InputUpdateFromConstant(IssmDouble constant, int name){{{*/ 760 void Node::InputUpdateFromConstant(IssmDouble constant, int name){ 762 761 763 762 /*Nothing updated yet*/ 764 763 } 765 764 /*}}}*/ 766 /*FUNCTION Node::InputUpdateFromConstant(int constant, int name){{{ 1*/765 /*FUNCTION Node::InputUpdateFromConstant(int constant, int name){{{*/ 767 766 void Node::InputUpdateFromConstant(int constant, int name){ 768 767 … … 770 769 } 771 770 /*}}}*/ 772 /*FUNCTION Node::InputUpdateFromConstant(bool constant, int name){{{ 1*/771 /*FUNCTION Node::InputUpdateFromConstant(bool constant, int name){{{*/ 773 772 void Node::InputUpdateFromConstant(bool constant, int name){ 774 773 … … 776 775 } 777 776 /*}}}*/ 778 /*FUNCTION Node::UpdateSpcs {{{ 1*/779 void Node::UpdateSpcs( double* ys){777 /*FUNCTION Node::UpdateSpcs {{{*/ 778 void Node::UpdateSpcs(IssmDouble* ys){ 780 779 781 780 int count=0; … … 791 790 } 792 791 /*}}}*/ 793 /*FUNCTION Node::VecMerge {{{ 1*/794 void Node::VecMerge(Vector* ug, double* vector_serial,int setenum){795 796 double* values=NULL;792 /*FUNCTION Node::VecMerge {{{*/ 793 void Node::VecMerge(Vector* ug, IssmDouble* vector_serial,int setenum){ 794 795 IssmDouble* values=NULL; 797 796 int* indices=NULL; 798 797 int count=0; … … 801 800 if(setenum==FsetEnum){ 802 801 if(this->indexing.fsize){ 803 indices= (int*)xmalloc(this->indexing.fsize*sizeof(int));804 values=(double*)xmalloc(this->indexing.fsize*sizeof(double));802 indices=xNew<int>(this->indexing.fsize); 803 values=xNew<IssmDouble>(this->indexing.fsize); 805 804 806 805 for(i=0;i<this->indexing.gsize;i++){ … … 819 818 else if(setenum==SsetEnum){ 820 819 if(this->indexing.ssize){ 821 indices= (int*)xmalloc(this->indexing.ssize*sizeof(int));822 values= (double*)xmalloc(this->indexing.ssize*sizeof(double));820 indices=xNew<int>(this->indexing.ssize); 821 values=xNew<IssmDouble>(this->indexing.ssize); 823 822 824 823 for(i=0;i<this->indexing.gsize;i++){ … … 835 834 } 836 835 } 837 else _error _("VecMerge can only merge from the s or f-set onto the g-set!");836 else _error2_("VecMerge can only merge from the s or f-set onto the g-set!"); 838 837 839 838 /*Free ressources:*/ 840 x free((void**)&values);841 x free((void**)&indices);842 } 843 /*}}}*/ 844 /*FUNCTION Node::VecReduce {{{ 1*/845 void Node::VecReduce(Vector* vector, double* ug_serial,int setenum){846 847 double* values=NULL;839 xDelete<IssmDouble>(values); 840 xDelete<int>(indices); 841 } 842 /*}}}*/ 843 /*FUNCTION Node::VecReduce {{{*/ 844 void Node::VecReduce(Vector* vector, IssmDouble* ug_serial,int setenum){ 845 846 IssmDouble* values=NULL; 848 847 int count=0; 849 848 int i; … … 851 850 if(setenum==FsetEnum){ 852 851 if(this->indexing.fsize){ 853 values=(double*)xmalloc(this->indexing.fsize*sizeof(double));852 values=xNew<IssmDouble>(this->indexing.fsize); 854 853 855 854 for(i=0;i<this->indexing.gsize;i++){ … … 867 866 else if(setenum==SsetEnum){ 868 867 if(this->indexing.ssize){ 869 values= (double*)xmalloc(this->indexing.ssize*sizeof(double));868 values=xNew<IssmDouble>(this->indexing.ssize); 870 869 871 870 for(i=0;i<this->indexing.gsize;i++){ … … 881 880 } 882 881 } 883 else _error _("VecReduce can only merge from the s or f-set onto the g-set!");882 else _error2_("VecReduce can only merge from the s or f-set onto the g-set!"); 884 883 885 884 /*Free ressources:*/ 886 x free((void**)&values);885 xDelete<IssmDouble>(values); 887 886 } 888 887 /*}}}*/ 889 888 890 889 /* DofObject routines:*/ 891 /*FUNCTION Node::DistributeDofs{{{ 1*/890 /*FUNCTION Node::DistributeDofs{{{*/ 892 891 void Node::DistributeDofs(int* pdofcount,int setenum){ 893 892 … … 928 927 dofcount+=this->indexing.ssize; 929 928 } 930 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");929 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 931 930 932 931 … … 936 935 } 937 936 /*}}}*/ 938 /*FUNCTION Node::Off_setDofs{{{ 1*/937 /*FUNCTION Node::Off_setDofs{{{*/ 939 938 void Node::OffsetDofs(int dofcount,int setenum){ 940 939 … … 957 956 for(i=0;i<this->indexing.ssize;i++) indexing.sdoflist[i]+=dofcount; 958 957 } 959 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");960 } 961 /*}}}*/ 962 /*FUNCTION Node::ShowTrueDofs{{{ 1*/958 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 959 } 960 /*}}}*/ 961 /*FUNCTION Node::ShowTrueDofs{{{*/ 963 962 void Node::ShowTrueDofs(int* truedofs, int ncols,int setenum){ 964 963 … … 973 972 else if(setenum==FsetEnum)for(j=0;j<this->indexing.fsize;j++) *(truedofs+ncols*sid+j)=indexing.fdoflist[j]; 974 973 else if(setenum==SsetEnum)for(j=0;j<this->indexing.ssize;j++) *(truedofs+ncols*sid+j)=indexing.sdoflist[j]; 975 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");976 977 } 978 /*}}}*/ 979 /*FUNCTION Node::UpdateCloneDofs{{{ 1*/974 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 975 976 } 977 /*}}}*/ 978 /*FUNCTION Node::UpdateCloneDofs{{{*/ 980 979 void Node::UpdateCloneDofs(int* alltruedofs,int ncols,int setenum){ 981 980 … … 992 991 else if(setenum==FsetEnum)for(j=0;j<this->indexing.fsize;j++) indexing.fdoflist[j]=*(alltruedofs+ncols*sid+j); 993 992 else if(setenum==SsetEnum)for(j=0;j<this->indexing.ssize;j++) indexing.sdoflist[j]=*(alltruedofs+ncols*sid+j); 994 else _error _("%s%s%s"," set of enum type ",EnumToStringx(setenum)," not supported yet!");995 996 } 997 /*}}}*/ 998 /*FUNCTION Node::SetClone {{{ 1*/993 else _error2_("set of enum type " << EnumToStringx(setenum) << " not supported yet!"); 994 995 } 996 /*}}}*/ 997 /*FUNCTION Node::SetClone {{{*/ 999 998 void Node::SetClone(int* minranks){ 1000 999 -
issm/trunk/src/c/objects/Node.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Object.h" 11 11 #include "../shared/shared.h" … … 34 34 IssmDouble coord_system[3][3]; 35 35 36 /*Node constructors, destructors {{{ 1*/36 /*Node constructors, destructors {{{*/ 37 37 Node(); 38 38 Node(int node_id,int node_sid, int vertex_id,int io_index, IoModel* iomodel,int analysis_type); 39 39 ~Node(); 40 40 /*}}}*/ 41 /*Object virtual functions definitions:{{{ 1*/41 /*Object virtual functions definitions:{{{ */ 42 42 void Echo(); 43 43 void DeepEcho(); … … 45 45 int MyRank(); 46 46 int ObjectEnum(); 47 Object* copy(){_error _("Not implemented yet (similar to Elements)");};47 Object* copy(){_error2_("Not implemented yet (similar to Elements)");}; 48 48 /*}}}*/ 49 /*Update virtual functions definitions: {{{ 1*/49 /*Update virtual functions definitions: {{{*/ 50 50 51 51 void InputUpdateFromVector(IssmDouble* vector, int name, int type); … … 59 59 void InputUpdateFromConstant(int constant, int name); 60 60 void InputUpdateFromConstant(bool constant, int name); 61 void InputUpdateFromSolution(IssmDouble* solution){_error _("Not implemented yet!");}62 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error _("Not implemented yet!");}61 void InputUpdateFromSolution(IssmDouble* solution){_error2_("Not implemented yet!");} 62 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error2_("Not implemented yet!");} 63 63 /*}}}*/ 64 /*Node numerical routines {{{ 1*/64 /*Node numerical routines {{{*/ 65 65 void Configure(DataSet* nodes,Vertices* vertices); 66 66 void CreateNodalConstraints(Vector* ys); … … 102 102 103 103 /*}}}*/ 104 /*Dof Object routines {{{ 1*/104 /*Dof Object routines {{{*/ 105 105 void DistributeDofs(int* pdofcount,int setenum); 106 106 void OffsetDofs(int dofcount,int setenum); -
issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp
r11995 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 21 21 /*ElementMatrix constructors and destructor*/ 22 /*FUNCTION ElementMatrix::ElementMatrix(){{{ 1*/22 /*FUNCTION ElementMatrix::ElementMatrix(){{{*/ 23 23 ElementMatrix::ElementMatrix(){ 24 24 … … 44 44 } 45 45 /*}}}*/ 46 /*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke){{{ 1*/46 /*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke){{{*/ 47 47 ElementMatrix::ElementMatrix(ElementMatrix* Ke){ 48 48 49 if(!Ke) _error _("Input Element Matrix is a NULL pointer");49 if(!Ke) _error2_("Input Element Matrix is a NULL pointer"); 50 50 this->Init(Ke); 51 51 return; 52 52 } 53 53 /*}}}*/ 54 /*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2){{{ 1*/54 /*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2){{{*/ 55 55 ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2){ 56 56 … … 63 63 /*If one of the two matrix is NULL, we copy the other one*/ 64 64 if(!Ke1 && !Ke2){ 65 _error _("Two input element matrices are NULL");65 _error2_("Two input element matrices are NULL"); 66 66 } 67 67 else if(!Ke1){ … … 75 75 76 76 /*General Case: Ke1 and Ke2 are not empty*/ 77 if(!Ke1->dofsymmetrical || !Ke2->dofsymmetrical) _error _("merging 2 non dofsymmetrical matrices not implemented yet");77 if(!Ke1->dofsymmetrical || !Ke2->dofsymmetrical) _error2_("merging 2 non dofsymmetrical matrices not implemented yet"); 78 78 79 79 /*Initialize itransformation matrix Ke[P[i]] = Ke2[i]*/ 80 P= (int*)xmalloc(Ke2->nrows*sizeof(int));80 P=xNew<int>(Ke2->nrows); 81 81 82 82 /*1: Get the new numbering of Ke2 and get size of the new matrix*/ … … 100 100 101 101 /*Gset and values*/ 102 this->gglobaldoflist= (int*)xmalloc(this->nrows*sizeof(int));103 this->values= (double*)xcalloc(this->nrows*this->ncols,sizeof(double));102 this->gglobaldoflist=xNew<int>(this->nrows); 103 this->values=xNewZeroInit<IssmDouble>(this->nrows*this->ncols); 104 104 for(i=0;i<Ke1->nrows;i++){ 105 105 for(j=0;j<Ke1->ncols;j++){ … … 122 122 this->row_fsize=fsize; 123 123 if(fsize){ 124 this->row_flocaldoflist = (int*)xmalloc(fsize*sizeof(int));125 this->row_fglobaldoflist= (int*)xmalloc(fsize*sizeof(int));124 this->row_flocaldoflist =xNew<int>(fsize); 125 this->row_fglobaldoflist=xNew<int>(fsize); 126 126 for(i=0;i<Ke1->row_fsize;i++){ 127 127 this->row_flocaldoflist[i] =Ke1->row_flocaldoflist[i]; … … 149 149 this->row_ssize=ssize; 150 150 if(ssize){ 151 this->row_slocaldoflist = (int*)xmalloc(ssize*sizeof(int));152 this->row_sglobaldoflist= (int*)xmalloc(ssize*sizeof(int));151 this->row_slocaldoflist =xNew<int>(ssize); 152 this->row_sglobaldoflist=xNew<int>(ssize); 153 153 for(i=0;i<Ke1->row_ssize;i++){ 154 154 this->row_slocaldoflist[i] =Ke1->row_slocaldoflist[i]; … … 178 178 179 179 /*clean-up*/ 180 x free((void**)&P);181 } 182 /*}}}*/ 183 /*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2,ElementMatrix* Ke3){{{ 1*/180 xDelete<int>(P); 181 } 182 /*}}}*/ 183 /*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2,ElementMatrix* Ke3){{{*/ 184 184 ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2,ElementMatrix* Ke3){ 185 185 … … 196 196 } 197 197 /*}}}*/ 198 /*FUNCTION ElementMatrix::ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){{{ 1*/198 /*FUNCTION ElementMatrix::ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){{{*/ 199 199 ElementMatrix::ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){ 200 200 … … 205 205 206 206 /*fill values with 0: */ 207 this->values= (double*)xcalloc(this->nrows*this->ncols,sizeof(double));207 this->values=xNewZeroInit<IssmDouble>(this->nrows*this->ncols); 208 208 209 209 /*g list*/ … … 228 228 } 229 229 /*}}}*/ 230 /*FUNCTION ElementMatrix::~ElementMatrix(){{{ 1*/230 /*FUNCTION ElementMatrix::~ElementMatrix(){{{*/ 231 231 ElementMatrix::~ElementMatrix(){ 232 232 233 x free((void**)&this->values);234 x free((void**)&this->gglobaldoflist);235 x free((void**)&this->row_flocaldoflist);236 x free((void**)&this->row_fglobaldoflist);237 x free((void**)&this->row_slocaldoflist);238 x free((void**)&this->row_sglobaldoflist);239 x free((void**)&this->col_flocaldoflist);240 x free((void**)&this->col_fglobaldoflist);241 x free((void**)&this->col_slocaldoflist);242 x free((void**)&this->col_sglobaldoflist);233 xDelete<IssmDouble>(this->values); 234 xDelete<int>(this->gglobaldoflist); 235 xDelete<int>(this->row_flocaldoflist); 236 xDelete<int>(this->row_fglobaldoflist); 237 xDelete<int>(this->row_slocaldoflist); 238 xDelete<int>(this->row_sglobaldoflist); 239 xDelete<int>(this->col_flocaldoflist); 240 xDelete<int>(this->col_fglobaldoflist); 241 xDelete<int>(this->col_slocaldoflist); 242 xDelete<int>(this->col_sglobaldoflist); 243 243 } 244 244 /*}}}*/ 245 245 246 246 /*ElementMatrix specific routines: */ 247 /*FUNCTION ElementMatrix::AddToGlobal(Matrix* Kff, Matrix* Kfs){{{ 1*/247 /*FUNCTION ElementMatrix::AddToGlobal(Matrix* Kff, Matrix* Kfs){{{*/ 248 248 void ElementMatrix::AddToGlobal(Matrix* Kff, Matrix* Kfs){ 249 249 250 250 int i,j; 251 double* localvalues=NULL;251 IssmDouble* localvalues=NULL; 252 252 253 253 /*If Kfs is not provided, call the other function*/ … … 265 265 if(this->row_fsize){ 266 266 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 267 localvalues= (double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));267 localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize); 268 268 for(i=0;i<this->row_fsize;i++){ 269 269 for(j=0;j<this->row_fsize;j++){ … … 275 275 276 276 /*Free ressources:*/ 277 x free((void**)&localvalues);277 xDelete<IssmDouble>(localvalues); 278 278 } 279 279 … … 281 281 if((this->row_ssize!=0) && (this->row_fsize!=0)){ 282 282 /*first, retrieve values that are in the f and s-set from the g-set values matrix: */ 283 localvalues= (double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));283 localvalues=xNew<IssmDouble>(this->row_fsize*this->row_ssize); 284 284 for(i=0;i<this->row_fsize;i++){ 285 285 for(j=0;j<this->row_ssize;j++){ … … 291 291 292 292 /*Free ressources:*/ 293 x free((void**)&localvalues);294 } 295 } 296 else{ 297 _error _("non dofsymmetrical matrix AddToGlobal routine not support yet!");298 } 299 300 } 301 /*}}}*/ 302 /*FUNCTION ElementMatrix::AddToGlobal(Matrix* Jff){{{ 1*/293 xDelete<IssmDouble>(localvalues); 294 } 295 } 296 else{ 297 _error2_("non dofsymmetrical matrix AddToGlobal routine not support yet!"); 298 } 299 300 } 301 /*}}}*/ 302 /*FUNCTION ElementMatrix::AddToGlobal(Matrix* Jff){{{*/ 303 303 void ElementMatrix::AddToGlobal(Matrix* Jff){ 304 304 305 305 int i,j; 306 double* localvalues=NULL;306 IssmDouble* localvalues=NULL; 307 307 308 308 /*Check that Jff is not NULL*/ … … 317 317 if(this->row_fsize){ 318 318 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 319 localvalues= (double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));319 localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize); 320 320 for(i=0;i<this->row_fsize;i++){ 321 321 for(j=0;j<this->row_fsize;j++){ … … 327 327 328 328 /*Free ressources:*/ 329 x free((void**)&localvalues);330 } 331 332 } 333 else{ 334 _error _("non dofsymmetrical matrix AddToGlobal routine not support yet!");335 } 336 337 } 338 /*}}}*/ 339 /*FUNCTION ElementMatrix::CheckConsistency{{{ 1*/329 xDelete<IssmDouble>(localvalues); 330 } 331 332 } 333 else{ 334 _error2_("non dofsymmetrical matrix AddToGlobal routine not support yet!"); 335 } 336 337 } 338 /*}}}*/ 339 /*FUNCTION ElementMatrix::CheckConsistency{{{*/ 340 340 void ElementMatrix::CheckConsistency(void){ 341 341 /*Check element matrix values, only in debugging mode*/ … … 343 343 for (int i=0;i<this->nrows;i++){ 344 344 for(int j=0;j<this->ncols;j++){ 345 if ( isnan(this->values[i*this->ncols+j])) _error_("NaN found in Element Matrix");346 if (fabs(this->values[i*this->ncols+j])>1.e+50) _error _("Element Matrix values exceeds 1.e+50");345 if (xIsNan<IssmDouble>(this->values[i*this->ncols+j])) _error2_("NaN found in Element Matrix"); 346 if (fabs(this->values[i*this->ncols+j])>1.e+50) _error2_("Element Matrix values exceeds 1.e+50"); 347 347 } 348 348 } … … 350 350 } 351 351 /*}}}*/ 352 /*FUNCTION ElementMatrix::Transpose{{{ 1*/352 /*FUNCTION ElementMatrix::Transpose{{{*/ 353 353 void ElementMatrix::Transpose(void){ 354 354 … … 365 365 /*Transpose indices*/ 366 366 if(!dofsymmetrical){ 367 _error _("not supported yet");367 _error2_("not supported yet"); 368 368 } 369 369 … … 373 373 } 374 374 /*}}}*/ 375 /*FUNCTION ElementMatrix::Echo{{{ 1*/375 /*FUNCTION ElementMatrix::Echo{{{*/ 376 376 void ElementMatrix::Echo(void){ 377 377 378 378 int i,j; 379 printf("Element Matrix echo: \n");380 printf(" nrows: %i\n",nrows);381 printf(" ncols: %i\n",ncols);382 printf(" dofsymmetrical: %s\n",dofsymmetrical?"true":"false");383 384 printf(" values: \n");379 _printLine_("Element Matrix echo:"); 380 _printLine_(" nrows: " << nrows); 381 _printLine_(" ncols: " << nrows); 382 _printLine_(" dofsymmetrical: " << (dofsymmetrical?"true":"false")); 383 384 _printLine_(" values:"); 385 385 for(i=0;i<nrows;i++){ 386 printf(" %i: ",i);387 for(j=0;j<ncols;j++) printf("%10g ",*(values+ncols*i+j));388 printf("\n");389 } 390 391 printf(" gglobaldoflist (%p): ",gglobaldoflist);392 if(gglobaldoflist) for(i=0;i<nrows;i++) printf("%i ",gglobaldoflist[i]); printf("\n");393 394 printf(" row_fsize: %i\n",row_fsize);395 printf(" row_flocaldoflist (%p): ",row_flocaldoflist);396 if(row_flocaldoflist) for(i=0;i<row_fsize;i++) printf("%i ",row_flocaldoflist[i]); printf("\n");397 printf(" row_fglobaldoflist (%p): ",row_fglobaldoflist);398 if(row_fglobaldoflist) for(i=0;i<row_fsize;i++)printf("%i ",row_fglobaldoflist[i]); printf("\n");399 400 printf(" row_ssize: %i\n",row_ssize);401 printf(" row_slocaldoflist (%p): ",row_slocaldoflist);402 if(row_slocaldoflist) for(i=0;i<row_ssize;i++)printf("%i ",row_slocaldoflist[i]); printf("\n");403 printf(" row_sglobaldoflist (%p): ",row_sglobaldoflist);404 if(row_sglobaldoflist) for(i=0;i<row_ssize;i++)printf("%i ",row_sglobaldoflist[i]); printf("\n");386 _printString_(setw(4) << right << i << ": "); 387 for(j=0;j<ncols;j++) _printString_( " " << setw(11) << setprecision (5) << right << values[i*ncols+j]); 388 _printLine_(""); 389 } 390 391 _printString_(" gglobaldoflist (" << gglobaldoflist << "): "); 392 if(gglobaldoflist) for(i=0;i<nrows;i++) _printString_(" " << gglobaldoflist[i]); _printLine_(""); 393 394 _printLine_(" row_fsize: " << row_fsize); 395 _printString_(" row_flocaldoflist (" << row_flocaldoflist << "): "); 396 if(row_flocaldoflist) for(i=0;i<row_fsize;i++) _printString_(" " << row_flocaldoflist[i]); _printLine_(" "); 397 _printString_(" row_fglobaldoflist (" << row_fglobaldoflist << "): "); 398 if(row_fglobaldoflist) for(i=0;i<row_fsize;i++) _printString_(" " << row_fglobaldoflist[i]); _printLine_(" "); 399 400 _printLine_(" row_ssize: " << row_ssize); 401 _printString_(" row_slocaldoflist (" << row_slocaldoflist << "): "); 402 if(row_slocaldoflist) for(i=0;i<row_ssize;i++) _printString_(" " << row_slocaldoflist[i]); _printLine_(" "); 403 _printString_(" row_sglobaldoflist (" << row_sglobaldoflist << "): "); 404 if(row_sglobaldoflist) for(i=0;i<row_ssize;i++) _printString_(" " << row_sglobaldoflist[i]); _printLine_(" "); 405 405 406 406 if(!dofsymmetrical){ 407 printf(" col_fsize: %i\n",col_fsize);408 printf(" col_flocaldoflist (%p): ",col_flocaldoflist);409 if(col_flocaldoflist) for(i=0;i<col_fsize;i++)printf("%i ",col_flocaldoflist[i]); printf("\n");410 printf(" col_fglobaldoflist (%p): ",col_fglobaldoflist);411 if(col_fglobaldoflist) for(i=0;i<col_fsize;i++)printf("%i ",col_fglobaldoflist[i]); printf("\n");412 413 printf(" col_ssize: %i\n",col_ssize);414 printf(" col_slocaldoflist (%p): ",col_slocaldoflist);415 if(col_slocaldoflist) for(i=0;i<col_ssize;i++)printf("%i ",col_slocaldoflist[i]); printf("\n");416 printf(" col_sglobaldoflist (%p): ",col_sglobaldoflist);417 if(col_sglobaldoflist) for(i=0;i<col_ssize;i++)printf("%i ",col_sglobaldoflist[i]); printf("\n");418 } 419 } 420 /*}}}*/ 421 /*FUNCTION ElementMatrix::Init{{{ 1*/407 _printLine_(" col_fsize: " << col_fsize); 408 _printString_(" col_flocaldoflist (" << col_flocaldoflist << "): "); 409 if(col_flocaldoflist) for(i=0;i<col_fsize;i++) _printString_(" " << col_flocaldoflist[i]); _printLine_(" "); 410 _printString_(" col_fglobaldoflist (" << col_fglobaldoflist << "): "); 411 if(col_fglobaldoflist) for(i=0;i<col_fsize;i++) _printString_(" " << col_fglobaldoflist[i]); _printLine_(" "); 412 413 _printLine_(" col_ssize: " << col_ssize); 414 _printString_(" col_slocaldoflist (" << col_slocaldoflist << "): "); 415 if(col_slocaldoflist) for(i=0;i<col_ssize;i++) _printString_(" " << col_slocaldoflist[i]); _printLine_(" "); 416 _printString_(" col_sglobaldoflist (" << col_sglobaldoflist << "): "); 417 if(col_sglobaldoflist) for(i=0;i<col_ssize;i++) _printString_(" " << col_sglobaldoflist[i]); _printLine_(" "); 418 } 419 } 420 /*}}}*/ 421 /*FUNCTION ElementMatrix::Init{{{*/ 422 422 void ElementMatrix::Init(ElementMatrix* Ke){ 423 423 … … 428 428 this->dofsymmetrical=Ke->dofsymmetrical; 429 429 430 this->values= (double*)xmalloc(this->nrows*this->ncols*sizeof(double));431 memcpy(this->values,Ke->values,this->nrows*this->ncols*sizeof(double));432 433 this->gglobaldoflist= (int*)xmalloc(this->nrows*sizeof(int));434 memcpy(this->gglobaldoflist,Ke->gglobaldoflist,this->nrows*sizeof(int));430 this->values=xNew<IssmDouble>(this->nrows*this->ncols); 431 xMemCpy<IssmDouble>(this->values,Ke->values,this->nrows*this->ncols); 432 433 this->gglobaldoflist=xNew<int>(this->nrows); 434 xMemCpy<int>(this->gglobaldoflist,Ke->gglobaldoflist,this->nrows); 435 435 436 436 this->row_fsize=Ke->row_fsize; 437 437 if(this->row_fsize){ 438 this->row_flocaldoflist= (int*)xmalloc(this->row_fsize*sizeof(int));439 memcpy(this->row_flocaldoflist,Ke->row_flocaldoflist,this->row_fsize*sizeof(int));440 this->row_fglobaldoflist= (int*)xmalloc(this->row_fsize*sizeof(int));441 memcpy(this->row_fglobaldoflist,Ke->row_fglobaldoflist,this->row_fsize*sizeof(int));438 this->row_flocaldoflist=xNew<int>(this->row_fsize); 439 xMemCpy<int>(this->row_flocaldoflist,Ke->row_flocaldoflist,this->row_fsize); 440 this->row_fglobaldoflist=xNew<int>(this->row_fsize); 441 xMemCpy<int>(this->row_fglobaldoflist,Ke->row_fglobaldoflist,this->row_fsize); 442 442 } 443 443 else{ … … 448 448 this->row_ssize=Ke->row_ssize; 449 449 if(this->row_ssize){ 450 this->row_slocaldoflist= (int*)xmalloc(this->row_ssize*sizeof(int));451 memcpy(this->row_slocaldoflist,Ke->row_slocaldoflist,this->row_ssize*sizeof(int));452 this->row_sglobaldoflist= (int*)xmalloc(this->row_ssize*sizeof(int));453 memcpy(this->row_sglobaldoflist,Ke->row_sglobaldoflist,this->row_ssize*sizeof(int));450 this->row_slocaldoflist=xNew<int>(this->row_ssize); 451 xMemCpy<int>(this->row_slocaldoflist,Ke->row_slocaldoflist,this->row_ssize); 452 this->row_sglobaldoflist=xNew<int>(this->row_ssize); 453 xMemCpy<int>(this->row_sglobaldoflist,Ke->row_sglobaldoflist,this->row_ssize); 454 454 } 455 455 else{ … … 460 460 this->col_fsize=Ke->col_fsize; 461 461 if(this->col_fsize){ 462 this->col_flocaldoflist= (int*)xmalloc(this->col_fsize*sizeof(int));463 memcpy(this->col_flocaldoflist,Ke->col_flocaldoflist,this->col_fsize*sizeof(int));464 this->col_fglobaldoflist= (int*)xmalloc(this->col_fsize*sizeof(int));465 memcpy(this->col_fglobaldoflist,Ke->col_fglobaldoflist,this->col_fsize*sizeof(int));462 this->col_flocaldoflist=xNew<int>(this->col_fsize); 463 xMemCpy<int>(this->col_flocaldoflist,Ke->col_flocaldoflist,this->col_fsize); 464 this->col_fglobaldoflist=xNew<int>(this->col_fsize); 465 xMemCpy<int>(this->col_fglobaldoflist,Ke->col_fglobaldoflist,this->col_fsize); 466 466 } 467 467 else{ … … 472 472 this->col_ssize=Ke->col_ssize; 473 473 if(this->col_ssize){ 474 this->col_slocaldoflist= (int*)xmalloc(this->col_ssize*sizeof(int));475 memcpy(this->col_slocaldoflist,Ke->col_slocaldoflist,this->col_ssize*sizeof(int));476 this->col_sglobaldoflist= (int*)xmalloc(this->col_ssize*sizeof(int));477 memcpy(this->col_sglobaldoflist,Ke->col_sglobaldoflist,this->col_ssize*sizeof(int));474 this->col_slocaldoflist=xNew<int>(this->col_ssize); 475 xMemCpy<int>(this->col_slocaldoflist,Ke->col_slocaldoflist,this->col_ssize); 476 this->col_sglobaldoflist=xNew<int>(this->col_ssize); 477 xMemCpy<int>(this->col_sglobaldoflist,Ke->col_sglobaldoflist,this->col_ssize); 478 478 } 479 479 else{ … … 483 483 } 484 484 /*}}}*/ 485 /*FUNCTION ElementMatrix::SetDiag{{{ 1*/486 void ElementMatrix::SetDiag( double scalar){485 /*FUNCTION ElementMatrix::SetDiag{{{*/ 486 void ElementMatrix::SetDiag(IssmDouble scalar){ 487 487 488 488 int i; 489 489 490 if(this->nrows!=this->ncols)_error _("need square matrix in input!");490 if(this->nrows!=this->ncols)_error2_("need square matrix in input!"); 491 491 492 492 for(i=0;i<this->nrows;i++){ -
issm/trunk/src/c/objects/Numerics/ElementMatrix.h
r11995 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 #include "../Object.h" 14 14 #include "../../toolkits/toolkits.h" … … 24 24 int ncols; 25 25 bool dofsymmetrical; 26 double* values;26 IssmDouble* values; 27 27 28 28 //gset … … 49 49 int* col_sglobaldoflist; 50 50 51 /*ElementMatrix constructors, destructors {{{ 1*/51 /*ElementMatrix constructors, destructors {{{*/ 52 52 ElementMatrix(); 53 53 ElementMatrix(ElementMatrix* Ke); … … 57 57 ~ElementMatrix(); 58 58 /*}}}*/ 59 /*ElementMatrix specific routines {{{ 1*/59 /*ElementMatrix specific routines {{{*/ 60 60 void AddToGlobal(Matrix* Kff, Matrix* Kfs); 61 61 void AddToGlobal(Matrix* Jff); … … 64 64 void Transpose(void); 65 65 void Init(ElementMatrix* Ke); 66 void SetDiag( double scalar);66 void SetDiag(IssmDouble scalar); 67 67 /*}}}*/ 68 68 }; -
issm/trunk/src/c/objects/Numerics/ElementVector.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 21 21 /*ElementVector constructors and destructor*/ 22 /*FUNCTION ElementVector::ElementVector(){{{ 1*/22 /*FUNCTION ElementVector::ElementVector(){{{*/ 23 23 ElementVector::ElementVector(){ 24 24 … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2){{{ 1*/33 /*FUNCTION ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2){{{*/ 34 34 ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2){ 35 35 … … 42 42 /*If one of the two matrix is NULL, we copy the other one*/ 43 43 if(!pe1 && !pe2){ 44 _error _("Two input element matrices are NULL");44 _error2_("Two input element matrices are NULL"); 45 45 } 46 46 else if(!pe1){ … … 54 54 55 55 /*Initialize itransformation matrix pe[P[i]] = pe2[i]*/ 56 P= (int*)xmalloc(pe2->nrows*sizeof(int));56 P=xNew<int>(pe2->nrows); 57 57 58 58 /*1: Get the new numbering of pe2 and get size of the new matrix*/ … … 74 74 75 75 /*Gset and values*/ 76 this->gglobaldoflist= (int*)xmalloc(this->nrows*sizeof(int));77 this->values= (double*)xcalloc(this->nrows,sizeof(double));76 this->gglobaldoflist=xNew<int>(this->nrows); 77 this->values=xNewZeroInit<IssmDouble>(this->nrows); 78 78 for(i=0;i<pe1->nrows;i++){ 79 79 this->values[i] += pe1->values[i]; … … 92 92 this->fsize=fsize; 93 93 if(fsize){ 94 this->flocaldoflist = (int*)xmalloc(fsize*sizeof(int));95 this->fglobaldoflist= (int*)xmalloc(fsize*sizeof(int));94 this->flocaldoflist =xNew<int>(fsize); 95 this->fglobaldoflist=xNew<int>(fsize); 96 96 for(i=0;i<pe1->fsize;i++){ 97 97 this->flocaldoflist[i] =pe1->flocaldoflist[i]; … … 113 113 114 114 /*clean-up*/ 115 x free((void**)&P);116 } 117 /*}}}*/ 118 /*FUNCTION ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2,ElementVector* pe3){{{ 1*/115 xDelete<int>(P); 116 } 117 /*}}}*/ 118 /*FUNCTION ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2,ElementVector* pe3){{{*/ 119 119 ElementVector::ElementVector(ElementVector* pe1, ElementVector* pe2,ElementVector* pe3){ 120 120 … … 131 131 } 132 132 /*}}}*/ 133 /*FUNCTION ElementVector::ElementVector(Node** nodes,int numnodes,Parameters* parameters,int approximation){{{ 1*/133 /*FUNCTION ElementVector::ElementVector(Node** nodes,int numnodes,Parameters* parameters,int approximation){{{*/ 134 134 ElementVector::ElementVector(Node** nodes,int numnodes,Parameters* parameters,int approximation){ 135 135 … … 138 138 139 139 /*fill values with 0: */ 140 this->values= (double*)xcalloc(this->nrows,sizeof(double));140 this->values=xNewZeroInit<IssmDouble>(this->nrows); 141 141 142 142 /*g list*/ … … 149 149 } 150 150 /*}}}*/ 151 /*FUNCTION ElementVector::~ElementVector(){{{ 1*/151 /*FUNCTION ElementVector::~ElementVector(){{{*/ 152 152 ElementVector::~ElementVector(){ 153 153 154 x free((void**)&this->values);155 x free((void**)&this->gglobaldoflist);156 x free((void**)&this->flocaldoflist);157 x free((void**)&this->fglobaldoflist);154 xDelete<IssmDouble>(this->values); 155 xDelete<int>(this->gglobaldoflist); 156 xDelete<int>(this->flocaldoflist); 157 xDelete<int>(this->fglobaldoflist); 158 158 } 159 159 /*}}}*/ 160 160 161 161 /*ElementVector specific routines: */ 162 /*FUNCTION ElementVector::AddToGlobal(Vector* pf){{{ 1*/162 /*FUNCTION ElementVector::AddToGlobal(Vector* pf){{{*/ 163 163 void ElementVector::AddToGlobal(Vector* pf){ 164 164 165 165 int i; 166 double* localvalues=NULL;166 IssmDouble* localvalues=NULL; 167 167 168 168 /*In debugging mode, check consistency (no NaN, and values not too big)*/ … … 171 171 if(this->fsize){ 172 172 /*first, retrieve values that are in the f-set from the g-set values vector: */ 173 localvalues= (double*)xmalloc(this->fsize*sizeof(double));173 localvalues=xNew<IssmDouble>(this->fsize); 174 174 for(i=0;i<this->fsize;i++){ 175 175 localvalues[i]=this->values[this->flocaldoflist[i]]; … … 179 179 180 180 /*Free ressources:*/ 181 x free((void**)&localvalues);181 xDelete<IssmDouble>(localvalues); 182 182 } 183 183 184 184 } 185 185 /*}}}*/ 186 /*FUNCTION ElementVector::InsertIntoGlobal(Vector* pf){{{ 1*/186 /*FUNCTION ElementVector::InsertIntoGlobal(Vector* pf){{{*/ 187 187 void ElementVector::InsertIntoGlobal(Vector* pf){ 188 188 189 189 int i; 190 double* localvalues=NULL;190 IssmDouble* localvalues=NULL; 191 191 192 192 if(this->fsize){ 193 193 /*first, retrieve values that are in the f-set from the g-set values vector: */ 194 localvalues= (double*)xmalloc(this->fsize*sizeof(double));194 localvalues=xNew<IssmDouble>(this->fsize); 195 195 for(i=0;i<this->fsize;i++){ 196 196 localvalues[i]=this->values[this->flocaldoflist[i]]; … … 200 200 201 201 /*Free ressources:*/ 202 x free((void**)&localvalues);203 } 204 205 } 206 /*}}}*/ 207 /*FUNCTION ElementVector::CheckConsistency{{{ 1*/202 xDelete<IssmDouble>(localvalues); 203 } 204 205 } 206 /*}}}*/ 207 /*FUNCTION ElementVector::CheckConsistency{{{*/ 208 208 void ElementVector::CheckConsistency(void){ 209 209 /*Check element matrix values, only in debugging mode*/ 210 210 #ifdef _ISSM_DEBUG_ 211 211 for (int i=0;i<this->nrows;i++){ 212 if ( isnan(this->values[i])) _error_("NaN found in Element Vector");213 if (fabs( this->values[i])>1.e+50) _error _("Element Vector values exceeds 1.e+50");212 if (xIsNan<IssmDouble>(this->values[i])) _error2_("NaN found in Element Vector"); 213 if (fabs( this->values[i])>1.e+50) _error2_("Element Vector values exceeds 1.e+50"); 214 214 } 215 215 #endif 216 216 } 217 217 /*}}}*/ 218 /*FUNCTION ElementVector::Echo{{{ 1*/218 /*FUNCTION ElementVector::Echo{{{*/ 219 219 void ElementVector::Echo(void){ 220 220 221 221 int i,j; 222 printf("Element Vector echo: \n"); 223 printf(" nrows: %i\n",nrows); 224 225 printf(" values: \n"); 222 _printLine_("Element Vector echo:"); 223 _printLine_(" nrows: " << nrows); 224 _printLine_(" values:"); 226 225 for(i=0;i<nrows;i++){ 227 printf(" %i: %10g\n",i,values[i]); 228 } 229 230 printf(" gglobaldoflist (%p): ",gglobaldoflist); 231 if(gglobaldoflist) for(i=0;i<nrows;i++)printf("%i ",gglobaldoflist[i]); printf("\n"); 232 233 printf(" fsize: %i\n",fsize); 234 printf(" flocaldoflist (%p): ",flocaldoflist); 235 if(flocaldoflist) for(i=0;i<fsize;i++)printf("%i ",flocaldoflist[i]); printf("\n"); 236 printf(" fglobaldoflist (%p): ",fglobaldoflist); 237 if(fglobaldoflist)for(i=0;i<fsize;i++)printf("%i ",fglobaldoflist[i]); printf("\n"); 238 } 239 /*}}}*/ 240 /*FUNCTION ElementVector::Init{{{1*/ 226 _printLine_(setw(4) << right << i << ": " << setw(10) << values[i]); 227 } 228 229 _printString_(" gglobaldoflist (" << gglobaldoflist << "): "); 230 if(gglobaldoflist) for(i=0;i<nrows;i++) _printString_(" " << gglobaldoflist[i] ); 231 _printLine_(" "); 232 233 _printLine_(" fsize: " << fsize); 234 _printString_(" flocaldoflist (" << flocaldoflist << "): "); 235 if(flocaldoflist) for(i=0;i<fsize;i++) _printString_(" " << flocaldoflist[i] ); 236 _printLine_(" "); 237 _printString_(" fglobaldoflist (" << fglobaldoflist << "): "); 238 if(fglobaldoflist) for(i=0;i<fsize;i++) _printString_(" " << fglobaldoflist[i] ); 239 _printLine_(" "); 240 } 241 /*}}}*/ 242 /*FUNCTION ElementVector::Init{{{*/ 241 243 void ElementVector::Init(ElementVector* pe){ 242 244 … … 245 247 this->nrows =pe->nrows; 246 248 247 this->values= (double*)xmalloc(this->nrows*sizeof(double));248 memcpy(this->values,pe->values,this->nrows*sizeof(double));249 250 this->gglobaldoflist= (int*)xmalloc(this->nrows*sizeof(int));251 memcpy(this->gglobaldoflist,pe->gglobaldoflist,this->nrows*sizeof(int));249 this->values=xNew<IssmDouble>(this->nrows); 250 xMemCpy<IssmDouble>(this->values,pe->values,this->nrows); 251 252 this->gglobaldoflist=xNew<int>(this->nrows); 253 xMemCpy<int>(this->gglobaldoflist,pe->gglobaldoflist,this->nrows); 252 254 253 255 this->fsize=pe->fsize; 254 256 if(this->fsize){ 255 this->flocaldoflist= (int*)xmalloc(this->fsize*sizeof(int));256 memcpy(this->flocaldoflist,pe->flocaldoflist,this->fsize*sizeof(int));257 this->fglobaldoflist= (int*)xmalloc(this->fsize*sizeof(int));258 memcpy(this->fglobaldoflist,pe->fglobaldoflist,this->fsize*sizeof(int));257 this->flocaldoflist=xNew<int>(this->fsize); 258 xMemCpy<int>(this->flocaldoflist,pe->flocaldoflist,this->fsize); 259 this->fglobaldoflist=xNew<int>(this->fsize); 260 xMemCpy<int>(this->fglobaldoflist,pe->fglobaldoflist,this->fsize); 259 261 } 260 262 else{ … … 264 266 } 265 267 /*}}}*/ 266 /*FUNCTION ElementVector::SetValue{{{ 1*/267 void ElementVector::SetValue( double scalar){268 /*FUNCTION ElementVector::SetValue{{{*/ 269 void ElementVector::SetValue(IssmDouble scalar){ 268 270 269 271 int i; -
issm/trunk/src/c/objects/Numerics/ElementVector.h
r12330 r12706 10 10 11 11 /*Headers:*/ 12 /*{{{ 1*/12 /*{{{*/ 13 13 #include "../Object.h" 14 14 #include "../../toolkits/toolkits.h" … … 22 22 23 23 int nrows; 24 double* values;24 IssmDouble* values; 25 25 26 26 //gset … … 32 32 int* fglobaldoflist; 33 33 34 /*ElementVector constructors, destructors {{{ 1*/34 /*ElementVector constructors, destructors {{{*/ 35 35 ElementVector(); 36 36 ElementVector(ElementVector* pe1,ElementVector* pe2); … … 39 39 ~ElementVector(); 40 40 /*}}}*/ 41 /*ElementVector specific routines {{{ 1*/41 /*ElementVector specific routines {{{*/ 42 42 void AddToGlobal(Vector* pf); 43 43 void InsertIntoGlobal(Vector* pf); … … 45 45 void CheckConsistency(void); 46 46 void Init(ElementVector* pe); 47 void SetValue( double scalar);47 void SetValue(IssmDouble scalar); 48 48 /*}}}*/ 49 49 }; -
issm/trunk/src/c/objects/Numerics/Matrix.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 23 23 24 24 /*Matrix constructors and destructor*/ 25 /*FUNCTION Matrix::Matrix(){{{ 1*/25 /*FUNCTION Matrix::Matrix(){{{*/ 26 26 Matrix::Matrix(){ 27 27 … … 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION Matrix::Matrix(int M,int N){{{ 1*/38 /*FUNCTION Matrix::Matrix(int M,int N){{{*/ 39 39 Matrix::Matrix(int M,int N){ 40 40 … … 45 45 #endif 46 46 #ifdef _HAVE_ADOLC_ 47 this->amatrix= (adouble*)xmalloc(M*N*sizeof(adouble));48 #endif 49 } 50 /*}}}*/ 51 /*FUNCTION Matrix::Matrix(int M,int N, double sparsity){{{1*/52 Matrix::Matrix(int M,int N, double sparsity){47 this->amatrix=xNew<IssmDouble>(M*N); 48 #endif 49 } 50 /*}}}*/ 51 /*FUNCTION Matrix::Matrix(int M,int N,IssmDouble sparsity){{{*/ 52 Matrix::Matrix(int M,int N,IssmDouble sparsity){ 53 53 54 54 #ifdef _HAVE_PETSC_ … … 58 58 #endif 59 59 #ifdef _HAVE_ADOLC_ 60 this->amatrix=(adouble*)xmalloc(M*N*sizeof(adouble));61 #endif 62 } 63 /*}}}*/ 64 /*FUNCTION Matrix::Matrix( double* serial_mat, int M,int N,double sparsity){{{1*/65 Matrix::Matrix( double* serial_mat, int M,int N,double sparsity){60 this->amatrix=xNew<IssmDouble>(M*N); 61 #endif 62 } 63 /*}}}*/ 64 /*FUNCTION Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity){{{*/ 65 Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity){ 66 66 67 67 #ifdef _HAVE_PETSC_ … … 69 69 70 70 71 int* idxm= (int*)xmalloc(M*sizeof(int));72 int* idxn= (int*)xmalloc(N*sizeof(int));71 int* idxm=xNew<int>(M); 72 int* idxn=xNew<int>(N); 73 73 for(i=0;i<M;i++)idxm[i]=i; 74 74 for(i=0;i<N;i++)idxn[i]=i; … … 79 79 MatAssemblyEnd(this->matrix,MAT_FINAL_ASSEMBLY); 80 80 81 x free((void**)&idxm);82 x free((void**)&idxn);81 xDelete<int>(idxm); 82 xDelete<int>(idxn); 83 83 #else 84 84 this->matrix=new SeqMat(serial_mat,M,N,sparsity); 85 85 #endif 86 86 #ifdef _HAVE_ADOLC_ 87 this->amatrix= (adouble*)xmalloc(M*N*sizeof(adouble));88 #endif 89 } 90 /*}}}*/ 91 /*FUNCTION Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode){{{ 1*/87 this->amatrix=xNew<IssmDouble>(M*N); 88 #endif 89 } 90 /*}}}*/ 91 /*FUNCTION Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode){{{*/ 92 92 Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode){ 93 93 … … 98 98 #endif 99 99 #ifdef _HAVE_ADOLC_ 100 this->amatrix= (adouble*)xmalloc(M*N*sizeof(adouble));101 #endif 102 } 103 /*}}}*/ 104 /*FUNCTION Matrix::~Matrix(){{{ 1*/100 this->amatrix=xNew<IssmDouble>(M*N); 101 #endif 102 } 103 /*}}}*/ 104 /*FUNCTION Matrix::~Matrix(){{{*/ 105 105 Matrix::~Matrix(){ 106 106 … … 111 111 #endif 112 112 #ifdef _HAVE_ADOLC_ 113 x free((void**)&this->amatrix);113 xDelete<IssmDouble>(this->amatrix); 114 114 #endif 115 115 } … … 117 117 118 118 /*Matrix specific routines: */ 119 /*FUNCTION Matrix::Echo{{{ 1*/119 /*FUNCTION Matrix::Echo{{{*/ 120 120 void Matrix::Echo(void){ 121 121 … … 130 130 #ifdef _HAVE_ADOLC_ 131 131 /*Not sure about that one. Should we use the overloaded operator >>?*/ 132 printf("ADOLC Matrix equivalent:" );133 for(i=0;i<M;i++){134 for(j=0;j<N;j++){135 printf("%g ",*(amatrix+N*i+j));136 }137 printf("\n");138 }139 #endif 140 } 141 /*}}}*/ 142 /*FUNCTION Matrix::Assemble{{{ 1*/132 _printString_("ADOLC Matrix equivalent:" ); 133 // for(i=0;i<M;i++){ 134 // for(j=0;j<N;j++){ 135 // _printString_(*(amatrix+N*i+j) << " "); 136 // } 137 // _printLine_(""); 138 // } 139 #endif 140 } 141 /*}}}*/ 142 /*FUNCTION Matrix::Assemble{{{*/ 143 143 void Matrix::Assemble(void){ 144 144 #ifdef _HAVE_PETSC_ … … 155 155 } 156 156 /*}}}*/ 157 /*FUNCTION Matrix::Norm{{{ 1*/158 double Matrix::Norm(NormMode norm_type){159 160 double norm=0;157 /*FUNCTION Matrix::Norm{{{*/ 158 IssmDouble Matrix::Norm(NormMode norm_type){ 159 160 IssmDouble norm=0; 161 161 #ifdef _HAVE_PETSC_ 162 162 _assert_(this->matrix); … … 168 168 } 169 169 /*}}}*/ 170 /*FUNCTION Matrix::GetSize{{{ 1*/170 /*FUNCTION Matrix::GetSize{{{*/ 171 171 void Matrix::GetSize(int* pM,int* pN){ 172 172 … … 179 179 } 180 180 /*}}}*/ 181 /*FUNCTION Matrix::GetLocalSize{{{ 1*/181 /*FUNCTION Matrix::GetLocalSize{{{*/ 182 182 void Matrix::GetLocalSize(int* pM,int* pN){ 183 183 … … 190 190 } 191 191 /*}}}*/ 192 /*FUNCTION Matrix::MatMult{{{ 1*/192 /*FUNCTION Matrix::MatMult{{{*/ 193 193 void Matrix::MatMult(Vector* X,Vector* AX){ 194 194 … … 202 202 } 203 203 /*}}}*/ 204 /*FUNCTION Matrix::Duplicate{{{ 1*/204 /*FUNCTION Matrix::Duplicate{{{*/ 205 205 Matrix* Matrix::Duplicate(void){ 206 206 … … 219 219 } 220 220 /*}}}*/ 221 /*FUNCTION Matrix::ToSerial{{{ 1*/222 double* Matrix::ToSerial(void){223 224 double* output=NULL;221 /*FUNCTION Matrix::ToSerial{{{*/ 222 IssmDouble* Matrix::ToSerial(void){ 223 224 IssmDouble* output=NULL; 225 225 226 226 #ifdef _HAVE_PETSC_ … … 232 232 } 233 233 /*}}}*/ 234 /*FUNCTION Matrix::SetValues{{{ 1*/235 void Matrix::SetValues(int m,int* idxm,int n,int* idxn, double* values,InsMode mode){234 /*FUNCTION Matrix::SetValues{{{*/ 235 void Matrix::SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){ 236 236 237 237 #ifdef _HAVE_PETSC_ … … 242 242 } 243 243 /*}}}*/ 244 /*FUNCTION Matrix::Convert{{{ 1*/244 /*FUNCTION Matrix::Convert{{{*/ 245 245 void Matrix::Convert(MatrixType type){ 246 246 -
issm/trunk/src/c/objects/Numerics/Matrix.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 16 16 #include "../../toolkits/toolkits.h" 17 17 #include "../../EnumDefinitions/EnumDefinitions.h" 18 19 #ifdef _HAVE_ADOLC_20 #include "adolc.h"21 #endif22 18 23 19 class Vector; … … 35 31 #endif 36 32 #ifdef _HAVE_ADOLC_ 37 adouble* amatrix;33 IssmDouble* amatrix; 38 34 #endif 39 35 40 /*Matrix constructors, destructors {{{ 1*/36 /*Matrix constructors, destructors {{{*/ 41 37 Matrix(); 42 38 Matrix(int M,int N); 43 Matrix(int M,int N, double sparsity);44 Matrix( double* serial_mat,int M,int N,double sparsity);39 Matrix(int M,int N,IssmDouble sparsity); 40 Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity); 45 41 Matrix(int M,int N,int connectivity,int numberofdofspernode); 46 42 ~Matrix(); 47 43 /*}}}*/ 48 /*Matrix specific routines {{{ 1*/44 /*Matrix specific routines {{{*/ 49 45 void Echo(void); 50 46 void Assemble(void); 51 double Norm(NormMode norm_type);47 IssmDouble Norm(NormMode norm_type); 52 48 void GetSize(int* pM,int* pN); 53 49 void GetLocalSize(int* pM,int* pN); 54 50 void MatMult(Vector* X,Vector* AX); 55 51 Matrix* Duplicate(void); 56 double* ToSerial(void);57 void SetValues(int m,int* idxm,int n,int* idxn, double* values,InsMode mode);52 IssmDouble* ToSerial(void); 53 void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode); 58 54 void Convert(MatrixType type); 59 55 /*}}}*/ -
issm/trunk/src/c/objects/Numerics/Vector.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 22 22 23 23 /*Vector constructors and destructor*/ 24 /*FUNCTION Vector::Vector(){{{ 1*/24 /*FUNCTION Vector::Vector(){{{*/ 25 25 Vector::Vector(){ 26 26 … … 35 35 } 36 36 /*}}}*/ 37 /*FUNCTION Vector::Vector(int M,bool fromlocalsize){{{ 1*/37 /*FUNCTION Vector::Vector(int M,bool fromlocalsize){{{*/ 38 38 Vector::Vector(int pM,bool fromlocalsize){ 39 39 … … 44 44 #endif 45 45 #ifdef _HAVE_ADOLC_ 46 this->avector= (adouble*)xmalloc(pM*sizeof(adouble));47 #endif 48 } 49 /*}}}*/ 50 /*FUNCTION Vector::Vector( double* serial_vec,int M){{{1*/51 Vector::Vector( double* serial_vec,int M){52 53 #ifdef _HAVE_PETSC_ 54 int* idxm= (int*)xmalloc(M*sizeof(int));46 this->avector=xNew<IssmDouble>(pM); 47 #endif 48 } 49 /*}}}*/ 50 /*FUNCTION Vector::Vector(IssmDouble* serial_vec,int M){{{*/ 51 Vector::Vector(IssmDouble* serial_vec,int M){ 52 53 #ifdef _HAVE_PETSC_ 54 int* idxm=xNew<int>(M); 55 55 for(int i=0;i<M;i++) idxm[i]=i; 56 56 … … 60 60 VecAssemblyEnd(this->vector); 61 61 62 x free((void**)&idxm);62 xDelete<int>(idxm); 63 63 #else 64 64 this->vector=new SeqVec(serial_vec,M); 65 65 #endif 66 66 #ifdef _HAVE_ADOLC_ 67 this->avector= (adouble*)xmalloc(M*sizeof(adouble));67 this->avector=xNew<IssmDouble>(M); 68 68 #endif 69 69 } 70 70 /*}}}*/ 71 71 #ifdef _HAVE_PETSC_ 72 /*FUNCTION Vector::Vector(Vec petsc_vec){{{ 1*/72 /*FUNCTION Vector::Vector(Vec petsc_vec){{{*/ 73 73 Vector::Vector(Vec petsc_vec){ 74 74 … … 86 86 #endif 87 87 #if defined(_HAVE_GSL_) && !defined(_HAVE_PETSC_) 88 /*FUNCTION Vector::Vector(SeqVec* seq_vec){{{ 1*/88 /*FUNCTION Vector::Vector(SeqVec* seq_vec){{{*/ 89 89 Vector::Vector(SeqVec* seq_vec){ 90 90 … … 100 100 #endif 101 101 102 /*FUNCTION Vector::~Vector(){{{ 1*/102 /*FUNCTION Vector::~Vector(){{{*/ 103 103 Vector::~Vector(){ 104 104 … … 109 109 #endif 110 110 #ifdef _HAVE_ADOLC_ 111 x free((void**)&this->avector);111 xDelete<IssmDouble>(this->avector); 112 112 #endif 113 113 } … … 115 115 116 116 /*Vector specific routines: */ 117 /*FUNCTION Vector::Echo{{{ 1*/117 /*FUNCTION Vector::Echo{{{*/ 118 118 void Vector::Echo(void){ 119 119 … … 132 132 } 133 133 /*}}}*/ 134 /*FUNCTION Vector::Assemble{{{ 1*/134 /*FUNCTION Vector::Assemble{{{*/ 135 135 void Vector::Assemble(void){ 136 136 … … 145 145 } 146 146 /*}}}*/ 147 /*FUNCTION Vector::SetValues{{{ 1*/148 void Vector::SetValues(int ssize, int* list, double* values, InsMode mode){147 /*FUNCTION Vector::SetValues{{{*/ 148 void Vector::SetValues(int ssize, int* list, IssmDouble* values, InsMode mode){ 149 149 150 150 … … 158 158 } 159 159 /*}}}*/ 160 /*FUNCTION Vector::SetValue{{{ 1*/161 void Vector::SetValue(int dof, double value, InsMode mode){160 /*FUNCTION Vector::SetValue{{{*/ 161 void Vector::SetValue(int dof, IssmDouble value, InsMode mode){ 162 162 163 163 #ifdef _HAVE_PETSC_ … … 170 170 } 171 171 /*}}}*/ 172 /*FUNCTION Vector::GetValue{{{ 1*/173 void Vector::GetValue( double* pvalue,int dof){172 /*FUNCTION Vector::GetValue{{{*/ 173 void Vector::GetValue(IssmDouble* pvalue,int dof){ 174 174 175 175 #ifdef _HAVE_PETSC_ … … 181 181 } 182 182 /*}}}*/ 183 /*FUNCTION Vector::GetSize{{{ 1*/183 /*FUNCTION Vector::GetSize{{{*/ 184 184 void Vector::GetSize(int* pM){ 185 185 … … 193 193 } 194 194 /*}}}*/ 195 /*FUNCTION Vector::IsEmpty{{{ 1*/195 /*FUNCTION Vector::IsEmpty{{{*/ 196 196 bool Vector::IsEmpty(void){ 197 197 … … 207 207 } 208 208 /*}}}*/ 209 /*FUNCTION Vector::GetLocalSize{{{ 1*/209 /*FUNCTION Vector::GetLocalSize{{{*/ 210 210 void Vector::GetLocalSize(int* pM){ 211 211 … … 219 219 } 220 220 /*}}}*/ 221 /*FUNCTION Vector::Duplicate{{{ 1*/221 /*FUNCTION Vector::Duplicate{{{*/ 222 222 Vector* Vector::Duplicate(void){ 223 223 … … 237 237 } 238 238 /*}}}*/ 239 /*FUNCTION Vector::Set{{{ 1*/240 void Vector::Set( double value){239 /*FUNCTION Vector::Set{{{*/ 240 void Vector::Set(IssmDouble value){ 241 241 242 242 #ifdef _HAVE_PETSC_ … … 249 249 } 250 250 /*}}}*/ 251 /*FUNCTION Vector::AXPY{{{ 1*/252 void Vector::AXPY(Vector* X, double a){251 /*FUNCTION Vector::AXPY{{{*/ 252 void Vector::AXPY(Vector* X, IssmDouble a){ 253 253 254 254 #ifdef _HAVE_PETSC_ … … 260 260 } 261 261 /*}}}*/ 262 /*FUNCTION Vector::AYPX{{{ 1*/263 void Vector::AYPX(Vector* X, double a){262 /*FUNCTION Vector::AYPX{{{*/ 263 void Vector::AYPX(Vector* X, IssmDouble a){ 264 264 265 265 #ifdef _HAVE_PETSC_ … … 272 272 } 273 273 /*}}}*/ 274 /*FUNCTION Vector::ToMPISerial{{{ 1*/275 double* Vector::ToMPISerial(void){276 277 double* vec_serial=NULL;274 /*FUNCTION Vector::ToMPISerial{{{*/ 275 IssmDouble* Vector::ToMPISerial(void){ 276 277 IssmDouble* vec_serial=NULL; 278 278 279 279 #ifdef _HAVE_PETSC_ … … 287 287 } 288 288 /*}}}*/ 289 /*FUNCTION Vector::Copy{{{ 1*/289 /*FUNCTION Vector::Copy{{{*/ 290 290 void Vector::Copy(Vector* to){ 291 291 … … 298 298 } 299 299 /*}}}*/ 300 /*FUNCTION Vector::Norm{{{ 1*/301 double Vector::Norm(NormMode norm_type){302 303 double norm=0;300 /*FUNCTION Vector::Norm{{{*/ 301 IssmDouble Vector::Norm(NormMode norm_type){ 302 303 IssmDouble norm=0; 304 304 #ifdef _HAVE_PETSC_ 305 305 _assert_(this->vector); … … 311 311 } 312 312 /*}}}*/ 313 /*FUNCTION Vector::Scale{{{ 1*/314 void Vector::Scale( double scale_factor){313 /*FUNCTION Vector::Scale{{{*/ 314 void Vector::Scale(IssmDouble scale_factor){ 315 315 316 316 #ifdef _HAVE_PETSC_ … … 322 322 } 323 323 /*}}}*/ 324 /*FUNCTION Vector::Dot{{{ 1*/325 double Vector::Dot(Vector* vector){326 327 double dot;324 /*FUNCTION Vector::Dot{{{*/ 325 IssmDouble Vector::Dot(Vector* vector){ 326 327 IssmDouble dot; 328 328 #ifdef _HAVE_PETSC_ 329 329 _assert_(this->vector); … … 335 335 } 336 336 /*}}}*/ 337 /*FUNCTION Vector::PointwiseDivide{{{ 1*/337 /*FUNCTION Vector::PointwiseDivide{{{*/ 338 338 void Vector::PointwiseDivide(Vector* x,Vector* y){ 339 339 -
issm/trunk/src/c/objects/Numerics/Vector.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 17 17 #include "../../EnumDefinitions/EnumDefinitions.h" 18 18 19 #ifdef _HAVE_ADOLC_20 #include "adolc.h"21 #endif22 23 19 /*}}}*/ 24 20 … … 33 29 #endif 34 30 #ifdef _HAVE_ADOLC_ 35 adouble* avector;31 IssmDouble* avector; 36 32 #endif 37 33 38 /*Vector constructors, destructors {{{ 1*/34 /*Vector constructors, destructors {{{*/ 39 35 Vector(); 40 36 Vector(int M,bool fromlocalsize=false); 41 Vector( double* serial_vec,int pM);37 Vector(IssmDouble* serial_vec,int pM); 42 38 #ifdef _HAVE_PETSC_ 43 39 Vector(Vec petsc_vec); … … 48 44 ~Vector(); 49 45 /*}}}*/ 50 /*Vector specific routines {{{ 1*/46 /*Vector specific routines {{{*/ 51 47 void Echo(void); 52 void AXPY(Vector *X, double a);53 void AYPX(Vector *X, double a);48 void AXPY(Vector *X, IssmDouble a); 49 void AYPX(Vector *X, IssmDouble a); 54 50 void Assemble(void); 55 51 void Copy(Vector *to); 56 double Dot(Vector *vector);52 IssmDouble Dot(Vector *vector); 57 53 Vector *Duplicate(void); 58 void GetValue( double *pvalue, int dof);54 void GetValue(IssmDouble *pvalue, int dof); 59 55 void GetSize(int *pM); 60 56 void GetLocalSize(int *pM); 61 57 bool IsEmpty(void); 62 double Norm(NormMode norm_type);58 IssmDouble Norm(NormMode norm_type); 63 59 void PointwiseDivide(Vector *x,Vector*y); 64 void Scale( double scale_factor);65 void Set( double value);66 void SetValues(int ssize, int *list, double*values, InsMode mode);67 void SetValue(int dof, double value, InsMode mode);68 double *ToMPISerial(void);60 void Scale(IssmDouble scale_factor); 61 void Set(IssmDouble value); 62 void SetValues(int ssize, int *list, IssmDouble*values, InsMode mode); 63 void SetValue(int dof, IssmDouble value, InsMode mode); 64 IssmDouble *ToMPISerial(void); 69 65 /*}}}*/ 70 66 }; -
issm/trunk/src/c/objects/Options/Option.cpp
r9761 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION Option::Option(){{{ 1*/23 /*FUNCTION Option::Option(){{{*/ 24 24 Option::Option(){ 25 25 … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Option::~Option(){{{ 1*/33 /*FUNCTION Option::~Option(){{{*/ 34 34 Option::~Option(){ 35 35 36 if(size) x free((void**)&size);37 if(name) x free((void**)&name);36 if(size) xDelete<int>(size); 37 if(name) xDelete<char>(name); 38 38 39 39 } … … 41 41 42 42 /*Other*/ 43 /*FUNCTION Option::Echo {{{ 1*/43 /*FUNCTION Option::Echo {{{*/ 44 44 void Option::Echo(){ 45 45 … … 47 47 bool flag=true; 48 48 49 _printf_(flag," name: \"%s\"\n" ,name);50 _printf_(flag," numel: %d\n" ,numel);51 _printf_(flag," ndims: %d\n" ,ndims);49 if(flag) _pprintLine_(" name: \"" << name << "\""); 50 if(flag) _pprintLine_(" numel: " << numel); 51 if(flag) _pprintLine_(" ndims: " << ndims); 52 52 if(size){ 53 53 StringFromSize(cstr,size,ndims); 54 _printf_(flag," size: %s\n" ,cstr);54 if(flag) _pprintLine_(" size: " << cstr); 55 55 } 56 else _printf_(flag," size: [empty]\n");56 else if(flag) _pprintLine_(" size: [empty]"); 57 57 } 58 58 /*}}}*/ 59 /*FUNCTION Option::DeepEcho() {{{ 1*/59 /*FUNCTION Option::DeepEcho() {{{*/ 60 60 void Option::DeepEcho(){ 61 61 … … 67 67 } 68 68 /*}}}*/ 69 /*FUNCTION Option::DeepEcho(char* indent) {{{ 1*/69 /*FUNCTION Option::DeepEcho(char* indent) {{{*/ 70 70 void Option::DeepEcho(char* indent){ 71 71 … … 73 73 bool flag=true; 74 74 75 _printf_(flag,"%s name: \"%s\"\n" ,indent,name);76 _printf_(flag,"%s numel: %d\n" ,indent,numel);77 _printf_(flag,"%s ndims: %d\n" ,indent,ndims);75 if(flag) _pprintLine_(indent << " name: \"" << name << "\""); 76 if(flag) _pprintLine_(indent << " numel: " << numel); 77 if(flag) _pprintLine_(indent << " ndims: " << ndims); 78 78 if(size){ 79 79 StringFromSize(cstr,size,ndims); 80 _printf_(flag,"%s size: %s\n" ,indent,cstr);80 if(flag) _pprintLine_(indent << " size: " << cstr); 81 81 } 82 else _printf_(flag,"%s size: [empty]\n" ,indent);82 else if(flag) _pprintLine_(indent << " size: [empty]"); 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION Option::Name {{{ 1*/85 /*FUNCTION Option::Name {{{*/ 86 86 char* Option::Name(){ 87 87 … … 89 89 } 90 90 /*}}}*/ 91 /*FUNCTION Option::NumEl {{{ 1*/91 /*FUNCTION Option::NumEl {{{*/ 92 92 int Option::NumEl(){ 93 93 … … 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION Option::NDims {{{ 1*/97 /*FUNCTION Option::NDims {{{*/ 98 98 int Option::NDims(){ 99 99 … … 101 101 } 102 102 /*}}}*/ 103 /*FUNCTION Option::Size {{{ 1*/103 /*FUNCTION Option::Size {{{*/ 104 104 int* Option::Size(){ 105 105 … … 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION Option::Get {{{ 1*/109 /*FUNCTION Option::Get {{{*/ 110 110 //void* Option::Get(){ 111 111 -
issm/trunk/src/c/objects/Options/Option.h
r12330 r12706 6 6 #define _OPTIONOBJECT_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 23 23 int* size; 24 24 25 /*Option constructors, destructors {{{ 1*/25 /*Option constructors, destructors {{{*/ 26 26 Option(); 27 27 ~Option(); 28 28 /*}}}*/ 29 /*Object virtual functions definitions:{{{ 1*/29 /*Object virtual functions definitions:{{{*/ 30 30 virtual void Echo(); 31 31 virtual void DeepEcho(); 32 32 virtual void DeepEcho(char* indent); 33 int Id(){_error _("Not implemented yet");};34 int MyRank(){_error _("Not implemented yet");};33 int Id(){_error2_("Not implemented yet");}; 34 int MyRank(){_error2_("Not implemented yet");}; 35 35 int ObjectEnum(){return OptionEnum;}; 36 Object* copy(){_error _("Not implemented yet");};36 Object* copy(){_error2_("Not implemented yet");}; 37 37 /*}}}*/ 38 38 … … 43 43 virtual int* Size()=0; 44 44 virtual void Get(int* pvalue)=0; 45 virtual void Get( double* pvalue)=0;45 virtual void Get(IssmDouble* pvalue)=0; 46 46 virtual void Get(bool* pvalue)=0; 47 47 virtual void Get(char** pvalue)=0; 48 48 virtual void Get(char*** ppvalue,int *pnumel)=0; 49 virtual void Get( double** pvalue,int *pnumel)=0;49 virtual void Get(IssmDouble** pvalue,int *pnumel)=0; 50 50 virtual void Get(Options** pvalue)=0; 51 51 virtual void Get(Options*** ppvalue,int *pnumel)=0; -
issm/trunk/src/c/objects/Options/OptionCell.cpp
r9761 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION OptionCell::OptionCell(){{{ 1*/23 /*FUNCTION OptionCell::OptionCell(){{{*/ 24 24 OptionCell::OptionCell(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION OptionCell::~OptionCell(){{{ 1*/30 /*FUNCTION OptionCell::~OptionCell(){{{*/ 31 31 OptionCell::~OptionCell(){ 32 32 … … 40 40 41 41 /*Other*/ 42 /*FUNCTION OptionCell::Echo {{{ 1*/42 /*FUNCTION OptionCell::Echo {{{*/ 43 43 void OptionCell::Echo(){ 44 44 … … 46 46 bool flag = true; 47 47 48 _printf_(flag,"OptionCell Echo:\n");48 if(flag) _pprintLine_("OptionCell Echo:"); 49 49 Option::Echo(); 50 50 51 51 if (values && size) { 52 52 StringFromSize(cstr,size,ndims); 53 _printf_(flag," values: %s %s\n" ,cstr,"cell");53 if(flag) _pprintLine_(" values: " << cstr << " " << "cell"); 54 54 } 55 else _printf_(flag," values: [empty]\n");55 else if(flag) _pprintLine_(" values: [empty]"); 56 56 } 57 57 /*}}}*/ 58 /*FUNCTION OptionCell::DeepEcho() {{{ 1*/58 /*FUNCTION OptionCell::DeepEcho() {{{*/ 59 59 void OptionCell::DeepEcho(){ 60 60 … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION OptionCell::DeepEcho(char* indent) {{{ 1*/68 /*FUNCTION OptionCell::DeepEcho(char* indent) {{{*/ 69 69 void OptionCell::DeepEcho(char* indent){ 70 70 … … 75 75 bool flag=true; 76 76 77 _printf_(flag,"%sOptionCell DeepEcho:\n",indent);77 if(flag) _pprintLine_(indent << "OptionCell DeepEcho:"); 78 78 Option::DeepEcho(indent); 79 79 80 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));80 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 81 81 strcat(indent2," "); 82 82 83 83 if (values->Size()) { 84 dims= (int *) xmalloc(ndims*sizeof(int));84 dims=xNew<int>(ndims); 85 85 for (i=0; i<values->Size(); i++) { 86 86 ColumnWiseDimsFromIndex(dims,i,size,ndims); 87 87 StringFromDims(cstr,dims,ndims); 88 _printf_(flag,"%s values: -------- begin %s --------\n" ,indent,cstr);88 if(flag) _pprintLine_(indent << " values: -------- begin " << cstr << " --------"); 89 89 ((Option *)values->GetObjectByOffset(i))->DeepEcho(indent2); 90 _printf_(flag,"%s values: -------- end %s --------\n" ,indent,cstr);90 if(flag) _pprintLine_(indent << " values: -------- end " << cstr << " --------"); 91 91 } 92 x free((void**)&dims);92 xDelete<int>(dims); 93 93 } 94 else _printf_(flag,"%s values: [empty]\n" ,indent);94 else if(flag) _pprintLine_(indent << " values: [empty]"); 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION OptionCell::Name {{{ 1*/97 /*FUNCTION OptionCell::Name {{{*/ 98 98 char* OptionCell::Name(){ 99 99 … … 101 101 } 102 102 /*}}}*/ 103 /*FUNCTION OptionCell::NumEl {{{ 1*/103 /*FUNCTION OptionCell::NumEl {{{*/ 104 104 int OptionCell::NumEl(){ 105 105 … … 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION OptionCell::NDims {{{ 1*/109 /*FUNCTION OptionCell::NDims {{{*/ 110 110 int OptionCell::NDims(){ 111 111 … … 113 113 } 114 114 /*}}}*/ 115 /*FUNCTION OptionCell::Size {{{ 1*/115 /*FUNCTION OptionCell::Size {{{*/ 116 116 int* OptionCell::Size(){ 117 117 … … 119 119 } 120 120 /*}}}*/ 121 /*FUNCTION OptionCell::Get(Options** pvalue) {{{ 1*/121 /*FUNCTION OptionCell::Get(Options** pvalue) {{{*/ 122 122 void OptionCell::Get(Options** pvalue){ 123 123 -
issm/trunk/src/c/objects/Options/OptionCell.h
r12330 r12706 6 6 #define _OPTIONCELL_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 20 20 Options* values; 21 21 22 /*OptionCell constructors, destructors {{{ 1*/22 /*OptionCell constructors, destructors {{{*/ 23 23 OptionCell(); 24 24 ~OptionCell(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{*/ 27 27 void Echo(); 28 28 void DeepEcho(); 29 29 void DeepEcho(char* indent); 30 int Id(){_error _("Not implemented yet");};31 int MyRank(){_error _("Not implemented yet");};30 int Id(){_error2_("Not implemented yet");}; 31 int MyRank(){_error2_("Not implemented yet");}; 32 32 int ObjectEnum(){return OptionCellEnum;}; 33 Object* copy(){_error _("Not implemented yet");};33 Object* copy(){_error2_("Not implemented yet");}; 34 34 /*}}}*/ 35 35 … … 39 39 int NDims(); 40 40 int* Size(); 41 void Get(int* pvalue){_error _("An OptionCell object cannot return a int");};42 void Get( double* pvalue){_error_("An OptionCell object cannot return a double");};43 void Get(bool* pvalue){ _error _("An OptionCell object cannot return a bool");};44 void Get(char** pvalue){ _error _("An OptionCell object cannot return a string");};45 void Get(char*** ppvalue,int *pnumel){ _error _("An OptionCell object cannot return a string vec");};46 void Get( double** pvalue,int *pnumel){ _error_("An OptionCell object cannot return a double vec");};41 void Get(int* pvalue){_error2_("An OptionCell object cannot return a int");}; 42 void Get(IssmDouble* pvalue){_error2_("An OptionCell object cannot return a IssmDouble");}; 43 void Get(bool* pvalue){ _error2_("An OptionCell object cannot return a bool");}; 44 void Get(char** pvalue){ _error2_("An OptionCell object cannot return a string");}; 45 void Get(char*** ppvalue,int *pnumel){ _error2_("An OptionCell object cannot return a string vec");}; 46 void Get(IssmDouble** pvalue,int *pnumel){ _error2_("An OptionCell object cannot return a IssmDouble vec");}; 47 47 void Get(Options** pvalue); 48 void Get(Options*** ppvalue,int *pnumel){ _error _("An OptionCell object cannot return an Options DataSet vec");};48 void Get(Options*** ppvalue,int *pnumel){ _error2_("An OptionCell object cannot return an Options DataSet vec");}; 49 49 50 50 }; -
issm/trunk/src/c/objects/Options/OptionChar.cpp
r9761 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION OptionChar::OptionChar(){{{ 1*/23 /*FUNCTION OptionChar::OptionChar(){{{*/ 24 24 OptionChar::OptionChar(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION OptionChar::~OptionChar(){{{ 1*/30 /*FUNCTION OptionChar::~OptionChar(){{{*/ 31 31 OptionChar::~OptionChar(){ 32 32 33 if (values) x free((void**)&values);33 if (values) xDelete<char>(values); 34 34 35 35 } … … 37 37 38 38 /*Other*/ 39 /*FUNCTION OptionChar::Echo {{{ 1*/39 /*FUNCTION OptionChar::Echo {{{*/ 40 40 void OptionChar::Echo(){ 41 41 … … 43 43 bool flag=true; 44 44 45 _printf_(flag,"OptionChar Echo:\n");45 if(flag) _pprintLine_("OptionChar Echo:"); 46 46 Option::Echo(); 47 47 … … 49 49 // if (numel == 1) { 50 50 if (1) { 51 // _printf_(flag," values: \"%s\"\n" ,values[0]);52 _printf_(flag," values: \"%s\"\n" ,values);51 // if(flag) _pprintLine_(" values: \"" << values[0] << "\""); 52 if(flag) _pprintLine_(" values: \"" << values << "\""); 53 53 } 54 54 else { 55 55 StringFromSize(cstr,size,ndims); 56 _printf_(flag," values: %s %s\n" ,cstr,"char");56 if(flag) _pprintLine_(" values: " << cstr << " " << "char"); 57 57 } 58 58 } 59 else _printf_(flag," values: [empty]\n");59 else if(flag) _pprintLine_(" values: [empty]"); 60 60 } 61 61 /*}}}*/ 62 /*FUNCTION OptionChar::DeepEcho() {{{ 1*/62 /*FUNCTION OptionChar::DeepEcho() {{{*/ 63 63 void OptionChar::DeepEcho(){ 64 64 … … 70 70 } 71 71 /*}}}*/ 72 /*FUNCTION OptionChar::DeepEcho(char* indent) {{{ 1*/72 /*FUNCTION OptionChar::DeepEcho(char* indent) {{{*/ 73 73 void OptionChar::DeepEcho(char* indent){ 74 74 … … 79 79 bool flag=true; 80 80 81 _printf_(flag,"%sOptionChar DeepEcho:\n",indent);81 if(flag) _pprintLine_(indent << "OptionChar DeepEcho:"); 82 82 Option::DeepEcho(indent); 83 83 84 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));84 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 85 85 strcat(indent2," "); 86 86 87 87 if (values) { 88 88 if (ndims == 2 && size[0] == 1) { 89 _printf_(flag,"%s values: \"%s\"\n" ,indent,values);89 if(flag) _pprintLine_(indent << " values: \"" << values << "\""); 90 90 } 91 91 else { … … 93 93 for (i=2; i<ndims; i++) nstr*=size[i]; 94 94 95 dims= (int *) xmalloc(ndims*sizeof(int));95 dims=xNew<int>(ndims); 96 96 for (i=0; i<nstr; i++) { 97 97 RowWiseDimsFromIndex(dims,ipt,size,ndims); 98 98 StringFromDims(cstr,dims,ndims); 99 _printf_(flag,"%s values%s: \"%.*s\"\n" ,indent,cstr,size[1],&(values[ipt]));99 if(flag) _pprintLine_(indent << " values" << cstr << ": \"" << size[1] << "*s\""); 100 100 ipt+=size[1]; 101 101 } 102 x free((void**)&dims);102 xDelete<int>(dims); 103 103 } 104 104 } 105 else _printf_(flag,"%s values: [empty]\n" ,indent);105 else if(flag) _pprintLine_(indent << " values: [empty]"); 106 106 } 107 107 /*}}}*/ 108 /*FUNCTION OptionChar::Name {{{ 1*/108 /*FUNCTION OptionChar::Name {{{*/ 109 109 char* OptionChar::Name(){ 110 110 … … 112 112 } 113 113 /*}}}*/ 114 /*FUNCTION OptionChar::NumEl {{{ 1*/114 /*FUNCTION OptionChar::NumEl {{{*/ 115 115 int OptionChar::NumEl(){ 116 116 … … 118 118 } 119 119 /*}}}*/ 120 /*FUNCTION OptionChar::NDims {{{ 1*/120 /*FUNCTION OptionChar::NDims {{{*/ 121 121 int OptionChar::NDims(){ 122 122 … … 124 124 } 125 125 /*}}}*/ 126 /*FUNCTION OptionChar::Size {{{ 1*/126 /*FUNCTION OptionChar::Size {{{*/ 127 127 int* OptionChar::Size(){ 128 128 … … 130 130 } 131 131 /*}}}*/ 132 /*FUNCTION OptionChar::Get(char** pvalue) {{{ 1*/132 /*FUNCTION OptionChar::Get(char** pvalue) {{{*/ 133 133 void OptionChar::Get(char** pvalue){ 134 134 … … 138 138 stringsize=strlen(this->values)+1; 139 139 140 outstring= (char*)xmalloc(stringsize*sizeof(char));141 memcpy(outstring,this->values,stringsize*sizeof(char));140 outstring=xNew<char>(stringsize); 141 xMemCpy<char>(outstring,this->values,stringsize); 142 142 143 143 *pvalue=outstring; 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION OptionChar::Get(char*** ppvalue,int *pnumel) {{{ 1*/146 /*FUNCTION OptionChar::Get(char*** ppvalue,int *pnumel) {{{*/ 147 147 void OptionChar::Get(char*** ppvalue,int *pnumel){ 148 148 … … 153 153 /*We should first check that the size is at least one*/ 154 154 if(this->NumEl()<=0){ 155 _error _("option \"%s\" is empty and cannot return a string vector",this->name);155 _error2_("option \"" << this->name << "\" is empty and cannot return a string vector"); 156 156 } 157 157 … … 162 162 163 163 /*Break concatenated string into individual strings*/ 164 *ppvalue= (char **) xmalloc(nstr*sizeof(char *));164 *ppvalue=xNew<char*>(nstr); 165 165 for (i=0; i<nstr; i++) { 166 outstring= (char*)xmalloc(stringsize*sizeof(char));167 memcpy(outstring,&(this->values[ipt]),(stringsize-1)*sizeof(char));166 outstring=xNew<char>(stringsize); 167 xMemCpy<char>(outstring,&(this->values[ipt]),(stringsize-1)); 168 168 outstring[stringsize-1]='\0'; 169 169 (*ppvalue)[i]=outstring; -
issm/trunk/src/c/objects/Options/OptionChar.h
r12330 r12706 6 6 #define _OPTIONCHAR_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 20 20 char* values; 21 21 22 /*OptionChar constructors, destructors {{{ 1*/22 /*OptionChar constructors, destructors {{{*/ 23 23 OptionChar(); 24 24 ~OptionChar(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{*/ 27 27 void Echo(); 28 28 void DeepEcho(); 29 29 void DeepEcho(char* indent); 30 int Id(){_error _("Not implemented yet");};31 int MyRank(){_error _("Not implemented yet");};30 int Id(){_error2_("Not implemented yet");}; 31 int MyRank(){_error2_("Not implemented yet");}; 32 32 int ObjectEnum(){return OptionCharEnum;}; 33 Object* copy(){_error _("Not implemented yet");};33 Object* copy(){_error2_("Not implemented yet");}; 34 34 /*}}}*/ 35 35 … … 39 39 int NDims(); 40 40 int* Size(); 41 void Get(int* pvalue){_error _("An OptionChar object cannot return a int");};42 void Get( double* pvalue){_error_("An OptionChar object cannot return a double");};43 void Get(bool* pvalue){ _error _("An OptionChar object cannot return a bool");};41 void Get(int* pvalue){_error2_("An OptionChar object cannot return a int");}; 42 void Get(IssmDouble* pvalue){_error2_("An OptionChar object cannot return a IssmDouble");}; 43 void Get(bool* pvalue){ _error2_("An OptionChar object cannot return a bool");}; 44 44 void Get(char** pvalue); 45 45 void Get(char*** ppvalue,int *pnumel); 46 void Get( double** pvalue,int *pnumel){ _error_("An OptionChar object cannot return a double vec");};47 void Get(Options** pvalue){ _error _("An OptionChar object cannot return an Options DataSet");};48 void Get(Options*** ppvalue,int *pnumel){ _error _("An OptionChar object cannot return an Options DataSet vec");};46 void Get(IssmDouble** pvalue,int *pnumel){ _error2_("An OptionChar object cannot return a IssmDouble vec");}; 47 void Get(Options** pvalue){ _error2_("An OptionChar object cannot return an Options DataSet");}; 48 void Get(Options*** ppvalue,int *pnumel){ _error2_("An OptionChar object cannot return an Options DataSet vec");}; 49 49 50 50 }; -
issm/trunk/src/c/objects/Options/OptionDouble.cpp
r12330 r12706 1 1 /*!\file OptionDouble.cpp 2 * \brief: implementation of the options double object2 * \brief: implementation of the optionsIssmDouble object 3 3 */ 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION OptionDouble::OptionDouble(){{{ 1*/23 /*FUNCTION OptionDouble::OptionDouble(){{{*/ 24 24 OptionDouble::OptionDouble(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION OptionDouble::~OptionDouble(){{{ 1*/30 /*FUNCTION OptionDouble::~OptionDouble(){{{*/ 31 31 OptionDouble::~OptionDouble(){ 32 32 33 if (values) x free((void**)&values);33 if (values) xDelete<IssmDouble>(values); 34 34 35 35 } … … 37 37 38 38 /*Other*/ 39 /*FUNCTION OptionDouble::Echo {{{ 1*/39 /*FUNCTION OptionDouble::Echo {{{*/ 40 40 void OptionDouble::Echo(){ 41 41 … … 43 43 bool flag=true; 44 44 45 _printf_(flag,"OptionDouble Echo:\n");45 if(flag) _pprintLine_("OptionDouble Echo:"); 46 46 Option::Echo(); 47 47 48 48 if (values && size) { 49 if(numel == 1) _printf_(flag," values: %g\n" ,values[0]);49 if(numel == 1) if(flag) _pprintLine_(" values: " << values[0]); 50 50 else { 51 51 StringFromSize(cstr,size,ndims); 52 _printf_(flag," values: %s %s\n" ,cstr,"double");52 if(flag) _pprintLine_(" values: " << cstr << " " << "IssmDouble"); 53 53 } 54 54 } 55 else _printf_(flag," values: [empty]\n");55 else if(flag) _pprintLine_(" values: [empty]"); 56 56 } 57 57 /*}}}*/ 58 /*FUNCTION OptionDouble::DeepEcho() {{{ 1*/58 /*FUNCTION OptionDouble::DeepEcho() {{{*/ 59 59 void OptionDouble::DeepEcho(){ 60 60 … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION OptionDouble::DeepEcho(char* indent) {{{ 1*/68 /*FUNCTION OptionDouble::DeepEcho(char* indent) {{{*/ 69 69 void OptionDouble::DeepEcho(char* indent){ 70 70 … … 75 75 bool flag=true; 76 76 77 _printf_(flag,"%sOptionDouble DeepEcho:\n",indent);77 if(flag) _pprintLine_(indent << "OptionDouble DeepEcho:"); 78 78 Option::DeepEcho(indent); 79 79 80 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));80 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 81 81 strcat(indent2," "); 82 82 83 83 if (values) { 84 dims= (int *) xmalloc(ndims*sizeof(int));85 if(numel==1) _printf_(flag,"%s values: %g\n" ,indent,values[0]);84 dims=xNew<int>(ndims); 85 if(numel==1) if(flag) _pprintLine_(indent << " values: " << values[0]); 86 86 else{ 87 87 for (i=0; i<numel; i++) { 88 88 RowWiseDimsFromIndex(dims,i,size,ndims); 89 89 StringFromDims(cstr,dims,ndims); 90 _printf_(flag,"%s values%s: %g\n" ,indent,cstr,values[i]);90 if(flag) _pprintLine_(indent << " values" << cstr << ": " << values[i]); 91 91 } 92 92 } 93 x free((void**)&dims);93 xDelete<int>(dims); 94 94 } 95 else _printf_(flag,"%s values: [empty]\n" ,indent);95 else if(flag) _pprintLine_(indent << " values: [empty]"); 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION OptionDouble::Name {{{ 1*/98 /*FUNCTION OptionDouble::Name {{{*/ 99 99 char* OptionDouble::Name(){ 100 100 … … 102 102 } 103 103 /*}}}*/ 104 /*FUNCTION OptionDouble::NumEl {{{ 1*/104 /*FUNCTION OptionDouble::NumEl {{{*/ 105 105 int OptionDouble::NumEl(){ 106 106 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION OptionDouble::NDims {{{ 1*/110 /*FUNCTION OptionDouble::NDims {{{*/ 111 111 int OptionDouble::NDims(){ 112 112 … … 114 114 } 115 115 /*}}}*/ 116 /*FUNCTION OptionDouble::Size {{{ 1*/116 /*FUNCTION OptionDouble::Size {{{*/ 117 117 int* OptionDouble::Size(){ 118 118 … … 120 120 } 121 121 /*}}}*/ 122 /*FUNCTION OptionDouble::Get(int* pvalue) {{{ 1*/122 /*FUNCTION OptionDouble::Get(int* pvalue) {{{*/ 123 123 void OptionDouble::Get(int* pvalue){ 124 124 125 125 /*We should first check that the size is one*/ 126 126 if(this->NumEl()!=1){ 127 _error _("option \"%s\" has %i elements and cannot return a single int",this->name,this->NumEl());127 _error2_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single int"); 128 128 } 129 129 130 130 /*Assign output pointer*/ 131 *pvalue= (int)this->values[0];131 *pvalue=reCast<int>(values[0]); 132 132 } 133 133 /*}}}*/ 134 /*FUNCTION OptionDouble::Get( double* pvalue) {{{1*/135 void OptionDouble::Get( double* pvalue){134 /*FUNCTION OptionDouble::Get(IssmDouble* pvalue) {{{*/ 135 void OptionDouble::Get(IssmDouble* pvalue){ 136 136 137 137 /*We should first check that the size is one*/ 138 138 if(this->NumEl()!=1){ 139 _error _("option \"%s\" has %i elements and cannot return a single double",this->name,this->NumEl());139 _error2_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single IssmDouble"); 140 140 } 141 141 … … 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION OptionDouble::Get( double** pvalue,int* numel) {{{1*/147 void OptionDouble::Get( double** pvalue,int* numel){146 /*FUNCTION OptionDouble::Get(IssmDouble** pvalue,int* numel) {{{*/ 147 void OptionDouble::Get(IssmDouble** pvalue,int* numel){ 148 148 149 149 /*We should first check that the size is at least one*/ 150 150 if(this->NumEl()<=0){ 151 _error _("option \"%s\" is empty and cannot return a double vector",this->name);151 _error2_("option \"" << this->name << "\" is empty and cannot return a IssmDouble vector"); 152 152 } 153 153 154 154 /*Copy vector*/ 155 double* outvalue=(double*)xmalloc(this->NumEl()*sizeof(double));155 IssmDouble* outvalue=xNew<IssmDouble>(this->NumEl()); 156 156 for(int i=0;i<this->NumEl();i++) outvalue[i]=this->values[i]; 157 157 -
issm/trunk/src/c/objects/Options/OptionDouble.h
r12330 r12706 1 1 /*! \file OptionDouble.h 2 * \brief: header file for option double object2 * \brief: header file for optionIssmDouble object 3 3 */ 4 4 … … 6 6 #define _OPTIONDOUBLE_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 18 18 public: 19 19 20 double* values;20 IssmDouble* values; 21 21 22 /*OptionDouble constructors, destructors {{{ 1*/22 /*OptionDouble constructors, destructors {{{*/ 23 23 OptionDouble(); 24 24 ~OptionDouble(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{*/ 27 27 void Echo(); 28 28 void DeepEcho(); 29 29 void DeepEcho(char* indent); 30 int Id(){_error _("Not implemented yet");};31 int MyRank(){_error _("Not implemented yet");};30 int Id(){_error2_("Not implemented yet");}; 31 int MyRank(){_error2_("Not implemented yet");}; 32 32 int ObjectEnum(){return OptionDoubleEnum;}; 33 Object* copy(){_error _("Not implemented yet");};33 Object* copy(){_error2_("Not implemented yet");}; 34 34 /*}}}*/ 35 35 … … 40 40 int* Size(); 41 41 void Get(int* pvalue); 42 void Get( double* pvalue);43 void Get(bool* pvalue){ _error _("An OptionDouble object cannot return a bool");};44 void Get(char** pvalue){ _error _("An OptionDouble object cannot return a string");};45 void Get(char*** ppvalue,int *pnumel){ _error _("An OptionDouble object cannot return a string vec");};46 void Get( double** pvalue,int* pnumel);47 void Get(Options** pvalue){ _error _("An OptionDouble object cannot return an Options DataSet");};48 void Get(Options*** ppvalue,int *pnumel){ _error _("An OptionDouble object cannot return an Options DataSet vec");};42 void Get(IssmDouble* pvalue); 43 void Get(bool* pvalue){ _error2_("An OptionDouble object cannot return a bool");}; 44 void Get(char** pvalue){ _error2_("An OptionDouble object cannot return a string");}; 45 void Get(char*** ppvalue,int *pnumel){ _error2_("An OptionDouble object cannot return a string vec");}; 46 void Get(IssmDouble** pvalue,int* pnumel); 47 void Get(Options** pvalue){ _error2_("An OptionDouble object cannot return an Options DataSet");}; 48 void Get(Options*** ppvalue,int *pnumel){ _error2_("An OptionDouble object cannot return an Options DataSet vec");}; 49 49 50 50 }; -
issm/trunk/src/c/objects/Options/OptionLogical.cpp
r9761 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION OptionLogical::OptionLogical(){{{ 1*/23 /*FUNCTION OptionLogical::OptionLogical(){{{*/ 24 24 OptionLogical::OptionLogical(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION OptionLogical::~OptionLogical(){{{ 1*/30 /*FUNCTION OptionLogical::~OptionLogical(){{{*/ 31 31 OptionLogical::~OptionLogical(){ 32 32 33 if (values) x free((void**)&values);33 if (values) xDelete<bool>(values); 34 34 35 35 } … … 37 37 38 38 /*Other*/ 39 /*FUNCTION OptionLogical::Echo {{{ 1*/39 /*FUNCTION OptionLogical::Echo {{{*/ 40 40 void OptionLogical::Echo(){ 41 41 … … 43 43 bool flag=true; 44 44 45 _printf_(flag,"OptionLogical Echo:\n");45 if(flag) _pprintLine_("OptionLogical Echo:"); 46 46 Option::Echo(); 47 47 48 48 if (values && size) { 49 if(numel == 1) _printf_(flag," values: %s\n" ,(values[0] ? "true" : "false"));49 if(numel == 1) if(flag) _pprintLine_(" values: " << (values[0] ? "true" : "false")); 50 50 else{ 51 51 StringFromSize(cstr,size,ndims); 52 _printf_(flag," values: %s %s\n" ,cstr,"logical");52 if(flag) _pprintLine_(" values: " << cstr << " " << "logical"); 53 53 } 54 54 } 55 else _printf_(flag," values: [empty]\n");55 else if(flag) _pprintLine_(" values: [empty]"); 56 56 } 57 57 /*}}}*/ 58 /*FUNCTION OptionLogical::DeepEcho() {{{ 1*/58 /*FUNCTION OptionLogical::DeepEcho() {{{*/ 59 59 void OptionLogical::DeepEcho(){ 60 60 … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION OptionLogical::DeepEcho(char* indent) {{{ 1*/68 /*FUNCTION OptionLogical::DeepEcho(char* indent) {{{*/ 69 69 void OptionLogical::DeepEcho(char* indent){ 70 70 … … 75 75 bool flag=true; 76 76 77 _printf_(flag,"%sOptionLogical DeepEcho:\n",indent);77 if(flag) _pprintLine_(indent << "OptionLogical DeepEcho:"); 78 78 Option::DeepEcho(indent); 79 79 80 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));80 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 81 81 strcat(indent2," "); 82 82 83 83 if (values) { 84 if(numel==1) _printf_(flag,"%s values: %s\n" ,indent,(values[0] ? "true" : "false"));84 if(numel==1) if(flag) _pprintLine_(indent << " values: " << (values[0] ? "true" : "false")); 85 85 else{ 86 dims= (int *) xmalloc(ndims*sizeof(int));86 dims=xNew<int>(ndims); 87 87 for (i=0; i<numel; i++) { 88 88 RowWiseDimsFromIndex(dims,i,size,ndims); 89 89 StringFromDims(cstr,dims,ndims); 90 _printf_(flag,"%s values%s: %s\n" ,indent,cstr,(values[i] ? "true" : "false"));90 if(flag) _pprintLine_(indent << " values" << cstr << ": " << (values[i] ? "true" : "false")); 91 91 } 92 x free((void**)&dims);92 xDelete<int>(dims); 93 93 } 94 94 } 95 else _printf_(flag,"%s values: [empty]\n" ,indent);95 else if(flag) _pprintLine_(indent << " values: [empty]"); 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION OptionLogical::Name {{{ 1*/98 /*FUNCTION OptionLogical::Name {{{*/ 99 99 char* OptionLogical::Name(){ 100 100 … … 102 102 } 103 103 /*}}}*/ 104 /*FUNCTION OptionLogical::NumEl {{{ 1*/104 /*FUNCTION OptionLogical::NumEl {{{*/ 105 105 int OptionLogical::NumEl(){ 106 106 … … 108 108 } 109 109 /*}}}*/ 110 /*FUNCTION OptionLogical::NDims {{{ 1*/110 /*FUNCTION OptionLogical::NDims {{{*/ 111 111 int OptionLogical::NDims(){ 112 112 … … 114 114 } 115 115 /*}}}*/ 116 /*FUNCTION OptionLogical::Size {{{ 1*/116 /*FUNCTION OptionLogical::Size {{{*/ 117 117 int* OptionLogical::Size(){ 118 118 … … 120 120 } 121 121 /*}}}*/ 122 /*FUNCTION OptionLogical::Get(bool* pvalue) {{{ 1*/122 /*FUNCTION OptionLogical::Get(bool* pvalue) {{{*/ 123 123 void OptionLogical::Get(bool* pvalue){ 124 124 125 125 /*We should first check that the size is one*/ 126 126 if(this->NumEl()!=1){ 127 _error _("option \"%s\" has %i elements and cannot return a single bool",this->name,this->NumEl());127 _error2_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single bool"); 128 128 } 129 129 -
issm/trunk/src/c/objects/Options/OptionLogical.h
r12330 r12706 6 6 #define _OPTIONLOGICAL_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 20 20 bool* values; 21 21 22 /*OptionLogical constructors, destructors {{{ 1*/22 /*OptionLogical constructors, destructors {{{*/ 23 23 OptionLogical(); 24 24 ~OptionLogical(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{*/ 27 27 void Echo(); 28 28 void DeepEcho(); 29 29 void DeepEcho(char* indent); 30 int Id(){_error _("Not implemented yet");};31 int MyRank(){_error _("Not implemented yet");};30 int Id(){_error2_("Not implemented yet");}; 31 int MyRank(){_error2_("Not implemented yet");}; 32 32 int ObjectEnum(){return OptionLogicalEnum;}; 33 Object* copy(){_error _("Not implemented yet");};33 Object* copy(){_error2_("Not implemented yet");}; 34 34 /*}}}*/ 35 35 … … 39 39 int NDims(); 40 40 int* Size(); 41 void Get(int* pvalue){_error _("An OptionLogical object cannot return a int");};42 void Get( double* pvalue){_error_("An OptionLogical object cannot return a double");};41 void Get(int* pvalue){_error2_("An OptionLogical object cannot return a int");}; 42 void Get(IssmDouble* pvalue){_error2_("An OptionLogical object cannot return a IssmDouble");}; 43 43 void Get(bool* pvalue); 44 void Get(char** pvalue){ _error _("An OptionLogical object cannot return a string");};45 void Get(char*** ppvalue,int *pnumel){ _error _("An OptionLogical object cannot return a string vec");};46 void Get( double** pvalue,int *pnumel){ _error_("An OptionLogical object cannot return a double vec");};47 void Get(Options** pvalue){ _error _("An OptionLogical object cannot return an Options DataSet");};48 void Get(Options*** ppvalue,int *pnumel){ _error _("An OptionLogical object cannot return an Options DataSet vec");};44 void Get(char** pvalue){ _error2_("An OptionLogical object cannot return a string");}; 45 void Get(char*** ppvalue,int *pnumel){ _error2_("An OptionLogical object cannot return a string vec");}; 46 void Get(IssmDouble** pvalue,int *pnumel){ _error2_("An OptionLogical object cannot return a IssmDouble vec");}; 47 void Get(Options** pvalue){ _error2_("An OptionLogical object cannot return an Options DataSet");}; 48 void Get(Options*** ppvalue,int *pnumel){ _error2_("An OptionLogical object cannot return an Options DataSet vec");}; 49 49 50 50 }; -
issm/trunk/src/c/objects/Options/OptionStruct.cpp
r9761 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*Constructors/destructor/copy*/ 23 /*FUNCTION OptionStruct::OptionStruct(){{{ 1*/23 /*FUNCTION OptionStruct::OptionStruct(){{{*/ 24 24 OptionStruct::OptionStruct(){ 25 25 … … 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION OptionStruct::~OptionStruct(){{{ 1*/30 /*FUNCTION OptionStruct::~OptionStruct(){{{*/ 31 31 OptionStruct::~OptionStruct(){ 32 32 … … 38 38 values[i] =NULL; 39 39 } 40 x free((void**)&values);40 xDelete<Options*>(values); 41 41 } 42 42 … … 45 45 46 46 /*Other*/ 47 /*FUNCTION OptionStruct::Echo {{{ 1*/47 /*FUNCTION OptionStruct::Echo {{{*/ 48 48 void OptionStruct::Echo(){ 49 49 … … 51 51 bool flag=true; 52 52 53 _printf_(flag,"OptionStruct Echo:\n");53 if(flag) _pprintLine_("OptionStruct Echo:"); 54 54 Option::Echo(); 55 55 56 56 if (values && size) { 57 57 StringFromSize(cstr,size,ndims); 58 _printf_(flag," values: %s %s\n" ,cstr,"struct");58 if(flag) _pprintLine_(" values: " << cstr << " " << "struct"); 59 59 } 60 else _printf_(flag," values: [empty]\n");60 else if(flag) _pprintLine_(" values: [empty]"); 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION OptionStruct::DeepEcho() {{{ 1*/63 /*FUNCTION OptionStruct::DeepEcho() {{{*/ 64 64 void OptionStruct::DeepEcho(){ 65 65 … … 71 71 } 72 72 /*}}}*/ 73 /*FUNCTION OptionStruct::DeepEcho(char* indent) {{{ 1*/73 /*FUNCTION OptionStruct::DeepEcho(char* indent) {{{*/ 74 74 void OptionStruct::DeepEcho(char* indent){ 75 75 … … 80 80 bool flag=true; 81 81 82 _printf_(flag,"%sOptionStruct DeepEcho:\n",indent);82 if(flag) _pprintLine_(indent << "OptionStruct DeepEcho:"); 83 83 Option::DeepEcho(indent); 84 84 85 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));85 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 86 86 strcat(indent2," "); 87 87 88 88 if (values) { 89 dims= (int *)xmalloc(ndims*sizeof(int));89 dims=xNew<int>(ndims); 90 90 for (i=0; i<numel; i++) { 91 91 ColumnWiseDimsFromIndex(dims,i,size,ndims); 92 92 StringFromDims(cstr,dims,ndims); 93 93 if (values[i]->Size()){ 94 _printf_(flag,"%s values: -------- begin %s --------\n" ,indent,cstr);94 if(flag) _pprintLine_(indent << " values: -------- begin " << cstr << " --------"); 95 95 for (j=0; j<values[i]->Size(); j++) ((Option *)values[i]->GetObjectByOffset(j))->DeepEcho(indent2); 96 _printf_(flag,"%s values: -------- end %s --------\n" ,indent,cstr);96 if(flag) _pprintLine_(indent << " values: -------- end " << cstr << " --------"); 97 97 } 98 else _printf_(flag,"%s values: %s [empty]\n" ,indent,cstr);98 else if(flag) _pprintLine_(indent << " values: " << cstr << " [empty]"); 99 99 } 100 x free((void**)&dims);100 xDelete<int>(dims); 101 101 } 102 else _printf_(flag,"%s values: [empty]\n" ,indent);102 else if(flag) _pprintLine_(indent << " values: [empty]"); 103 103 } 104 104 /*}}}*/ 105 /*FUNCTION OptionStruct::Name {{{ 1*/105 /*FUNCTION OptionStruct::Name {{{*/ 106 106 char* OptionStruct::Name(){ 107 107 … … 109 109 } 110 110 /*}}}*/ 111 /*FUNCTION OptionStruct::NumEl {{{ 1*/111 /*FUNCTION OptionStruct::NumEl {{{*/ 112 112 int OptionStruct::NumEl(){ 113 113 … … 115 115 } 116 116 /*}}}*/ 117 /*FUNCTION OptionStruct::NDims {{{ 1*/117 /*FUNCTION OptionStruct::NDims {{{*/ 118 118 int OptionStruct::NDims(){ 119 119 … … 121 121 } 122 122 /*}}}*/ 123 /*FUNCTION OptionStruct::Size {{{ 1*/123 /*FUNCTION OptionStruct::Size {{{*/ 124 124 int* OptionStruct::Size(){ 125 125 … … 127 127 } 128 128 /*}}}*/ 129 /*FUNCTION OptionStruct::Get(Options** pvalue) {{{ 1*/129 /*FUNCTION OptionStruct::Get(Options** pvalue) {{{*/ 130 130 void OptionStruct::Get(Options** pvalue){ 131 131 132 132 /*We should first check that the size is one*/ 133 133 if(this->NumEl()!=1){ 134 _error _("option \"%s\" has %i elements and cannot return a single options dataset",this->name,this->NumEl());134 _error2_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single options dataset"); 135 135 } 136 136 … … 139 139 } 140 140 /*}}}*/ 141 /*FUNCTION OptionStruct::Get(Options*** ppvalue,int* numel) {{{ 1*/141 /*FUNCTION OptionStruct::Get(Options*** ppvalue,int* numel) {{{*/ 142 142 void OptionStruct::Get(Options*** ppvalue,int* numel){ 143 143 144 144 /*We should first check that the size is at least one*/ 145 145 if(this->NumEl()<=0){ 146 _error _("option \"%s\" is empty and cannot return an options dataset vector",this->name);146 _error2_("option \"" << this->name << "\" is empty and cannot return an options dataset vector"); 147 147 } 148 148 -
issm/trunk/src/c/objects/Options/OptionStruct.h
r12330 r12706 6 6 #define _OPTIONSTRUCT_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" … … 20 20 Options** values; 21 21 22 /*OptionStruct constructors, destructors {{{ 1*/22 /*OptionStruct constructors, destructors {{{*/ 23 23 OptionStruct(); 24 24 ~OptionStruct(); 25 25 /*}}}*/ 26 /*Object virtual functions definitions:{{{ 1*/26 /*Object virtual functions definitions:{{{*/ 27 27 void Echo(); 28 28 void DeepEcho(); 29 29 void DeepEcho(char* indent); 30 int Id(){_error _("Not implemented yet");};31 int MyRank(){_error _("Not implemented yet");};30 int Id(){_error2_("Not implemented yet");}; 31 int MyRank(){_error2_("Not implemented yet");}; 32 32 int ObjectEnum(){return OptionStructEnum;}; 33 Object* copy(){_error _("Not implemented yet");};33 Object* copy(){_error2_("Not implemented yet");}; 34 34 /*}}}*/ 35 35 … … 39 39 int NDims(); 40 40 int* Size(); 41 void Get(int* pvalue){_error _("An OptionStruct object cannot return a int");};42 void Get( double* pvalue){_error_("An OptionStruct object cannot return a double");};43 void Get(bool* pvalue){ _error _("An OptionStruct object cannot return a bool");};44 void Get(char** pvalue){ _error _("An OptionStruct object cannot return a string");};45 void Get(char*** ppvalue,int *pnumel){ _error _("An OptionStruct object cannot return a string vec");};46 void Get( double** pvalue,int *pnumel){ _error_("An OptionStruct object cannot return a double vec");};41 void Get(int* pvalue){_error2_("An OptionStruct object cannot return a int");}; 42 void Get(IssmDouble* pvalue){_error2_("An OptionStruct object cannot return a IssmDouble");}; 43 void Get(bool* pvalue){ _error2_("An OptionStruct object cannot return a bool");}; 44 void Get(char** pvalue){ _error2_("An OptionStruct object cannot return a string");}; 45 void Get(char*** ppvalue,int *pnumel){ _error2_("An OptionStruct object cannot return a string vec");}; 46 void Get(IssmDouble** pvalue,int *pnumel){ _error2_("An OptionStruct object cannot return a IssmDouble vec");}; 47 47 void Get(Options** pvalue); 48 48 void Get(Options*** ppvalue,int *pnumel); -
issm/trunk/src/c/objects/Options/OptionUtilities.cpp
r9320 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 19 19 /*}}}*/ 20 20 21 /*FUNCTION ColumnWiseDimsFromIndex{{{ 1*/21 /*FUNCTION ColumnWiseDimsFromIndex{{{*/ 22 22 int ColumnWiseDimsFromIndex(int* dims,int index,int* size,int ndims){ 23 23 … … 27 27 /*check for index too large */ 28 28 for (i=0;i<ndims;i++) aprod*=size[i]; 29 if (index >= aprod) _error _("Index %d exceeds number of elements %d.",index,aprod);29 if (index >= aprod) _error2_("Index " << index << " exceeds number of elements " << aprod << "."); 30 30 31 31 /*calculate the dimensions (being careful of integer division) */ 32 32 for (i=ndims-1; i>=0; i--) { 33 aprod= (int)(((double)aprod+0.5)/(double)size[i]);34 dims[i]=(int)floor((( double)index+0.5)/(double)aprod);33 aprod=reCast<int>(((IssmPDouble)aprod+0.5)/(IssmPDouble)size[i]); 34 dims[i]=(int)floor(((IssmPDouble)index+0.5)/(IssmPDouble)aprod); 35 35 index-=dims[i]*aprod; 36 36 } … … 38 38 return(0); 39 39 }/*}}}*/ 40 /*FUNCTION IndexFromColumnWiseDims{{{ 1*/40 /*FUNCTION IndexFromColumnWiseDims{{{*/ 41 41 int IndexFromColumnWiseDims(int* dims, int* size, int ndims) { 42 42 … … 46 46 /*check for any dimension too large */ 47 47 for (i=0;i<ndims;i++){ 48 if (dims[i] >= size[i]) _error _("Dimension %d of %d exceeds size of %d.",i,dims[i],size[i]);48 if (dims[i] >= size[i]) _error2_("Dimension " << i << " of " << dims[i] << " exceeds size of " << size[i] << "."); 49 49 } 50 50 … … 57 57 return(index); 58 58 }/*}}}*/ 59 /*FUNCTION RowWiseDimsFromIndex{{{ 1*/59 /*FUNCTION RowWiseDimsFromIndex{{{*/ 60 60 int RowWiseDimsFromIndex(int* dims, int index, int* size, int ndims) { 61 61 … … 65 65 /*check for index too large */ 66 66 for (i=0; i<ndims; i++) aprod*=size[i]; 67 if (index >= aprod) _error _("Index %d exceeds number of elements %d.",index,aprod);67 if (index >= aprod) _error2_("Index " << index << " exceeds number of elements " << aprod << "."); 68 68 69 69 /*calculate the dimensions (being careful of integer division) */ 70 70 for (i=0; i<ndims; i++) { 71 aprod=(int)((( double)aprod+0.5)/(double)size[i]);72 dims[i]=(int)floor((( double)index+0.5)/(double)aprod);71 aprod=(int)(((IssmPDouble)aprod+0.5)/(IssmPDouble)size[i]); 72 dims[i]=(int)floor(((IssmPDouble)index+0.5)/(IssmPDouble)aprod); 73 73 index-=dims[i]*aprod; 74 74 } … … 76 76 return(0); 77 77 }/*}}}*/ 78 /*FUNCTION IndexFromRowWiseDims{{{ 1*/78 /*FUNCTION IndexFromRowWiseDims{{{*/ 79 79 int IndexFromRowWiseDims(int* dims, int* size, int ndims) { 80 80 … … 84 84 /*check for any dimension too large */ 85 85 for (i=0; i<ndims; i++){ 86 if (dims[i] >= size[i]) _error _("Dimension %d of %d exceeds size of %d.",i,dims[i],size[i]);86 if (dims[i] >= size[i]) _error2_("Dimension " << i << " of " << dims[i] << " exceeds size of " << size[i] << "."); 87 87 } 88 88 … … 95 95 return(index); 96 96 }/*}}}*/ 97 /*FUNCTION StringFromDims{{{ 1*/97 /*FUNCTION StringFromDims{{{*/ 98 98 int StringFromDims(char* cstr, int* dims, int ndims) { 99 99 … … 104 104 return(0); 105 105 }/*}}}*/ 106 /*FUNCTION StringFromSize{{{ 1*/106 /*FUNCTION StringFromSize{{{*/ 107 107 int StringFromSize(char* cstr, int* size, int ndims) { 108 108 -
issm/trunk/src/c/objects/Options/OptionUtilities.h
r8535 r12706 6 6 #define _OPTIONUTILITIES_H_ 7 7 8 /*Headers:{{{ 1*/8 /*Headers:{{{*/ 9 9 #include "../../include/include.h" 10 10 #include "../../shared/Exceptions/exceptions.h" -
issm/trunk/src/c/objects/Params/BoolParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*BoolParam constructors and destructor*/ 23 /*FUNCTION BoolParam::BoolParam(){{{ 1*/23 /*FUNCTION BoolParam::BoolParam(){{{*/ 24 24 BoolParam::BoolParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION BoolParam::BoolParam(int enum_type,IssmBool value){{{ 1*/28 /*FUNCTION BoolParam::BoolParam(int enum_type,IssmBool value){{{*/ 29 29 BoolParam::BoolParam(int in_enum_type,IssmBool in_value){ 30 30 … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION BoolParam::~BoolParam(){{{ 1*/35 /*FUNCTION BoolParam::~BoolParam(){{{*/ 36 36 BoolParam::~BoolParam(){ 37 37 return; … … 40 40 41 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION BoolParam::Echo {{{ 1*/42 /*FUNCTION BoolParam::Echo {{{*/ 43 43 void BoolParam::Echo(void){ 44 44 this->DeepEcho(); 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION BoolParam::DeepEcho{{{ 1*/47 /*FUNCTION BoolParam::DeepEcho{{{*/ 48 48 void BoolParam::DeepEcho(void){ 49 49 50 printf("BoolParam:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" value: %s\n",this->value?"true":"false");50 _printLine_("BoolParam:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" value: " <<(this->value?"true":"false")); 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION BoolParam::Id{{{ 1*/55 /*FUNCTION BoolParam::Id{{{*/ 56 56 int BoolParam::Id(void){ return -1; } 57 57 /*}}}*/ 58 /*FUNCTION BoolParam::MyRank{{{ 1*/58 /*FUNCTION BoolParam::MyRank{{{*/ 59 59 int BoolParam::MyRank(void){ 60 60 extern int my_rank; … … 62 62 } 63 63 /*}}}*/ 64 /*FUNCTION BoolParam::ObjectEnum{{{ 1*/64 /*FUNCTION BoolParam::ObjectEnum{{{*/ 65 65 int BoolParam::ObjectEnum(void){ 66 66 … … 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION BoolParam::copy{{{ 1*/71 /*FUNCTION BoolParam::copy{{{*/ 72 72 Object* BoolParam::copy() { 73 73 … … 78 78 79 79 /*BoolParam virtual functions definitions: */ 80 /*FUNCTION BoolParam::GetParameterName{{{ 1*/80 /*FUNCTION BoolParam::GetParameterName{{{*/ 81 81 void BoolParam::GetParameterName(char**pname){ 82 82 EnumToStringx(pname,this->enum_type); 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION BoolParam::UnitConversion{{{ 1*/85 /*FUNCTION BoolParam::UnitConversion{{{*/ 86 86 void BoolParam::UnitConversion(int direction_enum){ 87 87 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/BoolParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 27 27 IssmBool value; 28 28 29 /*BoolParam constructors, destructors: {{{ 1*/29 /*BoolParam constructors, destructors: {{{*/ 30 30 BoolParam(); 31 31 BoolParam(int enum_type,IssmBool value); 32 32 ~BoolParam(); 33 33 /*}}}*/ 34 /*Object virtual functions definitions:{{{ 1*/34 /*Object virtual functions definitions:{{{ */ 35 35 void Echo(); 36 36 void DeepEcho(); … … 40 40 Object* copy(); 41 41 /*}}}*/ 42 /*Param vritual function definitions: {{{ 1*/42 /*Param vritual function definitions: {{{*/ 43 43 int InstanceEnum(){return enum_type;} 44 44 void GetParameterValue(bool* pbool){*pbool=value;} 45 void GetParameterValue(int* pinteger){_error _("Bool param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(int** pintarray,int* pM){_error _("Bool param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("Bool param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue( double* pdouble){_error_("Bool param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue(char** pstring){_error _("Bool param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(char*** pstringarray,int* pM){_error _("Bool param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue( double** pdoublearray,int* pM){_error_("Bool param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("Bool param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("Bool param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue(Vector** pvec){_error _("Bool param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Matrix** pmat){_error _("Bool param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(FILE** pfid){_error _("Bool param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(int* pinteger){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 46 void GetParameterValue(int** pintarray,int* pM){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 47 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 48 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 49 void GetParameterValue(char** pstring){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 50 void GetParameterValue(char*** pstringarray,int* pM){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 54 void GetParameterValue(Vector** pvec){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 55 void GetParameterValue(Matrix** pmat){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 56 void GetParameterValue(FILE** pfid){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 57 57 58 58 void SetValue(bool boolean){this->value=boolean;} 59 void SetValue(int integer){ this->value=(bool)integer;}60 void SetValue( double scalar){this->value=(bool)scalar;}61 void SetValue(char* string){_error _("Bool param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}62 void SetValue(char** stringarray,int M){_error _("Bool param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}63 void SetValue( double* doublearray,int M){_error_("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* pdoublearray,int M,int N){_error_("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}65 void SetValue(int* intarray,int M){_error _("Bool param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* pintarray,int M,int N){_error _("Bool param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}67 void SetValue(Vector* vec){_error _("Bool param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}68 void SetValue(Matrix* mat){_error _("Bool param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}69 void SetValue(FILE* fid){_error _("Bool param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}70 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("Bool param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}59 void SetValue(int integer){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an int");} 60 void SetValue(IssmDouble scalar){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an IssmPDouble");} 61 void SetValue(char* string){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 62 void SetValue(char** stringarray,int M){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 63 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 64 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 65 void SetValue(int* intarray,int M){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 66 void SetValue(int* pintarray,int M,int N){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 67 void SetValue(Vector* vec){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 68 void SetValue(Matrix* mat){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 69 void SetValue(FILE* fid){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 70 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 71 71 void UnitConversion(int direction_enum); 72 72 -
issm/trunk/src/c/objects/Params/DoubleMatArrayParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*DoubleMatArrayParam constructors and destructor*/ 23 /*FUNCTION DoubleMatArrayParam::DoubleMatArrayParam(){{{ 1*/23 /*FUNCTION DoubleMatArrayParam::DoubleMatArrayParam(){{{*/ 24 24 DoubleMatArrayParam::DoubleMatArrayParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION DoubleMatArrayParam::DoubleMatArrayParam(int enum_type, double** array, int M, int* mdim_array, int* ndim_array){{{1*/29 DoubleMatArrayParam::DoubleMatArrayParam(int in_enum_type, double** in_array, int in_M, int* in_mdim_array, int* in_ndim_array){28 /*FUNCTION DoubleMatArrayParam::DoubleMatArrayParam(int enum_type,IssmDouble** array, int M, int* mdim_array, int* ndim_array){{{*/ 29 DoubleMatArrayParam::DoubleMatArrayParam(int in_enum_type,IssmDouble** in_array, int in_M, int* in_mdim_array, int* in_ndim_array){ 30 30 31 31 int i; 32 double* matrix=NULL;32 IssmDouble* matrix=NULL; 33 33 int m,n; 34 34 … … 36 36 M=in_M; 37 37 if(M){ 38 array= (double**)xmalloc(M*sizeof(double*));39 mdim_array= (int*)xmalloc(M*sizeof(int));40 ndim_array= (int*)xmalloc(M*sizeof(int));38 array=xNew<IssmDouble*>(M); 39 mdim_array=xNew<int>(M); 40 ndim_array=xNew<int>(M); 41 41 42 42 for(i=0;i<M;i++){ … … 48 48 49 49 if(m*n){ 50 matrix= (double*)xmalloc(m*n*sizeof(double));51 memcpy(matrix,in_array[i],m*n*sizeof(double));50 matrix=xNew<IssmDouble>(m*n); 51 xMemCpy<IssmDouble>(matrix,in_array[i],m*n); 52 52 } 53 53 else{ … … 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION DoubleMatArrayParam::~DoubleMatArrayParam(){{{ 1*/66 /*FUNCTION DoubleMatArrayParam::~DoubleMatArrayParam(){{{*/ 67 67 DoubleMatArrayParam::~DoubleMatArrayParam(){ 68 68 69 69 int i; 70 double* matrix=NULL;71 72 x free((void**)&mdim_array);73 x free((void**)&ndim_array);70 IssmDouble* matrix=NULL; 71 72 xDelete<int>(mdim_array); 73 xDelete<int>(ndim_array); 74 74 75 75 for(i=0;i<M;i++){ 76 76 matrix=array[i]; 77 x free((void**)&matrix);78 } 79 80 x free((void**)&array);77 xDelete<IssmDouble>(matrix); 78 } 79 80 xDelete<IssmDouble*>(array); 81 81 return; 82 82 } … … 84 84 85 85 /*Object virtual functions definitions:*/ 86 /*FUNCTION DoubleMatArrayParam::Echo {{{ 1*/86 /*FUNCTION DoubleMatArrayParam::Echo {{{*/ 87 87 void DoubleMatArrayParam::Echo(void){ 88 88 89 printf("DoubleMatArrayParam:\n");90 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));91 printf(" array size: %i\n",this->M);92 printf(" array pointer: %p\n",this->array);93 94 } 95 /*}}}*/ 96 /*FUNCTION DoubleMatArrayParam::DeepEcho{{{ 1*/89 _printLine_("DoubleMatArrayParam:"); 90 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 91 _printLine_(" array size: " << this->M); 92 _printLine_(" array pointer: " << this->array); 93 94 } 95 /*}}}*/ 96 /*FUNCTION DoubleMatArrayParam::DeepEcho{{{*/ 97 97 void DoubleMatArrayParam::DeepEcho(void){ 98 98 99 99 int i,j,k; 100 100 int m,n; 101 double* matrix=NULL;102 103 printf("DoubleMatArrayParam:\n");104 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));105 printf(" array size: %i\n",this->M);106 for(i=0;i<M;i++){ 107 printf(" array %i (%ix%i):\n",i,mdim_array[i],ndim_array[i]);101 IssmDouble* matrix=NULL; 102 103 _printLine_("DoubleMatArrayParam:"); 104 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 105 _printLine_(" array size: " << this->M); 106 for(i=0;i<M;i++){ 107 _printLine_(" array " << i << " (" << mdim_array[i] << "x" << ndim_array[i] << "):"); 108 108 matrix=array[i]; 109 109 m=mdim_array[i]; … … 111 111 112 112 for(j=0;j<m;j++){ 113 printf(" ");114 for(k=0;k<n;k++) printf("%g ",*(matrix+n*j+k));115 printf("\n");113 _printString_(" "); 114 for(k=0;k<n;k++)_printString_(*(matrix+n*j+k) << " "); 115 _printLine_(""); 116 116 } 117 117 } 118 118 } 119 119 /*}}}*/ 120 /*FUNCTION DoubleMatArrayParam::Id{{{ 1*/120 /*FUNCTION DoubleMatArrayParam::Id{{{*/ 121 121 int DoubleMatArrayParam::Id(void){ return -1; } 122 122 /*}}}*/ 123 /*FUNCTION DoubleMatArrayParam::MyRank{{{ 1*/123 /*FUNCTION DoubleMatArrayParam::MyRank{{{*/ 124 124 int DoubleMatArrayParam::MyRank(void){ 125 125 extern int my_rank; … … 127 127 } 128 128 /*}}}*/ 129 /*FUNCTION DoubleMatArrayParam::ObjectEnum{{{ 1*/129 /*FUNCTION DoubleMatArrayParam::ObjectEnum{{{*/ 130 130 int DoubleMatArrayParam::ObjectEnum(void){ 131 131 … … 134 134 } 135 135 /*}}}*/ 136 /*FUNCTION DoubleMatArrayParam::copy{{{ 1*/136 /*FUNCTION DoubleMatArrayParam::copy{{{*/ 137 137 Object* DoubleMatArrayParam::copy() { 138 138 … … 143 143 144 144 /*DoubleMatArrayParam virtual functions definitions: */ 145 /*FUNCTION DoubleMatArrayParam::GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){{{1*/146 void DoubleMatArrayParam::GetParameterValue( double*** pout_array, int* pout_M,int** pout_mdim_array, int** pout_ndim_array){145 /*FUNCTION DoubleMatArrayParam::GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){{{*/ 146 void DoubleMatArrayParam::GetParameterValue(IssmDouble*** pout_array, int* pout_M,int** pout_mdim_array, int** pout_ndim_array){ 147 147 148 148 int i,m,n; 149 double* matrix=NULL;150 double* out_matrix=NULL;149 IssmDouble* matrix=NULL; 150 IssmDouble* out_matrix=NULL; 151 151 152 152 /*output: */ 153 double** out_array=NULL;153 IssmDouble** out_array=NULL; 154 154 int out_M; 155 155 int* out_mdim_array=NULL; … … 159 159 out_M=this->M; 160 160 if(out_M){ 161 out_array= (double**)xmalloc(M*sizeof(double*));162 out_mdim_array= (int*)xmalloc(M*sizeof(int));163 out_ndim_array= (int*)xmalloc(M*sizeof(int));164 165 memcpy(out_mdim_array,this->mdim_array,M*sizeof(int));166 memcpy(out_ndim_array,this->ndim_array,M*sizeof(int));161 out_array=xNew<IssmDouble*>(M); 162 out_mdim_array=xNew<int>(M); 163 out_ndim_array=xNew<int>(M); 164 165 xMemCpy<int>(out_mdim_array,this->mdim_array,M); 166 xMemCpy<int>(out_ndim_array,this->ndim_array,M); 167 167 168 168 for(i=0;i<this->M;i++){ … … 172 172 173 173 if(m*n){ 174 out_matrix= (double*)xmalloc(m*n*sizeof(double));175 memcpy(out_matrix,matrix,m*n*sizeof(double));174 out_matrix=xNew<IssmDouble>(m*n); 175 xMemCpy<IssmDouble>(out_matrix,matrix,m*n); 176 176 } 177 177 else{ … … 196 196 } 197 197 /*}}}*/ 198 /*FUNCTION DoubleMatArrayParam::GetParameterName{{{ 1*/198 /*FUNCTION DoubleMatArrayParam::GetParameterName{{{*/ 199 199 void DoubleMatArrayParam::GetParameterName(char**pname){ 200 200 EnumToStringx(pname,this->enum_type); 201 201 } 202 202 /*}}}*/ 203 /*FUNCTION DoubleMatArrayParam::SetValue( double** array, int M, int* mdim_array, int* ndim_array){{{1*/204 void DoubleMatArrayParam::SetValue( double** in_array, int in_M, int* in_mdim_array, int* in_ndim_array){203 /*FUNCTION DoubleMatArrayParam::SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){{{*/ 204 void DoubleMatArrayParam::SetValue(IssmDouble** in_array, int in_M, int* in_mdim_array, int* in_ndim_array){ 205 205 206 206 int i,m,n; 207 double* in_matrix=NULL;208 double* matrix=NULL;207 IssmDouble* in_matrix=NULL; 208 IssmDouble* matrix=NULL; 209 209 210 210 /*avoid leak: */ 211 x free((void**)&mdim_array);212 x free((void**)&ndim_array);211 xDelete<int>(mdim_array); 212 xDelete<int>(ndim_array); 213 213 for(i=0;i<M;i++){ 214 214 matrix=array[i]; 215 x free((void**)&matrix);216 } 217 x free((void**)&array);215 xDelete<IssmDouble>(matrix); 216 } 217 xDelete<IssmDouble*>(array); 218 218 219 219 /*copy data: */ 220 220 this->M=in_M; 221 this->array= (double**)xmalloc(M*sizeof(double*));222 this->mdim_array= (int*)xmalloc(M*sizeof(int));223 this->ndim_array= (int*)xmalloc(M*sizeof(int));224 225 memcpy(this->mdim_array,in_mdim_array,M*sizeof(double));226 memcpy(this->ndim_array,in_ndim_array,M*sizeof(double));221 this->array=xNew<IssmDouble*>(M); 222 this->mdim_array=xNew<int>(M); 223 this->ndim_array=xNew<int>(M); 224 225 xMemCpy<int>(this->mdim_array,in_mdim_array,M); 226 xMemCpy<int>(this->ndim_array,in_ndim_array,M); 227 227 228 228 for(i=0;i<M;i++){ … … 231 231 n=in_ndim_array[i]; 232 232 233 matrix= (double*)xmalloc(m*n*sizeof(double));234 memcpy(matrix,in_matrix,m*n*sizeof(double));233 matrix=xNew<IssmDouble>(m*n); 234 xMemCpy<IssmDouble>(matrix,in_matrix,m*n); 235 235 236 236 this->array[i]=matrix; … … 239 239 } 240 240 /*}}}*/ 241 /*FUNCTION DoubleMatArrayParam::UnitConversion{{{ 1*/241 /*FUNCTION DoubleMatArrayParam::UnitConversion{{{*/ 242 242 void DoubleMatArrayParam::UnitConversion(int direction_enum){ 243 243 /*go through all matrices and convert: */ 244 244 for (int i=0;i<this->M;i++){ 245 double* matrix=this->array[i];245 IssmDouble* matrix=this->array[i]; 246 246 int m=this->mdim_array[i]; 247 247 int n=this->ndim_array[i]; -
issm/trunk/src/c/objects/Params/DoubleMatArrayParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 24 24 private: 25 25 int enum_type; 26 double** array; //array of matrices26 IssmDouble** array; //array of matrices 27 27 int M; //size of array 28 28 int* mdim_array; //m-dimensions of matrices in the array … … 30 30 31 31 public: 32 /*DoubleMatArrayParam constructors, destructors: {{{ 1*/32 /*DoubleMatArrayParam constructors, destructors: {{{*/ 33 33 DoubleMatArrayParam(); 34 DoubleMatArrayParam(int enum_type, double** array, int M, int* mdim_array, int* ndim_array);34 DoubleMatArrayParam(int enum_type,IssmDouble** array, int M, int* mdim_array, int* ndim_array); 35 35 ~DoubleMatArrayParam(); 36 36 /*}}}*/ 37 /*Object virtual functions definitions:{{{ 1*/37 /*Object virtual functions definitions:{{{ */ 38 38 void Echo(); 39 39 void DeepEcho(); … … 43 43 Object* copy(); 44 44 /*}}}*/ 45 /*Param vritual function definitions: {{{ 1*/45 /*Param vritual function definitions: {{{*/ 46 46 int InstanceEnum(){return enum_type;} 47 void GetParameterValue(bool* pbool){_error _("DoubleMatArray param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int* pinteger){_error _("DoubleMatArray param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue(int** pintarray,int* pM){_error _("DoubleMatArray param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("DoubleMatArray param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue( double* pdouble){_error_("DoubleMatArray param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue(char** pstring){_error _("DoubleMatArray param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue(char*** pstringarray,int* pM){_error _("DoubleMatArray param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double** pdoublearray,int* pM){_error_("DoubleMatArray param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("DoubleMatArray param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims);57 void GetParameterValue(Vector** pvec){_error _("DoubleMatArray param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}58 void GetParameterValue(Matrix** pmat){_error _("DoubleMatArray param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}59 void GetParameterValue(FILE** pfid){_error _("DoubleMatArray param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(bool* pbool){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 48 void GetParameterValue(int* pinteger){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 49 void GetParameterValue(int** pintarray,int* pM){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 50 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 51 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 52 void GetParameterValue(char** pstring){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 53 void GetParameterValue(char*** pstringarray,int* pM){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 55 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 56 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims); 57 void GetParameterValue(Vector** pvec){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 58 void GetParameterValue(Matrix** pmat){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 59 void GetParameterValue(FILE** pfid){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 60 60 61 void SetValue(bool boolean){_error _("DoubleMatArray param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}62 void SetValue(int integer){_error _("DoubleMatArray param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}63 void SetValue( double scalar){_error_("DoubleMatArray param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}64 void SetValue(char* string){_error _("DoubleMatArray param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}65 void SetValue(char** stringarray,int M){_error _("DoubleMatArray param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}66 void SetValue( double* doublearray,int M){_error_("DoubleMatArray param of enum %i (%s) cannot hold a double vec array",enum_type,EnumToStringx(enum_type));}67 void SetValue( double* doublearray,int M,int N){_error_("DoubleMatArray param of enum %i (%s) cannot hold a double mat array",enum_type,EnumToStringx(enum_type));}68 void SetValue(int* intarray,int M){_error _("DoubleMatArray param of enum %i (%s) cannot hold a int vec array",enum_type,EnumToStringx(enum_type));}69 void SetValue(int* intarray,int M,int N){_error _("DoubleMatArray param of enum %i (%s) cannot hold a int mat array",enum_type,EnumToStringx(enum_type));}70 void SetValue(Vector* vec){_error _("DoubleMatArray param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}71 void SetValue(Matrix* mat){_error _("DoubleMatArray param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}72 void SetValue(FILE* fid){_error _("Bool param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}73 void SetValue( double** array, int M, int* mdim_array, int* ndim_array);61 void SetValue(bool boolean){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 62 void SetValue(int integer){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 63 void SetValue(IssmDouble scalar){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 64 void SetValue(char* string){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 65 void SetValue(char** stringarray,int M){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble vec array");} 67 void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble mat array");} 68 void SetValue(int* intarray,int M){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int vec array");} 69 void SetValue(int* intarray,int M,int N){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int mat array");} 70 void SetValue(Vector* vec){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 71 void SetValue(Matrix* mat){_error2_("DoubleMatArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 72 void SetValue(FILE* fid){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 73 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array); 74 74 void UnitConversion(int direction_enum); 75 75 -
issm/trunk/src/c/objects/Params/DoubleMatParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*DoubleMatParam constructors and destructor*/ 23 /*FUNCTION DoubleMatParam::DoubleMatParam(){{{ 1*/23 /*FUNCTION DoubleMatParam::DoubleMatParam(){{{*/ 24 24 DoubleMatParam::DoubleMatParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION DoubleMatParam::DoubleMatParam(int enum_type,IssmDoubleMat value){{{ 1*/29 DoubleMatParam::DoubleMatParam(int in_enum_type, double* in_value, int in_M,int in_N){28 /*FUNCTION DoubleMatParam::DoubleMatParam(int enum_type,IssmDoubleMat value){{{*/ 29 DoubleMatParam::DoubleMatParam(int in_enum_type,IssmDouble* in_value, int in_M,int in_N){ 30 30 31 31 enum_type=in_enum_type; … … 33 33 N=in_N; 34 34 35 value= (double*)xmalloc(M*N*sizeof(double));36 memcpy(value,in_value,M*N*sizeof(double));35 value=xNew<IssmDouble>(M*N); 36 xMemCpy<IssmDouble>(value,in_value,M*N); 37 37 } 38 38 /*}}}*/ 39 /*FUNCTION DoubleMatParam::~DoubleMatParam(){{{ 1*/39 /*FUNCTION DoubleMatParam::~DoubleMatParam(){{{*/ 40 40 DoubleMatParam::~DoubleMatParam(){ 41 x free((void**)&value);41 xDelete<IssmDouble>(value); 42 42 return; 43 43 } … … 45 45 46 46 /*Object virtual functions definitions:*/ 47 /*FUNCTION DoubleMatParam::Echo {{{ 1*/47 /*FUNCTION DoubleMatParam::Echo {{{*/ 48 48 void DoubleMatParam::Echo(void){ 49 49 50 printf("DoubleMatParam:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" matrix size: %ix%i\n",this->M,this->N);50 _printLine_("DoubleMatParam:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" matrix size: " << this->M << "x" << this->N); 53 53 54 54 } 55 55 /*}}}*/ 56 /*FUNCTION DoubleMatParam::DeepEcho{{{ 1*/56 /*FUNCTION DoubleMatParam::DeepEcho{{{*/ 57 57 void DoubleMatParam::DeepEcho(void){ 58 58 59 59 int i,j; 60 60 61 printf("DoubleMatParam:\n");62 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));63 printf(" matrix size: %ix%i\n",this->M,this->N);61 _printLine_("DoubleMatParam:"); 62 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 63 _printLine_(" matrix size: " << this->M << "x" << this->N); 64 64 for(i=0;i<this->M;i++){ 65 65 for(i=0;i<this->N;i++){ 66 printf("%i %i %g\n",i,j,*(this->value+N*i+j));66 _printLine_(i << " " << j << " " << *(this->value+N*i+j)); 67 67 } 68 68 } 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION DoubleMatParam::Id{{{ 1*/71 /*FUNCTION DoubleMatParam::Id{{{*/ 72 72 int DoubleMatParam::Id(void){ return -1; } 73 73 /*}}}*/ 74 /*FUNCTION DoubleMatParam::MyRank{{{ 1*/74 /*FUNCTION DoubleMatParam::MyRank{{{*/ 75 75 int DoubleMatParam::MyRank(void){ 76 76 extern int my_rank; … … 78 78 } 79 79 /*}}}*/ 80 /*FUNCTION DoubleMatParam::ObjectEnum{{{ 1*/80 /*FUNCTION DoubleMatParam::ObjectEnum{{{*/ 81 81 int DoubleMatParam::ObjectEnum(void){ 82 82 … … 85 85 } 86 86 /*}}}*/ 87 /*FUNCTION DoubleMatParam::copy{{{ 1*/87 /*FUNCTION DoubleMatParam::copy{{{*/ 88 88 Object* DoubleMatParam::copy() { 89 89 … … 94 94 95 95 /*DoubleMatParam virtual functions definitions: */ 96 /*FUNCTION DoubleMatParam::GetParameterValue( double** pdoublearray,int* pM,int* pN){{{1*/97 void DoubleMatParam::GetParameterValue( double** pdoublearray,int* pM,int* pN){98 double* output=NULL;96 /*FUNCTION DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){{{*/ 97 void DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ 98 IssmDouble* output=NULL; 99 99 100 output= (double*)xmalloc((int)(M*N*sizeof(double)));101 memcpy(output,value,M*N*sizeof(double));100 output=xNew<IssmDouble>(M*N); 101 xMemCpy<IssmDouble>(output,value,M*N); 102 102 103 103 /*Assign output pointers:*/ 104 104 if(pM) *pM=M; 105 105 if(pN) *pN=N; 106 *p doublearray=output;106 *pIssmDoublearray=output; 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{ 1*/109 /*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{*/ 110 110 void DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){ 111 _error _("DoubleMat of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type));111 _error2_("DoubleMat of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of int"); 112 112 } 113 113 /*}}}*/ 114 /*FUNCTION DoubleMatParam::GetParameterName{{{ 1*/114 /*FUNCTION DoubleMatParam::GetParameterName{{{*/ 115 115 void DoubleMatParam::GetParameterName(char**pname){ 116 116 EnumToStringx(pname,this->enum_type); 117 117 } 118 118 /*}}}*/ 119 /*FUNCTION DoubleMatParam::SetValue{{{ 1*/120 void DoubleMatParam::SetValue( double* doublearray,int in_M,int in_N){119 /*FUNCTION DoubleMatParam::SetValue{{{*/ 120 void DoubleMatParam::SetValue(IssmDouble* IssmDoublearray,int in_M,int in_N){ 121 121 122 122 /*avoid leak: */ 123 x free((void**)&this->value);123 xDelete<IssmDouble>(this->value); 124 124 125 this->value= (double*)xmalloc(in_M*in_N*sizeof(double));126 memcpy(this->value,doublearray,in_M*in_N*sizeof(double));125 this->value=xNew<IssmDouble>(in_M*in_N); 126 xMemCpy<IssmDouble>(this->value,IssmDoublearray,in_M*in_N); 127 127 128 128 this->M=in_M; … … 130 130 } 131 131 /*}}}*/ 132 /*FUNCTION DoubleMatParam::UnitConversion{{{ 1*/132 /*FUNCTION DoubleMatParam::UnitConversion{{{*/ 133 133 void DoubleMatParam::UnitConversion(int direction_enum){ 134 134 ::UnitConversion(this->value,this->M*this->N,direction_enum,this->enum_type); … … 137 137 138 138 /*diverse: */ 139 /*FUNCTION DoubleMatParam::GetPointer{{{ 1*/140 double* DoubleMatParam::GetPointer(void){139 /*FUNCTION DoubleMatParam::GetPointer{{{*/ 140 IssmDouble* DoubleMatParam::GetPointer(void){ 141 141 return this->value; 142 142 } -
issm/trunk/src/c/objects/Params/DoubleMatParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 24 24 protected: 25 25 int enum_type; 26 double* value;26 IssmDouble* value; 27 27 int M; 28 28 int N; 29 29 30 30 public: 31 /*DoubleMatParam constructors, destructors: {{{ 1*/31 /*DoubleMatParam constructors, destructors: {{{*/ 32 32 DoubleMatParam(); 33 33 DoubleMatParam(int enum_type,IssmDouble* value,int M,int N); 34 34 ~DoubleMatParam(); 35 35 /*}}}*/ 36 /*Object virtual functions definitions:{{{ 1*/36 /*Object virtual functions definitions:{{{ */ 37 37 void Echo(); 38 38 void DeepEcho(); … … 42 42 Object* copy(); 43 43 /*}}}*/ 44 /*Param vritual function definitions: {{{ 1*/44 /*Param vritual function definitions: {{{*/ 45 45 int InstanceEnum(){return enum_type;} 46 void GetParameterValue(bool* pbool){_error _("DoubleMat param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int* pinteger){_error _("DoubleMat param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM){_error _("DoubleMat param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(bool* pbool){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 47 void GetParameterValue(int* pinteger){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 48 void GetParameterValue(int** pintarray,int* pM){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 49 49 void GetParameterValue(int** pintarray,int* pM,int* pN); 50 void GetParameterValue( double* pdouble){_error_("DoubleMat param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char** pstring){_error _("DoubleMat param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue(char*** pstringarray,int* pM){_error _("DoubleMat param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM){_error_("DoubleMat param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double** pdoublearray,int* pM,int* pN);55 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("DoubleMat param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Vector** pvec){_error _("DoubleMat param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(Matrix** pmat){_error _("DoubleMat param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}58 void GetParameterValue(FILE** pfid){_error _("DoubleMat param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 51 void GetParameterValue(char** pstring){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 52 void GetParameterValue(char*** pstringarray,int* pM){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN); 55 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 56 void GetParameterValue(Vector** pvec){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 57 void GetParameterValue(Matrix** pmat){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 58 void GetParameterValue(FILE** pfid){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 59 59 60 void SetValue(bool boolean){_error _("DoubleMat param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}61 void SetValue(int integer){_error _("DoubleMat param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}62 void SetValue( double scalar){_error_("DoubleMat param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}63 void SetValue(char* string){_error _("DoubleMat param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}64 void SetValue(char** stringarray,int M){_error _("DoubleMat param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* doublearray,int M){_error_("DoubleMat param of enum %i (%s) cannot hold a double vec array",enum_type,EnumToStringx(enum_type));}66 void SetValue( double* doublearray,int M,int N);67 void SetValue(int* intarray,int M){_error _("DoubleMat param of enum %i (%s) cannot hold a int vec array",enum_type,EnumToStringx(enum_type));}68 void SetValue(int* intarray,int M,int N){_error _("DoubleMat param of enum %i (%s) cannot hold a int mat array",enum_type,EnumToStringx(enum_type));};69 void SetValue(Vector* vec){_error _("DoubleMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}70 void SetValue(Matrix* mat){_error _("DoubleMat param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}71 void SetValue(FILE* fid){_error _("DoubleMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}72 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("DoubleMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}60 void SetValue(bool boolean){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 61 void SetValue(int integer){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 62 void SetValue(IssmDouble scalar){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 63 void SetValue(char* string){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 64 void SetValue(char** stringarray,int M){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 65 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble vec array");} 66 void SetValue(IssmDouble* IssmDoublearray,int M,int N); 67 void SetValue(int* intarray,int M){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int vec array");} 68 void SetValue(int* intarray,int M,int N){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int mat array");}; 69 void SetValue(Vector* vec){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 70 void SetValue(Matrix* mat){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 71 void SetValue(FILE* fid){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 72 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("DoubleMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 73 73 void UnitConversion(int direction_enum); 74 double* GetPointer(void);74 IssmDouble* GetPointer(void); 75 75 76 76 void GetParameterName(char**pname); -
issm/trunk/src/c/objects/Params/DoubleParam.cpp
r12330 r12706 18 18 19 19 /*DoubleParam constructors and destructor*/ 20 /*FUNCTION DoubleParam::DoubleParam(){{{ 1*/20 /*FUNCTION DoubleParam::DoubleParam(){{{*/ 21 21 DoubleParam::DoubleParam(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION DoubleParam::DoubleParam(int enum_type,IssmDouble value){{{ 1*/25 /*FUNCTION DoubleParam::DoubleParam(int enum_type,IssmDouble value){{{*/ 26 26 DoubleParam::DoubleParam(int in_enum_type,IssmDouble in_value){ 27 27 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION DoubleParam::~DoubleParam(){{{ 1*/32 /*FUNCTION DoubleParam::~DoubleParam(){{{*/ 33 33 DoubleParam::~DoubleParam(){ 34 34 return; … … 37 37 38 38 /*Object virtual functions definitions:*/ 39 /*FUNCTION DoubleParam::Echo {{{ 1*/39 /*FUNCTION DoubleParam::Echo {{{*/ 40 40 void DoubleParam::Echo(void){ 41 41 this->DeepEcho(); 42 42 } 43 43 /*}}}*/ 44 /*FUNCTION DoubleParam::DeepEcho{{{ 1*/44 /*FUNCTION DoubleParam::DeepEcho{{{*/ 45 45 void DoubleParam::DeepEcho(void){ 46 46 47 printf("DoubleParam:\n");48 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));49 printf(" value: %g\n",this->value);47 _printLine_("DoubleParam:"); 48 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 49 _printLine_(" value: " << this->value); 50 50 } 51 51 /*}}}*/ 52 /*FUNCTION DoubleParam::Id{{{ 1*/52 /*FUNCTION DoubleParam::Id{{{*/ 53 53 int DoubleParam::Id(void){ return -1; } 54 54 /*}}}*/ 55 /*FUNCTION DoubleParam::MyRank{{{ 1*/55 /*FUNCTION DoubleParam::MyRank{{{*/ 56 56 int DoubleParam::MyRank(void){ 57 57 extern int my_rank; … … 59 59 } 60 60 /*}}}*/ 61 /*FUNCTION DoubleParam::ObjectEnum{{{ 1*/61 /*FUNCTION DoubleParam::ObjectEnum{{{*/ 62 62 int DoubleParam::ObjectEnum(void){ 63 63 … … 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION DoubleParam::copy{{{ 1*/68 /*FUNCTION DoubleParam::copy{{{*/ 69 69 Object* DoubleParam::copy() { 70 70 … … 75 75 76 76 /*DoubleParam virtual functions definitions: */ 77 /*FUNCTION DoubleParam::GetParameterName{{{ 1*/77 /*FUNCTION DoubleParam::GetParameterName{{{*/ 78 78 void DoubleParam::GetParameterName(char**pname){ 79 79 EnumToStringx(pname,this->enum_type); 80 80 } 81 81 /*}}}*/ 82 /*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{ 1*/82 /*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{*/ 83 83 void DoubleParam::GetParameterValue(int* pinteger){ 84 _error _("Double param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));84 _error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer"); 85 85 } 86 86 /*}}}*/ 87 /*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{ 1*/87 /*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{*/ 88 88 void DoubleParam::GetParameterValue(bool* pbool){ 89 _error _("Double param of enum %i (%s) cannot return an bool",enum_type,EnumToStringx(enum_type));89 _error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an bool"); 90 90 } 91 91 /*}}}*/ 92 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{ 1*/92 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{*/ 93 93 void DoubleParam::GetParameterValue(int** pintarray,int* pM){ 94 _error _("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));94 _error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers"); 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{ 1*/97 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{*/ 98 98 void DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){ 99 _error _("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));99 _error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers"); 100 100 } 101 101 /*}}}*/ 102 /*FUNCTION DoubleParam::GetParameterValue( double** pdoublearray,int* pM){{{1*/103 void DoubleParam::GetParameterValue( double** pdoublearray,int* pM){104 _error _("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type));102 /*FUNCTION DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ 103 void DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){ 104 _error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of IssmDouble"); 105 105 } 106 106 /*}}}*/ 107 /*FUNCTION DoubleParam::GetParameterValue( double** pdoublearray,int* pM,int* pN){{{1*/108 void DoubleParam::GetParameterValue( double** pdoublearray,int* pM,int* pN){109 _error _("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type));107 /*FUNCTION DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){{{*/ 108 void DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ 109 _error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of IssmDouble"); 110 110 } 111 111 /*}}}*/ 112 /*FUNCTION DoubleParam::UnitConversion{{{ 1*/112 /*FUNCTION DoubleParam::UnitConversion{{{*/ 113 113 void DoubleParam::UnitConversion(int direction_enum){ 114 114 ::UnitConversion(&this->value,1,direction_enum,this->enum_type); -
issm/trunk/src/c/objects/Params/DoubleParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*DoubleParam constructors, destructors: {{{ 1*/30 /*DoubleParam constructors, destructors: {{{*/ 31 31 DoubleParam(); 32 32 DoubleParam(int enum_type,IssmDouble value); 33 33 ~DoubleParam(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{ */ 36 36 void Echo(); 37 37 void DeepEcho(); … … 41 41 Object* copy(); 42 42 /*}}}*/ 43 /*Param vritual function definitions: {{{ 1*/43 /*Param vritual function definitions: {{{*/ 44 44 int InstanceEnum(){return enum_type;} 45 45 void GetParameterValue(bool* pbool); … … 47 47 void GetParameterValue(int** pintarray,int* pM); 48 48 void GetParameterValue(int** pintarray,int* pM,int* pN); 49 void GetParameterValue( double* pdouble){*pdouble=value;}50 void GetParameterValue(char** pstring){_error _("Double param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char*** pstringarray,int* pM){_error _("Double param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM);53 void GetParameterValue( double** pdoublearray,int* pM, int* pN);54 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("Double param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Vector** pvec){_error _("Double param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Matrix** pmat){_error _("Double param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(FILE** pfid){_error _("Double param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue(IssmDouble* pIssmDouble){*pIssmDouble=value;} 50 void GetParameterValue(char** pstring){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 51 void GetParameterValue(char*** pstringarray,int* pM){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 55 void GetParameterValue(Vector** pvec){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 56 void GetParameterValue(Matrix** pmat){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 57 void GetParameterValue(FILE** pfid){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 58 58 59 void SetValue(bool boolean){this->value=( double)boolean;}60 void SetValue(int integer){this->value=( double)integer;}61 void SetValue( double scalar){this->value=(double)scalar;}62 void SetValue(char* string){_error _("Double param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}63 void SetValue(char** stringarray,int M){_error _("Double param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* doublearray,int M){_error_("Double param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* pdoublearray,int M,int N){_error_("Double param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* intarray,int M){_error _("Double param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}67 void SetValue(int* pintarray,int M,int N){_error _("Double param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}68 void SetValue(Vector* vec){_error _("Double param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}69 void SetValue(Matrix* mat){_error _("Double param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}70 void SetValue(FILE* fid){_error _("Double param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}71 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("Double param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}59 void SetValue(bool boolean){this->value=(IssmDouble)boolean;} 60 void SetValue(int integer){this->value=(IssmDouble)integer;} 61 void SetValue(IssmDouble scalar){this->value=(IssmDouble)scalar;} 62 void SetValue(char* string){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 63 void SetValue(char** stringarray,int M){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 64 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 65 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 66 void SetValue(int* intarray,int M){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 67 void SetValue(int* pintarray,int M,int N){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 68 void SetValue(Vector* vec){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 69 void SetValue(Matrix* mat){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 70 void SetValue(FILE* fid){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 72 72 void UnitConversion(int direction_enum); 73 73 -
issm/trunk/src/c/objects/Params/DoubleTransientMatParam.cpp
r10660 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 20 20 /*}}}*/ 21 21 22 /*FUNCTION DoubleTransientMatParam::DoubleTransientMatParam(int enum_type,IssmDoubleMat value){{{ 1*/23 DoubleTransientMatParam::DoubleTransientMatParam(int in_enum_type, double* in_value, int in_M,int in_N):DoubleMatParam(in_enum_type,in_value,in_M,in_N){22 /*FUNCTION DoubleTransientMatParam::DoubleTransientMatParam(int enum_type,IssmDoubleMat value){{{*/ 23 DoubleTransientMatParam::DoubleTransientMatParam(int in_enum_type,IssmDouble* in_value, int in_M,int in_N):DoubleMatParam(in_enum_type,in_value,in_M,in_N){ 24 24 } 25 25 /*}}}*/ 26 26 27 /*FUNCTION DoubleTransientMatParam::UnitConversion{{{ 1*/27 /*FUNCTION DoubleTransientMatParam::UnitConversion{{{*/ 28 28 void DoubleTransientMatParam::UnitConversion(int direction_enum){ 29 29 ::UnitConversion(this->value,(this->M-1)*this->N,direction_enum,this->enum_type); -
issm/trunk/src/c/objects/Params/DoubleTransientMatParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 23 23 24 24 public: 25 /*DoubleTransientMatParam constructors, destructors: {{{ 1*/25 /*DoubleTransientMatParam constructors, destructors: {{{*/ 26 26 DoubleTransientMatParam(int enum_type,IssmDouble* value,int M,int N); 27 27 /*}}}*/ 28 /*Param vritual function definitions: {{{ 1*/28 /*Param vritual function definitions: {{{*/ 29 29 void UnitConversion(int direction_enum); 30 30 /*}}}*/ -
issm/trunk/src/c/objects/Params/DoubleVecParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*DoubleVecParam constructors and destructor*/ 23 /*FUNCTION DoubleVecParam::DoubleVecParam(){{{ 1*/23 /*FUNCTION DoubleVecParam::DoubleVecParam(){{{*/ 24 24 DoubleVecParam::DoubleVecParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION DoubleVecParam::DoubleVecParam(int enum_type,IssmDoubleVec values,int M){{{ 1*/29 DoubleVecParam::DoubleVecParam(int in_enum_type, double* in_values, int in_M){28 /*FUNCTION DoubleVecParam::DoubleVecParam(int enum_type,IssmDoubleVec values,int M){{{*/ 29 DoubleVecParam::DoubleVecParam(int in_enum_type,IssmDouble* in_values, int in_M){ 30 30 31 31 enum_type=in_enum_type; 32 32 M=in_M; 33 33 34 values= (double*)xmalloc(M*sizeof(double));35 memcpy(values,in_values,M*sizeof(double));34 values=xNew<IssmDouble>(M); 35 xMemCpy<IssmDouble>(values,in_values,M); 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION DoubleVecParam::~DoubleVecParam(){{{ 1*/38 /*FUNCTION DoubleVecParam::~DoubleVecParam(){{{*/ 39 39 DoubleVecParam::~DoubleVecParam(){ 40 x free((void**)&values);40 xDelete<IssmDouble>(values); 41 41 return; 42 42 } … … 44 44 45 45 /*Object virtual functions definitions:*/ 46 /*FUNCTION DoubleVecParam::Echo {{{ 1*/46 /*FUNCTION DoubleVecParam::Echo {{{*/ 47 47 void DoubleVecParam::Echo(void){ 48 48 49 printf("DoubleVecParam:\n");50 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));51 printf(" vector size: %i\n",this->M);49 _printLine_("DoubleVecParam:"); 50 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 51 _printLine_(" vector size: " << this->M); 52 52 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION DoubleVecParam::DeepEcho{{{ 1*/55 /*FUNCTION DoubleVecParam::DeepEcho{{{*/ 56 56 void DoubleVecParam::DeepEcho(void){ 57 57 58 58 int i; 59 59 60 printf("DoubleVecParam:\n");61 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));62 printf(" vector size: %i\n",this->M);60 _printLine_("DoubleVecParam:"); 61 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 62 _printLine_(" vector size: " << this->M); 63 63 for(i=0;i<this->M;i++){ 64 printf("%i %g\n",i,this->values[i]);64 _printLine_(i << " " << this->values[i]); 65 65 } 66 66 } 67 67 /*}}}*/ 68 /*FUNCTION DoubleVecParam::Id{{{ 1*/68 /*FUNCTION DoubleVecParam::Id{{{*/ 69 69 int DoubleVecParam::Id(void){ return -1; } 70 70 /*}}}*/ 71 /*FUNCTION DoubleVecParam::MyRank{{{ 1*/71 /*FUNCTION DoubleVecParam::MyRank{{{*/ 72 72 int DoubleVecParam::MyRank(void){ 73 73 extern int my_rank; … … 75 75 } 76 76 /*}}}*/ 77 /*FUNCTION DoubleVecParam::ObjectEnum{{{ 1*/77 /*FUNCTION DoubleVecParam::ObjectEnum{{{*/ 78 78 int DoubleVecParam::ObjectEnum(void){ 79 79 … … 82 82 } 83 83 /*}}}*/ 84 /*FUNCTION DoubleVecParam::copy{{{ 1*/84 /*FUNCTION DoubleVecParam::copy{{{*/ 85 85 Object* DoubleVecParam::copy() { 86 86 … … 91 91 92 92 /*DoubleVecParam virtual functions definitions: */ 93 /*FUNCTION DoubleVecParam::GetParameterValue( double** pdoublearray,int* pM){{{1*/94 void DoubleVecParam::GetParameterValue( double** pdoublearray,int* pM){95 double* output=NULL;93 /*FUNCTION DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ 94 void DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){ 95 IssmDouble* output=NULL; 96 96 int M; 97 97 98 98 M=this->M; 99 output= (double*)xmalloc(M*sizeof(double));100 memcpy(output,values,M*sizeof(double));99 output=xNew<IssmDouble>(M); 100 xMemCpy<IssmDouble>(output,values,M); 101 101 102 102 /*Assign output pointers:*/ 103 103 if(pM) *pM=M; 104 *p doublearray=output;104 *pIssmDoublearray=output; 105 105 } 106 106 /*}}}*/ 107 /*FUNCTION DoubleVecParam::GetParameterValue( double** pdoublearray,int* pM){{{1*/108 void DoubleVecParam::GetParameterValue( double** pdoublearray,int* pM,int* pN){109 double* output=NULL;107 /*FUNCTION DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ 108 void DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ 109 IssmDouble* output=NULL; 110 110 int M; 111 111 int N; … … 113 113 N=1; 114 114 M=this->M; 115 output= (double*)xmalloc(M*sizeof(double));116 memcpy(output,values,M*sizeof(double));115 output=xNew<IssmDouble>(M); 116 xMemCpy<IssmDouble>(output,values,M); 117 117 118 118 /*Assign output pointers:*/ 119 119 if(pM) *pM=M; 120 120 if(pN) *pN=N; 121 *p doublearray=output;121 *pIssmDoublearray=output; 122 122 } 123 123 /*}}}*/ 124 /*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{ 1*/124 /*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{*/ 125 125 void DoubleVecParam::GetParameterValue(int** pintarray,int* pM){ 126 _error _("DoubleVec param of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type));126 _error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of int"); 127 127 } 128 128 /*}}}*/ 129 /*FUNCTION DoubleVecParam::GetParameterName{{{ 1*/129 /*FUNCTION DoubleVecParam::GetParameterName{{{*/ 130 130 void DoubleVecParam::GetParameterName(char**pname){ 131 131 EnumToStringx(pname,this->enum_type); 132 132 } 133 133 /*}}}*/ 134 /*FUNCTION DoubleVecParam::SetValue{{{ 1*/135 void DoubleVecParam::SetValue( double* doublearray,int in_M){134 /*FUNCTION DoubleVecParam::SetValue{{{*/ 135 void DoubleVecParam::SetValue(IssmDouble* IssmDoublearray,int in_M){ 136 136 137 137 /*avoid leak: */ 138 x free((void**)&this->values);138 xDelete<IssmDouble>(this->values); 139 139 140 this->values= (double*)xmalloc(in_M*sizeof(double));141 memcpy(this->values,doublearray,in_M*sizeof(double));140 this->values=xNew<IssmDouble>(in_M); 141 xMemCpy<IssmDouble>(this->values,IssmDoublearray,in_M); 142 142 143 143 this->M=in_M; 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION DoubleVecParam::UnitConversion{{{ 1*/146 /*FUNCTION DoubleVecParam::UnitConversion{{{*/ 147 147 void DoubleVecParam::UnitConversion(int direction_enum){ 148 148 ::UnitConversion(this->values,this->M,direction_enum,this->enum_type); -
issm/trunk/src/c/objects/Params/DoubleVecParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*DoubleVecParam constructors, destructors: {{{ 1*/30 /*DoubleVecParam constructors, destructors: {{{*/ 31 31 DoubleVecParam(); 32 32 DoubleVecParam(int enum_type,IssmDouble* values,int M); 33 33 ~DoubleVecParam(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{ */ 36 36 void Echo(); 37 37 void DeepEcho(); … … 41 41 Object* copy(); 42 42 /*}}}*/ 43 /*Param virtual functions definitions: {{{ 1*/43 /*Param virtual functions definitions: {{{*/ 44 44 int InstanceEnum(){return enum_type;} 45 void GetParameterValue(bool* pbool){_error _("DoubleVec param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(int* pinteger){_error _("DoubleVec param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(bool* pbool){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 46 void GetParameterValue(int* pinteger){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 47 47 void GetParameterValue(int** pintarray,int* pM); 48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("DoubleVec param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));};49 void GetParameterValue( double* pdouble){_error_("DoubleVec param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(char** pstring){_error _("DoubleVec param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char*** pstringarray,int* pM){_error _("DoubleVec param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM);53 void GetParameterValue( double** pdoublearray,int* pM, int* pN);54 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("DoubleVec param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Vector** pvec){_error _("DoubleVec param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Matrix** pmat){_error _("DoubleVec param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(FILE** pfid){_error _("DoubleVec param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");}; 49 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 50 void GetParameterValue(char** pstring){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 51 void GetParameterValue(char*** pstringarray,int* pM){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 55 void GetParameterValue(Vector** pvec){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 56 void GetParameterValue(Matrix** pmat){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 57 void GetParameterValue(FILE** pfid){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 58 58 59 void SetValue(bool boolean){_error _("DoubleVec param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}60 void SetValue(int integer){_error _("DoubleVec param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}61 void SetValue( double scalar){_error_("DoubleVec param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}62 void SetValue(char* string){_error _("DoubleVec param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}63 void SetValue(char** stringarray,int M){_error _("DoubleVec param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* doublearray,int M);65 void SetValue( double* pdoublearray,int M,int N){_error_("DoubleVec param of enum %i (%s) cannot hold a double mat array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* intarray,int M){_error _("DoubleVec param of enum %i (%s) cannot hold a int mat array",enum_type,EnumToStringx(enum_type));};67 void SetValue(int* pintarray,int M,int N){_error _("DoubleVec param of enum %i (%s) cannot hold a int mat array",enum_type,EnumToStringx(enum_type));}68 void SetValue(Vector* vec){_error _("DoubleVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}69 void SetValue(Matrix* mat){_error _("DoubleVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}70 void SetValue(FILE* fid){_error _("DoubleVec param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}71 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("DoubleVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}59 void SetValue(bool boolean){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 60 void SetValue(int integer){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 61 void SetValue(IssmDouble scalar){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 62 void SetValue(char* string){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 63 void SetValue(char** stringarray,int M){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 64 void SetValue(IssmDouble* IssmDoublearray,int M); 65 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble mat array");} 66 void SetValue(int* intarray,int M){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int mat array");}; 67 void SetValue(int* pintarray,int M,int N){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int mat array");} 68 void SetValue(Vector* vec){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 69 void SetValue(Matrix* mat){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 70 void SetValue(FILE* fid){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 72 72 void UnitConversion(int direction_enum); 73 73 -
issm/trunk/src/c/objects/Params/FileParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*FileParam constructors and destructor*/ 23 /*FUNCTION FileParam::FileParam(){{{ 1*/23 /*FUNCTION FileParam::FileParam(){{{*/ 24 24 FileParam::FileParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION FileParam::FileParam(int enum_type,FILE *value){{{ 1*/28 /*FUNCTION FileParam::FileParam(int enum_type,FILE *value){{{*/ 29 29 FileParam::FileParam(int in_enum_type,FILE* in_value){ 30 30 … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION FileParam::~FileParam(){{{ 1*/35 /*FUNCTION FileParam::~FileParam(){{{*/ 36 36 FileParam::~FileParam(){ 37 37 return; … … 40 40 41 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION FileParam::Echo {{{ 1*/42 /*FUNCTION FileParam::Echo {{{*/ 43 43 void FileParam::Echo(void){ 44 44 this->DeepEcho(); 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION FileParam::DeepEcho{{{ 1*/47 /*FUNCTION FileParam::DeepEcho{{{*/ 48 48 void FileParam::DeepEcho(void){ 49 49 50 printf("FileParam:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" value: %p\n",this->value);50 _printLine_("FileParam:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" value: " << this->value); 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION FileParam::Id{{{ 1*/55 /*FUNCTION FileParam::Id{{{*/ 56 56 int FileParam::Id(void){ return -1; } 57 57 /*}}}*/ 58 /*FUNCTION FileParam::MyRank{{{ 1*/58 /*FUNCTION FileParam::MyRank{{{*/ 59 59 int FileParam::MyRank(void){ 60 60 extern int my_rank; … … 62 62 } 63 63 /*}}}*/ 64 /*FUNCTION FileParam::ObjectEnum{{{ 1*/64 /*FUNCTION FileParam::ObjectEnum{{{*/ 65 65 int FileParam::ObjectEnum(void){ 66 66 … … 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION FileParam::copy{{{ 1*/71 /*FUNCTION FileParam::copy{{{*/ 72 72 Object* FileParam::copy() { 73 73 … … 78 78 79 79 /*FileParam virtual functions definitions: */ 80 /*FUNCTION FileParam::GetParameterName{{{ 1*/80 /*FUNCTION FileParam::GetParameterName{{{*/ 81 81 void FileParam::GetParameterName(char**pname){ 82 82 EnumToStringx(pname,this->enum_type); 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION FileParam::UnitConversion{{{ 1*/85 /*FUNCTION FileParam::UnitConversion{{{*/ 86 86 void FileParam::UnitConversion(int direction_enum){ 87 87 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/FileParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 27 27 28 28 public: 29 /*FileParam constructors, destructors: {{{ 1*/29 /*FileParam constructors, destructors: {{{*/ 30 30 FileParam(); 31 31 FileParam(int enum_type,FILE* fid); 32 32 ~FileParam(); 33 33 /*}}}*/ 34 /*Object virtual functions definitions:{{{ 1*/34 /*Object virtual functions definitions:{{{ */ 35 35 void Echo(); 36 36 void DeepEcho(); … … 40 40 Object* copy(); 41 41 /*}}}*/ 42 /*Param vritual function definitions: {{{ 1*/42 /*Param vritual function definitions: {{{*/ 43 43 int InstanceEnum(){return enum_type;} 44 void GetParameterValue(bool* pbool){ _error _("FileParam of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(int* pinteger){_error _("FileParam of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(int** pintarray,int* pM){_error _("FileParam of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("FileParam of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue( double* pdouble){_error_("FileParam of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue(char** pstring){_error _("FileParam of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(char*** pstringarray,int* pM){_error _("FileParam of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue( double** pdoublearray,int* pM){_error_("FileParam of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("FileParam of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("File param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue(Vector** pvec){_error _("FileParam of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Matrix** pmat){_error _("FileParam of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}44 void GetParameterValue(bool* pbool){ _error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 45 void GetParameterValue(int* pinteger){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 46 void GetParameterValue(int** pintarray,int* pM){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 47 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 48 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 49 void GetParameterValue(char** pstring){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 50 void GetParameterValue(char*** pstringarray,int* pM){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 54 void GetParameterValue(Vector** pvec){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 55 void GetParameterValue(Matrix** pmat){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 56 56 void GetParameterValue(FILE** pfid){*pfid=value;}; 57 57 58 void SetValue(bool boolean){_error _("FileParam of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}59 void SetValue(int integer){_error _("FileParam of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}60 void SetValue( double scalar){_error_("FileParam of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}61 void SetValue(char* string){_error _("FileParam of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}62 void SetValue(char** stringarray,int M){_error _("FileParam of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}63 void SetValue( double* doublearray,int M){_error_("FileParam of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* pdoublearray,int M,int N){_error_("FileParam of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}65 void SetValue(int* intarray,int M){_error _("FileParam of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* pintarray,int M,int N){_error _("FileParam of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}67 void SetValue(Vector* vec){_error _("FileParam of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}68 void SetValue(Matrix* mat){_error _("FileParam of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}69 void SetValue(FILE* fid){_error _("File param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}70 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("File param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}58 void SetValue(bool boolean){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 59 void SetValue(int integer){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 60 void SetValue(IssmDouble scalar){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 61 void SetValue(char* string){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 62 void SetValue(char** stringarray,int M){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 63 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 64 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 65 void SetValue(int* intarray,int M){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 66 void SetValue(int* pintarray,int M,int N){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 67 void SetValue(Vector* vec){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 68 void SetValue(Matrix* mat){_error2_("FileParam of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 69 void SetValue(FILE* fid){_error2_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 70 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 71 71 void UnitConversion(int direction_enum); 72 72 -
issm/trunk/src/c/objects/Params/IntMatParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*IntMatParam constructors and destructor*/ 23 /*FUNCTION IntMatParam::IntMatParam(){{{ 1*/23 /*FUNCTION IntMatParam::IntMatParam(){{{*/ 24 24 IntMatParam::IntMatParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION IntMatParam::IntMatParam(int enum_type,IssmIntMat value){{{ 1*/28 /*FUNCTION IntMatParam::IntMatParam(int enum_type,IssmIntMat value){{{*/ 29 29 IntMatParam::IntMatParam(int in_enum_type,int* in_value, int in_M,int in_N){ 30 30 … … 33 33 N=in_N; 34 34 35 value= (int*)xmalloc(M*N*sizeof(int));36 memcpy(value,in_value,M*N*sizeof(int));35 value=xNew<int>(M*N); 36 xMemCpy<int>(value,in_value,M*N); 37 37 } 38 38 /*}}}*/ 39 /*FUNCTION IntMatParam::~IntMatParam(){{{ 1*/39 /*FUNCTION IntMatParam::~IntMatParam(){{{*/ 40 40 IntMatParam::~IntMatParam(){ 41 x free((void**)&value);41 xDelete<int>(value); 42 42 return; 43 43 } … … 45 45 46 46 /*Object virtual functions definitions:*/ 47 /*FUNCTION IntMatParam::Echo {{{ 1*/47 /*FUNCTION IntMatParam::Echo {{{*/ 48 48 void IntMatParam::Echo(void){ 49 49 50 printf("IntMatParam:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" matrix size: %ix%i\n",this->M,this->N);50 _printLine_("IntMatParam:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" matrix size: " << this->M << "x" << this->N); 53 53 54 54 } 55 55 /*}}}*/ 56 /*FUNCTION IntMatParam::DeepEcho{{{ 1*/56 /*FUNCTION IntMatParam::DeepEcho{{{*/ 57 57 void IntMatParam::DeepEcho(void){ 58 58 59 59 int i,j; 60 60 61 printf("IntMatParam:\n");62 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));63 printf(" matrix size: %ix%i\n",this->M,this->N);61 _printLine_("IntMatParam:"); 62 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 63 _printLine_(" matrix size: " << this->M << "x" << this->N); 64 64 for(i=0;i<this->M;i++){ 65 65 for(i=0;i<this->N;i++){ 66 printf("(%i,%i) %i\n",i,j,*(this->value+N*i+j));66 _printLine_("(" << i << "," << j << ") " << *(this->value+N*i+j)); 67 67 } 68 68 } 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION IntMatParam::Id{{{ 1*/71 /*FUNCTION IntMatParam::Id{{{*/ 72 72 int IntMatParam::Id(void){ return -1; } 73 73 /*}}}*/ 74 /*FUNCTION IntMatParam::MyRank{{{ 1*/74 /*FUNCTION IntMatParam::MyRank{{{*/ 75 75 int IntMatParam::MyRank(void){ 76 76 extern int my_rank; … … 78 78 } 79 79 /*}}}*/ 80 /*FUNCTION IntMatParam::ObjectEnum{{{ 1*/80 /*FUNCTION IntMatParam::ObjectEnum{{{*/ 81 81 int IntMatParam::ObjectEnum(void){ 82 82 … … 85 85 } 86 86 /*}}}*/ 87 /*FUNCTION IntMatParam::copy{{{ 1*/87 /*FUNCTION IntMatParam::copy{{{*/ 88 88 Object* IntMatParam::copy() { 89 89 … … 94 94 95 95 /*IntMatParam virtual functions definitions: */ 96 /*FUNCTION IntMatParam::GetParameterValue{{{ 1*/96 /*FUNCTION IntMatParam::GetParameterValue{{{*/ 97 97 void IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){ 98 98 int* output=NULL; 99 99 100 output= (int*)xmalloc((int)(M*N*sizeof(int)));101 memcpy(output,value,M*N*sizeof(int));100 output=xNew<int>(M*N); 101 xMemCpy<int>(output,value,M*N); 102 102 103 103 /*Assign output pointers:*/ … … 107 107 } 108 108 /*}}}*/ 109 /*FUNCTION IntMatParam::GetParameterName{{{ 1*/109 /*FUNCTION IntMatParam::GetParameterName{{{*/ 110 110 void IntMatParam::GetParameterName(char**pname){ 111 111 EnumToStringx(pname,this->enum_type); 112 112 } 113 113 /*}}}*/ 114 /*FUNCTION IntMatParam::SetValue{{{ 1*/114 /*FUNCTION IntMatParam::SetValue{{{*/ 115 115 void IntMatParam::SetValue(int* intarray,int in_M,int in_N){ 116 116 117 117 /*avoid leak: */ 118 x free((void**)&this->value);118 xDelete<int>(this->value); 119 119 120 this->value= (int*)xmalloc(in_M*in_N*sizeof(int));121 memcpy(this->value,intarray,in_M*in_N*sizeof(int));120 this->value=xNew<int>(in_M*in_N); 121 xMemCpy<int>(this->value,intarray,in_M*in_N); 122 122 123 123 this->M=in_M; … … 125 125 } 126 126 /*}}}*/ 127 /*FUNCTION IntMatParam::UnitConversion{{{ 1*/127 /*FUNCTION IntMatParam::UnitConversion{{{*/ 128 128 void IntMatParam::UnitConversion(int direction_enum){ 129 129 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/IntMatParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 29 29 30 30 public: 31 /*IntMatParam constructors, destructors: {{{ 1*/31 /*IntMatParam constructors, destructors: {{{*/ 32 32 IntMatParam(); 33 33 IntMatParam(int enum_type,int* value,int M,int N); 34 34 ~IntMatParam(); 35 35 /*}}}*/ 36 /*Object virtual functions definitions:{{{ 1*/36 /*Object virtual functions definitions:{{{ */ 37 37 void Echo(); 38 38 void DeepEcho(); … … 42 42 Object* copy(); 43 43 /*}}}*/ 44 /*Param vritual function definitions: {{{ 1*/44 /*Param vritual function definitions: {{{*/ 45 45 int InstanceEnum(){return enum_type;} 46 void GetParameterValue(bool* pbool){_error _("IntMat param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int* pinteger){_error _("IntMat param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM){_error _("IntMat param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(bool* pbool){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 47 void GetParameterValue(int* pinteger){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 48 void GetParameterValue(int** pintarray,int* pM){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 49 49 void GetParameterValue(int** pintarray,int* pM,int* pN); 50 void GetParameterValue( double* pdouble){_error_("IntMat param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char** pstring){_error _("IntMat param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue(char*** pstringarray,int* pM){_error _("IntMat param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM){_error_("IntMat param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double** pdoublearray,int* pM,int* pN){_error_("IntMat param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));};55 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("IntMat param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Vector** pvec){_error _("IntMat param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(Matrix** pmat){_error _("IntMat param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}58 void GetParameterValue(FILE** pfid){_error _("IntMat param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 51 void GetParameterValue(char** pstring){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 52 void GetParameterValue(char*** pstringarray,int* pM){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");}; 55 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 56 void GetParameterValue(Vector** pvec){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 57 void GetParameterValue(Matrix** pmat){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 58 void GetParameterValue(FILE** pfid){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 59 59 60 void SetValue(bool boolean){_error _("IntMat param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}61 void SetValue(int integer){_error _("IntMat param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}62 void SetValue( double scalar){_error_("IntMat param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}63 void SetValue(char* string){_error _("IntMat param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}64 void SetValue(char** stringarray,int M){_error _("IntMat param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* doublearray,int M){_error_("IntMat param of enum %i (%s) cannot hold a double vec array",enum_type,EnumToStringx(enum_type));}66 void SetValue( double* doublearray,int M,int N){_error_("IntMat param of enum %i (%s) cannot hold a double vec array",enum_type,EnumToStringx(enum_type));};67 void SetValue(int* intarray,int M){_error _("IntMat param of enum %i (%s) cannot hold a int vec array",enum_type,EnumToStringx(enum_type));};60 void SetValue(bool boolean){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 61 void SetValue(int integer){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 62 void SetValue(IssmDouble scalar){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 63 void SetValue(char* string){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 64 void SetValue(char** stringarray,int M){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 65 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble vec array");} 66 void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble vec array");}; 67 void SetValue(int* intarray,int M){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int vec array");}; 68 68 void SetValue(int* intarray,int M,int N); 69 void SetValue(Vector* vec){_error _("IntMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}70 void SetValue(Matrix* mat){_error _("IntMat param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}71 void SetValue(FILE* fid){_error _("IntMat param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}72 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("IntMat param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}69 void SetValue(Vector* vec){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 70 void SetValue(Matrix* mat){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 71 void SetValue(FILE* fid){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 72 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("IntMat param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 73 73 void UnitConversion(int direction_enum); 74 74 -
issm/trunk/src/c/objects/Params/IntParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*IntParam constructors and destructor*/ 23 /*FUNCTION IntParam::IntParam(){{{ 1*/23 /*FUNCTION IntParam::IntParam(){{{*/ 24 24 IntParam::IntParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION IntParam::IntParam(int enum_type,IssmInt value){{{ 1*/28 /*FUNCTION IntParam::IntParam(int enum_type,IssmInt value){{{*/ 29 29 IntParam::IntParam(int in_enum_type,IssmInt in_value){ 30 30 … … 33 33 } 34 34 /*}}}*/ 35 /*FUNCTION IntParam::~IntParam(){{{ 1*/35 /*FUNCTION IntParam::~IntParam(){{{*/ 36 36 IntParam::~IntParam(){ 37 37 return; … … 40 40 41 41 /*Object virtual functions definitions:*/ 42 /*FUNCTION IntParam::Echo {{{ 1*/42 /*FUNCTION IntParam::Echo {{{*/ 43 43 void IntParam::Echo(void){ 44 44 this->DeepEcho(); 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION IntParam::DeepEcho{{{ 1*/47 /*FUNCTION IntParam::DeepEcho{{{*/ 48 48 void IntParam::DeepEcho(void){ 49 49 50 printf("IntParam:\n");51 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));52 printf(" value: %i\n",this->value);50 _printLine_("IntParam:"); 51 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 52 _printLine_(" value: " << this->value); 53 53 } 54 54 /*}}}*/ 55 /*FUNCTION IntParam::Id{{{ 1*/55 /*FUNCTION IntParam::Id{{{*/ 56 56 int IntParam::Id(void){ return -1; } 57 57 /*}}}*/ 58 /*FUNCTION IntParam::MyRank{{{ 1*/58 /*FUNCTION IntParam::MyRank{{{*/ 59 59 int IntParam::MyRank(void){ 60 60 extern int my_rank; … … 62 62 } 63 63 /*}}}*/ 64 /*FUNCTION IntParam::ObjectEnum{{{ 1*/64 /*FUNCTION IntParam::ObjectEnum{{{*/ 65 65 int IntParam::ObjectEnum(void){ 66 66 … … 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION IntParam::copy{{{ 1*/71 /*FUNCTION IntParam::copy{{{*/ 72 72 Object* IntParam::copy() { 73 73 … … 78 78 79 79 /*IntParam virtual functions definitions: */ 80 /*FUNCTION IntParam::GetParameterName{{{ 1*/80 /*FUNCTION IntParam::GetParameterName{{{*/ 81 81 void IntParam::GetParameterName(char**pname){ 82 82 EnumToStringx(pname,this->enum_type); 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION IntParam::UnitConversion{{{ 1*/85 /*FUNCTION IntParam::UnitConversion{{{*/ 86 86 void IntParam::UnitConversion(int direction_enum){ 87 87 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/IntParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*IntParam constructors, destructors: {{{ 1*/30 /*IntParam constructors, destructors: {{{*/ 31 31 IntParam(); 32 32 IntParam(int enum_type,IssmInt value); 33 33 ~IntParam(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{ */ 36 36 void Echo(); 37 37 void DeepEcho(); … … 41 41 Object* copy(); 42 42 /*}}}*/ 43 /*Param vritual function definitions: {{{ 1*/43 /*Param vritual function definitions: {{{*/ 44 44 int InstanceEnum(){return enum_type;} 45 void GetParameterValue(bool* pbool){_error _("Int param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(bool* pbool){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 46 46 void GetParameterValue(int* pinteger){*pinteger=value;} 47 void GetParameterValue(int** pintarray,int* pM){_error _("Int param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("Int param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue( double* pdouble){_error_("Int param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(char** pstring){_error _("Int param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char*** pstringarray,int* pM){_error _("Int param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM){_error_("Int param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("Int param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("Int param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Vector** pvec){_error _("Int param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Matrix** pmat){_error _("Int param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(FILE** pfid){_error _("Int param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int** pintarray,int* pM){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 49 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 50 void GetParameterValue(char** pstring){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 51 void GetParameterValue(char*** pstringarray,int* pM){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 55 void GetParameterValue(Vector** pvec){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 56 void GetParameterValue(Matrix** pmat){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 57 void GetParameterValue(FILE** pfid){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 58 58 59 void SetValue(bool boolean){ this->value=(int)boolean;}59 void SetValue(bool boolean){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a bool");} 60 60 void SetValue(int integer){this->value=integer;} 61 void SetValue(int* intarray,int M){_error _("Int param of enum %i (%s) cannot hold an int array",enum_type,EnumToStringx(enum_type));}62 void SetValue(int* intarray,int M,int N){_error _("Int param of enum %i (%s) cannot hold an int array",enum_type,EnumToStringx(enum_type));}63 void SetValue( double scalar){this->value=(int)scalar;}64 void SetValue(char* string){_error _("Int param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}65 void SetValue(char** stringarray,int M){_error _("Int param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}66 void SetValue( double* doublearray,int M){_error_("Int param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}67 void SetValue( double* pdoublearray,int M,int N){_error_("Int param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}68 void SetValue(Vector* vec){_error _("Int param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}69 void SetValue(Matrix* mat){_error _("Int param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}70 void SetValue(FILE* fid){_error _("Int param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}71 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("Int param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}61 void SetValue(int* intarray,int M){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an int array");} 62 void SetValue(int* intarray,int M,int N){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an int array");} 63 void SetValue(IssmDouble scalar){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an IssmDouble");} 64 void SetValue(char* string){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 65 void SetValue(char** stringarray,int M){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 67 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 68 void SetValue(Vector* vec){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 69 void SetValue(Matrix* mat){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 70 void SetValue(FILE* fid){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Int param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 72 72 void UnitConversion(int direction_enum); 73 73 -
issm/trunk/src/c/objects/Params/IntVecParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*IntVecParam constructors and destructor*/ 23 /*FUNCTION IntVecParam::IntVecParam(){{{ 1*/23 /*FUNCTION IntVecParam::IntVecParam(){{{*/ 24 24 IntVecParam::IntVecParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION IntVecParam::IntVecParam(int enum_type,int* values,int M){{{ 1*/28 /*FUNCTION IntVecParam::IntVecParam(int enum_type,int* values,int M){{{*/ 29 29 IntVecParam::IntVecParam(int in_enum_type,int* in_values, int in_M){ 30 30 … … 33 33 34 34 if(M){ 35 values= (int*)xmalloc(M*sizeof(int));36 memcpy(values,in_values,M*sizeof(int));35 values=xNew<int>(M); 36 xMemCpy<int>(values,in_values,M); 37 37 } 38 38 else values=NULL; 39 39 } 40 40 /*}}}*/ 41 /*FUNCTION IntVecParam::IntVecParam(int enum_type, double* values,int M){{{1*/42 IntVecParam::IntVecParam(int in_enum_type, double* in_values, int in_M){41 /*FUNCTION IntVecParam::IntVecParam(int enum_type,IssmDouble* values,int M){{{*/ 42 IntVecParam::IntVecParam(int in_enum_type,IssmDouble* in_values, int in_M){ 43 43 44 44 enum_type=in_enum_type; … … 46 46 47 47 if(M){ 48 values= (int*)xmalloc(M*sizeof(int));49 for(int i=0;i<in_M;i++) values[i]= (int)in_values[i];48 values=xNew<int>(M); 49 for(int i=0;i<in_M;i++) values[i]=reCast<int>(in_values[i]); 50 50 } 51 51 else values=NULL; 52 52 } 53 53 /*}}}*/ 54 /*FUNCTION IntVecParam::~IntVecParam(){{{ 1*/54 /*FUNCTION IntVecParam::~IntVecParam(){{{*/ 55 55 IntVecParam::~IntVecParam(){ 56 x free((void**)&values);56 xDelete<int>(values); 57 57 return; 58 58 } … … 60 60 61 61 /*Object virtual functions definitions:*/ 62 /*FUNCTION IntVecParam::Echo {{{ 1*/62 /*FUNCTION IntVecParam::Echo {{{*/ 63 63 void IntVecParam::Echo(void){ 64 64 65 printf("IntVecParam:\n");66 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));67 printf(" vector size: %i\n",this->M);65 _printLine_("IntVecParam:"); 66 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 67 _printLine_(" vector size: " << this->M); 68 68 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION IntVecParam::DeepEcho{{{ 1*/71 /*FUNCTION IntVecParam::DeepEcho{{{*/ 72 72 void IntVecParam::DeepEcho(void){ 73 73 74 74 int i; 75 75 76 printf("IntVecParam:\n");77 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));78 printf(" vector size: %i\n",this->M);76 _printLine_("IntVecParam:"); 77 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 78 _printLine_(" vector size: " << this->M); 79 79 for(i=0;i<this->M;i++){ 80 printf("%i %i\n",i,this->values[i]);80 _printLine_(i << " " << this->values[i]); 81 81 } 82 82 } 83 83 /*}}}*/ 84 /*FUNCTION IntVecParam::Id{{{ 1*/84 /*FUNCTION IntVecParam::Id{{{*/ 85 85 int IntVecParam::Id(void){ return -1; } 86 86 /*}}}*/ 87 /*FUNCTION IntVecParam::MyRank{{{ 1*/87 /*FUNCTION IntVecParam::MyRank{{{*/ 88 88 int IntVecParam::MyRank(void){ 89 89 extern int my_rank; … … 91 91 } 92 92 /*}}}*/ 93 /*FUNCTION IntVecParam::ObjectEnum{{{ 1*/93 /*FUNCTION IntVecParam::ObjectEnum{{{*/ 94 94 int IntVecParam::ObjectEnum(void){ 95 95 … … 98 98 } 99 99 /*}}}*/ 100 /*FUNCTION IntVecParam::copy{{{ 1*/100 /*FUNCTION IntVecParam::copy{{{*/ 101 101 Object* IntVecParam::copy() { 102 102 … … 107 107 108 108 /*IntVecParam virtual functions definitions: */ 109 /*FUNCTION IntVecParam::GetParameterValue{{{ 1*/109 /*FUNCTION IntVecParam::GetParameterValue{{{*/ 110 110 void IntVecParam::GetParameterValue(int** pintarray,int* pM){ 111 111 int* output=NULL; 112 112 113 113 if(M){ 114 output= (int*)xmalloc(M*sizeof(int));115 memcpy(output,values,M*sizeof(int));114 output=xNew<int>(M); 115 xMemCpy<int>(output,values,M); 116 116 } 117 117 … … 121 121 } 122 122 /*}}}*/ 123 /*FUNCTION IntVecParam::GetParameterName{{{ 1*/123 /*FUNCTION IntVecParam::GetParameterName{{{*/ 124 124 void IntVecParam::GetParameterName(char**pname){ 125 125 EnumToStringx(pname,this->enum_type); 126 126 } 127 127 /*}}}*/ 128 /*FUNCTION IntVecParam::SetValue{{{ 1*/128 /*FUNCTION IntVecParam::SetValue{{{*/ 129 129 void IntVecParam::SetValue(int* intarray,int in_M){ 130 130 131 131 /*avoid leak: */ 132 x free((void**)&this->values);132 xDelete<int>(this->values); 133 133 134 134 if(in_M){ 135 this->values= (int*)xmalloc(in_M*sizeof(int));136 memcpy(this->values,intarray,in_M*sizeof(int));135 this->values=xNew<int>(in_M); 136 xMemCpy<int>(this->values,intarray,in_M); 137 137 } 138 138 else this->values=NULL; … … 141 141 } 142 142 /*}}}*/ 143 /*FUNCTION IntVecParam::UnitConversion{{{ 1*/143 /*FUNCTION IntVecParam::UnitConversion{{{*/ 144 144 void IntVecParam::UnitConversion(int direction_enum){ 145 145 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/IntVecParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*IntVecParam constructors, destructors: {{{ 1*/30 /*IntVecParam constructors, destructors: {{{*/ 31 31 IntVecParam(); 32 32 IntVecParam(int enum_type,int* values,int M); 33 IntVecParam(int enum_type, double* values,int M);33 IntVecParam(int enum_type,IssmDouble* values,int M); 34 34 ~IntVecParam(); 35 35 /*}}}*/ 36 /*Object virtual functions definitions:{{{ 1*/36 /*Object virtual functions definitions:{{{ */ 37 37 void Echo(); 38 38 void DeepEcho(); … … 42 42 Object* copy(); 43 43 /*}}}*/ 44 /*Param virtual functions definitions: {{{ 1*/44 /*Param virtual functions definitions: {{{*/ 45 45 int InstanceEnum(){return enum_type;} 46 void GetParameterValue(bool* pbool){_error _("IntVec param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int* pinteger){_error _("IntVec param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(bool* pbool){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 47 void GetParameterValue(int* pinteger){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 48 48 void GetParameterValue(int** pintarray,int* pM); 49 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("IntVec param of enum %i (%s) cannot return a matrix",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue( double* pdouble){_error_("IntVec param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char** pstring){_error _("IntVec param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue(char*** pstringarray,int* pM){_error _("IntVec param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM){_error_("IntVec param of enum %i (%s) cannot return a double array (maybe in serial?)",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("IntVec param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("IntVec param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Vector** pvec){_error _("IntVec param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(Matrix** pmat){_error _("IntVec param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}58 void GetParameterValue(FILE** pfid){_error _("IntVec param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix");} 50 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 51 void GetParameterValue(char** pstring){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 52 void GetParameterValue(char*** pstringarray,int* pM){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array (maybe in serial?)");} 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 55 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 56 void GetParameterValue(Vector** pvec){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 57 void GetParameterValue(Matrix** pmat){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 58 void GetParameterValue(FILE** pfid){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 59 59 60 void SetValue(bool boolean){_error _("IntVec param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}61 void SetValue(int integer){_error _("IntVec param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}62 void SetValue( double scalar){_error_("IntVec param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}63 void SetValue(char* string){_error _("IntVec param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}64 void SetValue(char** stringarray,int M){_error _("IntVec param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* doublearray,int M){_error_("IntVec param of enum %i (%s) cannot hold a double mat array",enum_type,EnumToStringx(enum_type));}66 void SetValue( double* pdoublearray,int M,int N){_error_("IntVec param of enum %i (%s) cannot hold a double mat array",enum_type,EnumToStringx(enum_type));}60 void SetValue(bool boolean){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 61 void SetValue(int integer){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 62 void SetValue(IssmDouble scalar){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 63 void SetValue(char* string){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 64 void SetValue(char** stringarray,int M){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 65 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble mat array");} 66 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble mat array");} 67 67 void SetValue(int* intarray,int M); 68 void SetValue(int* pintarray,int M,int N){_error _("IntVec param of enum %i (%s) cannot hold a int mat array",enum_type,EnumToStringx(enum_type));}69 void SetValue(Vector* vec){_error _("IntVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}70 void SetValue(Matrix* mat){_error _("IntVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}71 void SetValue(FILE* fid){_error _("IntVec param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}72 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("IntVec param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}68 void SetValue(int* pintarray,int M,int N){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int mat array");} 69 void SetValue(Vector* vec){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 70 void SetValue(Matrix* mat){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 71 void SetValue(FILE* fid){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 72 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("IntVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 73 73 void UnitConversion(int direction_enum); 74 74 -
issm/trunk/src/c/objects/Params/MatrixParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*MatrixParam constructors and destructor*/ 23 /*FUNCTION MatrixParam::MatrixParam(){{{ 1*/23 /*FUNCTION MatrixParam::MatrixParam(){{{*/ 24 24 MatrixParam::MatrixParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix* value){{{ 1*/28 /*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix* value){{{*/ 29 29 MatrixParam::MatrixParam(int in_enum_type,Matrix* in_value){ 30 30 … … 37 37 } 38 38 /*}}}*/ 39 /*FUNCTION MatrixParam::~MatrixParam(){{{ 1*/39 /*FUNCTION MatrixParam::~MatrixParam(){{{*/ 40 40 MatrixParam::~MatrixParam(){ 41 41 xdelete(&value); … … 44 44 45 45 /*Object virtual functions definitions:*/ 46 /*FUNCTION MatrixParam::Echo {{{ 1*/46 /*FUNCTION MatrixParam::Echo {{{*/ 47 47 void MatrixParam::Echo(void){ 48 48 49 printf("MatrixParam:\n");50 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));49 _printLine_("MatrixParam:"); 50 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 51 51 52 52 } 53 53 /*}}}*/ 54 /*FUNCTION MatrixParam::DeepEcho{{{ 1*/54 /*FUNCTION MatrixParam::DeepEcho{{{*/ 55 55 void MatrixParam::DeepEcho(void){ 56 56 57 57 int i; 58 printf("MatrixParam:\n");59 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));58 _printLine_("MatrixParam:"); 59 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 60 60 this->value->Echo(); 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION MatrixParam::Id{{{ 1*/63 /*FUNCTION MatrixParam::Id{{{*/ 64 64 int MatrixParam::Id(void){ return -1; } 65 65 /*}}}*/ 66 /*FUNCTION MatrixParam::MyRank{{{ 1*/66 /*FUNCTION MatrixParam::MyRank{{{*/ 67 67 int MatrixParam::MyRank(void){ 68 68 extern int my_rank; … … 70 70 } 71 71 /*}}}*/ 72 /*FUNCTION MatrixParam::ObjectEnum{{{ 1*/72 /*FUNCTION MatrixParam::ObjectEnum{{{*/ 73 73 int MatrixParam::ObjectEnum(void){ 74 74 … … 77 77 } 78 78 /*}}}*/ 79 /*FUNCTION MatrixParam::copy{{{ 1*/79 /*FUNCTION MatrixParam::copy{{{*/ 80 80 Object* MatrixParam::copy() { 81 81 … … 86 86 87 87 /*MatrixParam virtual functions definitions: */ 88 /*FUNCTION MatrixParam::GetParameterValue{{{ 1*/88 /*FUNCTION MatrixParam::GetParameterValue{{{*/ 89 89 void MatrixParam::GetParameterValue(Matrix** poutput){ 90 90 Matrix* output=NULL; … … 96 96 } 97 97 /*}}}*/ 98 /*FUNCTION MatrixParam::GetParameterName{{{ 1*/98 /*FUNCTION MatrixParam::GetParameterName{{{*/ 99 99 void MatrixParam::GetParameterName(char**pname){ 100 100 EnumToStringx(pname,this->enum_type); 101 101 } 102 102 /*}}}*/ 103 /*FUNCTION MatrixParam::SetValue{{{ 1*/103 /*FUNCTION MatrixParam::SetValue{{{*/ 104 104 void MatrixParam::SetValue(Matrix* matrix){ 105 105 … … 111 111 } 112 112 /*}}}*/ 113 /*FUNCTION MatrixParam::UnitConversion{{{ 1*/113 /*FUNCTION MatrixParam::UnitConversion{{{*/ 114 114 void MatrixParam::UnitConversion(int direction_enum){ 115 115 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/MatrixParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*MatrixParam constructors, destructors: {{{ 1*/30 /*MatrixParam constructors, destructors: {{{*/ 31 31 MatrixParam(); 32 32 MatrixParam(int enum_type,Matrix* value); 33 33 ~MatrixParam(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{ */ 36 36 void Echo(); 37 37 void DeepEcho(); … … 41 41 Object* copy(); 42 42 /*}}}*/ 43 /*Param vritual function definitions: {{{ 1*/43 /*Param vritual function definitions: {{{*/ 44 44 int InstanceEnum(){return enum_type;} 45 void GetParameterValue(bool* pbool){_error _("Matrix param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(int* pinteger){_error _("Matrix param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int** pintarray,int* pM){_error _("Matrix param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("Matrix param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue( double* pdouble){_error_("Matrix param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(char** pstring){_error _("Matrix param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char*** pstringarray,int* pM){_error _("Matrix param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM){_error_("Matrix param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("Matrix param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("Matrix param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Vector** pvec){_error _("Matrix param of enum %i (%s) cannot return a vec",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(bool* pbool){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 46 void GetParameterValue(int* pinteger){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 47 void GetParameterValue(int** pintarray,int* pM){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 49 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 50 void GetParameterValue(char** pstring){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 51 void GetParameterValue(char*** pstringarray,int* pM){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 55 void GetParameterValue(Vector** pvec){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a vec");} 56 56 void GetParameterValue(Matrix** poutput); 57 void GetParameterValue(FILE** pfid){_error _("Matrix param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(FILE** pfid){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 58 58 59 void SetValue(bool boolean){_error _("Matrix param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}60 void SetValue(int integer){_error _("Matrix param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}61 void SetValue( double scalar){_error_("Matrix param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}62 void SetValue(char* string){_error _("Matrix param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}63 void SetValue(char** stringarray,int M){_error _("Matrix param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* doublearray,int M){_error_("Matrix param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* pdoublearray,int M,int N){_error_("Matrix param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* intarray,int M){_error _("Matrix param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}67 void SetValue(int* pintarray,int M,int N){_error _("Matrix param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}68 void SetValue(Vector* vec){_error _("Matrix param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}59 void SetValue(bool boolean){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 60 void SetValue(int integer){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 61 void SetValue(IssmDouble scalar){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 62 void SetValue(char* string){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 63 void SetValue(char** stringarray,int M){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 64 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 65 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 66 void SetValue(int* intarray,int M){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 67 void SetValue(int* pintarray,int M,int N){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 68 void SetValue(Vector* vec){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 69 69 void SetValue(Matrix* mat); 70 void SetValue(FILE* fid){_error _("Matrix param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}71 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("Matrix param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}70 void SetValue(FILE* fid){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Matrix param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 72 72 void UnitConversion(int direction_enum); 73 73 -
issm/trunk/src/c/objects/Params/Param.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 12 12 #ifdef HAVE_CONFIG_H … … 31 31 virtual void GetParameterValue(int** pintarray,int* pM)=0; 32 32 virtual void GetParameterValue(int** pintarray,int* pM,int* pN)=0; 33 virtual void GetParameterValue( double* pdouble)=0;33 virtual void GetParameterValue(IssmDouble* pIssmDouble)=0; 34 34 virtual void GetParameterValue(char** pstring)=0; 35 35 virtual void GetParameterValue(char*** pstringarray,int* pM)=0; 36 virtual void GetParameterValue( double** pdoublearray,int* pM)=0;37 virtual void GetParameterValue( double** pdoublearray,int* pM,int* pN)=0;38 virtual void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims)=0;36 virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM)=0; 37 virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN)=0; 38 virtual void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims)=0; 39 39 virtual void GetParameterValue(Vector** pvec)=0; 40 40 virtual void GetParameterValue(Matrix** pmat)=0; … … 43 43 virtual void SetValue(bool boolean)=0; 44 44 virtual void SetValue(int integer)=0; 45 virtual void SetValue( double scalar)=0;45 virtual void SetValue(IssmDouble scalar)=0; 46 46 virtual void SetValue(char* string)=0; 47 47 virtual void SetValue(char** stringarray,int M)=0; 48 virtual void SetValue( double* doublearray,int M)=0;49 virtual void SetValue( double* pdoublearray,int M,int N)=0;48 virtual void SetValue(IssmDouble* IssmDoublearray,int M)=0; 49 virtual void SetValue(IssmDouble* pIssmDoublearray,int M,int N)=0; 50 50 virtual void SetValue(int* intarray,int M)=0; 51 51 virtual void SetValue(int* pintarray,int M,int N)=0; … … 53 53 virtual void SetValue(Matrix* mat)=0; 54 54 virtual void SetValue(FILE* fid)=0; 55 virtual void SetValue( double** array, int M, int* mdim_array, int* ndim_array)=0;55 virtual void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array)=0; 56 56 virtual void UnitConversion(int direction_enum)=0; 57 57 virtual void GetParameterName(char**pname)=0; -
issm/trunk/src/c/objects/Params/StringArrayParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*StringArrayParam constructors and destructor*/ 23 /*FUNCTION StringArrayParam::StringArrayParam(){{{ 1*/23 /*FUNCTION StringArrayParam::StringArrayParam(){{{*/ 24 24 StringArrayParam::StringArrayParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION StringArrayParam::StringArrayParam(int enum_type,char** in_values,int in_numstrings){{{ 1*/28 /*FUNCTION StringArrayParam::StringArrayParam(int enum_type,char** in_values,int in_numstrings){{{*/ 29 29 StringArrayParam::StringArrayParam(int in_enum_type,char** in_values, int in_numstrings){ 30 30 … … 36 36 37 37 if(numstrings){ 38 value= (char**)xmalloc(numstrings*sizeof(char*));38 value=xNew<char*>(numstrings); 39 39 for(i=0;i<numstrings;i++){ 40 40 char* string=NULL; 41 41 size=strlen(in_values[i])+1; 42 string= (char*)xmalloc(size*sizeof(char));43 memcpy(string,in_values[i],size*sizeof(char));42 string=xNew<char>(size); 43 xMemCpy<char>(string,in_values[i],size); 44 44 value[i]=string; 45 45 } … … 49 49 } 50 50 /*}}}*/ 51 /*FUNCTION StringArrayParam::~StringArrayParam(){{{ 1*/51 /*FUNCTION StringArrayParam::~StringArrayParam(){{{*/ 52 52 StringArrayParam::~StringArrayParam(){ 53 53 … … 57 57 for(i=0;i<this->numstrings;i++){ 58 58 string=value[i]; 59 x free((void**)&string);59 xDelete<char>(string); 60 60 } 61 x free((void**)&value);61 xDelete<char*>(value); 62 62 } 63 63 /*}}}*/ 64 64 65 65 /*Object virtual functions definitions:*/ 66 /*FUNCTION StringArrayParam::Echo {{{ 1*/66 /*FUNCTION StringArrayParam::Echo {{{*/ 67 67 void StringArrayParam::Echo(void){ 68 68 this->DeepEcho(); 69 69 } 70 70 /*}}}*/ 71 /*FUNCTION StringArrayParam::DeepEcho{{{ 1*/71 /*FUNCTION StringArrayParam::DeepEcho{{{*/ 72 72 void StringArrayParam::DeepEcho(void){ 73 73 … … 75 75 char* string=NULL; 76 76 77 printf("StringArrayParam:\n");78 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));77 _printLine_("StringArrayParam:"); 78 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 79 79 for(i=0;i<this->numstrings;i++){ 80 80 string=this->value[i]; 81 printf(" %i: %s\n",i,string);81 _printLine_(" " << i << ": " << string); 82 82 } 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION StringArrayParam::Id{{{ 1*/85 /*FUNCTION StringArrayParam::Id{{{*/ 86 86 int StringArrayParam::Id(void){ return -1; } 87 87 /*}}}*/ 88 /*FUNCTION StringArrayParam::MyRank{{{ 1*/88 /*FUNCTION StringArrayParam::MyRank{{{*/ 89 89 int StringArrayParam::MyRank(void){ 90 90 extern int my_rank; … … 92 92 } 93 93 /*}}}*/ 94 /*FUNCTION StringArrayParam::ObjectEnum{{{ 1*/94 /*FUNCTION StringArrayParam::ObjectEnum{{{*/ 95 95 int StringArrayParam::ObjectEnum(void){ 96 96 … … 99 99 } 100 100 /*}}}*/ 101 /*FUNCTION StringArrayParam::copy{{{ 1*/101 /*FUNCTION StringArrayParam::copy{{{*/ 102 102 Object* StringArrayParam::copy() { 103 103 … … 108 108 109 109 /*StringArrayParam virtual functions definitions: */ 110 /*FUNCTION StringArrayParam::GetParameterValue{{{ 1*/110 /*FUNCTION StringArrayParam::GetParameterValue{{{*/ 111 111 void StringArrayParam::GetParameterValue(char*** pstringarray,int* pM){ 112 112 … … 120 120 M=this->numstrings; 121 121 if(this->numstrings){ 122 outstrings= (char**)xmalloc(this->numstrings*sizeof(char*));122 outstrings=xNew<char*>(this->numstrings); 123 123 124 124 for(i=0;i<this->numstrings;i++){ … … 126 126 stringsize=strlen(string)+1; 127 127 128 string2= (char*)xmalloc(stringsize*sizeof(char));129 memcpy(string2,string,stringsize*sizeof(char));128 string2=xNew<char>(stringsize); 129 xMemCpy<char>(string2,string,stringsize); 130 130 131 131 outstrings[i]=string2; … … 139 139 } 140 140 /*}}}*/ 141 /*FUNCTION StringArrayParam::GetParameterName{{{ 1*/141 /*FUNCTION StringArrayParam::GetParameterName{{{*/ 142 142 void StringArrayParam::GetParameterName(char**pname){ 143 143 EnumToStringx(pname,this->enum_type); 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION StringArrayParam::SetValue{{{ 1*/146 /*FUNCTION StringArrayParam::SetValue{{{*/ 147 147 void StringArrayParam::SetValue(char** stringarray,int M){ 148 148 … … 155 155 for(i=0;i<this->numstrings;i++){ 156 156 string=this->value[i]; 157 x free((void**)&string);157 xDelete<char>(string); 158 158 } 159 x free((void**)&this->value);159 xDelete<char*>(this->value); 160 160 161 161 /*copy: */ 162 162 this->numstrings=M; 163 this->value= (char**)xmalloc(this->numstrings*sizeof(char*));163 this->value=xNew<char*>(this->numstrings); 164 164 for(i=0;i<this->numstrings;i++){ 165 165 string=stringarray[i]; 166 166 stringsize=strlen(string)+1; 167 167 168 string2= (char*)xmalloc(stringsize*sizeof(char));169 memcpy(string2,string,stringsize*sizeof(char));168 string2=xNew<char>(stringsize); 169 xMemCpy<char>(string2,string,stringsize); 170 170 171 171 this->value[i]=string2; … … 173 173 } 174 174 /*}}}*/ 175 /*FUNCTION StringArrayParam::UnitConversion{{{ 1*/175 /*FUNCTION StringArrayParam::UnitConversion{{{*/ 176 176 void StringArrayParam::UnitConversion(int direction_enum){ 177 177 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/StringArrayParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 30 30 31 31 public: 32 /*StringArrayParam constructors, destructors: {{{ 1*/32 /*StringArrayParam constructors, destructors: {{{*/ 33 33 StringArrayParam(); 34 34 StringArrayParam(int enum_type,char** values, int numstrings); 35 35 ~StringArrayParam(); 36 36 /*}}}*/ 37 /*Object virtual functions definitions:{{{ 1*/37 /*Object virtual functions definitions:{{{ */ 38 38 void Echo(); 39 39 void DeepEcho(); … … 43 43 Object* copy(); 44 44 /*}}}*/ 45 /*Param vritual function definitions: {{{ 1*/45 /*Param vritual function definitions: {{{*/ 46 46 int InstanceEnum(){return enum_type;} 47 void GetParameterValue(bool* pbool){_error _("StringArray param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int* pinteger){_error _("StringArray param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue(int** pintarray,int* pM){_error _("StringArray param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("StringArray param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue( double* pdouble){_error_("StringArray param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue(char** pstring){_error _("StringArray param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(bool* pbool){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 48 void GetParameterValue(int* pinteger){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 49 void GetParameterValue(int** pintarray,int* pM){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 50 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 51 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 52 void GetParameterValue(char** pstring){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 53 53 void GetParameterValue(char*** pstringarray,int* pM); 54 void GetParameterValue( double** pdoublearray,int* pM){_error_("StringArray param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("StringArray param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("Vec param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(Vector** pvec){_error _("StringArray param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}58 void GetParameterValue(Matrix** pmat){_error _("StringArray param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}59 void GetParameterValue(FILE** pfid){_error _("StringArray param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 55 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 56 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Vec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 57 void GetParameterValue(Vector** pvec){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 58 void GetParameterValue(Matrix** pmat){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 59 void GetParameterValue(FILE** pfid){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 60 60 61 void SetValue(bool boolean){_error _("StringArray param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}62 void SetValue(int integer){_error _("StringArray param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}63 void SetValue( double scalar){_error_("StringArray param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}64 void SetValue(char* string){_error _("StringArray param of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}61 void SetValue(bool boolean){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 62 void SetValue(int integer){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 63 void SetValue(IssmDouble scalar){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 64 void SetValue(char* string){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 65 65 void SetValue(char** stringarray,int M); 66 void SetValue( double* doublearray,int M){_error_("StringArray param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}67 void SetValue( double* pdoublearray,int M,int N){_error_("StringArray param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}68 void SetValue(int* intarray,int M){_error _("StringArray param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}69 void SetValue(int* pintarray,int M,int N){_error _("StringArray param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}70 void SetValue(Vector* vec){_error _("StringArray param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}71 void SetValue(Matrix* mat){_error _("StringArray param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}72 void SetValue(FILE* fid){_error _("StringArray param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}73 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("StringArray param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}66 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 67 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 68 void SetValue(int* intarray,int M){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 69 void SetValue(int* pintarray,int M,int N){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 70 void SetValue(Vector* vec){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 71 void SetValue(Matrix* mat){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 72 void SetValue(FILE* fid){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 73 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("StringArray param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 74 74 void UnitConversion(int direction_enum); 75 75 -
issm/trunk/src/c/objects/Params/StringParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*StringParam constructors and destructor*/ 23 /*FUNCTION StringParam::StringParam(){{{ 1*/23 /*FUNCTION StringParam::StringParam(){{{*/ 24 24 StringParam::StringParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION StringParam::StringParam(int enum_type,IssmString value){{{ 1*/28 /*FUNCTION StringParam::StringParam(int enum_type,IssmString value){{{*/ 29 29 StringParam::StringParam(int in_enum_type,char* in_value){ 30 30 31 31 enum_type=in_enum_type; 32 value= (char*)xmalloc((strlen(in_value)+1)*sizeof(char));33 memcpy(value,in_value,(strlen(in_value)+1)*sizeof(char));32 value=xNew<char>(strlen(in_value)+1); 33 xMemCpy<char>(value,in_value,(strlen(in_value)+1)); 34 34 35 35 36 36 } 37 37 /*}}}*/ 38 /*FUNCTION StringParam::~StringParam(){{{ 1*/38 /*FUNCTION StringParam::~StringParam(){{{*/ 39 39 StringParam::~StringParam(){ 40 x free((void**)&value);40 xDelete<char>(value); 41 41 } 42 42 /*}}}*/ 43 43 44 44 /*Object virtual functions definitions:*/ 45 /*FUNCTION StringParam::Echo {{{ 1*/45 /*FUNCTION StringParam::Echo {{{*/ 46 46 void StringParam::Echo(void){ 47 47 this->DeepEcho(); 48 48 } 49 49 /*}}}*/ 50 /*FUNCTION StringParam::DeepEcho{{{ 1*/50 /*FUNCTION StringParam::DeepEcho{{{*/ 51 51 void StringParam::DeepEcho(void){ 52 printf("StringParam:\n");53 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));54 printf(" value: %s\n",this->value);52 _printLine_("StringParam:"); 53 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 54 _printLine_(" value: " << this->value); 55 55 } 56 56 /*}}}*/ 57 /*FUNCTION StringParam::Id{{{ 1*/57 /*FUNCTION StringParam::Id{{{*/ 58 58 int StringParam::Id(void){ return -1; } 59 59 /*}}}*/ 60 /*FUNCTION StringParam::MyRank{{{ 1*/60 /*FUNCTION StringParam::MyRank{{{*/ 61 61 int StringParam::MyRank(void){ 62 62 extern int my_rank; … … 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION StringParam::ObjectEnum{{{ 1*/66 /*FUNCTION StringParam::ObjectEnum{{{*/ 67 67 int StringParam::ObjectEnum(void){ 68 68 … … 71 71 } 72 72 /*}}}*/ 73 /*FUNCTION StringParam::copy{{{ 1*/73 /*FUNCTION StringParam::copy{{{*/ 74 74 Object* StringParam::copy() { 75 75 … … 80 80 81 81 /*StringParam virtual functions definitions: */ 82 /*FUNCTION StringParam::GetParameterValue{{{ 1*/82 /*FUNCTION StringParam::GetParameterValue{{{*/ 83 83 void StringParam::GetParameterValue(char** pstring){ 84 84 … … 88 88 stringsize=strlen(this->value)+1; 89 89 90 outstring= (char*)xmalloc(stringsize*sizeof(char));91 memcpy(outstring,this->value,stringsize*sizeof(char));90 outstring=xNew<char>(stringsize); 91 xMemCpy<char>(outstring,this->value,stringsize); 92 92 93 93 *pstring=outstring; … … 95 95 } 96 96 /*}}}*/ 97 /*FUNCTION StringParam::GetParameterName{{{ 1*/97 /*FUNCTION StringParam::GetParameterName{{{*/ 98 98 void StringParam::GetParameterName(char**pname){ 99 99 EnumToStringx(pname,this->enum_type); 100 100 } 101 101 /*}}}*/ 102 /*FUNCTION StringParam::SetValue{{{ 1*/102 /*FUNCTION StringParam::SetValue{{{*/ 103 103 void StringParam::SetValue(char* string){ 104 104 … … 106 106 107 107 /*avoid leak: */ 108 x free((void**)&this->value);108 xDelete<char>(this->value); 109 109 110 110 /*copy: */ 111 111 stringsize=strlen(string)+1; 112 this->value= (char*)xmalloc(stringsize*sizeof(char));113 memcpy(this->value,string,stringsize*sizeof(char));112 this->value=xNew<char>(stringsize); 113 xMemCpy<char>(this->value,string,stringsize); 114 114 115 115 } 116 116 /*}}}*/ 117 /*FUNCTION StringParam::UnitConversion{{{ 1*/117 /*FUNCTION StringParam::UnitConversion{{{*/ 118 118 void StringParam::UnitConversion(int direction_enum){ 119 119 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/StringParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*StringParam constructors, destructors: {{{ 1*/30 /*StringParam constructors, destructors: {{{*/ 31 31 StringParam(); 32 32 StringParam(int enum_type,char* value); 33 33 ~StringParam(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{ */ 36 36 void Echo(); 37 37 void DeepEcho(); … … 41 41 Object* copy(); 42 42 /*}}}*/ 43 /*Param vritual function definitions: {{{ 1*/43 /*Param vritual function definitions: {{{*/ 44 44 int InstanceEnum(){return enum_type;} 45 void GetParameterValue(bool* pbool){_error _("String param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(int* pinteger){_error _("String param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int** pintarray,int* pM){_error _("String param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("String param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue( double* pdouble){_error_("String param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(bool* pbool){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 46 void GetParameterValue(int* pinteger){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 47 void GetParameterValue(int** pintarray,int* pM){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 49 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 50 50 void GetParameterValue(char** pstring); 51 void GetParameterValue(char*** pstringarray,int* pM){_error _("String param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM){_error_("String param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("String param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("String param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Vector** pvec){_error _("String param of enum %i (%s) cannot return a Vec",enum_type,EnumToStringx(enum_type));}56 void GetParameterValue(Matrix** pmat){_error _("String param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(FILE** pfid){_error _("Bool param of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char*** pstringarray,int* pM){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 55 void GetParameterValue(Vector** pvec){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Vec");} 56 void GetParameterValue(Matrix** pmat){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 57 void GetParameterValue(FILE** pfid){_error2_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 58 58 59 void SetValue(bool boolean){_error _("String param of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}60 void SetValue(int integer){_error _("String param of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}61 void SetValue( double scalar){_error_("String param of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}59 void SetValue(bool boolean){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 60 void SetValue(int integer){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 61 void SetValue(IssmDouble scalar){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 62 62 void SetValue(char* string); 63 void SetValue(char** stringarray,int M){_error _("String param of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* doublearray,int M){_error_("String param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* pdoublearray,int M,int N){_error_("String param of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* intarray,int M){_error _("String param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}67 void SetValue(int* pintarray,int M,int N){_error _("String param of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}68 void SetValue(Vector* vec){_error _("String param of enum %i (%s) cannot hold a Vec",enum_type,EnumToStringx(enum_type));}69 void SetValue(Matrix* mat){_error _("String param of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}70 void SetValue(FILE* fid){_error _("String param of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}71 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("String param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}63 void SetValue(char** stringarray,int M){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 64 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 65 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 66 void SetValue(int* intarray,int M){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 67 void SetValue(int* pintarray,int M,int N){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 68 void SetValue(Vector* vec){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Vec");} 69 void SetValue(Matrix* mat){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 70 void SetValue(FILE* fid){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("String param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 72 72 void UnitConversion(int direction_enum); 73 73 -
issm/trunk/src/c/objects/Params/VectorParam.cpp
r12330 r12706 4 4 5 5 /*header files: */ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 21 21 22 22 /*VectorParam constructors and destructor*/ 23 /*FUNCTION VectorParam::VectorParam(){{{ 1*/23 /*FUNCTION VectorParam::VectorParam(){{{*/ 24 24 VectorParam::VectorParam(){ 25 25 return; 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{ 1*/28 /*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{*/ 29 29 VectorParam::VectorParam(int in_enum_type,Vector* in_value){ 30 30 … … 39 39 } 40 40 /*}}}*/ 41 /*FUNCTION VectorParam::~VectorParam(){{{ 1*/41 /*FUNCTION VectorParam::~VectorParam(){{{*/ 42 42 VectorParam::~VectorParam(){ 43 43 xdelete(&value); … … 46 46 47 47 /*Object virtual functions definitions:*/ 48 /*FUNCTION VectorParam::Echo {{{ 1*/48 /*FUNCTION VectorParam::Echo {{{*/ 49 49 void VectorParam::Echo(void){ 50 50 51 printf("VectorParam:\n");52 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));51 _printLine_("VectorParam:"); 52 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 53 53 54 54 } 55 55 /*}}}*/ 56 /*FUNCTION VectorParam::DeepEcho{{{ 1*/56 /*FUNCTION VectorParam::DeepEcho{{{*/ 57 57 void VectorParam::DeepEcho(void){ 58 58 59 59 int i; 60 printf("VectorParam:\n");61 printf(" enum: %i (%s)\n",this->enum_type,EnumToStringx(this->enum_type));60 _printLine_("VectorParam:"); 61 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); 62 62 value->Echo(); 63 63 } 64 64 /*}}}*/ 65 /*FUNCTION VectorParam::Id{{{ 1*/65 /*FUNCTION VectorParam::Id{{{*/ 66 66 int VectorParam::Id(void){ return -1; } 67 67 /*}}}*/ 68 /*FUNCTION VectorParam::MyRank{{{ 1*/68 /*FUNCTION VectorParam::MyRank{{{*/ 69 69 int VectorParam::MyRank(void){ 70 70 extern int my_rank; … … 72 72 } 73 73 /*}}}*/ 74 /*FUNCTION VectorParam::ObjectEnum{{{ 1*/74 /*FUNCTION VectorParam::ObjectEnum{{{*/ 75 75 int VectorParam::ObjectEnum(void){ 76 76 … … 79 79 } 80 80 /*}}}*/ 81 /*FUNCTION VectorParam::copy{{{ 1*/81 /*FUNCTION VectorParam::copy{{{*/ 82 82 Object* VectorParam::copy() { 83 83 … … 88 88 89 89 /*VectorParam virtual functions definitions: */ 90 /*FUNCTION VectorParam::GetParameterValue{{{ 1*/90 /*FUNCTION VectorParam::GetParameterValue{{{*/ 91 91 void VectorParam::GetParameterValue(Vector** poutput){ 92 92 Vector* output=NULL; … … 99 99 } 100 100 /*}}}*/ 101 /*FUNCTION VectorParam::GetParameterName{{{ 1*/101 /*FUNCTION VectorParam::GetParameterName{{{*/ 102 102 void VectorParam::GetParameterName(char**pname){ 103 103 EnumToStringx(pname,this->enum_type); 104 104 } 105 105 /*}}}*/ 106 /*FUNCTION VectorParam::SetValue{{{ 1*/106 /*FUNCTION VectorParam::SetValue{{{*/ 107 107 void VectorParam::SetValue(Vector* vector){ 108 108 … … 115 115 } 116 116 /*}}}*/ 117 /*FUNCTION VectorParam::UnitConversion{{{ 1*/117 /*FUNCTION VectorParam::UnitConversion{{{*/ 118 118 void VectorParam::UnitConversion(int direction_enum){ 119 119 /*do nothing, no unit conversion*/ -
issm/trunk/src/c/objects/Params/VectorParam.h
r12330 r12706 8 8 9 9 /*Headers:*/ 10 /*{{{ 1*/10 /*{{{*/ 11 11 #ifdef HAVE_CONFIG_H 12 12 #include <config.h> … … 28 28 29 29 public: 30 /*VectorParam constructors, destructors: {{{ 1*/30 /*VectorParam constructors, destructors: {{{*/ 31 31 VectorParam(); 32 32 VectorParam(int enum_type,Vector* value); 33 33 ~VectorParam(); 34 34 /*}}}*/ 35 /*Object virtual functions definitions:{{{ 1*/35 /*Object virtual functions definitions:{{{ */ 36 36 void Echo(); 37 37 void DeepEcho(); … … 41 41 Object* copy(); 42 42 /*}}}*/ 43 /*Param vritual function definitions: {{{ 1*/43 /*Param vritual function definitions: {{{*/ 44 44 int InstanceEnum(){return enum_type;} 45 void GetParameterValue(bool* pbool){_error _("Vector param of enum %i (%s) cannot return a bool",enum_type,EnumToStringx(enum_type));}46 void GetParameterValue(int* pinteger){_error _("Vector param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));}47 void GetParameterValue(int** pintarray,int* pM){_error _("Vector param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error _("Vector param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));}49 void GetParameterValue( double* pdouble){_error_("Vector param of enum %i (%s) cannot return a double",enum_type,EnumToStringx(enum_type));}50 void GetParameterValue(char** pstring){_error _("Vector param of enum %i (%s) cannot return a string",enum_type,EnumToStringx(enum_type));}51 void GetParameterValue(char*** pstringarray,int* pM){_error _("Vector param of enum %i (%s) cannot return a string array",enum_type,EnumToStringx(enum_type));}52 void GetParameterValue( double** pdoublearray,int* pM){_error_("Vector param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}53 void GetParameterValue( double** pdoublearray,int* pM, int* pN){_error_("Vector param of enum %i (%s) cannot return a double array",enum_type,EnumToStringx(enum_type));}54 void GetParameterValue( double*** parray, int* pM,int** pmdims, int** pndims){_error_("Vector param of enum %i (%s) cannot return a matrix array",enum_type,EnumToStringx(enum_type));}55 void GetParameterValue(Matrix** pmat){_error _("Vector param of enum %i (%s) cannot return a Mat",enum_type,EnumToStringx(enum_type));}45 void GetParameterValue(bool* pbool){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a bool");} 46 void GetParameterValue(int* pinteger){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");} 47 void GetParameterValue(int** pintarray,int* pM){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 48 void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers");} 49 void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble");} 50 void GetParameterValue(char** pstring){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string");} 51 void GetParameterValue(char*** pstringarray,int* pM){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a string array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 55 void GetParameterValue(Matrix** pmat){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a Mat");} 56 56 void GetParameterValue(Vector** poutput); 57 void GetParameterValue(FILE** pfid){_error _("Vector of enum %i (%s) cannot return a FILE",enum_type,EnumToStringx(enum_type));}57 void GetParameterValue(FILE** pfid){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} 58 58 59 void SetValue(bool boolean){_error _("Vector of enum %i (%s) cannot hold a boolean",enum_type,EnumToStringx(enum_type));}60 void SetValue(int integer){_error _("Vector of enum %i (%s) cannot hold an integer",enum_type,EnumToStringx(enum_type));}61 void SetValue( double scalar){_error_("Vector of enum %i (%s) cannot hold a scalar",enum_type,EnumToStringx(enum_type));}62 void SetValue(char* string){_error _("Vector of enum %i (%s) cannot hold a string",enum_type,EnumToStringx(enum_type));}63 void SetValue(char** stringarray,int M){_error _("Vector of enum %i (%s) cannot hold a string array",enum_type,EnumToStringx(enum_type));}64 void SetValue( double* doublearray,int M){_error_("Vector of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}65 void SetValue( double* pdoublearray,int M,int N){_error_("Vector of enum %i (%s) cannot hold a double array",enum_type,EnumToStringx(enum_type));}66 void SetValue(int* intarray,int M){_error _("Vector of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}67 void SetValue(int* pintarray,int M,int N){_error _("Vector of enum %i (%s) cannot hold a int array",enum_type,EnumToStringx(enum_type));}59 void SetValue(bool boolean){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} 60 void SetValue(int integer){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} 61 void SetValue(IssmDouble scalar){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} 62 void SetValue(char* string){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 63 void SetValue(char** stringarray,int M){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 64 void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 65 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 66 void SetValue(int* intarray,int M){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 67 void SetValue(int* pintarray,int M,int N){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} 68 68 void SetValue(Vector* vec); 69 void SetValue(Matrix* mat){_error _("Vector of enum %i (%s) cannot hold a Mat",enum_type,EnumToStringx(enum_type));}70 void SetValue(FILE* fid){_error _("Vector of enum %i (%s) cannot hold a FILE",enum_type,EnumToStringx(enum_type));}71 void SetValue( double** array, int M, int* mdim_array, int* ndim_array){_error_("Vector param of enum %i (%s) cannot hold an array of matrices",enum_type,EnumToStringx(enum_type));}69 void SetValue(Matrix* mat){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} 70 void SetValue(FILE* fid){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Vector param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 72 72 void UnitConversion(int direction_enum); 73 73 -
issm/trunk/src/c/objects/Patch.cpp
r12330 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 22 22 23 23 /*Object constructors and destructors:*/ 24 /*FUNCTION Patch::Patch() default constructor {{{ 1*/24 /*FUNCTION Patch::Patch() default constructor {{{*/ 25 25 Patch::Patch(){ 26 26 this->numrows=0; … … 31 31 } 32 32 /*}}}*/ 33 /*FUNCTION Patch::Patch(int numrows, int maxvertices, int maxnodes){{{ 1*/33 /*FUNCTION Patch::Patch(int numrows, int maxvertices, int maxnodes){{{*/ 34 34 Patch::Patch(int in_numrows, int in_maxvertices, int in_maxnodes){ 35 35 … … 52 52 } 53 53 else{ 54 this->values=(double*)xmalloc(this->numcols*this->numrows*sizeof(double));54 this->values=xNew<IssmDouble>(this->numcols*this->numrows); 55 55 for(i=0;i<this->numrows;i++){ 56 56 for(j=0;j<this->numcols;j++){ … … 62 62 } 63 63 /*}}}*/ 64 /*FUNCTION Patch::~Patch(){{{ 1*/64 /*FUNCTION Patch::~Patch(){{{*/ 65 65 Patch::~Patch(){ 66 x free((void**)&values);66 xDelete<IssmDouble>(values); 67 67 } 68 68 /*}}}*/ 69 69 70 70 /*Object methods*/ 71 /*FUNCTION Patch::fillelementinfo{{{ 1*/71 /*FUNCTION Patch::fillelementinfo{{{*/ 72 72 void Patch::fillelementinfo(int count, int element_id, int* vertices_ids, int num_vertices){ 73 73 74 74 int i; 75 double* row=NULL;75 IssmDouble* row=NULL; 76 76 77 77 /*point to the start of the row: */ … … 88 88 } 89 89 /*}}}*/ 90 /*FUNCTION Patch::fillresultinfo{{{ 1*/91 void Patch::fillresultinfo(int count,int enum_type,int step, double time, int interpolation, double* nodal_values, int num_nodes){90 /*FUNCTION Patch::fillresultinfo{{{*/ 91 void Patch::fillresultinfo(int count,int enum_type,int step, IssmDouble time, int interpolation, IssmDouble* nodal_values, int num_nodes){ 92 92 93 93 int i; 94 double* row=NULL;94 IssmDouble* row=NULL; 95 95 96 96 /*point to the start of the row: */ … … 101 101 */ 102 102 row[0]=enum_type; 103 row[1]=( double)step;103 row[1]=(IssmDouble)step; 104 104 row[2]=time; 105 105 row[4]=interpolation; … … 110 110 } 111 111 /*}}}*/ 112 /*FUNCTION Patch::Gather{{{ 1*/112 /*FUNCTION Patch::Gather{{{*/ 113 113 void Patch::Gather(void){ 114 114 … … 119 119 int total_numrows; 120 120 int node_numrows; 121 double *total_values = NULL;121 IssmDouble *total_values = NULL; 122 122 #ifdef _HAVE_MPI_ 123 123 MPI_Status status; … … 136 136 137 137 /*Now, allocate buffer to holds all the values, on node 0: */ 138 if(my_rank==0)total_values= (double*)xmalloc(this->numcols*total_numrows*sizeof(double));138 if(my_rank==0)total_values=xNew<IssmDouble>(this->numcols*total_numrows); 139 139 140 140 /*Start by copying node 0 values onto total_values: */ 141 141 if(my_rank==0){ 142 142 count=0; 143 memcpy(total_values+count,this->values,this->numcols*this->numrows*sizeof(double));143 xMemCpy<IssmDouble>(total_values+count,this->values,this->numcols*this->numrows); 144 144 count+=this->numrows*this->numcols; 145 145 } … … 164 164 if(my_rank==0){ 165 165 this->numrows=total_numrows; 166 x free((void**)&this->values);166 xDelete<IssmDouble>(this->values); 167 167 this->values=total_values; 168 168 } … … 170 170 else{ 171 171 this->numrows=0; 172 x free((void**)&this->values);172 xDelete<IssmDouble>(this->values); 173 173 } 174 174 #endif -
issm/trunk/src/c/objects/Segment.cpp
r12330 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 20 20 21 21 /*Segment constructors and destructors:*/ 22 /*FUNCTION Segment::Segment() default constructor {{{ 1*/22 /*FUNCTION Segment::Segment() default constructor {{{*/ 23 23 Segment::Segment(){ 24 24 this->eid=UNDEF; … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION Segment::Segment(int eid, double x1,double y1,double x2, double y2){{{1*/32 Segment::Segment(int segment_eid, double segment_x1,double segment_y1,double segment_x2, double segment_y2){31 /*FUNCTION Segment::Segment(int eid, IssmDouble x1,IssmDouble y1,IssmDouble x2, IssmDouble y2){{{*/ 32 Segment::Segment(int segment_eid, IssmDouble segment_x1,IssmDouble segment_y1,IssmDouble segment_x2, IssmDouble segment_y2){ 33 33 34 34 this->eid=segment_eid; … … 40 40 } 41 41 /*}}}*/ 42 /*FUNCTION Segment::~Segment(){{{ 1*/42 /*FUNCTION Segment::~Segment(){{{*/ 43 43 Segment::~Segment(){ 44 44 } … … 46 46 47 47 /*Object virtual functions definitions:*/ 48 /*FUNCTION Segment::Echo{{{ 1*/48 /*FUNCTION Segment::Echo{{{*/ 49 49 void Segment::Echo(void){ 50 50 51 printf("Segment:\n");52 printf(" eid: %i\n",eid);53 printf(" node 1: %g|%g\n",this->x1,this->y1);54 printf(" node 2: %g|%g\n",this->x2,this->y2);51 _printLine_("Segment:"); 52 _printLine_(" eid: " << eid); 53 _printLine_(" node 1: " << this->x1 << "|" << this->y1); 54 _printLine_(" node 2: " << this->x2 << "|" << this->y2); 55 55 56 56 } 57 57 /*}}}*/ 58 /*FUNCTION Segment::DeepEcho{{{ 1*/58 /*FUNCTION Segment::DeepEcho{{{*/ 59 59 void Segment::DeepEcho(void){ 60 60 this->Echo(); 61 61 } 62 62 /*}}}*/ 63 /*FUNCTION Segment::Id{{{ 1*/63 /*FUNCTION Segment::Id{{{*/ 64 64 int Segment::Id(void){ return eid; } 65 65 /*}}}*/ 66 /*FUNCTION Segment::MyRank{{{ 1*/66 /*FUNCTION Segment::MyRank{{{*/ 67 67 int Segment::MyRank(void){ 68 68 extern int my_rank; … … 71 71 } 72 72 /*}}}*/ 73 /*FUNCTION Segment::ObjectEnum{{{ 1*/73 /*FUNCTION Segment::ObjectEnum{{{*/ 74 74 int Segment::ObjectEnum(void){ 75 75 … … 78 78 } 79 79 /*}}}*/ 80 /*FUNCTION Segment::copy {{{ 1*/80 /*FUNCTION Segment::copy {{{*/ 81 81 Object* Segment::copy() { 82 82 return new Segment(this->eid,this->x1,this->y1,this->x2,this->y2); -
issm/trunk/src/c/objects/Segment.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Object.h" 11 11 /*}}}*/ … … 20 20 IssmDouble y2; 21 21 22 /*Segment constructors, destructors {{{ 1*/22 /*Segment constructors, destructors {{{*/ 23 23 Segment(); 24 24 Segment(int eid,IssmDouble x1,IssmDouble y1, IssmDouble x2, IssmDouble y2); 25 25 ~Segment(); 26 26 /*}}}*/ 27 /*Object virtual functions definitions:{{{ 1*/27 /*Object virtual functions definitions:{{{ */ 28 28 void Echo(); 29 29 void DeepEcho(); -
issm/trunk/src/c/objects/Update.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "../shared/shared.h" 11 11 /*}}}*/ -
issm/trunk/src/c/objects/Vertex.cpp
r12330 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 18 18 19 19 /*Vertex constructors and destructor:*/ 20 /*FUNCTION Vertex::Vertex() {{{ 1*/20 /*FUNCTION Vertex::Vertex() {{{*/ 21 21 Vertex::Vertex(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION Vertex::Vertex(int vertex_id, double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){{{1*/26 Vertex::Vertex(int vertex_id, int vertex_sid, double vertex_x, double vertex_y, double vertex_z, double vertex_sigma,int vertex_connectivity){25 /*FUNCTION Vertex::Vertex(int vertex_id, IssmDouble vertex_x, IssmDouble vertex_y, IssmDouble vertex_z, IssmDouble vertex_sigma){{{*/ 26 Vertex::Vertex(int vertex_id, int vertex_sid,IssmDouble vertex_x, IssmDouble vertex_y, IssmDouble vertex_z, IssmDouble vertex_sigma,int vertex_connectivity){ 27 27 this->Init(vertex_id, vertex_sid,vertex_x, vertex_y, vertex_z, vertex_sigma,vertex_connectivity); 28 28 } 29 29 /*}}}*/ 30 /*FUNCTION Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel) {{{ 1*/30 /*FUNCTION Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel) {{{*/ 31 31 Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel){ 32 32 … … 38 38 } 39 39 /*}}}*/ 40 /*FUNCTION Vertex::~Vertex() {{{ 1*/40 /*FUNCTION Vertex::~Vertex() {{{*/ 41 41 Vertex::~Vertex(){ 42 42 return; 43 43 } 44 44 /*}}}*/ 45 /*FUNCTION Vertex::Init{{{ 1*/46 void Vertex::Init(int vertex_id, int vertex_sid, double vertex_x, double vertex_y, double vertex_z, double vertex_sigma,int vertex_connectivity){45 /*FUNCTION Vertex::Init{{{*/ 46 void Vertex::Init(int vertex_id, int vertex_sid,IssmDouble vertex_x, IssmDouble vertex_y, IssmDouble vertex_z, IssmDouble vertex_sigma,int vertex_connectivity){ 47 47 48 48 /*all the initialization has been done by the initializer, just fill in the id: */ … … 61 61 62 62 /*Object virtual functions definitions:*/ 63 /*FUNCTION Vertex::Echo{{{ 1*/63 /*FUNCTION Vertex::Echo{{{*/ 64 64 void Vertex::Echo(void){ 65 65 66 printf("Vertex:\n");67 printf(" id: %i\n",id);68 printf(" sid: %i\n",sid);69 printf(" x: %g\n",x);70 printf(" y: %g\n",y);71 printf(" z: %g\n",z);72 printf(" sigma: %g\n",sigma);73 printf(" connectivity: %i\n",connectivity);74 printf(" dof: %i\n",dof);75 printf(" clone: %i\n",clone);76 77 return; 78 } 79 /*}}}*/ 80 /*FUNCTION Vertex::DeepEcho{{{ 1*/66 _printLine_("Vertex:"); 67 _printLine_(" id: " << id); 68 _printLine_(" sid: " << sid); 69 _printLine_(" x: " << x); 70 _printLine_(" y: " << y); 71 _printLine_(" z: " << z); 72 _printLine_(" sigma: " << sigma); 73 _printLine_(" connectivity: " << connectivity); 74 _printLine_(" dof: " << dof); 75 _printLine_(" clone: " << clone); 76 77 return; 78 } 79 /*}}}*/ 80 /*FUNCTION Vertex::DeepEcho{{{*/ 81 81 void Vertex::DeepEcho(void){ 82 82 this->Echo(); 83 83 } 84 84 /*}}}*/ 85 /*FUNCTION Vertex::Id{{{ 1*/85 /*FUNCTION Vertex::Id{{{*/ 86 86 int Vertex::Id(void){ return id; } 87 87 /*}}}*/ 88 /*FUNCTION Vertex::MyRank {{{ 1*/88 /*FUNCTION Vertex::MyRank {{{*/ 89 89 int Vertex::MyRank(void){ 90 90 extern int my_rank; … … 92 92 } 93 93 /*}}}*/ 94 /*FUNCTION Vertex::ObjectEnum{{{ 1*/94 /*FUNCTION Vertex::ObjectEnum{{{*/ 95 95 int Vertex::ObjectEnum(void){ 96 96 … … 99 99 } 100 100 /*}}}*/ 101 /*FUNCTION Vertex::copy {{{ 1*/101 /*FUNCTION Vertex::copy {{{*/ 102 102 Object* Vertex::copy() { 103 103 … … 108 108 109 109 /* DofObject routines: */ 110 /*FUNCTION Vertex::DistributeDofs{{{ 1*/110 /*FUNCTION Vertex::DistributeDofs{{{*/ 111 111 void Vertex::DistributeDofs(int* pdofcount){ 112 112 … … 131 131 } 132 132 /*}}}*/ 133 /*FUNCTION Vertex::OffsetDofs{{{ 1*/133 /*FUNCTION Vertex::OffsetDofs{{{*/ 134 134 void Vertex::OffsetDofs(int dofcount){ 135 135 … … 146 146 } 147 147 /*}}}*/ 148 /*FUNCTION Vertex::ShowTrueDofs{{{ 1*/148 /*FUNCTION Vertex::ShowTrueDofs{{{*/ 149 149 void Vertex::ShowTrueDofs(int* truedofs){ 150 150 … … 160 160 } 161 161 /*}}}*/ 162 /*FUNCTION Vertex::UpdateCloneDofs{{{ 1*/162 /*FUNCTION Vertex::UpdateCloneDofs{{{*/ 163 163 void Vertex::UpdateCloneDofs(int* alltruedofs){ 164 164 … … 174 174 } 175 175 /*}}}*/ 176 /*FUNCTION Vertex::SetClone {{{ 1*/176 /*FUNCTION Vertex::SetClone {{{*/ 177 177 void Vertex::SetClone(int* minranks){ 178 178 … … 192 192 193 193 /*Vertex management: */ 194 /*FUNCTION Vertex::Connectivity{{{ 1*/194 /*FUNCTION Vertex::Connectivity{{{*/ 195 195 int Vertex::Connectivity(void){return connectivity;} 196 196 /*}}}*/ 197 /*FUNCTION Vertex::Sid{{{ 1*/197 /*FUNCTION Vertex::Sid{{{*/ 198 198 int Vertex::Sid(void){ return sid; } 199 199 /*}}}*/ 200 /*FUNCTION Vertex::UpdateVertexPosition {{{ 1*/201 void Vertex::UpdatePosition(Vector* vz,Parameters* parameters, double* thickness,double* bed){202 203 double oldz,newz;204 double dt,velz;200 /*FUNCTION Vertex::UpdateVertexPosition {{{*/ 201 void Vertex::UpdatePosition(Vector* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed){ 202 203 IssmDouble oldz,newz; 204 IssmDouble dt,velz; 205 205 206 206 /*Get time stepping*/ -
issm/trunk/src/c/objects/Vertex.h
r12330 r12706 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #include "./Object.h" 11 11 class IoModel; … … 35 35 int dof; //dof to recover values in a vertex indexed vector 36 36 37 /*Vertex constructors, destructors {{{ 1*/37 /*Vertex constructors, destructors {{{*/ 38 38 Vertex(); 39 39 Vertex(int id, int sid,IssmDouble x, IssmDouble y, IssmDouble z, IssmDouble sigma, int connectivity); … … 42 42 ~Vertex(); 43 43 /*}}}*/ 44 /*Object virtual functions definitions:{{{ 1*/44 /*Object virtual functions definitions:{{{ */ 45 45 void Echo(); 46 46 void DeepEcho(); … … 50 50 Object* copy(); 51 51 /*}}}*/ 52 /*DofObject routines {{{ 1*/52 /*DofObject routines {{{*/ 53 53 void DistributeDofs(int* pdofcount); 54 54 void OffsetDofs(int dofcount); … … 57 57 void SetClone(int* minranks); 58 58 /*}}}*/ 59 /*Vertex management: {{{ 1*/59 /*Vertex management: {{{*/ 60 60 int Sid(void); 61 61 int Connectivity(void); -
issm/trunk/src/c/python/include/python_macros.h
r12330 r12706 6 6 #define _PYTHON_MACROS_H_ 7 7 8 /*Header {{{ 1*/8 /*Header {{{*/ 9 9 10 10 #ifdef HAVE_CONFIG_H … … 16 16 17 17 #ifdef _HAVE_PYTHON_ 18 /* MODULEBOOT/MODULEEND {{{ 1*/18 /* MODULEBOOT/MODULEEND {{{*/ 19 19 20 20 /*The following macros hide the error exception handling in a matlab module. Just put … … 30 30 //}}} 31 31 #if _PYTHON_MAJOR_ >=3 32 /* WRAPPER 3.2 {{{ 1*/32 /* WRAPPER 3.2 {{{*/ 33 33 #define WRAPPER(modulename,...) \ 34 34 \ … … 57 57 /*}}}*/ 58 58 #else 59 /* WRAPPER 2.7 {{{ 1*/59 /* WRAPPER 2.7 {{{*/ 60 60 #define WRAPPER(modulename,...) \ 61 61 \ … … 75 75 /*}}}*/ 76 76 #endif 77 /* CHECKARGUMENTS {{{ 1*/77 /* CHECKARGUMENTS {{{*/ 78 78 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumPythonArguments(args, NRHS,functionpointer) 79 79 /*}}}*/ -
issm/trunk/src/c/python/io/CheckNumPythonArguments.cpp
r12330 r12706 27 27 if (size==0){ 28 28 function(); 29 _error _("usage: see above");29 _error2_("usage: see above"); 30 30 } 31 31 else if (size!=NRHS ) { 32 32 function(); 33 _error _("usage error.");33 _error2_("usage error."); 34 34 } 35 35 return 1; -
issm/trunk/src/c/python/io/FetchPythonData.cpp
r12330 r12706 17 17 18 18 /*Primitive data types*/ 19 /*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{ 1*/19 /*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{*/ 20 20 void FetchData(double* pscalar,PyObject* py_float){ 21 21 … … 29 29 } 30 30 /*}}}*/ 31 /*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{ 1*/31 /*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{*/ 32 32 void FetchData(int* pinteger, PyObject* py_long){ 33 33 … … 41 41 } 42 42 /*}}}*/ 43 /*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{ 1*/43 /*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{*/ 44 44 void FetchData(bool* pboolean,PyObject* py_boolean){ 45 45 … … 47 47 48 48 /*check this is indeed a subtype of long type: */ 49 if(!PyBool_Check(py_boolean))_error _("expecting a boolean in input!");49 if(!PyBool_Check(py_boolean))_error2_("expecting a boolean in input!"); 50 50 51 51 /*extract boolean: */ … … 57 57 } 58 58 /*}}}*/ 59 /*FUNCTION FetchData(double** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{ 1*/59 /*FUNCTION FetchData(double** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{*/ 60 60 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_matrix){ 61 61 … … 68 68 /*retrive dimensions: */ 69 69 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 70 if(ndim!=2)_error _("expecting an MxN matrix in input!");70 if(ndim!=2)_error2_("expecting an MxN matrix in input!"); 71 71 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 72 72 M=dims[0]; N=dims[1]; … … 81 81 } 82 82 /*}}}*/ 83 /*FUNCTION FetchData(double** pvector,int* pM, PyObject* py_vector){{{ 1*/83 /*FUNCTION FetchData(double** pvector,int* pM, PyObject* py_vector){{{*/ 84 84 void FetchData(double** pvector,int* pM,PyObject* py_vector){ 85 85 … … 92 92 /*retrive dimensions: */ 93 93 ndim=PyArray_NDIM((const PyArrayObject*)py_vector); 94 if(ndim!=1)_error _("expecting an Mx1 vector in input!");94 if(ndim!=1)_error2_("expecting an Mx1 vector in input!"); 95 95 dims=PyArray_DIMS((PyArrayObject*)py_vector); 96 96 M=dims[0]; … … 107 107 /*Python version dependent: */ 108 108 #if _PYTHON_MAJOR_ >= 3 109 /*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{ 1*/109 /*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{*/ 110 110 void FetchData(char** pstring,PyObject* py_unicode){ 111 111 … … 124 124 /*}}}*/ 125 125 #else 126 /*FUNCTION FetchData(char** pstring,PyObject* py_string){{{ 1*/126 /*FUNCTION FetchData(char** pstring,PyObject* py_string){{{*/ 127 127 void FetchData(char** pstring,PyObject* py_string){ 128 128 -
issm/trunk/src/c/python/io/WritePythonData.cpp
r12330 r12706 21 21 22 22 23 /*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{ 1*/23 /*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{*/ 24 24 void WriteData(PyObject* py_tuple, int index, char* string){ 25 25 26 26 PyTuple_SetItem(py_tuple, index, PyUnicode_FromString(string)); 27 27 28 } 29 /*}}}*/ 30 /*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{1*/ 28 }/*}}}*/ 29 /*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{*/ 31 30 void WriteData(PyObject* tuple,int index,Matrix* matrix){ 32 31 … … 45 44 46 45 47 } 48 /*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{ 1*/46 }/*}}}*/ 47 /*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{*/ 49 48 void WriteData(PyObject* tuple,int index,Vector* vector){ 50 49 … … 64 63 } 65 64 /*}}}*/ 66 /*FUNCTION WriteData(PyObject* py_tuple,int index, double* matrix, int M, int N){{{ 1*/65 /*FUNCTION WriteData(PyObject* py_tuple,int index, double* matrix, int M, int N){{{*/ 67 66 void WriteData(PyObject* tuple, int index, double* matrix, int M,int N){ 68 67 … … 76 75 PyTuple_SetItem(tuple, index, array); 77 76 78 } 77 }/*}}}*/ -
issm/trunk/src/c/shared/Alloc/alloc.cpp
r12330 r12706 31 31 void* memptr=NULL; 32 32 33 if(!size)_error _("attempting to 0 size allocation!");33 if(!size)_error2_("attempting to 0 size allocation!"); 34 34 35 35 /* Use the c library to do the allocation: */ 36 36 memptr=malloc(size); 37 if(!memptr) _error _("memory allocation failed!");37 if(!memptr) _error2_("memory allocation failed!"); 38 38 39 39 return memptr; … … 44 44 void* memptr=NULL; 45 45 46 if(!size)_error _("attempting to 0 size allocation!");46 if(!size)_error2_("attempting to 0 size allocation!"); 47 47 48 48 /* Use the c library to do the allocation: */ 49 49 memptr=calloc(n,size); 50 if(!memptr) _error _("memory allocation failed!");50 if(!memptr) _error2_("memory allocation failed!"); 51 51 52 52 return memptr; … … 84 84 } 85 85 86 87 86 void* xrealloc( void* pv, int size){ 88 87 89 88 register void* value=NULL; 90 89 91 if(!size)_error _("attempting to realloc to zero");90 if(!size)_error2_("attempting to realloc to zero"); 92 91 value = (void*)realloc(pv,size); 93 92 94 93 if (value == NULL) { 95 _error _("virtual memory exhausted");94 _error2_("virtual memory exhausted"); 96 95 } 97 96 return value; -
issm/trunk/src/c/shared/Alloc/xNewDelete.h
r12330 r12706 8 8 #include <cassert> 9 9 10 11 // memory management of types 12 // T with non-trivial constructors require 13 // C++ style memory management 14 #define USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES 15 // but for speed on may alternatively use C memory managment 16 // but can do so safely only for T that are at most 17 // plain old data structures (POD) 18 #ifndef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES 19 #include <cstdlib> 20 #endif 21 10 22 template <class T> 11 23 T* xNew(unsigned int size) { 24 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES 12 25 T* aT_p=new T[size]; 13 26 assert(aT_p); 14 27 return aT_p; 15 }; 28 #else 29 T* aT_p=(T*)malloc(size*sizeof(T)); 30 assert(aT_p); 31 return aT_p; 32 #endif 33 } 34 35 template <class T> 36 T* xNewZeroInit(unsigned int size) { 37 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES 38 T* aT_p=xNew<T>(size); 39 for (unsigned int i=0; i<size;++i) 40 aT_p[i]=(T)0; 41 return aT_p; 42 #else 43 T* aT_p=(T*)calloc(size,sizeof(T)); 44 assert(aT_p); 45 return aT_p; 46 #endif 47 } 16 48 17 49 template <class T> 18 50 void xDelete(T*& aT_p) { 19 51 if (aT_p) 52 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES 20 53 delete []aT_p; 54 #else 55 free((void*)aT_p); 56 #endif 21 57 aT_p=0; 22 }; 58 } 59 60 template <class T> 61 T* xReNew(T* old, unsigned int old_size, unsigned int size) { 62 #ifdef USE_CXX_MEMORY_MANAGMENT_FOR_NON_POD_TYPES 63 T* aT_p=0; 64 if (!old) { // no old memory 65 if (size) 66 aT_p=xNew<T>(size); // according to realloc behavior in manual page 67 } 68 else { // have old memory 69 if (!size) // but 0 size 70 xDelete<T>(old); // according to realloc behavior in manual page 71 else { // non-zero size 72 assert(old_size); // have old memory - need to have old_size set or this call is bad 73 // allocate new, delete old; ; even for the case when size is 74 // less than old_size we can't just keep the memory unchanged 75 // because otherwise classes that have ctors/dtors with side-effects 76 // may misbehave, for example classes with static instance/operations counters. 77 aT_p=xNew<T>(size); 78 unsigned int iMax=(old_size<size)?old_size:size; 79 for (unsigned int i=0; i<iMax;++i) { 80 // we need to copy the items by explicit assignments 81 aT_p[i]=old[i]; 82 } 83 xDelete<T>(old); 84 } 85 } 86 return aT_p; 87 #else 88 T* aT_p=0; 89 aT_p=(T*)realloc((void*)old,size*sizeof(T)); 90 if (size) 91 assert(aT_p); // according to realloc behavior in manual page 92 return aT_p; 93 #endif 94 } 23 95 24 96 #endif -
issm/trunk/src/c/shared/Elements/Arrhenius.cpp
r7848 r12706 6 6 #include <math.h> 7 7 8 double Arrhenius(double temperature,double depth,double n){8 IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n){ 9 9 /*Use EISMINT Parameterization for the rheology: Payne2000 10 10 * … … 25 25 26 26 /*Some physical constants (Payne2000)*/ 27 double beta=8.66*pow(10.,-4.);28 double R=8.314;27 IssmDouble beta=8.66*pow(10.,-4.); 28 IssmDouble R=8.314; 29 29 30 30 /*Intermediaries*/ 31 double A,B,Tstar;31 IssmDouble A,B,Tstar; 32 32 33 33 /*convert temperature to absolute temperature*/ -
issm/trunk/src/c/shared/Elements/CoordinateSystemTransform.cpp
r10532 r12706 5 5 #include <math.h> 6 6 7 void CoordinateSystemTransform( double** ptransform,Node** nodes,int numnodes,int* cs_array){7 void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array){ 8 8 9 9 int i,counter; 10 10 int numdofs = 0; 11 double norm;12 double *transform = NULL;13 double *values = NULL;14 double coord_system[3][3];11 IssmDouble norm; 12 IssmDouble *transform = NULL; 13 IssmDouble *values = NULL; 14 IssmDouble coord_system[3][3]; 15 15 16 16 /*Some checks in debugging mode*/ … … 22 22 case XYEnum: numdofs+=2; break; 23 23 case XYZPEnum: numdofs+=4; break; 24 default: _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));24 default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 25 25 } 26 26 } 27 27 28 28 /*Allocate and initialize transform matrix*/ 29 transform= (double*)xmalloc(numdofs*numdofs*sizeof(double));29 transform=xNew<IssmDouble>(numdofs*numdofs); 30 30 for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0; 31 31 … … 67 67 break; 68 68 default: 69 _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));69 _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 70 70 } 71 71 } -
issm/trunk/src/c/shared/Elements/GetGlobalDofList.cpp
r10116 r12706 14 14 15 15 /*Allocate:*/ 16 ndof_list= (int*)xmalloc(numnodes*sizeof(int));16 ndof_list=xNew<int>(numnodes); 17 17 18 18 /*First, figure out size of doflist: */ … … 25 25 if(numdof){ 26 26 /*Allocate: */ 27 doflist= (int*)xmalloc(numdof*sizeof(int));27 doflist=xNew<int>(numdof); 28 28 29 29 /*Populate: */ … … 37 37 } 38 38 /*Free ressources:*/ 39 x free((void**)&ndof_list);39 xDelete<int>(ndof_list); 40 40 41 41 return doflist; -
issm/trunk/src/c/shared/Elements/GetLocalDofList.cpp
r10104 r12706 13 13 if(numnodes){ 14 14 /*allocate: */ 15 ndof_list= (int*)xmalloc(numnodes*sizeof(int));16 ngdof_list_cumulative= (int*)xmalloc(numnodes*sizeof(int));15 ndof_list=xNew<int>(numnodes); 16 ngdof_list_cumulative=xNew<int>(numnodes); 17 17 18 18 … … 33 33 if(numdof){ 34 34 /*Allocate: */ 35 doflist= (int*)xmalloc(numdof*sizeof(int));35 doflist=xNew<int>(numdof); 36 36 37 37 /*Populate: */ … … 55 55 56 56 /*Free ressources:*/ 57 x free((void**)&ndof_list);58 x free((void**)&ngdof_list_cumulative);57 xDelete<int>(ndof_list); 58 xDelete<int>(ngdof_list_cumulative); 59 59 60 60 /*CLean-up and return*/ -
issm/trunk/src/c/shared/Elements/GetVerticesCoordinates.cpp
r11237 r12706 5 5 #include "./elements.h" 6 6 7 void GetVerticesCoordinates( double* xyz, Node** nodes, int numvertices){7 void GetVerticesCoordinates(IssmDouble* xyz, Node** nodes, int numvertices){ 8 8 9 9 /*In debugging mode, check that nodes is not a NULL pointer*/ -
issm/trunk/src/c/shared/Elements/Paterson.cpp
r6966 r12706 7 7 #include <math.h> 8 8 9 double Paterson(double temperature){ 9 #include "../../include/include.h" 10 11 IssmDouble Paterson(IssmDouble temperature){ 10 12 11 13 /*output: */ 12 double B;13 double T;14 IssmDouble B; 15 IssmDouble T; 14 16 15 17 /*Switch to celsius from Kelvin: */ … … 30 32 31 33 if(T<=-45.0){ 32 B=pow(( double)10,(double)8)*(-0.000292866376675*pow(T+50,3)+ 0.011672640664130*pow(T+50,2) -0.325004442485481*(T+50)+ 6.524779401948101);34 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+50,3)+ 0.011672640664130*pow(T+50,2) -0.325004442485481*(T+50)+ 6.524779401948101); 33 35 } 34 36 else if((T>=-45.0) && (T<=-40.0)){ 35 B=pow(( double)10,(double)8)*(-0.000292866376675*pow(T+45,3)+ 0.007279645014004*pow(T+45,2) -0.230243014094813*(T+45)+ 5.154964909039554);37 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+45,3)+ 0.007279645014004*pow(T+45,2) -0.230243014094813*(T+45)+ 5.154964909039554); 36 38 } 37 39 else if((T>=-40.0) && (T<=-35.0)){ 38 B=pow(( double)10,(double)8)*(0.000072737147457*pow(T+40,3)+ 0.002886649363879*pow(T+40,2) -0.179411542205399*(T+40)+ 4.149132666831214);40 B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000072737147457*pow(T+40,3)+ 0.002886649363879*pow(T+40,2) -0.179411542205399*(T+40)+ 4.149132666831214); 39 41 } 40 42 else if((T>=-35.0) && (T<=-30.0)){ 41 B=pow(( double)10,(double)8)*(-0.000086144770023*pow(T+35,3)+ 0.003977706575736*pow(T+35,2) -0.145089762507325*(T+35)+ 3.333333333333331);43 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000086144770023*pow(T+35,3)+ 0.003977706575736*pow(T+35,2) -0.145089762507325*(T+35)+ 3.333333333333331); 42 44 } 43 45 else if((T>=-30.0) && (T<=-25.0)){ 44 B=pow(( double)10,(double)8)*(-0.000043984685769*pow(T+30,3)+ 0.002685535025386*pow(T+30,2) -0.111773554501713*(T+30)+ 2.696559088937191);46 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000043984685769*pow(T+30,3)+ 0.002685535025386*pow(T+30,2) -0.111773554501713*(T+30)+ 2.696559088937191); 45 47 } 46 48 else if((T>=-25.0) && (T<=-20.0)){ 47 B=pow(( double)10,(double)8)*(-0.000029799523463*pow(T+25,3)+ 0.002025764738854*pow(T+25,2) -0.088217055680511*(T+25)+ 2.199331606342181);49 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000029799523463*pow(T+25,3)+ 0.002025764738854*pow(T+25,2) -0.088217055680511*(T+25)+ 2.199331606342181); 48 50 } 49 51 else if((T>=-20.0) && (T<=-15.0)){ 50 B=pow(( double)10,(double)8)*(0.000136920904777*pow(T+20,3)+ 0.001578771886910*pow(T+20,2) -0.070194372551690*(T+20)+ 1.805165505978111);52 B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000136920904777*pow(T+20,3)+ 0.001578771886910*pow(T+20,2) -0.070194372551690*(T+20)+ 1.805165505978111); 51 53 } 52 54 else if((T>=-15.0) && (T<=-10.0)){ 53 B=pow(( double)10,(double)8)*(-0.000899763781026*pow(T+15,3)+ 0.003632585458564*pow(T+15,2) -0.044137585824322*(T+15)+ 1.510778053489523);55 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000899763781026*pow(T+15,3)+ 0.003632585458564*pow(T+15,2) -0.044137585824322*(T+15)+ 1.510778053489523); 54 56 } 55 57 else if((T>=-10.0) && (T<=-5.0)){ 56 B=pow(( double)10,(double)8)*(0.001676964325070*pow(T+10,3)- 0.009863871256831*pow(T+10,2) -0.075294014815659*(T+10)+ 1.268434288203714);58 B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.001676964325070*pow(T+10,3)- 0.009863871256831*pow(T+10,2) -0.075294014815659*(T+10)+ 1.268434288203714); 57 59 } 58 60 else if((T>=-5.0) && (T<=-2.0)){ 59 B=pow(( double)10,(double)8)*(-0.003748937622487*pow(T+5,3)+0.015290593619213*pow(T+5,2) -0.048160403003748*(T+5)+ 0.854987973338348);61 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622487*pow(T+5,3)+0.015290593619213*pow(T+5,2) -0.048160403003748*(T+5)+ 0.854987973338348); 60 62 } 61 63 else if(T>=-2.0){ 62 B=pow(( double)10,(double)8)*(-0.003748937622488*pow(T+2,3)-0.018449844983174*pow(T+2,2) -0.057638157095631*(T+2)+ 0.746900791092860);64 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622488*pow(T+2,3)-0.018449844983174*pow(T+2,2) -0.057638157095631*(T+2)+ 0.746900791092860); 63 65 } 64 66 65 67 /*B cannot be negative!*/ 66 if(B<0) B=pow(( double)10,(double)6);68 if(B<0) B=pow((IssmPDouble)10,(IssmPDouble)6); 67 69 68 70 return B; -
issm/trunk/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp
r10529 r12706 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 23 23 int i,j; 24 24 int numdofs = 0; 25 double *transform = NULL;26 double *values = NULL;25 IssmDouble *transform = NULL; 26 IssmDouble *values = NULL; 27 27 28 28 /*Get total number of dofs*/ … … 31 31 case XYEnum: numdofs+=2; break; 32 32 case XYZPEnum: numdofs+=4; break; 33 default: _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));33 default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 34 34 } 35 35 } 36 36 37 37 /*Copy current stiffness matrix*/ 38 values= (double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));38 values=xNew<IssmDouble>(Ke->nrows*Ke->ncols); 39 39 for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j]; 40 40 … … 49 49 50 50 /*Free Matrix*/ 51 x free((void**)&transform);52 x free((void**)&values);51 xDelete<IssmDouble>(transform); 52 xDelete<IssmDouble>(values); 53 53 } -
issm/trunk/src/c/shared/Elements/TransformLoadVectorCoord.cpp
r10523 r12706 8 8 9 9 /*All nodes have the same Coordinate System*/ 10 cs_array= (int*)xmalloc(numnodes*sizeof(int));10 cs_array=xNew<int>(numnodes); 11 11 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 12 12 … … 15 15 16 16 /*Clean-up*/ 17 x free((void**)&cs_array);17 xDelete<int>(cs_array); 18 18 } 19 19 … … 22 22 int i,j; 23 23 int numdofs = 0; 24 double *transform = NULL;25 double *values = NULL;24 IssmDouble *transform = NULL; 25 IssmDouble *values = NULL; 26 26 27 27 /*Get total number of dofs*/ … … 30 30 case XYEnum: numdofs+=2; break; 31 31 case XYZPEnum: numdofs+=4; break; 32 default: _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));32 default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 33 33 } 34 34 } 35 35 36 36 /*Copy current load vector*/ 37 values= (double*)xmalloc(pe->nrows*sizeof(double));37 values=xNew<IssmDouble>(pe->nrows); 38 38 for(i=0;i<pe->nrows;i++) values[i]=pe->values[i]; 39 39 … … 46 46 &pe->values[0],0); 47 47 48 /*Free Matri x*/49 x free((void**)&transform);50 x free((void**)&values);48 /*Free Matrices*/ 49 xDelete<IssmDouble>(transform); 50 xDelete<IssmDouble>(values); 51 51 } -
issm/trunk/src/c/shared/Elements/TransformSolutionCoord.cpp
r10523 r12706 4 4 #include "./elements.h" 5 5 6 void TransformSolutionCoord( double* solution,Node** nodes,int numnodes,int cs_enum){6 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum){ 7 7 8 8 int* cs_array=NULL; 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 21 void TransformSolutionCoord( double* solution,Node** nodes,int numnodes,int* cs_array){21 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array){ 22 22 23 23 int i,j; 24 24 int numdofs = 0; 25 double *transform = NULL;26 double *values = NULL;25 IssmDouble *transform = NULL; 26 IssmDouble *values = NULL; 27 27 28 28 /*Get total number of dofs*/ … … 31 31 case XYEnum: numdofs+=2; break; 32 32 case XYZPEnum: numdofs+=4; break; 33 default: _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));33 default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 34 34 } 35 35 } 36 36 37 37 /*Copy current solution vector*/ 38 values= (double*)xmalloc(numdofs*sizeof(double));38 values=xNew<IssmDouble>(numdofs); 39 39 for(i=0;i<numdofs;i++) values[i]=solution[i]; 40 40 … … 47 47 &solution[0],0); 48 48 49 /*Free Matri x*/50 x free((void**)&transform);51 x free((void**)&values);49 /*Free Matrices*/ 50 xDelete<IssmDouble>(transform); 51 xDelete<IssmDouble>(values); 52 52 } -
issm/trunk/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp
r10523 r12706 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 23 23 int i,j; 24 24 int numdofs = 0; 25 double *transform = NULL;26 double *values = NULL;25 IssmDouble *transform = NULL; 26 IssmDouble *values = NULL; 27 27 28 28 /*Get total number of dofs*/ … … 31 31 case XYEnum: numdofs+=2; break; 32 32 case XYZPEnum: numdofs+=4; break; 33 default: _error _("Coordinate system %s not supported yet",EnumToStringx(cs_array[i]));33 default: _error2_("Coordinate system " << EnumToStringx(cs_array[i]) << " not supported yet"); 34 34 } 35 35 } 36 36 37 37 /*Copy current stiffness matrix*/ 38 values= (double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));38 values=xNew<IssmDouble>(Ke->nrows*Ke->ncols); 39 39 for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j]; 40 40 … … 49 49 50 50 /*Free Matrix*/ 51 x free((void**)&transform);52 x free((void**)&values);51 xDelete<IssmDouble>(transform); 52 xDelete<IssmDouble>(values); 53 53 } -
issm/trunk/src/c/shared/Elements/elements.h
r12641 r12706 11 11 class ElementVector; 12 12 13 <<<<<<< .working 13 14 double Paterson(double temperature); 14 15 double Arrhenius(double temperature,double depth,double n); 15 16 double PddSurfaceMassBlance(double* monthlytemperatures, double* monthlyprec, double* pdds, double* pds, double signorm, double yts, double h, double s, double rho_ice, double rho_water); 16 17 void GetVerticesCoordinates(double* xyz, Node** nodes, int numvertices); 18 ======= 19 IssmDouble Paterson(IssmDouble temperature); 20 IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n); 21 void GetVerticesCoordinates(IssmDouble* xyz, Node** nodes, int numvertices); 22 >>>>>>> .merge-right.r12703 17 23 int GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum); 18 24 int* GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum); 19 25 int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation_enum); 20 26 #ifdef _HAVE_DIAGNOSTIC_ 21 void CoordinateSystemTransform( double** ptransform,Node** nodes,int numnodes,int* cs_array);27 void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array); 22 28 void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int cs_enum); 23 29 void TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes,int numnodes,int* cs_array); … … 26 32 void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int cs_enum); 27 33 void TransformLoadVectorCoord(ElementVector* pe,Node** nodes,int numnodes,int* cs_array); 28 void TransformSolutionCoord( double* solution,Node** nodes,int numnodes,int cs_enum);29 void TransformSolutionCoord( double* solution,Node** nodes,int numnodes,int* cs_array);34 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int cs_enum); 35 void TransformSolutionCoord(IssmDouble* solution,Node** nodes,int numnodes,int* cs_array); 30 36 #endif 31 37 32 inline void printarray( double* array,int lines,int cols=1){33 printf("\n");38 inline void printarray(IssmPDouble* array,int lines,int cols=1){ 39 _printLine_(""); 34 40 for(int i=0;i<lines;i++){ 35 printf(" [ ");36 for(int j=0;j<cols;j++) printf(" %12.7g ",array[i*cols+j]);37 printf(" ]\n");41 _printString_(" [ "); 42 for(int j=0;j<cols;j++) _printString_( " " << setw(11) << setprecision (5) << array[i*cols+j]); 43 _printLine_(" ]"); 38 44 } 39 printf("\n");45 _printLine_(""); 40 46 } 41 47 inline void printarray(int* array,int lines,int cols=1){ 42 printf("\n");48 _printLine_(""); 43 49 for(int i=0;i<lines;i++){ 44 printf(" [ ");45 for(int j=0;j<cols;j++) printf(" %6i",array[i*cols+j]);46 printf(" ]\n");50 _printString_(" [ "); 51 for(int j=0;j<cols;j++) _printString_( " " << setw(11) << setprecision (5) << array[i*cols+j]); 52 _printLine_(" ]"); 47 53 } 48 printf("\n");54 _printLine_(""); 49 55 } 50 56 inline void printbinary(int n) { 51 57 unsigned int i=1L<<(sizeof(n)*8-1); 52 53 58 while (i>0) { 54 59 if (n&i) 55 printf("1");60 _printString_("1"); 56 61 else 57 printf("0");62 _printString_("0"); 58 63 i>>=1; 59 64 } -
issm/trunk/src/c/shared/Exceptions/Exceptions.cpp
r12330 r12706 20 20 } 21 21 22 ErrorException::ErrorException( string what_file,string what_function,int what_line,stringwhat_arg){22 ErrorException::ErrorException(const string& what_file, const string& what_function,int what_line, const string& what_arg){ 23 23 24 24 what_str=what_arg; … … 44 44 45 45 if (function_name=="" || file_line==0){ //WINDOWS 46 printf("%s%s","Error message: ",what());46 _printString_("Error message: " << what()); 47 47 } 48 48 else{ 49 49 if(num_procs==1){ 50 printf("\n??? Error using ==> %s:%i\n",file_name.c_str(),file_line);51 printf("%s error message: %s\n\n",function_name.c_str(),what());50 _printLine_("\n??? Error using ==> " << file_name.c_str() << ":" << file_line); 51 _printLine_(function_name.c_str() << " error message: " << what() << "\n"); 52 52 } 53 53 else{ 54 printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line);55 printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what());54 _printLine_("\n[" << my_rank << "] ??? Error using ==> " << file_name.c_str() << ":" << file_line); 55 _printLine_("[" << my_rank << "] " << function_name.c_str() << " error message: " << what() << "\n"); 56 56 } 57 57 } -
issm/trunk/src/c/shared/Exceptions/exceptions.h
r12330 r12706 24 24 public: 25 25 ErrorException(const string &what_arg); //for windows 26 ErrorException( string what_file,string what_function,int what_line,stringwhat_arg);//UNIX26 ErrorException(const string& what_file,const string& what_function,int what_line,const string& what_arg);//UNIX 27 27 ~ErrorException() throw(); 28 28 virtual const char *what() const throw(); -
issm/trunk/src/c/shared/Exceptions/exprintf.cpp
r11237 r12706 9 9 #include <stdarg.h> 10 10 #include <stdio.h> 11 #include "../Alloc/xNewDelete.h" 11 12 #include "../Alloc/alloc.h" 12 13 … … 14 15 15 16 /*returned string: */ 16 char* string=NULL; 17 char *buffer = NULL; 18 int n,size = 100; 19 int string_size; 17 20 18 /*Assum nobody will print more that 1024 characters!*/19 string=(char*)xmalloc(1024*sizeof(char));//assume that nobody will print more than 1024 characters at once.20 21 21 //variable list of arguments 22 va_list a p;22 va_list args; 23 23 24 //First use vsprintf to get the whole input string. 25 va_start(ap,format); 26 vsprintf(string,format,ap); //printf style coding 27 va_end(ap); 24 while(true){ 28 25 29 return string; 26 /*allocate buffer for given string size*/ 27 buffer=xNew<char>(size); 28 29 /* Try to print in the allocated space. */ 30 va_start(args, format); 31 #ifndef WIN32 32 n=vsnprintf(buffer,size,format,args); 33 #else 34 n=vsnprintf(buffer,size,format,args); 35 #endif 36 va_end(args); 37 38 /* If that worked, return the string. */ 39 if(n>-1 && n<size) break; 40 41 /* Else try again with more space. */ 42 if(n>-1) /* glibc 2.1 */ 43 size=n+1; /* precisely what is needed */ 44 else /* glibc 2.0 */ 45 size*=2; /* twice the old size */ 46 47 xDelete<char>(buffer); 48 } 49 50 return buffer; 30 51 } -
issm/trunk/src/c/shared/Exp/DomainOutlineRead.cpp
r12349 r12706 20 20 21 21 /*I/O: */ 22 FILE * fid=NULL;23 char chardummy[256];22 FILE *fid = NULL; 23 char chardummy[256]; 24 24 double ddummy; 25 25 26 26 /*output: */ 27 int nprof;//number of profiles in the domainname file28 int * profnvertices=NULL; //array holding the number of vertices for the nprof profiles29 double ** pprofx=NULL; //array of profiles x coordinates30 double ** pprofy=NULL; //array of profiles y coordinates31 bool * closed=NULL; //array holding closed flags for the nprof profiles27 int nprof; //number of profiles in the domainname file 28 int *profnvertices = NULL; //array holding the number of vertices for the nprof profiles 29 double **pprofx = NULL; //array of profiles x coordinates 30 double **pprofy = NULL; //array of profiles y coordinates 31 bool *closed = NULL; //array holding closed flags for the nprof profiles 32 32 33 33 /*For each profile: */ 34 int n;35 double * x=NULL;36 double * y=NULL;37 bool cl;34 int n; 35 double *x = NULL; 36 double *y = NULL; 37 bool cl; 38 38 39 39 /*open domain outline file for reading: */ 40 40 if ((fid=fopen(domainname,"r"))==NULL){ 41 _error _("%s%s","could not find domain file ",domainname);41 _error2_("could not find domain file " << domainname); 42 42 } 43 43 … … 62 62 63 63 /*Allocate and initialize all the profiles: */ 64 profnvertices= (int*)xmalloc(nprof*sizeof(int));65 pprofx= (double**)xmalloc(nprof*sizeof(double*));66 pprofy= (double**)xmalloc(nprof*sizeof(double*));64 profnvertices=xNew<int>(nprof); 65 pprofx=xNew<double*>(nprof); 66 pprofy=xNew<double*>(nprof); 67 67 for (i=0;i<nprof;i++){ 68 68 pprofx[i]=NULL; 69 69 pprofy[i]=NULL; 70 70 } 71 closed= (bool*)xmalloc(nprof*sizeof(bool));71 closed=xNew<bool>(nprof); 72 72 73 73 /*Reaset file pointer to beginning of file: */ … … 89 89 90 90 /*Allocate vertices: */ 91 x= (double*)xmalloc(n*sizeof(double));92 y= (double*)xmalloc(n*sizeof(double));91 x=xNew<double>(n); 92 y=xNew<double>(n); 93 93 94 95 94 /*Read vertices: */ 96 95 for (i=0;i<n;i++){ … … 119 118 *ppprofx=pprofx; 120 119 *ppprofy=pprofy; 121 if(pclosed)*pclosed=closed; 122 else xfree((void**)&closed); 120 if(pclosed) 121 *pclosed=closed; 122 else 123 xDelete<bool>(closed); 123 124 } 124 125 -
issm/trunk/src/c/shared/Exp/DomainOutlineWrite.cpp
r12330 r12706 23 23 /*open domain outline file for writing: */ 24 24 if ((fid=fopen(domainname,"w"))==NULL){ 25 _error _("%s%s","could not open domain file ",domainname);25 _error2_("could not open domain file " << domainname); 26 26 noerr=0; goto cleanupandreturn; 27 27 } -
issm/trunk/src/c/shared/Exp/IsInPoly.cpp
r11995 r12706 14 14 #endif 15 15 16 /*IsInPoly {{{ 1*/16 /*IsInPoly {{{*/ 17 17 int IsInPoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){ 18 18 … … 55 55 return 1; 56 56 }/*}}}*/ 57 /*IsOutsidePoly {{{ 1*/57 /*IsOutsidePoly {{{*/ 58 58 int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){ 59 59 … … 96 96 return 1; 97 97 }/*}}}*/ 98 /*pnpoly{{{ 1*/98 /*pnpoly{{{*/ 99 99 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue) { 100 100 int i, j, c = 0; -
issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp
r11995 r12706 4 4 5 5 /*Headers*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #include "./matrix.h" 8 8 #include "../Exceptions/exceptions.h" … … 16 16 /*}}}*/ 17 17 18 /*FUNCTION TripleMultiply {{{ 1*/19 int TripleMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int nrowc, int ncolc, int itrnc, double* d, int iaddd){18 /*FUNCTION TripleMultiply {{{*/ 19 int TripleMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int nrowc, int ncolc, int itrnc, IssmDouble* d, int iaddd){ 20 20 /*TripleMultiply Perform triple matrix product a*b*c+d.*/ 21 21 22 22 int idima,idimb,idimc,idimd; 23 double* dtemp;23 IssmDouble* dtemp; 24 24 25 25 /* set up dimensions for triple product */ … … 36 36 if (!itrnb) { 37 37 if (nrowb != idimb) { 38 _error _("Matrix A and B inner vectors not equal size.");38 _error2_("Matrix A and B inner vectors not equal size."); 39 39 } 40 40 idimc=ncolb; … … 42 42 else { 43 43 if (ncolb != idimb) { 44 _error _("Matrix A and B inner vectors not equal size.");44 _error2_("Matrix A and B inner vectors not equal size."); 45 45 } 46 46 idimc=nrowb; … … 49 49 if (!itrnc) { 50 50 if (nrowc != idimc) { 51 _error _("Matrix B and C inner vectors not equal size.");51 _error2_("Matrix B and C inner vectors not equal size."); 52 52 } 53 53 idimd=ncolc; … … 55 55 else { 56 56 if (ncolc != idimc) { 57 _error _("Matrix B and C inner vectors not equal size.");57 _error2_("Matrix B and C inner vectors not equal size."); 58 58 } 59 59 idimd=nrowc; … … 62 62 /* perform the matrix triple product in the order that minimizes the 63 63 number of multiplies and the temporary space used, noting that 64 (a*b)*c requires ac(b+d) multiplies and ac doubles, and a*(b*c)65 requires bd(a+c) multiplies and bd doubles (both are the same for64 (a*b)*c requires ac(b+d) multiplies and ac IssmDoubles, and a*(b*c) 65 requires bd(a+c) multiplies and bd IssmDoubles (both are the same for 66 66 a symmetric triple product) */ 67 67 … … 69 69 70 70 if (idima*idimc*(idimb+idimd) <= idimb*idimd*(idima+idimc)) { 71 dtemp=(double *) xmalloc(idima*idimc*sizeof(double)); 72 73 MatrixMultiply(a ,nrowa,ncola,itrna, 74 b ,nrowb,ncolb,itrnb, 75 dtemp,0); 76 MatrixMultiply(dtemp,idima,idimc,0 , 77 c ,nrowc,ncolc,itrnc, 78 d ,iaddd); 79 80 xfree((void **)&dtemp); 71 dtemp=xNew<IssmDouble>(idima*idimc); 72 73 MatrixMultiply(a,nrowa,ncola,itrna,b,nrowb,ncolb,itrnb,dtemp,0); 74 MatrixMultiply(dtemp,idima,idimc,0,c,nrowc,ncolc,itrnc,d,iaddd); 75 xDelete<IssmDouble>(dtemp); 81 76 } 82 77 … … 84 79 85 80 else { 86 dtemp=(double *) xmalloc(idimb*idimd*sizeof(double)); 87 88 MatrixMultiply(b ,nrowb,ncolb,itrnb, 89 c ,nrowc,ncolc,itrnc, 90 dtemp,0); 91 MatrixMultiply(a ,nrowa,ncola,itrna, 92 dtemp,idimb,idimd,0 , 93 d ,iaddd); 94 95 xfree((void **)&dtemp); 81 dtemp=xNew<IssmDouble>(idimb*idimd); 82 83 MatrixMultiply(b,nrowb,ncolb,itrnb,c,nrowc,ncolc,itrnc,dtemp,0); 84 MatrixMultiply(a,nrowa,ncola,itrna,dtemp,idimb,idimd,0,d,iaddd); 85 xDelete<IssmDouble>(dtemp); 96 86 } 97 87 98 88 return 1; 99 89 }/*}}}*/ 100 /*FUNCTION MatrixMuliply {{{ 1*/101 int MatrixMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int iaddc ){90 /*FUNCTION MatrixMuliply {{{*/ 91 int MatrixMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int iaddc ){ 102 92 /*MatrixMultiply Perform matrix multiplication a*b+c.*/ 103 93 int noerr=1; … … 134 124 135 125 if (ntrma != ntrmb) { 136 _error _("Matrix A and B inner vectors not equal size");126 _error2_("Matrix A and B inner vectors not equal size"); 137 127 noerr=0; 138 128 return noerr; … … 167 157 return noerr; 168 158 }/*}}}*/ 169 /*FUNCTION MatrixInverse {{{ 1*/170 int MatrixInverse( double* a, int ndim, int nrow, double* b, int nvec, double* pdet ){159 /*FUNCTION MatrixInverse {{{*/ 160 int MatrixInverse( IssmDouble* a, int ndim, int nrow, IssmDouble* b, int nvec, IssmDouble* pdet ){ 171 161 /* MatrixInverse Perform matrix inversion and linear equation solution. 172 162 … … 181 171 int noerr=1; 182 172 int i,j,k,ipt,jpt,irow,icol,ipiv,ncol; 183 int (*pivrc)[2],*pindx;184 double pivot,det,dtemp;173 int *pivrc1,*pivrc2,*pindx; 174 IssmDouble pivot,det,dtemp; 185 175 186 176 if (!b && nvec) { 187 _error _("No right-hand side for nvec=%d.",nvec);177 _error2_("No right-hand side for nvec=" << nvec << "."); 188 178 noerr=0; 189 179 return noerr; … … 198 188 ncol=nrow; 199 189 det=1.; 200 201 pivrc = (int (*)[2]) xmalloc((nrow*2)*sizeof(int));202 pindx = (int (*) ) xcalloc( nrow ,sizeof(int));190 pivrc1 =xNew<int>(nrow); 191 pivrc2 =xNew<int>(nrow); 192 pindx =xNew<int>(nrow); 203 193 204 194 /* loop over the rows/columns of the matrix */ … … 221 211 222 212 if (fabs(pivot) < DBL_EPSILON) { 223 xfree((void **)&pivrc); 224 xfree((void **)&pindx); 225 _error_("Pivot %f less than machine epsilon",pivot); 213 xDelete<int>(pivrc1); 214 xDelete<int>(pivrc2); 215 xDelete<int>(pindx); 216 _error2_("Pivot " << pivot << " less than machine epsilon"); 226 217 noerr=0; 227 218 return noerr; 228 219 } 229 220 230 pivrc [i][0]=irow;231 pivrc [i][1]=icol;221 pivrc1[i]=irow; 222 pivrc2[i]=icol; 232 223 233 224 ipiv=icol; … … 319 310 j=(nrow-1)-i; 320 311 321 if (pivrc [j][0] != pivrc[j][1]) {322 irow=pivrc [j][0];323 icol=pivrc [j][1];312 if (pivrc1[j] != pivrc2[j]) { 313 irow=pivrc1[j]; 314 icol=pivrc2[j]; 324 315 325 316 // _printf_(true,"column switch back for j=%d: irow=%d, icol=%d\n", … … 336 327 } 337 328 338 if (pdet) 339 *pdet=det; 340 341 xfree((void **)&pivrc); 342 xfree((void **)&pindx); 343 329 if (pdet) *pdet=det; 330 xDelete<int>(pivrc1); 331 xDelete<int>(pivrc2); 332 xDelete<int>(pindx); 344 333 return noerr; 345 334 }/*}}}*/ 346 /*FUNCTION Matrix2x2Determinant( double* Adet,double* A) {{{1*/347 void Matrix2x2Determinant( double* Adet,double* A){335 /*FUNCTION Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A) {{{*/ 336 void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A){ 348 337 /*Compute determinant of a 2x2 matrix*/ 349 338 … … 352 341 } 353 342 /*}}}*/ 354 /*FUNCTION Matrix2x2Invert( double* Ainv,double* A) {{{1*/355 void Matrix2x2Invert( double* Ainv,double* A){343 /*FUNCTION Matrix2x2Invert(IssmDouble* Ainv,IssmDouble* A) {{{*/ 344 void Matrix2x2Invert(IssmDouble* Ainv,IssmDouble* A){ 356 345 357 346 /*Intermediaries*/ 358 double det;347 IssmDouble det; 359 348 360 349 /*Compute determinant*/ 361 350 Matrix2x2Determinant(&det,A); 362 if (fabs(det) < DBL_EPSILON) _error _("Determinant smaller that machine epsilon");351 if (fabs(det) < DBL_EPSILON) _error2_("Determinant smaller that machine epsilon"); 363 352 364 353 /*Compute invert*/ … … 369 358 370 359 }/*}}}*/ 371 /*FUNCTION Matrix3x3Determinant( double* Adet,double* A) {{{1*/372 void Matrix3x3Determinant( double* Adet,double* A){360 /*FUNCTION Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A) {{{*/ 361 void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A){ 373 362 /*Compute determinant of a 3x3 matrix*/ 374 363 … … 377 366 } 378 367 /*}}}*/ 379 /*FUNCTION Matrix3x3Invert( double* Ainv,double* A) {{{1*/380 void Matrix3x3Invert( double* Ainv,double* A){368 /*FUNCTION Matrix3x3Invert(IssmDouble* Ainv,IssmDouble* A) {{{*/ 369 void Matrix3x3Invert(IssmDouble* Ainv,IssmDouble* A){ 381 370 382 371 /*Intermediaries*/ 383 double det;372 IssmDouble det; 384 373 385 374 /*Compute determinant*/ 386 375 Matrix3x3Determinant(&det,A); 387 if (fabs(det) < DBL_EPSILON) _error _("Determinant smaller that machine epsilon");376 if (fabs(det) < DBL_EPSILON) _error2_("Determinant smaller that machine epsilon"); 388 377 389 378 /*Compute invert*/ … … 399 388 400 389 }/*}}}*/ 401 /*FUNCTION MatrixTranspose( double* Adet,double* A) {{{1*/402 void MatrixTranspose( double* tA,double* A, int nrows, int ncols){390 /*FUNCTION MatrixTranspose(IssmDouble* Adet,IssmDouble* A) {{{*/ 391 void MatrixTranspose(IssmDouble* tA,IssmDouble* A, int nrows, int ncols){ 403 392 /*Transpose a n*m matrix*/ 404 393 -
issm/trunk/src/c/shared/Matrix/matrix.h
r5371 r12706 6 6 #define _MATRIXUTILS_H_ 7 7 8 int TripleMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int nrowc, int ncolc, int itrnc, double* d, int iaddd); 9 int MatrixMultiply( double* a, int nrowa, int ncola, int itrna, double* b, int nrowb, int ncolb, int itrnb, double* c, int iaddc ); 10 int MatrixInverse( double* a, int ndim, int nrow, double* b, int nvec, double* pdet ); 11 void Matrix2x2Invert(double* Ainv, double* A); 12 void Matrix2x2Determinant(double* Adet,double* A); 13 void Matrix3x3Invert(double* Ainv, double* A); 14 void Matrix3x3Determinant(double* Adet,double* A); 15 void MatrixTranspose(double* tA,double* A,int nrows, int ncols); 8 #include "../../include/include.h" 9 10 int TripleMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int nrowc, int ncolc, int itrnc, IssmDouble* d, int iaddd); 11 int MatrixMultiply( IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int iaddc ); 12 int MatrixInverse( IssmDouble* a, int ndim, int nrow, IssmDouble* b, int nvec, IssmDouble* pdet ); 13 void Matrix2x2Invert(IssmDouble* Ainv, IssmDouble* A); 14 void Matrix2x2Determinant(IssmDouble* Adet,IssmDouble* A); 15 void Matrix3x3Invert(IssmDouble* Ainv, IssmDouble* A); 16 void Matrix3x3Determinant(IssmDouble* Adet,IssmDouble* A); 17 void MatrixTranspose(IssmDouble* tA,IssmDouble* A,int nrows, int ncols); 16 18 17 19 #endif //ifndef _MATRIXUTILS_H_ -
issm/trunk/src/c/shared/Numerics/BrentSearch.cpp
r9761 r12706 15 15 #include "../../shared/shared.h" 16 16 #include <float.h> 17 18 void BrentSearch(double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs){ 17 #include <iomanip> 18 19 void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){ 19 20 20 21 /* This routine is optimizing a given function using Brent's method … … 22 23 23 24 /*Intermediary*/ 24 double si,gold,intervalgold,oldintervalgold;25 double parab_num,parab_den;26 double distance,cm_jump;27 double fxmax,fxmin,fxbest;28 double fx,fx1,fx2;29 double xmax,xmin,xbest;30 double x,x1,x2,xm;31 double tol1,tol2,seps;32 double tolerance=1.e-4;33 int maxiter,iter;34 bool loop=true,goldenflag;25 IssmDouble si,gold,intervalgold,oldintervalgold; 26 IssmDouble parab_num,parab_den; 27 IssmDouble distance,cm_jump; 28 IssmDouble fxmax,fxmin,fxbest; 29 IssmDouble fx,fx1,fx2; 30 IssmDouble xmax,xmin,xbest; 31 IssmDouble x,x1,x2,xm; 32 IssmDouble tol1,tol2,seps; 33 IssmDouble tolerance = 1.e-4; 34 int maxiter ,iter; 35 bool loop= true,goldenflag; 35 36 36 37 /*Recover parameters:*/ … … 43 44 iter=0; 44 45 fxmin = (*f)(xmin,optargs); 45 if (isnan(fxmin)) _error_("Function evaluation returned NaN"); 46 _printf_(VerboseControl(),"\n Iteration x f(x) Tolerance Procedure\n\n"); 47 _printf_(VerboseControl()," %s %12.6g %12.6g %s"," N/A",xmin,fxmin," N/A boundary\n"); 46 if (xIsNan<IssmDouble>(fxmin)) _error2_("Function evaluation returned NaN"); 47 cout<<setprecision(5); 48 if(VerboseControl()) _pprintLine_(""); 49 if(VerboseControl()) _pprintLine_(" Iteration x f(x) Tolerance Procedure"); 50 if(VerboseControl()) _pprintLine_(""); 51 if(VerboseControl()) _pprintLine_(" N/A "<<setw(12)<<xmin<<" "<<setw(12)<<fxmin<<" N/A boundary"); 48 52 fxmax = (*f)(xmax,optargs); 49 if ( isnan(fxmax)) _error_("Function evaluation returned NaN");50 _printf_(VerboseControl()," %s %12.6g %12.6g %s"," N/A",xmax,fxmax," N/A boundary\n");53 if (xIsNan<IssmDouble>(fxmax)) _error2_("Function evaluation returned NaN"); 54 if(VerboseControl()) _pprintLine_(" N/A "<<setw(12)<<xmax<<" "<<setw(12)<<fxmax<<" N/A boundary"); 51 55 52 56 /*test if jump option activated and xmin==0*/ 53 if (! isnan(cm_jump) && (xmin==0) && (fxmax/fxmin)<cm_jump){57 if (!xIsNan<IssmDouble>(cm_jump) && (xmin==0) && (fxmax/fxmin)<cm_jump){ 54 58 *psearch_scalar=xmax; 55 59 *pJ=fxmax; … … 58 62 59 63 /*initialize optimization variables*/ 60 seps=sqrt(DBL_EPSILON); //precision of a double64 seps=sqrt(DBL_EPSILON); //precision of a IssmDouble 61 65 distance=0.0; //new_x=old_x + distance 62 66 gold=0.5*(3.0-sqrt(5.0)); //gold = 1 - golden ratio … … 71 75 /*2: call the function to be evaluated*/ 72 76 fxbest = (*f)(x,optargs); 73 if( isnan(fxbest)) _error_("Function evaluation returned NaN");77 if(xIsNan<IssmDouble>(fxbest)) _error2_("Function evaluation returned NaN"); 74 78 iter=iter+1; 75 79 … … 84 88 85 89 /*4: print result*/ 86 _printf_(VerboseControl()," %5i %12.6g %12.6g %12.6g %s\n",iter,xbest,fxbest,pow(pow(xbest-xm,2),0.5)," initial"); 87 if (!isnan(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){ 88 _printf_(VerboseControl()," optimization terminated: current x satisfies criteria 'cm_jump'=%g\n",cm_jump); 90 if(VerboseControl()) 91 _pprintLine_(" "<<setw(5)<<iter<<" "<<setw(12)<<xbest<<" "<<setw(12)<<fxbest<<" "<<setw(12)<<pow(pow(xbest-xm,2),0.5)<<" initial"); 92 if (!xIsNan<IssmDouble>(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){ 93 if(VerboseControl()) _pprintLine_(" optimization terminated: current x satisfies criteria 'cm_jump'=" << cm_jump); 89 94 loop=false; 90 95 } … … 154 159 //evaluate function on x 155 160 fx = (*f)(x,optargs); 156 if( isnan(fx)) _error_("Function evaluation returned NaN");161 if(xIsNan<IssmDouble>(fx)) _error2_("Function evaluation returned NaN"); 157 162 iter=iter+1; 158 163 … … 179 184 tol1=seps*pow(pow(xbest,2),0.5)+tolerance/3.0; 180 185 tol2=2.0*tol1; 181 _printf_(VerboseControl()," %5i %12.6g %12.6g %12.6g %s\n",iter,x,fx,pow(pow(xbest-xm,2),0.5),goldenflag?" golden":" parabolic"); 186 if(VerboseControl()) 187 _pprintLine_(" "<<setw(5)<<iter<<" "<<setw(12)<<x<<" "<<setw(12)<<fx<<" "<<setw(12)<<pow(pow(xbest-xm,2),0.5)<< 188 " "<<(goldenflag?"golden":"parabolic")); 182 189 183 190 /*Stop the optimization?*/ 184 191 if (sqrt(pow(xbest-xm,2)) < (tol2-0.5*(xmax-xmin))){ 185 _printf_(VerboseControl()," optimization terminated: current x satisfies criteria 'tolx'=%g\n",tolerance);192 if(VerboseControl()) _pprintLine_(" optimization terminated: current x satisfies criteria 'tolx'=" << tolerance); 186 193 loop=false; 187 194 } 188 195 else if (iter>=maxiter){ 189 _printf_(VerboseControl()," exiting: Maximum number of iterations has been exceeded ('maxiter'=%i)\n",maxiter);196 if(VerboseControl()) _pprintLine_(" exiting: Maximum number of iterations has been exceeded ('maxiter'=" << maxiter << ")"); 190 197 loop=false; 191 198 } 192 else if (! isnan(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){193 _printf_(VerboseControl()," optimization terminated: current x satisfies criteria 'cm_jump'=%g\n",cm_jump);199 else if (!xIsNan<IssmDouble>(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){ 200 if(VerboseControl()) _pprintLine_(" optimization terminated: current x satisfies criteria 'cm_jump'=" << cm_jump); 194 201 loop=false; 195 202 } -
issm/trunk/src/c/shared/Numerics/GaussPoints.cpp
r11995 r12706 1 1 /* Gauss point structures and prototypes */ 2 2 3 #include "../../include/include.h" 3 4 #include "./GaussPoints.h" 4 5 #include "../Alloc/alloc.h" 5 #include "../../include/include.h"6 6 #include "../../io/io.h" 7 7 #include "../Exceptions/exceptions.h" … … 10 10 11 11 /*General Gauss points*/ 12 /*FUNCTION GaussLegendreLinear {{{ 1*/13 void GaussLegendreLinear( double** pxgaus, double** pxwgt, int ngaus){12 /*FUNCTION GaussLegendreLinear {{{*/ 13 void GaussLegendreLinear( IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus){ 14 14 /* Gauss-Legendre quadrature points. 15 15 … … 25 25 /*Intermediaries*/ 26 26 int i; 27 double *alpha,*beta;27 IssmPDouble *alpha,*beta; 28 28 29 29 /*p= 1, npoint= 1*/ 30 static double wgt1[]={2.000000000000000};31 static double xi1[]={0.000000000000000};30 static IssmPDouble wgt1[]={2.000000000000000}; 31 static IssmPDouble xi1[]={0.000000000000000}; 32 32 33 33 /*p= 3, npoint= 2*/ 34 static double wgt2[]={1.000000000000000, 1.000000000000000};35 static double xi2[]={-0.577350269189626, 0.577350269189626};34 static IssmPDouble wgt2[]={1.000000000000000, 1.000000000000000}; 35 static IssmPDouble xi2[]={-0.577350269189626, 0.577350269189626}; 36 36 37 37 /*p= 5, npoint= 3*/ 38 static double wgt3[]={0.555555555555556, 0.888888888888889, 0.555555555555556};39 static double xi3[]={-0.774596669241483, 0.000000000000000, 0.774596669241483};38 static IssmPDouble wgt3[]={0.555555555555556, 0.888888888888889, 0.555555555555556}; 39 static IssmPDouble xi3[]={-0.774596669241483, 0.000000000000000, 0.774596669241483}; 40 40 41 41 /*p= 7, npoint= 4*/ 42 static double wgt4[]={0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454};43 static double xi4[]={-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053};44 45 static double* wgtp[MAX_LINE_GAUS_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 };46 static double* xip [MAX_LINE_GAUS_PTS]={xi1 ,xi2 ,xi3 ,xi4 };47 48 static int np[MAX_LINE_GAUS_PTS]={sizeof(wgt1 )/sizeof( double),49 sizeof(wgt2 )/sizeof( double),50 sizeof(wgt3 )/sizeof( double),51 sizeof(wgt4 )/sizeof( double)};52 53 // _p rintf_(true,"Gauss-Legendre recurrence coefficients ngaus=%d\n",ngaus);54 *pxgaus = (double *) xmalloc(ngaus*sizeof(double));55 *pxwgt = (double *) xmalloc(ngaus*sizeof(double));42 static IssmPDouble wgt4[]={0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454}; 43 static IssmPDouble xi4[]={-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053}; 44 45 static IssmPDouble* wgtp[MAX_LINE_GAUS_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 }; 46 static IssmPDouble* xip [MAX_LINE_GAUS_PTS]={xi1 ,xi2 ,xi3 ,xi4 }; 47 48 static int np[MAX_LINE_GAUS_PTS]={sizeof(wgt1 )/sizeof(IssmPDouble), 49 sizeof(wgt2 )/sizeof(IssmPDouble), 50 sizeof(wgt3 )/sizeof(IssmPDouble), 51 sizeof(wgt4 )/sizeof(IssmPDouble)}; 52 53 // _pprintLine_("Gauss-Legendre recurrence coefficients ngaus=" << ngaus); 54 *pxgaus =xNew<IssmPDouble>(ngaus); 55 *pxwgt =xNew<IssmPDouble>(ngaus); 56 56 57 57 /* check to see if Gauss points need to be calculated */ … … 70 70 71 71 /* calculate the Gauss points using recurrence relations */ 72 alpha= (double *) xmalloc(ngaus*sizeof(double));73 beta = (double *) xmalloc(ngaus*sizeof(double));72 alpha=xNew<IssmPDouble>(ngaus); 73 beta =xNew<IssmPDouble>(ngaus); 74 74 75 75 /* calculate the Legendre recurrence coefficients */ … … 84 84 /* calculate the Gauss points */ 85 85 GaussRecur(*pxgaus, *pxwgt, ngaus, alpha, beta ); 86 x free((void **)&beta);87 x free((void **)&alpha);86 xDelete<IssmPDouble>(beta); 87 xDelete<IssmPDouble>(alpha); 88 88 } 89 }/*}}} 1*/90 /*FUNCTION GaussLegendreTria{{{ 1*/91 void GaussLegendreTria( int* pngaus, double** pl1, double** pl2, double** pl3, double** pwgt, int iord ) {89 }/*}}}*/ 90 /*FUNCTION GaussLegendreTria{{{*/ 91 void GaussLegendreTria( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pwgt, int iord ) { 92 92 /*Gauss quadrature points for the triangle. 93 93 … … 98 98 /*Intermediaries*/ 99 99 int i,j,ipt,nigaus; 100 double xi,eta;101 double *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt;100 IssmPDouble xi,eta; 101 IssmPDouble *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt; 102 102 103 103 /*Hardcoded Gauss points declaration*/ 104 /*p= 1, npoint= 1{{{ 2*/105 static double wgt1[]={104 /*p= 1, npoint= 1{{{*/ 105 static IssmPDouble wgt1[]={ 106 106 1.732050807568877}; 107 static double l11[]={107 static IssmPDouble l11[]={ 108 108 0.333333333333333}; 109 static double l21[]={109 static IssmPDouble l21[]={ 110 110 0.333333333333333}; 111 static double l31[]={111 static IssmPDouble l31[]={ 112 112 0.333333333333333}; 113 /*}}} 2*/114 /*p= 2, npoint= 3 {{{ 2*/115 static double wgt2[]={113 /*}}}*/ 114 /*p= 2, npoint= 3 {{{*/ 115 static IssmPDouble wgt2[]={ 116 116 0.577350269189625, 0.577350269189625, 0.577350269189625}; 117 static double l12[]={117 static IssmPDouble l12[]={ 118 118 0.666666666666667, 0.166666666666667, 0.166666666666667}; 119 static double l22[]={119 static IssmPDouble l22[]={ 120 120 0.166666666666667, 0.666666666666667, 0.166666666666667}; 121 static double l32[]={121 static IssmPDouble l32[]={ 122 122 0.166666666666667, 0.166666666666667, 0.666666666666667}; 123 /*}}} 2*/124 /*p= 3, npoint= 4 {{{ 2*/125 static double wgt3[]={123 /*}}}*/ 124 /*p= 3, npoint= 4 {{{*/ 125 static IssmPDouble wgt3[]={ 126 126 -0.974278579257493, 0.902109795608790, 0.902109795608790, 127 127 0.902109795608790}; 128 static double l13[]={128 static IssmPDouble l13[]={ 129 129 0.333333333333333, 0.600000000000000, 0.200000000000000, 130 130 0.200000000000000}; 131 static double l23[]={131 static IssmPDouble l23[]={ 132 132 0.333333333333333, 0.200000000000000, 0.600000000000000, 133 133 0.200000000000000}; 134 static double l33[]={134 static IssmPDouble l33[]={ 135 135 0.333333333333333, 0.200000000000000, 0.200000000000000, 136 136 0.600000000000000}; 137 /*}}} 2*/138 /*p= 4, npoint= 6 {{{ 2*/139 static double wgt4[]={137 /*}}}*/ 138 /*p= 4, npoint= 6 {{{*/ 139 static IssmPDouble wgt4[]={ 140 140 0.386908262797819, 0.386908262797819, 0.386908262797819, 141 141 0.190442006391807, 0.190442006391807, 0.190442006391807}; 142 static double l14[]={142 static IssmPDouble l14[]={ 143 143 0.108103018168070, 0.445948490915965, 0.445948490915965, 144 144 0.816847572980459, 0.091576213509771, 0.091576213509771}; 145 static double l24[]={145 static IssmPDouble l24[]={ 146 146 0.445948490915965, 0.108103018168070, 0.445948490915965, 147 147 0.091576213509771, 0.816847572980459, 0.091576213509771}; 148 static double l34[]={148 static IssmPDouble l34[]={ 149 149 0.445948490915965, 0.445948490915965, 0.108103018168070, 150 150 0.091576213509771, 0.091576213509771, 0.816847572980459}; 151 /*}}} 2*/152 /*p= 5, npoint= 7 {{{ 2*/153 static double wgt5[]={151 /*}}}*/ 152 /*p= 5, npoint= 7 {{{*/ 153 static IssmPDouble wgt5[]={ 154 154 0.389711431702997, 0.229313399254729, 0.229313399254729, 155 155 0.229313399254729, 0.218133059367230, 0.218133059367230, 156 156 0.218133059367230}; 157 static double l15[]={157 static IssmPDouble l15[]={ 158 158 0.333333333333333, 0.059715871789770, 0.470142064105115, 159 159 0.470142064105115, 0.797426985353087, 0.101286507323456, 160 160 0.101286507323456}; 161 static double l25[]={161 static IssmPDouble l25[]={ 162 162 0.333333333333333, 0.470142064105115, 0.059715871789770, 163 163 0.470142064105115, 0.101286507323456, 0.797426985353087, 164 164 0.101286507323456}; 165 static double l35[]={165 static IssmPDouble l35[]={ 166 166 0.333333333333333, 0.470142064105115, 0.470142064105115, 167 167 0.059715871789770, 0.101286507323456, 0.101286507323456, 168 168 0.797426985353087}; 169 /*}}} 2*/170 /*p= 6, npoint=12 {{{ 2*/171 static double wgt6[]={169 /*}}}*/ 170 /*p= 6, npoint=12 {{{*/ 171 static IssmPDouble wgt6[]={ 172 172 0.202279763184836, 0.202279763184836, 0.202279763184836, 173 173 0.088065961139281, 0.088065961139281, 0.088065961139281, 174 174 0.143502272432755, 0.143502272432755, 0.143502272432755, 175 175 0.143502272432755, 0.143502272432755, 0.143502272432755}; 176 static double l16[]={176 static IssmPDouble l16[]={ 177 177 0.501426509658179, 0.249286745170910, 0.249286745170910, 178 178 0.873821971016996, 0.063089014491502, 0.063089014491502, 179 179 0.053145049844817, 0.053145049844817, 0.310352451033784, 180 180 0.636502499121399, 0.310352451033784, 0.636502499121399}; 181 static double l26[]={181 static IssmPDouble l26[]={ 182 182 0.249286745170910, 0.501426509658179, 0.249286745170910, 183 183 0.063089014491502, 0.873821971016996, 0.063089014491502, 184 184 0.310352451033784, 0.636502499121399, 0.053145049844817, 185 185 0.053145049844817, 0.636502499121399, 0.310352451033784}; 186 static double l36[]={186 static IssmPDouble l36[]={ 187 187 0.249286745170910, 0.249286745170910, 0.501426509658179, 188 188 0.063089014491502, 0.063089014491502, 0.873821971016996, 189 189 0.636502499121399, 0.310352451033784, 0.636502499121399, 190 190 0.310352451033784, 0.053145049844817, 0.053145049844817}; 191 /*}}} 2*/192 /*p= 7, npoint=13 {{{ 2*/193 static double wgt7[]={191 /*}}}*/ 192 /*p= 7, npoint=13 {{{*/ 193 static IssmPDouble wgt7[]={ 194 194 -0.259062916308362, 0.304174548458604, 0.304174548458604, 195 195 0.304174548458604, 0.092400122517855, 0.092400122517855, … … 197 197 0.133564951824643, 0.133564951824643, 0.133564951824643, 198 198 0.133564951824643}; 199 static double l17[]={199 static IssmPDouble l17[]={ 200 200 0.333333333333333, 0.479308067841920, 0.260345966079040, 201 201 0.260345966079040, 0.869739794195568, 0.065130102902216, … … 203 203 0.312865496004874, 0.638444188569810, 0.312865496004874, 204 204 0.638444188569810}; 205 static double l27[]={205 static IssmPDouble l27[]={ 206 206 0.333333333333333, 0.260345966079040, 0.479308067841920, 207 207 0.260345966079040, 0.065130102902216, 0.869739794195568, … … 209 209 0.048690315425316, 0.048690315425316, 0.638444188569810, 210 210 0.312865496004874}; 211 static double l37[]={211 static IssmPDouble l37[]={ 212 212 0.333333333333333, 0.260345966079040, 0.260345966079040, 213 213 0.479308067841920, 0.065130102902216, 0.065130102902216, … … 215 215 0.638444188569810, 0.312865496004874, 0.048690315425316, 216 216 0.048690315425316}; 217 /*}}} 2*/218 /*p= 8, npoint=16 {{{ 2*/219 static double wgt8[]={217 /*}}}*/ 218 /*p= 8, npoint=16 {{{*/ 219 static IssmPDouble wgt8[]={ 220 220 0.249961964823104, 0.164703541925695, 0.164703541925695, 221 221 0.164703541925695, 0.178777729989794, 0.178777729989794, … … 224 224 0.047164287656184, 0.047164287656184, 0.047164287656184, 225 225 0.047164287656184}; 226 static double l18[]={226 static IssmPDouble l18[]={ 227 227 0.333333333333333, 0.081414823414554, 0.459292588292723, 228 228 0.459292588292723, 0.658861384496480, 0.170569307751760, … … 231 231 0.263112829634638, 0.728492392955404, 0.263112829634638, 232 232 0.728492392955404}; 233 static double l28[]={233 static IssmPDouble l28[]={ 234 234 0.333333333333333, 0.459292588292723, 0.081414823414554, 235 235 0.459292588292723, 0.170569307751760, 0.658861384496480, … … 238 238 0.008394777409958, 0.008394777409958, 0.728492392955404, 239 239 0.263112829634638}; 240 static double l38[]={240 static IssmPDouble l38[]={ 241 241 0.333333333333333, 0.459292588292723, 0.459292588292723, 242 242 0.081414823414554, 0.170569307751760, 0.170569307751760, … … 245 245 0.728492392955404, 0.263112829634638, 0.008394777409958, 246 246 0.008394777409958}; 247 /*}}} 2*/248 /*p= 9, npoint=19 {{{ 2*/249 static double wgt9[]={247 /*}}}*/ 248 /*p= 9, npoint=19 {{{*/ 249 static IssmPDouble wgt9[]={ 250 250 0.168244134395468, 0.054273292833345, 0.054273292833345, 251 251 0.054273292833345, 0.134801255248419, 0.134801255248419, … … 255 255 0.074969289332873, 0.074969289332873, 0.074969289332873, 256 256 0.074969289332873}; 257 static double l19[]={257 static IssmPDouble l19[]={ 258 258 0.333333333333333, 0.020634961602525, 0.489682519198738, 259 259 0.489682519198738, 0.125820817014127, 0.437089591492937, … … 263 263 0.221962989160766, 0.741198598784498, 0.221962989160766, 264 264 0.741198598784498}; 265 static double l29[]={265 static IssmPDouble l29[]={ 266 266 0.333333333333333, 0.489682519198738, 0.020634961602525, 267 267 0.489682519198738, 0.437089591492937, 0.125820817014127, … … 271 271 0.036838412054736, 0.036838412054736, 0.741198598784498, 272 272 0.221962989160766}; 273 static double l39[]={273 static IssmPDouble l39[]={ 274 274 0.333333333333333, 0.489682519198738, 0.489682519198738, 275 275 0.020634961602525, 0.437089591492937, 0.437089591492937, … … 279 279 0.741198598784498, 0.221962989160766, 0.036838412054736, 280 280 0.036838412054736}; 281 /*}}} 2*/282 /*p=10, npoint=25 {{{ 2*/283 static double wgt10[]={281 /*}}}*/ 282 /*p=10, npoint=25 {{{*/ 283 static IssmPDouble wgt10[]={ 284 284 0.157301373584232, 0.063611224790829, 0.063611224790829, 285 285 0.063611224790829, 0.078498377595183, 0.078498377595183, … … 291 291 0.016318805873179, 0.016318805873179, 0.016318805873179, 292 292 0.016318805873179}; 293 static double l110[]={293 static IssmPDouble l110[]={ 294 294 0.333333333333333, 0.028844733232685, 0.485577633383657, 295 295 0.485577633383657, 0.781036849029926, 0.109481575485037, … … 301 301 0.066803251012200, 0.923655933587500, 0.066803251012200, 302 302 0.923655933587500}; 303 static double l210[]={303 static IssmPDouble l210[]={ 304 304 0.333333333333333, 0.485577633383657, 0.028844733232685, 305 305 0.485577633383657, 0.109481575485037, 0.781036849029926, … … 311 311 0.009540815400299, 0.009540815400299, 0.923655933587500, 312 312 0.066803251012200}; 313 static double l310[]={313 static IssmPDouble l310[]={ 314 314 0.333333333333333, 0.485577633383657, 0.485577633383657, 315 315 0.028844733232685, 0.109481575485037, 0.109481575485037, … … 321 321 0.923655933587500, 0.066803251012200, 0.009540815400299, 322 322 0.009540815400299}; 323 /*}}} 2*/324 /*p=11, npoint=27 {{{ 2*/325 static double wgt11[]={323 /*}}}*/ 324 /*p=11, npoint=27 {{{*/ 325 static IssmPDouble wgt11[]={ 326 326 0.001605622060698, 0.001605622060698, 0.001605622060698, 327 327 0.133626914252765, 0.133626914252765, 0.133626914252765, … … 333 333 0.035866718600836, 0.035866718600836, 0.035866718600836, 334 334 0.035866718600836, 0.035866718600836, 0.035866718600836}; 335 static double l111[]={335 static IssmPDouble l111[]={ 336 336 -0.069222096541517, 0.534611048270758, 0.534611048270758, 337 337 0.202061394068290, 0.398969302965855, 0.398969302965855, … … 343 343 0.021022016536166, 0.021022016536166, 0.171488980304042, 344 344 0.807489003159792, 0.171488980304042, 0.807489003159792}; 345 static double l211[]={345 static IssmPDouble l211[]={ 346 346 0.534611048270758,-0.069222096541517, 0.534611048270758, 347 347 0.398969302965855, 0.202061394068290, 0.398969302965855, … … 353 353 0.171488980304042, 0.807489003159792, 0.021022016536166, 354 354 0.021022016536166, 0.807489003159792, 0.171488980304042}; 355 static double l311[]={355 static IssmPDouble l311[]={ 356 356 0.534611048270758, 0.534611048270758,-0.069222096541517, 357 357 0.398969302965855, 0.398969302965855, 0.202061394068290, … … 363 363 0.807489003159792, 0.171488980304042, 0.807489003159792, 364 364 0.171488980304042, 0.021022016536166, 0.021022016536166}; 365 /*}}} 2*/366 /*p=12, npoint=33 {{{ 2*/367 static double wgt12[]={365 /*}}}*/ 366 /*p=12, npoint=33 {{{*/ 367 static IssmPDouble wgt12[]={ 368 368 0.044567514407799, 0.044567514407799, 0.044567514407799, 369 369 0.075677707051848, 0.075677707051848, 0.075677707051848, … … 377 377 0.029992592075802, 0.029992592075802, 0.029992592075802, 378 378 0.029992592075802, 0.029992592075802, 0.029992592075802}; 379 static double l112[]={379 static IssmPDouble l112[]={ 380 380 0.023565220452390, 0.488217389773805, 0.488217389773805, 381 381 0.120551215411079, 0.439724392294460, 0.439724392294460, … … 389 389 0.025734050548330, 0.025734050548330, 0.116251915907597, 390 390 0.858014033544073, 0.116251915907597, 0.858014033544073}; 391 static double l212[]={391 static IssmPDouble l212[]={ 392 392 0.488217389773805, 0.023565220452390, 0.488217389773805, 393 393 0.439724392294460, 0.120551215411079, 0.439724392294460, … … 401 401 0.116251915907597, 0.858014033544073, 0.025734050548330, 402 402 0.025734050548330, 0.858014033544073, 0.116251915907597}; 403 static double l312[]={403 static IssmPDouble l312[]={ 404 404 0.488217389773805, 0.488217389773805, 0.023565220452390, 405 405 0.439724392294460, 0.439724392294460, 0.120551215411079, … … 413 413 0.858014033544073, 0.116251915907597, 0.858014033544073, 414 414 0.116251915907597, 0.025734050548330, 0.025734050548330}; 415 /*}}} 2*/416 /* p=13, npoint=37 {{{ 2*/417 static double wgt13[]={415 /*}}}*/ 416 /* p=13, npoint=37 {{{*/ 417 static IssmPDouble wgt13[]={ 418 418 0.090968907790622, 0.019537784619314, 0.019537784619314, 419 419 0.019537784619314, 0.054427130356344, 0.054427130356344, … … 429 429 0.026884523429480, 0.026884523429480, 0.026884523429480, 430 430 0.026884523429480}; 431 static double l113[]={431 static IssmPDouble l113[]={ 432 432 0.333333333333333, 0.009903630120591, 0.495048184939705, 433 433 0.495048184939705, 0.062566729780852, 0.468716635109574, … … 443 443 0.126357385491669, 0.851409537834241, 0.126357385491669, 444 444 0.851409537834241}; 445 static double l213[]={445 static IssmPDouble l213[]={ 446 446 0.333333333333333, 0.495048184939705, 0.009903630120591, 447 447 0.495048184939705, 0.468716635109574, 0.062566729780852, … … 457 457 0.022233076674090, 0.022233076674090, 0.851409537834241, 458 458 0.126357385491669}; 459 static double l313[]={459 static IssmPDouble l313[]={ 460 460 0.333333333333333, 0.495048184939705, 0.495048184939705, 461 461 0.009903630120591, 0.468716635109574, 0.468716635109574, … … 471 471 0.851409537834241, 0.126357385491669, 0.022233076674090, 472 472 0.022233076674090}; 473 /*}}} 2*/474 /*p=14, npoint=42{{{ 2*/475 static double wgt14[]={473 /*}}}*/ 474 /*p=14, npoint=42{{{*/ 475 static IssmPDouble wgt14[]={ 476 476 0.037903474783419, 0.037903474783419, 0.037903474783419, 477 477 0.056791094234956, 0.056791094234956, 0.056791094234956, … … 488 488 0.008677970905831, 0.008677970905831, 0.008677970905831, 489 489 0.008677970905831, 0.008677970905831, 0.008677970905831}; 490 static double l114[]={490 static IssmPDouble l114[]={ 491 491 0.022072179275643, 0.488963910362179, 0.488963910362179, 492 492 0.164710561319092, 0.417644719340454, 0.417644719340454, … … 503 503 0.001268330932872, 0.001268330932872, 0.118974497696957, 504 504 0.879757171370171, 0.118974497696957, 0.879757171370171}; 505 static double l214[]={505 static IssmPDouble l214[]={ 506 506 0.488963910362179, 0.022072179275643, 0.488963910362179, 507 507 0.417644719340454, 0.164710561319092, 0.417644719340454, … … 518 518 0.118974497696957, 0.879757171370171, 0.001268330932872, 519 519 0.001268330932872, 0.879757171370171, 0.118974497696957}; 520 static double l314[]={520 static IssmPDouble l314[]={ 521 521 0.488963910362179, 0.488963910362179, 0.022072179275643, 522 522 0.417644719340454, 0.417644719340454, 0.164710561319092, … … 533 533 0.879757171370171, 0.118974497696957, 0.879757171370171, 534 534 0.118974497696957, 0.001268330932872, 0.001268330932872}; 535 /*}}} 2*/536 /*p=15, npoint=48{{{ 2*/537 static double wgt15[]={535 /*}}}*/ 536 /*p=15, npoint=48{{{*/ 537 static IssmPDouble wgt15[]={ 538 538 0.003320126005206, 0.003320126005206, 0.003320126005206, 539 539 0.076641563419124, 0.076641563419124, 0.076641563419124, … … 552 552 0.013291658531346, 0.013291658531346, 0.013291658531346, 553 553 0.013291658531346, 0.013291658531346, 0.013291658531346}; 554 static double l115[]={554 static IssmPDouble l115[]={ 555 555 -0.013945833716486, 0.506972916858243, 0.506972916858243, 556 556 0.137187291433955, 0.431406354283023, 0.431406354283023, … … 569 569 0.012459809331199, 0.012459809331199, 0.103575616576386, 570 570 0.883964574092416, 0.103575616576386, 0.883964574092416}; 571 static double l215[]={571 static IssmPDouble l215[]={ 572 572 0.506972916858243,-0.013945833716486, 0.506972916858243, 573 573 0.431406354283023, 0.137187291433955, 0.431406354283023, … … 586 586 0.103575616576386, 0.883964574092416, 0.012459809331199, 587 587 0.012459809331199, 0.883964574092416, 0.103575616576386}; 588 static double l315[]={588 static IssmPDouble l315[]={ 589 589 0.506972916858243, 0.506972916858243,-0.013945833716486, 590 590 0.431406354283023, 0.431406354283023, 0.137187291433955, … … 603 603 0.883964574092416, 0.103575616576386, 0.883964574092416, 604 604 0.103575616576386, 0.012459809331199, 0.012459809331199}; 605 /*}}} 2*/606 /*p=16, npoint=52 {{{ 2*/607 static double wgt16[]={605 /*}}}*/ 606 /*p=16, npoint=52 {{{*/ 607 static IssmPDouble wgt16[]={ 608 608 0.081191089584902, 0.011095307165226, 0.011095307165226, 609 609 0.011095307165226, 0.072244353151393, 0.072244353151393, … … 624 624 0.011864642509229, 0.011864642509229, 0.011864642509229, 625 625 0.011864642509229}; 626 static double l116[]={626 static IssmPDouble l116[]={ 627 627 0.333333333333333, 0.005238916103123, 0.497380541948438, 628 628 0.497380541948438, 0.173061122901295, 0.413469438549352, … … 643 643 0.085283615682657, 0.900399064086661, 0.085283615682657, 644 644 0.900399064086661}; 645 static double l216[]={645 static IssmPDouble l216[]={ 646 646 0.333333333333333, 0.497380541948438, 0.005238916103123, 647 647 0.497380541948438, 0.413469438549352, 0.173061122901295, … … 662 662 0.014317320230681, 0.014317320230681, 0.900399064086661, 663 663 0.085283615682657}; 664 static double l316[]={664 static IssmPDouble l316[]={ 665 665 0.333333333333333, 0.497380541948438, 0.497380541948438, 666 666 0.005238916103123, 0.413469438549352, 0.413469438549352, … … 681 681 0.900399064086661, 0.085283615682657, 0.014317320230681, 682 682 0.014317320230681}; 683 /*}}} 2*/684 /*p=17, npoint=61{{{ 2*/685 static double wgt17[]={683 /*}}}*/ 684 /*p=17, npoint=61{{{*/ 685 static IssmPDouble wgt17[]={ 686 686 0.057914928034477, 0.008822054327014, 0.008822054327014, 687 687 0.008822054327014, 0.025410682752829, 0.025410682752829, … … 705 705 0.011545213295771, 0.011545213295771, 0.011545213295771, 706 706 0.011545213295771}; 707 static double l117[]={707 static IssmPDouble l117[]={ 708 708 0.333333333333333, 0.005658918886452, 0.497170540556774, 709 709 0.497170540556774, 0.035647354750751, 0.482176322624625, … … 727 727 0.080711313679564, 0.904625504095608, 0.080711313679564, 728 728 0.904625504095608}; 729 static double l217[]={729 static IssmPDouble l217[]={ 730 730 0.333333333333333, 0.497170540556774, 0.005658918886452, 731 731 0.497170540556774, 0.482176322624625, 0.035647354750751, … … 749 749 0.014663182224828, 0.014663182224828, 0.904625504095608, 750 750 0.080711313679564}; 751 static double l317[]={751 static IssmPDouble l317[]={ 752 752 0.333333333333333, 0.497170540556774, 0.497170540556774, 753 753 0.005658918886452, 0.482176322624625, 0.482176322624625, … … 771 771 0.904625504095608, 0.080711313679564, 0.014663182224828, 772 772 0.014663182224828}; 773 /*}}} 2*/774 /* p=18, npoint=70 {{{ 2*/775 776 static double wgt18[]={773 /*}}}*/ 774 /* p=18, npoint=70 {{{*/ 775 776 static IssmPDouble wgt18[]={ 777 777 0.053364381350150, 0.015713921277179, 0.015713921277179, 778 778 0.015713921277179, 0.032495554156279, 0.032495554156279, … … 799 799 0.000079999375178, 0.000079999375178, 0.000079999375178, 800 800 0.000079999375178}; 801 static double l118[]={801 static IssmPDouble l118[]={ 802 802 0.333333333333333, 0.013310382738157, 0.493344808630921, 803 803 0.493344808630921, 0.061578811516086, 0.469210594241957, … … 824 824 0.020874755282586, 1.014347260005363, 0.020874755282586, 825 825 1.014347260005363}; 826 static double l218[]={826 static IssmPDouble l218[]={ 827 827 0.333333333333333, 0.493344808630921, 0.013310382738157, 828 828 0.493344808630921, 0.469210594241957, 0.061578811516086, … … 849 849 -0.035222015287949,-0.035222015287949, 1.014347260005363, 850 850 0.020874755282586}; 851 static double l318[]={851 static IssmPDouble l318[]={ 852 852 0.333333333333333, 0.493344808630921, 0.493344808630921, 853 853 0.013310382738157, 0.469210594241957, 0.469210594241957, … … 874 874 1.014347260005363, 0.020874755282586,-0.035222015287949, 875 875 -0.035222015287949}; 876 /*}}} 2*/877 /*p=19, npoint=73 {{{ 2*/878 879 static double wgt19[]={876 /*}}}*/ 877 /*p=19, npoint=73 {{{*/ 878 879 static IssmPDouble wgt19[]={ 880 880 0.056995437856306, 0.017893352515055, 0.017893352515055, 881 881 0.017893352515055, 0.038775849701151, 0.038775849701151, … … 903 903 0.006581669842530, 0.006581669842530, 0.006581669842530, 904 904 0.006581669842530}; 905 static double l119[]={905 static IssmPDouble l119[]={ 906 906 0.333333333333333, 0.020780025853987, 0.489609987073006, 907 907 0.489609987073006, 0.090926214604215, 0.454536892697893, … … 929 929 0.065494628082938, 0.924344252620784, 0.065494628082938, 930 930 0.924344252620784}; 931 static double l219[]={931 static IssmPDouble l219[]={ 932 932 0.333333333333333, 0.489609987073006, 0.020780025853987, 933 933 0.489609987073006, 0.454536892697893, 0.090926214604215, … … 955 955 0.010161119296278, 0.010161119296278, 0.924344252620784, 956 956 0.065494628082938}; 957 static double l319[]={957 static IssmPDouble l319[]={ 958 958 0.333333333333333, 0.489609987073006, 0.489609987073006, 959 959 0.020780025853987, 0.454536892697893, 0.454536892697893, … … 981 981 0.924344252620784, 0.065494628082938, 0.010161119296278, 982 982 0.010161119296278}; 983 /*}}} 2*/984 /*p=20, npoint=79 {{{ 2*/985 static double wgt20[]={983 /*}}}*/ 984 /*p=20, npoint=79 {{{*/ 985 static IssmPDouble wgt20[]={ 986 986 0.057256499746719, 0.001501721280705, 0.001501721280705, 987 987 0.001501721280705, 0.020195803723819, 0.020195803723819, … … 1011 1011 0.006190192638113, 0.006190192638113, 0.006190192638113, 1012 1012 0.006190192638113}; 1013 static double l120[]={1013 static IssmPDouble l120[]={ 1014 1014 0.333333333333333,-0.001900928704400, 0.500950464352200, 1015 1015 0.500950464352200, 0.023574084130543, 0.488212957934729, … … 1039 1039 0.059696109149007, 0.929756171556853, 0.059696109149007, 1040 1040 0.929756171556853}; 1041 static double l220[]={1041 static IssmPDouble l220[]={ 1042 1042 0.333333333333333, 0.500950464352200,-0.001900928704400, 1043 1043 0.500950464352200, 0.488212957934729, 0.023574084130543, … … 1067 1067 0.010547719294141, 0.010547719294141, 0.929756171556853, 1068 1068 0.059696109149007}; 1069 static double l320[]={1069 static IssmPDouble l320[]={ 1070 1070 0.333333333333333, 0.500950464352200, 0.500950464352200, 1071 1071 -0.001900928704400, 0.488212957934729, 0.488212957934729, … … 1095 1095 0.929756171556853, 0.059696109149007, 0.010547719294141, 1096 1096 0.010547719294141}; 1097 /*}}} 2*/1098 1099 static double* wgtp[MAX_TRIA_SYM_ORD]={1097 /*}}}*/ 1098 1099 static IssmPDouble* wgtp[MAX_TRIA_SYM_ORD]={ 1100 1100 wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 , 1101 1101 wgt6 ,wgt7 ,wgt8 ,wgt9 ,wgt10, 1102 1102 wgt11,wgt12,wgt13,wgt14,wgt15, 1103 1103 wgt16,wgt17,wgt18,wgt19,wgt20}; 1104 static double* l1p [MAX_TRIA_SYM_ORD]={1104 static IssmPDouble* l1p [MAX_TRIA_SYM_ORD]={ 1105 1105 l11 ,l12 ,l13 ,l14 ,l15 , 1106 1106 l16 ,l17 ,l18 ,l19 ,l110 , 1107 1107 l111 ,l112 ,l113 ,l114 ,l115 , 1108 1108 l116 ,l117 ,l118 ,l119 ,l120 }; 1109 static double* l2p [MAX_TRIA_SYM_ORD]={1109 static IssmPDouble* l2p [MAX_TRIA_SYM_ORD]={ 1110 1110 l21 ,l22 ,l23 ,l24 ,l25 , 1111 1111 l26 ,l27 ,l28 ,l29 ,l210 , 1112 1112 l211 ,l212 ,l213 ,l214 ,l215 , 1113 1113 l216 ,l217 ,l218 ,l219 ,l220 }; 1114 static double* l3p [MAX_TRIA_SYM_ORD]={1114 static IssmPDouble* l3p [MAX_TRIA_SYM_ORD]={ 1115 1115 l31 ,l32 ,l33 ,l34 ,l35 , 1116 1116 l36 ,l37 ,l38 ,l39 ,l310 , … … 1118 1118 l316 ,l317 ,l318 ,l319 ,l320 }; 1119 1119 1120 static int np[MAX_TRIA_SYM_ORD]={sizeof(wgt1 )/sizeof( double),1121 sizeof(wgt2 )/sizeof( double),1122 sizeof(wgt3 )/sizeof( double),1123 sizeof(wgt4 )/sizeof( double),1124 sizeof(wgt5 )/sizeof( double),1125 sizeof(wgt6 )/sizeof( double),1126 sizeof(wgt7 )/sizeof( double),1127 sizeof(wgt8 )/sizeof( double),1128 sizeof(wgt9 )/sizeof( double),1129 sizeof(wgt10)/sizeof( double),1130 sizeof(wgt11)/sizeof( double),1131 sizeof(wgt12)/sizeof( double),1132 sizeof(wgt13)/sizeof( double),1133 sizeof(wgt14)/sizeof( double),1134 sizeof(wgt15)/sizeof( double),1135 sizeof(wgt16)/sizeof( double),1136 sizeof(wgt17)/sizeof( double),1137 sizeof(wgt18)/sizeof( double),1138 sizeof(wgt19)/sizeof( double),1139 sizeof(wgt20)/sizeof( double)};1140 1141 // _p rintf_(true,"GaussLegendreTria: iord=%d\n",iord);1120 static int np[MAX_TRIA_SYM_ORD]={sizeof(wgt1 )/sizeof(IssmPDouble), 1121 sizeof(wgt2 )/sizeof(IssmPDouble), 1122 sizeof(wgt3 )/sizeof(IssmPDouble), 1123 sizeof(wgt4 )/sizeof(IssmPDouble), 1124 sizeof(wgt5 )/sizeof(IssmPDouble), 1125 sizeof(wgt6 )/sizeof(IssmPDouble), 1126 sizeof(wgt7 )/sizeof(IssmPDouble), 1127 sizeof(wgt8 )/sizeof(IssmPDouble), 1128 sizeof(wgt9 )/sizeof(IssmPDouble), 1129 sizeof(wgt10)/sizeof(IssmPDouble), 1130 sizeof(wgt11)/sizeof(IssmPDouble), 1131 sizeof(wgt12)/sizeof(IssmPDouble), 1132 sizeof(wgt13)/sizeof(IssmPDouble), 1133 sizeof(wgt14)/sizeof(IssmPDouble), 1134 sizeof(wgt15)/sizeof(IssmPDouble), 1135 sizeof(wgt16)/sizeof(IssmPDouble), 1136 sizeof(wgt17)/sizeof(IssmPDouble), 1137 sizeof(wgt18)/sizeof(IssmPDouble), 1138 sizeof(wgt19)/sizeof(IssmPDouble), 1139 sizeof(wgt20)/sizeof(IssmPDouble)}; 1140 1141 // _pprintLine_("GaussLegendreTria: iord=" << iord); 1142 1142 1143 1143 /* check to see if Gauss points need to be calculated */ … … 1150 1150 *pngaus=np[iord-1]; 1151 1151 1152 *pl1 = (double *) xmalloc(*pngaus*sizeof(double));1153 *pl2 = (double *) xmalloc(*pngaus*sizeof(double));1154 *pl3 = (double *) xmalloc(*pngaus*sizeof(double));1155 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));1152 *pl1 =xNew<IssmPDouble>(*pngaus); 1153 *pl2 =xNew<IssmPDouble>(*pngaus); 1154 *pl3 =xNew<IssmPDouble>(*pngaus); 1155 *pwgt =xNew<IssmPDouble>(*pngaus); 1156 1156 1157 1157 for (i=0; i<*pngaus; i++) { … … 1168 1168 *pngaus=nigaus*nigaus; 1169 1169 1170 *pl1 = (double *) xmalloc(*pngaus*sizeof(double));1171 *pl2 = (double *) xmalloc(*pngaus*sizeof(double));1172 *pl3 = (double *) xmalloc(*pngaus*sizeof(double));1173 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));1170 *pl1 =xNew<IssmPDouble>(*pngaus); 1171 *pl2 =xNew<IssmPDouble>(*pngaus); 1172 *pl3 =xNew<IssmPDouble>(*pngaus); 1173 *pwgt =xNew<IssmPDouble>(*pngaus); 1174 1174 1175 1175 /* get the gauss points in each direction */ … … 1195 1195 } 1196 1196 } 1197 x free((void **)&xwgt );1198 x free((void **)&xgaus);1197 xDelete<IssmPDouble>(xwgt ); 1198 xDelete<IssmPDouble>(xgaus); 1199 1199 } 1200 1200 1201 // _p rintf_(true,"GaussLegendreTria - ngaus=%d\n",*pngaus);1201 // _pprintLine_("GaussLegendreTria - ngaus=" << *pngaus); 1202 1202 // for (i=0; i<*pngaus; i++) 1203 1203 // _printf_(true,"i=%d: l1gaus=%f,l2gaus=%f,l3gaus=%f,wgt=%f\n", … … 1205 1205 1206 1206 return; 1207 }/*}}} 1*/1208 /*FUNCTION GaussLegendreTetra{{{ 1*/1209 void GaussLegendreTetra( int* pngaus, double** pl1, double** pl2, double** pl3, double** pl4, double** pwgt, int iord ) {1207 }/*}}}*/ 1208 /*FUNCTION GaussLegendreTetra{{{*/ 1209 void GaussLegendreTetra( int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord ) { 1210 1210 /* Gauss quadrature points for the tetrahedron. 1211 1211 … … 1220 1220 /*Intermediaries*/ 1221 1221 int i,j,k,ipt,nigaus; 1222 double xi,eta,zeta;1223 double *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt,*zgaus,*zwgt;1222 IssmPDouble xi,eta,zeta; 1223 IssmPDouble *xgaus=NULL,*xwgt=NULL,*egaus,*ewgt,*zgaus,*zwgt; 1224 1224 1225 1225 /*Hardcoded Gauss points definition*/ 1226 /*p= 1, npoint= 1 {{{ 2*/1227 static double wgt1[]={1226 /*p= 1, npoint= 1 {{{*/ 1227 static IssmPDouble wgt1[]={ 1228 1228 1.000000000000000}; 1229 static double l11[]={1229 static IssmPDouble l11[]={ 1230 1230 0.250000000000000}; 1231 static double l21[]={1231 static IssmPDouble l21[]={ 1232 1232 0.250000000000000}; 1233 static double l31[]={1233 static IssmPDouble l31[]={ 1234 1234 0.250000000000000}; 1235 static double l41[]={1235 static IssmPDouble l41[]={ 1236 1236 0.250000000000000}; 1237 /*}}} 2*/1238 /*p= 2, npoint= 4 {{{ 2*/1239 1240 static double wgt2[]={1237 /*}}}*/ 1238 /*p= 2, npoint= 4 {{{*/ 1239 1240 static IssmPDouble wgt2[]={ 1241 1241 0.250000000000000, 0.250000000000000, 0.250000000000000, 1242 1242 0.250000000000000}; 1243 static double l12[]={1243 static IssmPDouble l12[]={ 1244 1244 0.585410196624969, 0.138196601125011, 0.138196601125011, 1245 1245 0.138196601125011}; 1246 static double l22[]={1246 static IssmPDouble l22[]={ 1247 1247 0.138196601125011, 0.585410196624969, 0.138196601125011, 1248 1248 0.138196601125011}; 1249 static double l32[]={1249 static IssmPDouble l32[]={ 1250 1250 0.138196601125011, 0.138196601125011, 0.585410196624969, 1251 1251 0.138196601125011}; 1252 static double l42[]={1252 static IssmPDouble l42[]={ 1253 1253 0.138196601125011, 0.138196601125011, 0.138196601125011, 1254 1254 0.585410196624969}; 1255 /*}}} 2*/1256 /*p= 3, npoint= 5 {{{ 2*/1257 static double wgt3[]={1255 /*}}}*/ 1256 /*p= 3, npoint= 5 {{{*/ 1257 static IssmPDouble wgt3[]={ 1258 1258 -0.800000000000000, 0.450000000000000, 0.450000000000000, 1259 1259 0.450000000000000, 0.450000000000000}; 1260 static double l13[]={1260 static IssmPDouble l13[]={ 1261 1261 0.250000000000000, 0.500000000000000, 0.166666666666667, 1262 1262 0.166666666666667, 0.166666666666667}; 1263 static double l23[]={1263 static IssmPDouble l23[]={ 1264 1264 0.250000000000000, 0.166666666666667, 0.500000000000000, 1265 1265 0.166666666666667, 0.166666666666667}; 1266 static double l33[]={1266 static IssmPDouble l33[]={ 1267 1267 0.250000000000000, 0.166666666666667, 0.166666666666667, 1268 1268 0.500000000000000, 0.166666666666667}; 1269 static double l43[]={1269 static IssmPDouble l43[]={ 1270 1270 0.250000000000000, 0.166666666666667, 0.166666666666667, 1271 1271 0.166666666666667, 0.500000000000000}; 1272 /*}}} 2*/1273 /*p= 4, npoint=11 {{{ 2*/1274 1275 static double wgt4[]={1272 /*}}}*/ 1273 /*p= 4, npoint=11 {{{*/ 1274 1275 static IssmPDouble wgt4[]={ 1276 1276 -0.013155555555556, 0.007622222222222, 0.007622222222222, 1277 1277 0.007622222222222, 0.007622222222222, 0.024888888888889, 1278 1278 0.024888888888889, 0.024888888888889, 0.024888888888889, 1279 1279 0.024888888888889, 0.024888888888889}; 1280 static double l14[]={1280 static IssmPDouble l14[]={ 1281 1281 0.250000000000000, 0.785714285714286, 0.071428571428571, 1282 1282 0.071428571428571, 0.071428571428571, 0.399403576166799, 1283 1283 0.399403576166799, 0.399403576166799, 0.100596423833201, 1284 1284 0.100596423833201, 0.100596423833201}; 1285 static double l24[]={1285 static IssmPDouble l24[]={ 1286 1286 0.250000000000000, 0.071428571428571, 0.785714285714286, 1287 1287 0.071428571428571, 0.071428571428571, 0.399403576166799, 1288 1288 0.100596423833201, 0.100596423833201, 0.399403576166799, 1289 1289 0.399403576166799, 0.100596423833201}; 1290 static double l34[]={1290 static IssmPDouble l34[]={ 1291 1291 0.250000000000000, 0.071428571428571, 0.071428571428571, 1292 1292 0.785714285714286, 0.071428571428571, 0.100596423833201, 1293 1293 0.399403576166799, 0.100596423833201, 0.399403576166799, 1294 1294 0.100596423833201, 0.399403576166799}; 1295 static double l44[]={1295 static IssmPDouble l44[]={ 1296 1296 0.250000000000000, 0.071428571428571, 0.071428571428571, 1297 1297 0.071428571428571, 0.785714285714286, 0.100596423833201, 1298 1298 0.100596423833201, 0.399403576166799, 0.100596423833201, 1299 1299 0.399403576166799, 0.399403576166799}; 1300 /*}}} 2*/1301 /*p= 5, npoint=15 {{{ 2*/1302 1303 static double wgt5[]={1300 /*}}}*/ 1301 /*p= 5, npoint=15 {{{*/ 1302 1303 static IssmPDouble wgt5[]={ 1304 1304 0.030283678097089, 0.006026785714286, 0.006026785714286, 1305 1305 0.006026785714286, 0.006026785714286, 0.011645249086029, … … 1307 1307 0.010949141561386, 0.010949141561386, 0.010949141561386, 1308 1308 0.010949141561386, 0.010949141561386, 0.010949141561386}; 1309 static double l15[]={1309 static IssmPDouble l15[]={ 1310 1310 0.250000000000000, 0.000000000000000, 0.333333333333333, 1311 1311 0.333333333333333, 0.333333333333333, 0.727272727272727, … … 1313 1313 0.066550153573664, 0.066550153573664, 0.066550153573664, 1314 1314 0.433449846426336, 0.433449846426336, 0.433449846426336}; 1315 static double l25[]={1315 static IssmPDouble l25[]={ 1316 1316 0.250000000000000, 0.333333333333333, 0.000000000000000, 1317 1317 0.333333333333333, 0.333333333333333, 0.090909090909091, … … 1319 1319 0.066550153573664, 0.433449846426336, 0.433449846426336, 1320 1320 0.066550153573664, 0.066550153573664, 0.433449846426336}; 1321 static double l35[]={1321 static IssmPDouble l35[]={ 1322 1322 0.250000000000000, 0.333333333333333, 0.333333333333333, 1323 1323 0.000000000000000, 0.333333333333333, 0.090909090909091, … … 1325 1325 0.433449846426336, 0.066550153573664, 0.433449846426336, 1326 1326 0.066550153573664, 0.433449846426336, 0.066550153573664}; 1327 static double l45[]={1327 static IssmPDouble l45[]={ 1328 1328 0.250000000000000, 0.333333333333333, 0.333333333333333, 1329 1329 0.333333333333333, 0.000000000000000, 0.090909090909091, … … 1331 1331 0.433449846426336, 0.433449846426336, 0.066550153573664, 1332 1332 0.433449846426336, 0.066550153573664, 0.066550153573664}; 1333 /*}}} 2*/1334 /*p= 6, npoint=24 {{{ 2*/1335 1336 static double wgt6[]={1333 /*}}}*/ 1334 /*p= 6, npoint=24 {{{*/ 1335 1336 static IssmPDouble wgt6[]={ 1337 1337 0.006653791709695, 0.006653791709695, 0.006653791709695, 1338 1338 0.006653791709695, 0.001679535175887, 0.001679535175887, … … 1343 1343 0.008035714285714, 0.008035714285714, 0.008035714285714, 1344 1344 0.008035714285714, 0.008035714285714, 0.008035714285714}; 1345 static double l16[]={1345 static IssmPDouble l16[]={ 1346 1346 0.356191386222545, 0.214602871259152, 0.214602871259152, 1347 1347 0.214602871259152, 0.877978124396166, 0.040673958534611, … … 1353 1353 0.269672331458316, 0.603005664791649, 0.269672331458316, 1354 1354 0.603005664791649, 0.269672331458316, 0.603005664791649}; 1355 static double l26[]={1355 static IssmPDouble l26[]={ 1356 1356 0.214602871259152, 0.356191386222545, 0.214602871259152, 1357 1357 0.214602871259152, 0.040673958534611, 0.877978124396166, … … 1363 1363 0.063661001875018, 0.063661001875018, 0.063661001875018, 1364 1364 0.063661001875018, 0.603005664791649, 0.269672331458316}; 1365 static double l36[]={1365 static IssmPDouble l36[]={ 1366 1366 0.214602871259152, 0.214602871259152, 0.356191386222545, 1367 1367 0.214602871259152, 0.040673958534611, 0.040673958534611, … … 1373 1373 0.063661001875018, 0.063661001875018, 0.603005664791649, 1374 1374 0.269672331458316, 0.063661001875018, 0.063661001875018}; 1375 static double l46[]={1375 static IssmPDouble l46[]={ 1376 1376 0.214602871259152, 0.214602871259152, 0.214602871259152, 1377 1377 0.356191386222545, 0.040673958534611, 0.040673958534611, … … 1383 1383 0.603005664791649, 0.269672331458316, 0.063661001875018, 1384 1384 0.063661001875018, 0.063661001875018, 0.063661001875018}; 1385 /*}}} 2*/1386 1387 static double* wgtp[MAX_TETRA_SYM_ORD]={wgt1,wgt2,wgt3,wgt4,wgt5,wgt6};1388 static double* l1p [MAX_TETRA_SYM_ORD]={l11 ,l12 ,l13 ,l14 ,l15 ,l16 };1389 static double* l2p [MAX_TETRA_SYM_ORD]={l21 ,l22 ,l32 ,l24 ,l25 ,l26 };1390 static double* l3p [MAX_TETRA_SYM_ORD]={l31 ,l32 ,l33 ,l34 ,l35 ,l36 };1391 static double* l4p [MAX_TETRA_SYM_ORD]={l41 ,l42 ,l43 ,l44 ,l45 ,l46 };1392 1393 static int np[MAX_TETRA_SYM_ORD]={sizeof(wgt1 )/sizeof( double),1394 sizeof(wgt2 )/sizeof( double),1395 sizeof(wgt3 )/sizeof( double),1396 sizeof(wgt4 )/sizeof( double),1397 sizeof(wgt5 )/sizeof( double),1398 sizeof(wgt6 )/sizeof( double)};1399 1400 // _p rintf_(true,"GaussLegendreTetra: iord=%d\n",iord);1385 /*}}}*/ 1386 1387 static IssmPDouble* wgtp[MAX_TETRA_SYM_ORD]={wgt1,wgt2,wgt3,wgt4,wgt5,wgt6}; 1388 static IssmPDouble* l1p [MAX_TETRA_SYM_ORD]={l11 ,l12 ,l13 ,l14 ,l15 ,l16 }; 1389 static IssmPDouble* l2p [MAX_TETRA_SYM_ORD]={l21 ,l22 ,l32 ,l24 ,l25 ,l26 }; 1390 static IssmPDouble* l3p [MAX_TETRA_SYM_ORD]={l31 ,l32 ,l33 ,l34 ,l35 ,l36 }; 1391 static IssmPDouble* l4p [MAX_TETRA_SYM_ORD]={l41 ,l42 ,l43 ,l44 ,l45 ,l46 }; 1392 1393 static int np[MAX_TETRA_SYM_ORD]={sizeof(wgt1 )/sizeof(IssmPDouble), 1394 sizeof(wgt2 )/sizeof(IssmPDouble), 1395 sizeof(wgt3 )/sizeof(IssmPDouble), 1396 sizeof(wgt4 )/sizeof(IssmPDouble), 1397 sizeof(wgt5 )/sizeof(IssmPDouble), 1398 sizeof(wgt6 )/sizeof(IssmPDouble)}; 1399 1400 // _pprintLine_("GaussLegendreTetra: iord=" << iord); 1401 1401 1402 1402 /* check to see if Gauss points need to be calculated */ … … 1410 1410 *pngaus=np[iord-1]; 1411 1411 1412 *pl1 = (double *) xmalloc(*pngaus*sizeof(double));1413 *pl2 = (double *) xmalloc(*pngaus*sizeof(double));1414 *pl3 = (double *) xmalloc(*pngaus*sizeof(double));1415 *pl4 = (double *) xmalloc(*pngaus*sizeof(double));1416 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));1412 *pl1 =xNew<IssmPDouble>(*pngaus); 1413 *pl2 =xNew<IssmPDouble>(*pngaus); 1414 *pl3 =xNew<IssmPDouble>(*pngaus); 1415 *pl4 =xNew<IssmPDouble>(*pngaus); 1416 *pwgt =xNew<IssmPDouble>(*pngaus); 1417 1417 1418 1418 for (i=0; i<*pngaus; i++) { … … 1430 1430 *pngaus=nigaus*nigaus*nigaus; 1431 1431 1432 *pl1 = (double *) xmalloc(*pngaus*sizeof(double));1433 *pl2 = (double *) xmalloc(*pngaus*sizeof(double));1434 *pl3 = (double *) xmalloc(*pngaus*sizeof(double));1435 *pl4 = (double *) xmalloc(*pngaus*sizeof(double));1436 *pwgt = (double *) xmalloc(*pngaus*sizeof(double));1432 *pl1 =xNew<IssmPDouble>(*pngaus); 1433 *pl2 =xNew<IssmPDouble>(*pngaus); 1434 *pl3 =xNew<IssmPDouble>(*pngaus); 1435 *pl4 =xNew<IssmPDouble>(*pngaus); 1436 *pwgt =xNew<IssmPDouble>(*pngaus); 1437 1437 1438 1438 /* get the gauss points in each direction */ … … 1467 1467 } 1468 1468 } 1469 x free((void **)&xwgt );1470 x free((void **)&xgaus);1469 xDelete<IssmPDouble>(xwgt ); 1470 xDelete<IssmPDouble>(xgaus); 1471 1471 } 1472 }/*}}} 1*/1473 /*FUNCTION GaussLobatto{{{ 1*/1474 void GaussLobatto( double** pxgaus, double** pxwgt, int ngaus ) {1472 }/*}}}*/ 1473 /*FUNCTION GaussLobatto{{{*/ 1474 void GaussLobatto( IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus ) { 1475 1475 /*Gauss-Lobatto quadrature points. 1476 1476 … … 1488 1488 1489 1489 int i; 1490 double *alpha,*beta;1491 double left=-1.,right= 1.;1492 double p0l=0.,p0r=0.,p1l=1.,p1r=1.,pm1l,pm1r,det;1490 IssmPDouble *alpha,*beta; 1491 IssmPDouble left=-1.,right= 1.; 1492 IssmPDouble p0l=0.,p0r=0.,p1l=1.,p1r=1.,pm1l,pm1r,det; 1493 1493 1494 1494 /*p= 1, npoint= 1 (Gauss-Legendre)*/ 1495 static double wgt1[]={2.000000000000000};1496 static double xi1[]={0.000000000000000};1495 static IssmPDouble wgt1[]={2.000000000000000}; 1496 static IssmPDouble xi1[]={0.000000000000000}; 1497 1497 1498 1498 /*p= 1, npoint= 2*/ 1499 static double wgt2[]={1.000000000000000, 1.000000000000000};1500 static double xi2[]={-1.000000000000000, 1.000000000000000};1499 static IssmPDouble wgt2[]={1.000000000000000, 1.000000000000000}; 1500 static IssmPDouble xi2[]={-1.000000000000000, 1.000000000000000}; 1501 1501 1502 1502 /*p= 3, npoint= 3*/ 1503 static double wgt3[]={0.333333333333333, 1.333333333333333, 0.333333333333333};1504 static double xi3[]={-1.000000000000000, 0.000000000000000, 1.000000000000000};1503 static IssmPDouble wgt3[]={0.333333333333333, 1.333333333333333, 0.333333333333333}; 1504 static IssmPDouble xi3[]={-1.000000000000000, 0.000000000000000, 1.000000000000000}; 1505 1505 1506 1506 /*p= 5, npoint= 4*/ 1507 static double wgt4[]={0.166666666666667, 0.833333333333333, 0.833333333333333, 0.166666666666667};1508 static double xi4[]={-1.000000000000000,-0.447213595499958, 0.447213595499958, 1.000000000000000};1507 static IssmPDouble wgt4[]={0.166666666666667, 0.833333333333333, 0.833333333333333, 0.166666666666667}; 1508 static IssmPDouble xi4[]={-1.000000000000000,-0.447213595499958, 0.447213595499958, 1.000000000000000}; 1509 1509 1510 1510 /*p= 7, npoint= 5*/ 1511 static double wgt5[]={0.100000000000000, 0.544444444444444, 0.711111111111111, 0.544444444444444, 0.100000000000000};1512 static double xi5[]={-1.000000000000000,-0.654653670707977, 0.000000000000000, 0.654653670707977, 1.000000000000000};1513 1514 static double* wgtp[MAX_LINE_GLOB_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 };1515 static double* xip [MAX_LINE_GLOB_PTS]={xi1 ,xi2 ,xi3 ,xi4 ,xi5 };1516 1517 static int np[MAX_LINE_GLOB_PTS]={sizeof(wgt1 )/sizeof( double),1518 sizeof(wgt2 )/sizeof( double),1519 sizeof(wgt3 )/sizeof( double),1520 sizeof(wgt4 )/sizeof( double),1521 sizeof(wgt5 )/sizeof( double)};1522 1523 // _p rintf_(true,"Gauss-Lobatto recurrence coefficients ngaus=%d\n",ngaus);1524 *pxgaus = (double *) xmalloc(ngaus*sizeof(double));1525 *pxwgt = (double *) xmalloc(ngaus*sizeof(double));1511 static IssmPDouble wgt5[]={0.100000000000000, 0.544444444444444, 0.711111111111111, 0.544444444444444, 0.100000000000000}; 1512 static IssmPDouble xi5[]={-1.000000000000000,-0.654653670707977, 0.000000000000000, 0.654653670707977, 1.000000000000000}; 1513 1514 static IssmPDouble* wgtp[MAX_LINE_GLOB_PTS]={wgt1 ,wgt2 ,wgt3 ,wgt4 ,wgt5 }; 1515 static IssmPDouble* xip [MAX_LINE_GLOB_PTS]={xi1 ,xi2 ,xi3 ,xi4 ,xi5 }; 1516 1517 static int np[MAX_LINE_GLOB_PTS]={sizeof(wgt1 )/sizeof(IssmPDouble), 1518 sizeof(wgt2 )/sizeof(IssmPDouble), 1519 sizeof(wgt3 )/sizeof(IssmPDouble), 1520 sizeof(wgt4 )/sizeof(IssmPDouble), 1521 sizeof(wgt5 )/sizeof(IssmPDouble)}; 1522 1523 // _pprintLine_("Gauss-Lobatto recurrence coefficients ngaus=" << ngaus); 1524 *pxgaus =xNew<IssmPDouble>(ngaus); 1525 *pxwgt =xNew<IssmPDouble>(ngaus); 1526 1526 1527 1527 /* check to see if Gauss points need to be calculated */ … … 1539 1539 1540 1540 /* calculate the Gauss points using recurrence relations */ 1541 alpha= (double *) xmalloc(ngaus*sizeof(double));1542 beta = (double *) xmalloc(ngaus*sizeof(double));1541 alpha=xNew<IssmPDouble>(ngaus); 1542 beta =xNew<IssmPDouble>(ngaus); 1543 1543 1544 1544 /* calculate the Legendre recurrence coefficients */ … … 1575 1575 /* calculate the Gauss points */ 1576 1576 GaussRecur(*pxgaus, *pxwgt, ngaus, alpha, beta ); 1577 x free((void **)&beta );1578 x free((void **)&alpha);1577 xDelete<IssmPDouble>(beta ); 1578 xDelete<IssmPDouble>(alpha); 1579 1579 } 1580 1580 1581 }/*}}} 1*/1582 /*FUNCTION GaussRecur{{{ 1*/1583 void GaussRecur( double* zero, double* weight, int n, double* alpha, double* beta ) {1581 }/*}}}*/ 1582 /*FUNCTION GaussRecur{{{*/ 1583 void GaussRecur( IssmPDouble* zero, IssmPDouble* weight, int n, IssmPDouble* alpha, IssmPDouble* beta ) { 1584 1584 /*Gauss quadrature points from recursion coefficients. 1585 1585 * … … 1589 1589 /*Intermediaries*/ 1590 1590 int i,j,k,l,m,ii,mml,iter; 1591 double p,g,r,s,c,f,b;1592 double* work;1591 IssmPDouble p,g,r,s,c,f,b; 1592 IssmPDouble* work; 1593 1593 1594 1594 if (n==1){ … … 1598 1598 } 1599 1599 1600 work= (double*)xmalloc(n*sizeof(double));1600 work=xNew<IssmPDouble>(n); 1601 1601 1602 1602 zero[0] =alpha[0]; … … 1669 1669 } while (iter < MAX_GAUS_ITER); 1670 1670 if (iter >= MAX_GAUS_ITER) { 1671 x free((void **)&work);1672 _error _("%s%i"," Max iterations exceeded for l=",MAX_GAUS_ITER);1671 xDelete<IssmPDouble>(work); 1672 _error2_("Max iterations exceeded for l=" << MAX_GAUS_ITER); 1673 1673 } 1674 1674 } … … 1698 1698 1699 1699 /*Cleanup*/ 1700 x free((void **)&work);1701 1702 }/*}}} 1*/1700 xDelete<IssmPDouble>(work); 1701 1702 }/*}}}*/ 1703 1703 1704 1704 /*Element Gauss points TO BE REMOVED*/ 1705 /*FUNCTION gaussQuad{{{ 1*/1706 void gaussQuad( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, int nigaus, int njgaus ) {1705 /*FUNCTION gaussQuad{{{*/ 1706 void gaussQuad( IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, int nigaus, int njgaus ) { 1707 1707 /*Gauss quadrature points for the quadrilaterial.*/ 1708 1708 … … 1710 1710 GaussLegendreLinear(pxgaus, pxwgt, nigaus); 1711 1711 GaussLegendreLinear(pegaus, pewgt, njgaus); 1712 }/*}}} 1*/1713 /*FUNCTION gaussHexa{{{ 1*/1714 void gaussHexa( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, double** pzgaus, double** pzwgt, int nigaus, int njgaus, int nkgaus ) {1712 }/*}}}*/ 1713 /*FUNCTION gaussHexa{{{*/ 1714 void gaussHexa( IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, IssmPDouble** pzgaus, IssmPDouble ** pzwgt, int nigaus, int njgaus, int nkgaus ) { 1715 1715 /*Gauss quadrature points for the hexahedron.*/ 1716 1716 … … 1719 1719 GaussLegendreLinear(pegaus, pewgt, njgaus); 1720 1720 GaussLegendreLinear(pzgaus, pzwgt, nkgaus); 1721 }/*}}} 1*/1721 }/*}}}*/ -
issm/trunk/src/c/shared/Numerics/GaussPoints.h
r5808 r12706 3 3 */ 4 4 5 #include "../../include/types.h" 5 6 #ifndef _GAUSSPOINTS_H 6 7 #define _GAUSSPOINTS_H 7 8 8 9 #define MAX_LINE_GAUS_PTS 4 9 void GaussLegendreLinear( double** pxgaus, double** pxwgt, int ngaus );10 void GaussLegendreLinear(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus); 10 11 #define MAX_TRIA_SYM_ORD 20 11 void GaussLegendreTria( int* pngaus, double** pl1, double** pl2, double** pl3, double** pwgt, int iord);12 void GaussLegendreTria(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pwgt, int iord); 12 13 #define MAX_TETRA_SYM_ORD 6 13 void GaussLegendreTetra( int* pngaus, double** pl1, double** pl2, double** pl3, double** pl4, double** pwgt, int iord);14 void GaussLegendreTetra(int* pngaus, IssmPDouble** pl1, IssmPDouble** pl2, IssmPDouble** pl3, IssmPDouble** pl4, IssmPDouble** pwgt, int iord); 14 15 #define MAX_LINE_GLOB_PTS 5 15 void GaussLobatto( double** pxgaus, double** pxwgt, int ngaus );16 void GaussLobatto(IssmPDouble** pxgaus, IssmPDouble** pxwgt, int ngaus); 16 17 #define MAX_GAUS_ITER 30 17 void GaussRecur( double* zero, double* weight, int n, double* alpha, double* beta);18 void GaussRecur(IssmPDouble* zero, IssmPDouble* weight, int n, IssmPDouble* alpha, IssmPDouble* beta); 18 19 19 void gaussQuad( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, int nigaus, int njgaus);20 void gaussHexa( double** pxgaus, double** pxwgt, double** pegaus, double** pewgt, double** pzgaus, double** pzwgt, int nigaus, int njgaus, int nkgaus);20 void gaussQuad(IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, int nigaus, int njgaus); 21 void gaussHexa(IssmPDouble** pxgaus, IssmPDouble** pxwgt, IssmPDouble** pegaus, IssmPDouble** pewgt, IssmPDouble** pzgaus, IssmPDouble ** pzwgt, int nigaus, int njgaus, int nkgaus); 21 22 22 23 #endif -
issm/trunk/src/c/shared/Numerics/IsInputConverged.cpp
r9883 r12706 14 14 #include "../../objects/objects.h" 15 15 16 void IsInputConverged( double* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){16 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){ 17 17 18 18 int i,j; 19 19 20 20 /*output: */ 21 double eps;21 IssmDouble eps; 22 22 23 23 /*intermediary: */ 24 double *newvalues = NULL;25 double *oldvalues = NULL;24 IssmDouble *newvalues = NULL; 25 IssmDouble *oldvalues = NULL; 26 26 int num_values; 27 double ndu = 0;28 double nu = 0;27 IssmDouble ndu = 0; 28 IssmDouble nu = 0; 29 29 30 30 if(criterion_enum==RelativeEnum){ … … 50 50 51 51 /*now, compute eps: */ 52 if( nu)eps=ndu/nu;52 if(reCast<bool>(nu))eps=ndu/nu; 53 53 else eps=0; 54 54 } 55 else _error _("%s%s%s"," convergence criterion ",EnumToStringx(criterion_enum)," not supported yet!");55 else _error2_("convergence criterion " << EnumToStringx(criterion_enum) << " not supported yet!"); 56 56 57 57 /*Assign output pointers:*/ -
issm/trunk/src/c/shared/Numerics/OptimalSearch.cpp
r9761 r12706 16 16 #include <float.h> 17 17 18 void OptimalSearch( double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs){18 void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){ 19 19 20 20 /* This routine is optimizing a given function*/ 21 21 22 22 /*function values: */ 23 double fx1,fx2,fxbest;24 double x1,x2,xmin,xbest;23 IssmDouble fx1,fx2,fxbest; 24 IssmDouble x1,x2,xmin,xbest; 25 25 26 26 /*tolerances: */ 27 double seps;28 double tolerance=1.e-4;27 IssmDouble seps; 28 IssmDouble tolerance=1.e-4; 29 29 int maxiter; 30 30 … … 41 41 //get the value of the function at the first boundary 42 42 fx1= (*f)(x1,optargs); 43 if (isnan(fx1)) _error_("Function evaluation returned NaN"); 44 _printf_(VerboseControl(),"\n Iteration x f(x) Tolerance\n\n"); 45 _printf_(VerboseControl()," %s %12.6g %12.6g %s"," N/A",x1,fx1," N/A\n"); 43 if (xIsNan<IssmDouble>(fx1)) _error2_("Function evaluation returned NaN"); 44 cout<<setprecision(5); 45 if(VerboseControl()) _pprintLine_(""); 46 if(VerboseControl()) _pprintLine_(" Iteration x f(x) Tolerance"); 47 if(VerboseControl()) _pprintLine_(""); 48 if(VerboseControl()) _pprintLine_(" N/A "<<setw(12)<<x1<<" "<<setw(12)<<fx1<<" N/A"); 46 49 47 50 //update tolerances … … 54 57 iter++; 55 58 fx2 = (*f)(x2,optargs); 56 if (isnan(fx2)) _error_("Function evaluation returned NaN"); 57 _printf_(VerboseControl()," %5i %12.6g %12.6g %12.6g\n",iter,x2,fx2,fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1)); 59 if (xIsNan<IssmDouble>(fx2)) _error2_("Function evaluation returned NaN"); 60 if(VerboseControl()) 61 _pprintLine_(" "<<setw(5)<<iter<<" "<<setw(12)<<x2<<" "<<setw(12)<<fx2<<" "<<(fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1))); 58 62 59 63 //Stop the optimization? 60 64 if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){ 61 _printf_(VerboseControl()," %s%g\n","optimization terminated: the current x satisfies the termination criteria using 'tolx' of " ,tolerance);65 if(VerboseControl()) _pprintLine_(" " << "optimization terminated: the current x satisfies the termination criteria using 'tolx' of " << tolerance); 62 66 loop=false; 63 67 } 64 68 else if (iter>=maxiter){ 65 _printf_(VerboseControl()," %s\n","exiting: Maximum number of iterations has been exceeded - increase 'maxiter'\n");69 if(VerboseControl()) _pprintLine_(" " << "exiting: Maximum number of iterations has been exceeded - increase 'maxiter'"); 66 70 loop=false; 67 71 } -
issm/trunk/src/c/shared/Numerics/OptionsFromAnalysis.cpp
r12330 r12706 22 22 /*intermediary: */ 23 23 int dummy; 24 double* analyses=NULL;24 IssmDouble* analyses=NULL; 25 25 char** strings=NULL; 26 26 char* string=NULL; … … 57 57 if (found==-1){ 58 58 /*ok, we did not find anything, this is not good! error out: */ 59 _error _("%s%s","could find neither a default analysis nor analysis ",EnumToStringx(analysis_type));59 _error2_("could find neither a default analysis nor analysis " << EnumToStringx(analysis_type)); 60 60 } 61 61 62 62 /*ok, grab the option string: */ 63 outstring= (char*)xmalloc((strlen(strings[found])+1)*sizeof(char));63 outstring=xNew<char>(strlen(strings[found])+1); 64 64 strcpy(outstring,strings[found]); 65 65 66 66 /*Free ressources*/ 67 x free((void**)&analyses);67 xDelete<IssmDouble>(analyses); 68 68 for(i=0;i<numanalyses;i++){ 69 69 string=strings[i]; 70 x free((void**)&string);70 xDelete<char>(string); 71 71 } 72 xfree((void**)&strings); 73 74 72 xDelete<char*>(strings); 75 73 return outstring; 76 74 } -
issm/trunk/src/c/shared/Numerics/PetscOptionsFromAnalysis.cpp
r11995 r12706 39 39 40 40 /*Free ressources:*/ 41 x free((void**)&options);41 xDelete<char>(options); 42 42 } -
issm/trunk/src/c/shared/Numerics/Synchronize.sh
r12330 r12706 8 8 #Get all lines of Verbosity.cpp 9 9 cat Verbosity.h | grep "bool Verbose" | awk '{print $2}' | sed -e "s/(/ /" | awk '{print $1}' | awk '{ printf "%s %s\n", NR, $0 }' >temp 10 #Build header of Verbosity.cpp {{{ 110 #Build header of Verbosity.cpp {{{ 11 11 cat <<END > Verbosity.cpp 12 12 /* … … 127 127 done 128 128 129 #Add footer of Verbosity.cpp{{{ 1129 #Add footer of Verbosity.cpp{{{ 130 130 cat <<END >> Verbosity.cpp 131 131 … … 135 135 void SetVerbosityLevel(int level){ 136 136 137 if(level<0) _error _("vebosity level should be a positive integer (user provided %i)",level);137 if(level<0) _error2_("vebosity level should be a positive integer (user provided " << level << ")"); 138 138 139 139 verbositylevel = level; … … 147 147 END 148 148 #}}} 149 #Complete verbose.m {{{ 1149 #Complete verbose.m {{{ 150 150 VERBOSEPATH="$ISSM_DIR/src/m/classes/verbose.m" 151 151 cat $VERBOSEPATH | sed "/%BEGINFIELDS/,$ d" > temp_begin -
issm/trunk/src/c/shared/Numerics/UnitConversion.cpp
r11995 r12706 3 3 */ 4 4 5 /*headers {{{ 1*/5 /*headers {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 15 15 #include "../../shared/shared.h" 16 16 17 double UnitConversionScaleFactor(int type_enum);17 IssmDouble UnitConversionScaleFactor(int type_enum); 18 18 /*}}}*/ 19 19 20 void UnitConversion( double* values, int numvalues,int direction_enum, int type_enum){20 void UnitConversion(IssmDouble* values, int numvalues,int direction_enum, int type_enum){ 21 21 22 double scale;22 IssmDouble scale; 23 23 int i; 24 24 … … 29 29 if(direction_enum==IuToExtEnum) for(i=0;i<numvalues;i++)values[i]=values[i]*scale; 30 30 else if(direction_enum==ExtToIuEnum) for(i=0;i<numvalues;i++)values[i]=values[i]/scale; 31 else _error _("wrong direction for unit conversion, either IuToExtEnum or ExtToIuEnum. ");31 else _error2_("wrong direction for unit conversion, either IuToExtEnum or ExtToIuEnum. "); 32 32 33 33 } 34 34 35 double UnitConversion(double value, int direction_enum, int type_enum){35 IssmDouble UnitConversion(IssmDouble value, int direction_enum, int type_enum){ 36 36 37 37 UnitConversion(&value,1,direction_enum,type_enum); … … 41 41 42 42 43 double UnitConversionScaleFactor(int type_enum){43 IssmDouble UnitConversionScaleFactor(int type_enum){ 44 44 45 double yts=365.0*24.0*3600.0;45 IssmDouble yts=365.0*24.0*3600.0; 46 46 47 double scale;47 IssmDouble scale; 48 48 switch(type_enum){ 49 49 case TimesteppingStartTimeEnum: scale=1.0/yts;break; //yr … … 66 66 case SurfaceforcingsPrecipitationEnum: scale=yts;break; //m/yr 67 67 case SurfaceforcingsMassBalanceEnum: scale=yts;break; //m/yr 68 case SurfaceforcingsSmbPosMaxEnum: scale=yts;break; //m/yr 69 case SurfaceforcingsSmbPosMinEnum: scale=yts;break; //m/yr 70 case SurfaceforcingsAPosEnum: scale=yts;break; //m/yr 71 case SurfaceforcingsBPosEnum: scale=yts;break; //m/yr 72 case SurfaceforcingsANegEnum: scale=yts;break; //m/yr 73 case SurfaceforcingsBNegEnum: scale=yts;break; //m/yr 68 74 case MisfitEnum: scale=pow(yts,2);break; //(m/yr)^2 69 case MassFluxEnum: scale=pow(( double)10,-12)*yts;break; // (GigaTon/year)75 case MassFluxEnum: scale=pow((IssmDouble)10,-12)*yts;break; // (GigaTon/year) 70 76 default: scale=1.0; break; 71 77 } -
issm/trunk/src/c/shared/Numerics/Verbosity.cpp
r12330 r12706 34 34 void SetVerbosityLevel(int level){ 35 35 36 if(level<0) _error _("vebosity level should be a positive integer (user provided %i)",level);36 if(level<0) _error2_("vebosity level should be a positive integer (user provided " << level << ")"); 37 37 38 38 verbositylevel = level; -
issm/trunk/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp
r12330 r12706 5 5 #include <math.h> 6 6 7 void XZvectorsToCoordinateSystem( double* T,double* xzvectors){7 void XZvectorsToCoordinateSystem(IssmDouble* T,IssmDouble* xzvectors){ 8 8 9 9 int i,j; 10 double x[3],y[3],z[3];11 double x_norm, y_norm, z_norm;10 IssmDouble x[3],y[3],z[3]; 11 IssmDouble x_norm, y_norm, z_norm; 12 12 13 13 for(i=0;i<6;i++){ 14 if( isnan(xzvectors[i])){14 if(xIsNan<IssmDouble>(xzvectors[i])){ 15 15 /*At least one NaN found: default to Id*/ 16 16 T[0*3+0] = 1.0; T[0*3+1] = 0.0; T[0*3+2] = 0.0; -
issm/trunk/src/c/shared/Numerics/cross.cpp
r9320 r12706 9 9 #endif 10 10 11 void cross(double* result,double* vector1,double* vector2){ 11 #include "../../include/include.h" 12 13 void cross(IssmDouble* result,IssmDouble* vector1,IssmDouble* vector2){ 12 14 13 15 /*result,vector1 and vector2 are all assumed to be of size 3: */ -
issm/trunk/src/c/shared/Numerics/extrema.cpp
r9320 r12706 9 9 #endif 10 10 11 #include "../../include/include.h" 11 12 12 double min(double a,double b){13 IssmDouble min(IssmDouble a,IssmDouble b){ 13 14 if (a<b)return a; 14 15 else return b; … … 18 19 else return b; 19 20 } 20 double max(double a,double b){21 IssmDouble max(IssmDouble a,IssmDouble b){ 21 22 if (a>b)return a; 22 23 else return b; -
issm/trunk/src/c/shared/Numerics/isnan.cpp
r2241 r12706 1 1 /*This routine only used by Intel compler: */ 2 #ifdef _INTEL_WIN_3 2 4 int isnan(double x){ 5 if (x!=x)return 1; 6 else return 0; 3 #include "../../include/include.h" 4 #include "isnan.h" 5 6 #ifdef _HAVE_ADOLC_ 7 template <> int xIsNan<adouble> (const adouble& X) { 8 return isnan(X.getValue()); 7 9 } 8 10 #endif 9 -
issm/trunk/src/c/shared/Numerics/isnan.h
r2241 r12706 3 3 */ 4 4 5 #ifndef _ ISNAN_INTEL_H_6 #define _ ISNAN_INTEL_H_5 #ifndef _XISNAN_H_ 6 #define _XISNAN_H_ 7 7 8 #include <cmath> 9 10 template <class T> int xIsNan(const T& X) { 8 11 #ifdef _INTEL_WIN_ 9 int isnan(double X); 12 return (X!=X)?1:0; 13 #else 14 return isnan(X); 15 #endif 16 } 17 18 #ifdef _HAVE_ADOLC_ 19 template <> int xIsNan<adouble> (const adouble& X); 10 20 #endif 11 21 12 22 #endif 13 -
issm/trunk/src/c/shared/Numerics/numerics.h
r11995 r12706 9 9 #include "./GaussPoints.h" 10 10 #include "./isnan.h" 11 #include "./recast.h" 11 12 12 13 class Input; … … 16 17 struct OptPars; 17 18 18 double min(double a,double b);19 double max(double a,double b);19 IssmDouble min(IssmDouble a,IssmDouble b); 20 IssmDouble max(IssmDouble a,IssmDouble b); 20 21 int min(int a,int b); 21 22 int max(int a,int b); 22 double OptFunc(double scalar, OptArgs* optargs);23 void BrentSearch( double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs);24 void OptimalSearch( double* psearch_scalar,double* pJ,OptPars* optpars,double (*f)(double,OptArgs*), OptArgs* optargs);25 void cross( double* result,double* vector1,double* vector2);26 void IsInputConverged( double* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum);27 void UnitConversion( double* values, int numvalues,int direction_enum, int type_enum);28 double UnitConversion(double value, int direction_enum, int type_enum);23 IssmDouble OptFunc(IssmDouble scalar, OptArgs* optargs); 24 void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs); 25 void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs); 26 void cross(IssmDouble* result,IssmDouble* vector1,IssmDouble* vector2); 27 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum); 28 void UnitConversion(IssmDouble* values, int numvalues,int direction_enum, int type_enum); 29 IssmDouble UnitConversion(IssmDouble value, int direction_enum, int type_enum); 29 30 char* OptionsFromAnalysis(Parameters* parameters,int analysis_type); 30 void XZvectorsToCoordinateSystem( double* T,double* xzvectors);31 void XZvectorsToCoordinateSystem(IssmDouble* T,IssmDouble* xzvectors); 31 32 #ifdef _HAVE_PETSC_ 32 33 void PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type); -
issm/trunk/src/c/shared/String/DescriptorIndex.cpp
r9336 r12706 23 23 /*retrieve first token, separated by underscore: */ 24 24 pch = strtok (descriptor,"_"); 25 if(!pch)_error _("%s%s%s"," descriptor ",descriptor," is not correctly formatted!");25 if(!pch)_error2_("descriptor " << descriptor << " is not correctly formatted!"); 26 26 27 27 if (strncmp(pch,"scaled",6)==0){ 28 28 /*we have a scaled variable. recover the root: */ 29 29 pch = strtok (NULL, "_"); 30 if(!pch)_error _("%s%s%s"," scaled descriptor ",descriptor," is not correctly formatted!");30 if(!pch)_error2_("scaled descriptor " << descriptor << " is not correctly formatted!"); 31 31 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 32 32 … … 44 44 /*we have an indexed variable. recover the root: */ 45 45 pch = strtok (NULL, "_"); 46 if(!pch)_error _("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");46 if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!"); 47 47 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 48 48 /*now recover the index: */ 49 49 pch = strtok (NULL, "_"); 50 if(!pch)_error _("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");50 if(!pch)_error2_("indexed descriptor " << descriptor << " is not correctly formatted!"); 51 51 sscanf(pch,"%i",pindex); 52 52 return IndexedEnum; … … 55 55 /*we have an indexed variable. recover the root: */ 56 56 pch = strtok (NULL, "_"); 57 if(!pch)_error _("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");57 if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!"); 58 58 memcpy(root,pch,(strlen(pch)+1)*sizeof(char)); 59 59 /*now recover the index: */ 60 60 pch = strtok (NULL, "_"); 61 if(!pch)_error _("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");61 if(!pch)_error2_("nodal descriptor " << descriptor << " is not correctly formatted!"); 62 62 sscanf(pch,"%i",pindex); 63 63 return NodalEnum; -
issm/trunk/src/c/shared/Threads/LaunchThread.cpp
r12330 r12706 20 20 21 21 #include "./issm_threads.h" 22 #include "../Alloc/ alloc.h"22 #include "../Alloc/xNewDelete.h" 23 23 #include "../Exceptions/exceptions.h" 24 24 #include "../../include/include.h" … … 28 28 #ifdef _MULTITHREADING_ 29 29 int i; 30 int* status=NULL; 31 32 pthread_t* threads=NULL; 33 pthread_handle* handles=NULL; 30 int *status = NULL; 31 pthread_t *threads = NULL; 32 pthread_handle *handles = NULL; 34 33 35 34 /*dynamically allocate: */ 36 threads= (pthread_t*)xmalloc(num_threads*sizeof(pthread_t));37 handles= (pthread_handle*)xmalloc(num_threads*sizeof(pthread_handle));35 threads=xNew<pthread_t>(num_threads); 36 handles=xNew<pthread_handle>(num_threads); 38 37 39 38 for(i=0;i<num_threads;i++){ … … 42 41 handles[i].num=num_threads; 43 42 } 44 45 43 for(i=0;i<num_threads;i++){ 46 44 47 45 if(pthread_create(threads+i,NULL,function,(void*)(handles+i))){ 48 _error _("pthread_create error");46 _error2_("pthread_create error"); 49 47 } 50 48 } 51 49 for(i=0;i<num_threads;i++){ 52 50 if(pthread_join(threads[i],(void**)&status)){ 53 _error _("pthread_join error");51 _error2_("pthread_join error"); 54 52 } 55 53 } 56 54 57 55 /*Free ressources:*/ 58 x free((void**)&threads);59 x free((void**)&handles);56 xDelete<pthread_t>(threads); 57 xDelete<pthread_handle>(handles); 60 58 61 59 #else -
issm/trunk/src/c/shared/TriMesh/SplitMeshForRifts.cpp
r12330 r12706 3 3 */ 4 4 #include "./trimesh.h" 5 5 #include "../Alloc/xNewDelete.h" 6 6 #include "../Alloc/alloc.h" 7 7 … … 52 52 53 53 /*Go through all nodes of the rift segments, and start splitting the mesh: */ 54 flags= (int*)xcalloc(nods,sizeof(int)); //to make sure we don't split the same nodes twice!54 flags=xNewZeroInit<int>(nods); //to make sure we don't split the same nodes twice! 55 55 for (i=0;i<nriftsegs;i++){ 56 56 for (j=0;j<2;j++){ -
issm/trunk/src/c/shared/TriMesh/TriMeshUtils.cpp
r12330 r12706 7 7 #include "./trimesh.h" 8 8 #include "../Exceptions/exceptions.h" 9 #include "../Alloc/xNewDelete.h" 9 10 #include "../Alloc/alloc.h" 10 11 #include "../../include/include.h" … … 53 54 current_size=max_number_elements; 54 55 NumGridElements=0; 55 GridElements= (int*)xmalloc(max_number_elements*sizeof(int));56 GridElements=xNew<int>(max_number_elements); 56 57 57 58 for (i=0;i<nel;i++){ … … 65 66 else{ 66 67 /*Reallocate another max_number_elements slots in the GridElements: */ 67 GridElementsRealloc= (int*)xrealloc(GridElements,(current_size+max_number_elements)*sizeof(int));68 GridElementsRealloc=xReNew<int>(GridElements,current_size,(current_size+max_number_elements)); 68 69 if (!GridElementsRealloc){ 69 70 noerr=0; … … 81 82 cleanup_and_return: 82 83 if(!noerr){ 83 x free((void**)&GridElements);84 xDelete<int>(GridElements); 84 85 } 85 86 /*Allocate return pointers: */ … … 128 129 129 130 /*Allocate segmentflags: */ 130 riftsegments_uncompressed= (int*)xcalloc(nsegs*5,sizeof(int));131 riftsegments_uncompressed=xNewZeroInit<int>(nsegs*5); 131 132 132 133 /*Find the segments that belong to a rift: they are the ones that see two elements. The other ones belong to a boundary … … 165 166 166 167 /*Compress riftsegments_uncompressed:*/ 167 riftsegments= (int*)xmalloc(nriftsegs*4*sizeof(int));168 riftsegments=xNew<int>(nriftsegs*4); 168 169 counter=0; 169 170 for (i=0;i<nsegs;i++){ … … 177 178 } 178 179 179 x free((void**)&riftsegments_uncompressed);180 xDelete<int>(riftsegments_uncompressed); 180 181 181 182 /*Assign output pointers: */ … … 202 203 /*Figure out the list of elements that are on the same side of the rift. To do so, we start from one 203 204 * side of the rift and keep rotating in the same direction:*/ 204 GridElementListOnOneSideOfRift= (int*)xmalloc(NumGridElements*sizeof(int));205 GridElementListOnOneSideOfRift=xNew<int>(NumGridElements); 205 206 //bootstrap the GridElementListOnOneSideOfRift by filling elements from riftsegments: */ 206 207 GridElementListOnOneSideOfRift[0]=*(riftsegments+4*segmentnumber+0); /*this one does not belong to the same side, but is just there … … 241 242 242 243 /*Free ressources: */ 243 x free((void**)&GridElements);244 xDelete<int>(GridElements); 244 245 /*Assign output pointers: */ 245 246 *pNumGridElementListOnOneSideOfRift=NumGridElementListOnOneSideOfRift; … … 380 381 381 382 /*input: */ 382 double * segments=NULL;383 double * segmentmarkerlist=NULL;383 double *segments = NULL; 384 double *segmentmarkerlist = NULL; 384 385 int numsegs; 385 386 386 387 /*output: */ 387 int * riftsnumsegs=NULL;388 double** riftssegments=NULL;389 int new_numsegs;390 double * new_segments=NULL;391 double * new_segmentmarkers=NULL;388 int new_numsegs; 389 int *riftsnumsegs = NULL; 390 double **riftssegments = NULL; 391 double *new_segments = NULL; 392 double *new_segmentmarkers = NULL; 392 393 393 394 /*intermediary: */ … … 406 407 /*Allocate new segments: */ 407 408 new_numsegs=counter; 408 new_segments= (double*)xmalloc(new_numsegs*3*sizeof(double));409 new_segmentmarkers= (double*)xmalloc(new_numsegs*sizeof(double));409 new_segments=xNew<double>(new_numsegs*3); 410 new_segmentmarkers=xNew<double>(new_numsegs); 410 411 411 412 /*Copy new segments info : */ … … 422 423 423 424 /*Now deal with rift segments: */ 424 riftsnumsegs= (int*)xmalloc(numrifts*sizeof(int));425 riftssegments= (double**)xmalloc(numrifts*sizeof(double*));425 riftsnumsegs=xNew<int>(numrifts); 426 riftssegments=xNew<double*>(numrifts); 426 427 for (i=0;i<numrifts;i++){ 427 428 /*Figure out how many segments for rift i: */ … … 431 432 } 432 433 riftsnumsegs[i]=counter; 433 riftsegment= (double*)xmalloc(counter*3*sizeof(double));434 riftsegment=xNew<double>(counter*3); 434 435 /*Copy new segments info :*/ 435 436 counter=0; … … 446 447 447 448 /*Free ressources: */ 448 x free((void**)&segments);449 xDelete<double>(segments); 449 450 450 451 /*Assign output pointers: */ … … 465 466 466 467 /*output: */ 467 int * riftsnumpairs=NULL;468 double ** riftspairs=NULL;468 int *riftsnumpairs = NULL; 469 double **riftspairs = NULL; 469 470 470 471 /*intermediary :*/ … … 474 475 int node1,node2,node3,node4; 475 476 476 riftsnumpairs= (int*)xmalloc(numrifts*sizeof(int));477 riftspairs= (double**)xmalloc(numrifts*sizeof(double*));477 riftsnumpairs=xNew<int>(numrifts); 478 riftspairs=xNew<double*>(numrifts); 478 479 for (i=0;i<numrifts;i++){ 479 480 segments=riftssegments[i]; 480 481 numsegs=riftsnumsegments[i]; 481 482 riftsnumpairs[i]=numsegs; 482 pairs= (double*)xmalloc(2*numsegs*sizeof(double));483 pairs=xNew<double>(2*numsegs); 483 484 for (j=0;j<numsegs;j++){ 484 485 *(pairs+2*j+0)=*(segments+3*j+2); //retrieve element to which this segment belongs. … … 500 501 } 501 502 502 503 503 /*Assign output pointers: */ 504 504 *priftsnumpairs=riftsnumpairs; 505 505 *priftspairs=riftspairs; 506 507 506 return noerr; 508 507 }/*}}}*/ … … 522 521 523 522 /*intermediary: */ 524 double * riftsegments=NULL;525 double * riftpairs=NULL;523 double *riftsegments = NULL; 524 double *riftpairs = NULL; 526 525 int node1,node2,node3,node4,temp_node; 527 526 double el2; 528 527 int newnods; //temporary # node counter. 529 528 double xmin,ymin; 530 double * xreal=NULL;531 double * yreal=NULL;532 int * nodes=NULL;533 int * mergingnodes=NULL;529 double *xreal = NULL; 530 double *yreal = NULL; 531 int *nodes = NULL; 532 int *mergingnodes = NULL; 534 533 int max_size; 535 534 int redundant; 536 537 535 538 536 /*Recover input: */ … … 562 560 max_size+=rifts1numsegs[i]; 563 561 } 564 nodes= (int*)xmalloc(max_size*sizeof(int));565 mergingnodes= (int*)xmalloc(max_size*sizeof(int));562 nodes=xNew<int>(max_size); 563 mergingnodes=xNew<int>(max_size); 566 564 567 565 /*Go through the rifts segments, and identify which node we are going to merge with its counterpart on the other side … … 678 676 } 679 677 } 680 x free((void**)&x); x=xreal;681 x free((void**)&y); y=yreal;678 xDelete<double>(x); x=xreal; 679 xDelete<double>(y); y=yreal; 682 680 683 681 /*Assign output pointers:*/ … … 688 686 *psegments=segments; 689 687 *pnumsegs=numsegs; 690 691 688 return noerr; 692 689 }/*}}}*/ … … 716 713 *priftflag=riftflag; 717 714 *pnumrifts=numrifts; 718 719 715 return noerr; 720 716 }/*}}}*/ … … 726 722 727 723 /*intermediary: */ 728 double * riftsegments=NULL;729 double * riftpairs=NULL;724 double *riftsegments = NULL; 725 double *riftpairs = NULL; 730 726 int numsegs; 731 727 732 728 /*ordering and copy: */ 733 int * order=NULL;734 double * riftsegments_copy=NULL;735 double * riftpairs_copy=NULL;729 int *order = NULL; 730 double *riftsegments_copy = NULL; 731 double *riftpairs_copy = NULL; 736 732 737 733 /*node and element manipulation: */ … … 744 740 745 741 /*Allocate byproduct of this routine, riftstips: */ 746 riftstips= (double*)xmalloc(numrifts*2*sizeof(double));742 riftstips=xNew<double>(numrifts*2); 747 743 748 744 /*Go through all rifts: */ … … 754 750 /*Allocate copy of riftsegments and riftpairs, 755 751 *as well as ordering vector: */ 756 riftsegments_copy= (double*)xmalloc(numsegs*3*sizeof(double));757 riftpairs_copy= (double*)xmalloc(numsegs*2*sizeof(double));758 order= (int*)xmalloc(numsegs*sizeof(int));752 riftsegments_copy=xNew<double>(numsegs*3); 753 riftpairs_copy=xNew<double>(numsegs*2); 754 order=xNew<int>(numsegs); 759 755 760 756 /*First find the tips, using the pairs. If a pair of elements has one node in common, this node is a rift tip: */ … … 814 810 *(riftstips+2*i+0)=(double)tip1; 815 811 *(riftstips+2*i+1)=(double)tip2; 816 817 812 818 813 /*We have the two tips for this rift. Go from tip1 to tip2, and figure out the order in which segments are sequential. … … 865 860 } 866 861 867 x free((void**)&order);868 x free((void**)&riftsegments_copy);869 x free((void**)&riftpairs_copy);862 xDelete<int>(order); 863 xDelete<double>(riftsegments_copy); 864 xDelete<double>(riftpairs_copy); 870 865 871 866 } … … 887 882 888 883 /*output: */ 889 double ** riftspenaltypairs=NULL;890 double * riftpenaltypairs=NULL;891 int * riftsnumpenaltypairs=NULL;884 double **riftspenaltypairs = NULL; 885 double *riftpenaltypairs = NULL; 886 int *riftsnumpenaltypairs = NULL; 892 887 893 888 /*intermediary: */ … … 901 896 902 897 /*Allocate: */ 903 riftspenaltypairs= (double**)xmalloc(numrifts*sizeof(double*));904 riftsnumpenaltypairs= (int*)xmalloc(numrifts*sizeof(int));898 riftspenaltypairs=xNew<double*>(numrifts); 899 riftsnumpenaltypairs=xNew<int>(numrifts); 905 900 906 901 for(i=0;i<numrifts;i++){ … … 910 905 911 906 /*allocate riftpenaltypairs, and riftnumpenaltypairs: */ 912 if((numsegs/2-1)!=0)riftpenaltypairs= (double*)xcalloc((numsegs/2-1)*RIFTPENALTYPAIRSWIDTH,sizeof(double));907 if((numsegs/2-1)!=0)riftpenaltypairs=xNewZeroInit<double>((numsegs/2-1)*RIFTPENALTYPAIRSWIDTH); 913 908 914 909 /*Go through only one flank of the rifts, not counting the tips: */ … … 1006 1001 riftsnumpenaltypairs[i]=(numsegs/2-1); 1007 1002 } 1008 1009 1010 1003 1011 1004 /*Assign output pointers: */ 1012 1005 *priftspenaltypairs=riftspenaltypairs; 1013 1006 *priftsnumpenaltypairs=riftsnumpenaltypairs; 1014 1015 1007 return noerr; 1016 1008 } … … 1143 1135 *py=y; 1144 1136 *pnods=nods; 1145 1146 1137 return noerr; 1147 1138 } -
issm/trunk/src/c/shared/shared.h
r12330 r12706 6 6 #define _SHARED_H_ 7 7 8 9 8 #include "Alloc/alloc.h" 10 9 #include "Alloc/alloc_module.h" 10 #include "Alloc/xNewDelete.h" 11 #include "Bamg/shared.h" 12 #include "Elements/elements.h" 11 13 #include "Exceptions/exceptions.h" 12 14 #include "Exp/exp.h" 15 #include "Matrix/matrix.h" 16 #include "MemOps/xMemCpy.h" 17 #include "Numerics/numerics.h" 18 #include "Sorting/sorting.h" 19 #include "Sys/sys.h" 20 #include "Threads/issm_threads.h" 13 21 #include "TriMesh/trimesh.h" 14 #include "Sorting/sorting.h"15 #include "Elements/elements.h"16 #include "Matrix/matrix.h"17 #include "Numerics/numerics.h"18 #include "Dofs/dofs.h"19 #include "Threads/issm_threads.h"20 #include "Bamg/shared.h"21 22 #include "Wrapper/wrappershared.h" 22 23 -
issm/trunk/src/c/solutions/AdjointCorePointerFromSolutionEnum.cpp
r9320 r12706 35 35 break; 36 36 default: 37 _error _("No adjoint has been implemented for solution %s yet",EnumToStringx(solutiontype));37 _error2_("No adjoint has been implemented for solution " << EnumToStringx(solutiontype) << " yet"); 38 38 break; 39 39 } -
issm/trunk/src/c/solutions/AnalysisConfiguration.cpp
r11995 r12706 29 29 case DiagnosticSolutionEnum: 30 30 numanalyses=5; 31 analyses= (int*)xmalloc(numanalyses*sizeof(int));31 analyses=xNew<int>(numanalyses); 32 32 analyses[0]=DiagnosticHorizAnalysisEnum; 33 33 analyses[1]=DiagnosticVertAnalysisEnum; … … 39 39 case SteadystateSolutionEnum: 40 40 numanalyses=8; 41 analyses= (int*)xmalloc(numanalyses*sizeof(int));41 analyses=xNew<int>(numanalyses); 42 42 analyses[0]=DiagnosticHorizAnalysisEnum; 43 43 analyses[1]=DiagnosticVertAnalysisEnum; … … 52 52 case ThermalSolutionEnum: 53 53 numanalyses=2; 54 analyses= (int*)xmalloc(numanalyses*sizeof(int));54 analyses=xNew<int>(numanalyses); 55 55 analyses[0]=ThermalAnalysisEnum; 56 56 analyses[1]=MeltingAnalysisEnum; … … 59 59 case EnthalpySolutionEnum: 60 60 numanalyses=1; 61 analyses= (int*)xmalloc(numanalyses*sizeof(int));61 analyses=xNew<int>(numanalyses); 62 62 analyses[0]=EnthalpyAnalysisEnum; 63 63 break; … … 65 65 case HydrologySolutionEnum: 66 66 numanalyses=3; 67 analyses= (int*)xmalloc(numanalyses*sizeof(int));67 analyses=xNew<int>(numanalyses); 68 68 analyses[0]=HydrologyAnalysisEnum; 69 69 analyses[1]=SurfaceSlopeAnalysisEnum; … … 73 73 case PrognosticSolutionEnum: 74 74 numanalyses=1; 75 analyses= (int*)xmalloc(numanalyses*sizeof(int));75 analyses=xNew<int>(numanalyses); 76 76 analyses[0]=PrognosticAnalysisEnum; 77 77 break; … … 79 79 case BalancethicknessSolutionEnum: 80 80 numanalyses=1; 81 analyses= (int*)xmalloc(numanalyses*sizeof(int));81 analyses=xNew<int>(numanalyses); 82 82 analyses[0]=BalancethicknessAnalysisEnum; 83 83 break; … … 85 85 case SurfaceSlopeSolutionEnum: 86 86 numanalyses=1; 87 analyses= (int*)xmalloc(numanalyses*sizeof(int));87 analyses=xNew<int>(numanalyses); 88 88 analyses[0]=SurfaceSlopeAnalysisEnum; 89 89 break; … … 91 91 case BedSlopeSolutionEnum: 92 92 numanalyses=1; 93 analyses= (int*)xmalloc(numanalyses*sizeof(int));93 analyses=xNew<int>(numanalyses); 94 94 analyses[0]=BedSlopeAnalysisEnum; 95 95 break; … … 97 97 case TransientSolutionEnum: 98 98 numanalyses=9; 99 analyses= (int*)xmalloc(numanalyses*sizeof(int));99 analyses=xNew<int>(numanalyses); 100 100 analyses[0]=DiagnosticHorizAnalysisEnum; 101 101 analyses[1]=DiagnosticVertAnalysisEnum; … … 110 110 111 111 default: 112 _error _("%s%s%s"," solution type: ",EnumToStringx(solutiontype)," not supported yet!");112 _error2_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); 113 113 break; 114 114 } … … 117 117 if(pnumanalyses) *pnumanalyses=numanalyses; 118 118 if(panalyses) *panalyses=analyses; 119 else x free((void**)&analyses);119 else xDelete<int>(analyses); 120 120 } -
issm/trunk/src/c/solutions/CorePointerFromSolutionEnum.cpp
r10287 r12706 29 29 solutioncore=&diagnostic_core; 30 30 #else 31 _error _("ISSM was not compiled with diagnostic capabilities. Exiting");31 _error2_("ISSM was not compiled with diagnostic capabilities. Exiting"); 32 32 #endif 33 33 break; … … 36 36 solutioncore=&steadystate_core; 37 37 #else 38 _error _("ISSM was not compiled with steady state capabilities. Exiting");38 _error2_("ISSM was not compiled with steady state capabilities. Exiting"); 39 39 #endif 40 40 break; … … 43 43 solutioncore=&thermal_core; 44 44 #else 45 _error _("ISSM was not compiled with thermal capabilities. Exiting");45 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 46 46 #endif 47 47 break; … … 50 50 solutioncore=&enthalpy_core; 51 51 #else 52 _error _("ISSM was not compiled with thermal capabilities. Exiting");52 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 53 53 #endif 54 54 break; … … 57 57 solutioncore=&balancethickness_core; 58 58 #else 59 _error _("ISSM was not compiled with balanced capabilities. Exiting");59 _error2_("ISSM was not compiled with balanced capabilities. Exiting"); 60 60 #endif 61 61 break; … … 64 64 solutioncore=&hydrology_core; 65 65 #else 66 _error _("ISSM was not compiled with hydrology capabilities. Exiting");66 _error2_("ISSM was not compiled with hydrology capabilities. Exiting"); 67 67 #endif 68 68 break; … … 71 71 solutioncore=&surfaceslope_core; 72 72 #else 73 _error _("ISSM was not compiled with slope capabilities. Exiting");73 _error2_("ISSM was not compiled with slope capabilities. Exiting"); 74 74 #endif 75 75 break; … … 78 78 solutioncore=&bedslope_core; 79 79 #else 80 _error _("ISSM was not compiled with slope capabilities. Exiting");80 _error2_("ISSM was not compiled with slope capabilities. Exiting"); 81 81 #endif 82 82 break; … … 85 85 solutioncore=&transient_core; 86 86 #else 87 _error _("ISSM was not compiled with transient capabilities. Exiting");87 _error2_("ISSM was not compiled with transient capabilities. Exiting"); 88 88 #endif 89 89 break; … … 92 92 solutioncore=&prognostic_core; 93 93 #else 94 _error _("ISSM was not compiled with prognostic capabilities. Exiting");94 _error2_("ISSM was not compiled with prognostic capabilities. Exiting"); 95 95 #endif 96 96 break; 97 97 default: 98 _error _("%s%s%s"," solution type: ",EnumToStringx(solutiontype)," not supported yet!");98 _error2_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); 99 99 break; 100 100 } -
issm/trunk/src/c/solutions/ProcessArguments.cpp
r12330 r12706 17 17 char *lockfilename = NULL; 18 18 19 if(argc<2)_error _("Usage error: no solution requested");19 if(argc<2)_error2_("Usage error: no solution requested"); 20 20 *solution_type=StringToEnumx(argv[1]); 21 if(argc<3)_error _("Usage error: missing model name");21 if(argc<3)_error2_("Usage error: missing model name"); 22 22 modelname=argv[3]; 23 binfilename = (char*)xmalloc((strlen(modelname)+strlen(".bin") +1)*sizeof(char)); sprintf(binfilename, "%s%s",modelname,".bin");24 outbinfilename = (char*)xmalloc((strlen(modelname)+strlen(".outbin")+1)*sizeof(char)); sprintf(outbinfilename,"%s%s",modelname,".outbin");25 petscfilename = (char*)xmalloc((strlen(modelname)+strlen(".petsc") +1)*sizeof(char)); sprintf(petscfilename, "%s%s",modelname,".petsc");26 lockfilename = (char*)xmalloc((strlen(modelname)+strlen(".lock") +1)*sizeof(char)); sprintf(lockfilename, "%s%s",modelname,".lock");23 binfilename = xNew<char>(strlen(modelname)+strlen(".bin") +1); sprintf(binfilename, "%s%s",modelname,".bin"); 24 outbinfilename = xNew<char>(strlen(modelname)+strlen(".outbin")+1); sprintf(outbinfilename,"%s%s",modelname,".outbin"); 25 petscfilename = xNew<char>(strlen(modelname)+strlen(".petsc") +1); sprintf(petscfilename, "%s%s",modelname,".petsc"); 26 lockfilename = xNew<char>(strlen(modelname)+strlen(".lock") +1); sprintf(lockfilename, "%s%s",modelname,".lock"); 27 27 28 28 /*Clean up and assign output pointer*/ -
issm/trunk/src/c/solutions/ResetBoundaryConditions.cpp
r11995 r12706 15 15 int i; 16 16 17 _printf_(VerboseSolution(),"%s\n"," updating boundary conditions...");17 if(VerboseSolution()) _pprintLine_(" updating boundary conditions..."); 18 18 19 19 /*set current analysis: */ -
issm/trunk/src/c/solutions/WriteLockFile.cpp
r9320 r12706 17 17 if(my_rank==0){ 18 18 fid=fopen(filename,"w"); 19 if(fid==NULL) _error _("%s%s","error message: could not open lock file ",filename);19 if(fid==NULL) _error2_("error message: could not open lock file " << filename); 20 20 21 21 /*Close file: */ 22 if(fclose(fid)!=0) _error _("%s%s","could not close lock file ",filename);22 if(fclose(fid)!=0) _error2_("could not close lock file " << filename); 23 23 } 24 24 -
issm/trunk/src/c/solutions/adjointbalancethickness_core.cpp
r11995 r12706 22 22 23 23 /*compute thickness */ 24 _printf_(VerboseSolution(),"%s\n"," computing thickness");24 if(VerboseSolution()) _pprintLine_(" computing thickness"); 25 25 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum); 26 26 solver_linear(femmodel); … … 30 30 31 31 /*compute adjoint*/ 32 _printf_(VerboseSolution(),"%s\n"," computing adjoint");32 if(VerboseSolution()) _pprintLine_(" computing adjoint"); 33 33 femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum,AdjointBalancethicknessAnalysisEnum); 34 34 solver_adjoint_linear(femmodel); … … 36 36 /*Save results*/ 37 37 if(save_results){ 38 _printf_(VerboseSolution()," saving results\n");38 if(VerboseSolution()) _pprintLine_(" saving results"); 39 39 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointEnum); 40 40 } -
issm/trunk/src/c/solutions/adjointdiagnostic_core.cpp
r11995 r12706 25 25 26 26 /*Compute velocities*/ 27 _printf_(VerboseSolution(),"%s\n"," computing velocities");27 if(VerboseSolution()) _pprintLine_(" computing velocities"); 28 28 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum); 29 29 solver_nonlinear(femmodel,conserve_loads); … … 33 33 34 34 /*Compute adjoint*/ 35 _printf_(VerboseSolution(),"%s\n"," computing adjoint");35 if(VerboseSolution()) _pprintLine_(" computing adjoint"); 36 36 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum,AdjointHorizAnalysisEnum); 37 37 solver_adjoint_linear(femmodel); … … 39 39 /*Save results*/ 40 40 if(save_results){ 41 _printf_(VerboseSolution()," saving results\n");41 if(VerboseSolution()) _pprintLine_(" saving results"); 42 42 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointxEnum); 43 43 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointyEnum); -
issm/trunk/src/c/solutions/balancethickness_core.cpp
r11995 r12706 24 24 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 25 25 26 _printf_(VerboseSolution(),"call computational core:\n");26 if(VerboseSolution()) _pprintLine_("call computational core:"); 27 27 solver_linear(femmodel); 28 28 29 29 if(save_results){ 30 _printf_(VerboseSolution()," saving results\n");30 if(VerboseSolution()) _pprintLine_(" saving results"); 31 31 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum); 32 32 } -
issm/trunk/src/c/solutions/bedslope_core.cpp
r11995 r12706 19 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 20 21 _printf_(VerboseSolution(),"%s\n"," computing slope");21 if(VerboseSolution()) _pprintLine_(" computing slope"); 22 22 23 23 /*Call on core computations: */ … … 28 28 29 29 if(save_results){ 30 _printf_(VerboseSolution()," saving results\n");30 if(VerboseSolution()) _pprintLine_(" saving results"); 31 31 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedSlopeXEnum); 32 32 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedSlopeYEnum); -
issm/trunk/src/c/solutions/control_core.cpp
r11995 r12706 20 20 int num_controls,num_responses; 21 21 int nsteps; 22 double tol_cm;22 IssmDouble tol_cm; 23 23 bool cm_gradient; 24 24 int dim; … … 28 28 29 29 int* control_type = NULL; 30 double* responses=NULL;30 IssmDouble* responses=NULL; 31 31 int* step_responses=NULL; 32 double* maxiter=NULL;33 double* cm_jump=NULL;32 IssmDouble* maxiter=NULL; 33 IssmDouble* cm_jump=NULL; 34 34 35 35 /*intermediary: */ 36 double search_scalar=1;36 IssmDouble search_scalar=1; 37 37 OptArgs optargs; 38 38 OptPars optpars; … … 43 43 44 44 /*output: */ 45 double* J=NULL;45 IssmDouble* J=NULL; 46 46 47 47 /*Recover parameters used throughout the solution*/ … … 66 66 67 67 /*Launch once a complete solution to set up all inputs*/ 68 _printf_(VerboseControl(),"%s\n"," preparing initial solution");68 if(VerboseControl()) _pprintLine_(" preparing initial solution"); 69 69 if(isstokes) solutioncore(femmodel); 70 70 71 71 /*Initialize responses: */ 72 J= (double*)xmalloc(nsteps*sizeof(double));73 step_responses= (int*)xmalloc(num_responses*sizeof(int));72 J=xNew<IssmDouble>(nsteps); 73 step_responses=xNew<int>(num_responses); 74 74 75 75 /*Initialize some of the BrentSearch arguments: */ … … 81 81 82 82 /*Display info*/ 83 _printf_(VerboseControl(),"\n%s%i%s%i\n"," control method step ",n+1,"/",nsteps);83 if(VerboseControl()) _pprintLine_("\n" << " control method step " << n+1 << "/" << nsteps); 84 84 for(i=0;i<num_responses;i++) step_responses[i]=(int)responses[n*num_responses+i]; 85 85 femmodel->parameters->SetParam(step_responses,1,num_responses,StepResponsesEnum); … … 88 88 if(solution_type==SteadystateSolutionEnum) solutioncore(femmodel); 89 89 90 _printf_(VerboseControl(),"%s\n"," compute adjoint state:");90 if(VerboseControl()) _pprintLine_(" compute adjoint state:"); 91 91 adjointcore(femmodel); 92 92 gradient_core(femmodel,n,search_scalar==0); … … 98 98 } 99 99 100 _printf_(VerboseControl(),"%s\n"," optimizing along gradient direction");100 if(VerboseControl()) _pprintLine_(" optimizing along gradient direction"); 101 101 optpars.maxiter=(int)maxiter[n]; optpars.cm_jump=cm_jump[n]; 102 102 BrentSearch(&search_scalar,J+n,&optpars,&objectivefunction,&optargs); 103 103 104 _printf_(VerboseControl(),"%s\n"," updating parameter using optimized search scalar"); //true means update save controls104 if(VerboseControl()) _pprintLine_(" updating parameter using optimized search scalar"); //true means update save controls 105 105 InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true); 106 106 … … 108 108 } 109 109 110 _printf_(VerboseControl(),"%s\n"," preparing final solution");110 if(VerboseControl()) _pprintLine_(" preparing final solution"); 111 111 femmodel->parameters->SetParam(true,SaveResultsEnum); 112 112 solutioncore(femmodel); … … 120 120 cleanup_and_return: 121 121 /*Free ressources: */ 122 x free((void**)&control_type);123 x free((void**)&responses);124 x free((void**)&step_responses);125 x free((void**)&maxiter);126 x free((void**)&cm_jump);127 x free((void**)&J);122 xDelete<int>(control_type); 123 xDelete<int>(step_responses); 124 xDelete<IssmDouble>(maxiter); 125 xDelete<IssmDouble>(responses); 126 xDelete<IssmDouble>(cm_jump); 127 xDelete<IssmDouble>(J); 128 128 } -
issm/trunk/src/c/solutions/controlconvergence.cpp
r10197 r12706 17 17 #include "./solutions.h" 18 18 19 bool controlconvergence( double J, double tol_cm){19 bool controlconvergence(IssmDouble J, IssmDouble tol_cm){ 20 20 21 21 int i; … … 23 23 24 24 /*Has convergence been reached?*/ 25 if (! isnan(tol_cm) && J<tol_cm){25 if (!xIsNan<IssmDouble>(tol_cm) && J<tol_cm){ 26 26 converged=true; 27 _printf_(VerboseConvergence()," Convergence criterion reached: J = %g < %g",J,tol_cm);27 if(VerboseConvergence()) _pprintString_(" Convergence criterion reached: J = " << J << " < " << tol_cm); 28 28 } 29 29 -
issm/trunk/src/c/solutions/controlrestart.cpp
r11995 r12706 7 7 #include "../EnumDefinitions/EnumDefinitions.h" 8 8 9 void controlrestart(FemModel* femmodel, double* J){9 void controlrestart(FemModel* femmodel,IssmDouble* J){ 10 10 11 11 int num_controls; … … 33 33 34 34 /*Clean up and return*/ 35 x free((void**)&control_type);35 xDelete<int>(control_type); 36 36 } -
issm/trunk/src/c/solutions/controltao_core.cpp
r11995 r12706 17 17 18 18 /*Local prototype*/ 19 int FormFunctionGradient(TaoSolver,Vec, double*,Vec,void*);19 int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*); 20 20 int IssmMonitor(TaoSolver,void*); 21 21 typedef struct { … … 30 30 int nsteps,maxiter; 31 31 AppCtx user; 32 TaoSolver tao ;33 double *dummy = NULL;32 TaoSolver tao = 0; 33 IssmDouble *dummy = NULL; 34 34 int *control_list = NULL; 35 35 Vector *X = NULL; … … 41 41 PetscGetArgs(&argc,&args); 42 42 ierr = TaoInitialize(&argc,&args,(char*)0,""); 43 if(ierr) _error _("Could not initialize Tao");43 if(ierr) _error2_("Could not initialize Tao"); 44 44 45 45 /*Recover some parameters*/ … … 50 50 femmodel->parameters->FindParam(&dummy,NULL,NULL,InversionMaxiterPerStepEnum); 51 51 femmodel->parameters->SetParam(false,SaveResultsEnum); 52 maxiter=nsteps*(int)dummy[0]; x free((void**)&dummy);52 maxiter=nsteps*(int)dummy[0]; xDelete<IssmDouble>(dummy); 53 53 54 54 /*Initialize TAO*/ 55 _printf_(VerboseControl(),"%s\n"," Initializing the Toolkit for Advanced Optimization (TAO)");56 55 TaoCreate(PETSC_COMM_WORLD,&tao); 56 if(VerboseControl()) _pprintLine_(" Initializing the Toolkit for Advanced Optimization (TAO)"); 57 57 TaoSetFromOptions(tao); 58 58 TaoSetType(tao,"tao_blmvm"); … … 78 78 79 79 /*Solver optimization problem*/ 80 _printf_(VerboseControl(),"%s\n"," Starting optimization");80 if(VerboseControl()) _pprintLine_(" Starting optimization"); 81 81 TaoSolve(tao); 82 82 TaoView(tao,PETSC_VIEWER_STDOUT_WORLD); … … 88 88 89 89 /*Finalize*/ 90 _printf_(VerboseControl(),"%s\n"," preparing final solution");90 if(VerboseControl()) _pprintLine_(" preparing final solution"); 91 91 femmodel->parameters->SetParam(true,SaveResultsEnum); 92 92 void (*solutioncore)(FemModel*)=NULL; … … 95 95 96 96 /*Clean up and return*/ 97 x free((void**)&control_list);97 xDelete<int>(control_list); 98 98 xdelete(&X); 99 99 TaoDestroy(&tao); 100 100 TaoFinalize(); 101 101 } 102 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, double *fcn,Vec G,void *userCtx){102 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *userCtx){ 103 103 104 104 /*Retreive arguments*/ … … 107 107 FemModel *femmodel = user->femmodel; 108 108 int *cost_functions = NULL; 109 double *cost_functionsd= NULL;109 IssmDouble *cost_functionsd= NULL; 110 110 Vector *gradient = NULL; 111 111 Vector *X = NULL; … … 125 125 126 126 /*Prepare objective function*/ 127 cost_functions= (int*)xmalloc(num_cost_functions*sizeof(int));127 cost_functions=xNew<int>(num_cost_functions); 128 128 for(int i=0;i<num_cost_functions;i++) cost_functions[i]=(int)cost_functionsd[i]; //FIXME 129 129 femmodel->parameters->SetParam(cost_functions,1,num_cost_functions,StepResponsesEnum); … … 146 146 147 147 /*Clean-up and return*/ 148 x free((void**)&cost_functions);149 x free((void**)&cost_functionsd);148 xDelete<int>(cost_functions); 149 xDelete<IssmDouble>(cost_functionsd); 150 150 return 0; 151 151 } … … 153 153 154 154 int i,its,num_responses; 155 double f,gnorm,cnorm,xdiff;155 IssmDouble f,gnorm,cnorm,xdiff; 156 156 AppCtx *user = (AppCtx *)userCtx; 157 157 FemModel *femmodel = user->femmodel; … … 163 163 164 164 TaoGetSolutionStatus(tao, &its, &f, &gnorm, &cnorm, &xdiff, NULL); 165 if(its==0) _p rintf_(true,"Iter Function Residual | List of contributions\n");166 if(its==0) _p rintf_(true,"-----------------------------------+-----------------------\n");167 _p rintf_(true,"%4i %12.7g %12.7g | ",its,f,gnorm);165 if(its==0) _pprintLine_("Iter Function Residual | List of contributions"); 166 if(its==0) _pprintLine_("-----------------------------------+-----------------------"); 167 _pprintString_(setw(4)<<its<<" "<<setw(12)<<setprecision(7)<<f<<" "<<setw(12)<<setprecision(7)<<gnorm<<" | "); 168 168 169 169 /*Retrieve objective functions independently*/ 170 170 for(i=0;i<num_responses;i++){ 171 171 Responsex(&f,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnumToStringx(responses[i]),false,i); 172 _p rintf_(true," %12.7g ","",f);172 _pprintString_(" "<<setw(12)<<setprecision(7)<<f); 173 173 } 174 _p rintf_(true,"\n");174 _pprintLine_(""); 175 175 176 176 /*Clean-up and return*/ 177 x free((void**)&responses);177 xDelete<int>(responses); 178 178 return 0; 179 179 } … … 181 181 #else 182 182 void controltao_core(FemModel* femmodel){ 183 _error _("TAO not installed or PETSc version not supported");183 _error2_("TAO not installed or PETSc version not supported"); 184 184 } 185 185 #endif //_HAVE_TAO_ -
issm/trunk/src/c/solutions/convergence.cpp
r11995 r12706 19 19 Vector* KUoldF=NULL; 20 20 Vector* duf=NULL; 21 double ndu,nduinf,nu;22 double nKUF;23 double nKUoldF;24 double nF;25 double solver_residue,res;21 IssmDouble ndu,nduinf,nu; 22 IssmDouble nKUF; 23 IssmDouble nKUoldF; 24 IssmDouble nF; 25 IssmDouble solver_residue,res; 26 26 27 27 /*convergence options*/ 28 double eps_res;29 double eps_rel;30 double eps_abs;31 double yts;28 IssmDouble eps_res; 29 IssmDouble eps_rel; 30 IssmDouble eps_abs; 31 IssmDouble yts; 32 32 33 33 /*If uf is NULL in input, f-set is nil, model is fully constrained, therefore converged from … … 55 55 nF=pf->Norm(NORM_TWO); 56 56 solver_residue=nKUF/nF; 57 _p rintf_(true,"\n%s%g\n"," solver residue: norm(KU-F)/norm(F)=",solver_residue);57 _pprintLine_("\n" << " solver residue: norm(KU-F)/norm(F)=" << solver_residue); 58 58 59 59 //clean up … … 70 70 nF=pf->Norm(NORM_TWO); 71 71 res=nKUoldF/nF; 72 if ( isnan(res)){73 _p rintf_(true,"norm nf = %lf and norm kuold = %lf\n",nF,nKUoldF);74 _error _("mechanical equilibrium convergence criterion is NaN!");72 if (xIsNan<IssmDouble>(res)){ 73 _pprintLine_("norm nf = " << nF << "f and norm kuold = " << nKUoldF << "f"); 74 _error2_("mechanical equilibrium convergence criterion is NaN!"); 75 75 } 76 76 … … 81 81 //print 82 82 if(res<eps_res){ 83 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n"," mechanical equilibrium convergence criterion",res*100," < ",eps_res*100," %");83 if(VerboseConvergence()) _pprintLine_(setw(50) << left << " mechanical equilibrium convergence criterion" << res*100 << " < " << eps_res*100 << " %"); 84 84 converged=true; 85 85 } 86 86 else{ 87 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n"," mechanical equilibrium convergence criterion",res*100," > ",eps_res*100," %");87 if(VerboseConvergence()) _pprintLine_(setw(50) << left << " mechanical equilibrium convergence criterion" << res*100 << " > " << eps_res*100 << " %"); 88 88 converged=false; 89 89 } 90 90 91 91 /*Relative criterion (optional)*/ 92 if (! isnan(eps_rel) || (VerboseConvergence())){92 if (!xIsNan<IssmDouble>(eps_rel) || (VerboseConvergence())){ 93 93 94 94 //compute norm(du)/norm(u) … … 96 96 ndu=duf->Norm(NORM_TWO); nu=old_uf->Norm(NORM_TWO); 97 97 98 if ( isnan(ndu) || isnan(nu)) _error_("convergence criterion is NaN!");98 if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error2_("convergence criterion is NaN!"); 99 99 100 100 //clean up … … 102 102 103 103 //print 104 if (! isnan(eps_rel)){104 if (!xIsNan<IssmDouble>(eps_rel)){ 105 105 if((ndu/nu)<eps_rel){ 106 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n"," Convergence criterion: norm(du)/norm(u)",ndu/nu*100," < ",eps_rel*100," %");106 if(VerboseConvergence()) _pprintLine_(setw(50) << left << " Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " < " << eps_rel*100 << " %"); 107 107 } 108 108 else{ 109 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n"," Convergence criterion: norm(du)/norm(u)",ndu/nu*100," > ",eps_rel*100," %");109 if(VerboseConvergence()) _pprintLine_(setw(50) << left << " Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " > " << eps_rel*100 << " %"); 110 110 converged=false; 111 111 } 112 112 } 113 else _p rintf_(true,"%-50s%g%s\n"," Convergence criterion: norm(du)/norm(u)",ndu/nu*100," %");113 else _pprintLine_(setw(50) << left << " Convergence criterion: norm(du)/norm(u)" << ndu/nu*100 << " %"); 114 114 115 115 } 116 116 117 117 /*Absolute criterion (Optional) = max(du)*/ 118 if (! isnan(eps_abs) || (VerboseConvergence())){118 if (!xIsNan<IssmDouble>(eps_abs) || (VerboseConvergence())){ 119 119 120 120 //compute max(du) 121 121 duf=old_uf->Duplicate(); old_uf->Copy(duf); duf->AYPX(uf,-1.0); 122 122 ndu=duf->Norm(NORM_TWO); nduinf=duf->Norm(NORM_INF); 123 if ( isnan(ndu) || isnan(nu)) _error_("convergence criterion is NaN!");123 if (xIsNan<IssmDouble>(ndu) || xIsNan<IssmDouble>(nu)) _error2_("convergence criterion is NaN!"); 124 124 125 125 //clean up … … 127 127 128 128 //print 129 if (! isnan(eps_abs)){129 if (!xIsNan<IssmDouble>(eps_abs)){ 130 130 if ((nduinf*yts)<eps_abs){ 131 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n"," Convergence criterion: max(du)",nduinf*yts," < ",eps_abs," m/yr");131 if(VerboseConvergence()) _pprintLine_(setw(50) << left << " Convergence criterion: max(du)" << nduinf*yts << " < " << eps_abs << " m/yr"); 132 132 } 133 133 else{ 134 _printf_(VerboseConvergence(),"%-50s%g%s%g%s\n"," Convergence criterion: max(du)",nduinf*yts," > ",eps_abs," m/yr");134 if(VerboseConvergence()) _pprintLine_(setw(50) << left << " Convergence criterion: max(du)" << nduinf*yts << " > " << eps_abs << " m/yr"); 135 135 converged=false; 136 136 } 137 137 } 138 else _p rintf_(true,"%-50s%g%s\n"," Convergence criterion: max(du)",nduinf*yts," m/yr");138 else _pprintLine_(setw(50) << left << " Convergence criterion: max(du)" << nduinf*yts << " m/yr"); 139 139 140 140 } -
issm/trunk/src/c/solutions/diagnostic_core.cpp
r11995 r12706 59 59 if(ishutter){ 60 60 61 _printf_(VerboseSolution(),"%s\n"," computing hutter velocities");61 if(VerboseSolution()) _pprintLine_(" computing hutter velocities"); 62 62 63 63 //Take the last velocity into account so that the velocity on the MacAyeal domain is not zero … … 72 72 if (ismacayealpattyn ^ isstokes){ // ^ = xor 73 73 74 _printf_(VerboseSolution(),"%s\n"," computing velocities");74 if(VerboseSolution()) _pprintLine_(" computing velocities"); 75 75 femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum); 76 76 if(isnewton) … … 82 82 if (ismacayealpattyn && isstokes){ 83 83 84 _printf_(VerboseSolution(),"%s\n"," computing coupling macayealpattyn and stokes velocities and pressure ");84 if(VerboseSolution()) _pprintLine_(" computing coupling macayealpattyn and stokes velocities and pressure "); 85 85 solver_stokescoupling_nonlinear(femmodel,conserve_loads); 86 86 } … … 88 88 if (dim==3 & (ishutter || ismacayealpattyn)){ 89 89 90 _printf_(VerboseSolution(),"%s\n"," computing vertical velocities");90 if(VerboseSolution()) _pprintLine_(" computing vertical velocities"); 91 91 femmodel->SetCurrentConfiguration(DiagnosticVertAnalysisEnum); 92 92 solver_linear(femmodel); … … 95 95 96 96 if(save_results){ 97 _printf_(VerboseSolution()," saving results\n");97 if(VerboseSolution()) _pprintLine_(" saving results"); 98 98 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum); 99 99 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum); … … 105 105 106 106 /*Free ressources:*/ 107 x free((void**)&requested_outputs);107 xDelete<int>(requested_outputs); 108 108 } -
issm/trunk/src/c/solutions/enthalpy_core.cpp
r11995 r12706 21 21 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 22 22 23 _printf_(VerboseSolution()," computing enthalpy\n");23 if(VerboseSolution()) _pprintLine_(" computing enthalpy"); 24 24 femmodel->SetCurrentConfiguration(EnthalpyAnalysisEnum); 25 25 solver_nonlinear(femmodel,true); … … 29 29 30 30 if(save_results){ 31 _printf_(VerboseSolution()," saving results\n");31 if(VerboseSolution()) _pprintLine_(" saving results"); 32 32 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum); 33 33 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum); -
issm/trunk/src/c/solutions/gradient_core.cpp
r11995 r12706 16 16 17 17 /*Intermediaries*/ 18 double norm_inf;19 double *norm_list = NULL;18 IssmDouble norm_inf; 19 IssmDouble *norm_list = NULL; 20 20 Vector* new_gradient = NULL; 21 21 Vector* gradient = NULL; … … 23 23 24 24 /*Compute gradient*/ 25 _printf_(VerboseControl()," compute cost function gradient\n");25 if(VerboseControl()) _pprintLine_(" compute cost function gradient"); 26 26 Gradjx(&gradient,&norm_list,femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters); 27 27 28 28 if (orthogonalize){ 29 _printf_(VerboseControl()," orthogonalization\n");29 if(VerboseControl()) _pprintLine_(" orthogonalization"); 30 30 ControlInputGetGradientx(&old_gradient,femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters); 31 31 Orthx(&new_gradient,gradient,old_gradient); xdelete(&old_gradient); xdelete(&gradient); … … 37 37 /*Check that gradient is clean*/ 38 38 norm_inf=new_gradient->Norm(NORM_INF); 39 if(norm_inf<=0) _error _("||∂J/∂α||∞ = 0 gradient norm is zero");40 if( isnan(norm_inf))_error_("||∂J/∂α||∞ = NaN gradient norm is NaN");39 if(norm_inf<=0) _error2_("||∂J/∂α||∞ = 0 gradient norm is zero"); 40 if(xIsNan<IssmDouble>(norm_inf))_error2_("||∂J/∂α||∞ = NaN gradient norm is NaN"); 41 41 42 42 /*plug back into inputs: */ … … 48 48 49 49 /*Clean up and return*/ 50 x free((void**)&norm_list);50 xDelete<IssmDouble>(norm_list); 51 51 } -
issm/trunk/src/c/solutions/hydrology_core.cpp
r11995 r12706 17 17 18 18 /*intermediary*/ 19 double time;19 IssmDouble time; 20 20 int nsteps; 21 double starttime,final_time;22 double dt;21 IssmDouble starttime,final_time; 22 IssmDouble dt; 23 23 bool save_results; 24 24 int output_frequency; … … 45 45 for(i=0;i<nsteps;i++){ 46 46 47 if(nsteps) _printf_(VerboseSolution(),"time step:%i/%i\n",i+1,nsteps);47 if(nsteps)if(VerboseSolution()) _pprintLine_("time step:" << i+1 << "/" << nsteps); 48 48 time+=dt; 49 49 femmodel->parameters->SetParam(time,TimeEnum); … … 53 53 54 54 if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){ 55 _printf_(VerboseSolution()," saving results \n");55 if(VerboseSolution()) _pprintLine_(" saving results "); 56 56 //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WatercolumnEnum,i+1,time); 57 57 //InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time); … … 59 59 60 60 /*unload results*/ 61 _printf_(VerboseSolution()," saving temporary results\n");61 if(VerboseSolution()) _pprintLine_(" saving temporary results"); 62 62 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results); 63 63 } -
issm/trunk/src/c/solutions/hydrology_core_step.cpp
r9761 r12706 13 13 #include "../solvers/solvers.h" 14 14 15 void hydrology_core_step(FemModel* femmodel,int step, double time){15 void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time){ 16 16 17 17 bool modify_loads=true; 18 18 19 _printf_(VerboseSolution()," computing water column\n");19 if(VerboseSolution()) _pprintLine_(" computing water column"); 20 20 femmodel->SetCurrentConfiguration(HydrologyAnalysisEnum); 21 21 solver_nonlinear(femmodel,modify_loads); -
issm/trunk/src/c/solutions/issm.cpp
r12330 r12706 30 30 31 31 /*time*/ 32 double start, finish;33 double start_core, finish_core;34 double start_init, finish_init;32 IssmPDouble start, finish; 33 IssmPDouble start_core, finish_core; 34 IssmPDouble start_init, finish_init; 35 35 int ierr; 36 37 /*profiling*/ 38 bool profiling = false; 39 IssmPDouble Time_start, Flops_start; 40 IssmPDouble Solution_time, Memory_use, Current_flops; 36 41 37 42 ISSMBOOT(); … … 40 45 #ifdef _HAVE_PETSC_ 41 46 ierr=PetscInitialize(&argc,&argv,(char*)0,""); 42 if(ierr) _error _("Could not initialize Petsc");47 if(ierr) _error2_("Could not initialize Petsc"); 43 48 #else 44 49 #ifdef _HAVE_MPI_ … … 50 55 MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime(); 51 56 #else 52 start=( double)clock();57 start=(IssmPDouble)clock(); 53 58 #endif 54 59 … … 60 65 61 66 /*First process inputs*/ 62 _p rintf_(true,"\n");63 _p rintf_(true,"Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION);64 _p rintf_(true,"(website: %s contact: %s)\n",PACKAGE_URL,PACKAGE_BUGREPORT);65 _p rintf_(true,"\n");67 _pprintLine_(""); 68 _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION); 69 _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")"); 70 _pprintLine_(""); 66 71 ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,argc,argv); 67 72 … … 73 78 MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime(); 74 79 #else 75 start_init=( double)clock();80 start_init=(IssmPDouble)clock(); 76 81 #endif 77 82 femmodel=new FemModel(binfilename,outbinfilename,solution_type,analyses,numanalyses); … … 94 99 femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum); 95 100 femmodel->parameters->FindParam(&tao_analysis,InversionTaoEnum); 101 femmodel->parameters->FindParam(&profiling,DebugProfilingEnum); 102 96 103 #ifdef _HAVE_MPI_ 97 104 MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime(); 98 105 #else 99 finish_init=( double)clock();100 #endif 101 102 _p rintf_(true,"call computational core:\n");106 finish_init=(IssmPDouble)clock(); 107 #endif 108 109 _pprintLine_("call computational core:"); 103 110 #ifdef _HAVE_MPI_ 104 111 MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( ); 105 112 #else 106 start_core=(double)clock(); 107 #endif 108 113 start_core=(IssmPDouble)clock(); 114 #endif 115 116 if(profiling)ProfilingStart(&Time_start,&Flops_start); 117 109 118 if(dakota_analysis){ 110 119 #ifdef _HAVE_DAKOTA_ 111 120 Dakotax(femmodel); 112 121 #else 113 _error _("ISSM was not compiled with dakota support, cannot carry out dakota analysis!");122 _error2_("ISSM was not compiled with dakota support, cannot carry out dakota analysis!"); 114 123 #endif 115 124 } … … 121 130 control_core(femmodel); 122 131 #else 123 _error _("ISSM was not compiled with control support, cannot carry out dakota analysis!");132 _error2_("ISSM was not compiled with control support, cannot carry out dakota analysis!"); 124 133 #endif 125 134 } … … 127 136 solutioncore(femmodel); 128 137 } 138 139 if(profiling){ 140 ProfilingEnd(&Solution_time,&Memory_use,&Current_flops,Time_start,Flops_start); 141 femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, ProfilingSolutionTimeEnum, Solution_time, 1, 0)); 142 femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, ProfilingCurrentMemEnum, Memory_use, 1, 0)); 143 femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, ProfilingCurrentFlopsEnum, Current_flops, 1, 0)); 144 } 145 146 129 147 #ifdef _HAVE_MPI_ 130 148 MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( ); 131 149 #else 132 finish_core=( double)clock();133 #endif 134 135 _p rintf_(true,"write results to disk:\n");150 finish_core=(IssmPDouble)clock(); 151 #endif 152 153 _pprintLine_("write results to disk:"); 136 154 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results); 137 155 … … 139 157 pfclose(output_fid,lockfilename); 140 158 if (waitonlock>0){ 141 _p rintf_(true,"write lock file:\n");159 _pprintLine_("write lock file:"); 142 160 WriteLockFile(lockfilename); 143 161 } 144 162 145 /*Free res sources */146 x free((void**)&analyses);147 x free((void**)&lockfilename);148 x free((void**)&binfilename);149 x free((void**)&outbinfilename);150 x free((void**)&petscfilename);163 /*Free resources */ 164 xDelete<int>(analyses); 165 xDelete<char>(lockfilename); 166 xDelete<char>(binfilename); 167 xDelete<char>(outbinfilename); 168 xDelete<char>(petscfilename); 151 169 delete femmodel; 152 170 … … 154 172 #ifdef _HAVE_MPI_ 155 173 MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( ); 156 _printf_(true,"\n %-34s %f seconds \n","FemModel initialization elapsed time:",finish_init-start_init); 157 _printf_(true," %-34s %f seconds \n","Core solution elapsed time:",finish_core-start_core); 158 _printf_(true,"\n %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60); 159 #else 160 finish=(double)clock(); 161 _printf_(true,"\n %-34s %f seconds \n","FemModel initialization elapsed time:",(finish_init-start_init)/CLOCKS_PER_SEC); 162 _printf_(true," %-34s %f seconds \n","Core solution elapsed time:",(finish_core-start_core)/CLOCKS_PER_SEC); 163 _printf_(true,"\n %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600/CLOCKS_PER_SEC),int(int((finish-start)/CLOCKS_PER_SEC)%3600/60),(int(finish-start)/CLOCKS_PER_SEC)%60); 164 #endif 165 166 174 _pprintLine_(""); 175 _pprintLine_(" "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<finish_init-start_init); 176 _pprintLine_(" "<<setw(40)<<left<<"Core solution elapsed time:"<<finish_core-start_core); 177 _pprintLine_(""); 178 _pprintLine_(" Total elapsed time:"<<int((finish-start)/3600)<<" hrs "<<int(int(finish-start)%3600/60)<<" min "<<int(finish-start)%60<<" sec"); 179 _pprintLine_(""); 180 #else 181 finish=(IssmPDouble)clock(); 182 _pprintLine_(""); 183 _pprintLine_(" "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<(finish_init-start_init)/CLOCKS_PER_SEC); 184 _pprintLine_(" "<<setw(40)<<left<<"Core solution elapsed time:"<<(finish_core-start_core)/CLOCKS_PER_SEC); 185 _pprintLine_(""); 186 _pprintLine_(" Total elapsed time:" 187 <<int((finish-start)/CLOCKS_PER_SEC/3600)<<" hrs " 188 <<int(int(finish-start)/CLOCKS_PER_SEC%3600/60)<<" min " 189 <<int(finish-start)/CLOCKS_PER_SEC%60<<" sec"); 190 _pprintLine_(""); 191 #endif 167 192 168 193 #ifdef _HAVE_PETSC_ 169 _p rintf_(true,"closing MPI and Petsc\n");194 _pprintLine_("closing MPI and Petsc"); 170 195 PetscFinalize(); 171 196 #else 172 197 #ifdef _HAVE_MPI_ 173 _p rintf_(true,"closing MPI and Petsc\n");198 _pprintLine_("closing MPI and Petsc"); 174 199 MPI_Finalize(); 175 200 #endif -
issm/trunk/src/c/solutions/objectivefunction.cpp
r11995 r12706 3 3 */ 4 4 5 /*include files: {{{ 1*/5 /*include files: {{{*/ 6 6 #ifdef HAVE_CONFIG_H 7 7 #include <config.h> … … 20 20 /*}}}*/ 21 21 22 double objectivefunction(double search_scalar,OptArgs* optargs){22 IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs){ 23 23 24 24 int i; 25 25 26 26 /*output: */ 27 double J;27 IssmDouble J; 28 28 29 29 /*parameters: */ … … 49 49 } 50 50 else{ 51 _error _("Solution %s not implemented yet",EnumToStringx(solution_type));51 _error2_("Solution " << EnumToStringx(solution_type) << " not implemented yet"); 52 52 } 53 53 … … 66 66 } 67 67 else{ 68 _error _("Solution %s not implemented yet",EnumToStringx(solution_type));68 _error2_("Solution " << EnumToStringx(solution_type) << " not implemented yet"); 69 69 } 70 70 -
issm/trunk/src/c/solutions/prognostic_core.cpp
r12293 r12706 17 17 bool save_results; 18 18 bool ispdd; 19 bool issmbgradients; 19 20 20 21 /*activate formulation: */ … … 24 25 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 25 26 femmodel->parameters->FindParam(&ispdd,SurfaceforcingsIspddEnum); 27 femmodel->parameters->FindParam(&issmbgradients,SurfaceforcingsIssmbgradientsEnum); 26 28 27 29 if(ispdd){ 28 _printf_(VerboseSolution()," call positive degree day module\n");30 if(VerboseSolution()) _pprintLine_(" call positive degree day module"); 29 31 PositiveDegreeDayx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 30 } 32 } 31 33 32 _printf_(VerboseSolution()," call computational core\n"); 34 if(issmbgradients){ 35 _printf_(VerboseSolution()," call smb gradients module\n"); 36 SmbGradientsx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 37 } 38 39 if(VerboseSolution()) _pprintLine_(" call computational core"); 33 40 solver_linear(femmodel); 34 41 35 42 if(save_results){ 36 _printf_(VerboseSolution()," saving results\n");43 if(VerboseSolution()) _pprintLine_(" saving results"); 37 44 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum); 38 45 } -
issm/trunk/src/c/solutions/solutions.h
r11995 r12706 18 18 void diagnostic_core(FemModel* femmodel); 19 19 void hydrology_core(FemModel* femmodel); 20 void hydrology_core_step(FemModel* femmodel,int step, double time);20 void hydrology_core_step(FemModel* femmodel,int step, IssmDouble time); 21 21 void thermal_core(FemModel* femmodel); 22 22 void enthalpy_core(FemModel* femmodel); … … 30 30 void steadystate_core(FemModel* femmodel); 31 31 void transient_core(FemModel* femmodel); 32 double objectivefunction(double search_scalar,OptArgs* optargs);32 IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs); 33 33 34 34 //convergence: 35 35 void convergence(bool* pconverged, Matrix* K_ff,Vector* p_f,Vector* u_f,Vector* u_f_old,Parameters* parameters); 36 bool controlconvergence( double J,double tol_cm);36 bool controlconvergence(IssmDouble J,IssmDouble tol_cm); 37 37 bool steadystateconvergence(FemModel* femmodel); 38 38 39 39 //optimization 40 int GradJSearch( double* search_vector,FemModel* femmodel,int step);40 int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step); 41 41 42 42 //diverse 43 43 void ProcessArguments(int* solution,char** pbinname,char** poutbinname,char** ppetscname,char** plockname,int argc,char **argv); 44 44 void WriteLockFile(char* filename); 45 void controlrestart(FemModel* femmodel, double* J);45 void controlrestart(FemModel* femmodel,IssmDouble* J); 46 46 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type); 47 47 -
issm/trunk/src/c/solutions/steadystate_core.cpp
r11995 r12706 9 9 #endif 10 10 11 #include "../include/include.h" 11 12 #include "../toolkits/toolkits.h" 12 13 #include "../objects/objects.h" … … 16 17 #include "./solutions.h" 17 18 #include "../modules/modules.h" 18 #include "../include/include.h"19 19 #include "../solvers/solvers.h" 20 20 … … 43 43 for(;;){ 44 44 45 _printf_(VerboseSolution(),"%s%i\n"," computing temperature and velocity for step: ",step);45 if(VerboseSolution()) _pprintLine_(" computing temperature and velocity for step: " << step); 46 46 #ifdef _HAVE_THERMAL_ 47 47 if(isenthalpy==0){ … … 52 52 } 53 53 #else 54 _error _("ISSM was not compiled with thermal capabilities. Exiting");54 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 55 55 #endif 56 56 57 _printf_(VerboseSolution(),"%s\n"," computing new velocity");57 if(VerboseSolution()) _pprintLine_(" computing new velocity"); 58 58 diagnostic_core(femmodel); 59 59 60 60 if (step>1){ 61 _printf_(VerboseSolution(),"%s\n"," checking velocity, temperature and pressure convergence");61 if(VerboseSolution()) _pprintLine_(" checking velocity, temperature and pressure convergence"); 62 62 if(steadystateconvergence(femmodel)) break; 63 63 } 64 64 if(step>maxiter){ 65 _printf_(VerboseSolution(),"%s%i%s\n"," maximum number steadystate iterations ",maxiter," reached");65 if(VerboseSolution()) _pprintLine_(" maximum number steadystate iterations " << maxiter << " reached"); 66 66 break; 67 67 } 68 68 69 _printf_(VerboseSolution(),"%s\n"," saving velocity, temperature and pressure to check for convergence at next step");69 if(VerboseSolution()) _pprintLine_(" saving velocity, temperature and pressure to check for convergence at next step"); 70 70 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum,VxPicardEnum); 71 71 InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum,VyPicardEnum); … … 79 79 80 80 if(save_results){ 81 _printf_(VerboseSolution()," saving results\n");81 if(VerboseSolution()) _pprintLine_(" saving results"); 82 82 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum); 83 83 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum); … … 93 93 94 94 /*Free ressources:*/ 95 x free((void**)&requested_outputs);95 xDelete<int>(requested_outputs); 96 96 } -
issm/trunk/src/c/solutions/steadystateconvergence.cpp
r9677 r12706 28 28 int temperatureenums[2]={TemperatureEnum,TemperatureOldEnum}; 29 29 int convergencecriterion[1]={RelativeEnum}; //criterions for convergence, RelativeEnum or AbsoluteEnum 30 double convergencecriterionvalue[1]; //value of criterion to be respected30 IssmDouble convergencecriterionvalue[1]; //value of criterion to be respected 31 31 32 32 /*retrieve parameters: */ -
issm/trunk/src/c/solutions/surfaceslope_core.cpp
r11995 r12706 19 19 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 20 20 21 _printf_(VerboseSolution(),"%s\n","computing slope...");21 if(VerboseSolution()) _pprintLine_("computing slope..."); 22 22 23 23 /*Call on core computations: */ … … 28 28 29 29 if(save_results){ 30 _printf_(VerboseSolution(),"saving results:\n");30 if(VerboseSolution()) _pprintLine_("saving results:"); 31 31 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceSlopeXEnum); 32 32 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceSlopeYEnum); -
issm/trunk/src/c/solutions/thermal_core.cpp
r11995 r12706 16 16 17 17 /*intermediary*/ 18 double melting_offset;18 IssmDouble melting_offset; 19 19 bool save_results; 20 20 bool dakota_analysis = false; … … 29 29 } 30 30 31 _printf_(VerboseSolution()," computing temperatures\n");31 if(VerboseSolution()) _pprintLine_(" computing temperatures"); 32 32 femmodel->SetCurrentConfiguration(ThermalAnalysisEnum); 33 33 solver_thermal_nonlinear(femmodel); 34 34 35 _printf_(VerboseSolution()," computing melting\n");35 if(VerboseSolution()) _pprintLine_(" computing melting"); 36 36 femmodel->SetCurrentConfiguration(MeltingAnalysisEnum); 37 37 solver_linear(femmodel); 38 38 39 39 if(save_results){ 40 _printf_(VerboseSolution()," saving results\n");40 if(VerboseSolution()) _pprintLine_(" saving results"); 41 41 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum); 42 42 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BasalforcingsMeltingRateEnum); -
issm/trunk/src/c/solutions/transient_core.cpp
r11995 r12706 23 23 24 24 /*parameters: */ 25 double starttime,finaltime,dt,yts;25 IssmDouble starttime,finaltime,dt,yts; 26 26 bool isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy; 27 27 bool save_results,dakota_analysis; … … 34 34 /*intermediary: */ 35 35 int step; 36 double time;36 IssmDouble time; 37 37 38 38 //first recover parameters common to all solutions … … 86 86 femmodel->parameters->SetParam(step,StepEnum); 87 87 88 _printf_(VerboseSolution(),"iteration %i/%g time [yr]: %-7.3g (time step: %.2g)\n",step,floor((finaltime-time)/dt)+step,time/yts,dt/yts);88 if(VerboseSolution()) _pprintLine_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << " time [yr]: " << time/yts << " (time step: " << dt/yts << ")"); 89 89 if(step%output_frequency==0 || time==finaltime) 90 90 save_results=true; … … 94 94 95 95 if(isthermal && dim==3){ 96 _printf_(VerboseSolution()," computing temperatures\n");96 if(VerboseSolution()) _pprintLine_(" computing temperatures"); 97 97 #ifdef _HAVE_THERMAL_ 98 98 if(isenthalpy==0){ … … 103 103 } 104 104 #else 105 _error _("ISSM was not compiled with thermal capabilities. Exiting");105 _error2_("ISSM was not compiled with thermal capabilities. Exiting"); 106 106 #endif 107 107 } 108 108 109 109 if(isdiagnostic){ 110 _printf_(VerboseSolution()," computing new velocity\n");110 if(VerboseSolution()) _pprintLine_(" computing new velocity"); 111 111 #ifdef _HAVE_DIAGNOSTIC_ 112 112 diagnostic_core(femmodel); 113 113 #else 114 _error _("ISSM was not compiled with diagnostic capabilities. Exiting");114 _error2_("ISSM was not compiled with diagnostic capabilities. Exiting"); 115 115 #endif 116 116 } 117 117 118 118 if(isprognostic){ 119 _printf_(VerboseSolution()," computing new thickness\n");119 if(VerboseSolution()) _pprintLine_(" computing new thickness"); 120 120 prognostic_core(femmodel); 121 _printf_(VerboseSolution()," updating vertices positions\n");121 if(VerboseSolution()) _pprintLine_(" updating vertices positions"); 122 122 UpdateVertexPositionsx(femmodel->elements, femmodel->nodes,femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters); 123 123 } 124 124 125 125 if(isgroundingline){ 126 _printf_(VerboseSolution()," computing new grounding line position\n");126 if(VerboseSolution()) _pprintLine_(" computing new grounding line position"); 127 127 #ifdef _HAVE_GROUNDINGLINE_ 128 128 GroundinglineMigrationx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters); 129 129 #else 130 _error _("ISSM was not compiled with grounding line migration capabilities. Exiting");130 _error2_("ISSM was not compiled with grounding line migration capabilities. Exiting"); 131 131 #endif 132 132 } … … 134 134 /*unload results*/ 135 135 if(save_results){ 136 _printf_(VerboseSolution()," saving transient results\n");136 if(VerboseSolution()) _pprintLine_(" saving transient results"); 137 137 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum); 138 138 InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum); … … 141 141 RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs); 142 142 143 _printf_(VerboseSolution()," saving temporary results\n");143 if(VerboseSolution()) _pprintLine_(" saving temporary results"); 144 144 OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results); 145 145 } … … 147 147 148 148 /*Free ressources:*/ 149 x free((void**)&requested_outputs);149 xDelete<int>(requested_outputs); 150 150 } -
issm/trunk/src/c/solvers/solver_newton.cpp
r12330 r12706 17 17 int num_unstable_constraints; 18 18 int count; 19 double kmax;19 IssmDouble kmax; 20 20 Matrix* Kff = NULL; 21 21 Matrix* Kfs = NULL; … … 70 70 bool max_iteration_state=false; 71 71 int tempStep=1; 72 double tempTime=1.0;72 IssmDouble tempTime=1.0; 73 73 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 74 74 break; 75 75 } 76 76 if(count>=max_nonlinear_iterations){ 77 _p rintf_(true," maximum number of Newton iterations (%i) exceeded\n",max_nonlinear_iterations);77 _pprintLine_(" maximum number of Newton iterations (" << max_nonlinear_iterations << ") exceeded"); 78 78 bool max_iteration_state=true; 79 79 int tempStep=1; 80 double tempTime=1.0;80 IssmDouble tempTime=1.0; 81 81 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 82 82 break; … … 100 100 } 101 101 102 _printf_(VerboseConvergence(),"\n total number of iterations: %i\n",count-1);102 if(VerboseConvergence()) _pprintLine_("\n total number of iterations: " << count-1); 103 103 104 104 /*clean-up*/ -
issm/trunk/src/c/solvers/solver_nonlinear.cpp
r12330 r12706 73 73 74 74 ConstraintsStatex(&constraints_converged, &num_unstable_constraints, femmodel->elements,femmodel->nodes,femmodel->vertices,loads,femmodel->materials,femmodel->parameters); 75 _printf_(VerboseConvergence()," number of unstable constraints: %i\n",num_unstable_constraints);75 if(VerboseConvergence()) _pprintLine_(" number of unstable constraints: " << num_unstable_constraints); 76 76 77 77 //rift convergence … … 88 88 bool max_iteration_state=false; 89 89 int tempStep=1; 90 double tempTime=1.0;90 IssmDouble tempTime=1.0; 91 91 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 92 92 break; 93 93 } 94 94 if(count>=max_nonlinear_iterations){ 95 _p rintf_(true," maximum number of nonlinear iterations (%i) exceeded\n",max_nonlinear_iterations);95 _pprintLine_(" maximum number of nonlinear iterations (" << max_nonlinear_iterations << ") exceeded"); 96 96 converged=true; 97 97 InputUpdateFromConstantx( femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,converged,ConvergedEnum); … … 99 99 bool max_iteration_state=true; 100 100 int tempStep=1; 101 double tempTime=1.0;101 IssmDouble tempTime=1.0; 102 102 femmodel->results->AddObject(new BoolExternalResult(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, tempStep, tempTime)); 103 103 break; … … 105 105 } 106 106 107 _printf_(VerboseConvergence(),"\n total number of iterations: %i\n",count-1);107 if(VerboseConvergence()) _pprintLine_("\n total number of iterations: " << count-1); 108 108 109 109 /*clean-up*/ -
issm/trunk/src/c/solvers/solver_stokescoupling_nonlinear.cpp
r11995 r12706 91 91 if(converged==true)break; 92 92 if(count>=max_nonlinear_iterations){ 93 _p rintf_(true," maximum number of iterations (%i) exceeded\n",max_nonlinear_iterations);93 _pprintLine_(" maximum number of iterations (" << max_nonlinear_iterations << ") exceeded"); 94 94 break; 95 95 } -
issm/trunk/src/c/solvers/solver_thermal_nonlinear.cpp
r11995 r12706 16 16 Vector* tf_old=NULL; 17 17 Vector* ys=NULL; 18 double melting_offset;18 IssmDouble melting_offset; 19 19 20 20 /*intermediary: */ … … 47 47 converged=false; 48 48 49 _printf_(VerboseSolution(),"%s\n","starting direct shooting method");49 if(VerboseSolution()) _pprintLine_("starting direct shooting method"); 50 50 InputUpdateFromConstantx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,true,ResetPenaltiesEnum); 51 51 InputUpdateFromConstantx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,false,ConvergedEnum); … … 66 66 67 67 if (!converged){ 68 _printf_(VerboseConvergence(),"%s%i\n"," #unstable constraints = ",num_unstable_constraints);68 if(VerboseConvergence()) _pprintLine_(" #unstable constraints = " << num_unstable_constraints); 69 69 if (num_unstable_constraints <= thermal_penalty_threshold)converged=true; 70 70 if (count>=thermal_maxiter){ 71 71 converged=true; 72 _p rintf_(true," maximum number of iterations (%i) exceeded\n",thermal_maxiter);72 _pprintLine_(" maximum number of iterations (" << thermal_maxiter << ") exceeded"); 73 73 } 74 74 } -
issm/trunk/src/c/toolkits/issm/SeqMat.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 19 19 20 20 /*SeqMat constructors and destructor*/ 21 /*FUNCTION SeqMat::SeqMat(){{{ 1*/21 /*FUNCTION SeqMat::SeqMat(){{{*/ 22 22 SeqMat::SeqMat(){ 23 23 … … 27 27 } 28 28 /*}}}*/ 29 /*FUNCTION SeqMat::SeqMat(int M,int N){{{ 1*/29 /*FUNCTION SeqMat::SeqMat(int M,int N){{{*/ 30 30 SeqMat::SeqMat(int pM,int pN){ 31 31 … … 33 33 this->N=pN; 34 34 this->matrix=NULL; 35 if(M*N) this->matrix= (double*)xcalloc(pM*pN,sizeof(double));36 } 37 /*}}}*/ 38 /*FUNCTION SeqMat::SeqMat(int M,int N, double sparsity){{{1*/39 SeqMat::SeqMat(int pM,int pN, double sparsity){40 41 this->M=pM; 42 this->N=pN; 43 this->matrix=NULL; 44 if(M*N) this->matrix= (double*)xcalloc(pM*pN,sizeof(double));45 } 46 /*}}}*/ 47 /*FUNCTION SeqMat( double* serial_mat,int M,int N,double sparsity){{{1*/48 SeqMat::SeqMat( double* serial_mat,int pM,int pN,double sparsity){35 if(M*N) this->matrix=xNewZeroInit<IssmDouble>(pM*pN); 36 } 37 /*}}}*/ 38 /*FUNCTION SeqMat::SeqMat(int M,int N, IssmDouble sparsity){{{*/ 39 SeqMat::SeqMat(int pM,int pN, IssmDouble sparsity){ 40 41 this->M=pM; 42 this->N=pN; 43 this->matrix=NULL; 44 if(M*N) this->matrix=xNewZeroInit<IssmDouble>(pM*pN); 45 } 46 /*}}}*/ 47 /*FUNCTION SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity){{{*/ 48 SeqMat::SeqMat(IssmDouble* serial_mat,int pM,int pN,IssmDouble sparsity){ 49 49 50 50 int i,j; … … 54 54 this->matrix=NULL; 55 55 if(M*N){ 56 this->matrix= (double*)xcalloc(pM*pN,sizeof(double));57 memcpy(this->matrix,serial_mat,pM*pN*sizeof(double));58 } 59 60 } 61 /*}}}*/ 62 /*FUNCTION SeqMat::SeqMat(int M,int N, int connectivity, int numberofdofspernode){{{ 1*/56 this->matrix=xNewZeroInit<IssmDouble>(pM*pN); 57 xMemCpy<IssmDouble>(this->matrix,serial_mat,pM*pN); 58 } 59 60 } 61 /*}}}*/ 62 /*FUNCTION SeqMat::SeqMat(int M,int N, int connectivity, int numberofdofspernode){{{*/ 63 63 SeqMat::SeqMat(int pM,int pN, int connectivity,int numberofdofspernode){ 64 64 … … 66 66 this->N=pN; 67 67 this->matrix=NULL; 68 if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));69 } 70 /*}}}*/ 71 /*FUNCTION SeqMat::~SeqMat(){{{ 1*/68 if(M*N) this->matrix=xNewZeroInit<IssmDouble>(pM*pN); 69 } 70 /*}}}*/ 71 /*FUNCTION SeqMat::~SeqMat(){{{*/ 72 72 SeqMat::~SeqMat(){ 73 73 74 x free((void**)&this->matrix);74 xDelete<IssmDouble>(this->matrix); 75 75 M=0; 76 76 N=0; … … 79 79 80 80 /*SeqMat specific routines: */ 81 /*FUNCTION SeqMat::Echo{{{ 1*/81 /*FUNCTION SeqMat::Echo{{{*/ 82 82 void SeqMat::Echo(void){ 83 83 84 84 int i,j; 85 printf("SeqMat size %i-%i\n",this->M,this->N);85 _printLine_("SeqMat size " << this->M << "-" << this->N); 86 86 for(i=0;i<M;i++){ 87 87 for(j=0;j<N;j++){ 88 printf("%g ",this->matrix[N*i+j]);88 _printString_(this->matrix[N*i+j] << " "); 89 89 } 90 printf("\n");91 } 92 } 93 /*}}}*/ 94 /*FUNCTION SeqMat::Assemble{{{ 1*/90 _printLine_(""); 91 } 92 } 93 /*}}}*/ 94 /*FUNCTION SeqMat::Assemble{{{*/ 95 95 void SeqMat::Assemble(void){ 96 96 … … 99 99 } 100 100 /*}}}*/ 101 /*FUNCTION SeqMat::Norm{{{ 1*/102 double SeqMat::Norm(NormMode mode){103 104 double norm;105 double absolute;101 /*FUNCTION SeqMat::Norm{{{*/ 102 IssmDouble SeqMat::Norm(NormMode mode){ 103 104 IssmDouble norm; 105 IssmDouble absolute; 106 106 int i,j; 107 107 … … 119 119 break; 120 120 default: 121 _error _("unknown norm !");122 break; 123 } 124 } 125 /*}}}*/ 126 /*FUNCTION SeqMat::GetSize{{{ 1*/121 _error2_("unknown norm !"); 122 break; 123 } 124 } 125 /*}}}*/ 126 /*FUNCTION SeqMat::GetSize{{{*/ 127 127 void SeqMat::GetSize(int* pM,int* pN){ 128 128 … … 132 132 } 133 133 /*}}}*/ 134 /*FUNCTION SeqMat::GetLocalSize{{{ 1*/134 /*FUNCTION SeqMat::GetLocalSize{{{*/ 135 135 void SeqMat::GetLocalSize(int* pM,int* pN){ 136 136 … … 140 140 } 141 141 /*}}}*/ 142 /*FUNCTION SeqMat::MatMult{{{ 1*/142 /*FUNCTION SeqMat::MatMult{{{*/ 143 143 void SeqMat::MatMult(SeqVec* X,SeqVec* AX){ 144 144 145 145 int i,j; 146 146 int XM,AXM; 147 double dummy;147 IssmDouble dummy; 148 148 149 149 X->GetSize(&XM); 150 150 AX->GetSize(&AXM); 151 151 152 if(M!=AXM)_error _("A and AX should have the same number of rows!");153 if(N!=XM)_error _("A and X should have the same number of columns!");152 if(M!=AXM)_error2_("A and AX should have the same number of rows!"); 153 if(N!=XM)_error2_("A and X should have the same number of columns!"); 154 154 155 155 for(i=0;i<M;i++){ … … 163 163 } 164 164 /*}}}*/ 165 /*FUNCTION SeqMat::Duplicate{{{ 1*/165 /*FUNCTION SeqMat::Duplicate{{{*/ 166 166 SeqMat* SeqMat::Duplicate(void){ 167 167 168 double dummy=0;168 IssmDouble dummy=0; 169 169 170 170 return new SeqMat(this->matrix,this->M,this->N,dummy); … … 172 172 } 173 173 /*}}}*/ 174 /*FUNCTION SeqMat::ToSerial{{{ 1*/175 double* SeqMat::ToSerial(void){176 177 double* buffer=NULL;174 /*FUNCTION SeqMat::ToSerial{{{*/ 175 IssmDouble* SeqMat::ToSerial(void){ 176 177 IssmDouble* buffer=NULL; 178 178 179 179 if(this->M*this->N){ 180 buffer= (double*)xmalloc(this->M*this->N*sizeof(double));181 memcpy(buffer,this->matrix,this->M*this->N*sizeof(double));180 buffer=xNew<IssmDouble>(this->M*this->N); 181 xMemCpy<IssmDouble>(buffer,this->matrix,this->M*this->N); 182 182 } 183 183 return buffer; … … 185 185 } 186 186 /*}}}*/ 187 /*FUNCTION SeqMat::SetValues{{{ 1*/188 void SeqMat::SetValues(int m,int* idxm,int n,int* idxn, double* values,InsMode mode){187 /*FUNCTION SeqMat::SetValues{{{*/ 188 void SeqMat::SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){ 189 189 190 190 int i,j; … … 197 197 break; 198 198 default: 199 _error _("unknown insert mode!");200 break; 201 } 202 203 } 204 /*}}}*/ 205 /*FUNCTION SeqMat::Convert{{{ 1*/199 _error2_("unknown insert mode!"); 200 break; 201 } 202 203 } 204 /*}}}*/ 205 /*FUNCTION SeqMat::Convert{{{*/ 206 206 void SeqMat::Convert(MatrixType type){ 207 207 -
issm/trunk/src/c/toolkits/issm/SeqMat.h
r12330 r12706 1 1 /*!\file: SeqMat.h 2 * \brief wrapper to SeqMat objects, which are just wrappers to a simple double* buffer.2 * \brief wrapper to SeqMat objects, which are just wrappers to a simple IssmDouble* buffer. 3 3 */ 4 4 … … 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #ifdef HAVE_CONFIG_H 11 11 #include <config.h> … … 24 24 25 25 int M,N; 26 double* matrix;26 IssmDouble* matrix; 27 27 28 /*SeqMat constructors, destructors {{{ 1*/28 /*SeqMat constructors, destructors {{{*/ 29 29 SeqMat(); 30 30 SeqMat(int M,int N); 31 SeqMat(int M,int N, double sparsity);32 SeqMat( double* serial_mat,int M,int N,double sparsity);31 SeqMat(int M,int N,IssmDouble sparsity); 32 SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity); 33 33 SeqMat(int M,int N,int connectivity,int numberofdofspernode); 34 34 ~SeqMat(); 35 35 /*}}}*/ 36 /*SeqMat specific routines {{{ 1*/36 /*SeqMat specific routines {{{*/ 37 37 void Echo(void); 38 38 void Assemble(void); 39 double Norm(NormMode norm_type);39 IssmDouble Norm(NormMode norm_type); 40 40 void GetSize(int* pM,int* pN); 41 41 void GetLocalSize(int* pM,int* pN); 42 42 void MatMult(SeqVec* X,SeqVec* AX); 43 43 SeqMat* Duplicate(void); 44 double* ToSerial(void);45 void SetValues(int m,int* idxm,int n,int* idxn, double* values,InsMode mode);44 IssmDouble* ToSerial(void); 45 void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode); 46 46 void Convert(MatrixType type); 47 47 /*}}}*/ -
issm/trunk/src/c/toolkits/issm/SeqVec.cpp
r12330 r12706 4 4 5 5 /*Headers:*/ 6 /*{{{ 1*/6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> … … 19 19 20 20 /*SeqVec constructors and destructor*/ 21 /*FUNCTION SeqVec::SeqVec(){{{ 1*/21 /*FUNCTION SeqVec::SeqVec(){{{*/ 22 22 SeqVec::SeqVec(){ 23 23 … … 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{ 1*/28 /*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{*/ 29 29 SeqVec::SeqVec(int pM,bool fromlocalsize){ 30 30 31 31 this->M=pM; 32 32 this->vector=NULL; 33 if(this->M) this->vector= (double*)xcalloc(pM,sizeof(double));34 } 35 /*}}}*/ 36 /*FUNCTION SeqVec::SeqVec( double* serial_vec,int M){{{1*/37 SeqVec::SeqVec( double* buffer,int pM){33 if(this->M) this->vector=xNewZeroInit<IssmDouble>(pM); 34 } 35 /*}}}*/ 36 /*FUNCTION SeqVec::SeqVec(IssmDouble* serial_vec,int M){{{*/ 37 SeqVec::SeqVec(IssmDouble* buffer,int pM){ 38 38 39 39 int i,j; … … 42 42 this->vector=NULL; 43 43 if(this->M){ 44 this->vector= (double*)xcalloc(pM,sizeof(double));45 memcpy(this->vector,buffer,pM*sizeof(double));46 } 47 } 48 /*}}}*/ 49 /*FUNCTION SeqVec::~SeqVec(){{{ 1*/44 this->vector=xNewZeroInit<IssmDouble>(pM); 45 xMemCpy<IssmDouble>(this->vector,buffer,pM); 46 } 47 } 48 /*}}}*/ 49 /*FUNCTION SeqVec::~SeqVec(){{{*/ 50 50 SeqVec::~SeqVec(){ 51 x free((void**)&this->vector);51 xDelete<IssmDouble>(this->vector); 52 52 M=0; 53 53 } … … 55 55 56 56 /*SeqVec specific routines: */ 57 /*FUNCTION SeqVec::Echo{{{ 1*/57 /*FUNCTION SeqVec::Echo{{{*/ 58 58 void SeqVec::Echo(void){ 59 59 60 60 int i; 61 printf("SeqVec size %i\n",this->M);61 _printLine_("SeqVec size " << this->M); 62 62 for(i=0;i<M;i++){ 63 printf("%g\n ",vector[i]);64 } 65 } 66 /*}}}*/ 67 68 /*FUNCTION SeqVec::Assemble{{{ 1*/63 _printString_(vector[i] << "\n "); 64 } 65 } 66 /*}}}*/ 67 68 /*FUNCTION SeqVec::Assemble{{{*/ 69 69 void SeqVec::Assemble(void){ 70 70 … … 73 73 } 74 74 /*}}}*/ 75 /*FUNCTION SeqVec::SetValues{{{ 1*/76 void SeqVec::SetValues(int ssize, int* list, double* values, InsMode mode){75 /*FUNCTION SeqVec::SetValues{{{*/ 76 void SeqVec::SetValues(int ssize, int* list, IssmDouble* values, InsMode mode){ 77 77 78 78 int i; … … 85 85 break; 86 86 default: 87 _error _("unknown insert mode!");88 break; 89 } 90 91 } 92 /*}}}*/ 93 /*FUNCTION SeqVec::SetValue{{{ 1*/94 void SeqVec::SetValue(int dof, double value, InsMode mode){87 _error2_("unknown insert mode!"); 88 break; 89 } 90 91 } 92 /*}}}*/ 93 /*FUNCTION SeqVec::SetValue{{{*/ 94 void SeqVec::SetValue(int dof, IssmDouble value, InsMode mode){ 95 95 96 96 switch(mode){ … … 102 102 break; 103 103 default: 104 _error _("unknown insert mode!");105 break; 106 } 107 } 108 /*}}}*/ 109 /*FUNCTION SeqVec::GetValue{{{ 1*/110 void SeqVec::GetValue( double* pvalue,int dof){104 _error2_("unknown insert mode!"); 105 break; 106 } 107 } 108 /*}}}*/ 109 /*FUNCTION SeqVec::GetValue{{{*/ 110 void SeqVec::GetValue(IssmDouble* pvalue,int dof){ 111 111 112 112 *pvalue=this->vector[dof]; … … 115 115 /*}}}*/ 116 116 117 /*FUNCTION SeqVec::GetSize{{{ 1*/117 /*FUNCTION SeqVec::GetSize{{{*/ 118 118 void SeqVec::GetSize(int* pM){ 119 119 … … 122 122 } 123 123 /*}}}*/ 124 /*FUNCTION SeqVec::GetLocalSize{{{ 1*/124 /*FUNCTION SeqVec::GetLocalSize{{{*/ 125 125 void SeqVec::GetLocalSize(int* pM){ 126 126 … … 129 129 } 130 130 /*}}}*/ 131 /*FUNCTION SeqVec::Duplicate{{{ 1*/131 /*FUNCTION SeqVec::Duplicate{{{*/ 132 132 SeqVec* SeqVec::Duplicate(void){ 133 133 … … 136 136 } 137 137 /*}}}*/ 138 /*FUNCTION SeqVec::Set{{{ 1*/139 void SeqVec::Set( double value){138 /*FUNCTION SeqVec::Set{{{*/ 139 void SeqVec::Set(IssmDouble value){ 140 140 141 141 int i; … … 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION SeqVec::AXPY{{{ 1*/147 void SeqVec::AXPY(SeqVec* X, double a){146 /*FUNCTION SeqVec::AXPY{{{*/ 147 void SeqVec::AXPY(SeqVec* X, IssmDouble a){ 148 148 149 149 int i; … … 154 154 } 155 155 /*}}}*/ 156 /*FUNCTION SeqVec::AYPX{{{ 1*/157 void SeqVec::AYPX(SeqVec* X, double a){156 /*FUNCTION SeqVec::AYPX{{{*/ 157 void SeqVec::AYPX(SeqVec* X, IssmDouble a){ 158 158 159 159 int i; … … 164 164 } 165 165 /*}}}*/ 166 /*FUNCTION SeqVec::ToMPISerial{{{ 1*/167 double* SeqVec::ToMPISerial(void){168 169 double* buffer=NULL;166 /*FUNCTION SeqVec::ToMPISerial{{{*/ 167 IssmDouble* SeqVec::ToMPISerial(void){ 168 169 IssmDouble* buffer=NULL; 170 170 171 171 if(this->M){ 172 buffer= (double*)xmalloc(this->M*sizeof(double));173 memcpy(buffer,this->vector,this->M*sizeof(double));172 buffer=xNew<IssmDouble>(this->M); 173 xMemCpy<IssmDouble>(buffer,this->vector,this->M); 174 174 } 175 175 return buffer; … … 177 177 } 178 178 /*}}}*/ 179 /*FUNCTION SeqVec::Copy{{{ 1*/179 /*FUNCTION SeqVec::Copy{{{*/ 180 180 void SeqVec::Copy(SeqVec* to){ 181 181 … … 187 187 } 188 188 /*}}}*/ 189 /*FUNCTION SeqVec::Norm{{{ 1*/190 double SeqVec::Norm(NormMode mode){191 192 double norm;189 /*FUNCTION SeqVec::Norm{{{*/ 190 IssmDouble SeqVec::Norm(NormMode mode){ 191 192 IssmDouble norm; 193 193 int i; 194 194 … … 204 204 break; 205 205 default: 206 _error _("unknown norm !");207 break; 208 } 209 } 210 /*}}}*/ 211 /*FUNCTION SeqVec::Scale{{{ 1*/212 void SeqVec::Scale( double scale_factor){206 _error2_("unknown norm !"); 207 break; 208 } 209 } 210 /*}}}*/ 211 /*FUNCTION SeqVec::Scale{{{*/ 212 void SeqVec::Scale(IssmDouble scale_factor){ 213 213 214 214 int i; … … 217 217 } 218 218 /*}}}*/ 219 /*FUNCTION SeqVec::Dot{{{ 1*/220 double SeqVec::Dot(SeqVec* input){221 222 int i; 223 224 double dot=0;219 /*FUNCTION SeqVec::Dot{{{*/ 220 IssmDouble SeqVec::Dot(SeqVec* input){ 221 222 int i; 223 224 IssmDouble dot=0; 225 225 for(i=0;i<this->M;i++)dot+=this->vector[i]*input->vector[i]; 226 226 return dot; … … 228 228 } 229 229 /*}}}*/ 230 /*FUNCTION SeqVec::PointwiseDivide{{{ 1*/230 /*FUNCTION SeqVec::PointwiseDivide{{{*/ 231 231 void SeqVec::PointwiseDivide(SeqVec* x,SeqVec* y){ 232 232 -
issm/trunk/src/c/toolkits/issm/SeqVec.h
r12330 r12706 1 1 /*!\file: SeqVec.h 2 * \brief wrapper to our SeqVec object, which is just a wrapper to a double*2 * \brief wrapper to our SeqVec object, which is just a wrapper to a IssmDouble* 3 3 */ 4 4 … … 7 7 8 8 /*Headers:*/ 9 /*{{{ 1*/9 /*{{{*/ 10 10 #ifdef HAVE_CONFIG_H 11 11 #include <config.h> … … 22 22 public: 23 23 24 double* vector;24 IssmDouble* vector; 25 25 int M; 26 26 27 /*SeqVec constructors, destructors {{{ 1*/27 /*SeqVec constructors, destructors {{{*/ 28 28 SeqVec(); 29 29 SeqVec(int M,bool fromlocalsize=false); 30 SeqVec( double* buffer, int M);30 SeqVec(IssmDouble* buffer, int M); 31 31 ~SeqVec(); 32 32 /*}}}*/ 33 /*SeqVec specific routines {{{ 1*/33 /*SeqVec specific routines {{{*/ 34 34 void Echo(void); 35 35 void Assemble(void); 36 void SetValues(int ssize, int* list, double* values, InsMode mode);37 void SetValue(int dof, double value, InsMode mode);38 void GetValue( double* pvalue, int dof);36 void SetValues(int ssize, int* list, IssmDouble* values, InsMode mode); 37 void SetValue(int dof, IssmDouble value, InsMode mode); 38 void GetValue(IssmDouble* pvalue, int dof); 39 39 void GetSize(int* pM); 40 40 void GetLocalSize(int* pM); 41 41 SeqVec* Duplicate(void); 42 void Set( double value);43 void AXPY(SeqVec* X, double a);44 void AYPX(SeqVec* X, double a);45 double* ToMPISerial(void);42 void Set(IssmDouble value); 43 void AXPY(SeqVec* X, IssmDouble a); 44 void AYPX(SeqVec* X, IssmDouble a); 45 IssmDouble* ToMPISerial(void); 46 46 void Copy(SeqVec* to); 47 double Norm(NormMode norm_type);48 void Scale( double scale_factor);47 IssmDouble Norm(NormMode norm_type); 48 void Scale(IssmDouble scale_factor); 49 49 void PointwiseDivide(SeqVec* x,SeqVec* y); 50 double Dot(SeqVec* vector);50 IssmDouble Dot(SeqVec* vector); 51 51 /*}}}*/ 52 52 }; -
issm/trunk/src/c/toolkits/issm/issmtoolkit.h
r11995 r12706 6 6 #define _ISSM_TOOLKIT_H_ 7 7 8 #include "../../include/include.h" 9 8 10 #include "./SeqMat.h" 9 11 #include "./SeqVec.h" -
issm/trunk/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
r10087 r12706 13 13 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); 14 14 #elif _METIS_VERSION_ == 5 15 /*This interface is heavily changed. More options, different way of meshing, etc ...: */15 /*This interface is heavily changed. More options, different ways of meshing, etc ...: */ 16 16 int i; 17 17 … … 21 21 idx_t k=0; 22 22 real_t* tpwgts=NULL; 23 24 25 23 26 24 /*setup options: */ … … 40 38 options[METIS_OPTION_NCUTS] = 1; 41 39 42 43 40 /*create eptr: */ 44 eptr= (idx_t*)xmalloc((*pnumberofelements+1)*sizeof(idx_t));41 eptr=xNew<idx_t>((*pnumberofelements+1)); 45 42 eptr[0]=0; 46 43 for(i=0;i<*pnumberofelements;i++){ … … 49 46 } 50 47 51 52 48 /*create tpwgts: */ 53 tpwgts= (real_t*)xmalloc(*pnum_procs*sizeof(real_t));49 tpwgts=xNew<real_t>(*pnum_procs); 54 50 for(i=0;i<*pnum_procs;i++){ 55 51 tpwgts[i]=1.0/(*pnum_procs); 56 52 } 57 53 58 59 54 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index, 60 NULL, NULL, pnum_procs, tpwgts, options, &objval, 61 epart, npart); 62 55 NULL, NULL, pnum_procs, tpwgts, options, &objval,epart, npart); 63 56 64 57 #else 65 _error _("METIS version not supported yet");58 _error2_("METIS version not supported yet"); 66 59 #endif 67 60 } -
issm/trunk/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp
r11995 r12706 5 5 #include <stdio.h> 6 6 #include <math.h> 7 8 9 7 #include "../../../shared/shared.h" 10 8 … … 24 22 25 23 /*We are not bound by any library, just use what seems most logical*/ 26 num_local_rows= (int*)xmalloc(num_procs*sizeof(int));24 num_local_rows=xNew<int>(num_procs); 27 25 28 26 for (i=0;i<num_procs;i++){ 29 30 27 /*Here, we use floor. We under distribute rows. The rows 31 28 left are then redistributed, therefore resulting in a … … 39 36 num_local_rows[i]++; 40 37 } 41 42 38 local_size=num_local_rows[my_rank]; 43 39 44 40 /*free ressources: */ 45 x free((void**)&num_local_rows);41 xDelete<int>(num_local_rows); 46 42 47 43 /*return size: */ -
issm/trunk/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
r11995 r12706 20 20 21 21 /*Gather all range values into allranges, for all nodes*/ 22 allranges= (int*)xmalloc(num_procs*sizeof(int));22 allranges=xNew<int>(num_procs); 23 23 MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD); 24 25 24 26 25 /*From all ranges, get lower row and upper row*/ … … 31 30 upper_row=upper_row+allranges[i]; 32 31 } 33 34 /*free: */35 xfree((void**)&allranges);36 32 37 33 /*Assign output pointers: */ 34 xDelete<int>(allranges); 38 35 *plower_row=lower_row; 39 36 *pupper_row=upper_row; 40 41 37 return 1; 42 38 } -
issm/trunk/src/c/toolkits/petsc/patches/GetOwnershipBoundariesFromRange.cpp
r9320 r12706 28 28 29 29 /*Gather all range values into allranges, for all nodes*/ 30 allranges= (int*)xmalloc(num_procs*sizeof(int));30 allranges=xNew<int>(num_procs); 31 31 MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD); 32 32 … … 42 42 *plower_row=lower_row; 43 43 *pupper_row=upper_row; 44 45 /*Free ressources:*/ 46 xfree((void**)&allranges); 47 44 xDelete<int>(allranges); 48 45 } -
issm/trunk/src/c/toolkits/petsc/patches/ISSMToPetscInsertMode.cpp
r11995 r12706 30 30 break; 31 31 default: 32 _error _("unknown insert mode!");32 _error2_("unknown insert mode!"); 33 33 break; 34 34 } -
issm/trunk/src/c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp
r11995 r12706 30 30 break; 31 31 default: 32 _error _("unknown matrix type !");32 _error2_("unknown matrix type !"); 33 33 break; 34 34 } -
issm/trunk/src/c/toolkits/petsc/patches/ISSMToPetscNormMode.cpp
r11995 r12706 30 30 break; 31 31 default: 32 _error _("unknown norm !");32 _error2_("unknown norm !"); 33 33 break; 34 34 } -
issm/trunk/src/c/toolkits/petsc/patches/MatInvert.cpp
r12330 r12706 29 29 /*Some checks: */ 30 30 MatGetSize(matrix,&M,&N); 31 if(M!=N) _error _("trying to invert a non square matrix!");31 if(M!=N) _error2_("trying to invert a non square matrix!"); 32 32 33 33 /*Create identitiy matrix: */ -
issm/trunk/src/c/toolkits/petsc/patches/MatMultPatch.cpp
r9826 r12706 64 64 } 65 65 else{ 66 result=1; \66 result=1; 67 67 } 68 68 return result; … … 89 89 range=upper_row-lower_row+1; 90 90 if (range){ 91 index= (int*)xmalloc(range*sizeof(int));92 values= (double*)xmalloc(range*sizeof(double));91 index=xNew<int>(range); 92 values=xNew<double>(range); 93 93 for (int i=0;i<range;i++){ 94 94 *(index+i)=lower_row+i; … … 103 103 104 104 /*Free ressources:*/ 105 x free((void**)&index);106 x free((void**)&values);105 xDelete<int>(index); 106 xDelete<double>(values); 107 107 108 108 /*Assign output pointers:*/ -
issm/trunk/src/c/toolkits/petsc/patches/MatPartition.cpp
r11995 r12706 62 62 } 63 63 else{ 64 _error _("MatType %s not supported yet",type);64 _error2_("MatType " << type << " not supported yet"); 65 65 } 66 66 /*Assemble*/ … … 77 77 count=0; 78 78 if (range){ 79 node_rows= (int*)xmalloc(range*sizeof(int)); //this is the maximum number of rows one node can extract.79 node_rows=xNew<int>(range); //this is the maximum number of rows one node can extract. 80 80 81 81 for (i=0;i<row_partition_vector_size;i++){ … … 98 98 99 99 /*Same deal for columns*/ 100 node_cols= (int*)xmalloc(col_partition_vector_size*sizeof(int));100 node_cols=xNew<int>(col_partition_vector_size); 101 101 for (i=0;i<col_partition_vector_size;i++){ 102 102 *(node_cols+i)=(int)*(col_partition_vector+i)-1; … … 128 128 129 129 /*Free ressources:*/ 130 x free((void**)&node_rows);131 x free((void**)&node_cols);130 xDelete<int>(node_rows); 131 xDelete<int>(node_cols); 132 132 ISFree(&col_index); 133 133 ISFree(&row_index); -
issm/trunk/src/c/toolkits/petsc/patches/MatToSerial.cpp
r11995 r12706 32 32 double* outmatrix=NULL; 33 33 34 35 34 /*get matrix size: */ 36 35 MatGetSize(matrix,&M,&N); … … 42 41 43 42 /*Local and global allocation*/ 44 if (my_rank==0)outmatrix= (double*)xmalloc(M*N*sizeof(double));43 if (my_rank==0)outmatrix=xNew<double>(M*N); 45 44 46 45 if (range){ 47 local_matrix= (double*)xmalloc(N*range*sizeof(double));48 idxm= (int*)xmalloc(range*sizeof(int));49 idxn= (int*)xmalloc(N*sizeof(int));46 local_matrix=xNew<double>(N*range); 47 idxm=xNew<int>(range); 48 idxn=xNew<int>(N); 50 49 51 50 for (i=0;i<N;i++){ … … 78 77 //Still have the local_matrix on node 0 to take care of. 79 78 memcpy(outmatrix,local_matrix,N*range*sizeof(double)); 80 81 79 } 82 80 83 81 /*Assign output pointer: */ 84 82 *poutmatrix=outmatrix; 85 86 xfree((void**)&idxm); 87 xfree((void**)&idxn); 88 xfree((void**)&local_matrix); 89 83 xDelete<int>(idxm); 84 xDelete<int>(idxn); 85 xDelete<double>(local_matrix); 90 86 } -
issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp
r12330 r12706 20 20 #include "../../mpi/patches/mpipatches.h" 21 21 22 /*NewMat(int M,int N){{{ 1*/22 /*NewMat(int M,int N){{{*/ 23 23 Mat NewMat(int M,int N){ 24 24 … … 48 48 } 49 49 /*}}}*/ 50 /*NewMat(int M,int N,double sparsity){{{ 1*/50 /*NewMat(int M,int N,double sparsity){{{*/ 51 51 Mat NewMat(int M,int N,double sparsity){ 52 52 … … 81 81 } 82 82 /*}}}*/ 83 /*NewMat(int M,int N,int connectivity,int numberofdofspernode){{{ 1*/83 /*NewMat(int M,int N,int connectivity,int numberofdofspernode){{{*/ 84 84 Mat NewMat(int M,int N,int connectivity,int numberofdofspernode){ 85 85 -
issm/trunk/src/c/toolkits/petsc/patches/PetscMatrixToDoubleMatrix.cpp
r12330 r12706 36 36 MatGetSize(petsc_matrix,&rows,&cols); 37 37 38 idxm= (int*)xmalloc(rows*sizeof(int));39 idxn= (int*)xmalloc(cols*sizeof(int));38 idxm=xNew<int>(rows); 39 idxn=xNew<int>(cols); 40 40 41 41 for(i=0;i<rows;i++)idxm[i]=i; 42 42 for(i=0;i<cols;i++)idxn[i]=i; 43 43 44 matrix= (double*)xmalloc(rows*cols*sizeof(double));44 matrix=xNew<double>(rows*cols); 45 45 MatGetValues(petsc_matrix,rows,idxm,cols,idxn,matrix); 46 47 xDelete<int>(idxm); 48 xDelete<int>(idxn); 46 49 47 50 /*Assign output pointers: */ -
issm/trunk/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp
r11995 r12706 55 55 if(first[0]!='-'){ 56 56 /*This is not good, the option does not have '-'! Get out*/ 57 _error _("%s%s%s","Option ",first," should be preceded by '-'!");57 _error2_("Option " << first << " should be preceded by '-'!"); 58 58 } 59 59 /*Reduce first to bare option value*/ -
issm/trunk/src/c/toolkits/petsc/patches/PetscVectorToDoubleVector.cpp
r12330 r12706 28 28 VecGetSize(petsc_vector,&rows); 29 29 if(rows){ 30 idxm= (int*)xmalloc(rows*sizeof(int));31 vector= (double*)xmalloc(rows*sizeof(double));30 idxm=xNew<int>(rows); 31 vector=xNew<double>(rows); 32 32 for(i=0;i<rows;i++)idxm[i]=i; 33 34 33 VecGetValues(petsc_vector,rows,idxm,vector); 34 xDelete<int>(idxm); 35 35 } 36 36 } -
issm/trunk/src/c/toolkits/petsc/patches/SerialToVec.cpp
r11995 r12706 38 38 39 39 if (range){ 40 idxn= (int*)xmalloc(range*sizeof(int));41 values= (double*)xmalloc(range*sizeof(double));40 idxn=xNew<int>(range); 41 values=xNew<double>(range); 42 42 for (i=0;i<range;i++){ 43 43 idxn[i]=lower_row+i; … … 54 54 55 55 /*Free ressources:*/ 56 x free((void**)&idxn);57 x free((void**)&values);56 xDelete<int>(idxn); 57 xDelete<double>(values); 58 58 59 59 return outvector; -
issm/trunk/src/c/toolkits/petsc/patches/VecMerge.cpp
r9320 r12706 35 35 /*If the dimension of the partitioning vector is not the same as that of vector B, we have a problem: */ 36 36 if ( (row_partition_size !=MB) ){ 37 _error _("Dimensions of partitioning vector incompatible with dimensions of input vector\n");37 _error2_("Dimensions of partitioning vector incompatible with dimensions of input vector\n"); 38 38 } 39 39 … … 45 45 if (range){ 46 46 /*This node owns rows of vector B, get them*/ 47 idxm= (int*)xmalloc(range*sizeof(int));48 values= (double*)xmalloc(range*sizeof(double));47 idxm=xNew<int>(range); 48 values=xNew<double>(range); 49 49 for (i=0;i<range;i++){ 50 50 *(idxm+i)=lower_row+i; … … 63 63 64 64 /*Free ressources:*/ 65 xfree((void**)&idxm); 66 xfree((void**)&values); 67 65 xDelete<int>(idxm); 66 xDelete<double>(values); 68 67 } -
issm/trunk/src/c/toolkits/petsc/patches/VecPartition.cpp
r9320 r12706 56 56 57 57 if (range){ 58 node_rows= (int*)xmalloc(range*sizeof(int)); //this is the maximum number of rows one node can extract.58 node_rows=xNew<int>(range); //this is the maximum number of rows one node can extract. 59 59 60 60 count=0; … … 71 71 72 72 if (count){ 73 values= (double*)xmalloc(count*sizeof(double)); //holder for the values to be extracted from vectorA73 values=xNew<double>(count); //holder for the values to be extracted from vectorA 74 74 } 75 75 else{ 76 x free((void**)&node_rows); //count=0 means no values was condensed out for this node. null node_rows for use in VecGetValues.76 xDelete<int>(node_rows); //count=0 means no values was condensed out for this node. null node_rows for use in VecGetValues. 77 77 values=NULL; 78 78 } … … 110 110 VecAssemblyBegin(outvector); 111 111 VecAssemblyEnd(outvector); 112 113 112 } 114 113 115 114 /*Assign output pointers:*/ 116 115 *poutvector=outvector; 117 118 /*Free ressources:*/ 119 xfree((void**)&node_rows); 120 xfree((void**)&values); 121 116 xDelete<int>(node_rows); 117 xDelete<double>(values); 122 118 } -
issm/trunk/src/c/toolkits/petsc/patches/VecToMPISerial.cpp
r11995 r12706 42 42 43 43 /*Allocate gathered vector on all nodes .*/ 44 gathered_vector= (double*)xmalloc(vector_size*sizeof(double));44 gathered_vector=xNew<double>(vector_size); 45 45 46 46 /*Allocate local vectors*/ … … 50 50 51 51 if (range){ 52 idxn= (int*)xmalloc(range*sizeof(int));52 idxn=xNew<int>(range); 53 53 for (i=0;i<range;i++){ 54 54 *(idxn+i)=lower_row+i; 55 55 } 56 local_vector= (double*)xmalloc(range*sizeof(double));56 local_vector=xNew<double>(range); 57 57 /*Extract values from MPI vector to serial local_vector on each node*/ 58 58 VecGetValues(vector,range,idxn,local_vector); … … 87 87 88 88 /*free ressources: */ 89 x free((void**)&idxn);90 x free((void**)&local_vector);89 xDelete<int>(idxn); 90 xDelete<double>(local_vector); 91 91 92 92 return 1; -
issm/trunk/src/c/toolkits/petsc/patches/VecTranspose.cpp
r1 r12706 33 33 34 34 if (range){ 35 idxm= (int*)xmalloc(range*sizeof(int));36 tidxm= (int*)xmalloc(range*sizeof(int));35 idxm=xNew<int>(range); 36 tidxm=xNew<int>(range); 37 37 for (i=0;i<range;i++){ 38 38 *(idxm+i)=lower_row+i; 39 39 } 40 values= (double*)xmalloc(range*sizeof(double));41 tvalues= (double*)xmalloc(range*sizeof(double));40 values=xNew<double>(range); 41 tvalues=xNew<double>(range); 42 42 43 43 VecGetValues(vector,range,idxm,values); … … 56 56 57 57 /*Free ressources: */ 58 x free((void**)&idxm);59 x free((void**)&values);60 x free((void**)&tidxm);61 x free((void**)&tvalues);58 xDelete<int>(idxm); 59 xDelete<double>(values); 60 xDelete<int>(tidxm); 61 xDelete<double>(tvalues); 62 62 63 63 /*Assign output pointers: */ -
issm/trunk/src/c/toolkits/plapack/patches/CyclicalFactorization.cpp
r3595 r12706 44 44 int i; 45 45 46 decomp=x malloc(input*sizeof(int));46 decomp=xNew<int>(input); 47 47 *decomp=input; 48 48 for (i=0;i<input;i++){ … … 57 57 } 58 58 } 59 60 59 *pdecomp=decomp; 61 60 } -
issm/trunk/src/c/toolkits/plapack/patches/PlapackInvertMatrix.cpp
r6412 r12706 13 13 #include "../../scalapack/FortranMapping.h" 14 14 15 void PlapackInvertMatrixLocalCleanup(PLA_Obj* pa,PLA_Template* ptempl,double** parrayA, 16 int** pidxnA,MPI_Comm* pcomm_2d); 15 void PlapackInvertMatrixLocalCleanup(PLA_Obj* pa,PLA_Template* ptempl,double** parrayA,int** pidxnA,MPI_Comm* pcomm_2d); 17 16 18 17 int PlapackInvertMatrix(Mat* A,Mat* inv_A,int status,int con){ 19 /*inv_A does not yet exist, inv_A was just xmalloced, that's all*/18 /*inv_A does not yet exist, inv_A was just allocated, that's all*/ 20 19 21 20 /*Error management*/ 22 21 int i,j; 23 24 22 25 23 /*input*/ … … 53 51 54 52 /*Some dimensions checks: */ 55 if (mA!=nA) _error _("trying to take the invert of a non-square matrix!");53 if (mA!=nA) _error2_("trying to take the invert of a non-square matrix!"); 56 54 57 55 /* Set default Plapack parameters */ … … 94 92 /* Set the datatype */ 95 93 datatype = MPI_DOUBLE; 96 97 94 98 95 /* Copy A into a*/ … … 104 101 upper_row--; 105 102 range=upper_row-lower_row+1; 106 arrayA =xmalloc(nA*sizeof(double));107 idxnA =xmalloc(nA*sizeof(int));103 arrayA = xNew<double>(nA); 104 idxnA = xNew<int>(nA); 108 105 for (i=0;i<nA;i++){ 109 106 *(idxnA+i)=i; … … 128 125 PLA_Obj_free(&a); 129 126 PLA_Temp_free(&templ); 130 x free((void**)&arrayA);131 x free((void**)&idxnA);127 xDelete<double>(arrayA); 128 xDelete<int>(idxnA); 132 129 133 130 /*Finalize PLAPACK*/ 134 131 PLA_Finalize(); 135 132 MPI_Comm_free(&comm_2d); 136 137 133 } -
issm/trunk/src/c/toolkits/plapack/patches/PlapackToPetsc.cpp
r3332 r12706 45 45 46 46 /*Vector physically based block cyclic distribution: */ 47 row_nodes=x malloc(mA*sizeof(int));48 col_nodes=x malloc(nA*sizeof(int));47 row_nodes=xNew<int>(mA); 48 col_nodes=xNew<int>(nA); 49 49 for (i=0;i<mA;i++){ 50 50 i0=i/nb; … … 60 60 PLA_Temp_comm_col_rank(templ,&myrow); 61 61 62 idxm=x malloc(mA*sizeof(int));62 idxm=xNew<int>(mA); 63 63 count=0; 64 64 for (i=0;i<mA;i++){ … … 70 70 idxm_count=count; 71 71 72 idxn=x malloc(nA*sizeof(int));72 idxn=xNew<int>(nA); 73 73 count=0; 74 74 for (i=0;i<nA;i++){ … … 92 92 93 93 /*Free ressources:*/ 94 x free((void**)&row_nodes);95 x free((void**)&col_nodes);96 x free((void**)&idxm);97 x free((void**)&idxn);94 xDelete<int>(row_nodes); 95 xDelete<int>(col_nodes); 96 xDelete<int>(idxm); 97 xDelete<int>(idxn); 98 98 } -
issm/trunk/src/dox/issm.dox
r12337 r12706 46 46 </th> 47 47 <tr> 48 <th bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td bgcolor=#FFFFFF style="text-align:right;">508</td><td bgcolor=#FFFFFF style="text-align:right;">14595</td><td bgcolor=#FFFFFF style="text-align:right;">16762</td><td bgcolor=#FFFFFF style="text-align:right;">5603 4</td><td bgcolor=#FFFFFF style="text-align:right;">87391</td>48 <th bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td bgcolor=#FFFFFF style="text-align:right;">508</td><td bgcolor=#FFFFFF style="text-align:right;">14595</td><td bgcolor=#FFFFFF style="text-align:right;">16762</td><td bgcolor=#FFFFFF style="text-align:right;">56036</td><td bgcolor=#FFFFFF style="text-align:right;">87393</td> 49 49 </tr> 50 50 <tr> 51 <th bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td bgcolor=#C6E2FF style="text-align:right;">92 6</td><td bgcolor=#C6E2FF style="text-align:right;">6911</td><td bgcolor=#C6E2FF style="text-align:right;">13305</td><td bgcolor=#C6E2FF style="text-align:right;">30623</td><td bgcolor=#C6E2FF style="text-align:right;">50839</td>51 <th bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td bgcolor=#C6E2FF style="text-align:right;">925</td><td bgcolor=#C6E2FF style="text-align:right;">6851</td><td bgcolor=#C6E2FF style="text-align:right;">13228</td><td bgcolor=#C6E2FF style="text-align:right;">30468</td><td bgcolor=#C6E2FF style="text-align:right;">50547</td> 52 52 </tr> 53 53 <tr> 54 <th bgcolor=#FFFFFF style="text-align:left;"> C/C++ Header </th><td bgcolor=#FFFFFF style="text-align:right;">378</td><td bgcolor=#FFFFFF style="text-align:right;">275 4</td><td bgcolor=#FFFFFF style="text-align:right;">2625</td><td bgcolor=#FFFFFF style="text-align:right;">9801</td><td bgcolor=#FFFFFF style="text-align:right;">15180</td>54 <th bgcolor=#FFFFFF style="text-align:left;"> C/C++ Header </th><td bgcolor=#FFFFFF style="text-align:right;">378</td><td bgcolor=#FFFFFF style="text-align:right;">2758</td><td bgcolor=#FFFFFF style="text-align:right;">2612</td><td bgcolor=#FFFFFF style="text-align:right;">9818</td><td bgcolor=#FFFFFF style="text-align:right;">15188</td> 55 55 </tr> 56 56 <tr> … … 58 58 </tr> 59 59 <tr> 60 <th bgcolor=#FFFFFF style="text-align:left;"> Python </th><td bgcolor=#FFFFFF style="text-align:right;">5 4</td><td bgcolor=#FFFFFF style="text-align:right;">404</td><td bgcolor=#FFFFFF style="text-align:right;">799</td><td bgcolor=#FFFFFF style="text-align:right;">1435</td><td bgcolor=#FFFFFF style="text-align:right;">2638</td>60 <th bgcolor=#FFFFFF style="text-align:left;"> Python </th><td bgcolor=#FFFFFF style="text-align:right;">53</td><td bgcolor=#FFFFFF style="text-align:right;">400</td><td bgcolor=#FFFFFF style="text-align:right;">610</td><td bgcolor=#FFFFFF style="text-align:right;">1424</td><td bgcolor=#FFFFFF style="text-align:right;">2434</td> 61 61 </tr> 62 62 <tr> … … 64 64 </tr> 65 65 <tr> 66 <th bgcolor=#FFFFFF style="text-align:left;"> Bourne Shell </th><td bgcolor=#FFFFFF style="text-align:right;">6</td><td bgcolor=#FFFFFF style="text-align:right;">47</td><td bgcolor=#FFFFFF style="text-align:right;">73</td><td bgcolor=#FFFFFF style="text-align:right;">241</td><td bgcolor=#FFFFFF style="text-align:right;">361</td>66 <th bgcolor=#FFFFFF style="text-align:left;"> Perl </th><td bgcolor=#FFFFFF style="text-align:right;">3</td><td bgcolor=#FFFFFF style="text-align:right;">21</td><td bgcolor=#FFFFFF style="text-align:right;">23</td><td bgcolor=#FFFFFF style="text-align:right;">240</td><td bgcolor=#FFFFFF style="text-align:right;">284</td> 67 67 </tr> 68 68 <tr> 69 <th bgcolor=#C6E2FF style="text-align:left;"> Perl </th><td bgcolor=#C6E2FF style="text-align:right;">3</td><td bgcolor=#C6E2FF style="text-align:right;">21</td><td bgcolor=#C6E2FF style="text-align:right;">23</td><td bgcolor=#C6E2FF style="text-align:right;">240</td><td bgcolor=#C6E2FF style="text-align:right;">284</td>69 <th bgcolor=#C6E2FF style="text-align:left;"> Bourne Shell </th><td bgcolor=#C6E2FF style="text-align:right;">5</td><td bgcolor=#C6E2FF style="text-align:right;">47</td><td bgcolor=#C6E2FF style="text-align:right;">75</td><td bgcolor=#C6E2FF style="text-align:right;">239</td><td bgcolor=#C6E2FF style="text-align:right;">361</td> 70 70 </tr> 71 71 <tr> … … 73 73 </tr> 74 74 <tr> 75 <th bgcolor=#C6E2FF style="text-align:left;"> XML </th><td bgcolor=#C6E2FF style="text-align:right;">8</td><td bgcolor=#C6E2FF style="text-align:right;">37</td><td bgcolor=#C6E2FF style="text-align:right;">121</td><td bgcolor=#C6E2FF style="text-align:right;">85</td><td bgcolor=#C6E2FF style="text-align:right;">243</td>75 <th bgcolor=#C6E2FF style="text-align:left;"> C </th><td bgcolor=#C6E2FF style="text-align:right;">1</td><td bgcolor=#C6E2FF style="text-align:right;">2</td><td bgcolor=#C6E2FF style="text-align:right;">3</td><td bgcolor=#C6E2FF style="text-align:right;">6</td><td bgcolor=#C6E2FF style="text-align:right;">11</td> 76 76 </tr> 77 77 <tr> 78 <th bgcolor=#FFFFFF style="text-align:left;"> Java </th><td bgcolor=#FFFFFF style="text-align:right;">5</td><td bgcolor=#FFFFFF style="text-align:right;">17</td><td bgcolor=#FFFFFF style="text-align:right;">42</td><td bgcolor=#FFFFFF style="text-align:right;">61</td><td bgcolor=#FFFFFF style="text-align:right;">120</td> 79 </tr> 80 <tr> 81 <th bgcolor=#C6E2FF style="text-align:left;"> D </th><td bgcolor=#C6E2FF style="text-align:right;">7</td><td bgcolor=#C6E2FF style="text-align:right;">3</td><td bgcolor=#C6E2FF style="text-align:right;">0</td><td bgcolor=#C6E2FF style="text-align:right;">27</td><td bgcolor=#C6E2FF style="text-align:right;">30</td> 82 </tr> 83 <tr> 84 <th bgcolor=#FFFFFF style="text-align:left;"> C </th><td bgcolor=#FFFFFF style="text-align:right;">3</td><td bgcolor=#FFFFFF style="text-align:right;">4</td><td bgcolor=#FFFFFF style="text-align:right;">35</td><td bgcolor=#FFFFFF style="text-align:right;">21</td><td bgcolor=#FFFFFF style="text-align:right;">60</td> 85 </tr> 86 <tr> 87 <th bgcolor=#C6E2FF style="text-align:left;"> SUM: </th><td bgcolor=#C6E2FF style="text-align:right;">1915</td><td bgcolor=#C6E2FF style="text-align:right;">25906</td><td bgcolor=#C6E2FF style="text-align:right;">33869</td><td bgcolor=#C6E2FF style="text-align:right;">107321</td><td bgcolor=#C6E2FF style="text-align:right;">167096</td> 78 <th bgcolor=#FFFFFF style="text-align:left;"> SUM: </th><td bgcolor=#FFFFFF style="text-align:right;">1890</td><td bgcolor=#FFFFFF style="text-align:right;">25787</td><td bgcolor=#FFFFFF style="text-align:right;">33397</td><td bgcolor=#FFFFFF style="text-align:right;">106984</td><td bgcolor=#FFFFFF style="text-align:right;">166168</td> 88 79 </tr> 89 80 </table> -
issm/trunk/src/m/classes/autodiff.m
r11995 r12706 22 22 23 23 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{24 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 25 26 26 end % }}} -
issm/trunk/src/m/classes/balancethickness.m
r11995 r12706 25 25 26 26 end % }}} 27 function checkconsistency(obj,md,solution,analyses) % {{{27 function md = checkconsistency(obj,md,solution,analyses) % {{{ 28 28 %Early return 29 29 if solution~=BalancethicknessSolutionEnum, return; end 30 30 31 checkfield(md,'balancethickness.spcthickness','forcing',1);32 checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);33 checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);31 md = checkfield(md,'balancethickness.spcthickness','forcing',1); 32 md = checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1); 33 md = checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]); 34 34 end % }}} 35 35 function disp(obj) % {{{ -
issm/trunk/src/m/classes/bamggeom.m
r8587 r12706 6 6 classdef bamggeom 7 7 properties (SetAccess=public) 8 % {{{ 18 % {{{ 9 9 Vertices=[]; 10 10 Edges=[]; … … 18 18 end 19 19 methods 20 function bg = bamggeom(varargin)% {{{ 120 function bg = bamggeom(varargin)% {{{ 21 21 %BAMGGEOM - constructor for bamggeom object 22 22 % … … 44 44 end 45 45 end%}}} 46 function display(bg)% {{{ 146 function display(bg)% {{{ 47 47 disp(sprintf('\n%s = \n',inputname(1))); 48 48 disp(struct(bg)) -
issm/trunk/src/m/classes/bamgmesh.m
r8587 r12706 6 6 classdef bamgmesh 7 7 properties (SetAccess=public) 8 % {{{ 18 % {{{ 9 9 Vertices=[]; 10 10 Edges=[]; … … 26 26 end 27 27 methods 28 function bg = bamgmesh(varargin)% {{{ 128 function bg = bamgmesh(varargin)% {{{ 29 29 30 30 switch nargin … … 48 48 end 49 49 end%}}} 50 function display(bm)% {{{ 150 function display(bm)% {{{ 51 51 disp(sprintf('\n%s = \n',inputname(1))); 52 52 disp(struct(bm)) -
issm/trunk/src/m/classes/basalforcings.m
r11995 r12706 22 22 23 23 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{24 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 25 26 26 if ismember(PrognosticAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isprognostic==0), 27 checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);27 md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1); 28 28 end 29 29 if ismember(BalancethicknessAnalysisEnum,analyses), 30 checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);30 md = checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]); 31 31 end 32 32 if ismember(ThermalAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isthermal==0), 33 checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);34 checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);33 md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1); 34 md = checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0); 35 35 end 36 36 end % }}} -
issm/trunk/src/m/classes/clusters/acenet.m
r12293 r12706 8 8 classdef acenet 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='glacdyn.ace-net.ca' 12 12 %name='placentia.ace-net.ca' … … 23 23 end 24 24 methods 25 function cluster=acenet(varargin) % {{{ 125 function cluster=acenet(varargin) % {{{ 26 26 %use provided options to change fields 27 27 options=pairoptions(varargin{:}); … … 34 34 end 35 35 %}}} 36 function disp(cluster) % {{{ 136 function disp(cluster) % {{{ 37 37 % display the object 38 38 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 47 47 end 48 48 %}}} 49 function checkconsistency(cluster,md,solution,analyses) % {{{149 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 50 50 51 51 available_queues={'debug','shortq','longq'}; … … 56 56 end 57 57 %}}} 58 function BuildQueueScript(cluster,m d) % {{{158 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 59 59 60 %retrieve parameters 61 modelname=md.miscellaneous.name; 62 solution=md.private.solution; 60 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 61 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 63 62 64 % open file for writing:63 %write queuing script 65 64 fid=fopen([modelname '.queue'],'w'); 66 67 %write instructions for launching a job on the cluster68 % fprintf(fid,'#!/bin/sh\n');69 65 fprintf(fid,'#!/bin/bash\n'); 70 %fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...71 % cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);72 66 fprintf(fid,'#$ -cwd\n'); 73 67 fprintf(fid,'#$ -N issm\n'); 74 %fprintf(fid,'#$ -l h_rt=%i\n',cluster.time);75 68 fprintf(fid,'#$ -l h_rt=10:0:0\n'); 76 %fprintf(fid,'#$ -l h_rt=1:0:0,test=true\n');77 69 fprintf(fid,'#$ -pe ompi* %i\n',cluster.np); 78 70 fprintf(fid,'#$ -j y\n'); … … 81 73 fprintf(fid,'module load issm\n'); 82 74 fprintf(fid,'\n'); 83 %fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);84 75 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',... 85 76 cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname); 86 87 % fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np);88 % fprintf(fid,'#PBS -N %s\n',modelname);89 % fprintf(fid,'#PBS -l walltime=%i\n',time*60); %walltime is in seconds.90 % fprintf(fid,'#PBS -q %s\n',queue);91 % fprintf(fid,'#PBS -o %s.outlog \n',modelname);92 % fprintf(fid,'#PBS -e %s.errlog \n',modelname);93 % fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath);94 % fprintf(fid,'cd $PBS_O_WORKDIR\n');95 % fprintf(fid,'export OMP_NUM_THREADS=1\n');96 % fprintf(fid,'ulimit -s unlimited\n');97 % fprintf(fid,'ulimit -c 0\n');98 % fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);99 100 %close file101 77 fclose(fid); 102 78 103 79 end 104 80 %}}} 105 function LaunchQueueJob(cluster,md,options)% {{{1 106 %retrieve parameters 107 modelname=md.miscellaneous.name; 108 solution=md.private.solution; 81 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 109 82 110 %lauch command, to be executed via ssh 111 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 112 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub ' modelname '.queue ']; 83 %compress the files into one zip. 84 compressstring=['tar -zcf ' dirname '.tar.gz ']; 85 for i=1:numel(filelist), 86 compressstring = [compressstring ' ' filelist{i}]; 87 end 88 if cluster.interactive, 89 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 90 end 91 system(compressstring); 113 92 114 if ~strcmpi(options.batch,'yes'), 115 116 %compress the files into one zip. 117 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 118 if md.qmu.isdakota, 119 compressstring=[compressstring md.miscellaneous.name '.qmu.in']; 120 end 121 system(compressstring); 122 123 disp('uploading input file and queueing script'); 124 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']}); 125 126 disp('launching solution sequence on remote cluster'); 127 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand); 93 disp('uploading input file and queueing script'); 94 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 128 95 129 else 130 disp('batch mode requested: not launching job interactively'); 131 disp('launch solution sequence on remote cluster by hand'); 132 end 96 disp('launching solution sequence on remote cluster'); 97 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 98 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 99 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 100 end %}}} 101 function Download(cluster,dirname,filelist)% {{{ 133 102 134 end135 %}}}136 function Download(cluster,md)% {{{1103 %copy files from cluster to current directory 104 directory=[cluster.executionpath '/' dirname '/']; 105 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 137 106 138 %some check 139 if isempty(md.private.runtimename), 140 error('pfe Download error message: supply runtime name for results to be loaded!'); 141 end 142 143 %Figure out the directory where all the files are in: 144 directory=[cluster.executionpath '/' md.private.runtimename '/']; 145 146 %What packages are we picking up from remote cluster 147 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 148 %packages={}; 149 if md.qmu.isdakota, 150 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 151 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 152 if isfield(md.qmu.params,'tabular_graphics_data'), 153 if md.qmu.params.tabular_graphics_data==true, 154 packages{end+1}='dakota_tabular.dat'; 155 end 156 end 157 else 158 packages{end+1}=[md.miscellaneous.name '.outbin']; 159 end 160 161 %copy files from cluster to present directory 162 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 163 end %}}} 107 end %}}} 164 108 end 165 109 end -
issm/trunk/src/m/classes/clusters/castor.m
r11995 r12706 8 8 classdef castor 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='castor' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=castor(varargin) % {{{ 122 function cluster=castor(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'shortc','longc'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster,m d) % {{{148 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 50 %retrieve parameters 51 modelname=md.miscellaneous.name; 52 solution=md.private.solution; 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/sh\n'); 58 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. … … 64 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 65 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 66 67 64 fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath); 68 65 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 69 66 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 70 67 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 71 72 %close file73 68 fclose(fid); 74 69 75 70 end 76 71 %}}} 77 function LaunchQueueJob(cluster,md,options)% {{{1 78 79 %lauch command, to be executed via ssh 80 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 81 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub ' modelname '.queue ']; 72 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 82 73 83 if ~strcmpi(options.batch,'yes'), 84 85 %compress the files into one zip. 86 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 87 if md.qmu.isdakota, 88 compressstring=[compressstring md.miscellaneous.name '.qmu.in']; 89 end 90 system(compressstring); 91 92 disp('uploading input file and queueing script'); 93 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']}); 94 95 disp('launching solution sequence on remote cluster'); 96 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand); 74 %compress the files into one zip. 75 compressstring=['tar -zcf ' dirname '.tar.gz ']; 76 for i=1:numel(filelist), 77 compressstring = [compressstring ' ' filelist{i}]; 78 end 79 if cluster.interactive, 80 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 81 end 82 system(compressstring); 97 83 98 else 99 disp('batch mode requested: not launching job interactively'); 100 disp('launch solution sequence on remote cluster by hand'); 101 end 84 disp('uploading input file and queueing script'); 85 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 102 86 103 end 104 %}}} 105 function Download(cluster,md)% {{{1 87 disp('launching solution sequence on remote cluster'); 88 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 89 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 90 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 91 end %}}} 92 function Download(cluster,dirname,filelist)% {{{ 106 93 107 %some check 108 if isempty(md.private.runtimename), 109 error('pfe Download error message: supply runtime name for results to be loaded!'); 110 end 94 %copy files from cluster to current directory 95 directory=[cluster.executionpath '/' dirname '/']; 96 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 111 97 112 %Figure out the directory where all the files are in: 113 directory=[cluster.executionpath '/' md.private.runtimename '/']; 114 115 %What packages are we picking up from remote cluster 116 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 117 if md.qmu.isdakota, 118 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 119 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 120 if isfield(md.qmu.params,'tabular_graphics_data'), 121 if md.qmu.params.tabular_graphics_data==true, 122 packages{end+1}='dakota_tabular.dat'; 123 end 124 end 125 else 126 packages{end+1}=[md.miscellaneous.name '.outbin']; 127 end 128 129 %copy files from cluster to present directory 130 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 131 end %}}} 98 end %}}} 132 99 end 133 100 end -
issm/trunk/src/m/classes/clusters/cosmos.m
r11995 r12706 8 8 classdef cosmos 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='cosmos' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=cosmos(varargin) % {{{ 122 function cluster=cosmos(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'debug','shortq','longq'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster,m d) % {{{148 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 50 %retrieve parameters 51 modelname=md.miscellaneous.name; 52 solution=md.private.solution; 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/bash\n'); 58 56 fprintf(fid,'#PBS -l select=%i:ncpus=1\n',cluster.np); … … 68 66 fprintf(fid,'ulimit -c 0\n'); 69 67 fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpiexec -np %i %s/issm.exe %s %s %s',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 70 71 %close file72 68 fclose(fid); 73 69 74 70 end 75 71 %}}} 76 function LaunchQueueJob(cluster,md,options)% {{{1 77 78 %lauch command, to be executed via ssh 79 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 80 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub -S/bin/sh ' modelname '.queue ']; 72 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 81 73 82 if ~strcmpi(options.batch,'yes'), 83 84 %compress the files into one zip. 85 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 86 if md.qmu.isdakota, 87 compressstring=[compressstring md.miscellaneous.name '.qmu.in']; 88 end 89 system(compressstring); 90 91 disp('uploading input file and queueing script'); 92 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']}); 93 94 disp('launching solution sequence on remote cluster'); 95 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand); 74 %compress the files into one zip. 75 compressstring=['tar -zcf ' dirname '.tar.gz ']; 76 for i=1:numel(filelist), 77 compressstring = [compressstring ' ' filelist{i}]; 78 end 79 if cluster.interactive, 80 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 81 end 82 system(compressstring); 96 83 97 else 98 disp('batch mode requested: not launching job interactively'); 99 disp('launch solution sequence on remote cluster by hand'); 100 end 84 disp('uploading input file and queueing script'); 85 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 101 86 102 end 103 %}}} 104 function Download(cluster,md)% {{{1 87 disp('launching solution sequence on remote cluster'); 88 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 89 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 90 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 91 end %}}} 92 function Download(cluster,dirname,filelist)% {{{ 105 93 106 %some check 107 if isempty(md.private.runtimename), 108 error('pfe Download error message: supply runtime name for results to be loaded!'); 109 end 94 %copy files from cluster to current directory 95 directory=[cluster.executionpath '/' dirname '/']; 96 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 110 97 111 %Figure out the directory where all the files are in: 112 directory=[cluster.executionpath '/' md.private.runtimename '/']; 113 114 %What packages are we picking up from remote cluster 115 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 116 if md.qmu.isdakota, 117 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 118 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 119 if isfield(md.qmu.params,'tabular_graphics_data'), 120 if md.qmu.params.tabular_graphics_data==true, 121 packages{end+1}='dakota_tabular.dat'; 122 end 123 end 124 else 125 packages{end+1}=[md.miscellaneous.name '.outbin']; 126 end 127 128 %copy files from cluster to present directory 129 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 130 end %}}} 98 end %}}} 131 99 end 132 100 end -
issm/trunk/src/m/classes/clusters/gemini.m
r11995 r12706 8 8 classdef gemini 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='gemini' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=gemini(varargin) % {{{ 122 function cluster=gemini(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'debug','shortg','longg'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster,m d) % {{{148 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 50 %retrieve parameters 51 modelname=md.miscellaneous.name; 52 solution=md.private.solution; 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/sh\n'); 58 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. … … 69 67 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 70 68 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 71 72 %close file73 69 fclose(fid); 74 70 75 71 end 76 72 %}}} 77 function LaunchQueueJob(cluster,md,options)% {{{1 78 79 %lauch command, to be executed via ssh 80 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 81 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub ' modelname '.queue ']; 73 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 82 74 83 if ~strcmpi(options.batch,'yes'), 84 85 %compress the files into one zip. 86 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 87 if md.qmu.isdakota, 88 compressstring=[compressstring md.miscellaneous.name '.qmu.in']; 89 end 90 system(compressstring); 91 92 disp('uploading input file and queueing script'); 93 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']}); 94 95 disp('launching solution sequence on remote cluster'); 96 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand); 75 %compress the files into one zip. 76 compressstring=['tar -zcf ' dirname '.tar.gz ']; 77 for i=1:numel(filelist), 78 compressstring = [compressstring ' ' filelist{i}]; 79 end 80 if cluster.interactive, 81 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 82 end 83 system(compressstring); 97 84 98 else 99 disp('batch mode requested: not launching job interactively'); 100 disp('launch solution sequence on remote cluster by hand'); 101 end 85 disp('uploading input file and queueing script'); 86 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 102 87 103 end 104 %}}} 105 function Download(cluster,md)% {{{1 88 disp('launching solution sequence on remote cluster'); 89 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 90 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 91 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 92 end %}}} 93 function Download(cluster,dirname,filelist)% {{{ 106 94 107 %some check 108 if isempty(md.private.runtimename), 109 error('pfe Download error message: supply runtime name for results to be loaded!'); 110 end 95 %copy files from cluster to current directory 96 directory=[cluster.executionpath '/' dirname '/']; 97 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 111 98 112 %Figure out the directory where all the files are in: 113 directory=[cluster.executionpath '/' md.private.runtimename '/']; 114 115 %What packages are we picking up from remote cluster 116 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 117 if md.qmu.isdakota, 118 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 119 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 120 if isfield(md.qmu.params,'tabular_graphics_data'), 121 if md.qmu.params.tabular_graphics_data==true, 122 packages{end+1}='dakota_tabular.dat'; 123 end 124 end 125 else 126 packages{end+1}=[md.miscellaneous.name '.outbin']; 127 end 128 129 %copy files from cluster to present directory 130 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 131 end %}}} 99 end %}}} 132 100 end 133 101 end -
issm/trunk/src/m/classes/clusters/generic.m
r12329 r12706 7 7 classdef generic 8 8 properties (SetAccess=public) 9 % {{{ 19 % {{{ 10 10 name=''; 11 11 login=''; … … 21 21 end 22 22 methods 23 function cluster=generic(varargin) % {{{ 123 function cluster=generic(varargin) % {{{ 24 24 25 25 %use provided options to change fields … … 36 36 end 37 37 %}}} 38 function disp(cluster) % {{{ 138 function disp(cluster) % {{{ 39 39 % display the object 40 40 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 50 50 end 51 51 %}}} 52 function checkconsistency(cluster,md,solution,analyses) % {{{152 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 53 53 if cluster.np<1 54 checkmessage(['number of processors should be at least 1']);54 md = checkmessage(md,['number of processors should be at least 1']); 55 55 end 56 56 if isnan(cluster.np), … … 59 59 end 60 60 %}}} 61 function BuildQueueScript(cluster,md) % {{{1 62 63 %retrieve parameters 64 modelname=md.miscellaneous.name; 65 solution=md.private.solution; 66 isvalgrind=md.debug.valgrind; 67 isgprof=md.debug.gprof; 61 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 68 62 69 % open file for writing:63 %write queuing script 70 64 if ~ispc, 65 71 66 fid=fopen([modelname '.queue'],'w'); 72 else73 fid=fopen([modelname '.bat'],'w');74 end75 76 %write instructions for launching a job on the cluster77 if ~ispc,78 67 fprintf(fid,'#!/bin/sh\n'); 79 else 80 fprintf(fid,'@echo off\n'); 81 end 82 83 if ~isvalgrind, 84 if cluster.interactive 85 if ~ispc, 68 if ~isvalgrind, 69 if cluster.interactive 86 70 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 87 71 else 88 fprintf(fid,' "%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);72 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname); 89 73 end 74 elseif isgprof, 75 fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname); 90 76 else 91 if ~ispc,92 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);93 else94 fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);95 end96 end97 else98 if ~ispc,99 77 %Add --gen-suppressions=all to get suppression lines 100 78 fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib); 101 79 fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',... 102 cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname); 80 cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname); 81 end 82 if ~io_gather, %concatenate the output files: 83 fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname); 84 end 85 fclose(fid); 86 87 else % Windows 88 89 fid=fopen([modelname '.bat'],'w'); 90 fprintf(fid,'@echo off\n'); 91 if cluster.interactive 92 fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 103 93 else 104 error('valgrind not supported on windows platforms'); 94 fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog',... 95 cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname); 105 96 end 97 fclose(fid); 106 98 end 107 108 if isgprof,109 if ~ispc,110 fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);111 else112 error('gprof not supported on windows platforms');113 end114 115 end116 117 if ~md.settings.io_gather,118 if ~ispc,119 %concatenate the output files:120 fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);121 else122 error('iogather not supported on windows platforms');123 end124 125 end126 127 %close file:128 fclose(fid);129 99 130 100 %in interactive mode, create a run file, and errlog and outlog file … … 133 103 fid=fopen([modelname '.outlog'],'w'); fclose(fid); 134 104 end 135 136 137 105 end 138 106 %}}} 139 function LaunchQueueJob(cluster,md,options)% {{{1 140 107 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 108 109 %write queuing script 141 110 if ~ispc, 142 %lauch command, to be executed via ssh143 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...144 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && source ' md.miscellaneous.name '.queue '];145 111 146 if ~strcmpi(options.batch,'yes'), 112 fid=fopen([modelname '.queue'],'w'); 113 fprintf(fid,'#!/bin/sh\n'); 114 if ~isvalgrind, 115 if cluster.interactive 116 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s ',cluster.np,cluster.codepath,cluster.executionpath,modelname); 117 else 118 fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,cluster.executionpath,modelname,modelname,modelname); 119 end 120 elseif isgprof, 121 fprintf(fid,'\n gprof %s/kriging.exe gmon.out > %s.performance',cluster.codepath,modelname); 122 else 123 %Add --gen-suppressions=all to get suppression lines 124 fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib); 125 fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/kriging.exe %s %s 2> %s.errlog >%s.outlog ',... 126 cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,cluster.executionpath,modelname,modelname,modelname); 127 end 128 if ~io_gather, %concatenate the output files: 129 fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname); 130 end 131 fclose(fid); 147 132 148 %compress the files into one zip. 149 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 150 if md.qmu.isdakota, 151 compressstring=[compressstring md.miscellaneous.name '.qmu.in']; 152 end 153 if cluster.interactive, 154 compressstring=[compressstring ' ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog ']; 155 end 156 system(compressstring); 133 else % Windows 157 134 158 disp('uploading input file and queueing script'); 159 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']}); 135 fid=fopen([modelname '.bat'],'w'); 136 fprintf(fid,'@echo off\n'); 137 if cluster.interactive 138 fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 139 else 140 fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog',... 141 cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname); 142 end 143 fclose(fid); 144 end 160 145 161 disp('launching solution sequence on remote cluster'); 162 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 163 else 164 disp('batch mode requested: not launching job interactively'); 165 disp('launch solution sequence on remote cluster by hand'); 166 end 167 else 168 %launch right here, do not compress or archive. 169 system([md.miscellaneous.name '.bat']); 146 %in interactive mode, create a run file, and errlog and outlog file 147 if cluster.interactive, 148 fid=fopen([modelname '.errlog'],'w'); fclose(fid); 149 fid=fopen([modelname '.outlog'],'w'); fclose(fid); 150 end 151 end 152 %}}} 153 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 154 155 %compress the files into one zip. 156 compressstring=['tar -zcf ' dirname '.tar.gz ']; 157 for i=1:numel(filelist), 158 compressstring = [compressstring ' ' filelist{i}]; 159 end 160 if cluster.interactive, 161 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 162 end 163 system(compressstring); 164 165 disp('uploading input file and queueing script'); 166 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 167 168 disp('launching solution sequence on remote cluster'); 169 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 170 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && source ' modelname '.queue ']; 171 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 172 end %}}} 173 function Download(cluster,dirname,filelist)% {{{ 174 175 if ispc, 176 %do nothing 177 return; 170 178 end 171 179 172 end %}}} 173 function Download(cluster,md)% {{{1 174 175 if ~ispc, 176 %some check 177 if isempty(md.private.runtimename), 178 error('supply runtime name for results to be loaded!'); 179 end 180 181 %Figure out the directory where all the files are in: 182 directory=[cluster.executionpath '/' md.private.runtimename '/']; 183 184 %What packages are we picking up from remote cluster 185 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 186 if md.qmu.isdakota, 187 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 188 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 189 if isfield(md.qmu.params,'tabular_graphics_data'), 190 if md.qmu.params.tabular_graphics_data==true, 191 packages{end+1}='dakota_tabular.dat'; 192 end 193 end 194 else 195 packages{end+1}=[md.miscellaneous.name '.outbin']; 196 end 197 198 %copy files from cluster to present directory 199 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 200 else 201 %do nothing! 202 end 180 %copy files from cluster to current directory 181 directory=[cluster.executionpath '/' dirname '/']; 182 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 203 183 end %}}} 204 184 end -
issm/trunk/src/m/classes/clusters/generic.py
r12329 r12706 36 36 return string 37 37 #}}} 38 39 40 #old matlab41 # function cluster=generic(varargin) % {{{142 #43 # %use provided options to change fields44 # options=pairoptions(varargin{:});45 #46 # %get name47 # if ~exist(options,'name'), error('option ''name'' has not been provided'); end48 # cluster.name=getfieldvalue(options,'name');49 #50 # %initialize cluster using user settings if provided51 # if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end52 #53 # %OK get other fields54 # for i=1:size(options.list,1),55 # fieldname=options.list{i,1};56 # fieldvalue=options.list{i,2};57 # if ismember(fieldname,properties('generic')),58 # cluster.(fieldname)=fieldvalue;59 # else60 # disp(['''' fieldname ''' is not a property of cluster generic']);61 # end62 # end63 # end64 # %}}}65 # function checkconsistency(cluster,md,solution,analyses) % {{{166 # if cluster.np<167 # checkmessage(['number of processors should be at least 1']);68 # end69 # if isnan(cluster.np),70 # checkessage('number of processors should not be NaN!');71 # end72 # end73 # %}}}74 # function BuildQueueScript(cluster,md) % {{{175 #76 # %retrieve parameters77 # modelname=md.miscellaneous.name;78 # solution=md.private.solution;79 # isvalgrind=md.debug.valgrind;80 # isgprof=md.debug.gprof;81 #82 # %open file for writing:83 # if ~ispc,84 # fid=fopen([modelname '.queue'],'w');85 # else86 # fid=fopen([modelname '.bat'],'w');87 # end88 #89 # %write instructions for launching a job on the cluster90 # if ~ispc,91 # fprintf(fid,'#!/bin/sh\n');92 # else93 # fprintf(fid,'@echo off\n');94 # end95 #96 # if ~isvalgrind,97 # if cluster.interactive98 # if ~ispc,99 # fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);100 # else101 # fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);102 # end103 # else104 # if ~ispc,105 # fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);106 # else107 # fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);108 # end109 # end110 # else111 # if ~ispc,112 # %Add --gen-suppressions=all to get suppression lines113 # fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);114 # fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...115 # cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);116 # else117 # error('valgrind not supported on windows platforms');118 # end119 # end120 #121 # if isgprof,122 # if ~ispc,123 # fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);124 # else125 # error('gprof not supported on windows platforms');126 # end127 #128 # end129 #130 # if ~md.settings.io_gather,131 # if ~ispc,132 # %concatenate the output files:133 # fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);134 # else135 # error('iogather not supported on windows platforms');136 # end137 #138 # end139 #140 # %close file:141 # fclose(fid);142 #143 # %in interactive mode, create a run file, and errlog and outlog file144 # if cluster.interactive,145 # fid=fopen([modelname '.errlog'],'w'); fclose(fid);146 # fid=fopen([modelname '.outlog'],'w'); fclose(fid);147 # end148 #149 #150 # end151 # %}}}152 # function LaunchQueueJob(cluster,md,options)% {{{1153 #154 # if ~ispc,155 # %lauch command, to be executed via ssh156 # launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...157 # ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && source ' md.miscellaneous.name '.queue '];158 #159 # if ~strcmpi(options.batch,'yes'),160 #161 # %compress the files into one zip.162 # compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc '];163 # if md.qmu.isdakota,164 # compressstring=[compressstring md.miscellaneous.name '.qmu.in'];165 # end166 # if cluster.interactive,167 # compressstring=[compressstring ' ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog '];168 # end169 # system(compressstring);170 #171 # disp('uploading input file and queueing script');172 # issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']});173 #174 # disp('launching solution sequence on remote cluster');175 # issmssh(cluster.name,cluster.login,cluster.port,launchcommand);176 # else177 # disp('batch mode requested: not launching job interactively');178 # disp('launch solution sequence on remote cluster by hand');179 # end180 # else181 # %launch right here, do not compress or archive.182 # system([md.miscellaneous.name '.bat']);183 # end184 #185 # end %}}}186 # function Download(cluster,md)% {{{1187 #188 # if ~ispc,189 # %some check190 # if isempty(md.private.runtimename),191 # error('supply runtime name for results to be loaded!');192 # end193 #194 # %Figure out the directory where all the files are in:195 # directory=[cluster.executionpath '/' md.private.runtimename '/'];196 #197 # %What packages are we picking up from remote cluster198 # packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};199 # if md.qmu.isdakota,200 # packages{end+1}=[md.miscellaneous.name '.qmu.err'];201 # packages{end+1}=[md.miscellaneous.name '.qmu.out'];202 # if isfield(md.qmu.params,'tabular_graphics_data'),203 # if md.qmu.params.tabular_graphics_data==true,204 # packages{end+1}='dakota_tabular.dat';205 # end206 # end207 # else208 # packages{end+1}=[md.miscellaneous.name '.outbin'];209 # end210 #211 # %copy files from cluster to present directory212 # issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);213 # else214 # %do nothing!215 # end216 # end %}}}217 # -
issm/trunk/src/m/classes/clusters/greenplanet.m
r11995 r12706 8 8 classdef greenplanet 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='greenplanet' 12 12 login=''; … … 24 24 end 25 25 methods 26 function cluster=greenplanet(varargin) % {{{ 126 function cluster=greenplanet(varargin) % {{{ 27 27 28 28 %initialize cluster using default settings if provided … … 33 33 end 34 34 %}}} 35 function disp(cluster) % {{{ 135 function disp(cluster) % {{{ 36 36 % display the object 37 37 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 48 48 end 49 49 %}}} 50 function checkconsistency(cluster,md,solution,analyses) % {{{150 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 51 51 52 52 available_queues={'rignot','default'}; … … 57 57 58 58 %Miscelaneous 59 if isempty(cluster.login), checkmessage('login empty'); end60 if isempty(cluster.codepath), checkmessage('codepath empty'); end61 if isempty(cluster.executionpath), checkmessage('executionpath empty'); end59 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 60 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 61 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 62 62 63 63 end 64 64 %}}} 65 function BuildQueueScript(cluster,m d) % {{{165 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 66 66 67 %retrieve parameters 68 modelname=md.miscellaneous.name; 69 solution=md.private.solution; 70 isvalgrind=md.debug.valgrind; 67 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 68 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 71 69 72 70 %compute number of processors 73 71 cluster.np=cluster.numnodes*cluster.cpuspernode; 74 72 75 % open file for writing:73 %write queuing script 76 74 fid=fopen([modelname '.queue'],'w'); 77 78 75 fprintf(fid,'#PBS -S /bin/bash\n'); 79 76 fprintf(fid,'#PBS -N %s\n',modelname); … … 84 81 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 85 82 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname); 86 87 83 fprintf(fid,'cd %s/%s\n\n',cluster.executionpath,md.private.runtimename); 88 84 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 89 90 if ~md.settings.io_gather, 91 %concatenate the output files: 85 if ~io_gather, %concatenate the output files: 92 86 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 93 87 end 94 95 %close file96 88 fclose(fid); 97 89 … … 100 92 fid=fopen([modelname '.run'],'w'); 101 93 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 102 103 if ~md.settings.io_gather, 104 %concatenate the output files: 94 if ~io_gather, %concatenate the output files: 105 95 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 106 96 end … … 112 102 end 113 103 end %}}} 114 function LaunchQueueJob(cluster,md,options)% {{{1 115 116 %lauch command, to be executed via ssh 117 if ~cluster.interactive, 118 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 119 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub ' md.miscellaneous.name '.queue ']; 120 else 121 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' md.private.runtimename '.tar.gz']; 122 end 104 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 123 105 124 if ~strcmpi(options.batch,'yes'), 125 126 %compress the files into one zip. 127 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 128 if md.qmu.isdakota, 129 compressstring=[compressstring md.miscellaneous.name '.qmu.in ']; 130 end 131 if cluster.interactive, 132 compressstring=[compressstring md.miscellaneous.name '.run ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog ']; 133 end 134 system(compressstring); 135 136 disp('uploading input file and queueing script'); 137 if cluster.interactive, 138 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)]; 139 else 140 directory=cluster.executionpath; 141 end 142 143 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']}); 144 145 disp('launching solution sequence on remote cluster'); 146 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 106 %compress the files into one zip. 107 compressstring=['tar -zcf ' dirname '.tar.gz ']; 108 for i=1:numel(filelist), 109 compressstring = [compressstring ' ' filelist{i}]; 110 end 111 if cluster.interactive, 112 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 113 end 114 system(compressstring); 147 115 148 else 149 disp('batch mode requested: not launching job interactively'); 150 disp('launch solution sequence on remote cluster by hand'); 151 end 152 end 153 %}}} 154 function Download(cluster,md)% {{{1 116 disp('uploading input file and queueing script'); 117 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 155 118 156 %some check157 if isempty(md.private.runtimename),158 if ~cluster.interactive,159 error('greenplanet Download error message: supply runtime name for results to be loaded!');160 end161 end119 disp('launching solution sequence on remote cluster'); 120 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 121 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 122 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 123 end %}}} 124 function Download(cluster,dirname,filelist)% {{{ 162 125 163 %Figure out the directory where all the files are in: 164 if ~cluster.interactive, 165 directory=[cluster.executionpath '/' md.private.runtimename '/']; 166 else 167 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/']; 168 end 126 %copy files from cluster to current directory 127 directory=[cluster.executionpath '/' dirname '/']; 128 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 169 129 170 %What packages are we picking up from remote cluster 171 if ~cluster.interactive, 172 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 173 else 174 packages={}; 175 end 176 if md.qmu.isdakota, 177 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 178 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 179 if isfield(md.qmu.params,'tabular_graphics_data'), 180 if md.qmu.params.tabular_graphics_data==true, 181 packages{end+1}='dakota_tabular.dat'; 182 end 183 end 184 else 185 packages{end+1}=[md.miscellaneous.name '.outbin']; 186 end 187 188 %copy files from cluster to present directory 189 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 190 191 end %}}} 130 end %}}} 192 131 end 193 132 end -
issm/trunk/src/m/classes/clusters/pfe.m
r11995 r12706 8 8 classdef pfe 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='pfe' 12 12 login=''; … … 29 29 end 30 30 methods 31 function cluster=pfe(varargin) % {{{ 131 function cluster=pfe(varargin) % {{{ 32 32 33 33 %initialize cluster using default settings if provided … … 38 38 end 39 39 %}}} 40 function disp(cluster) % {{{ 140 function disp(cluster) % {{{ 41 41 % display the object 42 42 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 56 56 end 57 57 %}}} 58 function checkconsistency(cluster,md,solution,analyses) % {{{158 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 59 59 60 60 available_queues={'long','normal','debug'}; … … 68 68 if cluster.hyperthreading, 69 69 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)), 70 checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode');70 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode'); 71 71 end 72 72 else 73 73 if ((cluster.cpuspernode>8 ) | (cluster.cpuspernode<1)), 74 checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');74 md = checkmessage(md,'cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors'); 75 75 end 76 76 end … … 78 78 if cluster.hyperthreading, 79 79 if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)), 80 checkmessage('cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');80 md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode'); 81 81 end 82 82 else 83 83 if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)), 84 checkmessage('cpuspernode should be between 1 and 12 for ''wes'' processors');85 end 86 end 87 else 88 checkmessage('unknown processor type, should be ''neh'',''wes'' or ''har''');84 md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''wes'' processors'); 85 end 86 end 87 else 88 md = checkmessage(md,'unknown processor type, should be ''neh'',''wes'' or ''har'''); 89 89 end 90 90 91 91 %Miscelaneous 92 if isempty(cluster.login), checkmessage('login empty'); end 93 if isempty(cluster.codepath), checkmessage('codepath empty'); end 94 if isempty(cluster.executionpath), checkmessage('executionpath empty'); end 95 96 end 97 %}}} 98 function BuildQueueScript(cluster,md) % {{{1 99 100 %retrieve parameters 101 modelname=md.miscellaneous.name; 102 solution=md.private.solution; 103 isvalgrind=md.debug.valgrind; 92 if isempty(cluster.login), md = checkmessage(md,'login empty'); end 93 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end 94 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end 95 96 end 97 %}}} 98 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 99 100 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 104 101 105 102 %compute number of processors 106 103 cluster.np=cluster.numnodes*cluster.cpuspernode; 107 104 108 % open file for writing:105 %write queuing script 109 106 fid=fopen([modelname '.queue'],'w'); 110 111 107 fprintf(fid,'#PBS -S /bin/bash\n'); 112 108 % fprintf(fid,'#PBS -N %s\n',modelname); … … 118 114 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 119 115 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname); 120 121 116 fprintf(fid,'. /usr/share/modules/init/bash\n\n'); 122 123 117 fprintf(fid,'module load comp-intel/11.1.046\n'); 124 118 fprintf(fid,'module load mpi/mpt.1.25\n'); 125 119 fprintf(fid,'module load math/intel_mkl_64_10.0.011\n\n'); 126 127 120 fprintf(fid,'export PATH="$PATH:."\n\n'); 128 121 fprintf(fid,'export MPI_GROUP_MAX=64\n\n'); 129 130 122 fprintf(fid,'cd $PBS_O_WORKDIR\n\n'); 131 132 123 fprintf(fid,'mpiexec -np %i %s/issm.exe %s $PBS_O_WORKDIR %s\n',cluster.np,cluster.codepath,EnumToString(solution),modelname); 133 134 if ~md.settings.io_gather, 135 %concatenate the output files: 124 if ~io_gather, %concatenate the output files: 136 125 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 137 126 end 138 139 %close file140 127 fclose(fid); 141 128 … … 148 135 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/issm.exe %s $PBS_O_WORKDIR %s\n',cluster.np,cluster.codepath,EnumToString(solution),modelname); 149 136 end 150 151 if ~md.settings.io_gather, 152 %concatenate the output files: 137 if ~io_gather, %concatenate the output files: 153 138 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname); 154 139 end … … 160 145 end 161 146 end %}}} 162 function LaunchQueueJob(cluster,md,options)% {{{1 163 147 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 148 149 %compress the files into one zip. 150 compressstring=['tar -zcf ' dirname '.tar.gz ']; 151 for i=1:numel(filelist), 152 compressstring = [compressstring ' ' filelist{i}]; 153 end 154 if cluster.interactive, 155 compressstring = [compressstring ' ' modelname '.run ' modelname '.errlog ' modelname '.outlog ']; 156 end 157 system(compressstring); 158 159 disp('uploading input file and queueing script'); 160 if cluster.interactive, 161 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)]; 162 else 163 directory=cluster.executionpath; 164 end 165 166 if ~cluster.bbftp, 167 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']}); 168 else 169 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']}); 170 end 171 164 172 %lauch command, to be executed via ssh 165 173 if ~cluster.interactive, 166 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 167 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub ' md.miscellaneous.name '.queue ']; 168 else 169 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' md.private.runtimename '.tar.gz']; 170 end 171 172 if ~strcmpi(options.batch,'yes'), 173 174 %compress the files into one zip. 175 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 176 if md.qmu.isdakota, 177 compressstring=[compressstring md.miscellaneous.name '.qmu.in ']; 178 end 179 if cluster.interactive, 180 compressstring=[compressstring md.miscellaneous.name '.run ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog ']; 181 end 182 system(compressstring); 183 184 disp('uploading input file and queueing script'); 185 if cluster.interactive, 186 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)]; 187 else 188 directory=cluster.executionpath; 189 end 190 191 if ~cluster.bbftp, 192 issmscpout(cluster.name,directory,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']}); 193 else 194 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[md.private.runtimename '.tar.gz']}); 195 end 196 197 disp('launching solution sequence on remote cluster'); 198 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 199 200 else 201 disp('batch mode requested: not launching job interactively'); 202 disp('launch solution sequence on remote cluster by hand'); 203 end 204 end 205 %}}} 206 function Download(cluster,md)% {{{1 207 208 %some check 209 if isempty(md.private.runtimename), 210 if ~cluster.interactive, 211 error('pfe Download error message: supply runtime name for results to be loaded!'); 212 end 213 end 214 215 %Figure out the directory where all the files are in: 216 if ~cluster.interactive, 217 directory=[cluster.executionpath '/' md.private.runtimename '/']; 218 else 219 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/']; 220 end 221 222 %What packages are we picking up from remote cluster 223 if ~cluster.interactive, 224 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 225 else 226 packages={}; 227 end 228 if md.qmu.isdakota, 229 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 230 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 231 if isfield(md.qmu.params,'tabular_graphics_data'), 232 if md.qmu.params.tabular_graphics_data==true, 233 packages{end+1}='dakota_tabular.dat'; 234 end 235 end 236 else 237 packages{end+1}=[md.miscellaneous.name '.outbin']; 238 end 239 240 %copy files from cluster to present directory 241 if ~cluster.bbftp, 242 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 243 else 244 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, packages); 245 end 246 247 end %}}} 174 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 175 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 176 else 177 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz']; 178 end 179 180 disp('launching solution sequence on remote cluster'); 181 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 182 end 183 %}}} 184 function Download(cluster,dirname,filelist)% {{{ 185 186 %copy files from cluster to current directory 187 if ~cluster.interactive, 188 directory=[cluster.executionpath '/' dirname '/']; 189 else 190 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/']; 191 end 192 193 if ~cluster.bbftp, 194 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 195 else 196 issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist); 197 end 198 199 end %}}} 248 200 end 249 201 end -
issm/trunk/src/m/classes/clusters/pollux.m
r11995 r12706 8 8 classdef pollux 9 9 properties (SetAccess=public) 10 % {{{ 110 % {{{ 11 11 name='pollux' 12 12 login='username'; … … 20 20 end 21 21 methods 22 function cluster=pollux(varargin) % {{{ 122 function cluster=pollux(varargin) % {{{ 23 23 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster); 24 24 end 25 25 %}}} 26 function disp(cluster) % {{{ 126 function disp(cluster) % {{{ 27 27 % display the object 28 28 disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1))); … … 37 37 end 38 38 %}}} 39 function checkconsistency(cluster,md,solution,analyses) % {{{139 function md = checkconsistency(cluster,md,solution,analyses) % {{{ 40 40 41 41 available_queues={'shortp','longp'}; … … 46 46 end 47 47 %}}} 48 function BuildQueueScript(cluster,m d) % {{{148 function BuildQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{ 49 49 50 %retrieve parameters 51 modelname=md.miscellaneous.name; 52 solution=md.private.solution; 50 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end 51 if(isgprof), disp('gprof not supported by cluster, ignoring...'); end 53 52 54 % open file for writing:53 %write queuing script 55 54 fid=fopen([modelname '.queue'],'w'); 56 57 55 fprintf(fid,'#!/bin/sh\n'); 58 56 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds. … … 64 62 fprintf(fid,'#PBS -o %s.outlog \n',modelname); 65 63 fprintf(fid,'#PBS -e %s.errlog \n',modelname); 66 67 64 fprintf(fid,'export PBS_O_WORKDIR=%s\n',cluster.executionpath); 68 65 fprintf(fid,'cd $PBS_O_WORKDIR\n'); 69 66 fprintf(fid,'export OMP_NUM_THREADS=1\n'); 70 67 fprintf(fid,'dplace -s1 -c0-%i mpiexec -np %i %s/issm.exe %s %s %s',cluster.np-1,cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname); 71 72 %close file73 68 fclose(fid); 74 69 75 70 end 76 71 %}}} 77 function LaunchQueueJob(cluster,md,options)% {{{1 78 79 %lauch command, to be executed via ssh 80 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ... 81 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz && qsub ' modelname '.queue ']; 72 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{ 82 73 83 if ~strcmpi(options.batch,'yes'), 84 85 %compress the files into one zip. 86 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue ' md.miscellaneous.name '.petsc ']; 87 if md.qmu.isdakota, 88 compressstring=[compressstring md.miscellaneous.name '.qmu.in']; 89 end 90 system(compressstring); 91 92 disp('uploading input file and queueing script'); 93 issmscpout(md.cluster.name,md.cluster.executionpath,md.cluster.login,md.cluster.port,{[md.private.runtimename '.tar.gz']}); 94 95 disp('launching solution sequence on remote cluster'); 96 issmssh(md.cluster.name,md.cluster.login,md.cluster.port,launchcommand); 74 %compress the files into one zip. 75 compressstring=['tar -zcf ' dirname '.tar.gz ']; 76 for i=1:numel(filelist), 77 compressstring = [compressstring ' ' filelist{i}]; 78 end 79 if cluster.interactive, 80 compressstring = [compressstring ' ' modelname '.errlog ' modelname '.outlog ']; 81 end 82 system(compressstring); 97 83 98 else 99 disp('batch mode requested: not launching job interactively'); 100 disp('launch solution sequence on remote cluster by hand'); 101 end 84 disp('uploading input file and queueing script'); 85 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); 102 86 103 end 104 %}}} 105 function Download(cluster,md)% {{{1 87 disp('launching solution sequence on remote cluster'); 88 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... 89 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; 90 issmssh(cluster.name,cluster.login,cluster.port,launchcommand); 91 end %}}} 92 function Download(cluster,dirname,filelist)% {{{ 106 93 107 %some check 108 if isempty(md.private.runtimename), 109 error('pfe Download error message: supply runtime name for results to be loaded!'); 110 end 94 %copy files from cluster to current directory 95 directory=[cluster.executionpath '/' dirname '/']; 96 issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist); 111 97 112 %Figure out the directory where all the files are in: 113 directory=[cluster.executionpath '/' md.private.runtimename '/']; 114 115 %What packages are we picking up from remote cluster 116 packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 117 if md.qmu.isdakota, 118 packages{end+1}=[md.miscellaneous.name '.qmu.err']; 119 packages{end+1}=[md.miscellaneous.name '.qmu.out']; 120 if isfield(md.qmu.params,'tabular_graphics_data'), 121 if md.qmu.params.tabular_graphics_data==true, 122 packages{end+1}='dakota_tabular.dat'; 123 end 124 end 125 else 126 packages{end+1}=[md.miscellaneous.name '.outbin']; 127 end 128 129 %copy files from cluster to present directory 130 issmscpin(cluster.name, cluster.login, cluster.port, directory, packages); 131 end %}}} 98 end %}}} 132 99 end 133 100 end -
issm/trunk/src/m/classes/constants.m
r11995 r12706 31 31 32 32 end % }}} 33 function flag= checkconsistency(obj,md,solution,analyses) % {{{33 function md = checkconsistency(obj,md,solution,analyses) % {{{ 34 34 35 checkfield(md,'constants.g','>',0,'size',[1 1]);36 checkfield(md,'constants.yts','>',0,'size',[1 1]);37 checkfield(md,'constants.referencetemperature','size',[1 1]);35 md = checkfield(md,'constants.g','>',0,'size',[1 1]); 36 md = checkfield(md,'constants.yts','>',0,'size',[1 1]); 37 md = checkfield(md,'constants.referencetemperature','size',[1 1]); 38 38 39 39 end % }}} -
issm/trunk/src/m/classes/debug.m
r11995 r12706 8 8 valgrind = false; 9 9 gprof = false; 10 p etsc_profiling = false;10 profiling = false; 11 11 end 12 12 methods … … 27 27 fielddisplay(obj,'valgrind','use Valgrind to debug (0 or 1)'); 28 28 fielddisplay(obj,'gprof','use gnu-profiler to find out where the time is spent'); 29 fielddisplay(obj,'p etsc_profiling','enables PETScprofiling (memory, flops, time)');29 fielddisplay(obj,'profiling','enables profiling (memory, flops, time)'); 30 30 31 31 end % }}} 32 32 function marshall(obj,fid) % {{{ 33 WriteData(fid,'object',obj,'fieldname','p etsc_profiling','format','Boolean');33 WriteData(fid,'object',obj,'fieldname','profiling','format','Boolean'); 34 34 end % }}} 35 35 end -
issm/trunk/src/m/classes/diagnostic.m
r11995 r12706 64 64 65 65 end % }}} 66 function checkconsistency(obj,md,solution,analyses) % {{{66 function md = checkconsistency(obj,md,solution,analyses) % {{{ 67 67 68 68 %Early return … … 70 70 %if ~ismember(DiagnosticHorizAnalysisEnum,analyses) | (solution==TransientSolutionEnum & md.transient.isdiagnostic==0), return; end 71 71 72 checkfield(md,'diagnostic.spcvx','forcing',1);73 checkfield(md,'diagnostic.spcvy','forcing',1);74 if md.mesh.dimension==3, checkfield(md,'diagnostic.spcvz','forcing',1); end75 checkfield(md,'diagnostic.restol','size',[1 1],'>',0);76 checkfield(md,'diagnostic.reltol','size',[1 1]);77 checkfield(md,'diagnostic.abstol','size',[1 1]);78 checkfield(md,'diagnostic.isnewton','numel',1,'values',[0 1]);79 checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1);80 checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1);72 md = checkfield(md,'diagnostic.spcvx','forcing',1); 73 md = checkfield(md,'diagnostic.spcvy','forcing',1); 74 if md.mesh.dimension==3, md = checkfield(md,'diagnostic.spcvz','forcing',1); end 75 md = checkfield(md,'diagnostic.restol','size',[1 1],'>',0); 76 md = checkfield(md,'diagnostic.reltol','size',[1 1]); 77 md = checkfield(md,'diagnostic.abstol','size',[1 1]); 78 md = checkfield(md,'diagnostic.isnewton','numel',1,'values',[0 1]); 79 md = checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1); 80 md = checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1); 81 81 if md.mesh.dimension==2, 82 checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);82 md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1); 83 83 else 84 checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1);84 md = checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1); 85 85 end 86 checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);87 checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1);88 checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]);86 md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]); 87 md = checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1); 88 md = checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]); 89 89 if ~isempty(md.diagnostic.requested_outputs), 90 checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]);90 md = checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]); 91 91 end 92 92 93 93 %singular solution 94 94 if ~any((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy))==2), 95 checkmessage(['model ' md.miscellaneous.name ' is not well posed (singular). You need at least one node with fixed velocity!'])95 md = checkmessage(md,['model is not well posed (singular). You need at least one node with fixed velocity!']); 96 96 end 97 97 %CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES 98 98 if any(sum(isnan(md.diagnostic.referential),2)~=0 & sum(isnan(md.diagnostic.referential),2)~=6), 99 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc.Each line of diagnostic.referential should contain either only NaN values or no NaN values']);99 md = checkmessage(md,['Each line of diagnostic.referential should contain either only NaN values or no NaN values']); 100 100 end 101 101 %CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL … … 103 103 pos=find(sum(isnan(md.diagnostic.referential),2)==0); 104 104 if any(abs(dot(md.diagnostic.referential(pos,1:3)',md.diagnostic.referential(pos,4:6)'))>eps), 105 checkmessage(['model ' md.miscellaneous.name ' has problem with referential.Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']);105 md = checkmessage(md,['Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']); 106 106 end 107 107 end … … 110 110 pos=find(md.mask.vertexongroundedice & md.mesh.vertexonbed); 111 111 if any(~isnan(md.diagnostic.referential(pos,:))), 112 checkmessage(['no referential should be specified for basal vertices of grounded ice']);112 md = checkmessage(md,['no referential should be specified for basal vertices of grounded ice']); 113 113 end 114 114 end -
issm/trunk/src/m/classes/flaim.m
r11995 r12706 32 32 33 33 end % }}} 34 function checkconsistency(obj,md,solution,analyses) % {{{34 function md = checkconsistency(obj,md,solution,analyses) % {{{ 35 35 36 36 %Early return 37 37 if solution~=FlaimSolutionEnum, return; end 38 38 39 checkfield(md,'flaim.tracks','file',1);39 md = checkfield(md,'flaim.tracks','file',1); 40 40 if any(isnan(md.flaim.criterion)) || isempty(md.flaim.criterion) 41 checkfield(md,'flaim.targets','file',1);41 md = checkfield(md,'flaim.targets','file',1); 42 42 else 43 checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);43 md = checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]); 44 44 end 45 45 -
issm/trunk/src/m/classes/flowequation.m
r11995 r12706 27 27 28 28 end % }}} 29 function checkconsistency(obj,md,solution,analyses) % {{{29 function md = checkconsistency(obj,md,solution,analyses) % {{{ 30 30 31 31 if ismember(DiagnosticHorizAnalysisEnum,analyses), 32 32 33 checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]);34 checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]);35 checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]);36 checkfield(md,'flowequation.bordermacayeal','size',[md.mesh.numberofvertices 1],'values',[0 1]);37 checkfield(md,'flowequation.borderpattyn','size',[md.mesh.numberofvertices 1],'values',[0 1]);38 checkfield(md,'flowequation.borderstokes','size',[md.mesh.numberofvertices 1],'values',[0 1]);33 md = checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]); 34 md = checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]); 35 md = checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]); 36 md = checkfield(md,'flowequation.bordermacayeal','size',[md.mesh.numberofvertices 1],'values',[0 1]); 37 md = checkfield(md,'flowequation.borderpattyn','size',[md.mesh.numberofvertices 1],'values',[0 1]); 38 md = checkfield(md,'flowequation.borderstokes','size',[md.mesh.numberofvertices 1],'values',[0 1]); 39 39 if (md.mesh.dimension==2), 40 checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);41 checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);40 md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]); 41 md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]); 42 42 else 43 checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]);44 checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]);43 md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]); 44 md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]); 45 45 end 46 46 if (md.flowequation.ismacayealpattyn==0 && md.flowequation.ishutter==0 && md.flowequation.isstokes==0), 47 checkmessage(['no element types set for this model. At least one of ismacayealpattyn, ishutter or isstokes need to be =1']);47 md = checkmessage(md,['no element types set for this model. At least one of ismacayealpattyn, ishutter or isstokes need to be =1']); 48 48 end 49 49 end 50 50 if ismember(DiagnosticHutterAnalysisEnum,analyses), 51 if any(md.flowequation.element_equation==1 & md.mask.elementonfloatingice), 52 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n')); 51 if any(md.flowequation.element_equation==1), 52 if(md.flowequation.element_equation & md.mask.elementonfloatingice), 53 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n')); 54 end 53 55 end 54 56 end -
issm/trunk/src/m/classes/friction.m
r11995 r12706 22 22 23 23 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{24 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 25 26 26 %Early return 27 27 if ~ismember(DiagnosticHorizAnalysisEnum,analyses) & ~ismember(ThermalAnalysisEnum,analyses), return; end 28 28 29 checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);30 checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);31 checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);29 md = checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]); 30 md = checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]); 31 md = checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]); 32 32 end % }}} 33 33 function disp(obj) % {{{ -
issm/trunk/src/m/classes/geometry.m
r11995 r12706 24 24 25 25 end % }}} 26 function checkconsistency(obj,md,solution,analyses) % {{{26 function md = checkconsistency(obj,md,solution,analyses) % {{{ 27 27 28 checkfield(md,'geometry.surface' ,'NaN',1,'size',[md.mesh.numberofvertices 1]);29 checkfield(md,'geometry.bed' ,'NaN',1,'size',[md.mesh.numberofvertices 1]);30 checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);28 md = checkfield(md,'geometry.surface' ,'NaN',1,'size',[md.mesh.numberofvertices 1]); 29 md = checkfield(md,'geometry.bed' ,'NaN',1,'size',[md.mesh.numberofvertices 1]); 30 md = checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0); 31 31 if any((obj.thickness-obj.surface+obj.bed)>10^-9), 32 checkmessage(['equality thickness=surface-bed violated']);32 md = checkmessage(md,['equality thickness=surface-bed violated']); 33 33 end 34 34 if solution==TransientSolutionEnum & md.transient.isgroundingline, 35 checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);35 md = checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]); 36 36 end 37 37 end % }}} -
issm/trunk/src/m/classes/groundingline.m
r12329 r12706 28 28 29 29 end % }}} 30 function checkconsistency(obj,md,solution,analyses) % {{{30 function md = checkconsistency(obj,md,solution,analyses) % {{{ 31 31 32 checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'});32 md = checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'}); 33 33 34 34 if ~strcmp(obj.migration,'None'), 35 35 if isnan(md.geometry.bathymetry), 36 checkmessage(['requesting grounding line migration, but bathymetry is absent!']);36 md = checkmessage(md,['requesting grounding line migration, but bathymetry is absent!']); 37 37 end 38 38 pos=find(md.mask.vertexongroundedice); 39 39 if any(abs(md.geometry.bed(pos)-md.geometry.bathymetry(pos))>10^-10), 40 checkmessage(['bathymetry not equal to bed on grounded ice !']);40 md = checkmessage(md,['bathymetry not equal to bed on grounded ice !']); 41 41 end 42 42 pos=find(md.mask.vertexonfloatingice); 43 43 if any(md.geometry.bathymetry(pos)-md.geometry.bed(pos)>10^-9), 44 checkmessage(['bathymetry superior to bed on floating ice !']);44 md = checkmessage(md,['bathymetry superior to bed on floating ice !']); 45 45 end 46 46 end -
issm/trunk/src/m/classes/hydrology.m
r11995 r12706 35 35 obj.stabilization=1; 36 36 end % }}} 37 function checkconsistency(obj,md,solution,analyses) % {{{37 function md = checkconsistency(obj,md,solution,analyses) % {{{ 38 38 39 39 %Early return 40 40 if ~ismember(HydrologyAnalysisEnum,analyses), return; end 41 41 42 checkfield(md,'hydrology.spcwatercolumn','forcing',1);43 checkfield(md,'hydrology.stabilization','>=',0);42 md = checkfield(md,'hydrology.spcwatercolumn','forcing',1); 43 md = checkfield(md,'hydrology.stabilization','>=',0); 44 44 end % }}} 45 45 function disp(obj) % {{{ -
issm/trunk/src/m/classes/initialization.m
r11995 r12706 27 27 28 28 end % }}} 29 function checkconsistency(obj,md,solution,analyses) % {{{29 function md = checkconsistency(obj,md,solution,analyses) % {{{ 30 30 if ismember(DiagnosticHorizAnalysisEnum,analyses) 31 31 if ~isnan(md.initialization.vx) & ~isnan(md.initialization.vy), 32 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);33 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);32 md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]); 33 md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]); 34 34 end 35 35 end 36 36 if ismember(PrognosticAnalysisEnum,analyses), 37 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);38 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);37 md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]); 38 md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]); 39 39 end 40 40 if ismember(HydrologyAnalysisEnum,analyses), 41 checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);41 md = checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]); 42 42 end 43 43 if ismember(BalancethicknessAnalysisEnum,analyses), 44 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);45 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);44 md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]); 45 md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]); 46 46 %Triangle with zero velocity 47 47 if any(sum(abs(md.initialization.vx(md.mesh.elements)),2)==0 & sum(abs(md.initialization.vy(md.mesh.elements)),2)==0) 48 checkmessage('at least one triangle has all its vertices with a zero velocity');48 md = checkmessage(md,'at least one triangle has all its vertices with a zero velocity'); 49 49 end 50 50 end 51 51 if ismember(ThermalAnalysisEnum,analyses), 52 checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);53 checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);54 checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);55 checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);52 md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]); 53 md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]); 54 md = checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]); 55 md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]); 56 56 end 57 if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy) ,58 checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);57 if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy) | solution==EnthalpySolutionEnum, 58 md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]); 59 59 end 60 60 end % }}} -
issm/trunk/src/m/classes/inversion.m
r11995 r12706 75 75 76 76 end % }}} 77 function checkconsistency(obj,md,solution,analyses) % {{{77 function md = checkconsistency(obj,md,solution,analyses) % {{{ 78 78 79 79 %Early return … … 83 83 num_costfunc=size(md.inversion.cost_functions,2); 84 84 85 checkfield(md,'inversion.iscontrol','values',[0 1]);86 checkfield(md,'inversion.tao','values',[0 1]);87 checkfield(md,'inversion.incomplete_adjoint','values',[0 1]);88 checkfield(md,'inversion.control_parameters','cell',1,'values',{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'Vx' 'Vy'});89 checkfield(md,'inversion.nsteps','numel',1,'>=',1);90 checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0);91 checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps 1]);92 checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:503]);93 checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);94 checkfield(md,'inversion.gradient_only','values',[0 1]);95 checkfield(md,'inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]);96 checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);97 checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);85 md = checkfield(md,'inversion.iscontrol','values',[0 1]); 86 md = checkfield(md,'inversion.tao','values',[0 1]); 87 md = checkfield(md,'inversion.incomplete_adjoint','values',[0 1]); 88 md = checkfield(md,'inversion.control_parameters','cell',1,'values',{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'Vx' 'Vy'}); 89 md = checkfield(md,'inversion.nsteps','numel',1,'>=',1); 90 md = checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0); 91 md = checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps 1]); 92 md = checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:503]); 93 md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0); 94 md = checkfield(md,'inversion.gradient_only','values',[0 1]); 95 md = checkfield(md,'inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]); 96 md = checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]); 97 md = checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]); 98 98 99 99 if solution==BalancethicknessSolutionEnum 100 checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);100 md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1); 101 101 else 102 checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);103 checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);102 md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1); 103 md = checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1); 104 104 end 105 105 end % }}} -
issm/trunk/src/m/classes/mask.m
r11995 r12706 25 25 26 26 end % }}} 27 function checkconsistency(obj,md,solution,analyses) % {{{27 function md = checkconsistency(obj,md,solution,analyses) % {{{ 28 28 29 checkfield(md,'mask.elementonfloatingice','size',[md.mesh.numberofelements 1],'values',[0 1]);30 checkfield(md,'mask.elementongroundedice','size',[md.mesh.numberofelements 1],'values',[0 1]);31 checkfield(md,'mask.elementonwater' ,'size',[md.mesh.numberofelements 1],'values',[0 1]);32 checkfield(md,'mask.vertexonfloatingice','size',[md.mesh.numberofvertices 1],'values',[0 1]);33 checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]);34 checkfield(md,'mask.vertexonwater' ,'size',[md.mesh.numberofvertices 1],'values',[0 1]);29 md = checkfield(md,'mask.elementonfloatingice','size',[md.mesh.numberofelements 1],'values',[0 1]); 30 md = checkfield(md,'mask.elementongroundedice','size',[md.mesh.numberofelements 1],'values',[0 1]); 31 md = checkfield(md,'mask.elementonwater' ,'size',[md.mesh.numberofelements 1],'values',[0 1]); 32 md = checkfield(md,'mask.vertexonfloatingice','size',[md.mesh.numberofvertices 1],'values',[0 1]); 33 md = checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]); 34 md = checkfield(md,'mask.vertexonwater' ,'size',[md.mesh.numberofvertices 1],'values',[0 1]); 35 35 end % }}} 36 36 function disp(obj) % {{{ -
issm/trunk/src/m/classes/materials.m
r12301 r12706 69 69 obj.rheology_law='Paterson'; 70 70 end % }}} 71 function checkconsistency(obj,md,solution,analyses) % {{{72 checkfield(md,'materials.rho_ice','>',0);73 checkfield(md,'materials.rho_water','>',0);74 checkfield(md,'materials.rho_freshwater','>',0);75 checkfield(md,'materials.mu_water','>',0);76 checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);77 checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);78 checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'});71 function md = checkconsistency(obj,md,solution,analyses) % {{{ 72 md = checkfield(md,'materials.rho_ice','>',0); 73 md = checkfield(md,'materials.rho_water','>',0); 74 md = checkfield(md,'materials.rho_freshwater','>',0); 75 md = checkfield(md,'materials.mu_water','>',0); 76 md = checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]); 77 md = checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]); 78 md = checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'}); 79 79 end % }}} 80 80 function disp(obj) % {{{ … … 83 83 fielddisplay(obj,'rho_ice','ice density [kg/m^3]'); 84 84 fielddisplay(obj,'rho_water','ocean water density [kg/m^3]'); 85 fielddisplay(obj,' freshrho_water','fresh water density [kg/m^3]');85 fielddisplay(obj,'rho_freshwater','fresh water density [kg/m^3]'); 86 86 fielddisplay(obj,'mu_water','water viscosity [N s/m^2]'); 87 87 fielddisplay(obj,'heatcapacity','heat capacity [J/kg/K]'); -
issm/trunk/src/m/classes/mesh.m
r11995 r12706 64 64 obj.average_vertex_connectivity=25; 65 65 end % }}} 66 function checkconsistency(obj,md,solution,analyses) % {{{66 function md = checkconsistency(obj,md,solution,analyses) % {{{ 67 67 68 checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);69 checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);70 checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);71 checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);68 md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]); 69 md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]); 70 md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]); 71 md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices); 72 72 if(md.mesh.dimension==2), 73 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);73 md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]); 74 74 else 75 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);75 md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]); 76 76 end 77 77 if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:))))); 78 checkmessage('orphan nodes have been found. Check the mesh outline');78 md = checkmessage(md,'orphan nodes have been found. Check the mesh outline'); 79 79 end 80 checkfield(md,'mesh.dimension','values',[2 3]);81 checkfield(md,'mesh.numberoflayers','>=',0);82 checkfield(md,'mesh.numberofelements','>',0);83 checkfield(md,'mesh.numberofvertices','>',0);80 md = checkfield(md,'mesh.dimension','values',[2 3]); 81 md = checkfield(md,'mesh.numberoflayers','>=',0); 82 md = checkfield(md,'mesh.numberofelements','>',0); 83 md = checkfield(md,'mesh.numberofvertices','>',0); 84 84 %no checks for numberofedges lat long and hemisphere 85 checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);86 checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);87 checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);88 checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);85 md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]); 86 md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]); 87 md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]); 88 md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]); 89 89 if (md.mesh.dimension==2), 90 checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');90 md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d'); 91 91 else 92 checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');92 md = checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d'); 93 93 end 94 checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements 3],'NaN',1);94 md = checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements 3],'NaN',1); 95 95 96 96 %Solution specific checks … … 98 98 case PrognosticSolutionEnum, 99 99 if md.prognostic.stabilization==3, 100 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');101 checkfield(md,'mesh.edges','size',[NaN 4]);102 checkfield(md,'mesh.edges(:,1:3)','>',0);100 md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes'); 101 md = checkfield(md,'mesh.edges','size',[NaN 4]); 102 md = checkfield(md,'mesh.edges(:,1:3)','>',0); 103 103 end 104 104 case BalancethicknessSolutionEnum, 105 105 if md.balancethickness.stabilization==3, 106 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');107 checkfield(md,'mesh.edges','size',[NaN 4]);108 checkfield(md,'mesh.edges(:,1:3)','>',0);106 md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes'); 107 md = checkfield(md,'mesh.edges','size',[NaN 4]); 108 md = checkfield(md,'mesh.edges(:,1:3)','>',0); 109 109 end 110 110 case TransientSolutionEnum, 111 111 if md.transient.isprognostic & md.prognostic.stabilization==3, 112 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');113 checkfield(md,'mesh.edges','size',[NaN 4]);114 checkfield(md,'mesh.edges(:,1:3)','>',0);112 md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes'); 113 md = checkfield(md,'mesh.edges','size',[NaN 4]); 114 md = checkfield(md,'mesh.edges(:,1:3)','>',0); 115 115 end 116 116 case ThermalSolutionEnum, 117 checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');117 md = checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes'); 118 118 end 119 119 end % }}} -
issm/trunk/src/m/classes/miscellaneous.m
r11995 r12706 19 19 end 20 20 end % }}} 21 function checkconsistency(obj,md,solution,analyses) % {{{21 function md = checkconsistency(obj,md,solution,analyses) % {{{ 22 22 23 checkfield(md,'miscellaneous.name','empty',1);23 md = checkfield(md,'miscellaneous.name','empty',1); 24 24 25 25 end % }}} -
issm/trunk/src/m/classes/model/model.m
r12337 r12706 6 6 classdef model 7 7 properties (SetAccess=public) %Model fields 8 % {{{ 18 % {{{ 9 9 %Careful here: no other class should be used as default value this is a bug of matlab 10 10 mesh = 0; … … 75 75 end 76 76 methods 77 function md = model(varargin) % {{{ 177 function md = model(varargin) % {{{ 78 78 79 79 switch nargin … … 83 83 error('model constructor error message: 0 of 1 argument only in input.'); 84 84 end 85 end 86 %}}} 87 function md = checkmessage(md,string) % {{{ 88 if(nargout~=1) error('wrong usage, model must be an output'); end 89 disp(['model not consistent: ' string]); 90 md.private.isconsistent=false; 85 91 end 86 92 %}}} … … 242 248 if isfield(structmd,'pressureload'), md.diagnostic.icefront=structmd.pressureload; end 243 249 if isfield(structmd,'diagnostic_ref'), md.diagnostic.referential=structmd.diagnostic_ref; end 244 245 246 247 250 if isfield(structmd,'npart'); md.qmu.numberofpartitions=structmd.npart; end 251 if isfield(structmd,'part'); md.qmu.partition=structmd.part; end 252 248 253 %Field changes 249 254 if (isfield(structmd,'type') & ischar(structmd.type)), … … 356 361 md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices,6); 357 362 end 358 if isfield(structmd,'npart'); md.qmu.numberofpartitions=structmd.npart; end 359 if isfield(structmd,'part'); md.qmu.partition=structmd.part; end 360 363 361 364 end% }}} 362 function md = setdefaultparameters(md) % {{{ 1365 function md = setdefaultparameters(md) % {{{ 363 366 364 367 %initialize subclasses -
issm/trunk/src/m/classes/model/planet.m
r9548 r12706 6 6 classdef planet < model 7 7 properties (SetAccess=public) %Planet fields 8 % {{{ 18 % {{{ 9 9 %Planet specific fields 10 10 r=NaN; … … 14 14 end 15 15 methods 16 function md=planetmesh(md,varargin) % {{{ 116 function md=planetmesh(md,varargin) % {{{ 17 17 %PLANETMESH: build 2d shell mesh 18 18 % -
issm/trunk/src/m/classes/organizer.m
r9423 r12706 16 16 classdef organizer 17 17 properties (SetAccess=private) 18 % {{{ 118 % {{{ 19 19 currentstep =0; 20 20 end … … 28 28 end 29 29 methods 30 function org=organizer(varargin) % {{{ 130 function org=organizer(varargin) % {{{ 31 31 32 32 %process options … … 57 57 end 58 58 %}}} 59 function disp(org) % {{{ 159 function disp(org) % {{{ 60 60 disp(sprintf(' Repository: ''%s''',org.repository)); 61 61 disp(sprintf(' Prefix: ''%s''',org.prefix)); … … 69 69 end 70 70 %}}} 71 function md=loadmodel(org,string),% {{{1 71 function md=load(org,string),% {{{ 72 73 %Get model path 74 if ~ischar(string), error('argument provided is not a string'); end 75 path=[org.repository '/' org.prefix string]; 76 77 %figure out if the model is there 78 if exist(path,'file'), 79 struc=load(path,'-mat'); 80 name=char(fieldnames(struc)); 81 md=struc.(name); 82 if nargout, 83 varargout{1}=md; 84 end 85 else 86 error(['Could not find ' path ]); 87 end 88 end%}}} 89 function md=loadmodel(org,string),% {{{ 72 90 73 91 %Get model path … … 76 94 77 95 %figure out if the model is there, otherwise, we have to use the default path supplied by user. 78 if exist(path,'file') ,96 if exist(path,'file') | exist([path '.mat'],'file'), 79 97 md=loadmodel(path); 80 98 return; … … 95 113 end 96 114 end%}}} 97 function bool=perform(org,string) % {{{ 1115 function bool=perform(org,string) % {{{ 98 116 99 117 bool=false; … … 129 147 130 148 end%}}} 131 function savemodel(org,md) % {{{ 1149 function savemodel(org,md) % {{{ 132 150 133 151 %check … … 139 157 140 158 %check that md is a model 141 if ~isa(md,'model'), error('savemodel error message:third argument is not a model'); end159 if ~isa(md,'model'), warning('third argument is not a model'); end 142 160 if (org.currentstep>length(org.steps)), error(['organizer error message: element with id ' num2str(org.currentstep) ' not found']); end 143 161 -
issm/trunk/src/m/classes/pairoptions.m
r11995 r12706 223 223 end 224 224 end % }}} 225 function marshall(obj,fid,firstindex)% {{{ 226 227 for i=1:size(obj.list,1), 228 name = obj.list{i,1}; 229 value = obj.list{i,2}; 230 231 %Write option name 232 WriteData(fid,'enum',(firstindex-1)+2*i-1,'data',name,'format','String'); 233 234 %Write option value 235 if (isnumeric(value) & numel(value)==1), 236 WriteData(fid,'enum',(firstindex-1)+2*i,'data',value,'format','Double'); 237 elseif ischar(value), 238 WriteData(fid,'enum',(firstindex-1)+2*i,'data',value,'format','String'); 239 else 240 error(['Cannot marshall option ' name ': format not supported yet']); 241 end 242 end 243 end % }}} 225 244 end 226 245 end -
issm/trunk/src/m/classes/pairoptions.py
r12329 r12706 1 class pairoptions: 2 #properties 3 def __init__(self,*args): 4 # {{{ Properties 5 if len(args)%2==1: 6 raise RuntimeError('pairoption error message: an even number of options is required') 7 8 #create a pairoption object 9 if len(args)==0: 10 self.list=[] 11 else: 12 self.list=[] 13 for i in range(int(round(len(args)/2))): 14 if isinstance(args[2*i],str): 15 self.list.append([args[2*i],args[2*i+1]]) 1 """ 2 PAIROPTIONS class definition 3 4 Usage: 5 pairoptions=pairoptions(); 6 pairoptions=pairoptions('module',true,'solver',false); 7 """ 8 9 from WriteData import * 10 11 class pairoptions(object): 12 def __init__(self,*arg): 13 self.functionname = '' 14 self.list = {} 15 16 #get calling function name 17 import inspect 18 if len(inspect.stack()) > 1: 19 self.functionname=inspect.stack()[1][3] 20 21 #initialize list 22 if not len(arg): 23 pass #Do nothing, 24 else: 25 self.buildlist(*arg) 26 # }}} 27 28 def buildlist(self,*arg): # {{{ 29 """BUILDLIST - build list of objects from input""" 30 31 #check length of input 32 if len(arg) % 2: 33 raise TypeError('error: an even number of options is required') 34 numoptions = len(arg)/2 35 36 #go through arg and build list of objects 37 for i in xrange(numoptions): 38 if isinstance(arg[2*i],str): 39 self.list[arg[2*i]] = arg[2*i+1]; 40 else: 41 #option is not a string, ignore it 42 print "WARNING: option number %d '%s' is not a string and will be ignored." % (i+1,type(arg[2*i])) 43 # }}} 44 45 def addfield(self,field,value): # {{{ 46 """ADDFIELD - add a field to an options list""" 47 if isinstance(field,str): 48 if field in self.list: 49 print "WARNING: field '%s' with value=%s exists and will be overwritten with value=%s." % (field,str(self.list[field]),str(value)) 50 self.list[field] = value 51 # }}} 52 53 def addfielddefault(self,field,value): # {{{ 54 """ADDFIELDDEFAULT - add a field to an options list if it does not exist""" 55 if isinstance(field,str): 56 if not field in self.list: 57 self.list[field] = value 58 # }}} 59 60 def AssignObjectFields(self,obj2): # {{{ 61 """ASSIGNOBJECTFIELDS - assign object fields from options""" 62 for item in self.list.iteritems(): 63 if item[0] in dir(obj2): 64 setattr(obj2,item[0],item[1]) 65 else: 66 print "WARNING: field '%s' is not a property of '%s'." % (item[0],type(obj2)) 67 return obj2 68 # }}} 69 70 def changefieldvalue(self,field,newvalue): # {{{ 71 """CHANGEOPTIONVALUE - change the value of an option in an option list""" 72 73 self.list[field]=newvalue; 74 # }}} 75 76 # function obj = deleteduplicates(obj,warn) % {{{ 77 # %DELETEDUPLICATES - delete duplicates in an option list 78 # 79 # %track the first occurance of each option 80 # [dummy lines]=unique(obj.list(:,1),'first'); 81 # clear dummy 82 # 83 # %warn user if requested 84 # if warn, 85 # numoptions=size(obj.list,1); 86 # for i=1:numoptions, 87 # if ~ismember(i,lines), 88 # disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurence will be kept']) 89 # end 90 # end 91 # end 92 # 93 # %remove duplicates from the options list 94 # obj.list=obj.list(lines,:); 95 # end % }}} 96 97 def __repr__(self): # {{{ 98 s=" functionname: '%s'\n" % self.functionname 99 if self.list: 100 s+=" list: (%ix%i)\n\n" % (len(self.list),2) 101 for item in self.list.iteritems(): 102 if isinstance(item[1],str): 103 s+=" field: %-10s value: '%s'\n" % (item[0],item[1]) 104 elif isinstance(item[1],(bool,int,long,float)): 105 s+=" field: %-10s value: %g\n" % (item[0],item[1]) 16 106 else: 17 #option is not a string, ignore it 18 print("%s%i%s"%('buildlist info: option number ',i,' is not a string, it will be ignored')) 19 continue 20 21 #}}} 22 def __repr__(obj): 23 # {{{ Display 24 if not obj.list: 25 string=' list: empty' 26 else: 27 string=" list: (%i)"%(len(obj.list)) 28 for i in range(len(obj.list)): 29 if isinstance(obj.list[i][1],str): 30 string2=" field: %-10s value: '%s'"%(obj.list[i][0],obj.list[i][1]) 31 elif isinstance(obj.list[i][1],float): 32 string2=" field: %-10s value: %g"%(obj.list[i][0],obj.list[i][1]) 33 elif isinstance(obj.list[i][1],int): 34 string2=" field: %-10s value: %i"%(obj.list[i][0],obj.list[i][1]) 35 else: 36 string2=" field: %-10s value: (%i)"%(len(obj.list[i][1])) 37 string="%s\n%s"%(string,string2) 38 return string 107 s+=" field: %-10s value: %s\n" % (item[0],type(item[1])) 108 else: 109 s+=" list: empty\n" 110 return s 111 # }}} 112 113 def exist(self,field): # {{{ 114 """EXIST - check if the option exist""" 115 116 #some argument checking: 117 if field == None or field == '': 118 raise ValueError('exist error message: bad usage'); 119 if not isinstance(field,str): 120 raise TypeError("exist error message: field '%s' should be a string." % str(field)); 121 122 #Recover option 123 if field in self.list: 124 return True 125 else: 126 return False 127 # }}} 128 129 # function num = fieldoccurences(obj,field), % {{{ 130 # %FIELDOCCURENCES - get number of occurence of a field 131 # 132 # %check input 133 # if ~ischar(field), 134 # error('fieldoccurences error message: field should be a string'); 135 # end 136 # 137 # %get number of occurence 138 # num=sum(strcmpi(field,obj.list(:,1))); 139 # end % }}} 140 141 def getfieldvalue(self,field,default=None): # {{{ 142 """ 143 GETOPTION - get the value of an option 144 145 Usage: 146 value=options.getfieldvalue(field,default) 147 148 Find an option value from a field. A default option 149 can be given in input if the field does not exist 150 151 Examples: 152 value=options.getfieldvalue(options,'caxis') 153 value=options.getfieldvalue(options,'caxis',[0 2]) 154 """ 155 156 #some argument checking: 157 if field == None or field == '': 158 raise ValueError('getfieldvalue error message: bad usage'); 159 if not isinstance(field,str): 160 raise TypeError("getfieldvalue error message: field '%s' should be a string." % str(field)); 161 162 #Recover option 163 if field in self.list: 164 value=self.list[field] 165 else: 166 if not default == None: 167 value=default 168 else: 169 raise KeyError("error message: field '%s' has not been provided by user (and no default value has been specified)." % field) 170 171 return value 172 # }}} 173 174 def removefield(self,field,warn): # {{{ 175 """ 176 REMOVEFIELD - delete a field in an option list 177 178 Usage: 179 obj=removefield(self,field,warn) 180 181 if warn==1 display an info message to warn user that 182 some of his options have been removed. 183 """ 184 185 #check if field exist 186 if field in self.list: 187 188 #remove duplicates from the options list 189 del self.list[field] 190 191 #warn user if requested 192 if warn: 193 print "removefield info: option '%s' has been removed from the list of options." % field 194 # }}} 195 196 def marshall(self,fid,firstindex): # {{{ 197 198 for i,item in enumerate(self.list.iteritems()): 199 name = item[0] 200 value = item[1] 201 202 #Write option name 203 WriteData(fid,'enum',(firstindex-1)+2*i+1,'data',name,'format','String') 204 205 #Write option value 206 if isinstance(value,str): 207 WriteData(fid,'enum',(firstindex-1)+2*i+2,'data',value,'format','String') 208 elif isinstance(value,(bool,int,long,float)): 209 WriteData(fid,'enum',(firstindex-1)+2*i+2,'data',value,'format','Double') 210 else: 211 raise TypeError("Cannot marshall option '%s': format not supported yet." % name) 212 # }}} 213 -
issm/trunk/src/m/classes/plotoptions.m
r11995 r12706 6 6 classdef plotoptions 7 7 properties (SetAccess=public) 8 % {{{ 18 % {{{ 9 9 numberofplots = 0; 10 10 figurenumber = 1; … … 13 13 end 14 14 methods 15 function opt=plotoptions(varargin) % {{{ 115 function opt=plotoptions(varargin) % {{{ 16 16 opt=buildlist(opt,varargin{:}); 17 17 end 18 18 %}}} 19 function disp(opt) % {{{ 119 function disp(opt) % {{{ 20 20 disp(sprintf('\n%s = \n',inputname(1))); 21 21 disp(sprintf(' numberofplots: %i',opt.numberofplots)); … … 41 41 end 42 42 %}}} 43 function opt=buildlist(opt,varargin) % {{{ 143 function opt=buildlist(opt,varargin) % {{{ 44 44 45 45 %check length of input -
issm/trunk/src/m/classes/private.m
r11995 r12706 6 6 classdef private 7 7 properties (SetAccess=public) 8 runtimename = ''; 9 bamg = struct(); 10 solution = ''; 8 isconsistent = true; 9 runtimename = ''; 10 bamg = struct(); 11 solution = ''; 11 12 end 12 13 methods … … 22 23 23 24 end % }}} 24 function checkconsistency(obj,md,solution,analyses) % {{{25 function md = checkconsistency(obj,md,solution,analyses) % {{{ 25 26 26 27 end % }}} … … 28 29 disp(sprintf(' private parameters: do not change')); 29 30 31 fielddisplay(obj,'isconsistent','is model self consistent'); 30 32 fielddisplay(obj,'runtimename','name of the run launched'); 31 33 fielddisplay(obj,'bamg','structure with mesh properties construced if bamg is used to mesh the domain'); -
issm/trunk/src/m/classes/prognostic.m
r11995 r12706 36 36 obj.hydrostatic_adjustment='Absolute'; 37 37 end % }}} 38 function checkconsistency(obj,md,solution,analyses) % {{{38 function md = checkconsistency(obj,md,solution,analyses) % {{{ 39 39 40 40 %Early return, 41 41 if ~ismember(PrognosticAnalysisEnum,analyses) | (solution==TransientSolutionEnum & md.transient.isprognostic==0), return; end 42 42 43 checkfield(md,'prognostic.spcthickness','forcing',1);44 checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});45 checkfield(md,'prognostic.stabilization','values',[0 1 2 3]);46 checkfield(md,'prognostic.min_thickness','>',0);43 md = checkfield(md,'prognostic.spcthickness','forcing',1); 44 md = checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'}); 45 md = checkfield(md,'prognostic.stabilization','values',[0 1 2 3]); 46 md = checkfield(md,'prognostic.min_thickness','>',0); 47 47 48 48 end % }}} -
issm/trunk/src/m/classes/qmu.m
r11995 r12706 35 35 36 36 end % }}} 37 function checkconsistency(obj,md,solution,analyses) % {{{37 function md = checkconsistency(obj,md,solution,analyses) % {{{ 38 38 39 39 %Early return … … 41 41 42 42 if md.qmu.params.evaluation_concurrency~=1, 43 checkmessage(['concurrency should be set to 1 when running dakota in library mode']);43 md = checkmessage(md,['concurrency should be set to 1 when running dakota in library mode']); 44 44 end 45 45 if ~isempty(md.qmu.partition), 46 46 if numel(md.qmu.partition)~=md.mesh.numberofvertices, 47 checkmessage(['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);47 md = checkmessage(md,['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']); 48 48 end 49 49 if find(md.qmu.partition)>=md.mesh.numberofvertices, 50 checkmessage(['user supplied partition should be indexed from 0 (c-convention)']);50 md = checkmessage(md,['user supplied partition should be indexed from 0 (c-convention)']); 51 51 end 52 52 if min(md.qmu.partition)~=0, 53 checkmessage(['partition vector not indexed from 0 on']);53 md = checkmessage(md,['partition vector not indexed from 0 on']); 54 54 end 55 55 if max(md.qmu.partition)>=md.mesh.numberofvertices, 56 checkmessage(['partition vector cannot have maximum index larger than number of nodes']);56 md = checkmessage(md,['partition vector cannot have maximum index larger than number of nodes']); 57 57 end 58 58 if ~isempty(find(md.qmu.partition<0)), 59 checkmessage(['partition vector cannot have values less than 0']);59 md = checkmessage(md,['partition vector cannot have values less than 0']); 60 60 end 61 61 if ~isempty(find(md.qmu.partition>=md.qmu.numberofpartitions)), 62 checkmessage(['partition vector cannot have values more than md.qmu.numberofpartitions-1']);62 md = checkmessage(md,['partition vector cannot have values more than md.qmu.numberofpartitions-1']); 63 63 end 64 64 if max(md.qmu.partition)>=md.qmu.numberofpartitions, 65 checkmessage(['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);65 md = checkmessage(md,['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']); 66 66 end 67 67 end … … 69 69 if ~strcmpi(md.cluster.name,'none'), 70 70 if md.settings.waitonlock==0, 71 checkmessage(['waitonlock should be activated when running qmu in parallel mode!']);71 md = checkmessage(md,['waitonlock should be activated when running qmu in parallel mode!']); 72 72 end 73 73 end -
issm/trunk/src/m/classes/rifts.m
r11995 r12706 21 21 22 22 end % }}} 23 function checkconsistency(obj,md,solution,analyses) % {{{23 function md = checkconsistency(obj,md,solution,analyses) % {{{ 24 24 if isempty(obj.riftstruct) | isnans(obj.riftstruct), 25 25 numrifts=0; … … 29 29 if numrifts, 30 30 if ~(md.mesh.dimension==2), 31 checkmessage(['models with rifts are only supported in 2d for now!']);31 md = checkmessage(md,['models with rifts are only supported in 2d for now!']); 32 32 end 33 33 if ~isstruct(obj.riftstruct), 34 checkmessage(['rifts.riftstruct should be a structure!']);34 md = checkmessage(md,['rifts.riftstruct should be a structure!']); 35 35 end 36 36 if ~isempty(find(md.mesh.segmentmarkers>=2)), 37 37 %We have segments with rift markers, but no rift structure! 38 checkmessage(['model should be processed for rifts (run meshprocessrifts)!']);38 md = checkmessage(md,['model should be processed for rifts (run meshprocessrifts)!']); 39 39 end 40 checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);40 md = checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]); 41 41 else 42 42 if ~isnans(obj.riftstruct), 43 checkmessage(['riftstruct shoud be NaN since numrifts is 0!']);43 md = checkmessage(md,['riftstruct shoud be NaN since numrifts is 0!']); 44 44 end 45 45 end -
issm/trunk/src/m/classes/settings.m
r11995 r12706 41 41 obj.waitonlock=Inf; 42 42 end % }}} 43 function checkconsistency(obj,md,solution,analyses) % {{{43 function md = checkconsistency(obj,md,solution,analyses) % {{{ 44 44 45 checkfield(md,'settings.io_gather','numel',1,'values',[0 1]);46 checkfield(md,'settings.lowmem','numel',1,'values',[0 1]);47 checkfield(md,'settings.results_as_patches','numel',1,'values',[0 1]);48 checkfield(md,'settings.output_frequency','numel',1,'>=',1);49 checkfield(md,'settings.waitonlock','numel',1);45 md = checkfield(md,'settings.io_gather','numel',1,'values',[0 1]); 46 md = checkfield(md,'settings.lowmem','numel',1,'values',[0 1]); 47 md = checkfield(md,'settings.results_as_patches','numel',1,'values',[0 1]); 48 md = checkfield(md,'settings.output_frequency','numel',1,'>=',1); 49 md = checkfield(md,'settings.waitonlock','numel',1); 50 50 51 51 end % }}} -
issm/trunk/src/m/classes/solver.m
r12329 r12706 18 18 end 19 19 end % }}} 20 function obj = addoptions(obj,analysis,varargin) % {{{ 120 function obj = addoptions(obj,analysis,varargin) % {{{ 21 21 % Usage example: 22 22 % md.solver=addoptions(md.solver,DiagnosticHorizAnalysisEnum,stokesoptions()); … … 54 54 end 55 55 end % }}} 56 function checkconsistency(obj,md,solution,analyses) % {{{56 function md = checkconsistency(obj,md,solution,analyses) % {{{ 57 57 analyses=properties(obj); 58 58 for i=1:numel(analyses), 59 59 if isempty(fieldnames(obj.(analyses{i}))) 60 checkmessage(['md.solver.' analyses{i} ' is empty']);60 md = checkmessage(md,['md.solver.' analyses{i} ' is empty']); 61 61 end 62 62 end -
issm/trunk/src/m/classes/steadystate.m
r11995 r12706 26 26 obj.reltol=0.01; 27 27 end % }}} 28 function checkconsistency(obj,md,solution,analyses) % {{{28 function md = checkconsistency(obj,md,solution,analyses) % {{{ 29 29 30 30 %Early return … … 32 32 33 33 if md.timestepping.time_step~=0, 34 checkmessage(['for a steadystate computation, timestepping.time_step must be zero.']);34 md = checkmessage(md,['for a steadystate computation, timestepping.time_step must be zero.']); 35 35 end 36 36 37 37 if isnan(md.diagnostic.reltol), 38 checkmessage(['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);38 md = checkmessage(md,['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']); 39 39 end 40 40 end % }}} -
issm/trunk/src/m/classes/surfaceforcings.m
r12297 r12706 9 9 mass_balance = NaN; 10 10 ispdd = 0; 11 issmbgradients = 0; 12 hc = NaN; 13 smb_pos_max = NaN; 14 smb_pos_min = NaN; 15 a_pos = NaN; 16 b_pos = NaN; 17 a_neg = NaN; 18 b_neg = NaN; 11 19 monthlytemperatures = NaN; 12 20 end … … 24 32 %pdd method not used in default mode 25 33 obj.ispdd=0; 34 obj.issmbgradients=0; 26 35 27 36 end % }}} 28 function checkconsistency(obj,md,solution,analyses) % {{{37 function md = checkconsistency(obj,md,solution,analyses) % {{{ 29 38 30 39 if ismember(PrognosticAnalysisEnum,analyses), 31 checkfield(md,'surfaceforcings.ispdd','numel',1,'values',[0 1]); 40 md = checkfield(md,'surfaceforcings.ispdd','numel',1,'values',[0 1]); 41 checkfield(md,'surfaceforcings.issmbgradients','numel',1,'values',[0 1]); 32 42 if(obj.ispdd) 33 checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1); 43 md = checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1); 44 elseif(obj.issmbgradients) 45 checkfield(md,'surfaceforcings.hc','forcing',1,'NaN',1); 46 checkfield(md,'surfaceforcings.smb_pos_max','forcing',1,'NaN',1); 47 checkfield(md,'surfaceforcings.smb_pos_min','forcing',1,'NaN',1); 48 checkfield(md,'surfaceforcings.a_pos','forcing',1,'NaN',1); 49 checkfield(md,'surfaceforcings.b_pos','forcing',1,'NaN',1); 50 checkfield(md,'surfaceforcings.a_neg','forcing',1,'NaN',1); 51 checkfield(md,'surfaceforcings.b_neg','forcing',1,'NaN',1); 34 52 else 35 checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1);53 md = checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1); 36 54 end 37 55 end 38 56 if ismember(BalancethicknessAnalysisEnum,analyses), 39 checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);57 md = checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1); 40 58 end 41 59 end % }}} … … 47 65 fielddisplay(obj,'ispdd','is pdd activated (0 or 1, default is 0)'); 48 66 fielddisplay(obj,'monthlytemperatures','monthly surface temperatures required if pdd is activated'); 67 fielddisplay(obj,'issmbgradients','is smb gradients method activated (0 or 1, default is 0)'); 68 fielddisplay(obj,'hc',' elevation of intersection between accumulation and ablation regime required if smb gradients is activated'); 69 fielddisplay(obj,'smb_pos_max',' maximum value of positive smb required if smb gradients is activated'); 70 fielddisplay(obj,'smb_pos_min',' minimum value of positive smb required if smb gradients is activated'); 71 fielddisplay(obj,'a_pos',' intercept of hs - smb regression line for accumulation regime required if smb gradients is activated'); 72 fielddisplay(obj,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'); 73 fielddisplay(obj,'a_neg',' intercept of hs - smb regression line for ablation regime required if smb gradients is activated'); 74 fielddisplay(obj,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'); 49 75 50 76 end % }}} … … 56 82 WriteData(fid,'object',obj,'fieldname','monthlytemperatures','format','DoubleMat','mattype',1); 57 83 end 84 WriteData(fid,'object',obj,'fieldname','issmbgradients','format','Boolean'); 85 if obj.issmbgradients, 86 WriteData(fid,'object',obj,'fieldname','hc','format','DoubleMat','mattype',1); 87 WriteData(fid,'object',obj,'fieldname','smb_pos_max','format','DoubleMat','mattype',1); 88 WriteData(fid,'object',obj,'fieldname','smb_pos_min','format','DoubleMat','mattype',1); 89 WriteData(fid,'object',obj,'fieldname','a_pos','format','DoubleMat','mattype',1); 90 WriteData(fid,'object',obj,'fieldname','b_pos','format','DoubleMat','mattype',1); 91 WriteData(fid,'object',obj,'fieldname','a_neg','format','DoubleMat','mattype',1); 92 WriteData(fid,'object',obj,'fieldname','b_neg','format','DoubleMat','mattype',1); 93 end 58 94 59 95 end % }}} -
issm/trunk/src/m/classes/thermal.m
r11995 r12706 40 40 obj.isenthalpy=0; 41 41 end % }}} 42 function checkconsistency(obj,md,solution,analyses) % {{{42 function md = checkconsistency(obj,md,solution,analyses) % {{{ 43 43 44 44 %Early return 45 45 if (~ismember(ThermalAnalysisEnum,analyses) & ~ismember(EnthalpyAnalysisEnum,analyses)) | (solution==TransientSolutionEnum & md.transient.isthermal==0), return; end 46 46 47 checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]);48 checkfield(md,'thermal.spctemperature','forcing',1);49 if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy ),50 checkfield(md,'thermal.spctemperature','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*md.geometry.thickness,'message','spctemperature should be below the adjusted melting point');51 checkfield(md,'thermal.isenthalpy','numel',1,'values',[0 1]);47 md = checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]); 48 md = checkfield(md,'thermal.spctemperature','forcing',1); 49 if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy & md.mesh.dimension==3), 50 md = checkfield(md,'thermal.spctemperature','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*(md.geometry.surface-md.mesh.z),'message','spctemperature should be below the adjusted melting point'); 51 md = checkfield(md,'thermal.isenthalpy','numel',1,'values',[0 1]); 52 52 end 53 53 end % }}} -
issm/trunk/src/m/classes/timestepping.m
r11995 r12706 33 33 obj.cfl_coefficient=.5; 34 34 end % }}} 35 function checkconsistency(obj,md,solution,analyses) % {{{35 function md = checkconsistency(obj,md,solution,analyses) % {{{ 36 36 37 checkfield(md,'timestepping.start_time','numel',1,'NaN',1);38 checkfield(md,'timestepping.final_time','numel',1,'NaN',1);39 checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1);40 checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]);41 checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1);37 md = checkfield(md,'timestepping.start_time','numel',1,'NaN',1); 38 md = checkfield(md,'timestepping.final_time','numel',1,'NaN',1); 39 md = checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1); 40 md = checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]); 41 md = checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1); 42 42 if obj.final_time-obj.start_time<0, 43 checkmessage('timestepping.final_time should be larger than timestepping.start_time');43 md = checkmessage(md,'timestepping.final_time should be larger than timestepping.start_time'); 44 44 end 45 45 end % }}} -
issm/trunk/src/m/classes/transient.m
r11995 r12706 30 30 31 31 end % }}} 32 function checkconsistency(obj,md,solution,analyses) % {{{32 function md = checkconsistency(obj,md,solution,analyses) % {{{ 33 33 34 34 %Early return 35 35 if solution~=TransientSolutionEnum, return; end 36 36 37 checkfield(md,'transient.isprognostic','numel',1,'values',[0 1]);38 checkfield(md,'transient.isdiagnostic','numel',1,'values',[0 1]);39 checkfield(md,'transient.isthermal','numel',1,'values',[0 1]);40 checkfield(md,'transient.isgroundingline','numel',1,'values',[0 1]);37 md = checkfield(md,'transient.isprognostic','numel',1,'values',[0 1]); 38 md = checkfield(md,'transient.isdiagnostic','numel',1,'values',[0 1]); 39 md = checkfield(md,'transient.isthermal','numel',1,'values',[0 1]); 40 md = checkfield(md,'transient.isgroundingline','numel',1,'values',[0 1]); 41 41 42 42 end % }}} -
issm/trunk/src/m/classes/verbose.m
r11995 r12706 21 21 classdef verbose 22 22 properties (SetAccess=public) 23 % {{{ 123 % {{{ 24 24 %BEGINFIELDS 25 25 mprocessor = false; … … 35 35 %}}} 36 36 methods 37 function verbose=verbose(varargin) % {{{ 137 function verbose=verbose(varargin) % {{{ 38 38 39 39 switch(nargin), … … 70 70 end 71 71 %}}} 72 function binary=VerboseToBinary(verbose) % {{{ 172 function binary=VerboseToBinary(verbose) % {{{ 73 73 74 74 %BEGINVERB2BIN … … 85 85 end 86 86 %}}} 87 function verbose=BinaryToVerbose(verbose,binary) % {{{ 187 function verbose=BinaryToVerbose(verbose,binary) % {{{ 88 88 89 89 %BEGINBIN2VERB … … 99 99 end 100 100 %}}} 101 function checkconsistency(obj,md,solution,analyses) % {{{101 function md = checkconsistency(obj,md,solution,analyses) % {{{ 102 102 103 103 end % }}} 104 function disp(verbose) % {{{ 1104 function disp(verbose) % {{{ 105 105 106 106 %BEGINDISP -
issm/trunk/src/m/enum/MaximumNumberOfEnums.m
r12329 r12706 9 9 % macro=MaximumNumberOfEnums() 10 10 11 macro=44 0;11 macro=448; -
issm/trunk/src/m/model/SectionValues.m
r11995 r12706 12 12 if ischar(infile), 13 13 %read infile: 14 contempt=expread(infile);15 nods= contempt.nods;16 x= contempt.x;17 y= contempt.y;14 profile=expread(infile); 15 nods=profile.nods; 16 x=profile.x; 17 y=profile.y; 18 18 else 19 19 %read infile: -
issm/trunk/src/m/model/WriteData.m
r10981 r12706 35 35 %Step 2: write the data itself. 36 36 if strcmpi(format,'Boolean'),% {{{ 37 if(numel(data)~=1), error(['field ' field' cannot be marshalled as it has more than one element!']); end37 if(numel(data)~=1), error(['field ' EnumToString(enum) ' cannot be marshalled as it has more than one element!']); end 38 38 39 39 %first write length of record … … 59 59 % }}} 60 60 elseif strcmpi(format,'Double'), % {{{ 61 if(numel(data)~=1), error(['field ' field' cannot be marshalled as it has more than one element!']); end61 if(numel(data)~=1), error(['field ' EnumToString(enum) ' cannot be marshalled as it has more than one element!']); end 62 62 63 63 %first write length of record … … 233 233 enum=eval([string 'Enum();']); 234 234 end % }}} 235 function code=FormatToCode(format) % {{{ 1235 function code=FormatToCode(format) % {{{ 236 236 %This routine takes the format string, and hardcodes it into an integer, which 237 237 %is passed along the record, in order to identify the nature of the dataset being -
issm/trunk/src/m/model/averaging.m
r9734 r12706 1 function average=averaging(md,data,iterations )1 function average=averaging(md,data,iterations,varargin) 2 2 %AVERAGING - smooths the input over the mesh 3 3 % … … 8 8 % by taking the average of the element around a node weighted by the 9 9 % elements volume 10 % For 3d mesh, a last argument can be added to specify the layer to be averaged on. 10 11 % 11 12 % Usage: 12 13 % smoothdata=averaging(md,data,iterations) 14 % smoothdata=averaging(md,data,iterations,layer) 13 15 % 14 16 % Examples: 15 17 % velsmoothed=averaging(md,md.initialization.vel,4); 16 18 % pressure=averaging(md,md.initialization.pressure,0); 19 % temperature=averaging(md,md.initialization.temperature,1,1); 17 20 18 if length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices 21 if ((nargin~=4) & (nargin~=3)), 22 error('averaging error message'); 23 end 24 if (length(data)~=md.mesh.numberofelements & length(data)~=md.mesh.numberofvertices), 19 25 error('averaging error message: data not supported yet'); 26 end 27 if md.mesh.dimension==3 & nargin==4, 28 if varargin{1}<=0 | varargin{1}>md.mesh.numberoflayers, 29 error('layer should be between 1 and md.mesh.numberoflayers'); 30 end 31 layer=varargin{1}; 32 else 33 layer=0; 20 34 end 21 35 22 36 %initialization 23 weights=zeros(md.mesh.numberofvertices,1); 24 data=data(:); 37 if layer==0, 38 weights=zeros(md.mesh.numberofvertices,1); 39 data=data(:); 40 else 41 weights=zeros(md.mesh.numberofvertices2d,1); 42 data=data((layer-1)*md.mesh.numberofvertices2d+1:layer*md.mesh.numberofvertices2d,:); 43 end 25 44 26 %load some variables (it is much faster if the variab;es are loaded from md once for all) 27 index=md.mesh.elements; 28 numberofnodes=md.mesh.numberofvertices; 29 numberofelements=md.mesh.numberofelements; 45 %load some variables (it is much faster if the variabes are loaded from md once for all) 46 if layer==0, 47 index=md.mesh.elements; 48 numberofnodes=md.mesh.numberofvertices; 49 numberofelements=md.mesh.numberofelements; 50 else 51 index=md.mesh.elements2d; 52 numberofnodes=md.mesh.numberofvertices2d; 53 numberofelements=md.mesh.numberofelements2d; 54 end 30 55 31 56 %build some variables 32 57 line=index(:); 33 if md.mesh.dimension==3 58 if md.mesh.dimension==3 & layer==0, 34 59 rep=6; 35 60 areas=GetAreas(index,md.mesh.x,md.mesh.y,md.mesh.z); 61 elseif md.mesh.dimension==2, 62 rep=3; 63 areas=GetAreas(index,md.mesh.x,md.mesh.y); 36 64 else 37 65 rep=3; 38 areas=GetAreas(index,md.mesh.x ,md.mesh.y);66 areas=GetAreas(index,md.mesh.x2d,md.mesh.y2d); 39 67 end 40 68 summation=1/rep*ones(rep,1); -
issm/trunk/src/m/model/collapse.m
r12329 r12706 42 42 if ~isnan(md.initialization.vz),md.initialization.vz=DepthAverage(md,md.initialization.vz);end; 43 43 if ~isnan(md.initialization.vel),md.initialization.vel=DepthAverage(md,md.initialization.vel);end; 44 if ~isnan(md.initialization.temperature),md.initialization.temperature=DepthAverage(md,md.initialization.temperature);end; 44 45 45 46 %bedinfo and surface info … … 91 92 md.geometry.thickness=project2d(md,md.geometry.thickness,1); 92 93 md.geometry.bed=project2d(md,md.geometry.bed,1); 94 md.geometry.bathymetry=project2d(md,md.geometry.bathymetry,1); 93 95 md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1); 94 96 md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1); -
issm/trunk/src/m/model/contourenvelope.m
r9734 r12706 35 35 %Now, build the connectivity tables for this mesh. 36 36 %Computing connectivity 37 if size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices,37 if (size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices & size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices2d), 38 38 md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices); 39 39 end 40 if size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements,40 if (size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements & size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements2d), 41 41 md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity); 42 42 end … … 44 44 %get nodes inside profile 45 45 mesh.elementconnectivity=md.mesh.elementconnectivity; 46 if md.mesh.dimension==2; 47 mesh.elements=md.mesh.elements; 48 mesh.x=md.mesh.x; 49 mesh.y=md.mesh.y; 50 mesh.numberofvertices=md.mesh.numberofvertices; 51 mesh.numberofelements=md.mesh.numberofelements; 52 else 53 mesh.elements=md.mesh.elements2d; 54 mesh.x=md.mesh.x2d; 55 mesh.y=md.mesh.y2d; 56 mesh.numberofvertices=md.mesh.numberofvertices2d; 57 mesh.numberofelements=md.mesh.numberofelements2d; 58 end 59 46 60 if nargin==2, 61 47 62 if isfile, 48 63 %get flag list of elements and nodes inside the contour 49 nodein=ContourToMesh(m d.mesh.elements,md.mesh.x,md.mesh.y,file,'node',1);50 elemin=(sum(nodein(m d.mesh.elements),2)==size(md.mesh.elements,2));64 nodein=ContourToMesh(mesh.elements,mesh.x,mesh.y,file,'node',1); 65 elemin=(sum(nodein(mesh.elements),2)==size(mesh.elements,2)); 51 66 %modify element connectivity 52 67 elemout=find(~elemin); … … 55 70 else 56 71 %get flag list of elements and nodes inside the contour 57 nodein=zeros(m d.mesh.numberofvertices,1);58 elemin=zeros(m d.mesh.numberofelements,1);72 nodein=zeros(mesh.numberofvertices,1); 73 elemin=zeros(mesh.numberofelements,1); 59 74 60 75 pos=find(flags); 61 76 elemin(pos)=1; 62 nodein(m d.mesh.elements(pos,:))=1;77 nodein(mesh.elements(pos,:))=1; 63 78 64 79 %modify element connectivity … … 87 102 els2=mesh.elementconnectivity(el1,find(mesh.elementconnectivity(el1,:))); 88 103 if length(els2)>1, 89 flag=intersect(m d.mesh.elements(els2(1),:),md.mesh.elements(els2(2),:));90 nods1=m d.mesh.elements(el1,:);104 flag=intersect(mesh.elements(els2(1),:),mesh.elements(els2(2),:)); 105 nods1=mesh.elements(el1,:); 91 106 nods1(find(nods1==flag))=[]; 92 107 segments(count,:)=[nods1 el1]; 93 108 94 ord1=find(nods1(1)==m d.mesh.elements(el1,:));95 ord2=find(nods1(2)==m d.mesh.elements(el1,:));109 ord1=find(nods1(1)==mesh.elements(el1,:)); 110 ord2=find(nods1(2)==mesh.elements(el1,:)); 96 111 97 112 %swap segment nodes if necessary … … 104 119 count=count+1; 105 120 else 106 nods1=m d.mesh.elements(el1,:);107 flag=setdiff(nods1,m d.mesh.elements(els2,:));121 nods1=mesh.elements(el1,:); 122 flag=setdiff(nods1,mesh.elements(els2,:)); 108 123 for j=1:3, 109 124 nods=nods1; nods(j)=[]; 110 125 if any(ismember(flag,nods)), 111 126 segments(count,:)=[nods el1]; 112 ord1=find(nods(1)==m d.mesh.elements(el1,:));113 ord2=find(nods(2)==m d.mesh.elements(el1,:));127 ord1=find(nods(1)==mesh.elements(el1,:)); 128 ord2=find(nods(2)==mesh.elements(el1,:)); 114 129 if ( (ord1==1 & ord2==2) | (ord1==2 & ord2==3) | (ord1==3 & ord2==1) ), 115 130 temp=segments(count,1); -
issm/trunk/src/m/model/ismodelselfconsistent.m
r11237 r12706 6 6 7 7 %initialize consistency as true 8 m odelconsistency(true);8 md.private.isconsistent=true; 9 9 10 10 %Get solution and associated analyses … … 24 24 %Check that current field is an object 25 25 if ~isobject(md.(field)) 26 checkmessage(['field ''' char(field) ''' is not an object']);26 md=checkmessage(md,['field ''' char(field) ''' is not an object']); 27 27 end 28 28 29 29 %Check consistency of the object 30 30 if verLessThan('matlab', '7.6') 31 checkconsistency(md.(field),md,solution,analyses);31 md=checkconsistency(md.(field),md,solution,analyses); 32 32 else 33 md .(field).checkconsistency(md,solution,analyses);33 md=md.(field).checkconsistency(md,solution,analyses); 34 34 end 35 35 end 36 36 37 37 %error message if mode is not consistent 38 if m odelconsistency==false,39 error(' ');38 if md.private.isconsistent==false, 39 error('Model not consistent, see messages above'); 40 40 end -
issm/trunk/src/m/model/loadresultsfromcluster.m
r11527 r12706 13 13 14 14 %Download outputs from the cluster 15 if verLessThan('matlab', '7.6'); 16 Download(cluster,md); 15 filelist={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']}; 16 if md.qmu.isdakota, 17 filelist{end+1}=[md.miscellaneous.name '.qmu.err']; 18 filelist{end+1}=[md.miscellaneous.name '.qmu.out']; 19 if isfield(md.qmu.params,'tabular_graphics_data'), 20 if md.qmu.params.tabular_graphics_data==true, 21 filelist{end+1}='dakota_tabular.dat'; 22 end 23 end 17 24 else 18 cluster.Download(md);25 filelist{end+1}=[md.miscellaneous.name '.outbin']; 19 26 end 27 Download(cluster,md.private.runtimename,filelist); 20 28 21 29 %If we are here, no errors in the solution sequence, call loadresultsfromdisk. -
issm/trunk/src/m/model/loadresultsfromdisk.m
r11527 r12706 59 59 md=postqmu(md); 60 60 cd .. 61 62 61 end -
issm/trunk/src/m/model/marshall.m
r12329 r12706 31 31 %Check that current field is an object 32 32 if ~isobject(md.(field)) 33 checkmessage(['field ''' char(field) ''' is not an object']);33 error(['field ''' char(field) ''' is not an object']); 34 34 end 35 35 -
issm/trunk/src/m/model/mesh/bamg.m
r11995 r12706 58 58 bamg_mesh=bamgmesh; 59 59 60 % Bamg Geometry parameters {{{ 160 % Bamg Geometry parameters {{{ 61 61 if exist(options,'domain'), 62 62 … … 259 259 end 260 260 %}}} 261 % Bamg Mesh parameters {{{ 1261 % Bamg Mesh parameters {{{ 262 262 if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & md.mesh.dimension==2), 263 263 … … 274 274 end 275 275 %}}} 276 % Bamg Options {{{ 1276 % Bamg Options {{{ 277 277 bamg_options.Crack=getfieldvalue(options,'Crack',0); 278 278 bamg_options.anisomax=getfieldvalue(options,'anisomax',10^30); -
issm/trunk/src/m/model/modelextract.m
r11237 r12706 166 166 if size(md2.mesh.edges,2)>1, %do not use ~isnan because there are some NaNs... 167 167 %renumber first two columns 168 pos=find( ~isnan(md2.mesh.edges(:,4)));168 pos=find(md2.mesh.edges(:,4)~=-1); 169 169 md2.mesh.edges(: ,1)=Pnode(md2.mesh.edges(:,1)); 170 170 md2.mesh.edges(: ,2)=Pnode(md2.mesh.edges(:,2)); … … 173 173 %remove edges when the 2 vertices are not in the domain. 174 174 md2.mesh.edges=md2.mesh.edges(find(md2.mesh.edges(:,1) & md2.mesh.edges(:,2)),:); 175 %Replace all zeros by NaNin the last two columns;175 %Replace all zeros by -1 in the last two columns; 176 176 pos=find(md2.mesh.edges(:,3)==0); 177 md2.mesh.edges(pos,3)= NaN;177 md2.mesh.edges(pos,3)=-1; 178 178 pos=find(md2.mesh.edges(:,4)==0); 179 md2.mesh.edges(pos,4)= NaN;180 %Invert NaN ofthe third column with last column (Also invert first two columns!!)181 pos=find( isnan(md2.mesh.edges(:,3)));179 md2.mesh.edges(pos,4)=-1; 180 %Invert -1 on the third column with last column (Also invert first two columns!!) 181 pos=find(md2.mesh.edges(:,3)==-1); 182 182 md2.mesh.edges(pos,3)=md2.mesh.edges(pos,4); 183 md2.mesh.edges(pos,4)= NaN;183 md2.mesh.edges(pos,4)=-1; 184 184 values=md2.mesh.edges(pos,2); 185 185 md2.mesh.edges(pos,2)=md2.mesh.edges(pos,1); 186 186 md2.mesh.edges(pos,1)=values; 187 187 %Finally remove edges that do not belong to any element 188 pos=find( isnan(md2.mesh.edges(:,3)) & isnan(md2.mesh.edges(:,4)));188 pos=find(md2.mesh.edges(:,3)==-1 & md2.mesh.edges(:,4)==-1); 189 189 md2.mesh.edges(pos,:)=[]; 190 190 end … … 210 210 md2.mesh.segments=contourenvelope(md2); 211 211 md2.mesh.vertexonboundary=zeros(numberofvertices2,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1; 212 else 213 %First do the connectivity for the contourenvelope in 2d 214 md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d); 215 md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity); 216 md2.mesh.segments=contourenvelope(md2); 217 md2.mesh.vertexonboundary=zeros(numberofvertices2/md2.mesh.numberoflayers,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1; 218 md2.mesh.vertexonboundary=repmat(md2.mesh.vertexonboundary,md2.mesh.numberoflayers,1); 219 %Then do it for 3d as usual 220 md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices); 221 md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity); 212 222 end 213 223 -
issm/trunk/src/m/model/plot/applyoptions.m
r12329 r12706 31 31 end 32 32 33 %xlabel 33 %xlabel, ylabel and zlabel 34 34 if exist(options,'xlabel'); 35 35 xlabel(getfieldvalue(options,'xlabel'),'FontSize',fontsize,'FontWeight',fontweight); 36 36 end 37 38 %ylabel39 37 if exist(options,'ylabel'); 40 38 ylabel(getfieldvalue(options,'ylabel'),'FontSize',fontsize,'FontWeight',fontweight); 41 39 end 42 43 %zlabel44 40 if exist(options,'zlabel'); 45 41 zlabel(getfieldvalue(options,'zlabel'),'FontSize',fontsize,'FontWeight',fontweight); 46 42 end 47 43 48 %xti kcs44 %xticks, yticks and zticks 49 45 if exist(options,'xtick'), set(gca,'XTick',getfieldvalue(options,'xtick')); end 50 46 if exist(options,'ytick'), set(gca,'YTick',getfieldvalue(options,'ytick')); end … … 75 71 end 76 72 77 %xlim 73 %xlim, ylim and zlim 78 74 if exist(options,'xlim'); 79 75 xlim(getfieldvalue(options,'xlim')); 80 76 end 81 82 %ylim83 77 if exist(options,'ylim'); 84 78 ylim(getfieldvalue(options,'ylim')); 79 end 80 if exist(options,'zlim'); 81 zlim(getfieldvalue(options,'zlim')); 85 82 end 86 83 … … 92 89 end 93 90 94 95 %zlim96 if exist(options,'zlim');97 zlim(getfieldvalue(options,'zlim'));98 end99 100 91 %Basinzoom 101 92 if exist(options,'basin'); … … 107 98 showbasins(options); 108 99 end 109 110 100 111 101 %Caxis … … 127 117 128 118 %colormap 129 if exist(options,'colormap'), 130 cname=getfieldvalue(options,'colormap'); 131 if strcmpi(cname,'Ala'), 132 c = jet(64); 133 c = c (32:end,:); 134 elseif strcmpi(cname,'redblue'), 135 %m = 30; 136 %n = fix(0.5*m); 137 %r = [(0:1:n-1)/n,ones(1,n)]; 138 %g = [(0:n-1)/n, (n-1:-1:0)/n]; 139 %b = [ones(1,n),(n-1:-1:0)/n]; 140 %c = [r(:), g(:), b(:)]; 141 142 c = hsv(64); 143 c = rgb2hsv(c); 144 c(:,2) = max(min( abs(c(:,1)-0.5)/0.5 ,1),0); 145 c(1:32,1) = 0.7; 146 c(33:end,1) = 1; 147 c = hsv2rgb(c); 148 149 elseif strcmpi(cname,'Rignot'), 150 c = hsv; 151 152 %adjust saturation 153 c = rgb2hsv(c); 154 alpha=getfieldvalue(options,'alpha',1); 155 c(:,2) = max(min( (0.1+c(:,1)).^(1/alpha) ,1),0); 156 c = hsv2rgb(c); 157 158 elseif strcmpi(cname,'Rignot2'), 159 c = hsv; 160 161 %adjust saturation 162 c = rgb2hsv(c); 163 alpha=getfieldvalue(options,'alpha',1); 164 c(:,2) = max(min( (0.1+c(:,1)).^(1/alpha) ,1),0); 165 c = hsv2rgb(c); 166 167 c=flipud(c); 168 169 else 170 c = cname; 171 end 172 h=colormap(c); 173 else 174 h=colormap(jet(60)); 175 end 119 c = getcolormap(options); 120 h = colormap(c); 176 121 177 122 %wrapping … … 375 320 left=screen(1); bott=screen(2); widt=screen(3); heig=screen(4)-25; 376 321 set(gcf,'Position',fix([left bott widt/2 heig])); 322 elseif strcmpi(figposition,'square'), 323 screen=get(0,'ScreenSize'); 324 left=screen(1); bott=screen(2); widt=min(screen(3)-25,screen(4)-25); 325 set(gcf,'Position',fix([left+(screen(3)-widt) bott widt widt])); 377 326 elseif strcmpi(figposition,'portrait'), 378 327 %reformat with letter paper size (8.5" x 11") -
issm/trunk/src/m/model/plot/plot_gridded.m
r12329 r12706 6 6 % 7 7 % See also: PLOTMODEL 8 9 whitepos=getfieldvalue(options,'whitepos',2); %1: up, 2: down, else: none10 8 11 9 %process mesh and data … … 29 27 end 30 28 29 %Get and change colormap 30 map = getcolormap(options); 31 lenmap = size(map,1); 32 map = [1 1 1; map]; 33 options=changefieldvalue(options,'colormap',map); 34 31 35 %Process data_grid: add white in NaN and correct caxis accordingly 32 36 if exist(options,'caxis'), … … 40 44 data_max=max(data_grid(:)); 41 45 end 42 options=changefieldvalue(options,'cbYLim',[data_min data_max]); 43 if whitepos==1, 44 white =data_max + (data_max-data_min)/55; 45 options=changefieldvalue(options,'caxis',[data_min white]); 46 data_grid(isnan(data_grid))=white; 47 elseif whitepos==2, 48 white =data_min - (data_max-data_min)/55; 49 options=changefieldvalue(options,'caxis',[white data_max]); 50 data_grid(isnan(data_grid))=white; 51 end 46 options = changefieldvalue(options,'cbYLim',[data_min data_max]); 47 white = data_min - (data_max-data_min)/(lenmap); 48 options = changefieldvalue(options,'caxis',[white data_max]); 49 data_grid(isnan(data_grid))=white; 52 50 53 51 %Select plot area … … 56 54 %shading interp; 57 55 h=imagesc(xlim,ylim,data_grid);set(gca,'YDir','normal'); 58 map=getfieldvalue(options,'colormap',jet);59 if whitepos==1,60 map(end,:)=[1 1 1];61 elseif whitepos==2,62 map(1,:)=[1 1 1];63 end64 options=changefieldvalue(options,'colormap',map);65 56 66 57 %last step: mesh gridded? -
issm/trunk/src/m/model/plot/plot_manager.m
r11527 r12706 165 165 if exist(options,'sectionvalue') 166 166 plot_section(md,data,options,nlines,ncols,i); 167 return; 168 end 169 170 %Figure out if this is a Profile plot 171 if exist(options,'profile') 172 plot_profile(md,data,options,nlines,ncols,i); 167 173 return; 168 174 end -
issm/trunk/src/m/model/plot/plot_overlay.m
r12329 r12706 41 41 md=radarpower(md,options); 42 42 end 43 contrast = getfieldvalue(options,'contrast',1); 44 radar = (md.radaroverlay.pwr).^(contrast); 45 radar = radar./max(radar(:)); 46 %radar(find(radar==0))=1; %Change background from black to white 43 47 44 48 %InterpFromMeshToGrid … … 50 54 ncols =length(md.radaroverlay.x); 51 55 disp('Interpolating data on grid...'); 52 [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x/getfieldvalue(options,'unit',1),y/getfieldvalue(options,'unit',1),... 53 data,xmin,ymax,xspacing,yspacing,nlines,ncols,NaN); 56 if radaronly, 57 x_m=xmin:xspacing:xmin+ncols*xspacing; 58 y_m=ymax-nlines*yspacing:yspacing:ymax; 59 data_grid=NaN*ones(nlines,ncols); 60 else 61 [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x/getfieldvalue(options,'unit',1),y/getfieldvalue(options,'unit',1),... 62 data,xmin,ymax,xspacing,yspacing,nlines,ncols,NaN); 63 end 54 64 55 %Process data_grid 65 %Process data_grid (For processing, it is better not to have nan) 56 66 pos=find(isinf(data_grid)); 57 67 if ~isempty(pos), … … 70 80 end 71 81 data_nan=find(isnan(data_grid)); 72 73 %Generate HSV image74 contrast=getfieldvalue(options,'contrast',1);75 transparency=getfieldvalue(options,'alpha',1);76 82 data_grid(data_nan)=data_min; 77 83 84 %Special colormaps that require hsv treatment 78 85 colorm=getfieldvalue(options,'colormap','Rignot'); 79 if strcmpi(colorm,'Rignot'), 80 %hue (H) 81 h_data=(data_grid-data_min)/(data_max-data_min+eps); 82 if radaronly, h_data(:)=0; end 83 %saturation (S) 84 s_data=max(min((0.1+h_data).^(1/transparency),1),0); 85 elseif strcmpi(colorm,'Seroussi'), 86 %hue (H) 87 h_data=1-(data_grid-data_min)/(data_max-data_min+eps)*0.7; 88 %h_data=(data_grid-data_min)/(data_max-data_min)*2/3; 89 if radaronly, h_data(:)=0; end 90 %saturation (S) 91 s_data=max(min((0.1+h_data).^(1/transparency),1),0); 92 elseif strcmpi(colorm,'redblue') 93 data_mean=data_min+(data_max-data_min)/2; 94 %hue (H) 95 %h_data=0.7*ones(size(data_grid)); 96 %h_data(find(data_grid>data_mean))=1; 97 h_data=1*ones(size(data_grid)); 98 h_data(find(data_grid<data_mean))=0.7; 99 %saturation (S) 100 s_data=max(min(abs(data_grid-data_mean)/(data_max-data_mean) ,1),0); 86 if strcmpi(colorm,'Rignot') | strcmpi(colorm,'Seroussi') | strcmpi(colorm,'redblue') 87 if strcmpi(colorm,'Rignot'), 88 transparency=getfieldvalue(options,'alpha',1); 89 h=(data_grid-data_min)/(data_max-data_min+eps); 90 if radaronly, h(:)=0; end 91 s=max(min((0.1+h).^(1/transparency),1),0); 92 elseif strcmpi(colorm,'Seroussi'), 93 transparency=getfieldvalue(options,'alpha',1); 94 h=1-(data_grid-data_min)/(data_max-data_min+eps)*0.7; 95 if radaronly, h(:)=0; end 96 s=max(min((0.1+h).^(1/transparency),1),0); 97 elseif strcmpi(colorm,'redblue') 98 data_mean=data_min+(data_max-data_min)/2; 99 h=1*ones(size(data_grid)); 100 h(find(data_grid<data_mean))=0.7; 101 s=max(min(abs(data_grid-data_mean)/(data_max-data_mean) ,1),0); 102 else 103 error('colormap not supported yet. (''Rignot'' and ''redblue'' are the only cupported colormaps)'); 104 end 105 %(S) Saturation is 0 in NaNs 106 s(data_nan)=0; 107 %(V) intensity is based on radar image 108 v=radar; %use radar power as intensity 109 110 %Transform HSV to RGB 111 image_hsv=zeros(size(data_grid,1),size(data_grid,2),3); 112 image_hsv(:,:,1)=h; clear h; 113 image_hsv(:,:,2)=s; clear s; 114 image_hsv(:,:,3)=v; clear v; 115 image_rgb=hsv2rgb(image_hsv); 101 116 else 102 error('colormap not supported yet. (''Rignot'' and ''redblue'' are the only cupported colormaps)'); 117 colorm = getcolormap(options); 118 len = size(colorm,1); 119 120 ind = ceil((len-1)*(data_grid-data_min)/(data_max - data_min + eps) +1); 121 ind(find(ind>len))=len; 122 image_rgb=zeros(size(data_grid,1),size(data_grid,2),3); 123 r=colorm(:,1); image_rgb(:,:,1)=r(ind); clear r; 124 g=colorm(:,2); image_rgb(:,:,2)=g(ind); clear g; 125 b=colorm(:,3); image_rgb(:,:,3)=b(ind); clear b; 126 127 %Now add radarmap 128 r = image_rgb(:,:,1).*radar; r(data_nan) = radar(data_nan); image_rgb(:,:,1) = r; clear r; 129 g = image_rgb(:,:,2).*radar; g(data_nan) = radar(data_nan); image_rgb(:,:,2) = g; clear g; 130 b = image_rgb(:,:,3).*radar; b(data_nan) = radar(data_nan); image_rgb(:,:,3) = b; clear b; 103 131 end 104 105 %Saturation is 0 in NaNs106 s_data(data_nan)=0;107 %intensity (V)108 radar=(md.radaroverlay.pwr).^(contrast);109 v_data=radar/max(radar(:)); %use radar power as intensity110 111 %Change background from black to white112 %pos=find(v_data==0);v_data(pos)=1;113 114 %Transform HSV to RGB115 image_hsv=zeros(size(data_grid,1),size(data_grid,2),3);116 image_hsv(:,:,1)=h_data;117 image_hsv(:,:,2)=s_data;118 image_hsv(:,:,3)=v_data;119 image_rgb=hsv2rgb(image_hsv);120 132 121 133 %Select plot area … … 134 146 135 147 %Apply options, without colorbar and without grid 136 options=changefieldvalue(options,'colormap',colorm); %We used an HSV colorbar148 options=changefieldvalue(options,'colormap',colorm); % We used an HSV colorbar 137 149 if ~isnan(data_min), 138 options=changefieldvalue(options,'caxis',[data_min data_max]); % force caxis so that the colorbar is ready150 options=changefieldvalue(options,'caxis',[data_min data_max]); % force caxis so that the colorbar is ready 139 151 end 140 options=addfielddefault(options,'axis','equal off'); %default axis152 options=addfielddefault(options,'axis','equal off'); % default axis 141 153 applyoptions(md,data,options); 142 154 drawnow -
issm/trunk/src/m/model/plot/plotdoc.m
r12329 r12706 94 94 disp(' ''showsection'': show section used by ''sectionvalue'' (string ''on'' or a number of labels)'); 95 95 disp(' ''sectionvalue'': give the value of data on a profile given by an Argus file (string ''Argusfile_name.exp'')'); 96 disp(' ''profile'': give the value of data along a vertical profile ([xlocation ylocation])'); 96 97 disp(' ''smooth'': smooth element data (string ''yes'' or integer)'); 97 98 disp(' ''title'': same as standard matlab option'); -
issm/trunk/src/m/model/plot/plotmodel.m
r11995 r12706 48 48 for i=1:numberofplots, 49 49 plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i); 50 %cbfreeze;51 50 end 52 51 catch me, -
issm/trunk/src/m/model/plot/subplotmodel.m
r12329 r12706 14 14 hmargin = getfieldvalue(options,'hmargin',[.01 .01]); 15 15 vmargin = getfieldvalue(options,'vmargin',[.01 .01]); 16 17 16 18 17 height = (1-sum(vmargin)-(nlines-1)*gap(1))/nlines; -
issm/trunk/src/m/model/radarpower.m
r12329 r12706 37 37 error(['radarpower error message: file ' jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpg not found.']); 38 38 end 39 jpgim=[jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpg']; 40 geom=load([jplsvn() '/projects/ModelData/MOG/mog150_greenland_map.jpgw'],'ascii'); 39 name = 'mog150_greenland_map'; 40 %name = 'mog100_hp1_v10'; 41 %name = 'mog500_hp1_v10'; 42 jpgim=[jplsvn() '/projects/ModelData/MOG/' name '.jpg']; 43 geom=load([jplsvn() '/projects/ModelData/MOG/' name '.jpgw'],'ascii'); 41 44 42 45 %geom: xposting nbcols nbrows yposting xmin ymax 43 46 xmin=max(geom(5),x0); 44 47 xmax=min(geom(5)+geom(1)*geom(2),x1); 45 ymin=max(geom(6)-geom( 4)*geom(3),y0);48 ymin=max(geom(6)-geom(3)*geom(4),y0); 46 49 ymax=min(geom(6),y1); 47 50 … … 106 109 toplefty=floor((overlay_ylim(2)-y1)/overlay_yposting); % y max 107 110 108 109 111 %Read and crop file 110 112 disp('Warning: expecting coordinates in polar stereographic (Std Latitude: 70ºN Meridian: 45º)'); -
issm/trunk/src/m/model/regionaltransient2d.m
r10587 r12706 106 106 thickness=PatchToVec(md1.results.TransientSolution(t).Thickness); 107 107 spcx=[spcx InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vx,md2.mesh.x,md2.mesh.y)]; 108 spcy=[spcy InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,v x,md2.mesh.x,md2.mesh.y)];108 spcy=[spcy InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,vy,md2.mesh.x,md2.mesh.y)]; 109 109 spct=[spct InterpFromMeshToMesh2d(md1.mesh.elements,md1.mesh.x,md1.mesh.y,thickness,md2.mesh.x,md2.mesh.y)]; 110 110 steps=[steps t*md1.timestepping.time_step]; -
issm/trunk/src/m/model/setmask.m
r11035 r12706 25 25 elements=md.mesh.elements; 26 26 27 %Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 127 %Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 28 28 elementonfloatingice=FlagElements(md,floatingicename); 29 29 elementongroundedice=FlagElements(md,groundedicename); -
issm/trunk/src/m/model/setmask.py
r12329 r12706 22 22 elements = md.mesh.elements 23 23 24 #Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 124 #Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{ 25 25 elementonfloatingice = fe.FlagElements(md, floatingicename) 26 26 elementongroundedice = fe.FlagElements(md, groundedicename) -
issm/trunk/src/m/model/solve.m
r10981 r12706 24 24 % md=solve(md,DiagnosticSolutionEnum); 25 25 26 %recover options26 %recover and process solve options 27 27 options=pairoptions(varargin{:},'solution_type',solutionenum); 28 29 %add default options30 28 options=process_solve_options(options); 31 29 32 30 %recover some fields 33 31 md.private.solution=options.solution_type; 32 cluster=md.cluster; 34 33 35 34 %check model consistency 36 35 disp('checking model consistency'); 37 36 if (solutionenum == FlaimSolutionEnum) 38 m odelconsistency(true);39 md .mesh.checkconsistency(md,solutionenum);40 md .flaim.checkconsistency(md,solutionenum);41 if ~modelconsistency()42 error(' ');37 md.private.isconsistent=true; 38 md=checkconsistency(md.mesh,md,solutionenum); 39 md=checkconsistency(md.flaim,md,solutionenum); 40 if md.private.isconsistent==false, 41 error('Model not consistent, see messages above'); 43 42 end 44 43 else … … 46 45 end 47 46 48 %if running qmu analysis, some preprocessing of dakota files using 49 %models fields needs to be carried out. 47 %First, build a runtime name that is unique 48 c=clock; 49 md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid')); 50 51 %if running qmu analysis, some preprocessing of dakota files using models 52 %fields needs to be carried out. 50 53 if md.qmu.isdakota, 51 54 md=preqmu(md,options); 52 55 end 53 56 54 %Save model as is (in case of a crash)55 assignin('base',inputname(1),md);56 57 57 %flaim analysis 58 if ( md.private.solution== FlaimSolutionEnum)58 if (options.solution_type == FlaimSolutionEnum) 59 59 md=flaim_sol(md,options); 60 60 md.private.solution=EnumToString(options.solution_type); … … 62 62 end 63 63 64 %Marshall model data into a binary file. 65 marshall(md); 66 67 %write a template file for issm to use, in parallel 68 PetscFile(md.solver,[md.miscellaneous.name '.petsc']); 69 70 %If running in parallel, we have a different way of launching the solution 71 %sequences. 72 if ~strcmpi(md.cluster.name,'none'), 73 md=solveparallel(md,options); 64 %Do we load results only? 65 if options.loadonly, 66 md=loadresultsfromcluster(md); 74 67 return; 75 68 end 76 69 77 %Launch correct solution sequence 78 md=issm(md,md.private.solution); 70 %Wite all input files 71 marshall(md); % bin file 72 PetscFile(md.solver,[md.miscellaneous.name '.petsc']); % petsc file 73 BuildQueueScript(cluster,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof); % queue file 74 75 %we need to make sure we have PETSC support, otherwise, we run with only one cpu: 76 if ~ispetsc, 77 disp('PETSC support not included, running on 1 cpu only!'); 78 cluster.np=1; 79 end 80 81 %Stop here if batch mode 82 if strcmpi(options.batch,'yes') 83 disp('batch mode requested: not launching job interactively'); 84 disp('launch solution sequence on remote cluster by hand'); 85 return; 86 end 87 88 %Launch job 89 modelname = md.miscellaneous.name; 90 filelist = {[modelname '.bin '] [modelname '.petsc '] [modelname '.queue ']}; 91 if md.qmu.isdakota, 92 filelist{end+1} = [modelname '.qmu.in']; 93 end 94 LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist); 95 96 %did we even try to run? if so, wait on lock 97 if strcmpi(options.upload,'on'), 98 disp('solve done uploading test decks'); 99 return; 100 end 101 102 %wait on lock 103 if md.settings.waitonlock>0, 104 %we wait for the done file 105 islock=waitonlock(md); 106 if islock==0, %no results to be loaded 107 disp('The results must be loaded manually with md=loadresultsfromcluster(md).'); 108 else %load results 109 disp('loading results from cluster'); 110 md=loadresultsfromcluster(md); 111 end 112 end 79 113 80 114 %post processes qmu results if necessary 81 115 if md.qmu.isdakota, 82 md=postqmu(md);83 cd ..84 116 if ~strncmpi(options.keep,'y',1) 85 117 system(['rm -rf qmu' num2str(feature('GetPid'))]); 86 118 end 87 119 end 88 89 %convert analysis type to string finally90 md.private.solution=EnumToString(options.solution_type); -
issm/trunk/src/m/model/solvers/stokesoptions.m
r11995 r12706 6 6 7 7 %retrieve options provided in varargin 8 arguments=pairoptions(varargin{:});8 options=pairoptions(varargin{:}); 9 9 stokes=struct(); 10 10 -
issm/trunk/src/m/qmu/preqmu.m
r9668 r12706 44 44 responses=expandresponses(md,responses); 45 45 46 %go through variables and responses, and check they don't have more than md.qmu.numberofpartitions values. Also determine numvariables and numresponses{{{ 146 %go through variables and responses, and check they don't have more than md.qmu.numberofpartitions values. Also determine numvariables and numresponses{{{ 47 47 numvariables=0; 48 48 variable_fieldnames=fieldnames(variables); … … 76 76 system(['rm -rf ' md.miscellaneous.name '.m']); 77 77 78 %build a list of variables and responses descriptors. the list is not expanded. {{{ 178 %build a list of variables and responses descriptors. the list is not expanded. {{{ 79 79 variabledescriptors={}; 80 80 variable_fieldnames=fieldnames(md.qmu.variables(options.ivar)); -
issm/trunk/src/m/utils/Basins/basinzoom.m
r8100 r12706 38 38 39 39 %Ok, find basin we are talking about: 40 load([ issmdir'/projects/ModelData/Names/Names.mat']);40 load([jplsvn() '/projects/ModelData/Names/Names.mat']); 41 41 42 42 %Go through names: -
issm/trunk/src/m/utils/Basins/isbasin.m
r7140 r12706 9 9 10 10 %First, load basin names: 11 load([ issmdir'/projects/ModelData/Names/Names.mat']);11 load([jplsvn '/projects/ModelData/Names/Names.mat']); 12 12 13 13 -
issm/trunk/src/m/utils/Basins/showbasins.m
r7245 r12706 45 45 46 46 %Ok, find basin we are talking about: 47 load([ issmdir'/projects/ModelData/Names/Names.mat']);47 load([jplsvn '/projects/ModelData/Names/Names.mat']); 48 48 49 49 %Get xlim and ylim, and convert into lat,long: -
issm/trunk/src/m/utils/Exp/expcoarsen.m
r1264 r12706 26 26 %Get exp oldfile 27 27 [path root ext ver]=fileparts(oldfile); 28 A=expread(oldfile ,1);28 A=expread(oldfile); 29 29 numprofiles=size(A,2); 30 30 -
issm/trunk/src/m/utils/Exp/expcontract.m
r8298 r12706 8 8 9 9 10 contour=expread(oldfile ,1);10 contour=expread(oldfile); 11 11 num=numel(contour.x); 12 12 -
issm/trunk/src/m/utils/Exp/expll2xy.m
r8367 r12706 27 27 28 28 %read filename: 29 domain=expread(filename ,1);29 domain=expread(filename); 30 30 31 31 %change to x,y: -
issm/trunk/src/m/utils/Exp/expxy2ll.m
r8367 r12706 27 27 28 28 %read filename: 29 domain=expread(filename ,1);29 domain=expread(filename); 30 30 31 31 %change to x,y: -
issm/trunk/src/m/utils/Exp/manipulation/cutarea.m
r8662 r12706 87 87 A(selection).x=x(1:p1); 88 88 A(selection).y=y(1:p1); 89 closed(selection)=0; 89 90 A(end+1).x=x(p2:end); 90 91 A(end).y=y(p2:end); 91 92 A(end).density=A(selection).density; 92 93 A(end).name=A(selection).name; 94 closed(end+1)=0; 93 95 numprofiles=numprofiles+1; 94 96 numpoints=numpoints-(p2-p1-1); … … 113 115 else 114 116 %cut in 2 profiles 117 closed(selection)=0; 115 118 A(selection).x=x(1:p2); 116 119 A(selection).y=y(1:p2); … … 119 122 A(end).density=A(selection).density; 120 123 A(end).name=A(selection).name; 124 closed(end+1)=0; 121 125 numprofiles=numprofiles+1; 122 126 numpoints=numpoints-(p1-p2-1); -
issm/trunk/src/m/utils/Geometry/find_point.m
r1 r12706 8 8 % f=find_point(tabx,taby,pointx,pointy) 9 9 10 %Compute distance between point and cloud of points 10 11 distance=sqrt((tabx-pointx).^2+(taby-pointy).^2); 11 f=find(distance==min(min(distance))); 12 13 %find index of the minimum distance and return the first one only 14 f=find(distance==min(min(distance)),1); -
issm/trunk/src/m/utils/Kml/exp2kml.m
r7148 r12706 8 8 9 9 %First, read exp file 10 domain=expread(input ,1);10 domain=expread(input); 11 11 12 12 -
issm/trunk/src/m/utils/Miscellaneous/issmdoc.m
r12329 r12706 9 9 disp(sprintf('%s',' md=model; %creates a new empty model structure')); 10 10 disp(sprintf('%s',' md=triangle(md,''DomainOutline.exp'',50000); %creates a mesh of the domain outline with a resolution of 50000m')); 11 disp(sprintf('%s',' md= geography(md,''all'',''''); %defines the glacier system as an ice shelf (no island)'));11 disp(sprintf('%s',' md=setmask(md,''all'',''''); %defines the glacier system as an ice shelf (no island)')); 12 12 disp(sprintf('%s',' md=parameterize(md,''Square.par''); %fills all the other fields of the model')); 13 disp(sprintf('%s',' md=set elementstype(md,''macayeal'',''all''); %defines all elements as MacAyeal''s'));13 disp(sprintf('%s',' md=setflowequation(md,''macayeal'',''all''); %defines all elements as MacAyeal''s')); 14 14 disp(sprintf('%s',' md=solve(md,DiagnosticSolutionEnum); %generate the velocity field')); 15 15 disp(sprintf('%s',' plotmodel(md,''data'',md.results.DiagnosticSolution.Vel); %displays the velocity (type plotdoc for plotmodel help)')); -
issm/trunk/src/m/utils/Model/loadmodel.m
r10184 r12706 12 12 error('loadmodel usage error: md=loadmodel(path)'); 13 13 end 14 14 15 %check existence 15 if ~exist(path) 16 if exist(path,'file') 17 %do nothing 18 elseif exist([path '.mat'],'file') 19 %add extension 20 path = [path '.mat']; 21 else 16 22 error(['loadmodel error message: file ' path ' does not exist']); 17 23 end -
issm/trunk/src/m/utils/Numerics/cfl_step.m
r11995 r12706 8 8 % 9 9 % Example: 10 % dt=cfl_step(md,md ,md.results.DiagnosticSolution.Vx,md.results.DiagnosticSolution.Vy)10 % dt=cfl_step(md,md.results.DiagnosticSolution.Vx,md.results.DiagnosticSolution.Vy) 11 11 12 12 %Check length of velocities -
issm/trunk/src/m/utils/consistency/checkfield.m
r11527 r12706 1 function checkfield(md,fieldname,varargin)1 function md = checkfield(md,fieldname,varargin) 2 2 %CHECKFIELD - check field consistency 3 3 % … … 19 19 % 20 20 % Usage: 21 % checkfield(md,fieldname,options);21 % md = checkfield(md,fieldname,options); 22 22 % 23 23 % Example: 24 % checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);25 % checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);26 % checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);24 % md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]); 25 % md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1); 26 % md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]); 27 27 28 28 %get options … … 35 35 if exist(options,'empty') 36 36 if isempty(field), 37 checkmessage(getfieldvalue(options,'message',...37 md = checkmessage(md,getfieldvalue(options,'message',... 38 38 ['field ''' fieldname ''' is empty'])); 39 39 end … … 45 45 if isnan(fieldsize(1)), 46 46 if (size(field,2)~=fieldsize(2)), 47 checkmessage(getfieldvalue(options,'message',...47 md = checkmessage(md,getfieldvalue(options,'message',... 48 48 ['field ''' fieldname ''' should have ' num2str(fieldsize(2)) ' columns'])); 49 49 end 50 50 elseif isnan(fieldsize(2)), 51 51 if (size(field,1)~=fieldsize(1)), 52 checkmessage(getfieldvalue(options,'message',...52 md = checkmessage(md,getfieldvalue(options,'message',... 53 53 ['field ''' fieldname ''' should have ' num2str(fieldsize(1)) ' lines'])); 54 54 end 55 55 else 56 56 if ((size(field)~=fieldsize(1)) | (size(field,2)~=fieldsize(2))) 57 checkmessage(getfieldvalue(options,'message',...57 md = checkmessage(md,getfieldvalue(options,'message',... 58 58 ['field ''' fieldname ''' size should be ' num2str(fieldsize(1)) ' x ' num2str(fieldsize(2))])); 59 59 end … … 66 66 if ~ismember(numel(field),fieldnumel), 67 67 if length(fieldnumel)==1 68 checkmessage(getfieldvalue(options,'message',...68 md = checkmessage(md,getfieldvalue(options,'message',... 69 69 ['field ''' fieldname ''' size should be ' sprintf('%g ',fieldnumel) ])); 70 70 elseif length(fieldnumel)==2 71 checkmessage(getfieldvalue(options,'message',...71 md = checkmessage(md,getfieldvalue(options,'message',... 72 72 ['field ''' fieldname ''' size should be ' num2str(fieldnumel(1)) ' or ' num2str(fieldnumel(2)) ])); 73 73 else 74 checkmessage(getfieldvalue(options,'message',...74 md = checkmessage(md,getfieldvalue(options,'message',... 75 75 ['field ''' fieldname ''' size should be ' sprintf('%g, ',fieldnumel(1:end-1)) ' or ' num2str(fieldnumel(end)) ])); 76 76 end … … 82 82 field2=reshape(field,prod(size(field)),1); 83 83 if any(isnan(field2)), 84 checkmessage(getfieldvalue(options,'message',...84 md = checkmessage(md,getfieldvalue(options,'message',... 85 85 ['NaN values found in field ''' fieldname ''''])); 86 86 end … … 90 90 if getfieldvalue(options,'cell',0); 91 91 if ~iscell(field), 92 checkmessage(getfieldvalue(options,'message',...92 md = checkmessage(md,getfieldvalue(options,'message',... 93 93 ['field ''' fieldname ''' should be a cell'])); 94 94 end … … 102 102 if any(~ismember(field,fieldvalues)), 103 103 if length(fieldvalues)==1 104 checkmessage(getfieldvalue(options,'message',...104 md = checkmessage(md,getfieldvalue(options,'message',... 105 105 ['field ''' fieldname ''' value should be ' fieldvalues{1} ])); 106 106 elseif length(fieldvalues)==2 107 checkmessage(getfieldvalue(options,'message',...107 md = checkmessage(md,getfieldvalue(options,'message',... 108 108 ['field ''' fieldname ''' values should be ' fieldvalues{1} ' or ' fieldvalues{2} ])); 109 109 else 110 checkmessage(getfieldvalue(options,'message',...110 md = checkmessage(md,getfieldvalue(options,'message',... 111 111 ['field ''' fieldname ''' should have values in ' sprintf('''%s'', ',fieldvalues{1:end-1}) 'or ''' fieldvalues{end} ''''])); 112 112 end 113 113 end 114 114 else 115 checkmessage(getfieldvalue(options,'message',...115 md = checkmessage(md,getfieldvalue(options,'message',... 116 116 ['field ''' fieldname ''' should be one of the following strings: ' sprintf('''%s'', ',fieldvalues{1:end-1}) 'or ''' fieldvalues{end} ''''])); 117 117 end … … 120 120 if isnumeric(field), 121 121 if any(~ismember(field2,fieldvalues)), 122 checkmessage(getfieldvalue(options,'message',...122 md = checkmessage(md,getfieldvalue(options,'message',... 123 123 ['field ''' fieldname ''' should have values in [' num2str(fieldvalues) ']'])); 124 124 end 125 125 else 126 checkmessage(getfieldvalue(options,'message',...126 md = checkmessage(md,getfieldvalue(options,'message',... 127 127 ['field ''' fieldname ''' should be a number in [' num2str(fieldvalues) ']'])); 128 128 end … … 135 135 field2=reshape(field,prod(size(field)),1); 136 136 if any(field2<lowerbound), 137 checkmessage(getfieldvalue(options,'message',...137 md = checkmessage(md,getfieldvalue(options,'message',... 138 138 ['field ''' fieldname ''' should have values above ' num2str(lowerbound)])); 139 139 end … … 143 143 field2=reshape(field,prod(size(field)),1); 144 144 if any(field2<=lowerbound), 145 checkmessage(getfieldvalue(options,'message',...145 md = checkmessage(md,getfieldvalue(options,'message',... 146 146 ['field ''' fieldname ''' should have values above ' num2str(lowerbound)])); 147 147 end … … 153 153 field2=reshape(field,prod(size(field)),1); 154 154 if any(field2>upperbound), 155 checkmessage(getfieldvalue(options,'message',...155 md = checkmessage(md,getfieldvalue(options,'message',... 156 156 ['field ''' fieldname ''' should have values below ' num2str(upperbound)])); 157 157 end … … 161 161 field2=reshape(field,prod(size(field)),1); 162 162 if any(field2>=upperbound), 163 checkmessage(getfieldvalue(options,'message',...163 md = checkmessage(md,getfieldvalue(options,'message',... 164 164 ['field ''' fieldname ''' should have values below ' num2str(upperbound(1))])); 165 165 end … … 169 169 if getfieldvalue(options,'file',0), 170 170 if ~exist(field,'file') 171 checkmessage(['file profided in ''' fieldname ''': ''' field ''' does not exist']);171 md = checkmessage(md,['file profided in ''' fieldname ''': ''' field ''' does not exist']); 172 172 end 173 173 end … … 177 177 if size(field,1)==md.mesh.numberofvertices, 178 178 if ~size(field,2)==1, 179 checkmessage(getfieldvalue(options,'message',...179 md = checkmessage(md,getfieldvalue(options,'message',... 180 180 ['field ''' fieldname ''' should have only one column as there are md.mesh.numberofvertices lines'])); 181 181 end 182 182 elseif size(field,1)==md.mesh.numberofvertices+1 183 183 if any(field(end,:)~=sort(field(end,:))), 184 checkmessage(getfieldvalue(options,'message',...185 ['field ''' fieldname ''' columns should be chronological']));184 md = checkmessage(md,getfieldvalue(options,'message',... 185 ['field ''' fieldname ''' columns should be sorted chronologically'])); 186 186 end 187 187 if any(field(end,1:end-1)==field(end,2:end)), 188 checkmessage(getfieldvalue(options,'message',...188 md = checkmessage(md,getfieldvalue(options,'message',... 189 189 ['field ''' fieldname ''' columns must not contain duplicate timesteps'])); 190 190 end 191 191 else 192 checkmessage(getfieldvalue(options,'message',...192 md = checkmessage(md,getfieldvalue(options,'message',... 193 193 ['field ''' fieldname ''' should have md.mesh.numberofvertices or md.mesh.numberofvertices+1 lines'])); 194 194 end -
issm/trunk/src/modules/AverageFilter/AverageFilter.cpp
r12331 r12706 53 53 void AverageFilterUsage(void) 54 54 { 55 printf(" AverageFilter usage:\n");56 printf(" [image_out]=AverageFilter(image_in,pixels);\n\n");57 printf(" where:\n");58 printf(" image_in in double format\n");59 printf(" pixels: characteristic size of smoothing\n");60 printf(" image_out in double format\n");61 printf("\n");55 _printLine_(" AverageFilter usage:"); 56 _printLine_(" [image_out]=AverageFilter(image_in,pixels);\n"); 57 _printLine_(" where:"); 58 _printLine_(" image_in in double format"); 59 _printLine_(" pixels: characteristic size of smoothing"); 60 _printLine_(" image_out in double format"); 61 _printLine_(""); 62 62 } -
issm/trunk/src/modules/BamgConvertMesh/BamgConvertMesh.cpp
r12331 r12706 4 4 #include "./BamgConvertMesh.h" 5 5 6 void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){6 void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){ 7 7 8 8 /*input: */ 9 double* index=NULL; 10 int index_rows; 11 double* x=NULL; 12 int x_cols; 13 double* y=NULL; 14 int y_rows; 15 int y_cols; 9 int *index = NULL; 10 double *x = NULL; 11 double *y = NULL; 12 int nods,nels,test1,test2; 16 13 17 14 /*Output*/ 18 BamgMesh* bamgmesh=NULL; 19 BamgGeom* bamggeom=NULL; 20 mxArray* bamgmesh_mat=NULL; 21 mxArray* bamggeom_mat=NULL; 22 23 /*Intermediary*/ 24 int nods; 25 int nels; 26 int verbose=0; 15 BamgMesh *bamgmesh = NULL; 16 BamgGeom *bamggeom = NULL; 17 mxArray *bamgmesh_mat = NULL; 18 mxArray *bamggeom_mat = NULL; 27 19 28 20 /*Boot module: */ … … 37 29 38 30 /*Input datasets: */ 39 if (verbose) printf("Fetching inputs\n"); 40 FetchData(&index,&nels,&index_rows,INDEXHANDLE); 41 FetchData(&x,&nods,&x_cols,XHANDLE); 42 FetchData(&y,&y_rows,&y_cols,YHANDLE); 31 FetchData(&index,&nels,&test1,INDEXHANDLE); 32 FetchData(&x,&nods,XHANDLE); 33 FetchData(&y,&test2,YHANDLE); 43 34 44 35 /*Check inputs*/ 45 if (nels<0){ 46 _error_("Number of elements must be positive, check index number of lines"); 47 } 48 if (nods<0){ 49 _error_("Number of nods must be positive, check x and y sizes"); 50 } 51 if (index_rows!=3){ 52 _error_("index should have 3 columns"); 53 } 54 if (y_rows!=nods){ 55 _error_("x and y do not have the same length"); 56 } 57 if (x_cols>1 || y_cols>1){ 58 _error_("x and y should have only one column"); 59 } 36 if(nels<0) _error2_("Number of elements must be positive, check index number of lines"); 37 if(nods<0) _error2_("Number of nods must be positive, check x and y sizes"); 38 if(test1!=3) _error2_("index should have 3 columns"); 39 if(test2!=nods) _error2_("x and y do not have the same length"); 60 40 61 41 /* Run core computations: */ 62 if (verbose) printf("Call core\n");63 42 BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels); 64 43 … … 75 54 } 76 55 77 void BamgConvertMeshUsage(void) 78 { 79 _printf_(true,"BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom"); 80 _printf_(true,"\n"); 81 _printf_(true," Usage:\n"); 82 _printf_(true," [bamggeom bamgmesh]=BamgConvertMesh(index,x,y);\n"); 83 _printf_(true," index: index of the mesh\n"); 84 _printf_(true," x,y: coordinates of the nodes\n"); 85 _printf_(true,"\n"); 56 void BamgConvertMeshUsage(void){ 57 _pprintString_("BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom"); 58 _pprintLine_(""); 59 _pprintLine_(" Usage:"); 60 _pprintLine_(" [bamggeom bamgmesh]=BamgConvertMesh(index,x,y);"); 61 _pprintLine_(" index: index of the mesh"); 62 _pprintLine_(" x,y: coordinates of the nodes"); 63 _pprintLine_(""); 86 64 } -
issm/trunk/src/modules/BamgMesher/BamgMesher.cpp
r12331 r12706 51 51 52 52 void BamgMesherUsage(void){ 53 _p rintf_(true,"\n");54 _p rintf_(true," usage: [bamgmesh,bamggeom]=%s(bamgmesh,bamggeom,bamgoptions);\n",__FUNCT__);55 _p rintf_(true,"\n");53 _pprintLine_(""); 54 _pprintLine_(" usage: [bamgmesh,bamggeom]=" << __FUNCT__ << "(bamgmesh,bamggeom,bamgoptions);"); 55 _pprintLine_(""); 56 56 } -
issm/trunk/src/modules/BamgTriangulate/BamgTriangulate.cpp
r12331 r12706 27 27 28 28 /*Input datasets: */ 29 if (verbose) printf("Fetching inputs\n");29 if (verbose) _printLine_("Fetching inputs"); 30 30 FetchData(&x,&nods,&x_cols,XHANDLE); 31 31 FetchData(&y,&y_rows,&y_cols,YHANDLE); 32 32 33 33 /*Check inputs*/ 34 if(y_rows!=nods) _error _("x and y do not have the same length");35 if(x_cols>1 || y_cols>1) _error _("x and y should have only one column");36 if(nods<3) _error _("At least 3 points are required");34 if(y_rows!=nods) _error2_("x and y do not have the same length"); 35 if(x_cols>1 || y_cols>1) _error2_("x and y should have only one column"); 36 if(nods<3) _error2_("At least 3 points are required"); 37 37 38 38 /* Run core computations: */ 39 if (verbose) printf("Call core\n");39 if (verbose) _printLine_("Call core"); 40 40 BamgTriangulatex(&index,&nels,x,y,nods); 41 41 … … 49 49 void BamgTriangulateUsage(void) 50 50 { 51 _p rintf_(true,"BAMGTRIANGULATE - Delaunay Triangulation of a list of points");52 _p rintf_(true,"\n");53 _p rintf_(true," Usage:\n");54 _p rintf_(true," index=BamgTriangulate(x,y);\n");55 _p rintf_(true," index: index of the triangulation\n");56 _p rintf_(true," x,y: coordinates of the nodes\n");57 _p rintf_(true,"\n");51 _pprintString_("BAMGTRIANGULATE - Delaunay Triangulation of a list of points"); 52 _pprintLine_(""); 53 _pprintLine_(" Usage:"); 54 _pprintLine_(" index=BamgTriangulate(x,y);"); 55 _pprintLine_(" index: index of the triangulation"); 56 _pprintLine_(" x,y: coordinates of the nodes"); 57 _pprintLine_(""); 58 58 } -
issm/trunk/src/modules/Chaco/Chaco.cpp
r12331 r12706 42 42 43 43 #ifndef _HAVE_CHACO_ //only works if dakota library has been compiled in. 44 _error _("Chaco not available! Cannot carry out Chaco partitioning!");44 _error2_("Chaco not available! Cannot carry out Chaco partitioning!"); 45 45 #endif 46 46 … … 82 82 /*Some debugging print: {{{*/ 83 83 #ifdef _DEBUG_ 84 printf("nvtxs: %i\n",nvtxs);85 printf("options: [");86 for(i=0;i<10;i++) printf("%g|",options[i]);87 printf("]\n");88 printf("start: \n");89 for (i=0; i<nvtxs+1;i++) printf("%i ",start[i]);90 printf("\n");91 printf("adjacency: \n");92 for (i=0; i<mxGetNzmax(A_IN);i++) printf("%i ",adjacency[i]);93 printf("\n");94 printf("nedges: %i %p\n",nedges,ewgts);95 if(ewgts) for (i = 0; i < nedges; i++) printf("%g ",ewgts[i]);96 printf("\n");97 printf("vwgts:\n");98 for (i = 0; i < nvtxs; i++) printf("%g ",vwgts[i]);99 printf("\n");100 printf("nparts: %i\n",nparts[0]);101 printf("goal: %p\n",goal);84 _printLine_("nvtxs: " << nvtxs); 85 _printString_("options: ["); 86 for(i=0;i<10;i++)_printString_(options[i] << "|"); 87 _printLine_("]"); 88 _printLine_("start: "); 89 for (i=0; i<nvtxs+1;i++)_printString_(start[i] << " "); 90 _printLine_(""); 91 _printLine_("adjacency: "); 92 for (i=0; i<mxGetNzmax(A_IN);i++)_printString_("" <<adjacency[i]<< " ");i++) 93 _printLine_(""); 94 _printLine_("nedges: " << nedges << " " << ewgts); 95 if(ewgts) for (i = 0; i < nedges; i++)_printString_(ewgts[i] << " "); 96 _printLine_(""); 97 _printLine_("vwgts:"); 98 for (i = 0; i < nvtxs; i++)_printString_(vwgts[i] << " "); 99 _printLine_(""); 100 _printLine_("nparts: " << nparts[0]); 101 _printLine_("goal: " << goal); 102 102 #endif 103 103 /*}}}*/ … … 132 132 133 133 void ChacoUsage(void){ 134 _p rintf_(true,"\n");135 _p rintf_(true,"Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);\n");136 _p rintf_(true,"\n");134 _pprintLine_(""); 135 _pprintLine_("Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);"); 136 _pprintLine_(""); 137 137 } -
issm/trunk/src/modules/ContourToMesh/ContourToMesh.cpp
r12331 r12706 47 47 if(nlhs!=1 && nlhs!=2){ 48 48 ContourToMeshUsage(); 49 _error _("usage. See above");49 _error2_("usage. See above"); 50 50 } 51 51 #endif … … 53 53 if(nrhs!=NRHS){ 54 54 ContourToMeshUsage(); 55 _error _("usage. See above");55 _error2_("usage. See above"); 56 56 } 57 57 … … 82 82 WriteData(PLHS1,in_elem); 83 83 } 84 else _error _("wrong interpolation type");84 else _error2_("wrong interpolation type"); 85 85 86 86 /*end module: */ … … 91 91 void ContourToMeshUsage(void)//{{{1 92 92 { 93 printf("CONTOURTOMESH - Flag the elements or nodes inside a contour\n");94 printf("\n");95 printf(" Usage: \n");96 printf(" [in_nod,in_elem]=ContourToMesh(index,x,y,contourname,interptype,edgevalue)\n\n");97 printf("\n");98 printf(" index,x,y: mesh triangulation.\n");99 printf(" contourname: name of .exp file containing the contours.\n");100 printf(" interptype: string definining type of interpolation ('element', or 'node').\n");101 printf(" edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n");102 printf(" in_nod: vector of flags (0 or 1), of size nods if interptype is set to 'node' or 'element and node', \n");103 printf(" or of size 0 otherwise.\n");104 printf(" in_elem: vector of flags (0 or 1), of size nel if interptype is set to 'element' or 'element and node', \n");105 printf(" or of size 0 otherwise.\n");106 printf("\n");107 printf(" Example: \n");108 printf(" in_nod=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','node',1)\n");109 printf(" in_elements=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element',0)\n");110 printf(" [in_nodes,in_elements]=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element and node',0)\n");111 printf("\n");93 _printLine_("CONTOURTOMESH - Flag the elements or nodes inside a contour"); 94 _printLine_(""); 95 _printLine_(" Usage: "); 96 _printLine_(" [in_nod,in_elem]=ContourToMesh(index,x,y,contourname,interptype,edgevalue)\n"); 97 _printLine_(""); 98 _printLine_(" index,x,y: mesh triangulation."); 99 _printLine_(" contourname: name of .exp file containing the contours."); 100 _printLine_(" interptype: string definining type of interpolation ('element', or 'node')."); 101 _printLine_(" edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons."); 102 _printLine_(" in_nod: vector of flags (0 or 1), of size nods if interptype is set to 'node' or 'element and node', "); 103 _printLine_(" or of size 0 otherwise."); 104 _printLine_(" in_elem: vector of flags (0 or 1), of size nel if interptype is set to 'element' or 'element and node', "); 105 _printLine_(" or of size 0 otherwise."); 106 _printLine_(""); 107 _printLine_(" Example: "); 108 _printLine_(" in_nod=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','node',1)"); 109 _printLine_(" in_elements=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element',0)"); 110 _printLine_(" [in_nodes,in_elements]=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element and node',0)"); 111 _printLine_(""); 112 112 } 113 113 //}}} -
issm/trunk/src/modules/ContourToNodes/ContourToNodes.cpp
r12331 r12706 82 82 /* Debugging of contours :{{{1*/ 83 83 /*for(i=0;i<numcontours;i++){ 84 printf("\nContour echo: contour number %i / %i\n",i+1,numcontours);84 _printLine_("\nContour echo: contour number " << i+1 << " / " << numcontours); 85 85 contouri=*(contours+i); 86 printf(" Number of nodes %i\n",contouri->nods);86 _printLine_(" Number of nodes " << contouri->nods); 87 87 for (j=0;j<contouri->nods;j++){ 88 printf(" %lf %lf\n",*(contouri->x+j),*(contouri->y+j));88 _printLine_(" " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f"); 89 89 } 90 90 }*/ … … 103 103 104 104 void ContourToNodesUsage(void){ 105 printf(" usage:\n");106 printf(" [flags]=ContourToNodes(x,y,contourname,edgevalue);\n\n");107 printf(" where:\n");108 printf(" x,y: list of nodes.\n");109 printf(" contourname: name of .exp file containing the contours, or resulting structure from call to expread.\n");110 printf(" interptype: string definining type of interpolation ('element', or 'node').\n");111 printf(" edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n");112 printf(" flags: vector of flags (0 or 1), of size nods.\n");113 printf("\n");105 _printLine_(" usage:"); 106 _printLine_(" [flags]=ContourToNodes(x,y,contourname,edgevalue);\n"); 107 _printLine_(" where:"); 108 _printLine_(" x,y: list of nodes."); 109 _printLine_(" contourname: name of .exp file containing the contours, or resulting structure from call to expread."); 110 _printLine_(" interptype: string definining type of interpolation ('element', or 'node')."); 111 _printLine_(" edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons."); 112 _printLine_(" flags: vector of flags (0 or 1), of size nods."); 113 _printLine_(""); 114 114 } -
issm/trunk/src/modules/ElementConnectivity/ElementConnectivity.cpp
r12331 r12706 37 37 38 38 void ElementConnectivityUsage(void) { 39 _p rintf_(true,"\n");40 _p rintf_(true," usage: elementconnectivity = %s(elements, nodeconnectivity);\n",__FUNCT__);41 _p rintf_(true,"\n");39 _pprintLine_(""); 40 _pprintLine_(" usage: elementconnectivity = " << __FUNCT__ << "(elements, nodeconnectivity);"); 41 _pprintLine_(""); 42 42 } -
issm/trunk/src/modules/EnumToString/EnumToString.cpp
r12331 r12706 12 12 /*checks on arguments on the matlab side: */ 13 13 if(nrhs!=NRHS){ 14 EnumToStringUsage(); _error _("usage. See above");14 EnumToStringUsage(); _error2_("usage. See above"); 15 15 } 16 16 … … 27 27 void EnumToStringUsage(void) 28 28 { 29 _p rintf_(true,"\n");30 _p rintf_(true," usage: %sstring = EnumToString(enum);\n",__FUNCT__);31 _p rintf_(true,"\n");29 _pprintLine_(""); 30 _pprintLine_(" usage: " << __FUNCT__ << "string = EnumToString(enum);"); 31 _pprintLine_(""); 32 32 } -
issm/trunk/src/modules/Exp2Kml/Exp2Kml.cpp
r12331 r12706 25 25 /*checks on arguments on the matlab side: */ 26 26 if (nlhs > NLHS) { 27 Exp2KmlUsage(); _error _("Exp2Kml usage error");27 Exp2KmlUsage(); _error2_("Exp2Kml usage error"); 28 28 } 29 29 if (nrhs < NRHS) { 30 Exp2KmlUsage(); _error _("Exp2Kml usage error");30 Exp2KmlUsage(); _error2_("Exp2Kml usage error"); 31 31 } 32 32 … … 43 43 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 44 44 options->Get(&cm,"central_meridian"); 45 if (verbose) printf(" cm=%g\n",cm);45 if (verbose) _printLine_(" cm=" << cm); 46 46 options->Get(&sp,"standard_parallel"); 47 if (verbose) printf(" sp=%g\n",sp);47 if (verbose) _printLine_(" sp=" << sp); 48 48 } 49 49 50 50 /*some checks*/ 51 if (sgn !=+1 && sgn !=-1) _error _("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);52 if (fabs(cm) > 180.) _error _("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);53 if (sp < 0. || sp > 90.) _error _("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);51 if (sgn !=+1 && sgn !=-1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south)."); 52 if (fabs(cm) > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees."); 53 if (sp < 0. || sp > 90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere)."); 54 54 55 55 /* Run core computations: */ … … 73 73 74 74 void Exp2KmlUsage(void){ 75 _p rintf_(true,"Exp2Kml - exp to kml file conversion module:\n");76 _p rintf_(true,"\n");77 _p rintf_(true," This module converts a file from exp to kml format.\n");78 _p rintf_(true,"\n");79 _p rintf_(true," Usage:\n");80 _p rintf_(true," [ret]=Exp2Kml(filexp,filkml,sgn,'param name',param,...);\n");81 _p rintf_(true,"\n");82 _p rintf_(true," filexp file name of exp file to be read (char)\n");83 _p rintf_(true," filkml file name of kml file to be written (char)\n");84 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");85 _p rintf_(true,"\n");86 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");87 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");88 _p rintf_(true," holes flag for treatment of multiple profiles (char, optional, 'yes' for holes))\n");89 _p rintf_(true,"\n");90 _p rintf_(true," ret return code (non-zero for warning)\n");91 _p rintf_(true,"\n");92 _p rintf_(true," Examples:\n");93 _p rintf_(true," [ret]=Exp2Kml('file.exp','file.kml', 1);\n");94 _p rintf_(true," [ret]=Exp2Kml('file.exp','file.kml', 1,'central_meridian',45,'standard_parallel',70,'holes','yes');\n");95 _p rintf_(true," [ret]=Exp2Kml('file.exp','file.kml',-1,'central_meridian', 0,'standard_parallel',71,'holes','yes');\n");96 _p rintf_(true,"\n");75 _pprintLine_("Exp2Kml - exp to kml file conversion module:"); 76 _pprintLine_(""); 77 _pprintLine_(" This module converts a file from exp to kml format."); 78 _pprintLine_(""); 79 _pprintLine_(" Usage:"); 80 _pprintLine_(" [ret]=Exp2Kml(filexp,filkml,sgn,'param name',param,...);"); 81 _pprintLine_(""); 82 _pprintLine_(" filexp file name of exp file to be read (char)"); 83 _pprintLine_(" filkml file name of kml file to be written (char)"); 84 _pprintLine_(" sgn sign for hemisphere (double, +1 (north) or -1 (south))"); 85 _pprintLine_(""); 86 _pprintLine_(" central_meridian central meridian (double, optional, but must specify with sp)"); 87 _pprintLine_(" standard_parallel standard parallel (double, optional, but must specify with cm)"); 88 _pprintLine_(" holes flag for treatment of multiple profiles (char, optional, 'yes' for holes))"); 89 _pprintLine_(""); 90 _pprintLine_(" ret return code (non-zero for warning)"); 91 _pprintLine_(""); 92 _pprintLine_(" Examples:"); 93 _pprintLine_(" [ret]=Exp2Kml('file.exp','file.kml', 1);"); 94 _pprintLine_(" [ret]=Exp2Kml('file.exp','file.kml', 1,'central_meridian',45,'standard_parallel',70,'holes','yes');"); 95 _pprintLine_(" [ret]=Exp2Kml('file.exp','file.kml',-1,'central_meridian', 0,'standard_parallel',71,'holes','yes');"); 96 _pprintLine_(""); 97 97 } 98 98 -
issm/trunk/src/modules/HoleFiller/HoleFiller.cpp
r12331 r12706 60 60 void HoleFillerUsage(void) 61 61 { 62 printf(" HoleFiller usage:\n");63 printf(" [image_out]=HoleFiller(image_in,smooth);\n\n");64 printf(" where:\n");65 printf(" image_in in double format\n");66 printf(" smooth: 1 to smooth with a box filer, 0 to leave data raw\n");67 printf(" image_out in double format\n");68 printf("\n");62 _printLine_(" HoleFiller usage:"); 63 _printLine_(" [image_out]=HoleFiller(image_in,smooth);\n"); 64 _printLine_(" where:"); 65 _printLine_(" image_in in double format"); 66 _printLine_(" smooth: 1 to smooth with a box filer, 0 to leave data raw"); 67 _printLine_(" image_out in double format"); 68 _printLine_(""); 69 69 } -
issm/trunk/src/modules/InternalFront/InternalFront.cpp
r12331 r12706 26 26 /*Fetch required fields*/ 27 27 FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements")); 28 if(numberofelements<=0) _error _("No elements found in the model");28 if(numberofelements<=0) _error2_("No elements found in the model"); 29 29 FetchData(&elements,&M,&N,mxGetAssignedField(MODEL,0,"elements")); 30 if(M!=numberofelements || N!=3) _error _("Field 'elements' should be of size [md.numberofelements 3]");30 if(M!=numberofelements || N!=3) _error2_("Field 'elements' should be of size [md.numberofelements 3]"); 31 31 FetchData(&elementonwater,&M,&N,mxGetAssignedField(MODEL,0,"elementonwater")); 32 if(M!=numberofelements || N!=1) _error _("Field 'elementonwater' should be of size [md.numberofelements 1]");32 if(M!=numberofelements || N!=1) _error2_("Field 'elementonwater' should be of size [md.numberofelements 1]"); 33 33 FetchData(&elementconnectivity,&M,&N,mxGetAssignedField(MODEL,0,"elementconnectivity")); 34 if(M!=numberofelements || N!=3) _error _("Field 'elementconnectivity' should be of size [md.numberofelements 3]");34 if(M!=numberofelements || N!=3) _error2_("Field 'elementconnectivity' should be of size [md.numberofelements 3]"); 35 35 36 36 /*Allocate and initialize all variables*/ … … 94 94 95 95 void InternalFrontUsage(void) { 96 _p rintf_(true,"\n");97 _p rintf_(true," usage: icefront = %s(md);\n",__FUNCT__);98 _p rintf_(true,"\n");96 _pprintLine_(""); 97 _pprintLine_(" usage: icefront = " << __FUNCT__ << "(md);"); 98 _pprintLine_(""); 99 99 } -
issm/trunk/src/modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp
r12331 r12706 46 46 if((nlhs!=NLHS) || (nrhs!=6 && nrhs!=7)){ 47 47 InterpFromGridToMeshUsage(); 48 _error _("usage. See above");48 _error2_("usage. See above"); 49 49 } 50 50 … … 75 75 void InterpFromGridToMeshUsage(void) 76 76 { 77 _p rintf_(true,"INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points\n");78 _p rintf_(true,"\n");79 _p rintf_(true," This function is a multi-threaded mex file that interpolates a field\n");80 _p rintf_(true," defined on a grid onto a list of points\n");81 _p rintf_(true,"\n");82 _p rintf_(true," Usage:\n");83 _p rintf_(true," data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);\n");84 _p rintf_(true,"\n");85 _p rintf_(true," data: matrix holding the data to be interpolated onto the mesh.\n");86 _p rintf_(true," x,y: coordinates of matrix data. (x and y must be in increasing order)\n");87 _p rintf_(true," x_mesh,y_mesh: coordinates of the points onto which we interpolate.\n");88 _p rintf_(true," default_value: default value if no data is found (holes).\n");89 _p rintf_(true," data_mesh: vector of mesh interpolated data.\n");90 _p rintf_(true,"\n");91 _p rintf_(true," Example:\n");92 _p rintf_(true," load('velocities.mat');\n");93 _p rintf_(true," md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);\n");94 _p rintf_(true,"\n");77 _pprintLine_("INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points"); 78 _pprintLine_(""); 79 _pprintLine_(" This function is a multi-threaded mex file that interpolates a field"); 80 _pprintLine_(" defined on a grid onto a list of points"); 81 _pprintLine_(""); 82 _pprintLine_(" Usage:"); 83 _pprintLine_(" data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);"); 84 _pprintLine_(""); 85 _pprintLine_(" data: matrix holding the data to be interpolated onto the mesh."); 86 _pprintLine_(" x,y: coordinates of matrix data. (x and y must be in increasing order)"); 87 _pprintLine_(" x_mesh,y_mesh: coordinates of the points onto which we interpolate."); 88 _pprintLine_(" default_value: default value if no data is found (holes)."); 89 _pprintLine_(" data_mesh: vector of mesh interpolated data."); 90 _pprintLine_(""); 91 _pprintLine_(" Example:"); 92 _pprintLine_(" load('velocities.mat');"); 93 _pprintLine_(" md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);"); 94 _pprintLine_(""); 95 95 } -
issm/trunk/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp
r12331 r12706 69 69 if(nlhs!=NLHS){ 70 70 InterpFromMesh2dUsage(); 71 _error _("InterpFromMeshToMesh2dUsage usage error");71 _error2_("InterpFromMeshToMesh2dUsage usage error"); 72 72 } 73 73 if((nrhs!=6) && (nrhs!=7) && (nrhs!=8)){ 74 74 InterpFromMesh2dUsage(); 75 _error _("InterpFromMeshToMesh2dUsage usage error");75 _error2_("InterpFromMeshToMesh2dUsage usage error"); 76 76 } 77 77 … … 114 114 /* Debugging of contours :{{{1*/ 115 115 /*for(i=0;i<numcontours;i++){ 116 printf("\nContour echo: contour number %i / %i\n",i+1,numcontours);116 _printLine_("\nContour echo: contour number " << i+1 << " / " << numcontours); 117 117 contouri=*(contours+i); 118 printf(" Number of vertices %i\n",contouri->nods);118 _printLine_(" Number of vertices " << contouri->nods); 119 119 for (j=0;j<contouri->nods;j++){ 120 printf(" %lf %lf\n",*(contouri->x+j),*(contouri->y+j));120 _printLine_(" " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f"); 121 121 } 122 122 }*/ … … 131 131 /*some checks*/ 132 132 if (x_data_rows!=y_data_rows){ 133 _error _("vectors x and y should have the same length!");133 _error2_("vectors x and y should have the same length!"); 134 134 } 135 135 if (x_prime_rows!=y_prime_rows){ 136 _error _("vectors x_prime and y_prime should have the same length!");136 _error2_("vectors x_prime and y_prime should have the same length!"); 137 137 } 138 138 … … 154 154 void InterpFromMesh2dUsage(void) 155 155 { 156 _p rintf_(true," usage:\n");157 _p rintf_(true," data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime);\n\n");158 _p rintf_(true," or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n\n");159 _p rintf_(true," or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value,contourname);\n\n");160 _p rintf_(true," where:\n");161 _p rintf_(true," x,y: coordinates of the nodes where data is defined\n");162 _p rintf_(true," index: index of the mesh where data is defined\n");163 _p rintf_(true," data - vector holding the data to be interpolated onto the points.\n");164 _p rintf_(true," x_prime,y_prime: coordinates of the mesh vertices onto which we interpolate.\n");165 _p rintf_(true," default_value: a scalar or vector of size length(x_prime).\n");166 _p rintf_(true," contourname: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh.\n");167 _p rintf_(true," data_prime: vector of prime interpolated data.\n");168 _p rintf_(true,"\n");156 _pprintLine_(" usage:"); 157 _pprintLine_(" data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime);\n"); 158 _pprintLine_(" or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n"); 159 _pprintLine_(" or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value,contourname);\n"); 160 _pprintLine_(" where:"); 161 _pprintLine_(" x,y: coordinates of the nodes where data is defined"); 162 _pprintLine_(" index: index of the mesh where data is defined"); 163 _pprintLine_(" data - vector holding the data to be interpolated onto the points."); 164 _pprintLine_(" x_prime,y_prime: coordinates of the mesh vertices onto which we interpolate."); 165 _pprintLine_(" default_value: a scalar or vector of size length(x_prime)."); 166 _pprintLine_(" contourname: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh."); 167 _pprintLine_(" data_prime: vector of prime interpolated data."); 168 _pprintLine_(""); 169 169 } -
issm/trunk/src/modules/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
r12331 r12706 64 64 void InterpFromMeshToGridUsage(void) 65 65 { 66 _p rintf_(true,"INTERPFROMMESHTOGRID - interpolation of a data defined on a mesh onto a grid\n");67 _p rintf_(true,"\n");68 _p rintf_(true," This function is a multi-threaded mex file that interpolates a field\n");69 _p rintf_(true," defined on a triangular mesh onto a regular grid\n");70 _p rintf_(true,"\n");71 _p rintf_(true," Usage:\n");72 _p rintf_(true," [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)\n");73 _p rintf_(true,"\n");74 _p rintf_(true," index,x,y: delaunay triangulation defining the mesh.\n");75 _p rintf_(true," meshdata: vertex values of data to be interpolated.\n");76 _p rintf_(true," xmin,ymax,posting,nlines,ncols: parameters that define the grid\n");77 _p rintf_(true," default_value: value of points located out of the mesh.\n");78 _p rintf_(true,"\n");66 _pprintLine_("INTERPFROMMESHTOGRID - interpolation of a data defined on a mesh onto a grid"); 67 _pprintLine_(""); 68 _pprintLine_(" This function is a multi-threaded mex file that interpolates a field"); 69 _pprintLine_(" defined on a triangular mesh onto a regular grid"); 70 _pprintLine_(""); 71 _pprintLine_(" Usage:"); 72 _pprintLine_(" [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)"); 73 _pprintLine_(""); 74 _pprintLine_(" index,x,y: delaunay triangulation defining the mesh."); 75 _pprintLine_(" meshdata: vertex values of data to be interpolated."); 76 _pprintLine_(" xmin,ymax,posting,nlines,ncols: parameters that define the grid"); 77 _pprintLine_(" default_value: value of points located out of the mesh."); 78 _pprintLine_(""); 79 79 } -
issm/trunk/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
r12331 r12706 7 7 WRAPPER(InterpFromMeshToMesh2d){ 8 8 9 /*input: */ 10 double* index=NULL; 11 int index_cols; 12 double* x_data=NULL; 13 int x_data_rows; 14 double* y_data=NULL; 15 int y_data_rows; 16 double* data=NULL; 17 int data_rows; 18 int data_cols; 19 double* x_interp=NULL; 20 int x_interp_rows; 21 double* y_interp=NULL; 22 int y_interp_rows; 23 char* contourname=NULL; 24 double* default_values=NULL; 25 int num_default_values=0; 26 DataSet *contours = NULL; 27 28 /*Intermediary*/ 29 int nels_data; 30 31 /* output: */ 32 double* data_interp=NULL; 9 /*Intermediaties*/ 10 int *index = NULL; 11 double *x_data = NULL; 12 double *y_data = NULL; 13 double *data = NULL; 14 int nods_data,nels_data; 15 int M_data,N_data; 16 double *x_interp = NULL; 17 double *y_interp = NULL; 18 int N_interp; 19 Options *options = NULL; 20 double *data_interp = NULL; 21 int test1,test2,test; 33 22 34 23 /*Boot module: */ … … 39 28 if(nlhs!=NLHS){ 40 29 InterpFromMeshToMesh2dUsage(); 41 _error _("InterpFromMeshToMesh2dUsage usage error");30 _error2_("InterpFromMeshToMesh2dUsage usage error"); 42 31 } 43 32 #endif 44 33 /*check on input arguments: */ 45 if( (nrhs!=6) & (nrhs!=8)){34 if(nrhs<NRHS){ 46 35 InterpFromMeshToMesh2dUsage(); 47 _error _("InterpFromMeshToMesh2dUsage usage error");36 _error2_("InterpFromMeshToMesh2dUsage usage error"); 48 37 } 49 38 50 /*Input datasets: */ 51 FetchData(&index,&nels_data,&index_cols,INDEX); 52 FetchData(&x_data,&x_data_rows,NULL,X); 53 FetchData(&y_data,&y_data_rows,NULL,Y); 54 FetchData(&data,&data_rows,&data_cols,DATA); 55 FetchData(&x_interp,&x_interp_rows,XINTERP); 56 FetchData(&y_interp,&y_interp_rows,YINTERP); 39 /*Fetch inputs: */ 40 FetchData(&index,&nels_data,&test,INDEX); if(test!=3) _error2_("index should have 3 columns"); 41 FetchData(&x_data,&nods_data,X); if(nods_data<3) _error2_("there should be at least three points"); 42 FetchData(&y_data,&test,Y); if(test!=nods_data) _error2_("vectors x and y should have the same length"); 43 FetchData(&data,&M_data,&N_data,DATA); if(M_data*N_data<1) _error2_("data is empty"); 44 FetchData(&x_interp,&N_interp,XINTERP); if(N_interp<1) _error2_("no interpolation requested"); 45 FetchData(&y_interp,&test,YINTERP); if(test!=N_interp) _error2_("vectors x_interp and y_interp should have the same length"); 46 FetchData(&options,NRHS,nrhs,prhs); 57 47 58 /*Figure out contours and default values: */ 59 if(nrhs==8){ 60 FetchData(&default_values,&num_default_values,DEFAULT); 61 FetchData(&contourname,CONTOURNAME); 62 contours=DomainOutlineRead(contourname); 63 } 64 else{ 65 num_default_values=0; 66 default_values=NULL; 67 contours=new DataSet(); 68 } 69 70 71 /*some checks*/ 72 if (x_data_rows!=y_data_rows){ 73 _error_("vectors x and y should have the same length!"); 74 } 75 if (x_interp_rows!=y_interp_rows){ 76 _error_("vectors x_interp and y_interp should have the same length!"); 77 } 78 if (index_cols!=3){ 79 _error_("index should have 3 columns (input provided has %i columns)",index_cols); 80 } 81 82 /* Run core computations: */ 83 InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,x_data_rows,nels_data,data,data_rows,data_cols,x_interp,y_interp,x_interp_rows,default_values,num_default_values,contours); 48 /*Run core computations*/ 49 InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,nods_data,nels_data,data,M_data,N_data,x_interp,y_interp,N_interp,options); 84 50 85 51 /*Write data: */ 86 WriteData(DATAINTERP,data_interp, x_interp_rows,data_cols);52 WriteData(DATAINTERP,data_interp,N_interp,N_data); 87 53 88 54 /*end module: */ … … 90 56 } 91 57 92 void InterpFromMeshToMesh2dUsage(void)//{{{1 93 94 { 95 _printf_(true,"INTERFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point\n"); 96 _printf_(true,"\n"); 97 _printf_(true," This function is a multi-threaded mex file that interpolates a field\n"); 98 _printf_(true," defined on a triangular mesh onto a list of point\n"); 99 _printf_(true,"\n"); 100 _printf_(true," Usage:\n"); 101 _printf_(true," data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp);\n"); 102 _printf_(true," or data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,default_value,contourname);\n"); 103 _printf_(true,"\n"); 104 _printf_(true," index: index of the mesh where data is defined\n"); 105 _printf_(true," x,y: coordinates of the nodes where data is defined\n"); 106 _printf_(true," data: matrix holding the data to be interpolated onto the mesh. (one column per field)\n"); 107 _printf_(true," x_interp,y_interp: coordinates of the points onto which we interpolate.\n"); 108 _printf_(true," if default_value and contourname not specified: linear interpolation will happen on all x_interp,y_interp.\n"); 109 _printf_(true," if (default_value,contourname) specified: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh.\n"); 110 _printf_(true," note that default_value is either a scalar, or a vector of size length(x_interp)\n"); 111 _printf_(true," data_interp: vector of mesh interpolated data.\n"); 112 _printf_(true,"\n"); 113 _printf_(true," Example:\n"); 114 _printf_(true," load('temperature.mat');\n"); 115 _printf_(true," md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y);\n"); 116 _printf_(true," md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y,253,'Contour.exp');\n"); 117 _printf_(true,"\n"); 58 void InterpFromMeshToMesh2dUsage(void){ /*{{{*/ 59 _pprintLine_("INTERFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point"); 60 _pprintLine_(""); 61 _pprintLine_(" This function is a multi-threaded mex file that interpolates a field"); 62 _pprintLine_(" defined on a Delaunay triangulation onto a list of point"); 63 _pprintLine_(""); 64 _pprintLine_(" Usage:"); 65 _pprintLine_(" data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp);"); 66 _pprintLine_(" or data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,OPTIONS);"); 67 _pprintLine_(""); 68 _pprintLine_(" index : index of the mesh where data is defined"); 69 _pprintLine_(" x,y : coordinates of the nodes where data is defined"); 70 _pprintLine_(" data : matrix holding the data to be interpolated onto the mesh. (one column per field)"); 71 _pprintLine_(" x_interp,y_interp : coordinates of the points onto which we interpolate."); 72 _pprintLine_(" data_interp : vector of mesh interpolated data."); 73 _pprintLine_(" Available options :"); 74 _pprintLine_(" - 'default' : default value if point is outsite of triangulation (instead of linear interolation)"); 75 _pprintLine_(""); 76 _pprintLine_(" Example:"); 77 _pprintLine_(" load('temperature.mat');"); 78 _pprintLine_(" md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y);"); 79 _pprintLine_(" md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y,'default',253);"); 80 _pprintLine_(""); 118 81 } 119 / /}}}82 /*}}}*/ -
issm/trunk/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
r12331 r12706 12 12 #endif 13 13 14 /*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/ 14 /* local prototypes: */ 15 void InterpFromMeshToMesh2dUsage(void); 16 17 /*If python: this macro needs to come before header files inclusion*/ 15 18 #ifdef _HAVE_PYTHON_ 16 19 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol … … 28 31 #include "../../c/EnumDefinitions/EnumDefinitions.h" 29 32 33 #undef __FUNCT__ 34 #define __FUNCT__ "InterpFromMeshToMesh2d" 35 30 36 #ifdef _HAVE_MATLAB_MODULES_ 31 37 /* serial input macros: */ … … 36 42 #define XINTERP prhs[4] 37 43 #define YINTERP prhs[5] 38 #define DEFAULT prhs[6]39 #define CONTOURNAME prhs[7]40 44 41 45 /* serial output macros: */ … … 51 55 #define XINTERP PyTuple_GetItem(args,4) 52 56 #define YINTERP PyTuple_GetItem(args,5) 53 #define DEFAULT PyTuple_GetItem(args,6) 54 #define CONTOURNAME PyTuple_GetItem(args,7) 57 55 58 /* serial output macros: */ 56 59 #define DATAINTERP output,0 57 60 #endif 58 59 #undef __FUNCT__60 #define __FUNCT__ "InterpFromMeshToMesh2d"61 61 62 62 /* serial arg counts: */ … … 64 64 #define NLHS 1 65 65 #undef NRHS 66 #define NRHS 6 //can be 8 though 67 68 /* local prototypes: */ 69 void InterpFromMeshToMesh2dUsage(void); 66 #define NRHS 6 70 67 71 68 #endif -
issm/trunk/src/modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
r12331 r12706 76 76 /*some checks*/ 77 77 if (x_data_rows!=y_data_rows || x_data_rows!=z_data_rows){ 78 _error _("vectors x, y and z should have the same length!");78 _error2_("vectors x, y and z should have the same length!"); 79 79 } 80 80 if (x_prime_rows!=y_prime_rows || x_prime_rows!=z_prime_rows){ 81 _error _("vectors x_prime, y_prime and z_prime should have the same length!");81 _error2_("vectors x_prime, y_prime and z_prime should have the same length!"); 82 82 } 83 83 /*get number of elements and number of nodes in the data*/ … … 98 98 void InterpFromMeshToMesh3dUsage(void) 99 99 { 100 _p rintf_(true,"INTERPFROMMESHTOMESH3D - interpolation from a 3d hexahedron mesh onto a list of point\n");101 _p rintf_(true,"\n");102 _p rintf_(true," This function is a multi-threaded mex file that interpolates a field\n");103 _p rintf_(true," defined on a triangular mesh onto a list of point\n");104 _p rintf_(true,"\n");105 _p rintf_(true," Usage:\n");106 _p rintf_(true," data_prime=InterpFromMeshToMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);\n");107 _p rintf_(true,"\n");108 _p rintf_(true," index: index of the mesh where data is defined\n");109 _p rintf_(true," x,y,z: coordinates of the nodes where data is defined\n");110 _p rintf_(true," data: matrix holding the data to be interpolated onto the mesh.\n");111 _p rintf_(true," x_prime,y_prime,z_prime: coordinates of the points onto which we interpolate.\n");112 _p rintf_(true," default_value: default value if no data is found (holes).\n");113 _p rintf_(true," data_prime: vector of mesh interpolated data.\n");114 _p rintf_(true,"\n");115 _p rintf_(true," Example:\n");116 _p rintf_(true," load('temperature.mat');\n");117 _p rintf_(true," md.initialization.temperature=InterpFromMeshToMesh3d(index,x,y,z,temperature,md.mesh.x,md.mesh.y,md.mesh.z,253);\n");118 _p rintf_(true,"\n");100 _pprintLine_("INTERPFROMMESHTOMESH3D - interpolation from a 3d hexahedron mesh onto a list of point"); 101 _pprintLine_(""); 102 _pprintLine_(" This function is a multi-threaded mex file that interpolates a field"); 103 _pprintLine_(" defined on a triangular mesh onto a list of point"); 104 _pprintLine_(""); 105 _pprintLine_(" Usage:"); 106 _pprintLine_(" data_prime=InterpFromMeshToMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);"); 107 _pprintLine_(""); 108 _pprintLine_(" index: index of the mesh where data is defined"); 109 _pprintLine_(" x,y,z: coordinates of the nodes where data is defined"); 110 _pprintLine_(" data: matrix holding the data to be interpolated onto the mesh."); 111 _pprintLine_(" x_prime,y_prime,z_prime: coordinates of the points onto which we interpolate."); 112 _pprintLine_(" default_value: default value if no data is found (holes)."); 113 _pprintLine_(" data_prime: vector of mesh interpolated data."); 114 _pprintLine_(""); 115 _pprintLine_(" Example:"); 116 _pprintLine_(" load('temperature.mat');"); 117 _pprintLine_(" md.initialization.temperature=InterpFromMeshToMesh3d(index,x,y,z,temperature,md.mesh.x,md.mesh.y,md.mesh.z,253);"); 118 _pprintLine_(""); 119 119 } -
issm/trunk/src/modules/KMLFileRead/KMLFileRead.cpp
r12331 r12706 45 45 /*checks on arguments on the matlab side: */ 46 46 if (nlhs > NLHS) { 47 KMLFileReadUsage(); _error _("KMLFileRead usage error");47 KMLFileReadUsage(); _error2_("KMLFileRead usage error"); 48 48 } 49 49 if (nrhs < NRHS) { 50 KMLFileReadUsage(); _error _("KMLFileRead usage error");50 KMLFileReadUsage(); _error2_("KMLFileRead usage error"); 51 51 } 52 52 … … 63 63 if (!strlen(filnam)) strcpy(filnam,"stdout"); 64 64 65 if (verbose) printf("Opening file \"%s\".\n",filnam);65 if (verbose) _printLine_("Opening file \"" << filnam << "\"."); 66 66 fidi=fopen(filnam,"r"); 67 67 68 68 /* Run core computations: */ 69 if (verbose) printf("Calling core:\n");69 if (verbose) _printLine_("Calling core:"); 70 70 kobj=KMLFileReadx(fidi); 71 71 72 if (verbose) printf("Closing file \"%s\".\n",filnam);72 if (verbose) _printLine_("Closing file \"" << filnam << "\"."); 73 73 fclose(fidi); 74 74 … … 83 83 } 84 84 else { 85 if (verbose) printf("Opening file \"%s\".\n",write);85 if (verbose) _printLine_("Opening file \"" << write << "\"."); 86 86 fido=fopen(write,"w"); 87 87 kobj->Write(fido,""); 88 if (verbose) printf("Closing file \"%s\".\n",write);88 if (verbose) _printLine_("Closing file \"" << write << "\"."); 89 89 ierror=fclose(fido); 90 90 } … … 107 107 108 108 void KMLFileReadUsage(void){ 109 _p rintf_(true,"KMLFileRead - KML file reader module:\n");110 _p rintf_(true,"\n");111 _p rintf_(true," This module reads a KML file.\n");112 _p rintf_(true,"\n");113 _p rintf_(true," Usage:\n");114 _p rintf_(true," [ierror]=KMLFileRead(kmlfile,'param name',param,...);\n");115 _p rintf_(true,"\n");116 _p rintf_(true," kmlfile file name of kml file to be read (char)\n");117 _p rintf_(true,"\n");118 _p rintf_(true," echo echo command (char, optional, 'off'/'on')\n");119 _p rintf_(true," deepecho deep echo command (char, optional, 'off'/'on')\n");120 _p rintf_(true," write write command (char, optional, 'off'/'stdout'/kmlfile)\n");121 _p rintf_(true,"\n");122 _p rintf_(true," ierror return code (non-zero for error)\n");123 _p rintf_(true,"\n");124 _p rintf_(true," Examples:\n");125 _p rintf_(true," [ierror]=KMLFileRead('file.kml','deepecho','on');\n");126 _p rintf_(true," [ierror]=KMLFileRead('filin.kml','echo','on','write','filout.kml');\n");127 _p rintf_(true,"\n");109 _pprintLine_("KMLFileRead - KML file reader module:"); 110 _pprintLine_(""); 111 _pprintLine_(" This module reads a KML file."); 112 _pprintLine_(""); 113 _pprintLine_(" Usage:"); 114 _pprintLine_(" [ierror]=KMLFileRead(kmlfile,'param name',param,...);"); 115 _pprintLine_(""); 116 _pprintLine_(" kmlfile file name of kml file to be read (char)"); 117 _pprintLine_(""); 118 _pprintLine_(" echo echo command (char, optional, 'off'/'on')"); 119 _pprintLine_(" deepecho deep echo command (char, optional, 'off'/'on')"); 120 _pprintLine_(" write write command (char, optional, 'off'/'stdout'/kmlfile)"); 121 _pprintLine_(""); 122 _pprintLine_(" ierror return code (non-zero for error)"); 123 _pprintLine_(""); 124 _pprintLine_(" Examples:"); 125 _pprintLine_(" [ierror]=KMLFileRead('file.kml','deepecho','on');"); 126 _pprintLine_(" [ierror]=KMLFileRead('filin.kml','echo','on','write','filout.kml');"); 127 _pprintLine_(""); 128 128 } 129 129 -
issm/trunk/src/modules/KMLMeshWrite/KMLMeshWrite.cpp
r12331 r12706 40 40 /*checks on arguments on the matlab side: */ 41 41 if (nlhs > NLHS) { 42 KMLMeshWriteUsage(); _error _("KMLMeshWrite usage error");42 KMLMeshWriteUsage(); _error2_("KMLMeshWrite usage error"); 43 43 } 44 44 if (nrhs < NRHS) { 45 KMLMeshWriteUsage(); _error _("KMLMeshWrite usage error");45 KMLMeshWriteUsage(); _error2_("KMLMeshWrite usage error"); 46 46 } 47 47 … … 87 87 88 88 if (nodecon && (mncon != nnodes)) 89 _error_("Nodal connectivity table, if supplied, must be supplied for all nodes.");89 {_error2_("Nodal connectivity table, if supplied, must be supplied for all nodes.");} 90 90 else if (!nodecon) 91 91 mncon=nnodes; 92 92 if ((llat != nnodes) || (llng != nnodes) || (llat != llng)) 93 _error _("Latitude and longitude vectors must be supplied for all nodes.");93 _error2_("Latitude and longitude vectors must be supplied for all nodes."); 94 94 if (part && (lprt != nnodes)) 95 _error _("Partitioning vector, if supplied, must be supplied for all nodes.");95 _error2_("Partitioning vector, if supplied, must be supplied for all nodes."); 96 96 if (data && !((mdata == nnodes) || (mdata == melem))) 97 _error _("Data matrix, if supplied, must be supplied for all nodes or all elements.");97 _error2_("Data matrix, if supplied, must be supplied for all nodes or all elements."); 98 98 if (cmap && (ncmap != 3)) 99 _error _("Colormap matrix, if supplied, must have three columns for rgb.");99 _error2_("Colormap matrix, if supplied, must have three columns for rgb."); 100 100 if (!strlen(filnam)) 101 101 strcpy(filnam,"stdout"); … … 118 118 119 119 void KMLMeshWriteUsage(void){ 120 _p rintf_(true,"KMLMeshWrite - KML mesh writer module:\n");121 _p rintf_(true,"\n");122 _p rintf_(true," This module writes the mesh of a model as KML polygons into the specified KML file.\n");123 _p rintf_(true,"\n");124 _p rintf_(true," Usage:\n");125 _p rintf_(true," ierror=KMLMeshWrite(name,notes,elem,nodecon,lat,long,part,data,cmap,kmlfile);\n");126 _p rintf_(true,"\n");127 _p rintf_(true," name model name (string, may be empty)\n");128 _p rintf_(true," notes model notes (string or cell array of strings, may be empty)\n");129 _p rintf_(true," elem elements (double array)\n");130 _p rintf_(true," nodecon nodal connectivity array (double array, may be empty)\n");131 _p rintf_(true," lat nodal latititudes (double vector)\n");132 _p rintf_(true," long nodal longitudes (double vector)\n");133 _p rintf_(true," part nodal partitions (double vector, may be empty)\n");134 _p rintf_(true," data nodal or element data (double vector, may be empty)\n");135 _p rintf_(true," cmap color map (double nx3 array, may be empty)\n");136 _p rintf_(true," kmlfile KML file name (string)\n");137 _p rintf_(true,"\n");138 _p rintf_(true," ierror error flag (double, non-zero for error)\n");139 _p rintf_(true,"\n");140 _p rintf_(true," Example:\n");141 _p rintf_(true," KMLMeshWrite(md.name,md.notes,md.elements,md.nodeconnectivity,md.lat,md.long,md.part,md.fm_criterion,options.cmap,filekml);\n");142 _p rintf_(true,"\n");120 _pprintLine_("KMLMeshWrite - KML mesh writer module:"); 121 _pprintLine_(""); 122 _pprintLine_(" This module writes the mesh of a model as KML polygons into the specified KML file."); 123 _pprintLine_(""); 124 _pprintLine_(" Usage:"); 125 _pprintLine_(" ierror=KMLMeshWrite(name,notes,elem,nodecon,lat,long,part,data,cmap,kmlfile);"); 126 _pprintLine_(""); 127 _pprintLine_(" name model name (string, may be empty)"); 128 _pprintLine_(" notes model notes (string or cell array of strings, may be empty)"); 129 _pprintLine_(" elem elements (double array)"); 130 _pprintLine_(" nodecon nodal connectivity array (double array, may be empty)"); 131 _pprintLine_(" lat nodal latititudes (double vector)"); 132 _pprintLine_(" long nodal longitudes (double vector)"); 133 _pprintLine_(" part nodal partitions (double vector, may be empty)"); 134 _pprintLine_(" data nodal or element data (double vector, may be empty)"); 135 _pprintLine_(" cmap color map (double nx3 array, may be empty)"); 136 _pprintLine_(" kmlfile KML file name (string)"); 137 _pprintLine_(""); 138 _pprintLine_(" ierror error flag (double, non-zero for error)"); 139 _pprintLine_(""); 140 _pprintLine_(" Example:"); 141 _pprintLine_(" KMLMeshWrite(md.name,md.notes,md.elements,md.nodeconnectivity,md.lat,md.long,md.part,md.fm_criterion,options.cmap,filekml);"); 142 _pprintLine_(""); 143 143 } -
issm/trunk/src/modules/KMLOverlay/KMLOverlay.cpp
r12331 r12706 31 31 /*checks on arguments on the matlab side: */ 32 32 if(nlhs>NLHS){ 33 KMLOverlayUsage(); _error _("KMLOverlay usage error");33 KMLOverlayUsage(); _error2_("KMLOverlay usage error"); 34 34 } 35 35 if(nrhs<NRHS){ 36 KMLOverlayUsage(); _error _("KMLOverlay usage error");36 KMLOverlayUsage(); _error2_("KMLOverlay usage error"); 37 37 } 38 38 … … 42 42 43 43 options->Get(&lataxis ,&nlat ,"lataxis" ); 44 if (verbose && lataxis) for (i=0; i<nlat; i++) printf(" lataxis [%d]=%g\n",i,lataxis[i]);44 if (verbose && lataxis) for (i=0; i<nlat; i++) _printLine_(" lataxis [" << i << "]=" << lataxis[i]); 45 45 options->Get(&longaxis,&nlong,"longaxis"); 46 if (verbose && longaxis) for (i=0; i<nlong; i++) printf(" longaxis[%d]=%g\n",i,longaxis[i]);46 if (verbose && longaxis) for (i=0; i<nlong; i++) _printLine_(" longaxis[" << i << "]=" << longaxis[i]); 47 47 options->Get(&pimages,&nimages,"images"); 48 if (verbose && pimages) for (i=0; i<nimages; i++) printf(" pimages[%d]=\"%s\"\n",i,pimages[i]);48 if (verbose && pimages) for (i=0; i<nimages; i++) _printLine_(" pimages[" << i << "]=\"" << pimages[i] << "\""); 49 49 options->Get(&dzip,"zip",0.); 50 if (verbose) printf(" dzip=%g\n",dzip);50 if (verbose) _printLine_(" dzip=" << dzip); 51 51 52 52 /*some checks*/ 53 if (nlat !=2) _error _("Latitudinal axes \"lataxis\" require two double values, not %d.",nlat);54 if (nlong!=2) _error _("Longitudinal axes \"longaxis\" require two double values, not %d.",nlong);55 if (!nimages) _error _("No image files provided.");53 if (nlat !=2) _error2_("Latitudinal axes \"lataxis\" require two double values, not " << nlat << "."); 54 if (nlong!=2) _error2_("Longitudinal axes \"longaxis\" require two double values, not " << nlong << "."); 55 if (!nimages) _error2_("No image files provided."); 56 56 57 57 if ((int)dzip){ … … 63 63 if(!strlen(filkml)) strcpy(filkml,"stdout"); 64 64 65 if(verbose) printf("Opening kml overlay file \"%s\".\n",filkml);65 if(verbose) _printLine_("Opening kml overlay file \"" << filkml << "\"."); 66 66 fid=fopen(filkml,"w"); 67 67 68 68 /* Run core computations: */ 69 if (verbose) printf("Calling core:\n");69 if (verbose) _printLine_("Calling core:"); 70 70 KMLOverlayx(&ierror,lataxis,longaxis,nimages,pimages,fid); 71 71 72 if (verbose) printf("Closing file \"%s\".\n",filkml);72 if (verbose) _printLine_("Closing file \"" << filkml << "\"."); 73 73 fclose(fid); 74 74 … … 87 87 strcat(czip,pimages[i]); 88 88 } 89 if (verbose) printf("Zipping file \"%s\".\n",filkmz);90 if (verbose) printf("%s\n",czip);89 if (verbose) _printLine_("Zipping file \"" << filkmz << "\"."); 90 if (verbose) _printLine_(czip); 91 91 92 if (mexEvalString(czip)) _error _("Error zipping file \"%s\".",filkmz);92 if (mexEvalString(czip)) _error2_("Error zipping file \"" << filkmz << "\"."); 93 93 xfree((void**)&czip); 94 94 xfree((void**)&filkmz); … … 113 113 114 114 void KMLOverlayUsage(void){ 115 _p rintf_(true,"KMLOverlay - KML file overlay module:\n");116 _p rintf_(true,"\n");117 _p rintf_(true," This module reads a list of image files and writes a KML or KMZ overlay file.\n");118 _p rintf_(true,"\n");119 _p rintf_(true," Usage:\n");120 _p rintf_(true," ierror=KMLOverlay(kmlfile,'param name',param,...);\n");121 _p rintf_(true,"\n");122 _p rintf_(true," kmlfile KML or KMZ file name (string)\n");123 _p rintf_(true,"\n");124 _p rintf_(true," lataxis latitude axis (double vector [south north], required)\n");125 _p rintf_(true," longaxis longitude axis (double vector [west east], required)\n");126 _p rintf_(true," images relative or http image file names (string or array of strings or cell array of strings, required)\n");127 _p rintf_(true," zip flag to zip the doc.kml and image files into kmzfile (double, non-zero for kmz)\n");128 _p rintf_(true,"\n");129 _p rintf_(true," ierror error flag (double, non-zero for error)\n");130 _p rintf_(true,"\n");131 _p rintf_(true," Example:\n");132 _p rintf_(true," KMLOverlay(kmlfile,'lataxis',[south north],'longaxis',[west east],'images',{'file1.png','http://issm/file2.png'},'zip',1);\n");133 _p rintf_(true,"\n");115 _pprintLine_("KMLOverlay - KML file overlay module:"); 116 _pprintLine_(""); 117 _pprintLine_(" This module reads a list of image files and writes a KML or KMZ overlay file."); 118 _pprintLine_(""); 119 _pprintLine_(" Usage:"); 120 _pprintLine_(" ierror=KMLOverlay(kmlfile,'param name',param,...);"); 121 _pprintLine_(""); 122 _pprintLine_(" kmlfile KML or KMZ file name (string)"); 123 _pprintLine_(""); 124 _pprintLine_(" lataxis latitude axis (double vector [south north], required)"); 125 _pprintLine_(" longaxis longitude axis (double vector [west east], required)"); 126 _pprintLine_(" images relative or http image file names (string or array of strings or cell array of strings, required)"); 127 _pprintLine_(" zip flag to zip the doc.kml and image files into kmzfile (double, non-zero for kmz)"); 128 _pprintLine_(""); 129 _pprintLine_(" ierror error flag (double, non-zero for error)"); 130 _pprintLine_(""); 131 _pprintLine_(" Example:"); 132 _pprintLine_(" KMLOverlay(kmlfile,'lataxis',[south north],'longaxis',[west east],'images',{'file1.png','http://issm/file2.png'},'zip',1);"); 133 _pprintLine_(""); 134 134 } -
issm/trunk/src/modules/Kml2Exp/Kml2Exp.cpp
r12331 r12706 22 22 /*checks on arguments on the matlab side: */ 23 23 if (nlhs > NLHS) { 24 Kml2ExpUsage(); _error _("Kml2Exp usage error");24 Kml2ExpUsage(); _error2_("Kml2Exp usage error"); 25 25 } 26 26 if (nrhs < NRHS) { 27 Kml2ExpUsage(); _error _("Kml2Exp usage error");27 Kml2ExpUsage(); _error2_("Kml2Exp usage error"); 28 28 } 29 29 … … 37 37 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 38 38 options->Get(&cm,"central_meridian"); 39 if (verbose) printf(" cm=%g\n",cm);39 if (verbose) _printLine_(" cm=" << cm); 40 40 options->Get(&sp,"standard_parallel"); 41 if (verbose) printf(" sp=%g\n",sp);41 if (verbose) _printLine_(" sp=" << sp); 42 42 } 43 43 44 44 /*some checks*/ 45 if (sgn !=+1 && sgn!= -1) _error _("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);46 if (fabs(cm) > 180.) _error _("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);47 if (sp < 0. || sp > 90.) _error _("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);45 if (sgn !=+1 && sgn!= -1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south)."); 46 if (fabs(cm) > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees."); 47 if (sp < 0. || sp > 90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere)."); 48 48 49 49 /* Run core computations: */ … … 66 66 67 67 void Kml2ExpUsage(void){ 68 _p rintf_(true,"Kml2Exp - kml to exp file conversion module:\n");69 _p rintf_(true,"\n");70 _p rintf_(true," This module converts a file from kml to exp format.\n");71 _p rintf_(true,"\n");72 _p rintf_(true," Usage:\n");73 _p rintf_(true," [ret]=Kml2Exp(filexp,filkml,sgn,'param name',param,...);\n");74 _p rintf_(true,"\n");75 _p rintf_(true," filkml file name of kml file to be read (char)\n");76 _p rintf_(true," filexp file name of exp file to be written (char)\n");77 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");78 _p rintf_(true,"\n");79 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");80 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");81 _p rintf_(true,"\n");82 _p rintf_(true," ret return code (non-zero for warning)\n");83 _p rintf_(true,"\n");84 _p rintf_(true," Examples:\n");85 _p rintf_(true," [ret]=Kml2Exp('file.kml','file.exp', 1);\n");86 _p rintf_(true," [ret]=Kml2Exp('file.kml','file.exp', 1,'central_meridian',45,'standard_parallel',70);\n");87 _p rintf_(true," [ret]=Kml2Exp('file.kml','file.exp',-1,'central_meridian', 0,'standard_parallel',71);\n");88 _p rintf_(true,"\n");68 _pprintLine_("Kml2Exp - kml to exp file conversion module:"); 69 _pprintLine_(""); 70 _pprintLine_(" This module converts a file from kml to exp format."); 71 _pprintLine_(""); 72 _pprintLine_(" Usage:"); 73 _pprintLine_(" [ret]=Kml2Exp(filexp,filkml,sgn,'param name',param,...);"); 74 _pprintLine_(""); 75 _pprintLine_(" filkml file name of kml file to be read (char)"); 76 _pprintLine_(" filexp file name of exp file to be written (char)"); 77 _pprintLine_(" sgn sign for hemisphere (double, +1 (north) or -1 (south))"); 78 _pprintLine_(""); 79 _pprintLine_(" central_meridian central meridian (double, optional, but must specify with sp)"); 80 _pprintLine_(" standard_parallel standard parallel (double, optional, but must specify with cm)"); 81 _pprintLine_(""); 82 _pprintLine_(" ret return code (non-zero for warning)"); 83 _pprintLine_(""); 84 _pprintLine_(" Examples:"); 85 _pprintLine_(" [ret]=Kml2Exp('file.kml','file.exp', 1);"); 86 _pprintLine_(" [ret]=Kml2Exp('file.kml','file.exp', 1,'central_meridian',45,'standard_parallel',70);"); 87 _pprintLine_(" [ret]=Kml2Exp('file.kml','file.exp',-1,'central_meridian', 0,'standard_parallel',71);"); 88 _pprintLine_(""); 89 89 } 90 90 -
issm/trunk/src/modules/Kriging/Kriging.cpp
r12331 r12706 22 22 /*checks on arguments on the matlab side: */ 23 23 if (nrhs<NRHS || nlhs>NLHS){ 24 KrigingUsage(); _error _("Kriging usage error");24 KrigingUsage(); _error2_("Kriging usage error"); 25 25 } 26 26 27 27 /*Fetch inputs: */ 28 28 FetchData(&x,&n_obs,X); 29 FetchData(&y,&N,Y); if(n_obs!=N) _error _("x and y should have the same size");30 FetchData(&observations,&N,OBSERVATIONS); if(n_obs!=N) _error _("x and observations should have the same size");29 FetchData(&y,&N,Y); if(n_obs!=N) _error2_("x and y should have the same size"); 30 FetchData(&observations,&N,OBSERVATIONS); if(n_obs!=N) _error2_("x and observations should have the same size"); 31 31 FetchData(&x_interp,&M_interp,&N_interp,XINTERP); 32 FetchData(&y_interp,&M,&N,YINTERP); if(N!=N_interp || M!=M_interp) _error _("x_interp and y_interp should have the same size");32 FetchData(&y_interp,&M,&N,YINTERP); if(N!=N_interp || M!=M_interp) _error2_("x_interp and y_interp should have the same size"); 33 33 FetchData(&options,NRHS,nrhs,prhs); 34 34 … … 54 54 55 55 void KrigingUsage(void){ 56 _p rintf_(true,"\n");57 _p rintf_(true," usage: predictions=%s(x,y,observations,x_interp,y_interp,'options');\n",__FUNCT__);58 _p rintf_(true," available options:\n");59 _p rintf_(true," -'model': Available variogram models 'gaussian' (default),'spherical','power','exponential'\n");60 _p rintf_(true," -'nugget': nugget effect (default 0.2)\n");61 _p rintf_(true," -'range': for gaussian, spherical and exponential models (default sqrt(3))\n");62 _p rintf_(true," -'sill': for gaussian, spherical and exponential models (default 1)\n");63 _p rintf_(true," -'slope': for power model (default 1)\n");64 _p rintf_(true," -'power': for power model (default 1)\n");65 _p rintf_(true," -'searchradius': search radius for each prediction (default is observations span)\n");66 _p rintf_(true," -'boxlength': minimum length of quadtree boxes (useful to decrease the number of observations)\n");67 _p rintf_(true," -'maxdata': minimum number of observations for a prediction (default is 50)\n");68 _p rintf_(true," -'mindata': maximum number of observations for a prediction (default is 1)\n");69 _p rintf_(true," -'maxtrimming': maximum trimming value (default is -1.e+21)\n");70 _p rintf_(true," -'mintrimming': minimum trimming value (default is +1.e+21)\n");71 _p rintf_(true," -'minspacing': minimum distance between observation (default is 0.01)\n");72 _p rintf_(true,"\n");56 _pprintLine_(""); 57 _pprintLine_(" usage: predictions=" << __FUNCT__ << "(x,y,observations,x_interp,y_interp,'options');"); 58 _pprintLine_(" available options:"); 59 _pprintLine_(" -'model': Available variogram models 'gaussian' (default),'spherical','power','exponential'"); 60 _pprintLine_(" -'nugget': nugget effect (default 0.2)"); 61 _pprintLine_(" -'range': for gaussian, spherical and exponential models (default sqrt(3))"); 62 _pprintLine_(" -'sill': for gaussian, spherical and exponential models (default 1)"); 63 _pprintLine_(" -'slope': for power model (default 1)"); 64 _pprintLine_(" -'power': for power model (default 1)"); 65 _pprintLine_(" -'searchradius': search radius for each prediction (default is observations span)"); 66 _pprintLine_(" -'boxlength': minimum length of quadtree boxes (useful to decrease the number of observations)"); 67 _pprintLine_(" -'maxdata': minimum number of observations for a prediction (default is 50)"); 68 _pprintLine_(" -'mindata': maximum number of observations for a prediction (default is 1)"); 69 _pprintLine_(" -'maxtrimming': maximum trimming value (default is -1.e+21)"); 70 _pprintLine_(" -'mintrimming': minimum trimming value (default is +1.e+21)"); 71 _pprintLine_(" -'minspacing': minimum distance between observation (default is 0.01)"); 72 _pprintLine_(""); 73 73 } -
issm/trunk/src/modules/Ll2xy/Ll2xy.cpp
r12331 r12706 25 25 /*checks on arguments on the matlab side: */ 26 26 if (nlhs > NLHS) { 27 Ll2xyUsage(); _error _("Ll2xy usage error");27 Ll2xyUsage(); _error2_("Ll2xy usage error"); 28 28 } 29 29 if (nrhs < NRHS) { 30 Ll2xyUsage(); _error _("Ll2xy usage error");30 Ll2xyUsage(); _error2_("Ll2xy usage error"); 31 31 } 32 32 … … 40 40 if(options->GetOption("central_meridian") || options->GetOption("standard_parallel")){ 41 41 options->Get(&cm,"central_meridian"); 42 if (verbose) printf(" cm=%g\n",cm);42 if (verbose) _printLine_(" cm=" << cm); 43 43 options->Get(&sp,"standard_parallel"); 44 if (verbose) printf(" sp=%g\n",sp);44 if (verbose) _printLine_(" sp=" << sp); 45 45 } 46 46 47 47 /*some checks*/ 48 if (verbose) printf("Checking inputs:\n");49 if (nlat != nlon) _error_("Must have same number of lat[%d] and lon[%d] coordinates.",nlat,nlon);48 if (verbose) _printLine_("Checking inputs:"); 49 if (nlat != nlon){_error2_("Must have same number of lat[" << nlat << "] and lon[" << nlon << "] coordinates.");} 50 50 else ncoord=nlat; 51 if (sgn != +1 && sgn != -1) _error _("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);52 if (fabs(cm) > 180.) _error _("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);53 if (sp < 0. || sp > 90.) _error _("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);51 if (sgn != +1 && sgn != -1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south)."); 52 if (fabs(cm) > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees."); 53 if (sp < 0. || sp > 90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere)."); 54 54 55 55 x=(double*)mxMalloc(ncoord*sizeof(double)); … … 74 74 75 75 void Ll2xyUsage(void){ 76 _p rintf_(true,"Ll2xy - lat/long to x/y coordinate transformation module:\n");77 _p rintf_(true,"\n");78 _p rintf_(true," This module transforms lat/long to x/y coordinates.\n");79 _p rintf_(true,"\n");80 _p rintf_(true," Usage:\n");81 _p rintf_(true," [x,y]=Ll2xy(lat,lon,sgn,'param name',param,...);\n");82 _p rintf_(true,"\n");83 _p rintf_(true," lat latitude coordinates (double vector)\n");84 _p rintf_(true," lon longitude coordinates (double vector)\n");85 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");86 _p rintf_(true,"\n");87 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");88 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");89 _p rintf_(true,"\n");90 _p rintf_(true," x x coordinates (double vector)\n");91 _p rintf_(true," y y coordinates (double vector)\n");92 _p rintf_(true,"\n");93 _p rintf_(true," Examples:\n");94 _p rintf_(true," [x,y]=Ll2xy(lat,lon, 1);\n");95 _p rintf_(true," [x,y]=Ll2xy(lat,lon, 1,'central_meridian',45,'standard_parallel',70);\n");96 _p rintf_(true," [x,y]=Ll2xy(lat,lon,-1,'central_meridian', 0,'standard_parallel',71);\n");97 _p rintf_(true,"\n");76 _pprintLine_("Ll2xy - lat/long to x/y coordinate transformation module:"); 77 _pprintLine_(""); 78 _pprintLine_(" This module transforms lat/long to x/y coordinates."); 79 _pprintLine_(""); 80 _pprintLine_(" Usage:"); 81 _pprintLine_(" [x,y]=Ll2xy(lat,lon,sgn,'param name',param,...);"); 82 _pprintLine_(""); 83 _pprintLine_(" lat latitude coordinates (double vector)"); 84 _pprintLine_(" lon longitude coordinates (double vector)"); 85 _pprintLine_(" sgn sign for hemisphere (double, +1 (north) or -1 (south))"); 86 _pprintLine_(""); 87 _pprintLine_(" central_meridian central meridian (double, optional, but must specify with sp)"); 88 _pprintLine_(" standard_parallel standard parallel (double, optional, but must specify with cm)"); 89 _pprintLine_(""); 90 _pprintLine_(" x x coordinates (double vector)"); 91 _pprintLine_(" y y coordinates (double vector)"); 92 _pprintLine_(""); 93 _pprintLine_(" Examples:"); 94 _pprintLine_(" [x,y]=Ll2xy(lat,lon, 1);"); 95 _pprintLine_(" [x,y]=Ll2xy(lat,lon, 1,'central_meridian',45,'standard_parallel',70);"); 96 _pprintLine_(" [x,y]=Ll2xy(lat,lon,-1,'central_meridian', 0,'standard_parallel',71);"); 97 _pprintLine_(""); 98 98 } -
issm/trunk/src/modules/MeshPartition/MeshPartition.cpp
r12331 r12706 96 96 97 97 void MeshPartitionUsage(void){ 98 printf(" usage:\n");99 printf(" [element_partitioning,node_partitioning]=MeshPartition(md.mesh,numpartitions)");100 printf(" where:\n");101 printf(" element_partitioning is a vector of partitioning area numbers, for every element.\n");102 printf(" node_partitioning is a vector of partitioning area numbers, for every node.\n");103 printf("\n");98 _printLine_(" usage:"); 99 _printString_(" [element_partitioning,node_partitioning]=MeshPartition(md.mesh,numpartitions)"); 100 _printLine_(" where:"); 101 _printLine_(" element_partitioning is a vector of partitioning area numbers, for every element."); 102 _printLine_(" node_partitioning is a vector of partitioning area numbers, for every node."); 103 _printLine_(""); 104 104 } -
issm/trunk/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp
r12331 r12706 54 54 //index 55 55 FetchData(&double_index,&nel,&dummy,INDEX); 56 if(dummy!=3 && dummy!=6)_error _("element triangulation should be of 3 or 6 column width!");56 if(dummy!=3 && dummy!=6)_error2_("element triangulation should be of 3 or 6 column width!"); 57 57 index=(int*)xmalloc(nel*3*sizeof(int)); 58 58 for(i=0;i<nel;i++){ … … 81 81 /* Debugging of contours :{{{1*/ 82 82 /*for(i=0;i<numcontours;i++){ 83 printf("\nContour echo: contour number %i / %i\n",i+1,numcontours);83 _printLine_("\nContour echo: contour number " << i+1 << " / " << numcontours); 84 84 contouri=*(contours+i); 85 printf(" Number of vertices %i\n",contouri->nods);85 _printLine_(" Number of vertices " << contouri->nods); 86 86 for (j=0;j<contouri->nods;j++){ 87 printf(" %lf %lf\n",*(contouri->x+j),*(contouri->y+j));87 _printLine_(" " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f"); 88 88 } 89 89 }*/ … … 102 102 103 103 void MeshProfileIntersectionUsage(void){ 104 printf(" usage:\n");105 printf(" [segments]=MeshProfileIntersection(index,x,y,filename);\n");106 printf(" where:\n");107 printf(" input:\n");108 printf(" index,x,y is a triangulation\n");109 printf(" filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)\n");110 printf(" output:\n");111 printf(" segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment \n");112 printf(" belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the \n");113 printf(" mesh.\n");104 _printLine_(" usage:"); 105 _printLine_(" [segments]=MeshProfileIntersection(index,x,y,filename);"); 106 _printLine_(" where:"); 107 _printLine_(" input:"); 108 _printLine_(" index,x,y is a triangulation"); 109 _printLine_(" filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)"); 110 _printLine_(" output:"); 111 _printLine_(" segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment "); 112 _printLine_(" belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the "); 113 _printLine_(" mesh."); 114 114 } -
issm/trunk/src/modules/NodeConnectivity/NodeConnectivity.cpp
r12331 r12706 37 37 38 38 void NodeConnectivityUsage(void) { 39 _p rintf_(true,"\n");40 _p rintf_(true," usage: connectivity = %s(elements, numnodes);\n",__FUNCT__);41 _p rintf_(true,"\n");39 _pprintLine_(""); 40 _pprintLine_(" usage: connectivity = " << __FUNCT__ << "(elements, numnodes);"); 41 _pprintLine_(""); 42 42 } -
issm/trunk/src/modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
r12331 r12706 42 42 43 43 void PointCloudFindNeighborsUsage(void){ 44 printf(" usage:\n");45 printf(" [flags]=PointCloudFindNeighbors(x,y,mindistance,multithread);\n\n");46 printf(" where:\n");47 printf(" x,y: list of points.\n");48 printf(" mindistance: minimum distance that should exist between points in the cloud.\n");49 printf(" multithread: run multithreaded or not. with multithreads, flags can get 1 and 2 values in duplicates.\n");50 printf(" flags: array of flags (flag==1 means point is within mindistance of another point)\n");51 printf("\n");44 _printLine_(" usage:"); 45 _printLine_(" [flags]=PointCloudFindNeighbors(x,y,mindistance,multithread);\n"); 46 _printLine_(" where:"); 47 _printLine_(" x,y: list of points."); 48 _printLine_(" mindistance: minimum distance that should exist between points in the cloud."); 49 _printLine_(" multithread: run multithreaded or not. with multithreads, flags can get 1 and 2 values in duplicates."); 50 _printLine_(" flags: array of flags (flag==1 means point is within mindistance of another point)"); 51 _printLine_(""); 52 52 } -
issm/trunk/src/modules/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
r12331 r12706 42 42 43 43 void PropagateFlagsFromConnectivityUsage(void) { 44 printf("\n");45 printf(" usage: [pool] = %s(connectivity,pool,index,flags);\n",__FUNCT__);46 printf("\n");44 _printLine_(""); 45 _printLine_(" usage: [pool] = " << __FUNCT__ << "(connectivity,pool,index,flags);");; 46 _printLine_(""); 47 47 } -
issm/trunk/src/modules/Scotch/Scotch.cpp
r12331 r12706 25 25 26 26 #ifndef _HAVE_SCOTCH_ //only works if scotch library has been compiled in. 27 _error _("Scotch not available! Cannot carry out Scotch partitioning!");27 _error2_("Scotch not available! Cannot carry out Scotch partitioning!"); 28 28 #else 29 29 -
issm/trunk/src/modules/Shp2Kml/Shp2Kml.cpp
r12331 r12706 25 25 26 26 #ifndef _HAVE_SHAPELIB_ //only works if shapelib library has been compiled in. 27 _error _("Shapelib not available! Cannot carry out shp file translation!");27 _error2_("Shapelib not available! Cannot carry out shp file translation!"); 28 28 #endif 29 29 … … 33 33 /*checks on arguments on the matlab side: */ 34 34 if (nlhs > NLHS) { 35 Shp2KmlUsage(); _error _("Shp2Kml usage error");35 Shp2KmlUsage(); _error2_("Shp2Kml usage error"); 36 36 } 37 37 if (nrhs < NRHS) { 38 Shp2KmlUsage(); _error _("Shp2Kml usage error");38 Shp2KmlUsage(); _error2_("Shp2Kml usage error"); 39 39 } 40 40 … … 48 48 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 49 49 options->Get(&cm,"central_meridian"); 50 if (verbose) printf(" cm=%g\n",cm);50 if (verbose) _printLine_(" cm=" << cm); 51 51 options->Get(&sp,"standard_parallel"); 52 if (verbose) printf(" sp=%g\n",sp);52 if (verbose) _printLine_(" sp=" << sp); 53 53 } 54 54 55 55 /*some checks*/ 56 if (sgn < -1 || sgn > +1) _error _("Hemisphere sgn=%d must be +1 (north), -1 (south), or 0 (no translation).",sgn);57 if (fabs(cm) > 180.) _error _("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);58 if (sp < 0. || sp > 90.) _error _("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);56 if (sgn < -1 || sgn > +1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north), -1 (south), or 0 (no translation)."); 57 if (fabs(cm) > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees."); 58 if (sp < 0. || sp > 90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere)."); 59 59 60 60 /* Run core computations: */ … … 77 77 78 78 void Shp2KmlUsage(void){ 79 _p rintf_(true,"Shp2Kml - shp to kml file conversion module:\n");80 _p rintf_(true,"\n");81 _p rintf_(true," This module converts a file from shp to kml format.\n");82 _p rintf_(true,"\n");83 _p rintf_(true," Usage:\n");84 _p rintf_(true," [ret]=Shp2Kml(filshp,filkml,sgn,'param name',param,...);\n");85 _p rintf_(true,"\n");86 _p rintf_(true," filshp file name of shp file to be read (char, extension optional)\n");87 _p rintf_(true," filkml file name of kml file to be written (char)\n");88 _p rintf_(true," sgn sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))\n");89 _p rintf_(true,"\n");90 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");91 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");92 _p rintf_(true,"\n");93 _p rintf_(true," ret return code (non-zero for warning)\n");94 _p rintf_(true,"\n");95 _p rintf_(true," Examples:\n");96 _p rintf_(true," [ret]=Shp2Kml('file.shp','file.kml', 0);\n");97 _p rintf_(true," [ret]=Shp2Kml('file.shp','file.kml', 1,'central_meridian',45,'standard_parallel',70);\n");98 _p rintf_(true," [ret]=Shp2Kml('file.shp','file.kml',-1,'central_meridian', 0,'standard_parallel',71);\n");99 _p rintf_(true,"\n");79 _pprintLine_("Shp2Kml - shp to kml file conversion module:"); 80 _pprintLine_(""); 81 _pprintLine_(" This module converts a file from shp to kml format."); 82 _pprintLine_(""); 83 _pprintLine_(" Usage:"); 84 _pprintLine_(" [ret]=Shp2Kml(filshp,filkml,sgn,'param name',param,...);"); 85 _pprintLine_(""); 86 _pprintLine_(" filshp file name of shp file to be read (char, extension optional)"); 87 _pprintLine_(" filkml file name of kml file to be written (char)"); 88 _pprintLine_(" sgn sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))"); 89 _pprintLine_(""); 90 _pprintLine_(" central_meridian central meridian (double, optional, but must specify with sp)"); 91 _pprintLine_(" standard_parallel standard parallel (double, optional, but must specify with cm)"); 92 _pprintLine_(""); 93 _pprintLine_(" ret return code (non-zero for warning)"); 94 _pprintLine_(""); 95 _pprintLine_(" Examples:"); 96 _pprintLine_(" [ret]=Shp2Kml('file.shp','file.kml', 0);"); 97 _pprintLine_(" [ret]=Shp2Kml('file.shp','file.kml', 1,'central_meridian',45,'standard_parallel',70);"); 98 _pprintLine_(" [ret]=Shp2Kml('file.shp','file.kml',-1,'central_meridian', 0,'standard_parallel',71);"); 99 _pprintLine_(""); 100 100 } -
issm/trunk/src/modules/StringToEnum/StringToEnum.cpp
r12331 r12706 12 12 /*checks on arguments on the matlab side: */ 13 13 if(nrhs!=NRHS){ 14 StringToEnumUsage(); _error _("usage. See above");14 StringToEnumUsage(); _error2_("usage. See above"); 15 15 } 16 16 … … 27 27 void StringToEnumUsage(void) 28 28 { 29 _p rintf_(true,"\n");30 _p rintf_(true," usage: %senum = StringToEnum(string);\n",__FUNCT__);31 _p rintf_(true,"\n");29 _pprintLine_(""); 30 _pprintLine_(" usage: " << __FUNCT__ << "enum = StringToEnum(string);"); 31 _pprintLine_(""); 32 32 } -
issm/trunk/src/modules/TriMesh/TriMesh.cpp
r12331 r12706 63 63 void TriMeshUsage(void) //{{{1 64 64 { 65 printf("\n");66 printf(" usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,rifts,area) \n");67 printf(" where: index,x,y defines a triangulation, segments is an array made \n");68 printf(" of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, \n");69 printf(" outlinefilename an Argus domain outline file, \n");70 printf(" area is the maximum area desired for any element of the resulting mesh, \n");71 printf("\n");65 _printLine_(""); 66 _printLine_(" usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,rifts,area) "); 67 _printLine_(" where: index,x,y defines a triangulation, segments is an array made "); 68 _printLine_(" of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, "); 69 _printLine_(" outlinefilename an Argus domain outline file, "); 70 _printLine_(" area is the maximum area desired for any element of the resulting mesh, "); 71 _printLine_(""); 72 72 } 73 73 //}}} -
issm/trunk/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
r12331 r12706 66 66 mexPrintf(" %s format error.\n", __FUNCT__); 67 67 TriMeshProcessRiftsUsage(); 68 printf(" "); 69 mexErrMsgTxt(" "); 68 _error_("bad usage"); 70 69 } 71 70 … … 82 81 } 83 82 else{ 84 printf("%s%s\n",__FUNCT__," error message: first argument should be the element list!"); 85 mexErrMsgTxt(" "); 83 _error_("first argument should be the element list"); 86 84 } 87 85 … … 96 94 } 97 95 else{ 98 printf("%s%s\n",__FUNCT__," error message: second argument should be the x corrdinate list!"); 99 mexErrMsgTxt(" "); 96 _error_("second argument should be the x corrdinate list"); 100 97 } 101 98 … … 109 106 } 110 107 else{ 111 printf("%s%s\n",__FUNCT__," error message: third argument should be the y corrdinate list!"); 112 mexErrMsgTxt(" "); 108 _error_("third argument should be the y corrdinate list"); 113 109 } 114 110 … … 125 121 } 126 122 else{ 127 printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segments list!"); 128 mexErrMsgTxt(" "); 123 _error_("fourth argument should be the segments list"); 129 124 } 130 125 … … 138 133 } 139 134 else{ 140 printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segmentmarkers list!"); 141 mexErrMsgTxt(" "); 142 } 143 144 /* 145 printf("Index: \n"); 146 for (i=0;i<nel;i++){ 147 for(j=0;j<3;j++){ 148 printf("%lf ",*(index_in+3*i+j)); 149 } 150 printf("\n"); 151 } 152 printf("x,y: \n"); 153 for (i=0;i<nods;i++){ 154 printf("%16.16lf %16.16lf\n",x_in[i],y_in[i]); 155 } 156 printf("segments:\n"); 157 for (i=0;i<num_seg;i++){ 158 for(j=0;j<3;j++){ 159 printf("%lf ",*(segments_in+3*i+j)); 160 } 161 printf("%lf ",segmentmarkers_in[i]); 162 printf("\n"); 163 } 164 */ 135 _error_("fourth argument should be the segmentmarkers list"); 136 } 165 137 166 138 /*First, do some fixing on the existing mesh: we do not want any element belonging entirely to the segment list (ie: … … 325 297 void TriMeshProcessRiftsUsage(void) 326 298 { 327 printf("\n");328 printf(" usage: [index2,x2,y2,segments2,segmentmarkers2,rifts2]=TriMeshProcessrifts(index1,x1,y1,segments1,segmentmarkers1) \n");329 printf(" where: (index1,x1,y1,segments1,segmentmarkers1) is an initial triangulation.\n");330 printf(" index2,x2,y2,segments2,segmentmarkers2,rifts2 is the resulting triangulation where rifts have been processed.\n");299 _printLine_(""); 300 _printLine_(" usage: [index2,x2,y2,segments2,segmentmarkers2,rifts2]=TriMeshProcessrifts(index1,x1,y1,segments1,segmentmarkers1) "); 301 _printLine_(" where: (index1,x1,y1,segments1,segmentmarkers1) is an initial triangulation."); 302 _printLine_(" index2,x2,y2,segments2,segmentmarkers2,rifts2 is the resulting triangulation where rifts have been processed."); 331 303 } -
issm/trunk/src/modules/TriaSearch/TriaSearch.cpp
r12331 r12706 9 9 10 10 /*input: */ 11 double*index=NULL;11 int* index=NULL; 12 12 int nel; 13 13 int dummy; … … 37 37 FetchData(&y0,&numberofnodes,Y0HANDLE); 38 38 39 /* Echo: {{{1*/40 //printf("(x0,y0)=(%g,%g)\n",x0,y0);41 /*}}}*/42 43 39 /* Run core computations: */ 44 40 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes); … … 54 50 } 55 51 56 void TriaSearchUsage(void) 57 { 58 _printf_(true,"TriaSearch- find triangle holding a point (x0,y0) in a mesh\n"); 59 _printf_(true,"\n"); 60 _printf_(true," Usage:\n"); 61 _printf_(true," tria=TriaSearch(index,x,y,x0,y0);\n"); 62 _printf_(true," index,x,y: mesh triangulatrion\n"); 63 _printf_(true," x0,y0: coordinates of the point for which we are trying to find a triangle\n"); 64 _printf_(true," x0,y0 can be an array of points\n"); 65 _printf_(true,"\n"); 52 void TriaSearchUsage(void){ 53 _pprintLine_("TriaSearch- find triangle holding a point (x0,y0) in a mesh"); 54 _pprintLine_(""); 55 _pprintLine_(" Usage:"); 56 _pprintLine_(" tria=TriaSearch(index,x,y,x0,y0);"); 57 _pprintLine_(" index,x,y: mesh triangulatrion"); 58 _pprintLine_(" x0,y0: coordinates of the point for which we are trying to find a triangle"); 59 _pprintLine_(" x0,y0 can be an array of points"); 60 _pprintLine_(""); 66 61 } -
issm/trunk/src/modules/Xy2ll/Xy2ll.cpp
r12331 r12706 24 24 /*checks on arguments on the matlab side: */ 25 25 if (nlhs > NLHS) { 26 Xy2llUsage(); _error _("Xy2ll usage error");26 Xy2llUsage(); _error2_("Xy2ll usage error"); 27 27 } 28 28 if (nrhs < NRHS) { 29 Xy2llUsage(); _error _("Xy2ll usage error");29 Xy2llUsage(); _error2_("Xy2ll usage error"); 30 30 } 31 31 … … 39 39 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { 40 40 options->Get(&cm,"central_meridian"); 41 if (verbose) printf(" cm=%g\n",cm);41 if (verbose) _printLine_(" cm=" << cm); 42 42 options->Get(&sp,"standard_parallel"); 43 if (verbose) printf(" sp=%g\n",sp);43 if (verbose) _printLine_(" sp=" << sp); 44 44 } 45 45 46 46 /*some checks*/ 47 if (nx != ny) _error_("Must have same number of x[%d] and y[%d] coordinates.",nx,ny);47 if (nx != ny){_error2_("Must have same number of x[" << nx << "] and y[" << ny << "] coordinates.");} 48 48 else ncoord=nx; 49 if (sgn != +1 && sgn != -1) _error _("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn);50 if (fabs(cm) > 180.) _error _("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm);51 if (sp < 0. || sp > 90.) _error _("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp);49 if (sgn != +1 && sgn != -1) _error2_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south)."); 50 if (fabs(cm) > 180.) _error2_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees."); 51 if (sp < 0. || sp > 90.) _error2_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere)."); 52 52 53 53 lat=(double*)mxMalloc(ncoord*sizeof(double)); … … 55 55 56 56 /* Run core computations: */ 57 if (verbose) printf("Calling core:\n");57 if (verbose) _printLine_("Calling core:"); 58 58 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 59 59 iret=Xy2llx(lat,lon,x,y,ncoord,sgn,cm,sp); … … 73 73 74 74 void Xy2llUsage(void){ 75 _p rintf_(true,"Xy2ll - x/y to lat/long coordinate transformation module:\n");76 _p rintf_(true,"\n");77 _p rintf_(true," This module transforms x/y to lat/long coordinates.\n");78 _p rintf_(true,"\n");79 _p rintf_(true," Usage:\n");80 _p rintf_(true," [lat,lon]=Xy2ll(x,y,sgn,'param name',param,...);\n");81 _p rintf_(true,"\n");82 _p rintf_(true," x x coordinates (double vector)\n");83 _p rintf_(true," y y coordinates (double vector)\n");84 _p rintf_(true," sgn sign for hemisphere (double, +1 (north) or -1 (south))\n");85 _p rintf_(true,"\n");86 _p rintf_(true," central_meridian central meridian (double, optional, but must specify with sp)\n");87 _p rintf_(true," standard_parallel standard parallel (double, optional, but must specify with cm)\n");88 _p rintf_(true,"\n");89 _p rintf_(true," lat latitude coordinates (double vector)\n");90 _p rintf_(true," lon longitude coordinates (double vector)\n");91 _p rintf_(true,"\n");92 _p rintf_(true," Examples:\n");93 _p rintf_(true," [lat,lon]=Xy2ll(x,y, 1);\n");94 _p rintf_(true," [lat,lon]=Xy2ll(x,y, 1,'central_meridian',45,'standard_parallel',70);\n");95 _p rintf_(true," [lat,lon]=Xy2ll(x,y,-1,'central_meridian', 0,'standard_parallel',71);\n");96 _p rintf_(true,"\n");75 _pprintLine_("Xy2ll - x/y to lat/long coordinate transformation module:"); 76 _pprintLine_(""); 77 _pprintLine_(" This module transforms x/y to lat/long coordinates."); 78 _pprintLine_(""); 79 _pprintLine_(" Usage:"); 80 _pprintLine_(" [lat,lon]=Xy2ll(x,y,sgn,'param name',param,...);"); 81 _pprintLine_(""); 82 _pprintLine_(" x x coordinates (double vector)"); 83 _pprintLine_(" y y coordinates (double vector)"); 84 _pprintLine_(" sgn sign for hemisphere (double, +1 (north) or -1 (south))"); 85 _pprintLine_(""); 86 _pprintLine_(" central_meridian central meridian (double, optional, but must specify with sp)"); 87 _pprintLine_(" standard_parallel standard parallel (double, optional, but must specify with cm)"); 88 _pprintLine_(""); 89 _pprintLine_(" lat latitude coordinates (double vector)"); 90 _pprintLine_(" lon longitude coordinates (double vector)"); 91 _pprintLine_(""); 92 _pprintLine_(" Examples:"); 93 _pprintLine_(" [lat,lon]=Xy2ll(x,y, 1);"); 94 _pprintLine_(" [lat,lon]=Xy2ll(x,y, 1,'central_meridian',45,'standard_parallel',70);"); 95 _pprintLine_(" [lat,lon]=Xy2ll(x,y,-1,'central_meridian', 0,'standard_parallel',71);"); 96 _pprintLine_(""); 97 97 } 98 98 -
issm/trunk/src/modules/matlab/Makefile.am
r12331 r12706 1 INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @ METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@1 INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ 2 2 EXEEXT=$(MATLABWRAPPEREXT) 3 3 #Bin programs {{{1 … … 41 41 #}}} 42 42 #Flags and libraries {{{1 43 LDADD = ../../c/libISSMCore.a ../../c/libISSMModules.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $( MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)43 LDADD = ../../c/libISSMCore.a ../../c/libISSMModules.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(SPOOLESLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB) 44 44 45 45 #Triangle library … … 50 50 AM_CXXFLAGS += -D_HAVE_MATLAB_MODULES_ -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread 51 51 LDADD += $(MEXLIB) ../../c/libISSMMatlab.a 52 53 LDADD += ../../c/libISSMCore.a ../../c/libISSMModules.a 52 LDADD += ../../c/libISSMCore.a 53 if CIRCULAR_DEPENDENCIES 54 LDADD += $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(SPOOLESLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB) 55 endif 56 LDADD += ../../c/libISSMModules.a 54 57 55 58 #Optimization flags: -
issm/trunk/src/modules/python/Makefile.am
r12331 r12706 17 17 #Python part 18 18 AM_LDFLAGS = $(PYTHONLINK) 19 AM_CXXFLAGS += -D_HAVE_PYTHON_MODULES_ 19 AM_CXXFLAGS += -D_HAVE_PYTHON_MODULES_ -fPIC 20 20 if PYTHON3 21 21 AM_CXXFLAGS += -DNPY_NO_DEPRECATED_API
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)