Index: ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h =================================================================== --- ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h (revision 15011) +++ ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h (revision 15012) @@ -20,8 +20,8 @@ #include "../../shared/Exceptions/exceptions.h" #include "../../shared/MemOps/MemOps.h" #include "../../shared/io/Comm/Comm.h" -#include "../../classes/objects/DataSet.h" -#include "../../classes/objects/Bucket.h" +#include "../../classes/DataSet.h" +#include "../../classes/Bucket.h" #include "../mumps/mumpsincludes.h" #include "./IssmMpiVec.h" #include Index: ../trunk-jpl/src/c/Makefile.am =================================================================== --- ../trunk-jpl/src/c/Makefile.am (revision 15011) +++ ../trunk-jpl/src/c/Makefile.am (revision 15012) @@ -21,108 +21,107 @@ core_sources = ./main/issm.h\ ./main/globals.h\ ./classes/classes.h\ - ./classes/objects.h\ - ./classes/objects/Object.h\ + ./classes/Object.h\ ./classes/gauss/GaussTria.h\ ./classes/gauss/GaussTria.cpp\ - ./classes/objects/Update.h\ - ./classes/objects/Element.h\ + ./classes/Update.h\ + ./classes/Element.h\ ./classes/FemModel.h\ ./classes/FemModel.cpp\ - ./classes/objects/Material.h\ - ./classes/objects/Load.h\ - ./classes/objects/Contour.h\ - ./classes/objects/Loads/Friction.h\ - ./classes/objects/Loads/Friction.cpp\ - ./classes/objects/Inputs/TransientInput.h\ - ./classes/objects/Inputs/TransientInput.cpp\ - ./classes/objects/Constraints/SpcTransient.cpp\ - ./classes/objects/Constraints/SpcTransient.h\ - ./classes/objects/IndependentObject.h\ - ./classes/objects/IndependentObject.cpp\ - ./classes/objects/DependentObject.h\ - ./classes/objects/DependentObject.cpp\ + ./classes/Material.h\ + ./classes/Load.h\ + ./classes/Contour.h\ + ./classes/Loads/Friction.h\ + ./classes/Loads/Friction.cpp\ + ./classes/Inputs/TransientInput.h\ + ./classes/Inputs/TransientInput.cpp\ + ./classes/Constraints/SpcTransient.cpp\ + ./classes/Constraints/SpcTransient.h\ + ./classes/IndependentObject.h\ + ./classes/IndependentObject.cpp\ + ./classes/DependentObject.h\ + ./classes/DependentObject.cpp\ ./classes/DofIndexing.h\ ./classes/DofIndexing.cpp\ ./classes/IoModel.h\ ./classes/IoModel.cpp\ - ./classes/objects/DataSet.h\ - ./classes/objects/DataSet.cpp\ - ./classes/objects/Nodes.h\ - ./classes/objects/Nodes.cpp\ - ./classes/objects/Vertices.h\ - ./classes/objects/Vertices.cpp\ - ./classes/objects/Bucket.h\ - ./classes/objects/Node.h\ - ./classes/objects/Node.cpp\ - ./classes/objects/Segment.h\ - ./classes/objects/Vertex.h\ - ./classes/objects/Vertex.cpp\ - ./classes/objects/AdolcEdf.h\ + ./classes/DataSet.h\ + ./classes/DataSet.cpp\ + ./classes/Nodes.h\ + ./classes/Nodes.cpp\ + ./classes/Vertices.h\ + ./classes/Vertices.cpp\ + ./classes/Bucket.h\ + ./classes/Node.h\ + ./classes/Node.cpp\ + ./classes/Segment.h\ + ./classes/Vertex.h\ + ./classes/Vertex.cpp\ + ./classes/AdolcEdf.h\ ./classes/ToolkitOptions.h\ ./classes/ToolkitOptions.cpp\ ./classes/Hook.h\ ./classes/Hook.cpp\ ./classes/Patch.h\ ./classes/Patch.cpp\ - ./classes/objects/ElementResults/ElementResultLocal.h\ - ./classes/objects/ElementResults/DoubleElementResult.h\ - ./classes/objects/ElementResults/DoubleElementResult.cpp\ - ./classes/objects/ElementResults/TriaP1ElementResult.h\ - ./classes/objects/ElementResults/TriaP1ElementResult.cpp\ - ./classes/objects/ElementResults/BoolElementResult.h\ - ./classes/objects/ElementResults/BoolElementResult.cpp\ - ./classes/objects/ExternalResults/Results.h\ - ./classes/objects/ExternalResults/Results.cpp\ - ./classes/objects/ExternalResults/ExternalResult.h\ - ./classes/objects/ExternalResults/GenericExternalResult.h\ - ./classes/objects/Elements/Elements.h\ - ./classes/objects/Elements/Elements.cpp\ - ./classes/objects/Elements/Tria.h\ - ./classes/objects/Elements/Tria.cpp\ - ./classes/objects/Elements/TriaHook.h\ - ./classes/objects/Elements/TriaHook.cpp\ - ./classes/objects/Elements/TriaRef.h\ - ./classes/objects/Elements/TriaRef.cpp\ - ./classes/objects/Inputs/Inputs.h\ - ./classes/objects/Inputs/Inputs.cpp\ - ./classes/objects/Inputs/Input.h\ - ./classes/objects/Inputs/InputLocal.h\ - ./classes/objects/Inputs/TriaP1Input.h\ - ./classes/objects/Inputs/TriaP1Input.cpp\ - ./classes/objects/Inputs/BoolInput.h\ - ./classes/objects/Inputs/BoolInput.cpp\ - ./classes/objects/Inputs/IntInput.h\ - ./classes/objects/Inputs/IntInput.cpp\ - ./classes/objects/Inputs/DoubleInput.h\ - ./classes/objects/Inputs/DoubleInput.cpp\ - ./classes/objects/Inputs/DatasetInput.h\ - ./classes/objects/Inputs/DatasetInput.cpp\ - ./classes/objects/Materials/Materials.h\ - ./classes/objects/Materials/Materials.cpp\ - ./classes/objects/Materials/Matice.h\ - ./classes/objects/Materials/Matice.cpp\ - ./classes/objects/Materials/Matdamageice.h\ - ./classes/objects/Materials/Matdamageice.cpp\ - ./classes/objects/Materials/Matpar.h\ - ./classes/objects/Materials/Matpar.cpp\ - ./classes/objects/Constraints/Constraints.h\ - ./classes/objects/Constraints/Constraints.cpp\ - ./classes/objects/Constraints/Constraint.h\ - ./classes/objects/Constraints/SpcStatic.cpp\ - ./classes/objects/Constraints/SpcStatic.h\ - ./classes/objects/Constraints/SpcDynamic.cpp\ - ./classes/objects/Constraints/SpcDynamic.h\ - ./classes/objects/Loads/Loads.h\ - ./classes/objects/Loads/Loads.cpp\ - ./classes/objects/Loads/Penpair.cpp\ - ./classes/objects/Loads/Penpair.h\ - ./classes/objects/Loads/Pengrid.cpp\ - ./classes/objects/Loads/Pengrid.h\ - ./classes/objects/Loads/Icefront.cpp\ - ./classes/objects/Loads/Icefront.h\ - ./classes/objects/Loads/Numericalflux.cpp\ - ./classes/objects/Loads/Numericalflux.h\ + ./classes/ElementResults/ElementResultLocal.h\ + ./classes/ElementResults/DoubleElementResult.h\ + ./classes/ElementResults/DoubleElementResult.cpp\ + ./classes/ElementResults/TriaP1ElementResult.h\ + ./classes/ElementResults/TriaP1ElementResult.cpp\ + ./classes/ElementResults/BoolElementResult.h\ + ./classes/ElementResults/BoolElementResult.cpp\ + ./classes/ExternalResults/Results.h\ + ./classes/ExternalResults/Results.cpp\ + ./classes/ExternalResults/ExternalResult.h\ + ./classes/ExternalResults/GenericExternalResult.h\ + ./classes/Elements/Elements.h\ + ./classes/Elements/Elements.cpp\ + ./classes/Elements/Tria.h\ + ./classes/Elements/Tria.cpp\ + ./classes/Elements/TriaHook.h\ + ./classes/Elements/TriaHook.cpp\ + ./classes/Elements/TriaRef.h\ + ./classes/Elements/TriaRef.cpp\ + ./classes/Inputs/Inputs.h\ + ./classes/Inputs/Inputs.cpp\ + ./classes/Inputs/Input.h\ + ./classes/Inputs/InputLocal.h\ + ./classes/Inputs/TriaP1Input.h\ + ./classes/Inputs/TriaP1Input.cpp\ + ./classes/Inputs/BoolInput.h\ + ./classes/Inputs/BoolInput.cpp\ + ./classes/Inputs/IntInput.h\ + ./classes/Inputs/IntInput.cpp\ + ./classes/Inputs/DoubleInput.h\ + ./classes/Inputs/DoubleInput.cpp\ + ./classes/Inputs/DatasetInput.h\ + ./classes/Inputs/DatasetInput.cpp\ + ./classes/Materials/Materials.h\ + ./classes/Materials/Materials.cpp\ + ./classes/Materials/Matice.h\ + ./classes/Materials/Matice.cpp\ + ./classes/Materials/Matdamageice.h\ + ./classes/Materials/Matdamageice.cpp\ + ./classes/Materials/Matpar.h\ + ./classes/Materials/Matpar.cpp\ + ./classes/Constraints/Constraints.h\ + ./classes/Constraints/Constraints.cpp\ + ./classes/Constraints/Constraint.h\ + ./classes/Constraints/SpcStatic.cpp\ + ./classes/Constraints/SpcStatic.h\ + ./classes/Constraints/SpcDynamic.cpp\ + ./classes/Constraints/SpcDynamic.h\ + ./classes/Loads/Loads.h\ + ./classes/Loads/Loads.cpp\ + ./classes/Loads/Penpair.cpp\ + ./classes/Loads/Penpair.h\ + ./classes/Loads/Pengrid.cpp\ + ./classes/Loads/Pengrid.h\ + ./classes/Loads/Icefront.cpp\ + ./classes/Loads/Icefront.h\ + ./classes/Loads/Numericalflux.cpp\ + ./classes/Loads/Numericalflux.h\ ./classes/matrix/matrixobjects.h\ ./classes/matrix/ElementMatrix.h\ ./classes/matrix/ElementMatrix.cpp\ @@ -132,44 +131,44 @@ ./classes/toolkits/Matrix.h\ ./classes/toolkits/Vector.h\ ./classes/toolkits/Solver.h\ - ./classes/objects/Params/Parameters.h\ - ./classes/objects/Params/Parameters.cpp\ - ./classes/objects/Params/Param.h\ - ./classes/objects/Params/GenericParam.h\ - ./classes/objects/Params/BoolParam.cpp\ - ./classes/objects/Params/BoolParam.h\ - ./classes/objects/Params/IntParam.cpp\ - ./classes/objects/Params/IntParam.h\ - ./classes/objects/Params/IntVecParam.cpp\ - ./classes/objects/Params/IntVecParam.h\ - ./classes/objects/Params/IntMatParam.cpp\ - ./classes/objects/Params/IntMatParam.h\ - ./classes/objects/Params/DoubleParam.cpp\ - ./classes/objects/Params/DoubleParam.h\ - ./classes/objects/Params/FileParam.cpp\ - ./classes/objects/Params/FileParam.h\ - ./classes/objects/Params/StringArrayParam.cpp\ - ./classes/objects/Params/StringArrayParam.h\ - ./classes/objects/Params/DoubleMatParam.cpp\ - ./classes/objects/Params/DoubleMatParam.h\ - ./classes/objects/Params/DoubleTransientMatParam.cpp\ - ./classes/objects/Params/DoubleTransientMatParam.h\ - ./classes/objects/Params/DoubleMatArrayParam.cpp\ - ./classes/objects/Params/DoubleMatArrayParam.h\ - ./classes/objects/Params/DoubleVecParam.cpp\ - ./classes/objects/Params/DoubleVecParam.h\ - ./classes/objects/Params/StringParam.cpp\ - ./classes/objects/Params/StringParam.h\ - ./classes/objects/Params/MatrixParam.h\ - ./classes/objects/Params/MatrixParam.cpp\ - ./classes/objects/Params/VectorParam.h\ - ./classes/objects/Params/VectorParam.cpp\ - ./classes/objects/Params/TransientParam.h\ - ./classes/objects/Params/TransientParam.cpp\ - ./classes/objects/Params/DataSetParam.h\ - ./classes/objects/Params/DataSetParam.cpp\ - ./classes/objects/Profiler.h\ - ./classes/objects/Profiler.cpp\ + ./classes/Params/Parameters.h\ + ./classes/Params/Parameters.cpp\ + ./classes/Params/Param.h\ + ./classes/Params/GenericParam.h\ + ./classes/Params/BoolParam.cpp\ + ./classes/Params/BoolParam.h\ + ./classes/Params/IntParam.cpp\ + ./classes/Params/IntParam.h\ + ./classes/Params/IntVecParam.cpp\ + ./classes/Params/IntVecParam.h\ + ./classes/Params/IntMatParam.cpp\ + ./classes/Params/IntMatParam.h\ + ./classes/Params/DoubleParam.cpp\ + ./classes/Params/DoubleParam.h\ + ./classes/Params/FileParam.cpp\ + ./classes/Params/FileParam.h\ + ./classes/Params/StringArrayParam.cpp\ + ./classes/Params/StringArrayParam.h\ + ./classes/Params/DoubleMatParam.cpp\ + ./classes/Params/DoubleMatParam.h\ + ./classes/Params/DoubleTransientMatParam.cpp\ + ./classes/Params/DoubleTransientMatParam.h\ + ./classes/Params/DoubleMatArrayParam.cpp\ + ./classes/Params/DoubleMatArrayParam.h\ + ./classes/Params/DoubleVecParam.cpp\ + ./classes/Params/DoubleVecParam.h\ + ./classes/Params/StringParam.cpp\ + ./classes/Params/StringParam.h\ + ./classes/Params/MatrixParam.h\ + ./classes/Params/MatrixParam.cpp\ + ./classes/Params/VectorParam.h\ + ./classes/Params/VectorParam.cpp\ + ./classes/Params/TransientParam.h\ + ./classes/Params/TransientParam.cpp\ + ./classes/Params/DataSetParam.h\ + ./classes/Params/DataSetParam.cpp\ + ./classes/Profiler.h\ + ./classes/Profiler.cpp\ ./shared/shared.h\ ./shared/MemOps/MemOps.h\ ./shared/Matrix/matrix.h\ @@ -330,12 +329,12 @@ ./solutionsequences/solutionsequence_linear.cpp\ ./solutionsequences/solutionsequence_nonlinear.cpp\ ./solutionsequences/solutionsequence_newton.cpp\ - ./classes/objects/Options/Options.h\ - ./classes/objects/Options/Options.cpp\ - ./classes/objects/Options/Option.h\ - ./classes/objects/Options/GenericOption.h\ - ./classes/objects/Options/OptionUtilities.cpp\ - ./classes/objects/Options/OptionUtilities.h\ + ./classes/Options/Options.h\ + ./classes/Options/Options.cpp\ + ./classes/Options/Option.h\ + ./classes/Options/GenericOption.h\ + ./classes/Options/OptionUtilities.cpp\ + ./classes/Options/OptionUtilities.h\ ./classes/RiftStruct.cpp\ ./classes/RiftStruct.h #}}} @@ -427,8 +426,8 @@ ./modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h\ ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\ ./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\ - ./classes/objects/Inputs/ControlInput.h\ - ./classes/objects/Inputs/ControlInput.cpp\ + ./classes/Inputs/ControlInput.h\ + ./classes/Inputs/ControlInput.cpp\ ./shared/Numerics/BrentSearch.cpp\ ./shared/Numerics/OptimalSearch.cpp \ ./analyses/control_core.cpp\ @@ -521,8 +520,8 @@ ./modules/GroundinglineMigrationx/GroundinglineMigrationx.h #}}} #Rifts sources {{{ -rifts_sources = ./classes/objects/Loads/Riftfront.cpp\ - ./classes/objects/Loads/Riftfront.h\ +rifts_sources = ./classes/Loads/Riftfront.cpp\ + ./classes/Loads/Riftfront.h\ ./modules/ConstraintsStatex/RiftConstraintsState.cpp #}}} #Android sources {{{ @@ -531,16 +530,16 @@ #3D sources {{{ threed_sources = ./classes/gauss/GaussPenta.h\ ./classes/gauss/GaussPenta.cpp\ - ./classes/objects/ElementResults/PentaP1ElementResult.h\ - ./classes/objects/ElementResults/PentaP1ElementResult.cpp\ - ./classes/objects/Inputs/PentaP1Input.h\ - ./classes/objects/Inputs/PentaP1Input.cpp\ - ./classes/objects/Elements/Penta.h\ - ./classes/objects/Elements/Penta.cpp\ - ./classes/objects/Elements/PentaHook.h\ - ./classes/objects/Elements/PentaHook.cpp\ - ./classes/objects/Elements/PentaRef.h\ - ./classes/objects/Elements/PentaRef.cpp + ./classes/ElementResults/PentaP1ElementResult.h\ + ./classes/ElementResults/PentaP1ElementResult.cpp\ + ./classes/Inputs/PentaP1Input.h\ + ./classes/Inputs/PentaP1Input.cpp\ + ./classes/Elements/Penta.h\ + ./classes/Elements/Penta.cpp\ + ./classes/Elements/PentaHook.h\ + ./classes/Elements/PentaHook.cpp\ + ./classes/Elements/PentaRef.h\ + ./classes/Elements/PentaRef.cpp #}}} #Bamg sources {{{ bamg_sources = ./classes/bamg/bamgobjects.h\ @@ -663,60 +662,60 @@ ./modules/KMLMeshWritex/KMLMeshWritex.cpp\ ./modules/KMLOverlayx/KMLOverlayx.h\ ./modules/KMLOverlayx/KMLOverlayx.cpp\ - ./classes/objects/KML/KML_Attribute.cpp\ - ./classes/objects/KML/KML_Attribute.h\ - ./classes/objects/KML/KML_Comment.cpp\ - ./classes/objects/KML/KML_Comment.h\ - ./classes/objects/KML/KML_ColorStyle.cpp\ - ./classes/objects/KML/KML_ColorStyle.h\ - ./classes/objects/KML/KML_Container.cpp\ - ./classes/objects/KML/KML_Container.h\ - ./classes/objects/KML/KML_Document.cpp\ - ./classes/objects/KML/KML_Document.h\ - ./classes/objects/KML/KML_Feature.cpp\ - ./classes/objects/KML/KML_Feature.h\ - ./classes/objects/KML/KML_File.cpp\ - ./classes/objects/KML/KML_File.h\ - ./classes/objects/KML/KML_Folder.cpp\ - ./classes/objects/KML/KML_Folder.h\ - ./classes/objects/KML/KML_Geometry.cpp\ - ./classes/objects/KML/KML_Geometry.h\ - ./classes/objects/KML/KML_GroundOverlay.cpp\ - ./classes/objects/KML/KML_GroundOverlay.h\ - ./classes/objects/KML/KML_Icon.cpp\ - ./classes/objects/KML/KML_Icon.h\ - ./classes/objects/KML/KML_LatLonBox.cpp\ - ./classes/objects/KML/KML_LatLonBox.h\ - ./classes/objects/KML/KML_LinearRing.cpp\ - ./classes/objects/KML/KML_LinearRing.h\ - ./classes/objects/KML/KML_LineString.cpp\ - ./classes/objects/KML/KML_LineString.h\ - ./classes/objects/KML/KML_LineStyle.cpp\ - ./classes/objects/KML/KML_LineStyle.h\ - ./classes/objects/KML/KML_MultiGeometry.cpp\ - ./classes/objects/KML/KML_MultiGeometry.h\ - ./classes/objects/KML/KML_Object.cpp\ - ./classes/objects/KML/KML_Object.h\ - ./classes/objects/KML/KML_Overlay.cpp\ - ./classes/objects/KML/KML_Overlay.h\ - ./classes/objects/KML/KML_Point.cpp\ - ./classes/objects/KML/KML_Point.h\ - ./classes/objects/KML/KML_Placemark.cpp\ - ./classes/objects/KML/KML_Placemark.h\ - ./classes/objects/KML/KML_Polygon.cpp\ - ./classes/objects/KML/KML_Polygon.h\ - ./classes/objects/KML/KML_PolyStyle.cpp\ - ./classes/objects/KML/KML_PolyStyle.h\ - ./classes/objects/KML/KML_Style.cpp\ - ./classes/objects/KML/KML_Style.h\ - ./classes/objects/KML/KML_StyleSelector.cpp\ - ./classes/objects/KML/KML_StyleSelector.h\ - ./classes/objects/KML/KML_SubStyle.cpp\ - ./classes/objects/KML/KML_SubStyle.h\ - ./classes/objects/KML/KML_Unknown.cpp\ - ./classes/objects/KML/KML_Unknown.h\ - ./classes/objects/KML/KMLFileReadUtils.cpp\ - ./classes/objects/KML/KMLFileReadUtils.h + ./classes/KML/KML_Attribute.cpp\ + ./classes/KML/KML_Attribute.h\ + ./classes/KML/KML_Comment.cpp\ + ./classes/KML/KML_Comment.h\ + ./classes/KML/KML_ColorStyle.cpp\ + ./classes/KML/KML_ColorStyle.h\ + ./classes/KML/KML_Container.cpp\ + ./classes/KML/KML_Container.h\ + ./classes/KML/KML_Document.cpp\ + ./classes/KML/KML_Document.h\ + ./classes/KML/KML_Feature.cpp\ + ./classes/KML/KML_Feature.h\ + ./classes/KML/KML_File.cpp\ + ./classes/KML/KML_File.h\ + ./classes/KML/KML_Folder.cpp\ + ./classes/KML/KML_Folder.h\ + ./classes/KML/KML_Geometry.cpp\ + ./classes/KML/KML_Geometry.h\ + ./classes/KML/KML_GroundOverlay.cpp\ + ./classes/KML/KML_GroundOverlay.h\ + ./classes/KML/KML_Icon.cpp\ + ./classes/KML/KML_Icon.h\ + ./classes/KML/KML_LatLonBox.cpp\ + ./classes/KML/KML_LatLonBox.h\ + ./classes/KML/KML_LinearRing.cpp\ + ./classes/KML/KML_LinearRing.h\ + ./classes/KML/KML_LineString.cpp\ + ./classes/KML/KML_LineString.h\ + ./classes/KML/KML_LineStyle.cpp\ + ./classes/KML/KML_LineStyle.h\ + ./classes/KML/KML_MultiGeometry.cpp\ + ./classes/KML/KML_MultiGeometry.h\ + ./classes/KML/KML_Object.cpp\ + ./classes/KML/KML_Object.h\ + ./classes/KML/KML_Overlay.cpp\ + ./classes/KML/KML_Overlay.h\ + ./classes/KML/KML_Point.cpp\ + ./classes/KML/KML_Point.h\ + ./classes/KML/KML_Placemark.cpp\ + ./classes/KML/KML_Placemark.h\ + ./classes/KML/KML_Polygon.cpp\ + ./classes/KML/KML_Polygon.h\ + ./classes/KML/KML_PolyStyle.cpp\ + ./classes/KML/KML_PolyStyle.h\ + ./classes/KML/KML_Style.cpp\ + ./classes/KML/KML_Style.h\ + ./classes/KML/KML_StyleSelector.cpp\ + ./classes/KML/KML_StyleSelector.h\ + ./classes/KML/KML_SubStyle.cpp\ + ./classes/KML/KML_SubStyle.h\ + ./classes/KML/KML_Unknown.cpp\ + ./classes/KML/KML_Unknown.h\ + ./classes/KML/KMLFileReadUtils.cpp\ + ./classes/KML/KMLFileReadUtils.h #}}} #Petsc sources {{{ petsc_sources= ./toolkits/petsc\ Index: ../trunk-jpl/src/c/classes/objects/Contour.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Contour.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Contour.h (revision 15012) @@ -1,95 +0,0 @@ -/*!\file Contour.h - * \brief: header file for Contour object - */ - -#ifndef _CONTOUR_H_ -#define _CONTOUR_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../shared/Exceptions/exceptions.h" -#include "../../shared/MemOps/MemOps.h" -#include "../../shared/io/io.h" -#include "../../shared/Enum/Enum.h" -#include "./Object.h" -/*}}}*/ - -template -class Contour: public Object{ - - public: - - int id; - int nods; //number of vertices in the contour - doubletype *x; - doubletype *y; - bool closed; //is this contour closed? - - /*Contour constructors, destructors :*/ - /*FUNCTION Contour() {{{*/ - Contour(){ - this->id = 0; - this->nods = 0; - this->x = NULL; - this->y = NULL; - this->closed = false; - } - /*}}}*/ - /*FUNCTION Contour(int pid, int nods, doubletype* x, doubletype* y,bool closed) {{{*/ - Contour(int pid,int pnods, doubletype* px, doubletype* py,bool pclosed){ - - this->id = pid; - this->nods = pnods; - this->closed = pclosed; - if(nods){ - this->x=xNew(nods); - xMemCpy(this->x,px,nods); - this->y=xNew(nods); - xMemCpy(this->y,py,nods); - } - } - /*}}}*/ - /*FUNCTION ~Contour() {{{*/ - ~Contour(){ - xDelete(this->x); - xDelete(this->y); - } - /*}}}*/ - - /*Object virtual function resolutoin: */ - /*FUNCTION Echo(){{{*/ - void Echo(void){ - _printLine_(" Contour: " << id); - _printLine_(" nods: " << nods); - _printLine_(" closed: " << (closed?"true":"false")); - if(nods){ - _printLine_(" x , y:"); - for(int i=0;iEcho(); - } - /*}}}*/ - /*FUNCTION Id(){{{*/ - int Id(void){ - return id; - } - /*}}}*/ - /*FUNCTION ObjectEnum{{{*/ - int ObjectEnum(void){ - return ContourEnum; - } - /*}}}*/ - /*FUNCTION copy {{{*/ - Object* copy() { - return new Contour(*this); - } - /*}}}*/ -}; - -#endif /* _CONTOUR_H_ */ Index: ../trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp (revision 15012) @@ -1,886 +0,0 @@ -/*!\file Matdamageice.c - * \brief: implementation of the Matdamageice object - */ - -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../../classes.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" - -/*Matdamageice constructors and destructor*/ -/*FUNCTION Matdamageice::Matdamageice(){{{*/ -Matdamageice::Matdamageice(){ - this->inputs=NULL; - this->helement=NULL; - return; -} -/*}}}*/ -/*FUNCTION Matdamageice::Matdamageice(int id, int index, IoModel* iomodel, int num_vertices){{{*/ -Matdamageice::Matdamageice(int matice_mid,int index, IoModel* iomodel){ - - /*Intermediaries:*/ - int matice_eid; - - /*Initialize id*/ - this->mid=matice_mid; - - /*Initialize inputs*/ - this->inputs=new Inputs(); - - /*Initialize inputs from IoModel*/ - this->InputUpdateFromIoModel(index,iomodel); - - /*Hooks: */ - matice_eid=index+1; - this->helement=new Hook(&matice_eid,1); - - return; - -} -/*}}}*/ -/*FUNCTION Matdamageice::~Matdamageice(){{{*/ -Matdamageice::~Matdamageice(){ - delete helement; - delete inputs; - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION Matdamageice::Echo {{{*/ -void Matdamageice::Echo(void){ - - _printLine_("Matdamageice:"); - _printLine_(" mid: " << mid); - _printLine_(" inputs:"); - inputs->Echo(); - _printLine_(" element:"); - helement->Echo(); -} -/*}}}*/ -/*FUNCTION Matdamageice::DeepEcho {{{*/ -void Matdamageice::DeepEcho(void){ - - _printLine_("Matdamageice:"); - _printLine_(" mid: " << mid); - _printLine_(" inputs:"); - inputs->DeepEcho(); - _printLine_(" element:"); - helement->Echo(); -} -/*}}}*/ -/*FUNCTION Matdamageice::Id {{{*/ -int Matdamageice::Id(void){ return mid; } -/*}}}*/ -/*FUNCTION Matdamageice::ObjectEnum{{{*/ -int Matdamageice::ObjectEnum(void){ - - return MatdamageiceEnum; - -} -/*}}}*/ -/*FUNCTION Matdamageice::copy {{{*/ -Object* Matdamageice::copy() { - - /*Output*/ - Matdamageice* matice=NULL; - - /*Initialize output*/ - matice=new Matdamageice(); - - /*copy fields: */ - matice->mid=this->mid; - matice->helement=(Hook*)this->helement->copy(); - if(this->inputs) matice->inputs=(Inputs*)this->inputs->Copy(); - else matice->inputs=new Inputs(); - - return matice; -} -/*}}}*/ - -/*Matdamageice management*/ -/*FUNCTION Matdamageice::Configure {{{*/ -void Matdamageice::Configure(Elements* elementsin){ - - /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective - * datasets, using internal ids and offsets hidden in hooks: */ - helement->configure((DataSet*)elementsin); -} -/*}}}*/ -/*FUNCTION Matdamageice::SetCurrentConfiguration {{{*/ -void Matdamageice::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ - -} -/*}}}*/ -/*FUNCTION Matdamageice::GetA {{{*/ -IssmDouble Matdamageice::GetA(){ - /* - * A = 1/B^n - */ - - IssmDouble B,n; - - inputs->GetInputAverage(&B,MaterialsRheologyBEnum); - n=this->GetN(); - - return pow(B,-n); -} -/*}}}*/ -/*FUNCTION Matdamageice::GetB {{{*/ -IssmDouble Matdamageice::GetB(){ - - /*Output*/ - IssmDouble B; - - inputs->GetInputAverage(&B,MaterialsRheologyBEnum); - return B; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetBbar {{{*/ -IssmDouble Matdamageice::GetBbar(){ - - /*Output*/ - IssmDouble Bbar; - - inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum); - return Bbar; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetN {{{*/ -IssmDouble Matdamageice::GetN(){ - - /*Output*/ - IssmDouble n; - - inputs->GetInputAverage(&n,MaterialsRheologyNEnum); - return n; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetZ {{{*/ -IssmDouble Matdamageice::GetZ(){ - - /*Output*/ - IssmDouble Z; - - inputs->GetInputAverage(&Z,MaterialsRheologyZEnum); - return Z; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetZbar {{{*/ -IssmDouble Matdamageice::GetZbar(){ - - /*Output*/ - IssmDouble Zbar; - - inputs->GetInputAverage(&Zbar,MaterialsRheologyZbarEnum); - return Zbar; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetVectorFromInputs{{{*/ -void Matdamageice::GetVectorFromInputs(Vector* vector,int input_enum){ - - /*Intermediaries*/ - Element *element= NULL; - - /*Recover element*/ - element=(Element*)helement->delivers(); - - /*Check that input_enum is a material input*/ - if (!IsInput(input_enum)) return; - - switch(element->ObjectEnum()){ - - case TriaEnum:{ - - /*Prepare index list*/ - int doflist1[3]; - for(int i=0;i<3;i++) doflist1[i]=((Tria*)element)->nodes[i]->GetVertexPid(); - - /*Get input (either in element or material)*/ - Input* input=inputs->GetInput(input_enum); - if(!input) _error_("Input " << EnumToStringx(input_enum) << " not found in material"); - - /*We found the enum. Use its values to fill into the vector, using the vertices ids: */ - input->GetVectorFromInputs(vector,&doflist1[0]);} - break; - - default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosity2d {{{*/ -void Matdamageice::GetViscosity2d(IssmDouble* pviscosity, IssmDouble* epsilon){ - /*From a string tensor and a material object, return viscosity, using Glen's flow law. - Z * B - viscosity= ------------------------------------------------------------------- - 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - - where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity - vector, and n the flow law exponent. - - If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we - return 10^14, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Intermediary: */ - IssmDouble A,e; - IssmDouble Btmp,B,n,Z; - - /*Get B and n*/ - Btmp=GetBbar(); - Z=GetZbar(); - n=GetN(); - B=Z*Btmp; - - if (n==1){ - /*Viscous behaviour! viscosity=B: */ - viscosity=B/2; - } - else{ - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ - viscosity=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - /*Retrive strain rate components: */ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - - /*Build viscosity: viscosity=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy; - if(A==0){ - /*Maxiviscositym viscosity for 0 shear areas: */ - viscosity=2.5*pow(10.,17.); - } - else{ - e=(n-1)/(2*n); - viscosity=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity<=0) _error_("Negative viscosity"); - _assert_(B>0); - _assert_(n>0); - - /*Return: */ - *pviscosity=viscosity; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosity3d {{{*/ -void Matdamageice::GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* epsilon){ - - /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: - * - * B - * viscosity3d= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * where mu is the viscotiy, B the flow law parameter , (u,v) the velocity - * vector, and n the flow law exponent. - * - * If epsilon is NULL, it means this is the first time Emg is being run, and we - * return g, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity3d; - - /*input strain rate: */ - IssmDouble exx,eyy,exy,exz,eyz; - - /*Intermediaries: */ - IssmDouble A,e; - IssmDouble B,n,Z; - - /*Get B, Z and n*/ - n=GetN(); - Z=GetZ(); - B=Z*GetB(); - - if (n==1){ - /*Viscous behaviour! viscosity3d=B: */ - viscosity3d=B/2; - } - else{ - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && - (epsilon[3]==0) && (epsilon[4]==0)){ - viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - - /*Retrive strain rate components: */ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - exz=*(epsilon+3); - eyz=*(epsilon+4); - - /*Build viscosity: viscosity3d=2*B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+pow(exz,2)+pow(eyz,2)+exx*eyy; - if(A==0){ - /*Maxiviscosity3dm viscosity for 0 shear areas: */ - viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/2/n; - - viscosity3d=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity3d<=0) _error_("Negative viscosity"); - _assert_(B>0); - _assert_(n>0); - - /*Assign output pointers:*/ - *pviscosity3d=viscosity3d; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosity3dStokes {{{*/ -void Matdamageice::GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon){ - /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: - * - * B - * viscosity3d= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * where mu is the viscotiy, B the flow law parameter , (u,v) the velocity - * vector, and n the flow law exponent. - * - * If epsilon is NULL, it means this is the first time Emg is being run, and we - * return g, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity3d; - - /*input strain rate: */ - IssmDouble exx,eyy,exy,exz,eyz,ezz; - - /*Intermediaries: */ - IssmDouble A,e; - IssmDouble B,n,Z; - IssmDouble eps0; - - /*Get B and n*/ - eps0=pow((IssmDouble)10,(IssmDouble)-27); - n=GetN(); - Z=GetZ(); - B=Z*GetB(); - - if (n==1){ - /*Viscous behaviour! viscosity3d=B: */ - viscosity3d=B/2; - } - else{ - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && - (epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){ - viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - - /*Retrive strain rate components: */ - exx=*(epsilon+0); - eyy=*(epsilon+1); - ezz=*(epsilon+2); //not used - exy=*(epsilon+3); - exz=*(epsilon+4); - eyz=*(epsilon+5); - - /*Build viscosity: viscosity3d=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+pow(exz,2)+pow(eyz,2)+exx*eyy+pow(eps0,2); - if(A==0){ - /*Maxiviscosity3dm viscosity for 0 shear areas: */ - viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/2/n; - viscosity3d=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity3d<=0) _error_("Negative viscosity"); - _assert_(B>0); - _assert_(n>0); - - /*Assign output pointers:*/ - *pviscosity3d=viscosity3d; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosityComplement {{{*/ -void Matdamageice::GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){ - /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: - * - * 1 - * viscosity= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * If epsilon is NULL, it means this is the first time Gradjb is being run, and we - * return mu20, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity_complement; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Intermediary value A and exponent e: */ - IssmDouble A,e; - IssmDouble B,n; - - /*Get B and n*/ - B=GetBbar(); - n=GetN(); - - if(epsilon){ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - - /*Build viscosity: mu2=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy; - if(A==0){ - /*Maximum viscosity_complement for 0 shear areas: */ - viscosity_complement=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/(2*n); - - viscosity_complement=1/(2*pow(A,e)); - } - } - else{ - viscosity_complement=4.5*pow((IssmDouble)10,(IssmDouble)17); - } - - /*Checks in debugging mode*/ - _assert_(B>0); - _assert_(n>0); - _assert_(viscosity_complement>0); - - /*Return: */ - *pviscosity_complement=viscosity_complement; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosityZComplement {{{*/ -void Matdamageice::GetViscosityZComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){ - /*Return viscosity derivative for control method d(mu)/dZ: - * - * B - * dviscosity= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * If epsilon is NULL, it means this is the first time Gradjb is being run, and we - * return mu20, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity_complement; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Intermediary value A and exponent e: */ - IssmDouble A,e; - IssmDouble B,n; - - /*Get B and n*/ - B=GetBbar(); - n=GetN(); - - if(epsilon){ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - - /*Build viscosity: mu2=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy; - if(A==0){ - /*Maximum viscosity_complement for 0 shear areas: */ - viscosity_complement=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/(2*n); - - viscosity_complement=B/(2*pow(A,e)); - } - } - else{ - viscosity_complement=4.5*pow((IssmDouble)10,(IssmDouble)17); - } - - /*Checks in debugging mode*/ - _assert_(B>0); - _assert_(n>0); - _assert_(viscosity_complement>0); - - /*Return: */ - *pviscosity_complement=viscosity_complement; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosityDerivativeEpsSquare{{{*/ -void Matdamageice::GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ - - /*output: */ - IssmDouble mu_prime; - IssmDouble mu,n,eff2; - - /*input strain rate: */ - IssmDouble exx,eyy,exy,exz,eyz; - - /*Get visocisty and n*/ - GetViscosity3d(&mu,epsilon); - n=GetN(); - - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && - (epsilon[3]==0) && (epsilon[4]==0)){ - mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - /*Retrive strain rate components: */ - exx=epsilon[0]; - eyy=epsilon[1]; - exy=epsilon[2]; - exz=epsilon[3]; - eyz=epsilon[4]; - eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy + exz*exz + eyz*eyz; - - mu_prime=(1-n)/(2*n) * mu/eff2; - } - - /*Assign output pointers:*/ - *pmu_prime=mu_prime; -} -/*}}}*/ -/*FUNCTION Matdamageice::GetViscosity2dDerivativeEpsSquare{{{*/ -void Matdamageice::GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ - - /*output: */ - IssmDouble mu_prime; - IssmDouble mu,n,eff2; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Get visocisty and n*/ - GetViscosity2d(&mu,epsilon); - n=GetN(); - - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ - mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - /*Retrive strain rate components: */ - exx=epsilon[0]; - eyy=epsilon[1]; - exy=epsilon[2]; - eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy ; - - mu_prime=(1-n)/(2*n) * mu/eff2; - } - - /*Assign output pointers:*/ - *pmu_prime=mu_prime; -} -/*}}}*/ -/*FUNCTION Matdamageice::InputDuplicate{{{*/ -void Matdamageice::InputDuplicate(int original_enum,int new_enum){ - - /*Call inputs method*/ - if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum); - -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromVector(IssmDouble* vector, int name, int type){ - - /*Intermediaries*/ - Element *element = NULL; - - /*Recover element*/ - element=(Element*)helement->delivers(); - - /*Check that name is an element input*/ - if (!IsInput(name)) return; - - switch(type){ - - case VertexEnum: - - switch(element->ObjectEnum()){ - - case TriaEnum: { - IssmDouble values[3]; - for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetVertexPid()]; - this->inputs->AddInput(new TriaP1Input(name,values)); - return; - } - default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } - default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); - } -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromVector(int* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromVector(int* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromVector(bool* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ - - /*Intermediaries*/ - Element *element = NULL; - Parameters* parameters= NULL; - int dim; - - /*Recover element*/ - element=(Element*)helement->delivers(); - - /*Check that name is an element input*/ - if (!IsInput(name)) return; - - switch(type){ - - case VertexEnum: - - switch(element->ObjectEnum()){ - - case TriaEnum: { - IssmDouble values[3]; - for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetVertexSid()]; //use sid list, to index into serial oriented vector - this->inputs->AddInput(new TriaP1Input(name,values)); - /*Special case for rheology B in 2D: Pourave land for this solution{{{*/ - if(name==MaterialsRheologyBEnum){ - /*Are we in 2D?:*/ - if(element->ObjectEnum()==TriaEnum){ - parameters=((Tria*)(element))->parameters; - } - else{ - parameters=((Penta*)(element))->parameters; - } - parameters->FindParam(&dim,MeshDimensionEnum); - if(dim==2){ - /*Dupliacte rheology input: */ - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,values)); - } - } - /*}}}*/ - return; - } - default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } - default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromVectorDakota(int* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ -void Matdamageice::InputUpdateFromVectorDakota(bool* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ -void Matdamageice::InputUpdateFromConstant(IssmDouble constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromConstant(int constant, int name) {{{*/ -void Matdamageice::InputUpdateFromConstant(int constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromConstant(bool constant, int name) {{{*/ -void Matdamageice::InputUpdateFromConstant(bool constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromSolution{{{*/ -void Matdamageice::InputUpdateFromSolution(IssmDouble* solution){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matdamageice::InputUpdateFromIoModel{{{*/ -void Matdamageice::InputUpdateFromIoModel(int index, IoModel* iomodel){ - - int i,j; - - int dim; - bool control_analysis; - int num_control_type; - - /*Fetch parameters: */ - iomodel->Constant(&dim,MeshDimensionEnum); - iomodel->Constant(&control_analysis,InversionIscontrolEnum); - if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum); - - /*if 2d*/ - if(dim==2){ - - /*Intermediaries*/ - const int num_vertices = 3; //Tria has 3 vertices - IssmDouble nodeinputs[num_vertices]; - IssmDouble cmmininputs[num_vertices]; - IssmDouble cmmaxinputs[num_vertices]; - - /*Get B*/ - if (iomodel->Data(MaterialsRheologyBEnum)) { - for(i=0;iData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,nodeinputs)); - } - - /*Get n*/ - if (iomodel->Data(MaterialsRheologyNEnum)) { - for(i=0;iData(MaterialsRheologyNEnum)[index]; - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyNEnum,nodeinputs)); - } - - /*Get Z*/ - if (iomodel->Data(MaterialsRheologyZEnum)) { - for(i=0;iData(MaterialsRheologyZEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyZbarEnum,nodeinputs)); - } - - /*Control Inputs*/ - #ifdef _HAVE_CONTROL_ - if (control_analysis && iomodel->Data(InversionControlParametersEnum)){ - for(i=0;i(iomodel->Data(InversionControlParametersEnum)[i])){ - case MaterialsRheologyBbarEnum: - if (iomodel->Data(MaterialsRheologyBEnum)){ - _assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); - for(j=0;jData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); - } - break; - case MaterialsRheologyZbarEnum: - if (iomodel->Data(MaterialsRheologyZEnum)){ - _assert_(iomodel->Data(MaterialsRheologyZEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); - for(j=0;jData(MaterialsRheologyZEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - this->inputs->AddInput(new ControlInput(MaterialsRheologyZbarEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); - } - break; - - } - } - } - #endif - } - - /*if 3d*/ - #ifdef _HAVE_3D_ - else if(dim==3){ - - /*Intermediaries*/ - const int num_vertices = 6; //Penta has 6 vertices - IssmDouble nodeinputs[num_vertices]; - IssmDouble cmmininputs[num_vertices]; - IssmDouble cmmaxinputs[num_vertices]; - - /*Get B*/ - if (iomodel->Data(MaterialsRheologyBEnum)) { - for(i=0;iData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; - this->inputs->AddInput(new PentaP1Input(MaterialsRheologyBEnum,nodeinputs)); - } - - /*Get n*/ - if (iomodel->Data(MaterialsRheologyNEnum)) { - for(i=0;iData(MaterialsRheologyNEnum)[index]; - this->inputs->AddInput(new PentaP1Input(MaterialsRheologyNEnum,nodeinputs)); - } - - /*Get Z*/ - if (iomodel->Data(MaterialsRheologyZEnum)) { - for(i=0;iData(MaterialsRheologyZEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; - this->inputs->AddInput(new PentaP1Input(MaterialsRheologyZEnum,nodeinputs)); - } - - /*Control Inputs*/ - #ifdef _HAVE_CONTROL_ - if (control_analysis && iomodel->Data(InversionControlParametersEnum)){ - for(i=0;i(iomodel->Data(InversionControlParametersEnum)[i])){ - case MaterialsRheologyBbarEnum: - if (iomodel->Data(MaterialsRheologyBEnum)){ - _assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); - for(j=0;jData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); - } - break; - case MaterialsRheologyZbarEnum: - if (iomodel->Data(MaterialsRheologyZEnum)){ - _assert_(iomodel->Data(MaterialsRheologyZEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); - for(j=0;jData(MaterialsRheologyZEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - this->inputs->AddInput(new ControlInput(MaterialsRheologyZEnum,PentaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); - } - break; - } - } - } - #endif - } - #endif - else{ - _error_("Mesh type not supported yet!"); - } - - return; -} -/*}}}*/ -/*FUNCTION Matdamageice::IsInput{{{*/ -bool Matdamageice::IsInput(int name){ - if ( - name==MaterialsRheologyBEnum || - name==MaterialsRheologyBbarEnum || - name==MaterialsRheologyNEnum || - name==MaterialsRheologyZEnum || - name==MaterialsRheologyZbarEnum - ){ - return true; - } - else return false; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Materials/Materials.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Materials.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Materials.cpp (revision 15012) @@ -1,48 +0,0 @@ -/* - * \file Materials.cpp - * \brief: Implementation of Materials class, derived from DataSet class. - */ - -/*Headers: {{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Materials.h" -#include "../../../shared/shared.h" -#include "./Material.h" - -using namespace std; -/*}}}*/ - -/*Object constructors and destructor*/ -/*FUNCTION Materials::Materials(){{{*/ -Materials::Materials(){ - enum_type=MaterialsEnum; - return; -} -/*}}}*/ -/*FUNCTION Materials::~Materials(){{{*/ -Materials::~Materials(){ - return; -} -/*}}}*/ - -/*Object management*/ -/*FUNCTION Materials::Configure{{{*/ -void Materials::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){ - - vector::iterator object; - Material* material=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - material=dynamic_cast(*object); - material->Configure(elements); - - } - -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Materials/Matice.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Matice.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Matice.cpp (revision 15012) @@ -1,785 +0,0 @@ -/*!\file Matice.c - * \brief: implementation of the Matice object - */ - -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "./Matice.h" -#include "./Materials.h" -#include "../Inputs/Input.h" -#include "../Inputs/Inputs.h" -#include "../Inputs/TriaP1Input.h" -#include "../Inputs/PentaP1Input.h" -#include "../Inputs/ControlInput.h" -#include "../Elements/Element.h" -#include "../Elements/Tria.h" -#include "../Elements/Penta.h" -#include "../Params/Parameters.h" -#include "../../Hook.h" -#include "../Node.h" -#include "../../IoModel.h" -#include "../../../shared/shared.h" - -/*Matice constructors and destructor*/ -/*FUNCTION Matice::Matice(){{{*/ -Matice::Matice(){ - this->inputs=NULL; - this->helement=NULL; - return; -} -/*}}}*/ -/*FUNCTION Matice::Matice(int id, int index, IoModel* iomodel, int num_vertices){{{*/ -Matice::Matice(int matice_mid,int index, IoModel* iomodel){ - - /*Intermediaries:*/ - int matice_eid; - - /*Initialize id*/ - this->mid=matice_mid; - - /*Initialize inputs*/ - this->inputs=new Inputs(); - - /*Initialize inputs from IoModel*/ - this->InputUpdateFromIoModel(index,iomodel); - - /*Hooks: */ - matice_eid=index+1; - this->helement=new Hook(&matice_eid,1); - - return; - -} -/*}}}*/ -/*FUNCTION Matice::~Matice(){{{*/ -Matice::~Matice(){ - delete helement; - delete inputs; - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION Matice::Echo {{{*/ -void Matice::Echo(void){ - - _printLine_("Matice:"); - _printLine_(" mid: " << mid); - _printLine_(" inputs:"); - inputs->Echo(); - _printLine_(" element:"); - helement->Echo(); -} -/*}}}*/ -/*FUNCTION Matice::DeepEcho {{{*/ -void Matice::DeepEcho(void){ - - _printLine_("Matice:"); - _printLine_(" mid: " << mid); - _printLine_(" inputs:"); - inputs->DeepEcho(); - _printLine_(" element:"); - helement->Echo(); -} -/*}}}*/ -/*FUNCTION Matice::Id {{{*/ -int Matice::Id(void){ return mid; } -/*}}}*/ -/*FUNCTION Matice::ObjectEnum{{{*/ -int Matice::ObjectEnum(void){ - - return MaticeEnum; - -} -/*}}}*/ -/*FUNCTION Matice::copy {{{*/ -Object* Matice::copy() { - - /*Output*/ - Matice* matice=NULL; - - /*Initialize output*/ - matice=new Matice(); - - /*copy fields: */ - matice->mid=this->mid; - matice->helement=(Hook*)this->helement->copy(); - if(this->inputs) matice->inputs=(Inputs*)this->inputs->Copy(); - else matice->inputs=new Inputs(); - - return matice; -} -/*}}}*/ - -/*Matice management*/ -/*FUNCTION Matice::Configure {{{*/ -void Matice::Configure(Elements* elementsin){ - - /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective - * datasets, using internal ids and offsets hidden in hooks: */ - helement->configure((DataSet*)elementsin); -} -/*}}}*/ -/*FUNCTION Matice::SetCurrentConfiguration {{{*/ -void Matice::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ - -} -/*}}}*/ -/*FUNCTION Matice::GetA {{{*/ -IssmDouble Matice::GetA(){ - /* - * A = 1/B^n - */ - - IssmDouble B,n; - - inputs->GetInputAverage(&B,MaterialsRheologyBEnum); - n=this->GetN(); - - return pow(B,-n); -} -/*}}}*/ -/*FUNCTION Matice::GetB {{{*/ -IssmDouble Matice::GetB(){ - - /*Output*/ - IssmDouble B; - - inputs->GetInputAverage(&B,MaterialsRheologyBEnum); - return B; -} -/*}}}*/ -/*FUNCTION Matice::GetBbar {{{*/ -IssmDouble Matice::GetBbar(){ - - /*Output*/ - IssmDouble Bbar; - - inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum); - return Bbar; -} -/*}}}*/ -/*FUNCTION Matice::GetN {{{*/ -IssmDouble Matice::GetN(){ - - /*Output*/ - IssmDouble n; - - inputs->GetInputAverage(&n,MaterialsRheologyNEnum); - return n; -} -/*}}}*/ -/*FUNCTION Matice::GetVectorFromInputs{{{*/ -void Matice::GetVectorFromInputs(Vector* vector,int input_enum){ - - /*Intermediaries*/ - Element *element= NULL; - - /*Recover element*/ - element=(Element*)helement->delivers(); - - /*Check that input_enum is a material input*/ - if (!IsInput(input_enum)) return; - - switch(element->ObjectEnum()){ - - case TriaEnum:{ - - /*Prepare index list*/ - int doflist1[3]; - for(int i=0;i<3;i++) doflist1[i]=((Tria*)element)->nodes[i]->GetVertexPid(); - - /*Get input (either in element or material)*/ - Input* input=inputs->GetInput(input_enum); - if(!input) _error_("Input " << EnumToStringx(input_enum) << " not found in material"); - - /*We found the enum. Use its values to fill into the vector, using the vertices ids: */ - input->GetVectorFromInputs(vector,&doflist1[0]);} - break; - - default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } -} -/*}}}*/ -/*FUNCTION Matice::GetViscosity2d {{{*/ -void Matice::GetViscosity2d(IssmDouble* pviscosity, IssmDouble* epsilon){ - /*From a string tensor and a material object, return viscosity, using Glen's flow law. - B - viscosity= ------------------------------------------------------------------- - 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - - where viscosity is the viscotiy, B the flow law parameter , (u,v) the velocity - vector, and n the flow law exponent. - - If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we - return 10^14, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Intermediary: */ - IssmDouble A,e; - IssmDouble B,n; - - /*Get B and n*/ - B=GetBbar(); - n=GetN(); - - if (n==1){ - /*Viscous behaviour! viscosity=B: */ - viscosity=B/2; - } - else{ - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ - viscosity=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - /*Retrive strain rate components: */ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - - /*Build viscosity: viscosity=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy; - if(A==0){ - /*Maxiviscositym viscosity for 0 shear areas: */ - viscosity=2.5*pow(10.,17.); - } - else{ - e=(n-1)/(2*n); - viscosity=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity<=0) _error_("Negative viscosity"); - _assert_(B>0); - _assert_(n>0); - - /*Return: */ - *pviscosity=viscosity; -} -/*}}}*/ -/*FUNCTION Matice::GetViscosity3d {{{*/ -void Matice::GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* epsilon){ - - /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: - * - * B - * viscosity3d= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * where mu is the viscotiy, B the flow law parameter , (u,v) the velocity - * vector, and n the flow law exponent. - * - * If epsilon is NULL, it means this is the first time Emg is being run, and we - * return g, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity3d; - - /*input strain rate: */ - IssmDouble exx,eyy,exy,exz,eyz; - - /*Intermediaries: */ - IssmDouble A,e; - IssmDouble B,n; - - /*Get B and n*/ - B=GetB(); - n=GetN(); - - if (n==1){ - /*Viscous behaviour! viscosity3d=B: */ - viscosity3d=B/2; - } - else{ - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && - (epsilon[3]==0) && (epsilon[4]==0)){ - viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - - /*Retrive strain rate components: */ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - exz=*(epsilon+3); - eyz=*(epsilon+4); - - /*Build viscosity: viscosity3d=2*B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+pow(exz,2)+pow(eyz,2)+exx*eyy; - if(A==0){ - /*Maxiviscosity3dm viscosity for 0 shear areas: */ - viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/2/n; - - viscosity3d=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity3d<=0) _error_("Negative viscosity"); - _assert_(B>0); - _assert_(n>0); - - /*Assign output pointers:*/ - *pviscosity3d=viscosity3d; -} -/*}}}*/ -/*FUNCTION Matice::GetViscosity3dStokes {{{*/ -void Matice::GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon){ - /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: - * - * B - * viscosity3d= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * where mu is the viscotiy, B the flow law parameter , (u,v) the velocity - * vector, and n the flow law exponent. - * - * If epsilon is NULL, it means this is the first time Emg is being run, and we - * return g, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity3d; - - /*input strain rate: */ - IssmDouble exx,eyy,exy,exz,eyz,ezz; - - /*Intermediaries: */ - IssmDouble A,e; - IssmDouble B,n; - IssmDouble eps0; - - /*Get B and n*/ - eps0=pow((IssmDouble)10,(IssmDouble)-27); - B=GetB(); - n=GetN(); - - if (n==1){ - /*Viscous behaviour! viscosity3d=B: */ - viscosity3d=B/2; - } - else{ - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && - (epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){ - viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - - /*Retrive strain rate components: */ - exx=*(epsilon+0); - eyy=*(epsilon+1); - ezz=*(epsilon+2); //not used - exy=*(epsilon+3); - exz=*(epsilon+4); - eyz=*(epsilon+5); - - /*Build viscosity: viscosity3d=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+pow(exz,2)+pow(eyz,2)+exx*eyy+pow(eps0,2); - if(A==0){ - /*Maxiviscosity3dm viscosity for 0 shear areas: */ - viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/2/n; - viscosity3d=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity3d<=0) _error_("Negative viscosity"); - _assert_(B>0); - _assert_(n>0); - - /*Assign output pointers:*/ - *pviscosity3d=viscosity3d; -} -/*}}}*/ -/*FUNCTION Matice::GetViscosityComplement {{{*/ -void Matice::GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){ - /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: - * - * 1 - * viscosity= ------------------------------------------------------------------- - * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] - * - * If epsilon is NULL, it means this is the first time Gradjb is being run, and we - * return mu20, initial viscosity. - */ - - /*output: */ - IssmDouble viscosity_complement; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Intermediary value A and exponent e: */ - IssmDouble A,e; - IssmDouble B,n; - - /*Get B and n*/ - B=GetBbar(); - n=GetN(); - - if(epsilon){ - exx=*(epsilon+0); - eyy=*(epsilon+1); - exy=*(epsilon+2); - - /*Build viscosity: mu2=B/(2*A^e) */ - A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy; - if(A==0){ - /*Maximum viscosity_complement for 0 shear areas: */ - viscosity_complement=2.25*pow((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/(2*n); - - viscosity_complement=1/(2*pow(A,e)); - } - } - else{ - viscosity_complement=4.5*pow((IssmDouble)10,(IssmDouble)17); - } - - /*Checks in debugging mode*/ - _assert_(B>0); - _assert_(n>0); - _assert_(viscosity_complement>0); - - /*Return: */ - *pviscosity_complement=viscosity_complement; -} -/*}}}*/ -/*FUNCTION Matice::GetViscosityDerivativeEpsSquare{{{*/ -void Matice::GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ - - /*output: */ - IssmDouble mu_prime; - IssmDouble mu,n,eff2; - - /*input strain rate: */ - IssmDouble exx,eyy,exy,exz,eyz; - - /*Get visocisty and n*/ - GetViscosity3d(&mu,epsilon); - n=GetN(); - - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && - (epsilon[3]==0) && (epsilon[4]==0)){ - mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - /*Retrive strain rate components: */ - exx=epsilon[0]; - eyy=epsilon[1]; - exy=epsilon[2]; - exz=epsilon[3]; - eyz=epsilon[4]; - eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy + exz*exz + eyz*eyz; - - mu_prime=(1-n)/(2*n) * mu/eff2; - } - - /*Assign output pointers:*/ - *pmu_prime=mu_prime; -} -/*}}}*/ -/*FUNCTION Matice::GetViscosity2dDerivativeEpsSquare{{{*/ -void Matice::GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ - - /*output: */ - IssmDouble mu_prime; - IssmDouble mu,n,eff2; - - /*input strain rate: */ - IssmDouble exx,eyy,exy; - - /*Get visocisty and n*/ - GetViscosity2d(&mu,epsilon); - n=GetN(); - - if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ - mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); - } - else{ - /*Retrive strain rate components: */ - exx=epsilon[0]; - eyy=epsilon[1]; - exy=epsilon[2]; - eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy ; - - mu_prime=(1-n)/(2*n) * mu/eff2; - } - - /*Assign output pointers:*/ - *pmu_prime=mu_prime; -} -/*}}}*/ -/*FUNCTION Matice::InputDuplicate{{{*/ -void Matice::InputDuplicate(int original_enum,int new_enum){ - - /*Call inputs method*/ - if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum); - -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type){ - - /*Intermediaries*/ - Element *element = NULL; - - /*Recover element*/ - element=(Element*)helement->delivers(); - - /*Check that name is an element input*/ - if (!IsInput(name)) return; - - switch(type){ - - case VertexEnum: - - switch(element->ObjectEnum()){ - - case TriaEnum: { - IssmDouble values[3]; - for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetVertexPid()]; - this->inputs->AddInput(new TriaP1Input(name,values)); - return; - } - default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } - default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); - } -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromVector(int* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromVector(int* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromVector(bool* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ - - /*Intermediaries*/ - Element *element = NULL; - Parameters* parameters= NULL; - int dim; - - /*Recover element*/ - element=(Element*)helement->delivers(); - - /*Check that name is an element input*/ - if (!IsInput(name)) return; - - switch(type){ - - case VertexEnum: - - switch(element->ObjectEnum()){ - - case TriaEnum: { - IssmDouble values[3]; - for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetVertexSid()]; //index into serial oriented vector - this->inputs->AddInput(new TriaP1Input(name,values)); - /*Special case for rheology B in 2D: Pourave land for this solution{{{*/ - if(name==MaterialsRheologyBEnum){ - /*Are we in 2D?:*/ - if(element->ObjectEnum()==TriaEnum){ - parameters=((Tria*)(element))->parameters; - } - else{ - parameters=((Penta*)(element))->parameters; - } - parameters->FindParam(&dim,MeshDimensionEnum); - if(dim==2){ - /*Dupliacte rheology input: */ - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,values)); - } - } - /*}}}*/ - return; - } - default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } - default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromVectorDakota(int* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ -void Matice::InputUpdateFromVectorDakota(bool* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ -void Matice::InputUpdateFromConstant(IssmDouble constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromConstant(int constant, int name) {{{*/ -void Matice::InputUpdateFromConstant(int constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromConstant(bool constant, int name) {{{*/ -void Matice::InputUpdateFromConstant(bool constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromSolution{{{*/ -void Matice::InputUpdateFromSolution(IssmDouble* solution){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matice::InputUpdateFromIoModel{{{*/ -void Matice::InputUpdateFromIoModel(int index, IoModel* iomodel){ - - int i,j; - - int dim; - bool control_analysis; - int num_control_type; - - /*Fetch parameters: */ - iomodel->Constant(&dim,MeshDimensionEnum); - iomodel->Constant(&control_analysis,InversionIscontrolEnum); - if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum); - - /*if 2d*/ - if(dim==2){ - - /*Intermediaries*/ - const int num_vertices = 3; //Tria has 3 vertices - IssmDouble nodeinputs[num_vertices]; - IssmDouble cmmininputs[num_vertices]; - IssmDouble cmmaxinputs[num_vertices]; - - /*Get B*/ - if (iomodel->Data(MaterialsRheologyBEnum)) { - for(i=0;iData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,nodeinputs)); - } - - /*Get n*/ - if (iomodel->Data(MaterialsRheologyNEnum)) { - for(i=0;iData(MaterialsRheologyNEnum)[index]; - this->inputs->AddInput(new TriaP1Input(MaterialsRheologyNEnum,nodeinputs)); - } - - /*Control Inputs*/ - #ifdef _HAVE_CONTROL_ - if (control_analysis && iomodel->Data(InversionControlParametersEnum)){ - for(i=0;i(iomodel->Data(InversionControlParametersEnum)[i])){ - case MaterialsRheologyBbarEnum: - if (iomodel->Data(MaterialsRheologyBEnum)){ - _assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); - for(j=0;jData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); - } - break; - } - } - } - #endif - } - - /*if 3d*/ - #ifdef _HAVE_3D_ - else if(dim==3){ - - /*Intermediaries*/ - const int num_vertices = 6; //Penta has 6 vertices - IssmDouble nodeinputs[num_vertices]; - IssmDouble cmmininputs[num_vertices]; - IssmDouble cmmaxinputs[num_vertices]; - - /*Get B*/ - if (iomodel->Data(MaterialsRheologyBEnum)) { - for(i=0;iData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; - this->inputs->AddInput(new PentaP1Input(MaterialsRheologyBEnum,nodeinputs)); - } - - /*Get n*/ - if (iomodel->Data(MaterialsRheologyNEnum)) { - for(i=0;iData(MaterialsRheologyNEnum)[index]; - this->inputs->AddInput(new PentaP1Input(MaterialsRheologyNEnum,nodeinputs)); - } - - /*Control Inputs*/ - #ifdef _HAVE_CONTROL_ - if (control_analysis && iomodel->Data(InversionControlParametersEnum)){ - for(i=0;i(iomodel->Data(InversionControlParametersEnum)[i])){ - case MaterialsRheologyBbarEnum: - if (iomodel->Data(MaterialsRheologyBEnum)){ - _assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); - for(j=0;jData(MaterialsRheologyBEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[reCast(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); - } - break; - } - } - } - #endif - } - #endif - else{ - _error_("Mesh type not supported yet!"); - } - - return; -} -/*}}}*/ -/*FUNCTION Matice::IsInput{{{*/ -bool Matice::IsInput(int name){ - if ( - name==MaterialsRheologyBEnum || - name==MaterialsRheologyBbarEnum || - name==MaterialsRheologyNEnum - ){ - return true; - } - else return false; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Materials/Material.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Material.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Material.h (revision 15012) @@ -1,43 +0,0 @@ -/*!\file: Material.h - * \brief abstract class for Material object - */ - -#ifndef _MATERIAL_H_ -#define _MATERIAL_H_ - -/*Headers:*/ -/*{{{*/ -class Inputs; -template class Vector; -#include "../Object.h" -#include "../../Update.h" -class Elements; -/*}}}*/ - -class Material: public Object,public Update{ - - public: - Inputs* inputs; - virtual ~Material(){}; - /*WARNING: input should not be public but it is an easy way to update B from T (using UpdateFromSolution) from Pentas*/ - - /*Numerics*/ - virtual void InputDuplicate(int original_enum,int new_enum)=0; - virtual void Configure(Elements* elements)=0; - virtual void GetVectorFromInputs(Vector* vector,int input_enum)=0; - virtual void GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon)=0; - virtual void GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon)=0; - virtual void GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon)=0; - virtual void GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0; - virtual void GetViscosityZComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0; - virtual void GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0; - virtual void GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0; - virtual IssmDouble GetA()=0; - virtual IssmDouble GetB()=0; - virtual IssmDouble GetBbar()=0; - virtual IssmDouble GetN()=0; - virtual IssmDouble GetZ()=0; - virtual IssmDouble GetZbar()=0; - -}; -#endif Index: ../trunk-jpl/src/c/classes/objects/Materials/Matpar.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Matpar.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Matpar.cpp (revision 15012) @@ -1,466 +0,0 @@ -/*!\file Matpar.c - * \brief: implementation of the Matpar object - */ - -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../../classes.h" -#include "../../../shared/shared.h" -#include "../../../shared/Enum/Enum.h" - -/*Matpar constructors and destructor*/ -/*FUNCTION Matpar::Matpar() {{{*/ -Matpar::Matpar(){ - return; -} -/*}}}*/ -/*FUNCTION Matpar::Matpar(int matpar_mid,IoModel* iomodel){{{*/ -Matpar::Matpar(int matpar_mid, IoModel* iomodel){ - - bool ispdd; - bool isefficientlayer; - int hydrology_model; - iomodel->Constant(&hydrology_model,HydrologyModelEnum); - iomodel->Constant(&ispdd,SurfaceforcingsIspddEnum); - - this->mid = matpar_mid; - iomodel->Constant(&this->rho_ice,MaterialsRhoIceEnum); - iomodel->Constant(&this->rho_water,MaterialsRhoWaterEnum); - iomodel->Constant(&this->rho_freshwater,MaterialsRhoFreshwaterEnum); - iomodel->Constant(&this->mu_water,MaterialsMuWaterEnum); - iomodel->Constant(&this->heatcapacity,MaterialsHeatcapacityEnum); - iomodel->Constant(&this->thermalconductivity,MaterialsThermalconductivityEnum); - iomodel->Constant(&this->latentheat,MaterialsLatentheatEnum); - iomodel->Constant(&this->beta,MaterialsBetaEnum); - iomodel->Constant(&this->meltingpoint,MaterialsMeltingpointEnum); - iomodel->Constant(&this->referencetemperature,ConstantsReferencetemperatureEnum); - iomodel->Constant(&this->mixed_layer_capacity,MaterialsMixedLayerCapacityEnum); - iomodel->Constant(&this->thermal_exchange_velocity,MaterialsThermalExchangeVelocityEnum); - iomodel->Constant(&this->g,ConstantsGEnum); - - if(ispdd){ - iomodel->Constant(&this->desfac,SurfaceforcingsDesfacEnum); - iomodel->Constant(&this->s0p,SurfaceforcingsS0pEnum); - } - - if(hydrology_model==HydrologyshreveEnum){ - iomodel->Constant(&this->hydro_CR,HydrologyshreveCREnum); - iomodel->Constant(&this->hydro_kn,HydrologyshreveKnEnum); - iomodel->Constant(&this->hydro_n,HydrologyshreveNEnum); - iomodel->Constant(&this->hydro_p,HydrologyshrevePEnum); - iomodel->Constant(&this->hydro_q,HydrologyshreveQEnum); - } - else if(hydrology_model==HydrologydcEnum){ - iomodel->Constant(&this->sediment_compressibility,HydrologydcSedimentCompressibilityEnum); - iomodel->Constant(&this->sediment_porosity,HydrologydcSedimentPorosityEnum); - iomodel->Constant(&this->sediment_thickness,HydrologydcSedimentThicknessEnum); - iomodel->Constant(&this->sediment_transmitivity,HydrologydcSedimentTransmitivityEnum); - iomodel->Constant(&this->water_compressibility,HydrologydcWaterCompressibilityEnum); - iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum); - - if(isefficientlayer){ - iomodel->Constant(&this->epl_compressibility,HydrologydcEplCompressibilityEnum); - iomodel->Constant(&this->epl_porosity,HydrologydcEplPorosityEnum); - iomodel->Constant(&this->epl_thickness,HydrologydcEplThicknessEnum); - iomodel->Constant(&this->epl_transmitivity,HydrologydcEplTransmitivityEnum); - } - } - else{ - _error_("Hydrology model "<Constant(&this->lithosphere_shear_modulus,MaterialsLithosphereShearModulusEnum); - iomodel->Constant(&this->lithosphere_density,MaterialsLithosphereDensityEnum); - iomodel->Constant(&this->mantle_shear_modulus,MaterialsMantleShearModulusEnum); - iomodel->Constant(&this->mantle_density,MaterialsMantleDensityEnum); - - /*Unit conversion: */ - this->UnitConversion(); - - this->inputs=NULL; /*not used here*/ -} -/*}}}*/ -/*FUNCTION Matpar::~Matpar() {{{*/ -Matpar::~Matpar(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION Matpar::Echo {{{*/ -void Matpar::Echo(void){ - - _printLine_("Matpar:"); - _printLine_(" mid: " << mid); - _printLine_(" rho_ice: " << rho_ice); - _printLine_(" rho_water: " << rho_water); - _printLine_(" rho_freshwater: " << rho_freshwater); - _printLine_(" mu_water: " << mu_water); - _printLine_(" heatcapacity: " << heatcapacity); - _printLine_(" thermalconductivity: " << thermalconductivity); - _printLine_(" latentheat: " << latentheat); - _printLine_(" beta: " << beta); - _printLine_(" meltingpoint: " << meltingpoint); - _printLine_(" referencetemperature: " << referencetemperature); - _printLine_(" mixed_layer_capacity: " << mixed_layer_capacity); - _printLine_(" thermal_exchange_velocity: " << thermal_exchange_velocity); - _printLine_(" g: " << g); - _printLine_(" desfac: " << desfac); - _printLine_(" s0p: " << s0p); - return; -} -/*}}}*/ -/*FUNCTION Matpar::DeepEcho {{{*/ -void Matpar::DeepEcho(void){ - - this->Echo(); -} -/*}}}*/ -/*FUNCTION Matpar::Id {{{*/ -int Matpar::Id(void){ return mid; } -/*}}}*/ -/*FUNCTION Matpar::ObjectEnum{{{*/ -int Matpar::ObjectEnum(void){ - - return MatparEnum; - -} -/*}}}*/ -/*FUNCTION Matpar::copy {{{*/ -Object* Matpar::copy() { - return new Matpar(*this); -} -/*}}}*/ - -/*Update virtual functions definitions:*/ -/*FUNCTION Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromVector(int* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromVector(int* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromVector(bool* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromVector(bool* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromVectorDakota(int* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromVectorDakota(int* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromVectorDakota(bool* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromVectorDakota(bool* vector, int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ -void Matpar::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ -void Matpar::InputUpdateFromConstant(IssmDouble constant, int name){ - - switch(name){ - case MaterialsRhoIceEnum: - this->rho_ice=constant; - break; - case MaterialsRhoWaterEnum: - this->rho_water=constant; - break; - case MaterialsRhoFreshwaterEnum: - this->rho_freshwater=constant; - break; - case MaterialsMuWaterEnum: - this->mu_water=constant; - break; - case MaterialsHeatcapacityEnum: - this->heatcapacity=constant; - break; - case MaterialsThermalconductivityEnum: - this->thermalconductivity=constant; - break; - case MaterialsLatentheatEnum: - this->latentheat=constant; - break; - case MaterialsBetaEnum: - this->beta=constant; - break; - case MaterialsMeltingpointEnum: - this->meltingpoint=constant; - break; - case ConstantsReferencetemperatureEnum: - this->referencetemperature=constant; - break; - case MaterialsMixedLayerCapacityEnum: - this->mixed_layer_capacity=constant; - break; - case MaterialsThermalExchangeVelocityEnum: - this->thermalconductivity=constant; - break; - case ConstantsGEnum: - this->g=constant; - break; - case SurfaceforcingsDesfacEnum: - this->desfac=constant; - break; - case SurfaceforcingsS0pEnum: - this->s0p=constant; - break; - default: - break; - } - -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromConstant(int constant, int name) {{{*/ -void Matpar::InputUpdateFromConstant(int constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromConstant(bool constant, int name) {{{*/ -void Matpar::InputUpdateFromConstant(bool constant, int name){ - /*Nothing updated yet*/ -} -/*}}}*/ -/*FUNCTION Matpar::InputUpdateFromSolution{{{*/ -void Matpar::InputUpdateFromSolution(IssmDouble* solution){ - /*Nothing updated yet*/ -} -/*}}}*/ - -/*Matpar management: */ -/*FUNCTION Matpar::Configure {{{*/ -void Matpar::Configure(Elements* elementsin){ - - /*nothing done yet!*/ - -} -/*}}}*/ -/*FUNCTION Matpar::GetBeta {{{*/ -IssmDouble Matpar::GetBeta(){ - return beta; -} -/*}}}*/ -/*FUNCTION Matpar::GetG {{{*/ -IssmDouble Matpar::GetG(){ - return g; -} -/*}}}*/ -/*FUNCTION Matpar::GetHeatCapacity {{{*/ -IssmDouble Matpar::GetHeatCapacity(){ - return heatcapacity; -} -/*}}}*/ -/*FUNCTION Matpar::GetLatentHeat {{{*/ -IssmDouble Matpar::GetLatentHeat(){ - return latentheat; -} -/*}}}*/ -/*FUNCTION Matpar::GetMeltingPoint {{{*/ -IssmDouble Matpar::GetMeltingPoint(){ - return meltingpoint; -} -/*}}}*/ -/*FUNCTION Matpar::GetReferenceTemperature {{{*/ -IssmDouble Matpar::GetReferenceTemperature(){ - return referencetemperature; -} -/*}}}*/ -/*FUNCTION Matpar::GetMixedLayerCapacity {{{*/ -IssmDouble Matpar::GetMixedLayerCapacity(){ - return mixed_layer_capacity; -} -/*}}}*/ -/*FUNCTION Matpar::GetRhoIce {{{*/ -IssmDouble Matpar::GetRhoIce(){ - - return rho_ice; -} -/*}}}*/ -/*FUNCTION Matpar::GetRhoWater {{{*/ -IssmDouble Matpar::GetRhoWater(){ - return rho_water; -} -/*}}}*/ -/*FUNCTION Matpar::GetRhoFreshwater {{{*/ -IssmDouble Matpar::GetRhoFreshwater(){ - return rho_freshwater; -} -/*}}}*/ -/*FUNCTION Matpar::GetMuWater {{{*/ -IssmDouble Matpar::GetMuWater(){ - return mu_water; -} -/*}}}*/ -/*FUNCTION Matpar::GetDesFac {{{*/ -IssmDouble Matpar::GetDesFac(){ - return desfac; -} -/*}}}*/ -/*FUNCTION Matpar::GetS0p {{{*/ -IssmDouble Matpar::GetS0p(){ - return s0p; -} -/*}}}*/ -/*FUNCTION Matpar::GetThermalConductivity {{{*/ -IssmDouble Matpar::GetThermalConductivity(){ - return thermalconductivity; -} -/*}}}*/ -/*FUNCTION Matpar::GetThermalExchangeVelocity {{{*/ -IssmDouble Matpar::GetThermalExchangeVelocity(){ - return thermal_exchange_velocity; -} -/*}}}*/ -/*FUNCTION Matpar::GetHydrologyKn {{{*/ -IssmDouble Matpar::GetHydrologyKn(){ - return hydro_kn; -} -/*}}}*/ -/*FUNCTION Matpar::GetHydrologyP {{{*/ -IssmDouble Matpar::GetHydrologyP(){ - return hydro_p; -} -/*}}}*/ -/*FUNCTION Matqar::GetHydrologyQ {{{*/ -IssmDouble Matpar::GetHydrologyQ(){ - return hydro_q; -} -/*}}}*/ -/*FUNCTION Matpar::GetHydrologyCR {{{*/ -IssmDouble Matpar::GetHydrologyCR(){ - return hydro_CR; -} -/*}}}*/ -/*FUNCTION Matpar::GetHydrologyN {{{*/ -IssmDouble Matpar::GetHydrologyN(){ - return hydro_n; -} -/*}}}*/ -/*FUNCTION Matpar::GetSedimentStoring {{{*/ -IssmDouble Matpar::GetSedimentStoring(){ - return this->rho_freshwater* this->g* this->sediment_porosity* this->sediment_thickness* - ( this->water_compressibility+( this->sediment_compressibility/ this->sediment_porosity)); -} -/*}}}*/ -/*FUNCTION Matpar::GetEplStoring {{{*/ -IssmDouble Matpar::GetEplStoring(){ - return this->rho_freshwater* this->g* this->epl_porosity* this->epl_thickness* - ( this->water_compressibility+( this->epl_compressibility/ this->epl_porosity)); -} -/*}}}*/ -/*FUNCTION Matpar::GetSedimentTransitivity {{{*/ -IssmDouble Matpar::GetSedimentTransmitivity(){ - return sediment_transmitivity; -} -/*}}}*/ -/*FUNCTION Matpar::GetEplTransitivity {{{*/ -IssmDouble Matpar::GetEplTransmitivity(){ - return epl_transmitivity; -} -/*}}}*/ -/*FUNCTION Matpar::TMeltingPoint {{{*/ -IssmDouble Matpar::TMeltingPoint(IssmDouble pressure){ - return meltingpoint-beta*pressure; -} -/*}}}*/ -/*FUNCTION Matpar::PureIceEnthalpy{{{*/ -IssmDouble Matpar::PureIceEnthalpy(IssmDouble pressure){ - return heatcapacity*(TMeltingPoint(pressure)-referencetemperature); -} -/*}}}*/ -/*FUNCTION Matpar::GetEnthalpyDiffusionParameter{{{*/ -IssmDouble Matpar::GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){ - if(enthalpylithosphere_density,1,ExtToIuEnum,MaterialsLithosphereDensityEnum); - ::UnitConversion(&this->mantle_density,1,ExtToIuEnum,MaterialsMantleDensityEnum); - -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Materials/Matdamageice.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Matdamageice.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Matdamageice.h (revision 15012) @@ -1,69 +0,0 @@ -/*!\file Matdamageice.h - * \brief: header file for matice object - */ - -#ifndef MATDAMAGEICE_H_ -#define MATDAMAGEICE_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Material.h" -class IoModel; -/*}}}*/ - -class Matdamageice: public Material{ - - private: - int mid; - Hook* helement; - - public: - /*Matdamageice constructors, destructors: {{{*/ - Matdamageice(); - Matdamageice(int mid,int i, IoModel* iomodel); - ~Matdamageice(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Update virtual functions definitions: {{{*/ - void InputUpdateFromVector(IssmDouble* vector, int name, int type); - void InputUpdateFromVector(int* vector, int name, int type); - void InputUpdateFromVector(bool* vector, int name, int type); - void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrow, int ncols, int name, int type); - void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); - void InputUpdateFromVectorDakota(int* vector, int name, int type); - void InputUpdateFromVectorDakota(bool* vector, int name, int type); - void InputUpdateFromConstant(IssmDouble constant, int name); - void InputUpdateFromConstant(int constant, int name); - void InputUpdateFromConstant(bool constant, int name); - void InputUpdateFromSolution(IssmDouble* solution); - void InputUpdateFromIoModel(int index, IoModel* iomodel); - /*}}}*/ - /*Material virtual functions resolution: {{{*/ - void InputDuplicate(int original_enum,int new_enum); - void Configure(Elements* elements); - void GetVectorFromInputs(Vector* vector,int input_enum); - void SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin); - void GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon); - void GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon); - void GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon); - void GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon); - void GetViscosityZComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon); - void GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); - void GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); - IssmDouble GetA(); - IssmDouble GetB(); - IssmDouble GetBbar(); - IssmDouble GetN(); - IssmDouble GetZ(); - IssmDouble GetZbar(); - bool IsInput(int name); - /*}}}*/ -}; - -#endif /* _MATICE_H_ */ Index: ../trunk-jpl/src/c/classes/objects/Materials/Materials.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Materials.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Materials.h (revision 15012) @@ -1,29 +0,0 @@ -#ifndef _CONTAINER_MATERIALS_H_ -#define _CONTAINER_MATERIALS_H_ - -/*forward declarations */ -#include "../DataSet.h" -class Parameters; -class Elements; -class Vertices; -class Loads; -class Nodes; - -/*! \brief Declaration of Materials class. - * - * Declaration of Materials class. Materials are vector lists (Containers) of Material objects. - */ -class Materials: public DataSet{ - - public: - - /*constructors, destructors*/ - Materials(); - ~Materials(); - - /*numerics*/ - void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); - -}; - -#endif //ifndef _MATERIALS_H_ Index: ../trunk-jpl/src/c/classes/objects/Materials/Matice.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Matice.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Matice.h (revision 15012) @@ -1,78 +0,0 @@ -/*!\file Matice.h - * \brief: header file for matice object - */ - -#ifndef MATICE_H_ -#define MATICE_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Material.h" -#include "../../Hook.h" -class IoModel; - -class Elements; -class Loads; -class Nodes; -class Vertices; -class Materials; -class Parameters; - -/*}}}*/ - -class Matice: public Material{ - - private: - int mid; - Hook *helement; - - public: - /*Matice constructors, destructors: {{{*/ - Matice(); - Matice(int mid,int i, IoModel* iomodel); - ~Matice(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Update virtual functions definitions: {{{*/ - void InputUpdateFromVector(IssmDouble* vector, int name, int type); - void InputUpdateFromVector(int* vector, int name, int type); - void InputUpdateFromVector(bool* vector, int name, int type); - void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrow, int ncols, int name, int type); - void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); - void InputUpdateFromVectorDakota(int* vector, int name, int type); - void InputUpdateFromVectorDakota(bool* vector, int name, int type); - void InputUpdateFromConstant(IssmDouble constant, int name); - void InputUpdateFromConstant(int constant, int name); - void InputUpdateFromConstant(bool constant, int name); - void InputUpdateFromSolution(IssmDouble* solution); - void InputUpdateFromIoModel(int index, IoModel* iomodel); - /*}}}*/ - /*Material virtual functions resolution: {{{*/ - void InputDuplicate(int original_enum,int new_enum); - void Configure(Elements* elements); - void GetVectorFromInputs(Vector* vector,int input_enum); - void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); - void GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon); - void GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon); - void GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon); - void GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon); - void GetViscosityZComplement(IssmDouble*, IssmDouble*){_error_("not supported");}; - void GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); - void GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); - IssmDouble GetA(); - IssmDouble GetB(); - IssmDouble GetBbar(); - IssmDouble GetZ(){_error_("not supported");}; - IssmDouble GetZbar(){_error_("not supported");}; - IssmDouble GetN(); - bool IsInput(int name); - /*}}}*/ -}; - -#endif /* _MATICE_H_ */ Index: ../trunk-jpl/src/c/classes/objects/Materials/Matpar.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/Matpar.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/Matpar.h (revision 15012) @@ -1,142 +0,0 @@ -/*!\file Matpar.h - * \brief: header file for matpar object - */ - -#ifndef _MATPAR_H_ -#define _MATPAR_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Material.h" -class IoModel; -/*}}}*/ - -class Matpar: public Material{ - - private: - int mid; - IssmDouble rho_ice; - IssmDouble rho_water; - IssmDouble rho_freshwater; - IssmDouble mu_water; - IssmDouble heatcapacity; - IssmDouble thermalconductivity; - IssmDouble latentheat; - IssmDouble beta; - IssmDouble meltingpoint; - IssmDouble referencetemperature; - IssmDouble mixed_layer_capacity; - IssmDouble thermal_exchange_velocity; - IssmDouble g; - IssmDouble desfac; - IssmDouble s0p; - - /*hydrology Shreve: */ - IssmDouble hydro_kn; - IssmDouble hydro_p; - IssmDouble hydro_q; - IssmDouble hydro_CR; - IssmDouble hydro_n; - - /*hydrology Dual Porous Continuum: */ - IssmDouble sediment_compressibility; - IssmDouble sediment_porosity; - IssmDouble sediment_thickness; - IssmDouble sediment_transmitivity; - IssmDouble water_compressibility; - - IssmDouble epl_compressibility; - IssmDouble epl_porosity; - IssmDouble epl_thickness; - IssmDouble epl_transmitivity; - - /*gia: */ - IssmDouble lithosphere_shear_modulus; - IssmDouble lithosphere_density; - IssmDouble mantle_shear_modulus; - IssmDouble mantle_density; - - public: - Matpar(); - Matpar(int matpar_id, IoModel* iomodel); - ~Matpar(); - - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object *copy(); - /*}}}*/ - /*Update virtual functions resolution: {{{*/ - void InputUpdateFromVector(IssmDouble* vector, int name, int type); - void InputUpdateFromVector(int* vector, int name, int type); - void InputUpdateFromVector(bool* vector, int name, int type); - void InputUpdateFromMatrixDakota(IssmDouble* matrix,int nrows,int ncols, int name, int type); - void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); - void InputUpdateFromVectorDakota(int* vector, int name, int type); - void InputUpdateFromVectorDakota(bool* vector, int name, int type); - void InputUpdateFromConstant(IssmDouble constant, int name); - void InputUpdateFromConstant(int constant, int name); - void InputUpdateFromConstant(bool constant, int name); - void InputUpdateFromSolution(IssmDouble* solution); - void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; - /*}}}*/ - /*Material virtual functions resolution: {{{*/ - void InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");}; - void Configure(Elements* elements); - void GetVectorFromInputs(Vector* vector,int input_enum){return;} - void GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");}; - void GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon){_error_("not supported");}; - void GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon){_error_("not supported");}; - void GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");}; - void GetViscosityZComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");}; - void GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");}; - void GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");}; - IssmDouble GetA(){_error_("not supported");}; - IssmDouble GetB(){_error_("not supported");}; - IssmDouble GetBbar(){_error_("not supported");}; - IssmDouble GetN(){_error_("not supported");}; - IssmDouble GetZ(){_error_("not supported");}; - IssmDouble GetZbar(){_error_("not supported");}; - /*}}}*/ - /*Numerics: {{{*/ - IssmDouble GetG(); - IssmDouble GetRhoIce(); - IssmDouble GetRhoWater(); - IssmDouble GetRhoFreshwater(); - IssmDouble GetMuWater(); - IssmDouble GetMixedLayerCapacity(); - IssmDouble GetThermalExchangeVelocity(); - IssmDouble GetHeatCapacity(); - IssmDouble GetThermalConductivity(); - IssmDouble GetLatentHeat(); - IssmDouble GetBeta(); - IssmDouble GetMeltingPoint(); - IssmDouble GetReferenceTemperature(); - IssmDouble GetHydrologyKn(); - IssmDouble GetHydrologyP(); - IssmDouble GetHydrologyQ(); - IssmDouble GetHydrologyCR(); - IssmDouble GetHydrologyN(); - IssmDouble GetSedimentStoring(); - IssmDouble GetEplStoring(); - IssmDouble GetSedimentTransmitivity(); - IssmDouble GetEplTransmitivity(); - IssmDouble TMeltingPoint(IssmDouble pressure); - IssmDouble PureIceEnthalpy(IssmDouble pressure); - IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure); - IssmDouble GetLithosphereShearModulus(); - IssmDouble GetLithosphereDensity(); - IssmDouble GetMantleShearModulus(); - IssmDouble GetMantleDensity(); - void EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure); - void ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure); - IssmDouble GetDesFac(); - IssmDouble GetS0p(); - void UnitConversion(void); - /*}}}*/ - -}; - -#endif /* _MATPAR_H_ */ Index: ../trunk-jpl/src/c/classes/objects/Materials/CMakeLists.txt =================================================================== --- ../trunk-jpl/src/c/classes/objects/Materials/CMakeLists.txt (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Materials/CMakeLists.txt (revision 15012) @@ -1,10 +0,0 @@ -# Subdirectories {{{ -# }}} -# Include Directory {{{ -include_directories(AFTER $ENV{ISSM_DIR}/src/c/classes/objects/Materials) -# }}} -# CORE_SOURCES {{{ -set(CORE_SOURCES $ENV{ISSM_DIR}/src/c/classes/objects/Materials/Matdamageice.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Materials/Matice.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Materials/Matpar.cpp PARENT_SCOPE) -# }}} Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Comment.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Comment.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Comment.h (revision 15012) @@ -1,44 +0,0 @@ -/*! \file KML_Comment.h - * \brief: header file for kml_comment object - */ - -#ifndef _KML_COMMENT_H_ -#define _KML_COMMENT_H_ - -/*Headers:{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "../Object.h" -class DataSet; -/*}}}*/ - -class KML_Comment: public Object { - - public: - - char* name; - char* value; - - /*KML_Comment constructors, destructors {{{*/ - KML_Comment(); - ~KML_Comment(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - virtual void Echo(); - virtual void DeepEcho(); - virtual void DeepEcho(const char* indent); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - - /*virtual functions: */ - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void Alloc(const char* valuei); - void Add(DataSet* commnt); - void Get(char** pvalueo); - -}; -#endif /* _KML_COMMENT_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Object.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Object.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Object.h (revision 15012) @@ -1,50 +0,0 @@ -/*! \file KML_Object.h - * \brief: header file for kml_object abstract object - */ - -#ifndef _KML_OBJECT_H_ -#define _KML_OBJECT_H_ - -/*Headers:{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "../Object.h" -class DataSet; -/*}}}*/ - -class KML_Object: public Object { - - public: - - DataSet* attrib; - DataSet* commnt; - DataSet* kmlobj; - - /*KML_Object constructors, destructors {{{*/ - KML_Object(); - ~KML_Object(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - virtual void Echo(); - virtual void DeepEcho(); - virtual void DeepEcho(const char* indent); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - - /*virtual functions: */ - virtual void Write(FILE* fid,const char* indent)=0; - virtual void Read(FILE* fid,char* kstr)=0; - virtual void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - virtual void AddAttrib(const char* name,const char* value); - virtual void FindAttrib(char** pvalue,char* name,char* deflt); - virtual void WriteAttrib(FILE* fid,const char* indent); - virtual void AddCommnt(int ncom,char** pcom); - virtual void AddCommnt(char* value); - virtual void FindCommnt(char** pvalue,int inum); - virtual void WriteCommnt(FILE* fid,const char* indent); - -}; -#endif /* _KML_OBJECT_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Folder.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Folder.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Folder.cpp (revision 15012) @@ -1,124 +0,0 @@ -/*!\file KML_Folder.cpp - * \brief: implementation of the kml_folder object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Folder::KML_Folder(){{{*/ -KML_Folder::KML_Folder(){ - - ; - -} -/*}}}*/ -/*FUNCTION KML_Folder::~KML_Folder(){{{*/ -KML_Folder::~KML_Folder(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Folder::Echo {{{*/ -void KML_Folder::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Folder:"); - KML_Container::Echo(); - - return; -} -/*}}}*/ -/*FUNCTION KML_Folder::DeepEcho {{{*/ -void KML_Folder::DeepEcho(){ - - char indent[81]=""; - - KML_Folder::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Folder::DeepEcho {{{*/ -void KML_Folder::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Folder:"); - KML_Container::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Folder::Write {{{*/ -void KML_Folder::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Container::Write(filout,indent); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Folder::Read {{{*/ -void KML_Folder::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_MultiGeometry.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_MultiGeometry.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_MultiGeometry.h (revision 15012) @@ -1,41 +0,0 @@ -/*! \file KML_MultiGeometry.h - * \brief: header file for kml_multigeometry object - */ - -#ifndef _KML_MULTIGEOMETRY_H_ -#define _KML_MULTIGEOMETRY_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Geometry.h" -class KML_Geometry; -class DataSet; -/*}}}*/ - -class KML_MultiGeometry: public KML_Geometry { - - public: - - DataSet* geometry; - - /*KML_MultiGeometry constructors, destructors {{{*/ - KML_MultiGeometry(); - ~KML_MultiGeometry(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_MULTIGEOMETRY_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_LineStyle.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_LineStyle.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_LineStyle.h (revision 15012) @@ -1,38 +0,0 @@ -/*! \file KML_LineStyle.h - * \brief: header file for kml_linestyle object - */ - -#ifndef _KML_LINESTYLE_H_ -#define _KML_LINESTYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_ColorStyle.h" -/*}}}*/ - -class KML_LineStyle: public KML_ColorStyle { - - public: - - float width; - - /*KML_LineStyle constructors, destructors {{{*/ - KML_LineStyle(); - ~KML_LineStyle(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LINESTYLE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Document.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Document.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Document.cpp (revision 15012) @@ -1,124 +0,0 @@ -/*!\file KML_Document.cpp - * \brief: implementation of the kml_document object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Document::KML_Document(){{{*/ -KML_Document::KML_Document(){ - - ; - -} -/*}}}*/ -/*FUNCTION KML_Document::~KML_Document(){{{*/ -KML_Document::~KML_Document(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Document::Echo {{{*/ -void KML_Document::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Document:"); - KML_Container::Echo(); - - return; -} -/*}}}*/ -/*FUNCTION KML_Document::DeepEcho {{{*/ -void KML_Document::DeepEcho(){ - - char indent[81]=""; - - KML_Document::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Document::DeepEcho {{{*/ -void KML_Document::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Document:"); - KML_Container::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Document::Write {{{*/ -void KML_Document::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Container::Write(filout,indent); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Document::Read {{{*/ -void KML_Document::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.h (revision 15012) @@ -1,36 +0,0 @@ -/*! \file KML_SubStyle.h - * \brief: header file for kml_substyle abstract object - */ - -#ifndef _KML_SUBSTYLE_H_ -#define _KML_SUBSTYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Object.h" -/*}}}*/ - -class KML_SubStyle: public KML_Object { - - public: - - /*KML_SubStyle constructors, destructors {{{*/ - KML_SubStyle(); - ~KML_SubStyle(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_SUBSTYLE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_File.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_File.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_File.cpp (revision 15012) @@ -1,137 +0,0 @@ -/*!\file KML_File.cpp - * \brief: implementation of the kml_file object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_File::KML_File(){{{*/ -KML_File::KML_File(){ - - ; - -} -/*}}}*/ -/*FUNCTION KML_File::~KML_File(){{{*/ -KML_File::~KML_File(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_File::Echo {{{*/ -void KML_File::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_File:"); - KML_Object::Echo(); - - return; -} -/*}}}*/ -/*FUNCTION KML_File::DeepEcho {{{*/ -void KML_File::DeepEcho(){ - - char indent[81]=""; - - KML_File::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_File::DeepEcho {{{*/ -void KML_File::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_File:"); - KML_Object::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_File::Write {{{*/ -void KML_File::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Object::Write(filout,indent); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_File::Read {{{*/ -void KML_File::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_File::WriteExp {{{*/ -void KML_File::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - -/* loop over the kml objects for the file */ - - for (i=0; iSize(); i++) - ((KML_Object *)kmlobj->GetObjectByOffset(i))->WriteExp(fid,nstr,sgn,cm,sp); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.cpp (revision 15012) @@ -1,133 +0,0 @@ -/*!\file KML_Overlay.cpp - * \brief: implementation of the kml_overlay abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Overlay::KML_Overlay(){{{*/ -KML_Overlay::KML_Overlay(){ - - strcpy(color ,"ffffffff"); - memcpy(color,"ffffffff",(strlen("ffffffff")+1)*sizeof(char)); - - draword = 0; - icon =NULL; - -} -/*}}}*/ -/*FUNCTION KML_Overlay::~KML_Overlay(){{{*/ -KML_Overlay::~KML_Overlay(){ - - if (icon) { - delete icon; - icon =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Overlay::Echo {{{*/ -void KML_Overlay::Echo(){ - - KML_Feature::Echo(); - _pprintLine_(" color: \"" << color << "\""); - _pprintLine_(" draword: " << draword); - _pprintLine_(" icon: " << icon); -} -/*}}}*/ -/*FUNCTION KML_Overlay::DeepEcho {{{*/ -void KML_Overlay::DeepEcho(){ - - char indent[81]=""; - - KML_Overlay::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Overlay::DeepEcho {{{*/ -void KML_Overlay::DeepEcho(const char* indent){ - - char indent2[81]; - KML_Feature::DeepEcho(indent); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - _pprintLine_(indent << " color: " << color); - _pprintLine_(indent << " draword: " << draword); - if (icon) - icon->DeepEcho(indent2); - else - _pprintLine_(indent << " icon: " << icon); -} -/*}}}*/ -/*FUNCTION KML_Overlay::Write {{{*/ -void KML_Overlay::Write(FILE* filout,const char* indent){ - - char indent2[81]; - - KML_Feature::Write(filout,indent); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - - if (color && strlen(color)) - fprintf(filout,"%s %s\n",indent,color); - fprintf(filout,"%s %d\n",indent,draword); - if (icon) - icon->Write(filout,indent2); - - return; -} -/*}}}*/ -/*FUNCTION KML_Overlay::Read {{{*/ -void KML_Overlay::Read(FILE* fid,char* kstr){ - -/* process field within opening and closing tags */ - - if (!strncmp(kstr,"(kstr); - return; - } - else if (!strncmp(kstr,"")) - KMLFileTokenParse( color ,NULL,KML_OVERLAY_COLOR_LENGTH, - kstr, - fid); - else if (!strcmp(kstr,"")) - KMLFileTokenParse(&draword , - kstr, - fid); - - else if (!strncmp(kstr,"Read(fid,kstr); - } - - else if (!strncmp(kstr,"<",1)) - KML_Feature::Read(fid,kstr); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Container.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Container.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Container.cpp (revision 15012) @@ -1,166 +0,0 @@ -/*!\file KML_Container.cpp - * \brief: implementation of the kml_container abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Container::KML_Container(){{{*/ -KML_Container::KML_Container(){ - - feature =new DataSet; - -} -/*}}}*/ -/*FUNCTION KML_Container::~KML_Container(){{{*/ -KML_Container::~KML_Container(){ - - if (feature) { - delete feature; - feature =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Container::Echo {{{*/ -void KML_Container::Echo(){ - - bool flag=true; - - KML_Feature::Echo(); - - if(flag) _pprintLine_(" feature: (size=" << feature->Size() << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Container::DeepEcho {{{*/ -void KML_Container::DeepEcho(){ - - char indent[81]=""; - - KML_Container::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Container::DeepEcho {{{*/ -void KML_Container::DeepEcho(const char* indent){ - - int i; - char indent2[81]; - bool flag=true; - - KML_Feature::DeepEcho(indent); - -/* loop over the features for the container */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (feature->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " feature: -------- begin [" << i << "] --------"); - ((KML_Feature *)feature->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " feature: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " feature: [empty]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Container::Write {{{*/ -void KML_Container::Write(FILE* filout,const char* indent){ - - int i; - char indent2[81]; - - KML_Feature::Write(filout,indent); - -/* loop over the features for the container */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - - for (i=0; iSize(); i++) - ((KML_Feature *)feature->GetObjectByOffset(i))->Write(filout,indent2); - - return; -} -/*}}}*/ -/*FUNCTION KML_Container::Read {{{*/ -void KML_Container::Read(FILE* fid,char* kstr){ - - KML_Object* kobj; - -/* process field within opening and closing tags */ - - if (!strncmp(kstr,"(kstr); - return; - } - else if (!strncmp(kstr,"Read(fid,kstr); - feature ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - feature ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - feature ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - feature ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"<",1)) - KML_Feature::Read(fid,kstr); - - return; -} -/*}}}*/ -/*FUNCTION KML_Container::WriteExp {{{*/ -void KML_Container::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - -/* loop over the features for the container */ - - for (i=0; iSize(); i++) - ((KML_Object *)feature->GetObjectByOffset(i))->WriteExp(fid,nstr,sgn,cm,sp); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_LineString.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_LineString.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_LineString.h (revision 15012) @@ -1,45 +0,0 @@ -/*! \file KML_LineString.h - * \brief: header file for kml_linestring object - */ - -#ifndef _KML_LINESTRING_H_ -#define _KML_LINESTRING_H_ - -#define KML_LINESTRING_ALTMODE_LENGTH 18 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Geometry.h" -/*}}}*/ - -class KML_LineString: public KML_Geometry { - - public: - - bool extrude; - bool tessellate; - char altmode[KML_LINESTRING_ALTMODE_LENGTH+1]; - int ncoord; - double *coords; - - /*KML_LineString constructors, destructors {{{*/ - KML_LineString(); - ~KML_LineString(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LINESTRING_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.cpp (revision 15012) @@ -1,295 +0,0 @@ -/*!\file KML_Polygon.cpp - * \brief: implementation of the kml_polygon object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Polygon::KML_Polygon(){{{*/ -KML_Polygon::KML_Polygon(){ - - extrude =false; - tessellate=false; - memcpy(altmode,"clampToGround",(strlen("clampToGround")+1)*sizeof(char)); - - outer =new DataSet; - inner =new DataSet; - -} -/*}}}*/ -/*FUNCTION KML_Polygon::~KML_Polygon(){{{*/ -KML_Polygon::~KML_Polygon(){ - - if (inner) { - delete inner; - inner =NULL; - } - - if (outer) { - delete outer; - outer =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Polygon::Echo {{{*/ -void KML_Polygon::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Polygon:"); - KML_Geometry::Echo(); - - if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(" tessellate: " << (tessellate ? "true" : "false")); - if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(" outer: (size=" << outer->Size() << ")"); - if(flag) _pprintLine_(" inner: (size=" << inner->Size() << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Polygon::DeepEcho {{{*/ -void KML_Polygon::DeepEcho(){ - - char indent[81]=""; - - KML_Polygon::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Polygon::DeepEcho {{{*/ -void KML_Polygon::DeepEcho(const char* indent){ - - int i; - char indent2[81]; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Polygon:"); - KML_Geometry::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(indent << " tessellate: " << (tessellate ? "true" : "false")); - if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (outer->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " outer: -------- begin [" << i << "] --------"); - ((KML_LinearRing *)outer->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " outer: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " outer: [empty]"); - - if (inner->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " inner: -------- begin [" << i << "] --------"); - ((KML_LinearRing *)inner->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " inner: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " inner: [empty]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Polygon::Write {{{*/ -void KML_Polygon::Write(FILE* filout,const char* indent){ - - int i; - char indent4[81]; - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Geometry::Write(filout,indent); - - fprintf(filout,"%s %d\n",indent,(extrude ? 1 : 0)); - fprintf(filout,"%s %d\n",indent,(tessellate ? 1 : 0)); - fprintf(filout,"%s %s\n",indent,altmode); - - memcpy(indent4,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent4," "); - -/* check outer boundary for the polygon */ - - fprintf(filout,"%s \n",indent); - if (outer->Size()) - ((KML_LinearRing *)outer->GetObjectByOffset(0))->Write(filout,indent4); - fprintf(filout,"%s \n",indent); - -/* loop over any inner boundaries for the polygon */ - - for (i=0; iSize(); i++) { - fprintf(filout,"%s \n",indent); - ((KML_LinearRing *)inner->GetObjectByOffset(i))->Write(filout,indent4); - fprintf(filout,"%s \n",indent); - } - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Polygon::Read {{{*/ -void KML_Polygon::Read(FILE* fid,char* kstr){ - - char* kstri; - char* kstrj; - int ncom=0; - char** pcom=NULL; - KML_Object* kobj; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&extrude , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&tessellate, - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( altmode ,NULL,KML_POLYGON_ALTMODE_LENGTH, - kstri, - fid); - - else if (!strcmp(kstri,"")) - -/* loop over and process fields within outer boundary */ - - while (kstrj=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstrj,"(kstrj); - break; - } - else if (!strncmp(kstrj,"Read(fid,kstrj); - outer ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstrj,"<",1)) - KML_Geometry::Read(fid,kstrj); - - xDelete(kstrj); - } - - else if (!strcmp(kstri,"")) - -/* loop over and process fields within inner boundaries */ - - while (kstrj=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstrj,"(kstrj); - break; - } - else if (!strncmp(kstrj,"Read(fid,kstrj); - inner ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstrj,"<",1)) - KML_Geometry::Read(fid,kstrj); - - xDelete(kstrj); - } - - else if (!strncmp(kstri,"<",1)) - KML_Geometry::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_Polygon::WriteExp {{{*/ -void KML_Polygon::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - char nstr2[81]; - -/* check outer boundary for the polygon */ - - if (outer->Size()) { - if (strlen(nstr)) - sprintf(nstr2,"%s (outer)",nstr); - else - sprintf(nstr2,"(outer)"); - - ((KML_LinearRing *)outer->GetObjectByOffset(0))->WriteExp(fid,nstr2,sgn,cm,sp); - } - -/* loop over any inner boundaries for the polygon */ - - for (i=0; iSize(); i++) { - if (strlen(nstr)) - sprintf(nstr2,"%s (inner %d of %d)",nstr,i+1,inner->Size()); - else - sprintf(nstr2,"(inner %d of %d)",i+1,inner->Size()); - - ((KML_LinearRing *)inner->GetObjectByOffset(i))->WriteExp(fid,nstr2,sgn,cm,sp); - } - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp (revision 15012) @@ -1,180 +0,0 @@ -/*!\file KML_Icon.cpp - * \brief: implementation of the kml_feature abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Icon::KML_Icon(){{{*/ -KML_Icon::KML_Icon(){ - - strcpy(href ,""); - strcpy(refmode ,"onChange"); - refint = 4.; - strcpy(vrefmode ,"never"); - vreftime = 4.; - vboundsc = 1.; - strcpy(vformat ,""); - strcpy(hquery ,""); - -} -/*}}}*/ -/*FUNCTION KML_Icon::~KML_Icon(){{{*/ -KML_Icon::~KML_Icon(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Icon::Echo {{{*/ -void KML_Icon::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Icon:"); - KML_Object::Echo(); - - if(flag) _pprintLine_(" href: \"" << href << "\""); - if(flag) _pprintLine_(" refmode: \"" << refmode << "\""); - if(flag) _pprintLine_(" refint: " << refint); - if(flag) _pprintLine_(" vrefmode: \"" << vrefmode << "\""); - if(flag) _pprintLine_(" vreftime: " << vreftime); - if(flag) _pprintLine_(" vboundsc: " << vboundsc); - if(flag) _pprintLine_(" vformat: \"" << vformat << "\""); - if(flag) _pprintLine_(" hquery: \"" << hquery << "\""); - - return; -} -/*}}}*/ -/*FUNCTION KML_Icon::DeepEcho {{{*/ -void KML_Icon::DeepEcho(){ - - char indent[81]=""; - - KML_Icon::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Icon::DeepEcho {{{*/ -void KML_Icon::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Icon:"); - KML_Object::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " href: \"" << href << "\""); - if(flag) _pprintLine_(indent << " refmode: \"" << refmode << "\""); - if(flag) _pprintLine_(indent << " refint: " << refint); - if(flag) _pprintLine_(indent << " vrefmode: \"" << vrefmode << "\""); - if(flag) _pprintLine_(indent << " vreftime: " << vreftime); - if(flag) _pprintLine_(indent << " vboundsc: " << vboundsc); - if(flag) _pprintLine_(indent << " vformat: \"" << vformat << "\""); - if(flag) _pprintLine_(indent << " hquery: \"" << hquery << "\""); - - return; -} -/*}}}*/ -/*FUNCTION KML_Icon::Write {{{*/ -void KML_Icon::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Object::Write(filout,indent); - - if (href && strlen(href)) - fprintf(filout,"%s %s\n",indent,href); - if (refmode && strlen(refmode)) - fprintf(filout,"%s %s\n",indent,refmode); - fprintf(filout,"%s %g\n",indent,refint); - if (vrefmode && strlen(vrefmode)) - fprintf(filout,"%s %s\n",indent,vrefmode); - fprintf(filout,"%s %g\n",indent,vreftime); - fprintf(filout,"%s %g\n",indent,vboundsc); - if (vformat && strlen(vformat)) - fprintf(filout,"%s %s\n",indent,vformat); - if (hquery && strlen(hquery)) - fprintf(filout,"%s %s\n",indent,hquery); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Icon::Read {{{*/ -void KML_Icon::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse( href ,NULL,KML_ICON_HREF_LENGTH, kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( refmode ,NULL,KML_ICON_REFMODE_LENGTH, kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&refint , kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( vrefmode ,NULL,KML_ICON_VREFMODE_LENGTH, kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&vreftime , kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&vboundsc , kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( vformat ,NULL,KML_ICON_VFORMAT_LENGTH, kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( hquery ,NULL,KML_ICON_HQUERY_LENGTH, kstri, fid); - - else if (!strncmp(kstri,"<",1)) - KML_Object::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/CMakeLists.txt =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/CMakeLists.txt (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/CMakeLists.txt (revision 15012) @@ -1,34 +0,0 @@ -# Subdirectories {{{ -# }}} -# Include Directory {{{ -include_directories(AFTER $ENV{ISSM_DIR}/src/c/classes/objects/KML) -# }}} -# KML_SOURCES {{{ -set(KML_SOURCES $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Attribute.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_ColorStyle.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Comment.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Container.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Document.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Feature.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_File.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Folder.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Geometry.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_GroundOverlay.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Icon.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_LatLonBox.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_LinearRing.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_LineString.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_LineStyle.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_MultiGeometry.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Object.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Overlay.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Placemark.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Point.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Polygon.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_PolyStyle.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Style.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_StyleSelector.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_SubStyle.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KML_Unknown.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/KML/KMLFileReadUtils.cpp PARENT_SCOPE) -# }}} Index: ../trunk-jpl/src/c/classes/objects/KML/KML_LinearRing.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_LinearRing.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_LinearRing.cpp (revision 15012) @@ -1,228 +0,0 @@ -/*!\file KML_LinearRing.cpp - * \brief: implementation of the kml_linearring object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -#include "../../../modules/Ll2xyx/Ll2xyx.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_LinearRing::KML_LinearRing(){{{*/ -KML_LinearRing::KML_LinearRing(){ - - extrude =false; - tessellate=false; - memcpy(altmode,"clampToGround",(strlen("clampToGround")+1)*sizeof(char)); - - ncoord =0; - coords =NULL; - -} -/*}}}*/ -/*FUNCTION KML_LinearRing::~KML_LinearRing(){{{*/ -KML_LinearRing::~KML_LinearRing(){ - - if (coords) xDelete(coords); - - coords =NULL; - ncoord =0; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_LinearRing::Echo {{{*/ -void KML_LinearRing::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_LinearRing:"); - KML_Geometry::Echo(); - - if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(" tessellate: " << (tessellate ? "true" : "false")); - if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(" coords: (ncoord=" << ncoord << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_LinearRing::DeepEcho {{{*/ -void KML_LinearRing::DeepEcho(){ - - char indent[81]=""; - - KML_LinearRing::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LinearRing::DeepEcho {{{*/ -void KML_LinearRing::DeepEcho(const char* indent){ - - int i; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_LinearRing:"); - KML_Geometry::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(indent << " tessellate: " << (tessellate ? "true" : "false")); - if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(indent << " coords: (ncoord=" << ncoord << ")"); - for (i=0; i\n"); - WriteCommnt(filout,indent); - - KML_Geometry::Write(filout,indent); - - fprintf(filout,"%s %d\n",indent,(extrude ? 1 : 0)); - fprintf(filout,"%s %d\n",indent,(tessellate ? 1 : 0)); - fprintf(filout,"%s %s\n",indent,altmode); - fprintf(filout,"%s \n",indent); - -/* loop over the coordinates for the linearring */ - - for (i=0; i\n",indent); - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LinearRing::Read {{{*/ -void KML_LinearRing::Read(FILE* fid,char* kstr){ - - char *kstri = NULL; - int ncom = 0; - char **pcom = NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this,kstr)) return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid,&ncom,&pcom)){ - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&extrude,kstri,fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&tessellate,kstri,fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(altmode,NULL,KML_LINEARRING_ALTMODE_LENGTH,kstri,fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&coords,&ncoord,3,0,kstri,fid); - else if (!strncmp(kstri,"<",1)) - KML_Geometry::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for(ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_LinearRing::WriteExp {{{*/ -void KML_LinearRing::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - double *lat,*lon,*x,*y; - char nstr2[81]; - -/* extract latitude and longitude into vectors */ - - lat=xNew(ncoord); - lon=xNew(ncoord); - for (i=0; i(ncoord); - y =xNew(ncoord); - if (sgn) { - Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); - } - else { - memcpy(x,lon,ncoord*sizeof(IssmDouble)); - memcpy(y,lat,ncoord*sizeof(IssmDouble)); - } - -/* write header */ - - memcpy(nstr2,nstr,(strlen(nstr)+1)*sizeof(char)); - - for (i=0; i(y); - xDelete(x); - xDelete(lon); - xDelete(lat); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KMLFileReadUtils.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KMLFileReadUtils.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KMLFileReadUtils.cpp (revision 15012) @@ -1,722 +0,0 @@ -/*!\file KMLFileUtils.cpp - * \brief: utilities for kml file reading. - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*FUNCTION KMLFileToken(FILE* fid,int* pncom=NULL,char*** ppcom=NULL) {{{*/ -char* KMLFileToken(FILE* fid, - int* pncom=NULL,char*** ppcom=NULL){ - -/* get the next token (tag or field) in the file */ - - bool inew=1,itag=0,ifield=0; - int c; - int ibuf=0,buflen=1024,bufblk=1024; - char *buffer=NULL,*bufferc=NULL,**pcom2=NULL; - - buffer=xNew(buflen); - buffer[0]='\0'; - -/* read kml file character-by-character */ - -// note that fgets includes newline -// fgets(buffer,buflen,fid); - - while ((c=getc(fid)) != EOF) { - /* ignore leading blanks */ - if (inew && isspace(c)) - continue; - - /* distinguish between tag or field */ - if (!itag && !ifield) { - - /* distinguish between tag or comment */ - if (c == '<') { - ungetc(c,fid); - if (!(bufferc=KMLFileTokenComment(fid))) { - c=getc(fid); - itag=1; - } - else { - if (pncom && ppcom) { - (*pncom)++; - pcom2=xNew(*pncom); - memcpy(pcom2,*ppcom,(*pncom-1)*sizeof(char*)); - xDelete(*ppcom); - *ppcom=pcom2; - pcom2=NULL; -// *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*)); - (*ppcom)[*pncom-1]=bufferc; - } - else - xDelete(bufferc); - inew=1; - continue; - } - } - else - ifield=1; - inew=0; - KMLFileTokenBuffer(&buffer,&ibuf,&buflen, - c, - bufblk); - } - - /* accumulate tag, not including newlines */ - else if (itag) { - if (c != '\n') { - inew=0; - KMLFileTokenBuffer(&buffer,&ibuf,&buflen, - c, - bufblk); - if (c == '>') - break; - } - else - inew=1; - } - - /* accumulate field, including newlines */ - else if (ifield) { - /* distinguish between another tag or comment */ - if (c == '<') { - ungetc(c,fid); - if (!(bufferc=KMLFileTokenComment(fid))) - break; - else - if (pncom && ppcom) { - (*pncom)++; - pcom2=xNew(*pncom); - memcpy(pcom2,*ppcom,(*pncom-1)*sizeof(char*)); - xDelete(*ppcom); - *ppcom=pcom2; - pcom2=NULL; -// *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*)); - (*ppcom)[*pncom-1]=bufferc; - } - else - xDelete(bufferc); - } - else { - inew=0; - KMLFileTokenBuffer(&buffer,&ibuf,&buflen, - c, - bufblk); - if (c == '\n') - inew=1; - } - } - - } - -/* remove trailing blanks or newline */ - - while (ibuf > 0) - if (isspace(buffer[ibuf-1])) - ibuf--; - else { - buffer[ibuf]='\0'; - break; - } - -// if (itag) -// _pprintLine_("tag buffer (length=" << ibuf << "):"); -// else if (ifield) -// _pprintLine_("field buffer (length=" << ibuf << "):"); -// _pprintLine_(buffer); - - if (!ibuf) - xDelete(buffer); - - return(buffer); -} -/*}}}*/ -/*FUNCTION KMLFileTokenComment(FILE* fid) {{{*/ -char* KMLFileTokenComment(FILE* fid){ - -/* check for comment in the file and read it */ - - bool inew=1; - int i; - int c; - int ibuf=0,buflen=1024,bufblk=1024; - char* buffer=NULL; - - buffer=xNew(buflen); - buffer[0]='\0'; - -/* read kml file character-by-character */ - - while ((c=getc(fid)) != EOF) { - /* ignore leading blanks */ - if (inew && isspace(c)) - continue; - - inew=0; - KMLFileTokenBuffer(&buffer,&ibuf,&buflen, - c, - bufblk); - - /* check for comment */ - if (ibuf <= 4) { - if ((ibuf == 1 && buffer[0] != '<') || - (ibuf == 2 && buffer[1] != '!') || - (ibuf == 3 && buffer[2] != '-') || - (ibuf == 4 && buffer[3] != '-')) { - for (i=ibuf-1; i>=0; i--) - ungetc(buffer[i],fid); - xDelete(buffer); - return(buffer); - } - } - - /* accumulate comment, including newlines */ - else - if (buffer[ibuf-3]=='-' && buffer[ibuf-2]=='-' && buffer[ibuf-1]=='>') - break; - } - -/* remove trailing blanks or newline */ - - while (ibuf > 0) - if (isspace(buffer[ibuf-1])) - ibuf--; - else { - buffer[ibuf]='\0'; - break; - } - -// _pprintLine_("comment buffer (length=" << ibuf << "):"); -// _pprintLine_(buffer); - - if (!ibuf) - xDelete(buffer); - - return(buffer); -} -/*}}}*/ -/*FUNCTION KMLFileTokenBuffer {{{*/ -void KMLFileTokenBuffer(char** pbuffer,int* pibuf,int* pbuflen, - int c, - int bufblk){ - -/* add the specified character to the token buffer */ - - char* buffer2=NULL; - -/* check buffer length and realloc if necessary */ - - if (*pibuf+2 > *pbuflen) { - *pbuflen+=bufblk; - buffer2=xNew(*pbuflen); - memcpy(buffer2,*pbuffer,(*pbuflen-bufblk)*sizeof(char)); - xDelete(*pbuffer); - *pbuffer=buffer2; - buffer2=NULL; -// *pbuffer=(char *) xrealloc(*pbuffer,*pbuflen*sizeof(char)); - } - -/* add character and terminator */ - - (*pbuffer)[(*pibuf)++]=c; - (*pbuffer)[ *pibuf ]='\0'; - - return; -} -/*}}}*/ -/*FUNCTION KMLFileTagName {{{*/ -char* KMLFileTagName(char* pname, - char* ktag){ - - return(KMLFileTagName(pname,NULL,0, - ktag)); -} -/*}}}*/ -/*FUNCTION KMLFileTagName {{{*/ -char* KMLFileTagName(char* pname,int *m,int maxlen, - char* ktag){ - -/* for the given tag buffer, read and store the name */ - - char* ktagi; - char* ktokn; - - if (strncmp(&ktag[0],"<" ,1) || strncmp(&ktag[strlen(ktag)-1],">",1)) - _error_("KMLFileTagName -- Missing tag delimiters in " << ktag << ".\n"); - -/* strtok modifies ktag, so work on copy */ - - ktagi=xNew(strlen(ktag)+1); - memcpy(ktagi,ktag,(strlen(ktag)+1)*sizeof(char)); - -/* skip opening delimeter and find subsequent blank or closing delimiter */ - - ktokn=strtok(ktagi,"< >"); -// _pprintLine_("KMLFileTagName -- initial token=\"" << ktokn << "\"."); - - if (!pname) { - if (maxlen) - pname=xNew(maxlen +1); - else - pname=xNew(strlen(ktokn)+1); - } - - if (maxlen && (maxlen < strlen(ktokn))) { - _pprintLine_("KMLFileTagName -- string field too short for " << ktag << "."); - _pprintLine_("KMLFileTagName -- \"" << ktokn << "\" truncated to " << maxlen << " characters."); - strncpy(pname,ktokn,maxlen); - } - else - memcpy(pname,ktokn,(strlen(ktokn)+1)*sizeof(char)); - - xDelete(ktagi); - - if (m) - *m=strlen(pname); - - return(pname); -} -/*}}}*/ -/*FUNCTION KMLFileTagAttrib {{{*/ -int KMLFileTagAttrib(KML_Object* kobj, - char* ktag){ - -/* for the given tag buffer, read and store the attributes */ - - char* ktagi; - char* ktokn; - char* ktokv; - char quote[]={'\"','\0'}; - int isolo=0; - -/* strtok modifies ktag, so work on copy */ - - ktagi=xNew(strlen(ktag)+1); - memcpy(ktagi,ktag,(strlen(ktag)+1)*sizeof(char)); - -/* loop through tag to find all attributes */ - - /* return first non blank and move past subsequent blank */ - ktokn=strtok(ktagi," "); -// _pprintLine_("KMLFileTagAttrib -- initial token=\"" << ktokn << "\"."); - - /* return next non " =?/>" and move past subsequent " =?/>" */ - while (ktokn=strtok(NULL," =?/>")) { - - /* return next non quote and move past subsequent quote */ - ktokv=strtok(NULL,quote); -// _pprintLine_("KMLFileTagAttrib -- attribute " << ktokn << "=\"" << ktokv << "\"."); - -/* add the attribute to the dataset */ - - if (kobj) - kobj->AddAttrib(ktokn,ktokv); - } - - xDelete(ktagi); - -/* check for xml declaration, dtd declaration, or solo tag */ - - if ((!strncmp(&ktag[0],"",2)) || - (!strncmp(&ktag[0],"",1)) || - (!strncmp(&ktag[0],"<" ,1) && !strncmp(&ktag[strlen(ktag)-2],"/>",2))) - isolo=1; -// _pprintLine_("KMLFileTagAttrib -- isolo=" << isolo << "."); - - return(isolo); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(int* pival, - char* ktag, - FILE* fid){ - - char* kstr; - -/* get next token and convert to appropriate format */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); - - sscanf(kstr,"%d",pival); - xDelete(kstr); - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pival << "."); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(bool* pbval, char* ktag, FILE* fid){ - - int ival; - char* kstr; - -/* get next token and convert to appropriate format */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - {_error_("KMLFileTokenParse -- Missing bool field for " << ktag << ".\n");} - - sscanf(kstr,"%d",&ival); - *pbval=(bool)ival; - xDelete(kstr); - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << (*pbval ? "true" : "false") << "."); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -char* KMLFileTokenParse(char* pstr, - char* ktag, - FILE* fid){ - - return(KMLFileTokenParse(pstr,NULL,0, - ktag, - fid)); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -char* KMLFileTokenParse(char* pstr,int *m,int maxlen, - char* ktag, - FILE* fid){ - - char* kstr; - -/* get next token and allocate if necessary */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error_("KMLFileTokenParse -- Missing string field for " << ktag << ".\n"); - - if (!pstr) { - if (maxlen) - pstr=xNew(maxlen +1); - else - pstr=xNew(strlen(kstr)+1); - } - - if (maxlen && (maxlen < strlen(kstr))) { - _pprintLine_("KMLFileTokenParse -- string field too short for " << ktag << "."); - _pprintLine_("KMLFileTokenParse -- \"" << kstr << "\" truncated to " << maxlen << " characters."); - strncpy(pstr,kstr,maxlen); - } - else - memcpy(pstr,kstr,(strlen(kstr)+1)*sizeof(char)); - - xDelete(kstr); - - if (m) - *m=strlen(pstr); - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=\"" << pstr << "\"."); - - return(pstr); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(float* pfval, - char* ktag, - FILE* fid){ - - char* kstr; - -/* get next token and convert to appropriate format */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - {_error_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n");} - - sscanf(kstr,"%g",pfval); - xDelete(kstr); - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pfval << "."); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(double* pdval, - char* ktag, - FILE* fid){ - - char* kstr; - -/* get next token and convert to appropriate format */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); - - sscanf(kstr,"%lg",pdval); - xDelete(kstr); - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pdval << "."); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(double **pdval,int* m,int maxlen, - char* ktag, - FILE* fid){ - - int i=-1; - char* kstr; - char* ktok; - double* dval2=NULL; - char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; - -/* get next token and allocate if necessary */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error_("KMLFileTokenParse -- Missing double [m] field for " << ktag << ".\n"); - - if (!*pdval) - if (maxlen) - *pdval=xNew(maxlen ); - else - *pdval=xNew((strlen(kstr)+1)/2); - -/* loop through string to get all values */ - - ktok=strtok(kstr,delim); - while (ktok) { - i++; - if (maxlen && (maxlen < i+1)) - _error_("KMLFileTokenParse -- Double [m] field too short for " << ktag << ".\n"); - sscanf(ktok,"%lg",&((*pdval)[i])); - ktok=strtok(NULL,delim); - } - xDelete(kstr); - - if (!maxlen) - dval2=xNew(i+1); - memcpy(dval2,*pdval,(i+1)*sizeof(double)); - xDelete(*pdval); - *pdval=dval2; - dval2=NULL; -// *pdval=(double *) xrealloc(*pdval,(i+1)*sizeof(double)); - - if (m) - *m=i+1; - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); -// for (j=0; j<=i; j++) -// _pprintLine_(" [" << j << "]: " << (*pdval)[j] << "g"); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(double **pdval,int* m,int n,int maxlen, - char* ktag, - FILE* fid){ - - int i=-1,j=-1; - char* kstr; - char* ktok; - double* dval2=NULL; - char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; - -/* get next token and allocate if necessary */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error_("KMLFileTokenParse -- Missing double [m x n] field for " << ktag << ".\n"); - - if (!*pdval) - if (maxlen) - *pdval=xNew(maxlen*n ); - else - *pdval=xNew((strlen(kstr)+1)/2); - -/* loop through string to get all values */ - - ktok=strtok(kstr,delim); - while (ktok) { - i++; - if (maxlen && (maxlen*n < i+1)) - _error_("KMLFileTokenParse -- Double [m x n] field too short for " << ktag << ".\n"); - j=(j+1) % n; - sscanf(ktok,"%lg",&((*pdval)[i])); - ktok=strtok(NULL,delim); - } - xDelete(kstr); - - if (!maxlen) - dval2=xNew((i+1)*n); - memcpy(dval2,*pdval,((i+1)*n)*sizeof(double)); - xDelete(*pdval); - *pdval=dval2; - dval2=NULL; -// *pdval=(double *) xrealloc(*pdval,((i+1)*n)*sizeof(double)); - - if (m) - *m=((i+1)+(n-1))/n; - - if ((i+1) % n) - _pprintLine_("KMLFileTokenParse -- Double [m x n] field for " << ktag << " does not have multiple of n values."); - -/* get additional token and compare to closing tag */ - - if (ktag) - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] != '<') || - (kstr[1] != '/') || - (strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1))) - {_error_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xDelete(kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); -// for (j=0; j<=i; j++) -// _pprintLine_(" [" << j << "]: " << (*pdval)[j] << "g"); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTagSkip {{{*/ -int KMLFileTagSkip(char* ktag, - FILE* fid){ - - char* kstr; - -/* note that tags of the same type can be nested inside each other, so for each - opening tag, must find corresponding closing tag */ - - _pprintLine_("KMLFileTagSkip -- input tag " << ktag << "."); - -/* if next token is a closing tag, compare to input */ - - while (kstr=KMLFileToken(fid, - NULL,NULL)) { - if ((kstr[0] == '<') && - (kstr[1] == '/') && - (!strncmp(&(kstr[2]),&(ktag[1]),(strcspn(ktag," >")-1)/sizeof(char)))) { - _pprintLine_("KMLFileTagSkip -- closing tag " << kstr << "."); - xDelete(kstr); - return(0); - } - -/* if next token is an opening tag, call recursively */ - - else if ((kstr[0] == '<') && - (kstr[1] != '/')) { - _pprintLine_("KMLFileTagSkip -- opening tag " << kstr << "."); - KMLFileTagSkip(kstr, - fid); - } - -/* if next token is a closing tag, error out */ - - else if ((kstr[0] == '<') && - (kstr[1] == '/')) { - _error_("KMLFileTagSkip -- Unexpected closing tag " << kstr << ".\n"); - } - - xDelete(kstr); - } - - _error_("KMLFileTokenParse -- Corresponding closing tag for " << ktag << " not found.\n"); - - return(0); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Point.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Point.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Point.h (revision 15012) @@ -1,43 +0,0 @@ -/*! \file KML_Point.h - * \brief: header file for kml_point object - */ - -#ifndef _KML_POINT_H_ -#define _KML_POINT_H_ - -#define KML_POINT_ALTMODE_LENGTH 18 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Geometry.h" -/*}}}*/ - -class KML_Point: public KML_Geometry { - - public: - - bool extrude; - char altmode[KML_POINT_ALTMODE_LENGTH+1]; - double coords[3]; - - /*KML_Point constructors, destructors {{{*/ - KML_Point(); - ~KML_Point(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_POINT_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.cpp (revision 15012) @@ -1,208 +0,0 @@ -/*!\file KML_Placemark.cpp - * \brief: implementation of the kml_placemark object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Placemark::KML_Placemark(){{{*/ -KML_Placemark::KML_Placemark(){ - - geometry =new DataSet; - -} -/*}}}*/ -/*FUNCTION KML_Placemark::~KML_Placemark(){{{*/ -KML_Placemark::~KML_Placemark(){ - - if (geometry) { - delete geometry; - geometry =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Placemark::Echo {{{*/ -void KML_Placemark::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Placemark:"); - KML_Feature::Echo(); - - if(flag) _pprintLine_(" geometry: (size=" << geometry->Size() << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Placemark::DeepEcho {{{*/ -void KML_Placemark::DeepEcho(){ - - char indent[81]=""; - - KML_Placemark::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Placemark::DeepEcho {{{*/ -void KML_Placemark::DeepEcho(const char* indent){ - - int i; - char indent2[81]; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Placemark:"); - KML_Feature::DeepEcho(indent); - -/* loop over the geometry elements for the placemark */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (geometry->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " geometry: -------- begin [" << i << "] --------"); - ((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " geometry: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " geometry: [empty]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Placemark::Write {{{*/ -void KML_Placemark::Write(FILE* filout,const char* indent){ - - int i; - char indent2[81]; - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Feature::Write(filout,indent); - -/* loop over the geometry elements for the placemark */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - - for (i=0; iSize(); i++) - ((KML_Geometry *)geometry->GetObjectByOffset(i))->Write(filout,indent2); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Placemark::Read {{{*/ -void KML_Placemark::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - KML_Object* kobj; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"<",1)) - KML_Feature::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_Placemark::WriteExp {{{*/ -void KML_Placemark::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - char nstr2[81]; - -/* loop over the geometry elements for the placemark */ - - for (i=0; iSize(); i++) { - if (strlen(nstr)) - sprintf(nstr2,"%s %s",nstr,name); - else - sprintf(nstr2,"%s",name); - - ((KML_Object *)geometry->GetObjectByOffset(i))->WriteExp(fid,nstr2,sgn,cm,sp); - } - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.cpp (revision 15012) @@ -1,193 +0,0 @@ -/*!\file KML_Unknown.cpp - * \brief: implementation of the kml_unknown object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Unknown::KML_Unknown(){{{*/ -KML_Unknown::KML_Unknown(){ - - name =NULL; - value =NULL; - -} -/*}}}*/ -/*FUNCTION KML_Unknown::~KML_Unknown(){{{*/ -KML_Unknown::~KML_Unknown(){ - - if (name ) xDelete(name); - if (value ) xDelete(value); - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Unknown::Echo {{{*/ -void KML_Unknown::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Unknown " << name << ":"); - KML_Object::Echo(); - - if (value ) - if(flag) _pprintLine_(" value: \"" << value << "\""); - else - if(flag) _pprintLine_(" value: [none]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Unknown::DeepEcho {{{*/ -void KML_Unknown::DeepEcho(){ - - char indent[81]=""; - - KML_Unknown::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Unknown::DeepEcho {{{*/ -void KML_Unknown::DeepEcho(const char* indent){ - - char* valuei; - char* vtoken; - char nl[]={'\n','\0'}; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Unknown " << name << ":"); - KML_Object::DeepEcho(indent); - - if (value ) { - valuei=xNew(strlen(value)+1); - memcpy(valuei,value,(strlen(value)+1)*sizeof(char)); - - vtoken=strtok(valuei,nl); - if(flag) _pprintString_(indent << " value: \"" << vtoken); - - while (vtoken=strtok(NULL,nl)) - if(flag) _pprintString_("\n" << indent << " " << vtoken); - if(flag) _pprintLine_("\""); - - xDelete(valuei); - } - else - if(flag) _pprintLine_(indent << " value: [none]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Unknown::Write {{{*/ -void KML_Unknown::Write(FILE* filout,const char* indent){ - - char* valuei; - char* vtoken; - char nl[]={'\n','\0'}; - - fprintf(filout,"%s<%s",indent,name); - WriteAttrib(filout," "); - fprintf(filout,">\n"); - WriteCommnt(filout,indent); - - if (value ) { - valuei=xNew(strlen(value)+1); - memcpy(valuei,value,(strlen(value)+1)*sizeof(char)); - - vtoken=strtok(valuei,nl); - fprintf(filout,"%s %s\n",indent,vtoken); - - while (vtoken=strtok(NULL,nl)) - fprintf(filout,"%s %s\n",indent,vtoken); - - xDelete(valuei); - } - - KML_Object::Write(filout,indent); - - fprintf(filout,"%s\n",indent,name); - - return; -} -/*}}}*/ -/*FUNCTION KML_Unknown::Read {{{*/ -void KML_Unknown::Read(FILE* fid,char* kstr){ - - char* kstri; - char* value2=NULL; - int ncom=0; - char** pcom=NULL; - char nl[]={'\n','\0'}; - -/* get object name */ - - name=KMLFileTagName(NULL, - kstr); -// _pprintLine_("KML_Unknown::Read -- opening name=" << name << "."); - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { -// _pprintLine_("KML_Unknown::Read -- kstri=" << kstri << "."); - if (!strncmp(&kstri[0],"(kstri); - break; - } - else if (!strncmp(kstri,"(strlen(value)+1+strlen(kstri)+1); - memcpy(value2,value,(strlen(value)+1)*sizeof(char)); - xDelete(value); - value=value2; - value2=NULL; -// value=(char *) xrealloc(value,(strlen(value)+1+strlen(kstri)+1)*sizeof(char)); - strcat(value,nl); - strcat(value,kstri); - } - else { - value=xNew(strlen(kstri)+1); - memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char)); - } - } - - else if (!strncmp(kstri,"<",1)) - KML_Object::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.cpp (revision 15012) @@ -1,162 +0,0 @@ -/*!\file KML_GroundOverlay.cpp - * \brief: implementation of the kml_groundoverlay object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_GroundOverlay::KML_GroundOverlay(){{{*/ -KML_GroundOverlay::KML_GroundOverlay(){ - - altitude = 0.; - memcpy(altmode,"clampToGround",(strlen("clampToGround")+1)*sizeof(char)); - - llbox =NULL; - -} -/*}}}*/ -/*FUNCTION KML_GroundOverlay::~KML_GroundOverlay(){{{*/ -KML_GroundOverlay::~KML_GroundOverlay(){ - - if (llbox) { - delete llbox; - llbox =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_GroundOverlay::Echo {{{*/ -void KML_GroundOverlay::Echo(){ - - _printLine_("KML_GroundOverlay:"); - KML_Overlay::Echo(); - - _printLine_(" altitude: " << altitude); - _printLine_(" altmode: " << altmode); - _printLine_(" llbox: " << llbox); -} -/*}}}*/ -/*FUNCTION KML_GroundOverlay::DeepEcho {{{*/ -void KML_GroundOverlay::DeepEcho(){ - - char indent[81]=""; - - KML_GroundOverlay::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_GroundOverlay::DeepEcho {{{*/ -void KML_GroundOverlay::DeepEcho(const char* indent){ - - char indent2[81]; - - _printLine_(indent << "KML_GroundOverlay:"); - KML_Overlay::DeepEcho(indent); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - _printLine_(indent<<" altitude: " << altitude); - _printLine_(indent<<" altmode: " << altmode); - if (llbox) - llbox->DeepEcho(indent2); - else - _printLine_(indent<<" llbox: " << llbox); -} -/*}}}*/ -/*FUNCTION KML_GroundOverlay::Write {{{*/ -void KML_GroundOverlay::Write(FILE* filout,const char* indent){ - - char indent2[81]; - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Overlay::Write(filout,indent); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - - fprintf(filout,"%s %0.16g\n",indent,altitude); - fprintf(filout,"%s %s\n",indent,altmode); - if (llbox) - llbox->Write(filout,indent2); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_GroundOverlay::Read {{{*/ -void KML_GroundOverlay::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&altitude , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( altmode ,NULL,KML_GROUNDOVERLAY_ALTMODE_LENGTH, - kstri, - fid); - else if (!strncmp(kstri,"Read(fid,kstri); - } - - else if (!strncmp(kstri,"<",1)) - KML_Overlay::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Feature.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Feature.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Feature.h (revision 15012) @@ -1,51 +0,0 @@ -/*! \file KML_Feature.h - * \brief: header file for kml_feature abstract object - */ - -#ifndef _KML_FEATURE_H_ -#define _KML_FEATURE_H_ - -#define KML_FEATURE_NAME_LENGTH 80 -#define KML_FEATURE_SNIPPET_LENGTH 160 -#define KML_FEATURE_DESCRIPT_LENGTH 3200 -#define KML_FEATURE_STYLEURL_LENGTH 80 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Object.h" -class KML_Style; -class DataSet; -/*}}}*/ - -class KML_Feature: public KML_Object { - - public: - - char name[KML_FEATURE_NAME_LENGTH+1]; - bool visibility; - bool open; - char snippet[KML_FEATURE_SNIPPET_LENGTH+1]; - char descript[KML_FEATURE_DESCRIPT_LENGTH+1]; - char styleurl[KML_FEATURE_STYLEURL_LENGTH+1]; - DataSet* style; - - /*KML_Feature constructors, destructors {{{*/ - KML_Feature(); - ~KML_Feature(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_FEATURE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Style.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Style.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Style.cpp (revision 15012) @@ -1,237 +0,0 @@ -/*!\file KML_Style.cpp - * \brief: implementation of the kml_style object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Style::KML_Style(){{{*/ -KML_Style::KML_Style(){ - - icon =NULL; - label =NULL; - line =NULL; - poly =NULL; - balloon =NULL; - list =NULL; - -} -/*}}}*/ -/*FUNCTION KML_Style::~KML_Style(){{{*/ -KML_Style::~KML_Style(){ - - if (list) { -// delete list; - list =NULL; - } - if (balloon) { -// delete balloon; - balloon =NULL; - } - if (poly) { - delete poly; - poly =NULL; - } - if (line) { - delete line; - line =NULL; - } - if (label) { -// delete label; - label =NULL; - } - if (icon) { -// delete icon; - icon =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Style::Echo {{{*/ -void KML_Style::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Style:"); - KML_StyleSelector::Echo(); - - if(flag) _pprintLine_(" icon: " << icon); - if(flag) _pprintLine_(" label: " << label); - if(flag) _pprintLine_(" line: " << line); - if(flag) _pprintLine_(" poly: " << poly); - if(flag) _pprintLine_(" balloon: " << balloon); - if(flag) _pprintLine_(" list: " << list); - - return; -} -/*}}}*/ -/*FUNCTION KML_Style::DeepEcho {{{*/ -void KML_Style::DeepEcho(){ - - char indent[81]=""; - - KML_Style::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Style::DeepEcho {{{*/ -void KML_Style::DeepEcho(const char* indent){ - - char indent2[81]; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Style:"); - KML_StyleSelector::DeepEcho(indent); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - -// if (icon) -// icon->DeepEcho(indent2); -// else - if(flag) _pprintLine_(indent << " icon: " << icon); -// if (label) -// label->DeepEcho(indent2); -// else - if(flag) _pprintLine_(indent << " label: " << label); - if (line) - line->DeepEcho(indent2); - else - if(flag) _pprintLine_(indent << " line: " << line); - if (poly) - poly->DeepEcho(indent2); - else - if(flag) _pprintLine_(indent << " poly: " << poly); -// if (balloon) -// balloon->DeepEcho(indent2); -// else - if(flag) _pprintLine_(indent << " balloon: " << balloon); -// if (list) -// list->DeepEcho(indent2); -// else - if(flag) _pprintLine_(indent << " list: " << list); - - return; -} -/*}}}*/ -/*FUNCTION KML_Style::Write {{{*/ -void KML_Style::Write(FILE* filout,const char* indent){ - - char indent2[81]; - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_StyleSelector::Write(filout,indent); - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - -// if (icon) -// icon->Write(filout,indent2); -// if (label) -// label->Write(filout,indent2); - if (line) - line->Write(filout,indent2); - if (poly) - poly->Write(filout,indent2); -// if (balloon) -// balloon->Write(filout,indent2); -// if (list) -// list->Write(filout,indent2); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Style::Read {{{*/ -void KML_Style::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"Read(fid,kstri); -// } - -// else if (!strncmp(kstri,"Read(fid,kstri); -// } - - else if (!strncmp(kstri,"Read(fid,kstri); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - } - -// else if (!strncmp(kstri,"Read(fid,kstri); -// } - -// else if (!strncmp(kstri,"Read(fid,kstri); -// } - - else if (!strncmp(kstri,"<",1)) - KML_StyleSelector::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.h (revision 15012) @@ -1,36 +0,0 @@ -/*! \file KML_Geometry.h - * \brief: header file for kml_geometry abstract object - */ - -#ifndef _KML_GEOMETRY_H_ -#define _KML_GEOMETRY_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Object.h" -/*}}}*/ - -class KML_Geometry: public KML_Object { - - public: - - /*KML_Geometry constructors, destructors {{{*/ - KML_Geometry(); - ~KML_Geometry(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_GEOMETRY_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Comment.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Comment.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Comment.cpp (revision 15012) @@ -1,116 +0,0 @@ -/*!\file KML_Comment.cpp - * \brief: implementation of the kml_comment object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Comment::KML_Comment(){{{*/ -KML_Comment::KML_Comment(){ - - value =NULL; - -} -/*}}}*/ -/*FUNCTION KML_Comment::~KML_Comment(){{{*/ -KML_Comment::~KML_Comment(){ - - if (value ) xDelete(value); - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Comment::Echo {{{*/ -void KML_Comment::Echo(){ - - bool flag=true; - - if(flag) _pprintString_(" "); - if(flag) _pprintLine_(value); - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::DeepEcho {{{*/ -void KML_Comment::DeepEcho(){ - - char indent[81]=""; - - KML_Comment::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::DeepEcho {{{*/ -void KML_Comment::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintString_(indent << " "); - if(flag) _pprintLine_(value); - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::Write {{{*/ -void KML_Comment::Write(FILE* filout,const char* indent){ - - if (strncmp(&value[0] ,"" ,3)) - fprintf(filout,"%s-->\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::Read {{{*/ -void KML_Comment::Read(FILE* fid,char* kstr){ - -// comments always read as part of KMLFileToken - - ; - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::Alloc {{{*/ -void KML_Comment::Alloc(const char* valuei){ - - value=xNew(strlen(valuei)+1); - memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char)); - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::Add {{{*/ -void KML_Comment::Add(DataSet* commnt){ - - commnt->AddObject((Object*)this); - - return; -} -/*}}}*/ -/*FUNCTION KML_Comment::Get {{{*/ -void KML_Comment::Get(char** pvalueo){ - - *pvalueo=xNew(strlen(value)+1); - memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_ColorStyle.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_ColorStyle.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_ColorStyle.h (revision 15012) @@ -1,43 +0,0 @@ -/*! \file KML_ColorStyle.h - * \brief: header file for kml_colorstyle abstract object - */ - -#ifndef _KML_COLORSTYLE_H_ -#define _KML_COLORSTYLE_H_ - -#define KML_COLORSTYLE_COLOR_LENGTH 8 -#define KML_COLORSTYLE_COLORMODE_LENGTH 6 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_SubStyle.h" -/*}}}*/ - -class KML_ColorStyle: public KML_SubStyle { - - public: - - char color[KML_COLORSTYLE_COLOR_LENGTH+1]; - char colormode[KML_COLORSTYLE_COLORMODE_LENGTH+1]; - - /*KML_ColorStyle constructors, destructors {{{*/ - KML_ColorStyle(); - ~KML_ColorStyle(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_COLORSTYLE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_MultiGeometry.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_MultiGeometry.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_MultiGeometry.cpp (revision 15012) @@ -1,201 +0,0 @@ -/*!\file KML_MultiGeometry.cpp - * \brief: implementation of the kml_multigeometry object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_MultiGeometry::KML_MultiGeometry(){{{*/ -KML_MultiGeometry::KML_MultiGeometry(){ - - geometry =new DataSet; - -} -/*}}}*/ -/*FUNCTION KML_MultiGeometry::~KML_MultiGeometry(){{{*/ -KML_MultiGeometry::~KML_MultiGeometry(){ - - if (geometry) { - delete geometry; - geometry =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_MultiGeometry::Echo {{{*/ -void KML_MultiGeometry::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Multigeometry:"); - KML_Geometry::Echo(); - - if(flag) _pprintLine_(" geometry: (size=" << geometry->Size() << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_MultiGeometry::DeepEcho {{{*/ -void KML_MultiGeometry::DeepEcho(){ - - char indent[81]=""; - - KML_MultiGeometry::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_MultiGeometry::DeepEcho {{{*/ -void KML_MultiGeometry::DeepEcho(const char* indent){ - - int i; - char indent2[81]; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Multigeometry:"); - KML_Geometry::DeepEcho(indent); - -/* loop over the geometry elements for the multigeometry */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (geometry->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " geometry: -------- begin [" << i << "] --------"); - ((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " geometry: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " geometry: [empty]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_MultiGeometry::Write {{{*/ -void KML_MultiGeometry::Write(FILE* filout,const char* indent){ - - int i; - char indent2[81]; - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Geometry::Write(filout,indent); - -/* loop over the geometry elements for the multigeometry */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - - for (i=0; iSize(); i++) - ((KML_Geometry *)geometry->GetObjectByOffset(i))->Write(filout,indent2); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_MultiGeometry::Read {{{*/ -void KML_MultiGeometry::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - KML_Object* kobj; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"Read(fid,kstri); - geometry ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstri,"<",1)) - KML_Geometry::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_MultiGeometry::WriteExp {{{*/ -void KML_MultiGeometry::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - -/* loop over the geometry elements for the multigeometry */ - - for (i=0; iSize(); i++) - ((KML_Object *)geometry->GetObjectByOffset(i))->WriteExp(fid,nstr,sgn,cm,sp); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.h (revision 15012) @@ -1,36 +0,0 @@ -/*! \file KML_StyleSelector.h - * \brief: header file for kml_styleselector abstract object - */ - -#ifndef _KML_STYLESELECTOR_H_ -#define _KML_STYLESELECTOR_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Object.h" -/*}}}*/ - -class KML_StyleSelector: public KML_Object { - - public: - - /*KML_StyleSelector constructors, destructors {{{*/ - KML_StyleSelector(); - ~KML_StyleSelector(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_STYLESELECTOR_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Object.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Object.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Object.cpp (revision 15012) @@ -1,385 +0,0 @@ -/*!\file KML_Object.cpp - * \brief: implementation of the kml_object abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Object::KML_Object(){{{*/ -KML_Object::KML_Object(){ - - attrib =new DataSet; - commnt =new DataSet; - kmlobj =new DataSet; - -} -/*}}}*/ -/*FUNCTION KML_Object::~KML_Object(){{{*/ -KML_Object::~KML_Object(){ - - if (attrib) { - delete attrib; - attrib =NULL; - } - if (commnt) { - delete commnt; - commnt =NULL; - } - if (kmlobj) { - delete kmlobj; - kmlobj =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Object::Echo {{{*/ -void KML_Object::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_(" attrib: (size=" << attrib->Size() << ")"); - if(flag) _pprintLine_(" commnt: (size=" << commnt->Size() << ")"); - if(flag) _pprintLine_(" kmlobj: (size=" << kmlobj->Size() << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::DeepEcho {{{*/ -void KML_Object::DeepEcho(){ - - char indent[81]=""; - - KML_Object::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::DeepEcho {{{*/ -void KML_Object::DeepEcho(const char* indent){ - - int i; - char indent2[81]; - bool flag=true; - -/* loop over the attributes for the object */ - - if (attrib->Size()) - for (i=0; iSize(); i++) { - ((KML_Attribute *)attrib->GetObjectByOffset(i))->DeepEcho(indent); - } - else - if(flag) _pprintLine_(indent << " attrib: [empty]"); - -/* loop over the comments for the object */ - - if (commnt->Size()) - for (i=0; iSize(); i++) { - ((KML_Comment *)commnt->GetObjectByOffset(i))->DeepEcho(indent); - } - else - if(flag) _pprintLine_(indent << " commnt: [empty]"); - -/* loop over the unknown objects for the object */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (kmlobj->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " kmlobj: -------- begin [" << i << "] --------"); - ((KML_Unknown *)kmlobj->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " kmlobj: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " kmlobj: [empty]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::Write {{{*/ -void KML_Object::Write(FILE* filout,const char* indent){ - - int i; - char indent2[81]; - -// attributes always written in keyword line of derived classes -// comments always written after keyword line of derived classes - -/* loop over the unknown objects for the object */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (kmlobj->Size()) - for (i=0; iSize(); i++) { - ((KML_Unknown *)kmlobj->GetObjectByOffset(i))->Write(filout,indent2); - } - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::Read {{{*/ -void KML_Object::Read(FILE* fid,char* kstr){ - - KML_Object* kobj; - -/* process field within opening and closing tags */ - - if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - -// else if (!strncmp(kstr,"Read(fid,kstr); -// kmlobj ->AddObject((Object*)kobj); -// } - -// else if (!strncmp(kstr,"Read(fid,kstr); -// kmlobj ->AddObject((Object*)kobj); -// } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstr,"Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - -// else if (!strncmp(kstr,"Read(fid,kstr); -// kmlobj ->AddObject((Object*)kobj); -// } - -// else if (!strncmp(kstr,"Read(fid,kstr); -// kmlobj ->AddObject((Object*)kobj); -// } - - else if (!strncmp(kstr,"<",1)) { - _pprintLine_("KML_Object::Read -- Unrecognized opening tag " << kstr << "."); -// KMLFileTagSkip(kstr, -// fid); - kobj=(KML_Object*)new KML_Unknown(); - kobj->Read(fid,kstr); - kmlobj ->AddObject((Object*)kobj); - } - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::WriteExp {{{*/ -void KML_Object::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - ; - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::AddAttrib {{{*/ -void KML_Object::AddAttrib(const char* name,const char* value){ - - KML_Attribute* katt=NULL; - - katt=new KML_Attribute(); - katt->Alloc(name,value); - katt->Add(attrib); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::FindAttrib {{{*/ -void KML_Object::FindAttrib(char** pvalue,char* name,char* deflt){ - - int i; - KML_Attribute* katt=NULL; - -/* loop over any attributes for the object */ - - if (attrib->Size()) - for (i=0; iSize(); i++) - if (!strcmp(((KML_Attribute *)attrib->GetObjectByOffset(i))->name,name)) { - katt=(KML_Attribute *)attrib->GetObjectByOffset(i); - break; - } - -/* if found, get the value; otherwise use the default */ - - if (katt) - katt->Get(pvalue,deflt); - else { - *pvalue=xNew(strlen(deflt)+1); - memcpy(*pvalue,deflt,(strlen(deflt)+1)*sizeof(char)); - } - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::WriteAttrib {{{*/ -void KML_Object::WriteAttrib(FILE* filout,const char* indent){ - -// attributes always written in keyword line of kml_object - -/* loop over any attributes for the object */ - - if (attrib->Size()) - for (int i=0; iSize(); i++) - ((KML_Attribute *)attrib->GetObjectByOffset(i))->Write(filout,indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::AddCommnt {{{*/ -void KML_Object::AddCommnt(int ncom,char** pcom){ - - int i; - KML_Comment* kcom=NULL; - - for (i=0; iAlloc(pcom[i]); - kcom->Add(commnt); - } - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::AddCommnt {{{*/ -void KML_Object::AddCommnt(char* value){ - - KML_Comment* kcom=NULL; - - kcom=new KML_Comment(); - kcom->Alloc(value); - kcom->Add(commnt); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::FindCommnt {{{*/ -void KML_Object::FindCommnt(char** pvalue,int inum){ - - KML_Comment* kcom=NULL; - -/* loop over any comments for the object */ - - if (inum <= commnt->Size()) - kcom=(KML_Comment *)commnt->GetObjectByOffset(inum-1); - -/* if found, get the value; otherwise use the NULL */ - - if (kcom) - kcom->Get(pvalue); - - return; -} -/*}}}*/ -/*FUNCTION KML_Object::WriteCommnt {{{*/ -void KML_Object::WriteCommnt(FILE* filout,const char* indent){ - - int i; - -// comments always written after keyword line of kml_object - -/* loop over any comments for the object */ - - if (commnt->Size()) - for (i=0; iSize(); i++) - ((KML_Comment *)commnt->GetObjectByOffset(i))->Write(filout,indent); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_LatLonBox.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_LatLonBox.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_LatLonBox.h (revision 15012) @@ -1,42 +0,0 @@ -/*! \file KML_LatLonBox.h - * \brief: header file for kml_latlonbox object - */ - -#ifndef _KML_LATLONBOX_H_ -#define _KML_LATLONBOX_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Object.h" -/*}}}*/ - -class KML_LatLonBox: public KML_Object { - - public: - - double north; - double south; - double east; - double west; - double rotation; - - /*KML_LatLonBox constructors, destructors {{{*/ - KML_LatLonBox(); - ~KML_LatLonBox(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LATLONBOX_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.h (revision 15012) @@ -1,44 +0,0 @@ -/*! \file KML_Attribute.h - * \brief: header file for kml_attribute object - */ - -#ifndef _KML_ATTRIBUTE_H_ -#define _KML_ATTRIBUTE_H_ - -/*Headers:{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "../Object.h" -class DataSet; -/*}}}*/ - -class KML_Attribute: public Object { - - public: - - char* name; - char* value; - - /*KML_Attribute constructors, destructors {{{*/ - KML_Attribute(); - ~KML_Attribute(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - virtual void Echo(); - virtual void DeepEcho(); - virtual void DeepEcho(const char* indent); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - - /*virtual functions: */ - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void Alloc(const char* namei,const char* valuei); - void Add(DataSet* attrib); - void Get(char** pvalueo,char* deflt); - -}; -#endif /* _KML_ATTRIBUTE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_LineStyle.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_LineStyle.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_LineStyle.cpp (revision 15012) @@ -1,135 +0,0 @@ -/*!\file KML_LineStyle.cpp - * \brief: implementation of the kml_linestyle object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_LineStyle::KML_LineStyle(){{{*/ -KML_LineStyle::KML_LineStyle(){ - - width =1.; - -} -/*}}}*/ -/*FUNCTION KML_LineStyle::~KML_LineStyle(){{{*/ -KML_LineStyle::~KML_LineStyle(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_LineStyle::Echo {{{*/ -void KML_LineStyle::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_LineStyle:"); - KML_ColorStyle::Echo(); - - if(flag) _pprintLine_(" width: " << width); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineStyle::DeepEcho {{{*/ -void KML_LineStyle::DeepEcho(){ - - char indent[81]=""; - - KML_LineStyle::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineStyle::DeepEcho {{{*/ -void KML_LineStyle::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_LineStyle:"); - KML_ColorStyle::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " width: " << width); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineStyle::Write {{{*/ -void KML_LineStyle::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_ColorStyle::Write(filout,indent); - - fprintf(filout,"%s %g\n",indent,width); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineStyle::Read {{{*/ -void KML_LineStyle::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&width , - kstri, - fid); - - else if (!strncmp(kstri,"<",1)) - KML_ColorStyle::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.h (revision 15012) @@ -1,39 +0,0 @@ -/*! \file KML_PolyStyle.h - * \brief: header file for kml_polystyle object - */ - -#ifndef _KML_POLYSTYLE_H_ -#define _KML_POLYSTYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_ColorStyle.h" -/*}}}*/ - -class KML_PolyStyle: public KML_ColorStyle { - - public: - - int fill; - int outline; - - /*KML_PolyStyle constructors, destructors {{{*/ - KML_PolyStyle(); - ~KML_PolyStyle(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_POLYSTYLE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.cpp (revision 15012) @@ -1,92 +0,0 @@ -/*!\file KML_SubStyle.cpp - * \brief: implementation of the kml_substyle abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_SubStyle::KML_SubStyle(){{{*/ -KML_SubStyle::KML_SubStyle(){ - - ; - -} -/*}}}*/ -/*FUNCTION KML_SubStyle::~KML_SubStyle(){{{*/ -KML_SubStyle::~KML_SubStyle(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_SubStyle::Echo {{{*/ -void KML_SubStyle::Echo(){ - - KML_Object::Echo(); - - return; -} -/*}}}*/ - -/*FUNCTION KML_SubStyle::DeepEcho {{{*/ -void KML_SubStyle::DeepEcho(){ - - char indent[81]=""; - - KML_SubStyle::DeepEcho(indent); - - return; -} -/*}}}*/ - -/*FUNCTION KML_SubStyle::DeepEcho {{{*/ -void KML_SubStyle::DeepEcho(const char* indent){ - - KML_Object::DeepEcho(indent); - - return; -} -/*}}}*/ - -/*FUNCTION KML_SubStyle::Write {{{*/ -void KML_SubStyle::Write(FILE* filout,const char* indent){ - - KML_Object::Write(filout,indent); - - return; -} -/*}}}*/ - -/*FUNCTION KML_SubStyle::Read {{{*/ -void KML_SubStyle::Read(FILE* fid,char* kstr){ - -/* process field within opening and closing tags */ - - if (!strncmp(kstr," -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -#include "../../../modules/Ll2xyx/Ll2xyx.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_LineString::KML_LineString(){{{*/ -KML_LineString::KML_LineString(){ - - extrude =false; - tessellate=false; - memcpy(altmode,"clampToGround",(strlen("clampToGround")+1)*sizeof(char)); - - ncoord =0; - coords =NULL; - -} -/*}}}*/ -/*FUNCTION KML_LineString::~KML_LineString(){{{*/ -KML_LineString::~KML_LineString(){ - - if (coords) xDelete(coords); - - coords =NULL; - ncoord =0; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_LineString::Echo {{{*/ -void KML_LineString::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_LineString:"); - KML_Geometry::Echo(); - - if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(" tessellate: " << (tessellate ? "true" : "false")); - if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(" coords: (ncoord=" << ncoord << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineString::DeepEcho {{{*/ -void KML_LineString::DeepEcho(){ - - char indent[81]=""; - - KML_LineString::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineString::DeepEcho {{{*/ -void KML_LineString::DeepEcho(const char* indent){ - - int i; - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_LineString:"); - KML_Geometry::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(indent << " tessellate: " << (tessellate ? "true" : "false")); - if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(indent << " coords: (ncoord=" << ncoord << ")"); - for (i=0; i\n"); - WriteCommnt(filout,indent); - - KML_Geometry::Write(filout,indent); - - fprintf(filout,"%s %d\n",indent,(extrude ? 1 : 0)); - fprintf(filout,"%s %d\n",indent,(tessellate ? 1 : 0)); - fprintf(filout,"%s %s\n",indent,altmode); - fprintf(filout,"%s \n",indent); - -/* loop over the coordinates for the linestring */ - - for (i=0; i\n",indent); - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineString::Read {{{*/ -void KML_LineString::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&extrude , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&tessellate, - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( altmode ,NULL,KML_LINESTRING_ALTMODE_LENGTH, - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&coords ,&ncoord ,0, - kstri, - fid); - - else if (!strncmp(kstri,"<",1)) - KML_Geometry::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_LineString::WriteExp {{{*/ -void KML_LineString::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - double *lat,*lon,*x,*y; - char nstr2[81]; - -/* extract latitude and longitude into vectors */ - - lat=xNew(ncoord); - lon=xNew(ncoord); - for (i=0; i(ncoord); - y =xNew(ncoord); - if (sgn) { - Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); - } - else { - memcpy(x,lon,ncoord*sizeof(IssmDouble)); - memcpy(y,lat,ncoord*sizeof(IssmDouble)); - } - -/* write header */ - - memcpy(nstr2,nstr,(strlen(nstr)+1)*sizeof(char)); - - for (i=0; i(y); - xDelete(x); - xDelete(lon); - xDelete(lat); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Folder.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Folder.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Folder.h (revision 15012) @@ -1,37 +0,0 @@ -/*! \file KML_Folder.h - * \brief: header file for kml_folder object - */ - -#ifndef _KML_FOLDER_H_ -#define _KML_FOLDER_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Container.h" -class KML_Feature; -/*}}}*/ - -class KML_Folder: public KML_Container { - - public: - - /*KML_Folder constructors, destructors {{{*/ - KML_Folder(); - ~KML_Folder(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_FOLDER_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Document.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Document.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Document.h (revision 15012) @@ -1,37 +0,0 @@ -/*! \file KML_Document.h - * \brief: header file for kml_document object - */ - -#ifndef _KML_DOCUMENT_H_ -#define _KML_DOCUMENT_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Container.h" -class KML_Feature; -/*}}}*/ - -class KML_Document: public KML_Container { - - public: - - /*KML_Document constructors, destructors {{{*/ - KML_Document(); - ~KML_Document(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_DOCUMENT_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_File.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_File.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_File.h (revision 15012) @@ -1,38 +0,0 @@ -/*! \file KML_File.h - * \brief: header file for kml_file object - */ - -#ifndef _KML_FILE_H_ -#define _KML_FILE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Feature.h" -class DataSet; -/*}}}*/ - -class KML_File: public KML_Object { - - public: - - /*KML_File constructors, destructors {{{*/ - KML_File(); - ~KML_File(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_FILE_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.h (revision 15012) @@ -1,43 +0,0 @@ -/*! \file KML_Overlay.h - * \brief: header file for kml_overlay abstract object - */ - -#ifndef _KML_OVERLAY_H_ -#define _KML_OVERLAY_H_ - -#define KML_OVERLAY_COLOR_LENGTH 8 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Feature.h" -class KML_Icon; -/*}}}*/ - -class KML_Overlay: public KML_Feature { - - public: - - char color[KML_OVERLAY_COLOR_LENGTH+1]; - int draword; - KML_Icon* icon; - - /*KML_Overlay constructors, destructors {{{*/ - KML_Overlay(); - ~KML_Overlay(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_OVERLAY_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Container.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Container.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Container.h (revision 15012) @@ -1,40 +0,0 @@ -/*! \file KML_Container.h - * \brief: header file for kml_container abstract object - */ - -#ifndef _KML_CONTAINER_H_ -#define _KML_CONTAINER_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Feature.h" -class DataSet; -/*}}}*/ - -class KML_Container: public KML_Feature { - - public: - - DataSet* feature; - - /*KML_Container constructors, destructors {{{*/ - KML_Container(); - ~KML_Container(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_CONTAINER_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Point.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Point.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Point.cpp (revision 15012) @@ -1,197 +0,0 @@ -/*!\file KML_Point.cpp - * \brief: implementation of the kml_point object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -#include "../../../modules/Ll2xyx/Ll2xyx.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Point::KML_Point(){{{*/ -KML_Point::KML_Point(){ - - extrude =false; - memcpy(altmode,"clampToGround",(strlen("clampToGround")+1)*sizeof(char)); - - coords[0] = 0.; - coords[1] = 0.; - coords[2] = 0.; - -} -/*}}}*/ -/*FUNCTION KML_Point::~KML_Point(){{{*/ -KML_Point::~KML_Point(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Point::Echo {{{*/ -void KML_Point::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_Point:"); - KML_Geometry::Echo(); - - if(flag) _pprintLine_(" extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(" altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(" coords: (" << coords[0] << "," << coords[1] << "," << coords[2] << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Point::DeepEcho {{{*/ -void KML_Point::DeepEcho(){ - - char indent[81]=""; - - KML_Point::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Point::DeepEcho {{{*/ -void KML_Point::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_Point:"); - KML_Geometry::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " extrude: " << (extrude ? "true" : "false")); - if(flag) _pprintLine_(indent << " altmode: \"" << altmode << "\""); - if(flag) _pprintLine_(indent << " coords: (" << coords[0] << "," << coords[1] << "," << coords[2] << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Point::Write {{{*/ -void KML_Point::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Geometry::Write(filout,indent); - - fprintf(filout,"%s %d\n",indent,(extrude ? 1 : 0)); - fprintf(filout,"%s %s\n",indent,altmode); - fprintf(filout,"%s %0.16g,%0.16g,%0.16g\n", - indent,coords[0],coords[1],coords[2]); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Point::Read {{{*/ -void KML_Point::Read(FILE* fid,char* kstr){ - - double* pcoords=&coords[0]; - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&extrude , kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse( altmode ,NULL,KML_POINT_ALTMODE_LENGTH, kstri, fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&pcoords ,NULL,3, kstri, fid); - - else if (!strncmp(kstri,"<",1)) - KML_Geometry::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ -/*FUNCTION KML_Point::WriteExp {{{*/ -void KML_Point::WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp){ - - int i; - double lat,lon,x,y; - char nstr2[81]; - -/* extract latitude and longitude */ - - lon=coords[0]; - lat=coords[1]; - -/* convert latitude and longitude to x and y */ - - if (sgn) { - Ll2xyx(&x,&y,&lat,&lon,1,sgn,cm,sp); - } - else { - memcpy(&x,&lon,1*sizeof(IssmDouble)); - memcpy(&y,&lat,1*sizeof(IssmDouble)); - } - -/* write header */ - - memcpy(nstr2,nstr,(strlen(nstr)+1)*sizeof(char)); - - for (i=0; i -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Feature::KML_Feature(){{{*/ -KML_Feature::KML_Feature(){ - - memcpy(name,"",(strlen("")+1)*sizeof(char)); - - visibility=true; - open =false; - memcpy(snippet,"",(strlen("")+1)*sizeof(char)); - memcpy(descript,"",(strlen("")+1)*sizeof(char)); - memcpy(styleurl,"",(strlen("")+1)*sizeof(char)); - style =new DataSet; - -} -/*}}}*/ -/*FUNCTION KML_Feature::~KML_Feature(){{{*/ -KML_Feature::~KML_Feature(){ - - if (style) { - delete style; - style =NULL; - } - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Feature::Echo {{{*/ -void KML_Feature::Echo(){ - - bool flag=true; - - KML_Object::Echo(); - - if(flag) _pprintLine_(" name: \"" << name << "\""); - if(flag) _pprintLine_(" visibility: " << (visibility ? "true" : "false")); - if(flag) _pprintLine_(" open: " << (open ? "true" : "false")); - if(flag) _pprintLine_(" snippet: \"" << snippet << "\""); - if(flag) _pprintLine_(" descript: \"" << descript << "\""); - if(flag) _pprintLine_(" styleurl: \"" << styleurl << "\""); - if(flag) _pprintLine_(" style: (size=" << style->Size() << ")"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Feature::DeepEcho {{{*/ -void KML_Feature::DeepEcho(){ - - char indent[81]=""; - - KML_Feature::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Feature::DeepEcho {{{*/ -void KML_Feature::DeepEcho(const char* indent){ - - int i; - char indent2[81]; - bool flag=true; - - KML_Object::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " name: \"" << name << "\""); - if(flag) _pprintLine_(indent << " visibility: " << (visibility ? "true" : "false")); - if(flag) _pprintLine_(indent << " open: " << (open ? "true" : "false")); - if(flag) _pprintLine_(indent << " snippet: \"" << snippet << "\""); - if(flag) _pprintLine_(indent << " descript: \"" << descript << "\""); - if(flag) _pprintLine_(indent << " styleurl: \"" << styleurl << "\""); - -/* loop over any styles for the feature */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - strcat(indent2," "); - - if (style->Size()) - for (i=0; iSize(); i++) { - if(flag) _pprintLine_(indent << " style: -------- begin [" << i << "] --------"); - ((KML_Style *)style->GetObjectByOffset(i))->DeepEcho(indent2); - if(flag) _pprintLine_(indent << " style: -------- end [" << i << "] --------"); - } - else - if(flag) _pprintLine_(indent << " style: [empty]"); - - return; -} -/*}}}*/ -/*FUNCTION KML_Feature::Write {{{*/ -void KML_Feature::Write(FILE* filout,const char* indent){ - - int i; - char indent2[81]; - - KML_Object::Write(filout,indent); - - if (name && strlen(name)) - fprintf(filout,"%s %s\n",indent,name); - fprintf(filout,"%s %d\n",indent,(visibility ? 1 : 0)); - fprintf(filout,"%s %d\n",indent,(open ? 1 : 0)); - if (snippet && strlen(snippet)) - fprintf(filout,"%s %s\n",indent,snippet); - if (descript && strlen(descript)) - fprintf(filout,"%s %s\n",indent,descript); - if (styleurl && strlen(styleurl)) - fprintf(filout,"%s %s\n",indent,styleurl); - -/* loop over any styles for the feature */ - - memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char)); - - strcat(indent2," "); - - for (i=0; iSize(); i++) - ((KML_Style *)style->GetObjectByOffset(i))->Write(filout,indent2); - - return; -} -/*}}}*/ -/*FUNCTION KML_Feature::Read {{{*/ -void KML_Feature::Read(FILE* fid,char* kstr){ - - KML_Object* kobj; - -/* process field within opening and closing tags */ - - if (!strncmp(kstr,"Read(fid,kstr); - style ->AddObject((Object*)kobj); - } - - else if (!strcmp(kstr,"")) - KMLFileTokenParse( name ,NULL,KML_FEATURE_NAME_LENGTH, kstr, fid); - else if (!strcmp(kstr,"")) - KMLFileTokenParse(&visibility, kstr, fid); - else if (!strcmp(kstr,"")) - KMLFileTokenParse(&open , kstr, fid); - else if (!strncmp(kstr,"")) - KMLFileTokenParse( descript ,NULL,KML_FEATURE_DESCRIPT_LENGTH, kstr, fid); - else if (!strcmp(kstr,"")) - KMLFileTokenParse( styleurl ,NULL,KML_FEATURE_STYLEURL_LENGTH, kstr, fid); - - else if (!strncmp(kstr,"<",1)) - KML_Object::Read(fid,kstr); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.cpp (revision 15012) @@ -1,88 +0,0 @@ -/*!\file KML_Geometry.cpp - * \brief: implementation of the kml_geometry abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Geometry::KML_Geometry(){{{*/ -KML_Geometry::KML_Geometry(){ - - ; - -} -/*}}}*/ -/*FUNCTION KML_Geometry::~KML_Geometry(){{{*/ -KML_Geometry::~KML_Geometry(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Geometry::Echo {{{*/ -void KML_Geometry::Echo(){ - - this->KML_Object::Echo(); - - return; -} -/*}}}*/ -/*FUNCTION KML_Geometry::DeepEcho {{{*/ -void KML_Geometry::DeepEcho(){ - - char indent[81]=""; - - KML_Geometry::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Geometry::DeepEcho {{{*/ -void KML_Geometry::DeepEcho(const char* indent){ - - this->KML_Object::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Geometry::Write {{{*/ -void KML_Geometry::Write(FILE* filout,const char* indent){ - - KML_Object::Write(filout,indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Geometry::Read {{{*/ -void KML_Geometry::Read(FILE* fid,char* kstr){ - -/* process field within opening and closing tags */ - - if (!strncmp(kstr," -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_ColorStyle::KML_ColorStyle(){{{*/ -KML_ColorStyle::KML_ColorStyle(){ - - strcpy(color ,"ffffffff"); - strcpy(colormode ,"normal"); - -} -/*}}}*/ -/*FUNCTION KML_ColorStyle::~KML_ColorStyle(){{{*/ -KML_ColorStyle::~KML_ColorStyle(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_ColorStyle::Echo {{{*/ -void KML_ColorStyle::Echo(){ - - bool flag=true; - - KML_SubStyle::Echo(); - - if(flag) _pprintLine_(" color: " << color); - if(flag) _pprintLine_(" colormode: " << colormode); - - return; -} -/*}}}*/ -/*FUNCTION KML_ColorStyle::DeepEcho {{{*/ -void KML_ColorStyle::DeepEcho(){ - - char indent[81]=""; - - KML_ColorStyle::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_ColorStyle::DeepEcho {{{*/ -void KML_ColorStyle::DeepEcho(const char* indent){ - - bool flag=true; - - KML_SubStyle::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " color: " << color); - if(flag) _pprintLine_(indent << " colormode: " << colormode); -} -/*}}}*/ -/*FUNCTION KML_ColorStyle::Write {{{*/ -void KML_ColorStyle::Write(FILE* filout,const char* indent){ - - KML_SubStyle::Write(filout,indent); - - if (color && strlen(color)) - fprintf(filout,"%s %s\n",indent,color); - if (colormode && strlen(colormode)) - fprintf(filout,"%s %s\n",indent,colormode); - - return; -} -/*}}}*/ -/*FUNCTION KML_ColorStyle::Read {{{*/ -void KML_ColorStyle::Read(FILE* fid,char* kstr){ - -/* process field within opening and closing tags */ - - if (!strncmp(kstr,"")) - KMLFileTokenParse( color ,NULL,KML_COLORSTYLE_COLOR_LENGTH, kstr, fid); - else if (!strcmp(kstr,"")) - KMLFileTokenParse( colormode ,NULL,KML_COLORSTYLE_COLORMODE_LENGTH, kstr, fid); - - else if (!strncmp(kstr,"<",1)) - KML_SubStyle::Read(fid,kstr); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_LinearRing.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_LinearRing.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_LinearRing.h (revision 15012) @@ -1,45 +0,0 @@ -/*! \file KML_LinearRing.h - * \brief: header file for kml_linearring object - */ - -#ifndef _KML_LINEARRING_H_ -#define _KML_LINEARRING_H_ - -#define KML_LINEARRING_ALTMODE_LENGTH 18 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Geometry.h" -/*}}}*/ - -class KML_LinearRing: public KML_Geometry { - - public: - - bool extrude; - bool tessellate; - char altmode[KML_LINEARRING_ALTMODE_LENGTH+1]; - int ncoord; - double *coords; - - /*KML_LinearRing constructors, destructors {{{*/ - KML_LinearRing(); - ~KML_LinearRing(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LINEARRING_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.cpp (revision 15012) @@ -1,92 +0,0 @@ -/*!\file KML_StyleSelector.cpp - * \brief: implementation of the kml_styleselector abstract object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_StyleSelector::KML_StyleSelector(){{{*/ -KML_StyleSelector::KML_StyleSelector(){ - - ; - -} -/*}}}*/ -/*FUNCTION KML_StyleSelector::~KML_StyleSelector(){{{*/ -KML_StyleSelector::~KML_StyleSelector(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_StyleSelector::Echo {{{*/ -void KML_StyleSelector::Echo(){ - - KML_Object::Echo(); - - return; -} -/*}}}*/ - -/*FUNCTION KML_StyleSelector::DeepEcho {{{*/ -void KML_StyleSelector::DeepEcho(){ - - char indent[81]=""; - - KML_StyleSelector::DeepEcho(indent); - - return; -} -/*}}}*/ - -/*FUNCTION KML_StyleSelector::DeepEcho {{{*/ -void KML_StyleSelector::DeepEcho(const char* indent){ - - KML_Object::DeepEcho(indent); - - return; -} -/*}}}*/ - -/*FUNCTION KML_StyleSelector::Write {{{*/ -void KML_StyleSelector::Write(FILE* filout,const char* indent){ - - KML_Object::Write(filout,indent); - - return; -} -/*}}}*/ - -/*FUNCTION KML_StyleSelector::Read {{{*/ -void KML_StyleSelector::Read(FILE* fid,char* kstr){ - -/* process field within opening and closing tags */ - - if (!strncmp(kstr," -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_LatLonBox::KML_LatLonBox(){{{*/ -KML_LatLonBox::KML_LatLonBox(){ - - north = 0.; - south = 0.; - east = 0.; - west = 0.; - rotation = 0.; - -} -/*}}}*/ -/*FUNCTION KML_LatLonBox::~KML_LatLonBox(){{{*/ -KML_LatLonBox::~KML_LatLonBox(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_LatLonBox::Echo {{{*/ -void KML_LatLonBox::Echo(){ - - _printLine_("KML_LatLonBox:"); - KML_Object::Echo(); - - _printLine_(" north: " << north); - _printLine_(" south: " << south); - _printLine_(" east: " << east); - _printLine_(" west: " << west); - _printLine_(" rotation: " << rotation); -} -/*}}}*/ -/*FUNCTION KML_LatLonBox::DeepEcho {{{*/ -void KML_LatLonBox::DeepEcho(){ - - char indent[81]=""; - - KML_LatLonBox::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LatLonBox::DeepEcho {{{*/ -void KML_LatLonBox::DeepEcho(const char* indent){ - - _printLine_(indent << "KML_LatLonBox:"); - KML_Object::DeepEcho(indent); - - _printLine_(" north: " << north); - _printLine_(" south: " << south); - _printLine_(" east: " << east); - _printLine_(" west: " << west); - _printLine_(" rotation: " << rotation); -} -/*}}}*/ -/*FUNCTION KML_LatLonBox::Write {{{*/ -void KML_LatLonBox::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_Object::Write(filout,indent); - - fprintf(filout,"%s %0.16g\n",indent,north); - fprintf(filout,"%s %0.16g\n",indent,south); - fprintf(filout,"%s %0.16g\n",indent,east); - fprintf(filout,"%s %0.16g\n",indent,west); - fprintf(filout,"%s %0.16g\n",indent,rotation); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_LatLonBox::Read {{{*/ -void KML_LatLonBox::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&north , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&south , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&east , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&west , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&rotation , - kstri, - fid); - - else if (!strncmp(kstri,"<",1)) - KML_Object::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.cpp (revision 15012) @@ -1,131 +0,0 @@ -/*!\file KML_Attribute.cpp - * \brief: implementation of the kml_attribute object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_Attribute::KML_Attribute(){{{*/ -KML_Attribute::KML_Attribute(){ - - name =NULL; - value =NULL; - -} -/*}}}*/ -/*FUNCTION KML_Attribute::~KML_Attribute(){{{*/ -KML_Attribute::~KML_Attribute(){ - - if (name ) xDelete(name); - if (value ) xDelete(value); - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_Attribute::Echo {{{*/ -void KML_Attribute::Echo(){ - - int i; - bool flag=true; - - if(flag) _pprintString_(" "); - for (i=0;i<10-strlen(name);i++) - if(flag) _pprintString_(" "); - if(flag) _pprintLine_(name << ": \"" << value << "\""); - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::DeepEcho {{{*/ -void KML_Attribute::DeepEcho(){ - - char indent[81]=""; - - KML_Attribute::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::DeepEcho {{{*/ -void KML_Attribute::DeepEcho(const char* indent){ - - int i; - bool flag=true; - - if(flag) _pprintString_(indent << " "); - for (i=0;i<10-strlen(name);i++) - if(flag) _pprintString_(" "); - if(flag) _pprintLine_(name << ": \"" << value << "\""); - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::Write {{{*/ -void KML_Attribute::Write(FILE* filout,const char* indent){ - -// attributes always written in keyword line of kml_object - - fprintf(filout,"%s%s=\"%s\"",indent,name,value); - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::Read {{{*/ -void KML_Attribute::Read(FILE* fid,char* kstr){ - -// attributes always read in keyword line of kml_object - - ; - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::Alloc {{{*/ -void KML_Attribute::Alloc(const char* namei,const char* valuei){ - - name =xNew(strlen(namei )+1); - memcpy(name,namei,(strlen(namei)+1)*sizeof(char)); - - value=xNew(strlen(valuei)+1); - memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char)); - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::Add {{{*/ -void KML_Attribute::Add(DataSet* attrib){ - - attrib->AddObject((Object*)this); - - return; -} -/*}}}*/ -/*FUNCTION KML_Attribute::Get {{{*/ -void KML_Attribute::Get(char** pvalueo,char* deflt){ - - if (!value || !strlen(value)) { - *pvalueo=xNew(strlen(deflt)+1); - memcpy(*pvalueo,deflt,(strlen(deflt)+1)*sizeof(char)); - } - else { - *pvalueo=xNew(strlen(value)+1); - memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); - } - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.h (revision 15012) @@ -1,41 +0,0 @@ -/*! \file KML_Placemark.h - * \brief: header file for kml_placemark object - */ - -#ifndef _KML_PLACEMARK_H_ -#define _KML_PLACEMARK_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Feature.h" -class KML_Geometry; -class DataSet; -/*}}}*/ - -class KML_Placemark: public KML_Feature { - - public: - - DataSet* geometry; - - /*KML_Placemark constructors, destructors {{{*/ - KML_Placemark(); - ~KML_Placemark(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - void WriteExp(FILE* fid,const char* nstr,int sgn,double cm,double sp); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_PLACEMARK_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.cpp (revision 15012) @@ -1,143 +0,0 @@ -/*!\file KML_PolyStyle.cpp - * \brief: implementation of the kml_polystyle object - */ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -#include "../../../shared/io/io.h" -/*}}}*/ - -/*Constructors/destructor/copy*/ -/*FUNCTION KML_PolyStyle::KML_PolyStyle(){{{*/ -KML_PolyStyle::KML_PolyStyle(){ - - fill =true; - outline =true; - -} -/*}}}*/ -/*FUNCTION KML_PolyStyle::~KML_PolyStyle(){{{*/ -KML_PolyStyle::~KML_PolyStyle(){ - - ; - -} -/*}}}*/ - -/*Other*/ -/*FUNCTION KML_PolyStyle::Echo {{{*/ -void KML_PolyStyle::Echo(){ - - bool flag=true; - - if(flag) _pprintLine_("KML_PolyStyle:"); - KML_ColorStyle::Echo(); - - if(flag) _pprintLine_(" fill: " << fill); - if(flag) _pprintLine_(" outline: " << outline); - - return; -} -/*}}}*/ -/*FUNCTION KML_PolyStyle::DeepEcho {{{*/ -void KML_PolyStyle::DeepEcho(){ - - char indent[81]=""; - - KML_PolyStyle::DeepEcho(indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_PolyStyle::DeepEcho {{{*/ -void KML_PolyStyle::DeepEcho(const char* indent){ - - bool flag=true; - - if(flag) _pprintLine_(indent << "KML_PolyStyle:"); - KML_ColorStyle::DeepEcho(indent); - - if(flag) _pprintLine_(indent << " fill: " << fill); - if(flag) _pprintLine_(indent << " outline: " << outline); - - return; -} -/*}}}*/ -/*FUNCTION KML_PolyStyle::Write {{{*/ -void KML_PolyStyle::Write(FILE* filout,const char* indent){ - - fprintf(filout,"%s\n"); - WriteCommnt(filout,indent); - - KML_ColorStyle::Write(filout,indent); - - fprintf(filout,"%s %d\n",indent,fill); - fprintf(filout,"%s %d\n",indent,outline); - - fprintf(filout,"%s\n",indent); - - return; -} -/*}}}*/ -/*FUNCTION KML_PolyStyle::Read {{{*/ -void KML_PolyStyle::Read(FILE* fid,char* kstr){ - - char* kstri; - int ncom=0; - char** pcom=NULL; - -/* get object attributes and check for solo tag */ - - if (KMLFileTagAttrib(this, - kstr)) - return; - -/* loop over and process fields within opening and closing tags */ - - while (kstri=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstri,"(kstri); - break; - } - else if (!strncmp(kstri,"")) - KMLFileTokenParse(&fill , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&outline , - kstri, - fid); - - else if (!strncmp(kstri,"<",1)) - KML_ColorStyle::Read(fid,kstri); - - xDelete(kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xDelete(pcom[ncom-1]); - xDelete(pcom); - - return; -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.h (revision 15012) @@ -1,39 +0,0 @@ -/*! \file KML_Unknown.h - * \brief: header file for kml_unknown object - */ - -#ifndef _KML_UNKNOWN_H_ -#define _KML_UNKNOWN_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Object.h" -/*}}}*/ - -class KML_Unknown: public KML_Object { - - public: - - char* name; - char* value; - - /*KML_Unknown constructors, destructors {{{*/ - KML_Unknown(); - ~KML_Unknown(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_UNKNOWN_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.h (revision 15012) @@ -1,43 +0,0 @@ -/*! \file KML_GroundOverlay.h - * \brief: header file for kml_groundoverlay object - */ - -#ifndef _KML_GROUNDOVERLAY_H_ -#define _KML_GROUNDOVERLAY_H_ - -#define KML_GROUNDOVERLAY_ALTMODE_LENGTH 18 - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_Overlay.h" -class KML_LatLonBox; -/*}}}*/ - -class KML_GroundOverlay: public KML_Overlay { - - public: - - double altitude; - char altmode[KML_GROUNDOVERLAY_ALTMODE_LENGTH+1]; - KML_LatLonBox* llbox; - - /*KML_GroundOverlay constructors, destructors {{{*/ - KML_GroundOverlay(); - ~KML_GroundOverlay(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_GROUNDOVERLAY_H */ Index: ../trunk-jpl/src/c/classes/objects/KML/KML_Style.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/KML/KML_Style.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/KML/KML_Style.h (revision 15012) @@ -1,45 +0,0 @@ -/*! \file KML_Style.h - * \brief: header file for kml_style object - */ - -#ifndef _KML_STYLE_H_ -#define _KML_STYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../../shared/Exceptions/exceptions.h" -#include "../../../shared/Enum/Enum.h" - -#include "./KML_StyleSelector.h" -class KML_LineStyle; -class KML_PolyStyle; -/*}}}*/ - -class KML_Style: public KML_StyleSelector { - - public: - - void* icon; - void* label; - KML_LineStyle* line; - KML_PolyStyle* poly; - void* balloon; - void* list; - - /*KML_Style constructors, destructors {{{*/ - KML_Style(); - ~KML_Style(); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - void DeepEcho(const char* indent); - void Write(FILE* fid,const char* indent); - void Read(FILE* fid,char* kstr); - int Id(){_error_("Not implemented yet.");}; - int ObjectEnum(){_error_("Not implemented yet.");}; - Object* copy(){_error_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_STYLE_H */ Index: ../trunk-jpl/src/c/classes/objects/DependentObject.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/DependentObject.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/DependentObject.h (revision 15012) @@ -1,41 +0,0 @@ -/*!\file: DependentObject.h - * \brief prototype for DependentObject.h - */ - -#ifndef _DEPENDENTOBJECT_H_ -#define _DEPENDENTOBJECT_H_ - -/*{{{*/ -#include "./Object.h" -#include "../../shared/shared.h" -/*}}}*/ - -class FemModel; - -class DependentObject: public Object{ - - public: - - int name; - int type; /*0: scalar, 1: vertex*/ - int index; /*0: scalar, 1: vertex*/ - - /*DependentObject constructors, destructors {{{*/ - DependentObject(); - DependentObject(int name, int type,int index); - ~DependentObject(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(void); - /*}}}*/ - - /*DependentObject methods: */ - int NumDependents(void); - void Responsex(IssmDouble* poutput_value,FemModel* femmodel); - -}; -#endif //ifndef _DEPENDENTOBJECT_H_ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h (revision 15012) @@ -1,76 +0,0 @@ -/*! \file DoubleVecParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _DOUBLEVECPARAM_H_ -#define _DOUBLEVECPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class DoubleVecParam: public Param{ - - private: - int enum_type; - IssmDouble *values; - int M; - - public: - /*DoubleVecParam constructors, destructors: {{{*/ - DoubleVecParam(); - DoubleVecParam(int enum_type,IssmDouble* values,int M); - ~DoubleVecParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param virtual functions definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM); - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");}; - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M); - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif /* _DOUBLEVECPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/FileParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/FileParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/FileParam.cpp (revision 15012) @@ -1,81 +0,0 @@ -/*!\file FileParam.c - * \brief: implementation of the FileParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*FileParam constructors and destructor*/ -/*FUNCTION FileParam::FileParam(){{{*/ -FileParam::FileParam(){ - return; -} -/*}}}*/ -/*FUNCTION FileParam::FileParam(int enum_type,FILE *value){{{*/ -FileParam::FileParam(int in_enum_type,FILE* in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION FileParam::~FileParam(){{{*/ -FileParam::~FileParam(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION FileParam::Echo {{{*/ -void FileParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION FileParam::DeepEcho{{{*/ -void FileParam::DeepEcho(void){ - - _printLine_("FileParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " << this->value); -} -/*}}}*/ -/*FUNCTION FileParam::Id{{{*/ -int FileParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION FileParam::ObjectEnum{{{*/ -int FileParam::ObjectEnum(void){ - - return FileParamEnum; - -} -/*}}}*/ -/*FUNCTION FileParam::copy{{{*/ -Object* FileParam::copy() { - - return new FileParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*FileParam virtual functions definitions: */ -/*FUNCTION FileParam::GetParameterName{{{*/ -void FileParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION FileParam::UnitConversion{{{*/ -void FileParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file DoubleParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _DOUBLEPARAM_H_ -#define _DOUBLEPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class DoubleParam: public Param{ - - private: - /*just hold 3 values for 3 vertices: */ - int enum_type; - IssmDouble value; - - public: - /*DoubleParam constructors, destructors: {{{*/ - DoubleParam(); - DoubleParam(int enum_type,IssmDouble value); - ~DoubleParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool); - void GetParameterValue(int* pinteger); - void GetParameterValue(int** pintarray,int* pM); - void GetParameterValue(int** pintarray,int* pM,int* pN); - void GetParameterValue(IssmDouble* pIssmDouble){*pIssmDouble=value;} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){this->value=(IssmDouble)boolean;} - void SetValue(int integer){this->value=(IssmDouble)integer;} - void SetValue(IssmDouble scalar){this->value=(IssmDouble)scalar;} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _DOUBLEPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h (revision 15012) @@ -1,79 +0,0 @@ -/*! \file DoubleMatArrayParam.h - * \brief: header file for object holding an array of serial matrices - */ - -#ifndef _DOUBLEMATARRAYPARAM_H_ -#define _DOUBLEMATARRAYPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class DoubleMatArrayParam: public Param{ - - private: - int enum_type; - IssmDouble **array; //array of matrices - int M; //size of array - int *mdim_array; //m-dimensions of matrices in the array - int *ndim_array; //n-dimensions -f matrices in the array - - public: - /*DoubleMatArrayParam constructors, destructors: {{{*/ - DoubleMatArrayParam(); - DoubleMatArrayParam(int enum_type,IssmDouble** array, int M, int* mdim_array, int* ndim_array); - ~DoubleMatArrayParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << "cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims); - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a scalar");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble vec array");} - void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble mat array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a int vec array");} - void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a int mat array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array); - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _DOUBLEMATARRAYPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/GenericParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/GenericParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/GenericParam.h (revision 15012) @@ -1,98 +0,0 @@ -/* - * GenericParam.h - * - * Created on: Aug 29, 2012 - * Author: utke - */ - -#ifndef GENERICPARAM_H_ -#define GENERICPARAM_H_ - -/*Headers:*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif -#include "./Param.h" -#include "../../../shared/shared.h" -#include "../../../shared/Enum/Enum.h" - -/** - * here we have a class that holds an instance of P - * but because it should live side by side with - * the other instances derived from Param it - unfortunately - - * inherits all the accessors that are useless in this context - */ -template class GenericParam: public Param{ - - private: - P myP; - int myEnumVal; - - public: - /*GenericParam constructors, destructors: {{{*/ - GenericParam(int enumVal) : myEnumVal(enumVal){}; - ~GenericParam(){}; - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - // unfortunately, having to implement such a printer method implies - // that any structured P must provide the friend << operator - void DeepEcho() { - _printLine_("GenericParam:"); - _printLine_(" enum: " << myEnumVal << " (" << EnumToStringx(myEnumVal) << ")"); - _printLine_(" value: " << myP);; - } - void Echo() {DeepEcho();}; - int Id(){ return -1; }; - int ObjectEnum() {return AdolcParamEnum;}; - - // the "copy" has to implement the base class abstract function - // but I would prefer to drop this not to hide a "new" in here because - // it does not clarify ownership of the newed up instance... - // use the default copy constructor instead - Object* copy() { return new GenericParam

(*this); }; - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return myEnumVal;} - void GetParameterName(char**pname) {EnumToStringx(pname,this->myEnumVal);} - - P& GetParameterValue() { return myP;} - const P& GetParameterValue()const { return myP;}; - - // none of these apply ... - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a bool");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an integer");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an int array");} - void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an int array");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an IssmDouble");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum) {/* nothing useful here either */}; - - /*}}}*/ -}; - -#endif /* GENERICPARAM_H_ */ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h (revision 15012) @@ -1,78 +0,0 @@ -/*! \file DoubleMatParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _DOUBLEMATPARAM_H_ -#define _DOUBLEMATPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class DoubleMatParam: public Param{ - - protected: - int enum_type; - IssmDouble *value; - int M; - int N; - - public: - /*DoubleMatParam constructors, destructors: {{{*/ - DoubleMatParam(); - DoubleMatParam(int enum_type,IssmDouble* value,int M,int N); - ~DoubleMatParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN); - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN); - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} - void SetValue(IssmDouble* IssmDoublearray,int M,int N); - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");} - void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _DOUBLEMATPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/Parameters.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/Parameters.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/Parameters.h (revision 15012) @@ -1,65 +0,0 @@ -#ifndef _CONTAINER_PARAMETERS_H_ -#define _CONTAINER_PARAMETERS_H_ -#include - -/*forward declarations */ -template class Matrix; -template class Vector; -#include "../DataSet.h" -#include "../../../shared/shared.h" - -/*!\brief Declaration of Parameters class. - * - * Declaration of Parameters class. Parameters are vector lists (Containers) of Parameter objects. - */ -class Parameters: public DataSet{ - - public: - - /*constructors, destructors*/ - Parameters(); - ~Parameters(); - - /*numerics*/ - bool Exist(int enum_type); - - void FindParam(bool* pinteger,int enum_type); - void FindParam(int* pinteger,int enum_type); - void FindParam(IssmDouble* pscalar, int enum_type); - void FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time); - void FindParam(char** pstring,int enum_type); - void FindParam(char*** pstringarray,int* pM,int enum_type); - void FindParam(int** pintarray,int* pM,int enum_type); - void FindParam(int** pintarray,int* pM,int* PN,int enum_type); - void FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type); - void FindParam(IssmDouble** pIssmDoublearray,int* pM,int* pN,int enum_type); - void FindParam(IssmDouble*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type); - void FindParam(Vector** pvec,int enum_type); - void FindParam(Matrix** pmat,int enum_type); - void FindParam(FILE** pfid,int enum_type); - void FindParam(DataSet** pdataset, int enum_type); - - void SetParam(bool boolean,int enum_type); - void SetParam(int integer,int enum_type); - void SetParam(IssmDouble scalar, int enum_type); - void SetParam(char* string,int enum_type); - void SetParam(char** stringarray,int M,int enum_type); - void SetParam(IssmDouble* IssmDoublearray,int M,int enum_type); - void SetParam(IssmDouble* IssmDoublearray,int M,int N,int enum_type); - void SetParam(int* intarray,int M,int enum_type); - void SetParam(int* intarray,int M,int N,int enum_type); - void SetParam(Vector* vec,int enum_type); - void SetParam(Matrix* mat,int enum_type); - void SetParam(FILE* fid,int enum_type); - void UnitConversion(int direction_enum); - - Object* FindParamObject(int enum_type); - -}; - -/*Methods relating to parameters: */ -char *OptionsFromAnalysis(Parameters *parameters,int analysis_type); -void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type); - - -#endif //ifndef _PARAMETERS_H_ Index: ../trunk-jpl/src/c/classes/objects/Params/DataSetParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DataSetParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DataSetParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file DataSetParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _DATASETPARAM_H_ -#define _DATASETPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class DataSetParam: public Param{ - - private: - int enum_type; - DataSet* value; - - public: - /*DataSetParam constructors, destructors: {{{*/ - DataSetParam(); - DataSetParam(int enum_type,DataSet* dataset); - ~DataSetParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){ _error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(FILE** pfile){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a file pointer");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(DataSet** pdataset); - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a file pointer");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(DataSet* dataset){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a DataSet yet");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _INTPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/IntVecParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/IntVecParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/IntVecParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file IntVecParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _INTVECPARAM_H_ -#define _INTVECPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class IntVecParam: public Param{ - - private: - int enum_type; - int* values; - int M; - - public: - /*IntVecParam constructors, destructors: {{{*/ - IntVecParam(); - IntVecParam(int enum_type,int* values,int M); - IntVecParam(int enum_type,IssmDouble* values,int M); - ~IntVecParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param virtual functions definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM); - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array (maybe in serial?)");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} - void SetValue(int* intarray,int M); - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif Index: ../trunk-jpl/src/c/classes/objects/Params/IntParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/IntParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/IntParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file IntParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _INTPARAM_H_ -#define _INTPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class IntParam: public Param{ - - private: - /*just hold 3 values for 3 vertices: */ - int enum_type; - IssmInt value; - - public: - /*IntParam constructors, destructors: {{{*/ - IntParam(); - IntParam(int enum_type,IssmInt value); - ~IntParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){*pinteger=value;} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a bool");} - void SetValue(int integer){this->value=integer;} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} - void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _INTPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/BoolParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/BoolParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/BoolParam.h (revision 15012) @@ -1,75 +0,0 @@ -/*! \file BoolParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _BOOLPARAM_H_ -#define _BOOLPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class BoolParam: public Param{ - - public: - /*just hold 3 values for 3 vertices: */ - int enum_type; - bool value; - - /*BoolParam constructors, destructors: {{{*/ - BoolParam(); - BoolParam(int enum_type,bool value); - ~BoolParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){*pbool=value;} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){this->value=boolean;} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an int");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmPDouble");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif /* _BOOLPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/IntMatParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/IntMatParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/IntMatParam.h (revision 15012) @@ -1,78 +0,0 @@ -/*! \file IntMatParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _INTMATPARAM_H_ -#define _INTMATPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class IntMatParam: public Param{ - - private: - int enum_type; - int* value; - int M; - int N; - - public: - /*IntMatParam constructors, destructors: {{{*/ - IntMatParam(); - IntMatParam(int enum_type,int* value,int M,int N); - ~IntMatParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN); - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}; - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} - void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");}; - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");}; - void SetValue(int* intarray,int M,int N); - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _INTMATPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp (revision 15012) @@ -1,111 +0,0 @@ -/*!\file VectorParam.c - * \brief: implementation of the VectorParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*VectorParam constructors and destructor*/ -/*FUNCTION VectorParam::VectorParam(){{{*/ -VectorParam::VectorParam(){ - return; -} -/*}}}*/ -/*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{*/ -VectorParam::VectorParam(int in_enum_type,Vector* in_value){ - - enum_type=in_enum_type; - - value=NULL; - - if(in_value){ - value=in_value->Duplicate(); - in_value->Copy(value); - } -} -/*}}}*/ -/*FUNCTION VectorParam::~VectorParam(){{{*/ -VectorParam::~VectorParam(){ - delete value; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION VectorParam::Echo {{{*/ -void VectorParam::Echo(void){ - - _printLine_("VectorParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - -} -/*}}}*/ -/*FUNCTION VectorParam::DeepEcho{{{*/ -void VectorParam::DeepEcho(void){ - - _printLine_("VectorParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - value->Echo(); -} -/*}}}*/ -/*FUNCTION VectorParam::Id{{{*/ -int VectorParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION VectorParam::ObjectEnum{{{*/ -int VectorParam::ObjectEnum(void){ - - return VectorParamEnum; - -} -/*}}}*/ -/*FUNCTION VectorParam::copy{{{*/ -Object* VectorParam::copy() { - - return new VectorParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*VectorParam virtual functions definitions: */ -/*FUNCTION VectorParam::GetParameterValue{{{*/ -void VectorParam::GetParameterValue(Vector** poutput){ - Vector* output=NULL; - - if(value){ - output=value->Duplicate(); - value->Copy(output); - } - *poutput=output; -} -/*}}}*/ -/*FUNCTION VectorParam::GetParameterName{{{*/ -void VectorParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION VectorParam::SetValue{{{*/ -void VectorParam::SetValue(Vector* vector){ - - /*avoid leak: */ - delete value; - - /*copy: */ - value=vector->Duplicate(); - vector->Copy(value); -} -/*}}}*/ -/*FUNCTION VectorParam::UnitConversion{{{*/ -void VectorParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp (revision 15012) @@ -1,107 +0,0 @@ -/*!\file MatrixParam.c - * \brief: implementation of the MatrixParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*MatrixParam constructors and destructor*/ -/*FUNCTION MatrixParam::MatrixParam(){{{*/ -MatrixParam::MatrixParam(){ - return; -} -/*}}}*/ -/*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix* value){{{*/ -MatrixParam::MatrixParam(int in_enum_type,Matrix* in_value){ - - enum_type=in_enum_type; - value=NULL; - - if(in_value){ - value=in_value->Duplicate(); - } -} -/*}}}*/ -/*FUNCTION MatrixParam::~MatrixParam(){{{*/ -MatrixParam::~MatrixParam(){ - delete value; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION MatrixParam::Echo {{{*/ -void MatrixParam::Echo(void){ - - _printLine_("MatrixParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - -} -/*}}}*/ -/*FUNCTION MatrixParam::DeepEcho{{{*/ -void MatrixParam::DeepEcho(void){ - - _printLine_("MatrixParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - this->value->Echo(); -} -/*}}}*/ -/*FUNCTION MatrixParam::Id{{{*/ -int MatrixParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION MatrixParam::ObjectEnum{{{*/ -int MatrixParam::ObjectEnum(void){ - - return MatrixParamEnum; - -} -/*}}}*/ -/*FUNCTION MatrixParam::copy{{{*/ -Object* MatrixParam::copy() { - - return new MatrixParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*MatrixParam virtual functions definitions: */ -/*FUNCTION MatrixParam::GetParameterValue{{{*/ -void MatrixParam::GetParameterValue(Matrix** poutput){ - Matrix* output=NULL; - - if(value){ - output=value->Duplicate(); - } - *poutput=output; -} -/*}}}*/ -/*FUNCTION MatrixParam::GetParameterName{{{*/ -void MatrixParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION MatrixParam::SetValue{{{*/ -void MatrixParam::SetValue(Matrix* matrix){ - - /*avoid leak: */ - delete value; - - /*copy: */ - value=matrix->Duplicate(); -} -/*}}}*/ -/*FUNCTION MatrixParam::UnitConversion{{{*/ -void MatrixParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.cpp (revision 15012) @@ -1,142 +0,0 @@ -/*!\file DoubleVecParam.c - * \brief: implementation of the DoubleVecParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*DoubleVecParam constructors and destructor*/ -/*FUNCTION DoubleVecParam::DoubleVecParam(){{{*/ -DoubleVecParam::DoubleVecParam(){ - return; -} -/*}}}*/ -/*FUNCTION DoubleVecParam::DoubleVecParam(int enum_type,IssmDoubleVec values,int M){{{*/ -DoubleVecParam::DoubleVecParam(int in_enum_type,IssmDouble* in_values, int in_M){ - - enum_type=in_enum_type; - M=in_M; - - values=xNew(M); - xMemCpy(values,in_values,M); -} -/*}}}*/ -/*FUNCTION DoubleVecParam::~DoubleVecParam(){{{*/ -DoubleVecParam::~DoubleVecParam(){ - xDelete(values); - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION DoubleVecParam::Echo {{{*/ -void DoubleVecParam::Echo(void){ - - _printLine_("DoubleVecParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" vector size: " << this->M); - -} -/*}}}*/ -/*FUNCTION DoubleVecParam::DeepEcho{{{*/ -void DoubleVecParam::DeepEcho(void){ - - int i; - - _printLine_("DoubleVecParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" vector size: " << this->M); - for(i=0;iM;i++){ - _printLine_(i << " " << this->values[i]); - } -} -/*}}}*/ -/*FUNCTION DoubleVecParam::Id{{{*/ -int DoubleVecParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION DoubleVecParam::ObjectEnum{{{*/ -int DoubleVecParam::ObjectEnum(void){ - - return DoubleVecParamEnum; - -} -/*}}}*/ -/*FUNCTION DoubleVecParam::copy{{{*/ -Object* DoubleVecParam::copy() { - - return new DoubleVecParam(this->enum_type,this->values,this->M); - -} -/*}}}*/ - -/*DoubleVecParam virtual functions definitions: */ -/*FUNCTION DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ -void DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){ - IssmDouble* output=NULL; - int M; - - M=this->M; - output=xNew(M); - xMemCpy(output,values,M); - - /*Assign output pointers:*/ - if(pM) *pM=M; - *pIssmDoublearray=output; -} -/*}}}*/ -/*FUNCTION DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ -void DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ - IssmDouble* output=NULL; - int M; - int N; - - N=1; - M=this->M; - output=xNew(M); - xMemCpy(output,values,M); - - /*Assign output pointers:*/ - if(pM) *pM=M; - if(pN) *pN=N; - *pIssmDoublearray=output; -} -/*}}}*/ -/*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{*/ -void DoubleVecParam::GetParameterValue(int** pintarray,int* pM){ - _error_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of int"); -} -/*}}}*/ -/*FUNCTION DoubleVecParam::GetParameterName{{{*/ -void DoubleVecParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION DoubleVecParam::SetValue{{{*/ -void DoubleVecParam::SetValue(IssmDouble* IssmDoublearray,int in_M){ - - /*avoid leak: */ - xDelete(this->values); - - this->values=xNew(in_M); - xMemCpy(this->values,IssmDoublearray,in_M); - - this->M=in_M; -} -/*}}}*/ -/*FUNCTION DoubleVecParam::UnitConversion{{{*/ -void DoubleVecParam::UnitConversion(int direction_enum){ - ::UnitConversion(this->values,this->M,direction_enum,this->enum_type); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.h (revision 15012) @@ -1,30 +0,0 @@ -/*! \file DoubleTransientMatParam.h - * \brief: header file for DoubleTransientMatParam object - */ - -#ifndef _DOUBLETRANSIENTMATPARAM_H_ -#define _DOUBLETRANSIENTMATPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class DoubleTransientMatParam: public DoubleMatParam{ - - public: - /*DoubleTransientMatParam constructors, destructors: {{{*/ - DoubleTransientMatParam(int enum_type,IssmDouble* value,int M,int N); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - void UnitConversion(int direction_enum); - /*}}}*/ -}; -#endif /* _DOUBLETRANSIENTMATPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file StringArrayParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _STRINGARRAYPARAM_H_ -#define _STRINGARRAYPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class StringArrayParam: public Param{ - - private: - /*just hold 3 values for 3 vertices: */ - int enum_type; - char** value; - int numstrings; - - public: - /*StringArrayParam constructors, destructors: {{{*/ - StringArrayParam(); - StringArrayParam(int enum_type,char** values, int numstrings); - ~StringArrayParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM); - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Vec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M); - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif /* _STRINGARRAYPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleParam.cpp (revision 15012) @@ -1,108 +0,0 @@ -/*!\file DoubleParam.c - * \brief: implementation of the DoubleParam object - */ - -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" - -/*DoubleParam constructors and destructor*/ -/*FUNCTION DoubleParam::DoubleParam(){{{*/ -DoubleParam::DoubleParam(){ - return; -} -/*}}}*/ -/*FUNCTION DoubleParam::DoubleParam(int enum_type,IssmDouble value){{{*/ -DoubleParam::DoubleParam(int in_enum_type,IssmDouble in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION DoubleParam::~DoubleParam(){{{*/ -DoubleParam::~DoubleParam(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION DoubleParam::Echo {{{*/ -void DoubleParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION DoubleParam::DeepEcho{{{*/ -void DoubleParam::DeepEcho(void){ - - _printLine_("DoubleParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " << this->value); -} -/*}}}*/ -/*FUNCTION DoubleParam::Id{{{*/ -int DoubleParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION DoubleParam::ObjectEnum{{{*/ -int DoubleParam::ObjectEnum(void){ - - return DoubleParamEnum; - -} -/*}}}*/ -/*FUNCTION DoubleParam::copy{{{*/ -Object* DoubleParam::copy() { - - return new DoubleParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*DoubleParam virtual functions definitions: */ -/*FUNCTION DoubleParam::GetParameterName{{{*/ -void DoubleParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{*/ -void DoubleParam::GetParameterValue(int* pinteger){ - _error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer"); -} -/*}}}*/ -/*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{*/ -void DoubleParam::GetParameterValue(bool* pbool){ - _error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an bool"); -} -/*}}}*/ -/*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{*/ -void DoubleParam::GetParameterValue(int** pintarray,int* pM){ - _error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers"); -} -/*}}}*/ -/*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{*/ -void DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){ - _error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of integers"); -} -/*}}}*/ -/*FUNCTION DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ -void DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){ - _error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of IssmDouble"); -} -/*}}}*/ -/*FUNCTION DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){{{*/ -void DoubleParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ - _error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of IssmDouble"); -} -/*}}}*/ -/*FUNCTION DoubleParam::UnitConversion{{{*/ -void DoubleParam::UnitConversion(int direction_enum){ - ::UnitConversion(&this->value,1,direction_enum,this->enum_type); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/CMakeLists.txt =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/CMakeLists.txt (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/CMakeLists.txt (revision 15012) @@ -1,23 +0,0 @@ -# Subdirectories {{{ -# }}} -# Include Directory {{{ -include_directories(AFTER $ENV{ISSM_DIR}/src/c/classes/objects/Params) -# }}} -# CORE_SOURCES {{{ -set(CORE_SOURCES $ENV{ISSM_DIR}/src/c/classes/objects/Params/BoolParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/DataSetParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleMatArrayParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleMatParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleTransientMatParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleVecParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/FileParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/IntMatParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/IntParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/IntVecParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/MatrixParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/StringArrayParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/StringParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/TransientParam.cpp - $ENV{ISSM_DIR}/src/c/classes/objects/Params/VectorParam.cpp PARENT_SCOPE) -# }}} Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.cpp (revision 15012) @@ -1,242 +0,0 @@ -/*!\file DoubleMatArrayParam.c - * \brief: implementation of the DoubleMatArrayParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*DoubleMatArrayParam constructors and destructor*/ -/*FUNCTION DoubleMatArrayParam::DoubleMatArrayParam(){{{*/ -DoubleMatArrayParam::DoubleMatArrayParam(){ - return; -} -/*}}}*/ -/*FUNCTION DoubleMatArrayParam::DoubleMatArrayParam(int enum_type,IssmDouble** array, int M, int* mdim_array, int* ndim_array){{{*/ -DoubleMatArrayParam::DoubleMatArrayParam(int in_enum_type,IssmDouble** in_array, int in_M, int* in_mdim_array, int* in_ndim_array){ - - int i; - IssmDouble* matrix=NULL; - int m,n; - - enum_type=in_enum_type; - M=in_M; - if(M){ - array=xNew(M); - mdim_array=xNew(M); - ndim_array=xNew(M); - - for(i=0;i(m*n); - xMemCpy(matrix,in_array[i],m*n); - } - else{ - matrix=NULL; - } - array[i]=matrix; - } - } - else{ - array=NULL; - mdim_array=NULL; - ndim_array=NULL; - } -} -/*}}}*/ -/*FUNCTION DoubleMatArrayParam::~DoubleMatArrayParam(){{{*/ -DoubleMatArrayParam::~DoubleMatArrayParam(){ - - int i; - IssmDouble* matrix=NULL; - - xDelete(mdim_array); - xDelete(ndim_array); - - for(i=0;i(matrix); - } - - xDelete(array); - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION DoubleMatArrayParam::Echo {{{*/ -void DoubleMatArrayParam::Echo(void){ - - _printLine_("DoubleMatArrayParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" array size: " << this->M); - _printLine_(" array pointer: " << this->array); - -} -/*}}}*/ -/*FUNCTION DoubleMatArrayParam::DeepEcho{{{*/ -void DoubleMatArrayParam::DeepEcho(void){ - - int i,j,k; - int m,n; - IssmDouble* matrix=NULL; - - _printLine_("DoubleMatArrayParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" array size: " << this->M); - for(i=0;ienum_type,this->array, this->M, this->mdim_array,this->ndim_array); - -} -/*}}}*/ - -/*DoubleMatArrayParam virtual functions definitions: */ -/*FUNCTION DoubleMatArrayParam::GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){{{*/ -void DoubleMatArrayParam::GetParameterValue(IssmDouble*** pout_array, int* pout_M,int** pout_mdim_array, int** pout_ndim_array){ - - int i,m,n; - IssmDouble* matrix=NULL; - IssmDouble* out_matrix=NULL; - - /*output: */ - IssmDouble** out_array=NULL; - int out_M; - int* out_mdim_array=NULL; - int* out_ndim_array=NULL; - - out_M=this->M; - if(out_M){ - out_array=xNew(M); - out_mdim_array=xNew(M); - out_ndim_array=xNew(M); - - xMemCpy(out_mdim_array,this->mdim_array,M); - xMemCpy(out_ndim_array,this->ndim_array,M); - - for(i=0;iM;i++){ - matrix=this->array[i]; - m=this->mdim_array[i]; - n=this->ndim_array[i]; - - if(m*n){ - out_matrix=xNew(m*n); - xMemCpy(out_matrix,matrix,m*n); - } - else{ - out_matrix=NULL; - } - out_array[i]=out_matrix; - } - } - else{ - out_array=NULL; - out_matrix=NULL; - out_ndim_array=NULL; - } - - /*Assign output pointers:*/ - if(pout_M) *pout_M=out_M; - if(pout_mdim_array) *pout_mdim_array=out_mdim_array; - if(pout_ndim_array) *pout_ndim_array=out_ndim_array; - *pout_array=out_array; - -} -/*}}}*/ -/*FUNCTION DoubleMatArrayParam::GetParameterName{{{*/ -void DoubleMatArrayParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION DoubleMatArrayParam::SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){{{*/ -void DoubleMatArrayParam::SetValue(IssmDouble** in_array, int in_M, int* in_mdim_array, int* in_ndim_array){ - - int i,m,n; - IssmDouble* in_matrix=NULL; - IssmDouble* matrix=NULL; - - /*avoid leak: */ - xDelete(mdim_array); - xDelete(ndim_array); - for(i=0;i(matrix); - } - xDelete(array); - - /*copy data: */ - this->M=in_M; - this->array=xNew(M); - this->mdim_array=xNew(M); - this->ndim_array=xNew(M); - - xMemCpy(this->mdim_array,in_mdim_array,M); - xMemCpy(this->ndim_array,in_ndim_array,M); - - for(i=0;i(m*n); - xMemCpy(matrix,in_matrix,m*n); - - this->array[i]=matrix; - } - -} -/*}}}*/ -/*FUNCTION DoubleMatArrayParam::UnitConversion{{{*/ -void DoubleMatArrayParam::UnitConversion(int direction_enum){ - /*go through all matrices and convert: */ - for (int i=0;iM;i++){ - IssmDouble* matrix=this->array[i]; - int m=this->mdim_array[i]; - int n=this->ndim_array[i]; - ::UnitConversion(matrix,m*n,direction_enum,this->enum_type); - } - -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/StringParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/StringParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/StringParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file StringParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _STRINGPARAM_H_ -#define _STRINGPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class StringParam: public Param{ - - private: - /*just hold 3 values for 3 vertices: */ - int enum_type; - char *value; - - public: - /*StringParam constructors, destructors: {{{*/ - StringParam(); - StringParam(int enum_type,char* value); - ~StringParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring); - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string); - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _STRINGPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/TransientParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/TransientParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/TransientParam.h (revision 15012) @@ -1,78 +0,0 @@ -/*! \file TransientParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _TRANSIENTPARAM_H_ -#define _TRANSIENTPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class TransientParam: public Param{ - - protected: - int enum_type; - int N; - IssmDouble *values; - IssmDouble *timesteps; - - public: - /*TransientParam constructors, destructors: {{{*/ - TransientParam(); - TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,int in_N); - ~TransientParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Parameter " <** pvec){_error_("Parameter " <** pmat){_error_("Parameter " <* vec){_error_("Parameter " <* mat){_error_("Parameter " < -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*DoubleMatParam constructors and destructor*/ -/*FUNCTION DoubleMatParam::DoubleMatParam(){{{*/ -DoubleMatParam::DoubleMatParam(){ - return; -} -/*}}}*/ -/*FUNCTION DoubleMatParam::DoubleMatParam(int enum_type,IssmDoubleMat value){{{*/ -DoubleMatParam::DoubleMatParam(int in_enum_type,IssmDouble* in_value, int in_M,int in_N){ - - enum_type=in_enum_type; - M=in_M; - N=in_N; - - value=xNew(M*N); - xMemCpy(value,in_value,M*N); -} -/*}}}*/ -/*FUNCTION DoubleMatParam::~DoubleMatParam(){{{*/ -DoubleMatParam::~DoubleMatParam(){ - xDelete(value); - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION DoubleMatParam::Echo {{{*/ -void DoubleMatParam::Echo(void){ - - _printLine_("DoubleMatParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" matrix size: " << this->M << "x" << this->N); - -} -/*}}}*/ -/*FUNCTION DoubleMatParam::DeepEcho{{{*/ -void DoubleMatParam::DeepEcho(void){ - - int i,j; - - _printLine_("DoubleMatParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" matrix size: " << this->M << "x" << this->N); - for(i=0;iM;i++){ - for(i=0;iN;i++){ - _printLine_(i << " " << j << " " << *(this->value+N*i+j)); - } - } -} -/*}}}*/ -/*FUNCTION DoubleMatParam::Id{{{*/ -int DoubleMatParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION DoubleMatParam::ObjectEnum{{{*/ -int DoubleMatParam::ObjectEnum(void){ - - return DoubleMatParamEnum; - -} -/*}}}*/ -/*FUNCTION DoubleMatParam::copy{{{*/ -Object* DoubleMatParam::copy() { - - return new DoubleMatParam(this->enum_type,this->value,this->M,this->N); - -} -/*}}}*/ - -/*DoubleMatParam virtual functions definitions: */ -/*FUNCTION DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){{{*/ -void DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ - IssmDouble* output=NULL; - - output=xNew(M*N); - xMemCpy(output,value,M*N); - - /*Assign output pointers:*/ - if(pM) *pM=M; - if(pN) *pN=N; - *pIssmDoublearray=output; -} -/*}}}*/ -/*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{*/ -void DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){ - _error_("DoubleMat of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of int"); -} -/*}}}*/ -/*FUNCTION DoubleMatParam::GetParameterName{{{*/ -void DoubleMatParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION DoubleMatParam::SetValue{{{*/ -void DoubleMatParam::SetValue(IssmDouble* IssmDoublearray,int in_M,int in_N){ - - /*avoid leak: */ - xDelete(this->value); - - this->value=xNew(in_M*in_N); - xMemCpy(this->value,IssmDoublearray,in_M*in_N); - - this->M=in_M; - this->N=in_N; -} -/*}}}*/ -/*FUNCTION DoubleMatParam::UnitConversion{{{*/ -void DoubleMatParam::UnitConversion(int direction_enum){ - ::UnitConversion(this->value,this->M*this->N,direction_enum,this->enum_type); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/Parameters.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/Parameters.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/Parameters.cpp (revision 15012) @@ -1,605 +0,0 @@ -/* - * \file Parameters.cpp - * \brief: Implementation of the Parameters class, derived from DataSet class. - */ - -/*Headers: {{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include -#include - -#include "./Parameters.h" -#include "./Param.h" - -#include "./BoolParam.h" -#include "./DoubleMatParam.h" -#include "./DoubleParam.h" -#include "./DoubleVecParam.h" -#include "./IntParam.h" -#include "./IntVecParam.h" -#include "./IntMatParam.h" -#include "./FileParam.h" -#include "./MatrixParam.h" -#include "./VectorParam.h" -#include "./StringArrayParam.h" -#include "./StringParam.h" - -#include "../../../shared/shared.h" -#include "../../../toolkits/toolkits.h" - -using namespace std; -/*}}}*/ - -/*Object constructors and destructor*/ -/*FUNCTION Parameters::Parameters(){{{*/ -Parameters::Parameters(){ - enum_type=ParametersEnum; - return; -} -/*}}}*/ -/*FUNCTION Parameters::~Parameters(){{{*/ -Parameters::~Parameters(){ - return; -} -/*}}}*/ - -/*Object management*/ -/*FUNCTION Parameters::Exist{{{*/ -bool Parameters::Exist(int enum_type){ - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type) return true; - } - return false; -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{*/ -void Parameters::FindParam(bool* pbool,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pbool); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{*/ -void Parameters::FindParam(int* pinteger,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pinteger); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type){{{*/ -void Parameters::FindParam(IssmDouble* pscalar, int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pscalar); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time){{{*/ -void Parameters::FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pscalar,time); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{*/ -void Parameters::FindParam(char** pstring,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pstring); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{*/ -void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pstringarray,pM); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{*/ -void Parameters::FindParam(int** pintarray,int* pM, int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pintarray,pM); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int* pN,int enum_type){{{*/ -void Parameters::FindParam(int** pintarray,int* pM,int *pN,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pintarray,pM,pN); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type){{{*/ -void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pIssmDoublearray,pM); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){{{*/ -void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pIssmDoublearray,pM,pN); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{*/ -void Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(parray,pM,pmdims_array,pndims_array); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{*/ -void Parameters::FindParam(Vector** pvec,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pvec); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{*/ -void Parameters::FindParam(Matrix** pmat,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pmat); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); - -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{*/ -void Parameters::FindParam(FILE** pfid,int enum_type){ _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pfid); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ -/*FUNCTION Parameters::FindParam(DataSet** pdataset,int enum_type){{{*/ -void Parameters::FindParam(DataSet** pdataset,int enum_type){ - _assert_(this); - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - param->GetParameterValue(pdataset); - return; - } - } - _error_("could not find parameter " << EnumToStringx(enum_type)); -} -/*}}}*/ - -/*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{*/ -void Parameters::SetParam(bool boolean,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(boolean); //already exists, just set it. - else this->AddObject(new BoolParam(enum_type,boolean)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{*/ -void Parameters::SetParam(int integer,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(integer); //already exists, just set it. - else this->AddObject(new IntParam(enum_type,integer)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(IssmDouble scalar,int enum_type);{{{*/ -void Parameters::SetParam(IssmDouble scalar,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(scalar); //already exists, just set it. - else this->AddObject(new DoubleParam(enum_type,scalar)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{*/ -void Parameters::SetParam(char* string,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(string); //already exists, just set it. - else this->AddObject(new StringParam(enum_type,string)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{*/ -void Parameters::SetParam(char** stringarray,int M, int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(stringarray,M); //already exists, just set it. - else this->AddObject(new StringArrayParam(enum_type,stringarray,M)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int enum_type);{{{*/ -void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it. - else this->AddObject(new DoubleVecParam(enum_type,IssmDoublearray,M)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int N, int enum_type);{{{*/ -void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int N, int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(IssmDoublearray,M,N); //already exists, just set it. - else this->AddObject(new DoubleMatParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(int* intarray,int M,int enum_type);{{{*/ -void Parameters::SetParam(int* intarray,int M, int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(intarray,M); //already exists, just set it. - else this->AddObject(new IntVecParam(enum_type,intarray,M)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(int* intarray,int M,int N, int enum_type);{{{*/ -void Parameters::SetParam(int* intarray,int M, int N, int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(intarray,M,N); //already exists, just set it. - else this->AddObject(new IntMatParam(enum_type,intarray,M,N)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{*/ -void Parameters::SetParam(Vector* vector,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(vector); //already exists, just set it. - else this->AddObject(new VectorParam(enum_type,vector)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{*/ -void Parameters::SetParam(Matrix* matrix,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(matrix); //already exists, just set it. - else this->AddObject(new MatrixParam(enum_type,matrix)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{*/ -void Parameters::SetParam(FILE* fid,int enum_type){ - - Param* param=NULL; - - /*first, figure out if the param has already been created: */ - param=dynamic_cast(this->FindParamObject(enum_type)); - - if(param) param->SetValue(fid); //already exists, just set it. - else this->AddObject(new FileParam(enum_type,fid)); //just add the new parameter. -} -/*}}}*/ -/*FUNCTION Parameters::UnitConversion(int direction_enum);{{{*/ -void Parameters::UnitConversion(int direction_enum){ - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - param=dynamic_cast(*object); - param->UnitConversion(direction_enum); - } - -} -/*}}}*/ - -/*FUNCTION Parameters::FindParamObject{{{*/ -Object* Parameters::FindParamObject(int enum_type){ - - vector::iterator object; - Param* param=NULL; - - for ( object=objects.begin() ; object < objects.end(); object++ ){ - - param=dynamic_cast(*object); - if(param->InstanceEnum()==enum_type){ - return (*object); - } - } - return NULL; -} -/*}}}*/ - -/*Methods relating to parameters: */ -char* OptionsFromAnalysis(Parameters* parameters,int analysis_type){ /*{{{*/ - - /* figure out ISSM options for current analysis, return a string. */ - - /*output: */ - char* outstring=NULL; - - /*intermediary: */ - int dummy; - IssmDouble *analyses = NULL; - char **strings = NULL; - char *string = NULL; - int numanalyses; - int found = -1; - int i; - - numanalyses=0; - parameters->FindParam(&strings,&numanalyses,ToolkitsOptionsStringsEnum); - - parameters->FindParam(&analyses,&dummy,ToolkitsOptionsAnalysesEnum); - - if(numanalyses==0)return NULL; //we did not find petsc options, don't bother. - - /*ok, go through analyses and figure out if it corresponds to our analysis_type: */ - for(i=0;i(strlen(strings[found])+1); - strcpy(outstring,strings[found]); - - /*Free ressources*/ - xDelete(analyses); - for(i=0;i(string); - } - xDelete(strings); - return outstring; -} -/*}}}*/ -void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type){ /*{{{*/ - - /*!\file: ToolkitsOptionsFromAnalysis.cpp - * \brief: for each analysis, setup the issmoptions string. - * This is mainly for the case where we run our toolkits using petsc. In this case, we need to - * plug our toolkits options directly into the petsc options database. This is the case for each analysis type - * and parameters - */ - - - char* options=NULL; - - /*Recover first the options string for this analysis: */ - options=OptionsFromAnalysis(parameters,analysis_type); - - /*Initialize our Toolkit Options: */ - ToolkitOptions::Init(options); - - #ifdef _HAVE_PETSC_ - /*In case we are using PETSC, we do not rely on issmoptions. Instead, we dump issmoptions into the Petsc - * options database: */ - - #if _PETSC_MAJOR_ == 2 - PetscOptionsDestroy(); - PetscOptionsCreate(); - //PetscOptionsCheckInitial_Private(); - //PetscOptionsCheckInitial_Components(); - PetscOptionsSetFromOptions(); - PetscOptionsInsertMultipleString(options); //our patch - #else - PetscOptionsSetFromOptions(); - PetscOptionsClear(); - //PetscOptionsSetFromOptions(); - PetscOptionsInsertMultipleString(options); //our patch - #endif - - #endif - - xDelete(options); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/Param.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/Param.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/Param.h (revision 15012) @@ -1,60 +0,0 @@ -/*!\file: Param.h - * \brief abstract class for Param object - */ - -#ifndef _PARAM_H_ -#define _PARAM_H_ - -/*Headers:*/ -/*{{{*/ - -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "../Object.h" -#include "../Node.h" -/*}}}*/ - -class Param: public Object{ - - public: - virtual ~Param(){}; - - /*Virtual functions:*/ - virtual int InstanceEnum()=0; - virtual void GetParameterValue(bool* pbool)=0; - virtual void GetParameterValue(int* pinteger)=0; - virtual void GetParameterValue(int** pintarray,int* pM)=0; - virtual void GetParameterValue(int** pintarray,int* pM,int* pN)=0; - virtual void GetParameterValue(IssmDouble* pIssmDouble)=0; - virtual void GetParameterValue(IssmDouble* pdouble,IssmDouble time)=0; - virtual void GetParameterValue(char** pstring)=0; - virtual void GetParameterValue(char*** pstringarray,int* pM)=0; - virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM)=0; - virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN)=0; - virtual void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims)=0; - virtual void GetParameterValue(Vector** pvec)=0; - virtual void GetParameterValue(Matrix** pmat)=0; - virtual void GetParameterValue(FILE** pfid)=0; - virtual void GetParameterValue(DataSet** pdataset)=0; - - virtual void SetValue(bool boolean)=0; - virtual void SetValue(int integer)=0; - virtual void SetValue(IssmDouble scalar)=0; - virtual void SetValue(char* string)=0; - virtual void SetValue(char** stringarray,int M)=0; - virtual void SetValue(IssmDouble* IssmDoublearray,int M)=0; - virtual void SetValue(IssmDouble* pIssmDoublearray,int M,int N)=0; - virtual void SetValue(int* intarray,int M)=0; - virtual void SetValue(int* pintarray,int M,int N)=0; - virtual void SetValue(Vector* vec)=0; - virtual void SetValue(Matrix* mat)=0; - virtual void SetValue(FILE* fid)=0; - virtual void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array)=0; - virtual void UnitConversion(int direction_enum)=0; - virtual void GetParameterName(char**pname)=0; -}; -#endif Index: ../trunk-jpl/src/c/classes/objects/Params/FileParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/FileParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/FileParam.h (revision 15012) @@ -1,76 +0,0 @@ -/*! \file FileParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _FILEPARAM_H_ -#define _FILEPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class FileParam: public Param{ - - private: - int enum_type; - FILE* value; - - public: - /*FileParam constructors, destructors: {{{*/ - FileParam(); - FileParam(int enum_type,FILE* fid); - ~FileParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){ _error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){*pfid=value;}; - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _INTPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/DataSetParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DataSetParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DataSetParam.cpp (revision 15012) @@ -1,87 +0,0 @@ -/*!\file DataSetParam.c - * \brief: implementation of the DataSetParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*DataSetParam constructors and destructor*/ -/*FUNCTION DataSetParam::DataSetParam(){{{*/ -DataSetParam::DataSetParam(){ - value=NULL; - return; -} -/*}}}*/ -/*FUNCTION DataSetParam::DataSetParam(int enum_type,DataSet *value){{{*/ -DataSetParam::DataSetParam(int in_enum_type,DataSet* in_value){ - - enum_type=in_enum_type; - value=in_value->Copy();; -} -/*}}}*/ -/*FUNCTION DataSetParam::~DataSetParam(){{{*/ -DataSetParam::~DataSetParam(){ - delete value; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION DataSetParam::Echo {{{*/ -void DataSetParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION DataSetParam::DeepEcho{{{*/ -void DataSetParam::DeepEcho(void){ - - _printLine_("DataSetParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - this->value->Echo(); -} -/*}}}*/ -/*FUNCTION DataSetParam::Id{{{*/ -int DataSetParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION DataSetParam::ObjectEnum{{{*/ -int DataSetParam::ObjectEnum(void){ - - return DataSetParamEnum; - -} -/*}}}*/ -/*FUNCTION DataSetParam::copy{{{*/ -Object* DataSetParam::copy() { - - return new DataSetParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*DataSetParam virtual functions definitions: */ -/*FUNCTION DataSetParam::GetParameterName{{{*/ -void DataSetParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION DataSetParam::UnitConversion{{{*/ -void DataSetParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ -/*FUNCTION DataSetParam::GetParameterValue{{{*/ -void DataSetParam::GetParameterValue(DataSet** pdataset){ - *pdataset=value->Copy(); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/IntVecParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/IntVecParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/IntVecParam.cpp (revision 15012) @@ -1,138 +0,0 @@ -/*!\file IntVecParam.c - * \brief: implementation of the IntVecParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*IntVecParam constructors and destructor*/ -/*FUNCTION IntVecParam::IntVecParam(){{{*/ -IntVecParam::IntVecParam(){ - return; -} -/*}}}*/ -/*FUNCTION IntVecParam::IntVecParam(int enum_type,int* values,int M){{{*/ -IntVecParam::IntVecParam(int in_enum_type,int* in_values, int in_M){ - - enum_type=in_enum_type; - M=in_M; - - if(M){ - values=xNew(M); - xMemCpy(values,in_values,M); - } - else values=NULL; -} -/*}}}*/ -/*FUNCTION IntVecParam::IntVecParam(int enum_type,IssmDouble* values,int M){{{*/ -IntVecParam::IntVecParam(int in_enum_type,IssmDouble* in_values, int in_M){ - - enum_type=in_enum_type; - M=in_M; - - if(M){ - values=xNew(M); - for(int i=0;i(in_values[i]); - } - else values=NULL; -} -/*}}}*/ -/*FUNCTION IntVecParam::~IntVecParam(){{{*/ -IntVecParam::~IntVecParam(){ - xDelete(values); - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION IntVecParam::Echo {{{*/ -void IntVecParam::Echo(void){ - - _printLine_("IntVecParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" vector size: " << this->M); - -} -/*}}}*/ -/*FUNCTION IntVecParam::DeepEcho{{{*/ -void IntVecParam::DeepEcho(void){ - - int i; - - _printLine_("IntVecParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" vector size: " << this->M); - for(i=0;iM;i++){ - _printLine_(i << " " << this->values[i]); - } -} -/*}}}*/ -/*FUNCTION IntVecParam::Id{{{*/ -int IntVecParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION IntVecParam::ObjectEnum{{{*/ -int IntVecParam::ObjectEnum(void){ - - return IntVecParamEnum; - -} -/*}}}*/ -/*FUNCTION IntVecParam::copy{{{*/ -Object* IntVecParam::copy() { - - return new IntVecParam(this->enum_type,this->values,this->M); - -} -/*}}}*/ - -/*IntVecParam virtual functions definitions: */ -/*FUNCTION IntVecParam::GetParameterValue{{{*/ -void IntVecParam::GetParameterValue(int** pintarray,int* pM){ - int* output=NULL; - - if(M){ - output=xNew(M); - xMemCpy(output,values,M); - } - - /*Assign output pointers:*/ - if(pM) *pM=M; - *pintarray=output; -} -/*}}}*/ -/*FUNCTION IntVecParam::GetParameterName{{{*/ -void IntVecParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION IntVecParam::SetValue{{{*/ -void IntVecParam::SetValue(int* intarray,int in_M){ - - /*avoid leak: */ - xDelete(this->values); - - if(in_M){ - this->values=xNew(in_M); - xMemCpy(this->values,intarray,in_M); - } - else this->values=NULL; - - this->M=in_M; -} -/*}}}*/ -/*FUNCTION IntVecParam::UnitConversion{{{*/ -void IntVecParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/IntParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/IntParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/IntParam.cpp (revision 15012) @@ -1,80 +0,0 @@ -/*!\file IntParam.c - * \brief: implementation of the IntParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*IntParam constructors and destructor*/ -/*FUNCTION IntParam::IntParam(){{{*/ -IntParam::IntParam(){ - return; -} -/*}}}*/ -/*FUNCTION IntParam::IntParam(int enum_type,IssmInt value){{{*/ -IntParam::IntParam(int in_enum_type,IssmInt in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION IntParam::~IntParam(){{{*/ -IntParam::~IntParam(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION IntParam::Echo {{{*/ -void IntParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION IntParam::DeepEcho{{{*/ -void IntParam::DeepEcho(void){ - - _printLine_("IntParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " << this->value); -} -/*}}}*/ -/*FUNCTION IntParam::Id{{{*/ -int IntParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION IntParam::ObjectEnum{{{*/ -int IntParam::ObjectEnum(void){ - - return IntParamEnum; - -} -/*}}}*/ -/*FUNCTION IntParam::copy{{{*/ -Object* IntParam::copy() { - - return new IntParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*IntParam virtual functions definitions: */ -/*FUNCTION IntParam::GetParameterName{{{*/ -void IntParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION IntParam::UnitConversion{{{*/ -void IntParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/BoolParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/BoolParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/BoolParam.cpp (revision 15012) @@ -1,81 +0,0 @@ -/*!\file BoolParam.c - * \brief: implementation of the BoolParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*BoolParam constructors and destructor*/ -/*FUNCTION BoolParam::BoolParam(){{{*/ -BoolParam::BoolParam(){ - return; -} -/*}}}*/ -/*FUNCTION BoolParam::BoolParam(int enum_type,bool value){{{*/ -BoolParam::BoolParam(int in_enum_type,bool in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION BoolParam::~BoolParam(){{{*/ -BoolParam::~BoolParam(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION BoolParam::Echo {{{*/ -void BoolParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION BoolParam::DeepEcho{{{*/ -void BoolParam::DeepEcho(void){ - - _printLine_("BoolParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " <<(this->value?"true":"false")); -} -/*}}}*/ -/*FUNCTION BoolParam::Id{{{*/ -int BoolParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION BoolParam::ObjectEnum{{{*/ -int BoolParam::ObjectEnum(void){ - - return BoolParamEnum; - -} -/*}}}*/ -/*FUNCTION BoolParam::copy{{{*/ -Object* BoolParam::copy() { - - return new BoolParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*BoolParam virtual functions definitions: */ -/*FUNCTION BoolParam::GetParameterName{{{*/ -void BoolParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION BoolParam::UnitConversion{{{*/ -void BoolParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/IntMatParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/IntMatParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/IntMatParam.cpp (revision 15012) @@ -1,123 +0,0 @@ -/*!\file IntMatParam.c - * \brief: implementation of the IntMatParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*IntMatParam constructors and destructor*/ -/*FUNCTION IntMatParam::IntMatParam(){{{*/ -IntMatParam::IntMatParam(){ - return; -} -/*}}}*/ -/*FUNCTION IntMatParam::IntMatParam(int enum_type,IssmIntMat value){{{*/ -IntMatParam::IntMatParam(int in_enum_type,int* in_value, int in_M,int in_N){ - - enum_type=in_enum_type; - M=in_M; - N=in_N; - - value=xNew(M*N); - xMemCpy(value,in_value,M*N); -} -/*}}}*/ -/*FUNCTION IntMatParam::~IntMatParam(){{{*/ -IntMatParam::~IntMatParam(){ - xDelete(value); - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION IntMatParam::Echo {{{*/ -void IntMatParam::Echo(void){ - - _printLine_("IntMatParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" matrix size: " << this->M << "x" << this->N); - -} -/*}}}*/ -/*FUNCTION IntMatParam::DeepEcho{{{*/ -void IntMatParam::DeepEcho(void){ - - int i,j; - - _printLine_("IntMatParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" matrix size: " << this->M << "x" << this->N); - for(i=0;iM;i++){ - for(i=0;iN;i++){ - _printLine_("(" << i << "," << j << ") " << *(this->value+N*i+j)); - } - } -} -/*}}}*/ -/*FUNCTION IntMatParam::Id{{{*/ -int IntMatParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION IntMatParam::ObjectEnum{{{*/ -int IntMatParam::ObjectEnum(void){ - - return IntMatParamEnum; - -} -/*}}}*/ -/*FUNCTION IntMatParam::copy{{{*/ -Object* IntMatParam::copy() { - - return new IntMatParam(this->enum_type,this->value,this->M,this->N); - -} -/*}}}*/ - -/*IntMatParam virtual functions definitions: */ -/*FUNCTION IntMatParam::GetParameterValue{{{*/ -void IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){ - int* output=NULL; - - output=xNew(M*N); - xMemCpy(output,value,M*N); - - /*Assign output pointers:*/ - if(pM) *pM=M; - if(pN) *pN=N; - *pintarray=output; -} -/*}}}*/ -/*FUNCTION IntMatParam::GetParameterName{{{*/ -void IntMatParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION IntMatParam::SetValue{{{*/ -void IntMatParam::SetValue(int* intarray,int in_M,int in_N){ - - /*avoid leak: */ - xDelete(this->value); - - this->value=xNew(in_M*in_N); - xMemCpy(this->value,intarray,in_M*in_N); - - this->M=in_M; - this->N=in_N; -} -/*}}}*/ -/*FUNCTION IntMatParam::UnitConversion{{{*/ -void IntMatParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.cpp (revision 15012) @@ -1,28 +0,0 @@ -/*!\file DoubleTransientMatParam.c - * \brief: implementation of the DoubleTransientMatParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/Enum/Enum.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*FUNCTION DoubleTransientMatParam::DoubleTransientMatParam(int enum_type,IssmDoubleMat value){{{*/ -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){ -} -/*}}}*/ -/*FUNCTION DoubleTransientMatParam::UnitConversion{{{*/ -void DoubleTransientMatParam::UnitConversion(int direction_enum){ - ::UnitConversion(this->value,(this->M-1)*this->N,direction_enum,this->enum_type); -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.cpp (revision 15012) @@ -1,170 +0,0 @@ -/*!\file StringArrayParam.c - * \brief: implementation of the StringArrayParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*StringArrayParam constructors and destructor*/ -/*FUNCTION StringArrayParam::StringArrayParam(){{{*/ -StringArrayParam::StringArrayParam(){ - return; -} -/*}}}*/ -/*FUNCTION StringArrayParam::StringArrayParam(int enum_type,char** in_values,int in_numstrings){{{*/ -StringArrayParam::StringArrayParam(int in_enum_type,char** in_values, int in_numstrings){ - - int i; - int size; - - enum_type=in_enum_type; - numstrings=in_numstrings; - - if(numstrings){ - value=xNew(numstrings); - for(i=0;i(size); - xMemCpy(string,in_values[i],size); - value[i]=string; - } - } - else value=NULL; - -} -/*}}}*/ -/*FUNCTION StringArrayParam::~StringArrayParam(){{{*/ -StringArrayParam::~StringArrayParam(){ - - int i; - - char* string=NULL; - for(i=0;inumstrings;i++){ - string=value[i]; - xDelete(string); - } - xDelete(value); -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION StringArrayParam::Echo {{{*/ -void StringArrayParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION StringArrayParam::DeepEcho{{{*/ -void StringArrayParam::DeepEcho(void){ - - int i; - char* string=NULL; - - _printLine_("StringArrayParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - for(i=0;inumstrings;i++){ - string=this->value[i]; - _printLine_(" " << i << ": " << string); - } -} -/*}}}*/ -/*FUNCTION StringArrayParam::Id{{{*/ -int StringArrayParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION StringArrayParam::ObjectEnum{{{*/ -int StringArrayParam::ObjectEnum(void){ - - return StringArrayParamEnum; - -} -/*}}}*/ -/*FUNCTION StringArrayParam::copy{{{*/ -Object* StringArrayParam::copy() { - - return new StringArrayParam(this->enum_type,this->value,this->numstrings); - -} -/*}}}*/ - -/*StringArrayParam virtual functions definitions: */ -/*FUNCTION StringArrayParam::GetParameterValue{{{*/ -void StringArrayParam::GetParameterValue(char*** pstringarray,int* pM){ - - int i; - char** outstrings=NULL; - int M; - char* string=NULL; - char* string2=NULL; - int stringsize; - - M=this->numstrings; - if(this->numstrings){ - outstrings=xNew(this->numstrings); - - for(i=0;inumstrings;i++){ - string=this->value[i]; - stringsize=strlen(string)+1; - - string2=xNew(stringsize); - xMemCpy(string2,string,stringsize); - - outstrings[i]=string2; - } - } - else outstrings=NULL; - - /*Assign output pointers:*/ - *pM=M; - *pstringarray=outstrings; -} -/*}}}*/ -/*FUNCTION StringArrayParam::GetParameterName{{{*/ -void StringArrayParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION StringArrayParam::SetValue{{{*/ -void StringArrayParam::SetValue(char** stringarray,int M){ - - int i; - char *string = NULL; - char *string2 = NULL; - int stringsize; - - /*first, avoid leak: */ - for(i=0;inumstrings;i++){ - string=this->value[i]; - xDelete(string); - } - xDelete(this->value); - - /*copy: */ - this->numstrings=M; - this->value=xNew(this->numstrings); - for(i=0;inumstrings;i++){ - string=stringarray[i]; - stringsize=strlen(string)+1; - - string2=xNew(stringsize); - xMemCpy(string2,string,stringsize); - - this->value[i]=string2; - } -} -/*}}}*/ -/*FUNCTION StringArrayParam::UnitConversion{{{*/ -void StringArrayParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/StringParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/StringParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/StringParam.cpp (revision 15012) @@ -1,111 +0,0 @@ -/*!\file StringParam.c - * \brief: implementation of the StringParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*StringParam constructors and destructor*/ -/*FUNCTION StringParam::StringParam(){{{*/ -StringParam::StringParam(){ - return; -} -/*}}}*/ -/*FUNCTION StringParam::StringParam(int enum_type,IssmString value){{{*/ -StringParam::StringParam(int in_enum_type,char* in_value){ - - enum_type=in_enum_type; - value=xNew(strlen(in_value)+1); - xMemCpy(value,in_value,(strlen(in_value)+1)); - -} -/*}}}*/ -/*FUNCTION StringParam::~StringParam(){{{*/ -StringParam::~StringParam(){ - xDelete(value); -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION StringParam::Echo {{{*/ -void StringParam::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION StringParam::DeepEcho{{{*/ -void StringParam::DeepEcho(void){ - _printLine_("StringParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " << this->value); -} -/*}}}*/ -/*FUNCTION StringParam::Id{{{*/ -int StringParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION StringParam::ObjectEnum{{{*/ -int StringParam::ObjectEnum(void){ - - return StringParamEnum; - -} -/*}}}*/ -/*FUNCTION StringParam::copy{{{*/ -Object* StringParam::copy() { - - return new StringParam(this->enum_type,this->value); - -} -/*}}}*/ - -/*StringParam virtual functions definitions: */ -/*FUNCTION StringParam::GetParameterValue{{{*/ -void StringParam::GetParameterValue(char** pstring){ - - char* outstring=NULL; - int stringsize; - - stringsize=strlen(this->value)+1; - - outstring=xNew(stringsize); - xMemCpy(outstring,this->value,stringsize); - - *pstring=outstring; - -} -/*}}}*/ -/*FUNCTION StringParam::GetParameterName{{{*/ -void StringParam::GetParameterName(char**pname){ - EnumToStringx(pname,this->enum_type); -} -/*}}}*/ -/*FUNCTION StringParam::SetValue{{{*/ -void StringParam::SetValue(char* string){ - - int stringsize; - - /*avoid leak: */ - xDelete(this->value); - - /*copy: */ - stringsize=strlen(string)+1; - this->value=xNew(stringsize); - xMemCpy(this->value,string,stringsize); - -} -/*}}}*/ -/*FUNCTION StringParam::UnitConversion{{{*/ -void StringParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: ../trunk-jpl/src/c/classes/objects/Params/VectorParam.h =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/VectorParam.h (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/VectorParam.h (revision 15012) @@ -1,77 +0,0 @@ -/*! \file VectorParam.h - * \brief: header file for triavertexinput object - */ - -#ifndef _VECTORPARAM_H_ -#define _VECTORPARAM_H_ - -/*Headers:*/ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./Param.h" -#include "../../../shared/shared.h" -/*}}}*/ - -class VectorParam: public Param{ - - private: - /*just hold 3 values for 3 vertices: */ - int enum_type; - Vector* value; - - public: - /*VectorParam constructors, destructors: {{{*/ - VectorParam(); - VectorParam(int enum_type,Vector* value); - ~VectorParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(Vector** poutput); - void GetParameterValue(FILE** pfid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} - void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} - - void SetValue(bool boolean){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} - void SetValue(int integer){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} - void SetValue(IssmDouble scalar){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} - void SetValue(char* string){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} - void SetValue(char** stringarray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} - void SetValue(Vector* vec); - void SetValue(Matrix* mat){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} - void SetValue(FILE* fid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _VECTORPARAM_H */ Index: ../trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp (revision 15011) +++ ../trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp (revision 15012) @@ -1,140 +0,0 @@ -/*!\file TransientParam.c - * \brief: implementation of the TransientParam object - */ - -/*header files: */ -/*{{{*/ -#ifdef HAVE_CONFIG_H - #include -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../../shared/shared.h" -/*}}}*/ - -/*TransientParam constructors and destructor*/ -/*FUNCTION TransientParam::TransientParam(){{{*/ -TransientParam::TransientParam(){ - return; -} -/*}}}*/ -/*FUNCTION TransientParam::TransientParam(int enum_type,IssmDoubleMat value){{{*/ -TransientParam::TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,int in_N){ - - _assert_(in_values && in_time); - - enum_type=in_enum_type; - N=in_N; - - values=xNew(N); - xMemCpy(values,in_values,N); - - timesteps=xNew(N); - xMemCpy(timesteps,in_time,N); -} -/*}}}*/ -/*FUNCTION TransientParam::~TransientParam(){{{*/ -TransientParam::~TransientParam(){ - xDelete(values); - xDelete(timesteps); -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION TransientParam::Echo {{{*/ -void TransientParam::Echo(void){ - - _printLine_("TransientParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" size: " << this->N); - -} -/*}}}*/ -/*FUNCTION TransientParam::DeepEcho{{{*/ -void TransientParam::DeepEcho(void){ - - _printLine_("TransientParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" size: " << this->N); - for(int i=0;iN;i++){ - _printLine_( "time: " << this->timesteps[i] << " value: " << this->values[i]); - } -} -/*}}}*/ -/*FUNCTION TransientParam::Id{{{*/ -int TransientParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION TransientParam::ObjectEnum{{{*/ -int TransientParam::ObjectEnum(void){ - - return TransientParamEnum; - -} -/*}}}*/ -/*FUNCTION TransientParam::copy{{{*/ -Object* TransientParam::copy() { - - return new TransientParam(this->enum_type,this->values,this->timesteps,this->N); - -} -/*}}}*/ - -/*TransientParam virtual functions definitions: */ -/*FUNCTION TransientParam::GetParameterValue(IssmDouble* pdouble,IssmDouble time){{{*/ -void TransientParam::GetParameterValue(IssmDouble* pdouble,IssmDouble time){ - - IssmDouble output; - bool found; - - /*Ok, we have the time, go through the timesteps, and figure out which interval we - *fall within. Then interpolate the values on this interval: */ - if(timetimesteps[0]){ - /*get values for the first time: */ - output=this->values[0]; - found=true; - } - else if(time>this->timesteps[this->N-1]){ - /*get values for the last time: */ - output=this->values[this->N-1]; - found=true; - } - else{ - /*Find which interval we fall within: */ - for(int i=0;iN;i++){ - if(time==this->timesteps[i]){ - /*We are right on one step time: */ - output=this->values[i]; - found=true; - break; //we are done with the time interpolation. - } - else{ - if(this->timesteps[i]

(*this); }; + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return myEnumVal;} + void GetParameterName(char**pname) {EnumToStringx(pname,this->myEnumVal);} + + P& GetParameterValue() { return myP;} + const P& GetParameterValue()const { return myP;}; + + // none of these apply ... + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a bool");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an integer");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an int array");} + void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an int array");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an IssmDouble");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum) {/* nothing useful here either */}; + + /*}}}*/ +}; + +#endif /* GENERICPARAM_H_ */ Index: ../trunk-jpl/src/c/classes/Params/DoubleMatParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/DoubleMatParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DoubleMatParam.h (revision 15012) @@ -0,0 +1,78 @@ +/*! \file DoubleMatParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _DOUBLEMATPARAM_H_ +#define _DOUBLEMATPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class DoubleMatParam: public Param{ + + protected: + int enum_type; + IssmDouble *value; + int M; + int N; + + public: + /*DoubleMatParam constructors, destructors: {{{*/ + DoubleMatParam(); + DoubleMatParam(int enum_type,IssmDouble* value,int M,int N); + ~DoubleMatParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN); + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN); + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} + void SetValue(IssmDouble* IssmDoublearray,int M,int N); + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");} + void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _DOUBLEMATPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/Param.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/Param.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/Param.h (revision 15012) @@ -0,0 +1,60 @@ +/*!\file: Param.h + * \brief abstract class for Param object + */ + +#ifndef _PARAM_H_ +#define _PARAM_H_ + +/*Headers:*/ +/*{{{*/ + +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../Object.h" +#include "../Node.h" +/*}}}*/ + +class Param: public Object{ + + public: + virtual ~Param(){}; + + /*Virtual functions:*/ + virtual int InstanceEnum()=0; + virtual void GetParameterValue(bool* pbool)=0; + virtual void GetParameterValue(int* pinteger)=0; + virtual void GetParameterValue(int** pintarray,int* pM)=0; + virtual void GetParameterValue(int** pintarray,int* pM,int* pN)=0; + virtual void GetParameterValue(IssmDouble* pIssmDouble)=0; + virtual void GetParameterValue(IssmDouble* pdouble,IssmDouble time)=0; + virtual void GetParameterValue(char** pstring)=0; + virtual void GetParameterValue(char*** pstringarray,int* pM)=0; + virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM)=0; + virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN)=0; + virtual void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims)=0; + virtual void GetParameterValue(Vector** pvec)=0; + virtual void GetParameterValue(Matrix** pmat)=0; + virtual void GetParameterValue(FILE** pfid)=0; + virtual void GetParameterValue(DataSet** pdataset)=0; + + virtual void SetValue(bool boolean)=0; + virtual void SetValue(int integer)=0; + virtual void SetValue(IssmDouble scalar)=0; + virtual void SetValue(char* string)=0; + virtual void SetValue(char** stringarray,int M)=0; + virtual void SetValue(IssmDouble* IssmDoublearray,int M)=0; + virtual void SetValue(IssmDouble* pIssmDoublearray,int M,int N)=0; + virtual void SetValue(int* intarray,int M)=0; + virtual void SetValue(int* pintarray,int M,int N)=0; + virtual void SetValue(Vector* vec)=0; + virtual void SetValue(Matrix* mat)=0; + virtual void SetValue(FILE* fid)=0; + virtual void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array)=0; + virtual void UnitConversion(int direction_enum)=0; + virtual void GetParameterName(char**pname)=0; +}; +#endif Index: ../trunk-jpl/src/c/classes/Params/FileParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/FileParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/FileParam.h (revision 15012) @@ -0,0 +1,76 @@ +/*! \file FileParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _FILEPARAM_H_ +#define _FILEPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class FileParam: public Param{ + + private: + int enum_type; + FILE* value; + + public: + /*FileParam constructors, destructors: {{{*/ + FileParam(); + FileParam(int enum_type,FILE* fid); + ~FileParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){ _error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){*pfid=value;}; + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _INTPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/Parameters.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/Parameters.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/Parameters.h (revision 15012) @@ -0,0 +1,65 @@ +#ifndef _CONTAINER_PARAMETERS_H_ +#define _CONTAINER_PARAMETERS_H_ +#include + +/*forward declarations */ +template class Matrix; +template class Vector; +#include "../DataSet.h" +#include "../../shared/shared.h" + +/*!\brief Declaration of Parameters class. + * + * Declaration of Parameters class. Parameters are vector lists (Containers) of Parameter objects. + */ +class Parameters: public DataSet{ + + public: + + /*constructors, destructors*/ + Parameters(); + ~Parameters(); + + /*numerics*/ + bool Exist(int enum_type); + + void FindParam(bool* pinteger,int enum_type); + void FindParam(int* pinteger,int enum_type); + void FindParam(IssmDouble* pscalar, int enum_type); + void FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time); + void FindParam(char** pstring,int enum_type); + void FindParam(char*** pstringarray,int* pM,int enum_type); + void FindParam(int** pintarray,int* pM,int enum_type); + void FindParam(int** pintarray,int* pM,int* PN,int enum_type); + void FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type); + void FindParam(IssmDouble** pIssmDoublearray,int* pM,int* pN,int enum_type); + void FindParam(IssmDouble*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type); + void FindParam(Vector** pvec,int enum_type); + void FindParam(Matrix** pmat,int enum_type); + void FindParam(FILE** pfid,int enum_type); + void FindParam(DataSet** pdataset, int enum_type); + + void SetParam(bool boolean,int enum_type); + void SetParam(int integer,int enum_type); + void SetParam(IssmDouble scalar, int enum_type); + void SetParam(char* string,int enum_type); + void SetParam(char** stringarray,int M,int enum_type); + void SetParam(IssmDouble* IssmDoublearray,int M,int enum_type); + void SetParam(IssmDouble* IssmDoublearray,int M,int N,int enum_type); + void SetParam(int* intarray,int M,int enum_type); + void SetParam(int* intarray,int M,int N,int enum_type); + void SetParam(Vector* vec,int enum_type); + void SetParam(Matrix* mat,int enum_type); + void SetParam(FILE* fid,int enum_type); + void UnitConversion(int direction_enum); + + Object* FindParamObject(int enum_type); + +}; + +/*Methods relating to parameters: */ +char *OptionsFromAnalysis(Parameters *parameters,int analysis_type); +void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type); + + +#endif //ifndef _PARAMETERS_H_ Index: ../trunk-jpl/src/c/classes/Params/IntVecParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/IntVecParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/IntVecParam.cpp (revision 15012) @@ -0,0 +1,136 @@ +/*!\file IntVecParam.c + * \brief: implementation of the IntVecParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*IntVecParam constructors and destructor*/ +/*FUNCTION IntVecParam::IntVecParam(){{{*/ +IntVecParam::IntVecParam(){ + return; +} +/*}}}*/ +/*FUNCTION IntVecParam::IntVecParam(int enum_type,int* values,int M){{{*/ +IntVecParam::IntVecParam(int in_enum_type,int* in_values, int in_M){ + + enum_type=in_enum_type; + M=in_M; + + if(M){ + values=xNew(M); + xMemCpy(values,in_values,M); + } + else values=NULL; +} +/*}}}*/ +/*FUNCTION IntVecParam::IntVecParam(int enum_type,IssmDouble* values,int M){{{*/ +IntVecParam::IntVecParam(int in_enum_type,IssmDouble* in_values, int in_M){ + + enum_type=in_enum_type; + M=in_M; + + if(M){ + values=xNew(M); + for(int i=0;i(in_values[i]); + } + else values=NULL; +} +/*}}}*/ +/*FUNCTION IntVecParam::~IntVecParam(){{{*/ +IntVecParam::~IntVecParam(){ + xDelete(values); + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION IntVecParam::Echo {{{*/ +void IntVecParam::Echo(void){ + + _printLine_("IntVecParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" vector size: " << this->M); + +} +/*}}}*/ +/*FUNCTION IntVecParam::DeepEcho{{{*/ +void IntVecParam::DeepEcho(void){ + + int i; + + _printLine_("IntVecParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" vector size: " << this->M); + for(i=0;iM;i++){ + _printLine_(i << " " << this->values[i]); + } +} +/*}}}*/ +/*FUNCTION IntVecParam::Id{{{*/ +int IntVecParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION IntVecParam::ObjectEnum{{{*/ +int IntVecParam::ObjectEnum(void){ + + return IntVecParamEnum; + +} +/*}}}*/ +/*FUNCTION IntVecParam::copy{{{*/ +Object* IntVecParam::copy() { + + return new IntVecParam(this->enum_type,this->values,this->M); + +} +/*}}}*/ + +/*IntVecParam virtual functions definitions: */ +/*FUNCTION IntVecParam::GetParameterValue{{{*/ +void IntVecParam::GetParameterValue(int** pintarray,int* pM){ + int* output=NULL; + + if(M){ + output=xNew(M); + xMemCpy(output,values,M); + } + + /*Assign output pointers:*/ + if(pM) *pM=M; + *pintarray=output; +} +/*}}}*/ +/*FUNCTION IntVecParam::GetParameterName{{{*/ +void IntVecParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION IntVecParam::SetValue{{{*/ +void IntVecParam::SetValue(int* intarray,int in_M){ + + /*avoid leak: */ + xDelete(this->values); + + if(in_M){ + this->values=xNew(in_M); + xMemCpy(this->values,intarray,in_M); + } + else this->values=NULL; + + this->M=in_M; +} +/*}}}*/ +/*FUNCTION IntVecParam::UnitConversion{{{*/ +void IntVecParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/DataSetParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/DataSetParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DataSetParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file DataSetParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _DATASETPARAM_H_ +#define _DATASETPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class DataSetParam: public Param{ + + private: + int enum_type; + DataSet* value; + + public: + /*DataSetParam constructors, destructors: {{{*/ + DataSetParam(); + DataSetParam(int enum_type,DataSet* dataset); + ~DataSetParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){ _error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(FILE** pfile){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a file pointer");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(DataSet** pdataset); + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a file pointer");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(DataSet* dataset){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a DataSet yet");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _INTPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/BoolParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/BoolParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/BoolParam.cpp (revision 15012) @@ -0,0 +1,78 @@ +/*!\file BoolParam.c + * \brief: implementation of the BoolParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*BoolParam constructors and destructor*/ +/*FUNCTION BoolParam::BoolParam(){{{*/ +BoolParam::BoolParam(){ + return; +} +/*}}}*/ +/*FUNCTION BoolParam::BoolParam(int enum_type,bool value){{{*/ +BoolParam::BoolParam(int in_enum_type,bool in_value){ + + enum_type=in_enum_type; + value=in_value; +} +/*}}}*/ +/*FUNCTION BoolParam::~BoolParam(){{{*/ +BoolParam::~BoolParam(){ + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION BoolParam::Echo {{{*/ +void BoolParam::Echo(void){ + this->DeepEcho(); +} +/*}}}*/ +/*FUNCTION BoolParam::DeepEcho{{{*/ +void BoolParam::DeepEcho(void){ + + _printLine_("BoolParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" value: " <<(this->value?"true":"false")); +} +/*}}}*/ +/*FUNCTION BoolParam::Id{{{*/ +int BoolParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION BoolParam::ObjectEnum{{{*/ +int BoolParam::ObjectEnum(void){ + + return BoolParamEnum; + +} +/*}}}*/ +/*FUNCTION BoolParam::copy{{{*/ +Object* BoolParam::copy() { + + return new BoolParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*BoolParam virtual functions definitions: */ +/*FUNCTION BoolParam::GetParameterName{{{*/ +void BoolParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION BoolParam::UnitConversion{{{*/ +void BoolParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/IntMatParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/IntMatParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/IntMatParam.cpp (revision 15012) @@ -0,0 +1,120 @@ +/*!\file IntMatParam.c + * \brief: implementation of the IntMatParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*IntMatParam constructors and destructor*/ +/*FUNCTION IntMatParam::IntMatParam(){{{*/ +IntMatParam::IntMatParam(){ + return; +} +/*}}}*/ +/*FUNCTION IntMatParam::IntMatParam(int enum_type,IssmIntMat value){{{*/ +IntMatParam::IntMatParam(int in_enum_type,int* in_value, int in_M,int in_N){ + + enum_type=in_enum_type; + M=in_M; + N=in_N; + + value=xNew(M*N); + xMemCpy(value,in_value,M*N); +} +/*}}}*/ +/*FUNCTION IntMatParam::~IntMatParam(){{{*/ +IntMatParam::~IntMatParam(){ + xDelete(value); + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION IntMatParam::Echo {{{*/ +void IntMatParam::Echo(void){ + + _printLine_("IntMatParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" matrix size: " << this->M << "x" << this->N); + +} +/*}}}*/ +/*FUNCTION IntMatParam::DeepEcho{{{*/ +void IntMatParam::DeepEcho(void){ + + int i,j; + + _printLine_("IntMatParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" matrix size: " << this->M << "x" << this->N); + for(i=0;iM;i++){ + for(i=0;iN;i++){ + _printLine_("(" << i << "," << j << ") " << *(this->value+N*i+j)); + } + } +} +/*}}}*/ +/*FUNCTION IntMatParam::Id{{{*/ +int IntMatParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION IntMatParam::ObjectEnum{{{*/ +int IntMatParam::ObjectEnum(void){ + + return IntMatParamEnum; + +} +/*}}}*/ +/*FUNCTION IntMatParam::copy{{{*/ +Object* IntMatParam::copy() { + + return new IntMatParam(this->enum_type,this->value,this->M,this->N); + +} +/*}}}*/ + +/*IntMatParam virtual functions definitions: */ +/*FUNCTION IntMatParam::GetParameterValue{{{*/ +void IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){ + int* output=NULL; + + output=xNew(M*N); + xMemCpy(output,value,M*N); + + /*Assign output pointers:*/ + if(pM) *pM=M; + if(pN) *pN=N; + *pintarray=output; +} +/*}}}*/ +/*FUNCTION IntMatParam::GetParameterName{{{*/ +void IntMatParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION IntMatParam::SetValue{{{*/ +void IntMatParam::SetValue(int* intarray,int in_M,int in_N){ + + /*avoid leak: */ + xDelete(this->value); + + this->value=xNew(in_M*in_N); + xMemCpy(this->value,intarray,in_M*in_N); + + this->M=in_M; + this->N=in_N; +} +/*}}}*/ +/*FUNCTION IntMatParam::UnitConversion{{{*/ +void IntMatParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/IntParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/IntParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/IntParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file IntParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _INTPARAM_H_ +#define _INTPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class IntParam: public Param{ + + private: + /*just hold 3 values for 3 vertices: */ + int enum_type; + IssmInt value; + + public: + /*IntParam constructors, destructors: {{{*/ + IntParam(); + IntParam(int enum_type,IssmInt value); + ~IntParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){*pinteger=value;} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a bool");} + void SetValue(int integer){this->value=integer;} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} + void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _INTPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/DoubleTransientMatParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/DoubleTransientMatParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DoubleTransientMatParam.cpp (revision 15012) @@ -0,0 +1,25 @@ +/*!\file DoubleTransientMatParam.c + * \brief: implementation of the DoubleTransientMatParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*FUNCTION DoubleTransientMatParam::DoubleTransientMatParam(int enum_type,IssmDoubleMat value){{{*/ +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){ +} +/*}}}*/ +/*FUNCTION DoubleTransientMatParam::UnitConversion{{{*/ +void DoubleTransientMatParam::UnitConversion(int direction_enum){ + ::UnitConversion(this->value,(this->M-1)*this->N,direction_enum,this->enum_type); +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/StringParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/StringParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/StringParam.cpp (revision 15012) @@ -0,0 +1,109 @@ +/*!\file StringParam.c + * \brief: implementation of the StringParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*StringParam constructors and destructor*/ +/*FUNCTION StringParam::StringParam(){{{*/ +StringParam::StringParam(){ + return; +} +/*}}}*/ +/*FUNCTION StringParam::StringParam(int enum_type,IssmString value){{{*/ +StringParam::StringParam(int in_enum_type,char* in_value){ + + enum_type=in_enum_type; + value=xNew(strlen(in_value)+1); + xMemCpy(value,in_value,(strlen(in_value)+1)); + +} +/*}}}*/ +/*FUNCTION StringParam::~StringParam(){{{*/ +StringParam::~StringParam(){ + xDelete(value); +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION StringParam::Echo {{{*/ +void StringParam::Echo(void){ + this->DeepEcho(); +} +/*}}}*/ +/*FUNCTION StringParam::DeepEcho{{{*/ +void StringParam::DeepEcho(void){ + _printLine_("StringParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" value: " << this->value); +} +/*}}}*/ +/*FUNCTION StringParam::Id{{{*/ +int StringParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION StringParam::ObjectEnum{{{*/ +int StringParam::ObjectEnum(void){ + + return StringParamEnum; + +} +/*}}}*/ +/*FUNCTION StringParam::copy{{{*/ +Object* StringParam::copy() { + + return new StringParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*StringParam virtual functions definitions: */ +/*FUNCTION StringParam::GetParameterValue{{{*/ +void StringParam::GetParameterValue(char** pstring){ + + char* outstring=NULL; + int stringsize; + + stringsize=strlen(this->value)+1; + + outstring=xNew(stringsize); + xMemCpy(outstring,this->value,stringsize); + + *pstring=outstring; + +} +/*}}}*/ +/*FUNCTION StringParam::GetParameterName{{{*/ +void StringParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION StringParam::SetValue{{{*/ +void StringParam::SetValue(char* string){ + + int stringsize; + + /*avoid leak: */ + xDelete(this->value); + + /*copy: */ + stringsize=strlen(string)+1; + this->value=xNew(stringsize); + xMemCpy(this->value,string,stringsize); + +} +/*}}}*/ +/*FUNCTION StringParam::UnitConversion{{{*/ +void StringParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/VectorParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/VectorParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/VectorParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file VectorParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _VECTORPARAM_H_ +#define _VECTORPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class VectorParam: public Param{ + + private: + /*just hold 3 values for 3 vertices: */ + int enum_type; + Vector* value; + + public: + /*VectorParam constructors, destructors: {{{*/ + VectorParam(); + VectorParam(int enum_type,Vector* value); + ~VectorParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(Vector** poutput); + void GetParameterValue(FILE** pfid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} + void SetValue(int integer){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} + void SetValue(char* string){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} + void SetValue(Vector* vec); + void SetValue(Matrix* mat){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _VECTORPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp (revision 15012) @@ -0,0 +1,139 @@ +/*!\file DoubleVecParam.c + * \brief: implementation of the DoubleVecParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*DoubleVecParam constructors and destructor*/ +/*FUNCTION DoubleVecParam::DoubleVecParam(){{{*/ +DoubleVecParam::DoubleVecParam(){ + return; +} +/*}}}*/ +/*FUNCTION DoubleVecParam::DoubleVecParam(int enum_type,IssmDoubleVec values,int M){{{*/ +DoubleVecParam::DoubleVecParam(int in_enum_type,IssmDouble* in_values, int in_M){ + + enum_type=in_enum_type; + M=in_M; + + values=xNew(M); + xMemCpy(values,in_values,M); +} +/*}}}*/ +/*FUNCTION DoubleVecParam::~DoubleVecParam(){{{*/ +DoubleVecParam::~DoubleVecParam(){ + xDelete(values); + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION DoubleVecParam::Echo {{{*/ +void DoubleVecParam::Echo(void){ + + _printLine_("DoubleVecParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" vector size: " << this->M); + +} +/*}}}*/ +/*FUNCTION DoubleVecParam::DeepEcho{{{*/ +void DoubleVecParam::DeepEcho(void){ + + int i; + + _printLine_("DoubleVecParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" vector size: " << this->M); + for(i=0;iM;i++){ + _printLine_(i << " " << this->values[i]); + } +} +/*}}}*/ +/*FUNCTION DoubleVecParam::Id{{{*/ +int DoubleVecParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION DoubleVecParam::ObjectEnum{{{*/ +int DoubleVecParam::ObjectEnum(void){ + + return DoubleVecParamEnum; + +} +/*}}}*/ +/*FUNCTION DoubleVecParam::copy{{{*/ +Object* DoubleVecParam::copy() { + + return new DoubleVecParam(this->enum_type,this->values,this->M); + +} +/*}}}*/ + +/*DoubleVecParam virtual functions definitions: */ +/*FUNCTION DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ +void DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){ + IssmDouble* output=NULL; + int M; + + M=this->M; + output=xNew(M); + xMemCpy(output,values,M); + + /*Assign output pointers:*/ + if(pM) *pM=M; + *pIssmDoublearray=output; +} +/*}}}*/ +/*FUNCTION DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){{{*/ +void DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ + IssmDouble* output=NULL; + int M; + int N; + + N=1; + M=this->M; + output=xNew(M); + xMemCpy(output,values,M); + + /*Assign output pointers:*/ + if(pM) *pM=M; + if(pN) *pN=N; + *pIssmDoublearray=output; +} +/*}}}*/ +/*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{*/ +void DoubleVecParam::GetParameterValue(int** pintarray,int* pM){ + _error_("DoubleVec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of int"); +} +/*}}}*/ +/*FUNCTION DoubleVecParam::GetParameterName{{{*/ +void DoubleVecParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION DoubleVecParam::SetValue{{{*/ +void DoubleVecParam::SetValue(IssmDouble* IssmDoublearray,int in_M){ + + /*avoid leak: */ + xDelete(this->values); + + this->values=xNew(in_M); + xMemCpy(this->values,IssmDoublearray,in_M); + + this->M=in_M; +} +/*}}}*/ +/*FUNCTION DoubleVecParam::UnitConversion{{{*/ +void DoubleVecParam::UnitConversion(int direction_enum){ + ::UnitConversion(this->values,this->M,direction_enum,this->enum_type); +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/MatrixParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/MatrixParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/MatrixParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file MatrixParam.h + * \brief: header file for MatrixParam object + */ + +#ifndef _MATRIXPARAM_H_ +#define _MATRIXPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class MatrixParam: public Param{ + + private: + /*just hold 3 values for 3 vertices: */ + int enum_type; + Matrix* value; + + public: + /*MatrixParam constructors, destructors: {{{*/ + MatrixParam(); + MatrixParam(int enum_type,Matrix* value); + ~MatrixParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a vec");} + void GetParameterValue(Matrix** poutput); + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat); + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _MATRIXPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/StringArrayParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/StringArrayParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/StringArrayParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file StringArrayParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _STRINGARRAYPARAM_H_ +#define _STRINGARRAYPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class StringArrayParam: public Param{ + + private: + /*just hold 3 values for 3 vertices: */ + int enum_type; + char** value; + int numstrings; + + public: + /*StringArrayParam constructors, destructors: {{{*/ + StringArrayParam(); + StringArrayParam(int enum_type,char** values, int numstrings); + ~StringArrayParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM); + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Vec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M); + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + /*}}}*/ +}; +#endif /* _STRINGARRAYPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/CMakeLists.txt =================================================================== --- ../trunk-jpl/src/c/classes/Params/CMakeLists.txt (revision 0) +++ ../trunk-jpl/src/c/classes/Params/CMakeLists.txt (revision 15012) @@ -0,0 +1,23 @@ +# Subdirectories {{{ +# }}} +# Include Directory {{{ +include_directories(AFTER $ENV{ISSM_DIR}/src/c/classes/objects/Params) +# }}} +# CORE_SOURCES {{{ +set(CORE_SOURCES $ENV{ISSM_DIR}/src/c/classes/objects/Params/BoolParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/DataSetParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleMatArrayParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleMatParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleTransientMatParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/DoubleVecParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/FileParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/IntMatParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/IntParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/IntVecParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/MatrixParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/StringArrayParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/StringParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/TransientParam.cpp + $ENV{ISSM_DIR}/src/c/classes/objects/Params/VectorParam.cpp PARENT_SCOPE) +# }}} Index: ../trunk-jpl/src/c/classes/Params/TransientParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/TransientParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/TransientParam.h (revision 15012) @@ -0,0 +1,78 @@ +/*! \file TransientParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _TRANSIENTPARAM_H_ +#define _TRANSIENTPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class TransientParam: public Param{ + + protected: + int enum_type; + int N; + IssmDouble *values; + IssmDouble *timesteps; + + public: + /*TransientParam constructors, destructors: {{{*/ + TransientParam(); + TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,int in_N); + ~TransientParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Parameter " <** pvec){_error_("Parameter " <** pmat){_error_("Parameter " <* vec){_error_("Parameter " <* mat){_error_("Parameter " < +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*DoubleMatParam constructors and destructor*/ +/*FUNCTION DoubleMatParam::DoubleMatParam(){{{*/ +DoubleMatParam::DoubleMatParam(){ + return; +} +/*}}}*/ +/*FUNCTION DoubleMatParam::DoubleMatParam(int enum_type,IssmDoubleMat value){{{*/ +DoubleMatParam::DoubleMatParam(int in_enum_type,IssmDouble* in_value, int in_M,int in_N){ + + enum_type=in_enum_type; + M=in_M; + N=in_N; + + value=xNew(M*N); + xMemCpy(value,in_value,M*N); +} +/*}}}*/ +/*FUNCTION DoubleMatParam::~DoubleMatParam(){{{*/ +DoubleMatParam::~DoubleMatParam(){ + xDelete(value); + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION DoubleMatParam::Echo {{{*/ +void DoubleMatParam::Echo(void){ + + _printLine_("DoubleMatParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" matrix size: " << this->M << "x" << this->N); + +} +/*}}}*/ +/*FUNCTION DoubleMatParam::DeepEcho{{{*/ +void DoubleMatParam::DeepEcho(void){ + + int i,j; + + _printLine_("DoubleMatParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" matrix size: " << this->M << "x" << this->N); + for(i=0;iM;i++){ + for(i=0;iN;i++){ + _printLine_(i << " " << j << " " << *(this->value+N*i+j)); + } + } +} +/*}}}*/ +/*FUNCTION DoubleMatParam::Id{{{*/ +int DoubleMatParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION DoubleMatParam::ObjectEnum{{{*/ +int DoubleMatParam::ObjectEnum(void){ + + return DoubleMatParamEnum; + +} +/*}}}*/ +/*FUNCTION DoubleMatParam::copy{{{*/ +Object* DoubleMatParam::copy() { + + return new DoubleMatParam(this->enum_type,this->value,this->M,this->N); + +} +/*}}}*/ + +/*DoubleMatParam virtual functions definitions: */ +/*FUNCTION DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){{{*/ +void DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){ + IssmDouble* output=NULL; + + output=xNew(M*N); + xMemCpy(output,value,M*N); + + /*Assign output pointers:*/ + if(pM) *pM=M; + if(pN) *pN=N; + *pIssmDoublearray=output; +} +/*}}}*/ +/*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{*/ +void DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){ + _error_("DoubleMat of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an array of int"); +} +/*}}}*/ +/*FUNCTION DoubleMatParam::GetParameterName{{{*/ +void DoubleMatParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION DoubleMatParam::SetValue{{{*/ +void DoubleMatParam::SetValue(IssmDouble* IssmDoublearray,int in_M,int in_N){ + + /*avoid leak: */ + xDelete(this->value); + + this->value=xNew(in_M*in_N); + xMemCpy(this->value,IssmDoublearray,in_M*in_N); + + this->M=in_M; + this->N=in_N; +} +/*}}}*/ +/*FUNCTION DoubleMatParam::UnitConversion{{{*/ +void DoubleMatParam::UnitConversion(int direction_enum){ + ::UnitConversion(this->value,this->M*this->N,direction_enum,this->enum_type); +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/FileParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/FileParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/FileParam.cpp (revision 15012) @@ -0,0 +1,78 @@ +/*!\file FileParam.c + * \brief: implementation of the FileParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*FileParam constructors and destructor*/ +/*FUNCTION FileParam::FileParam(){{{*/ +FileParam::FileParam(){ + return; +} +/*}}}*/ +/*FUNCTION FileParam::FileParam(int enum_type,FILE *value){{{*/ +FileParam::FileParam(int in_enum_type,FILE* in_value){ + + enum_type=in_enum_type; + value=in_value; +} +/*}}}*/ +/*FUNCTION FileParam::~FileParam(){{{*/ +FileParam::~FileParam(){ + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION FileParam::Echo {{{*/ +void FileParam::Echo(void){ + this->DeepEcho(); +} +/*}}}*/ +/*FUNCTION FileParam::DeepEcho{{{*/ +void FileParam::DeepEcho(void){ + + _printLine_("FileParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" value: " << this->value); +} +/*}}}*/ +/*FUNCTION FileParam::Id{{{*/ +int FileParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION FileParam::ObjectEnum{{{*/ +int FileParam::ObjectEnum(void){ + + return FileParamEnum; + +} +/*}}}*/ +/*FUNCTION FileParam::copy{{{*/ +Object* FileParam::copy() { + + return new FileParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*FileParam virtual functions definitions: */ +/*FUNCTION FileParam::GetParameterName{{{*/ +void FileParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION FileParam::UnitConversion{{{*/ +void FileParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/DoubleParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/DoubleParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DoubleParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file DoubleParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _DOUBLEPARAM_H_ +#define _DOUBLEPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class DoubleParam: public Param{ + + private: + /*just hold 3 values for 3 vertices: */ + int enum_type; + IssmDouble value; + + public: + /*DoubleParam constructors, destructors: {{{*/ + DoubleParam(); + DoubleParam(int enum_type,IssmDouble value); + ~DoubleParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool); + void GetParameterValue(int* pinteger); + void GetParameterValue(int** pintarray,int* pM); + void GetParameterValue(int** pintarray,int* pM,int* pN); + void GetParameterValue(IssmDouble* pIssmDouble){*pIssmDouble=value;} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){this->value=(IssmDouble)boolean;} + void SetValue(int integer){this->value=(IssmDouble)integer;} + void SetValue(IssmDouble scalar){this->value=(IssmDouble)scalar;} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _DOUBLEPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h (revision 15012) @@ -0,0 +1,79 @@ +/*! \file DoubleMatArrayParam.h + * \brief: header file for object holding an array of serial matrices + */ + +#ifndef _DOUBLEMATARRAYPARAM_H_ +#define _DOUBLEMATARRAYPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class DoubleMatArrayParam: public Param{ + + private: + int enum_type; + IssmDouble **array; //array of matrices + int M; //size of array + int *mdim_array; //m-dimensions of matrices in the array + int *ndim_array; //n-dimensions -f matrices in the array + + public: + /*DoubleMatArrayParam constructors, destructors: {{{*/ + DoubleMatArrayParam(); + DoubleMatArrayParam(int enum_type,IssmDouble** array, int M, int* mdim_array, int* ndim_array); + ~DoubleMatArrayParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << "cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims); + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a boolean");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a scalar");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble vec array");} + void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble mat array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a int vec array");} + void SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a int mat array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array); + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _DOUBLEMATARRAYPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/Parameters.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/Parameters.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/Parameters.cpp (revision 15012) @@ -0,0 +1,605 @@ +/* + * \file Parameters.cpp + * \brief: Implementation of the Parameters class, derived from DataSet class. + */ + +/*Headers: {{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include +#include +#include +#include + +#include "./Parameters.h" +#include "./Param.h" + +#include "./BoolParam.h" +#include "./DoubleMatParam.h" +#include "./DoubleParam.h" +#include "./DoubleVecParam.h" +#include "./IntParam.h" +#include "./IntVecParam.h" +#include "./IntMatParam.h" +#include "./FileParam.h" +#include "./MatrixParam.h" +#include "./VectorParam.h" +#include "./StringArrayParam.h" +#include "./StringParam.h" + +#include "../../shared/shared.h" +#include "../../toolkits/toolkits.h" + +using namespace std; +/*}}}*/ + +/*Object constructors and destructor*/ +/*FUNCTION Parameters::Parameters(){{{*/ +Parameters::Parameters(){ + enum_type=ParametersEnum; + return; +} +/*}}}*/ +/*FUNCTION Parameters::~Parameters(){{{*/ +Parameters::~Parameters(){ + return; +} +/*}}}*/ + +/*Object management*/ +/*FUNCTION Parameters::Exist{{{*/ +bool Parameters::Exist(int enum_type){ + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type) return true; + } + return false; +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{*/ +void Parameters::FindParam(bool* pbool,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pbool); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{*/ +void Parameters::FindParam(int* pinteger,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pinteger); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type){{{*/ +void Parameters::FindParam(IssmDouble* pscalar, int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pscalar); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time){{{*/ +void Parameters::FindParam(IssmDouble* pscalar, int enum_type,IssmDouble time){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pscalar,time); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{*/ +void Parameters::FindParam(char** pstring,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pstring); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{*/ +void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pstringarray,pM); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{*/ +void Parameters::FindParam(int** pintarray,int* pM, int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pintarray,pM); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int* pN,int enum_type){{{*/ +void Parameters::FindParam(int** pintarray,int* pM,int *pN,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pintarray,pM,pN); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type){{{*/ +void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pIssmDoublearray,pM); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){{{*/ +void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pIssmDoublearray,pM,pN); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{*/ +void Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(parray,pM,pmdims_array,pndims_array); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{*/ +void Parameters::FindParam(Vector** pvec,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pvec); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{*/ +void Parameters::FindParam(Matrix** pmat,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pmat); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); + +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{*/ +void Parameters::FindParam(FILE** pfid,int enum_type){ _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pfid); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ +/*FUNCTION Parameters::FindParam(DataSet** pdataset,int enum_type){{{*/ +void Parameters::FindParam(DataSet** pdataset,int enum_type){ + _assert_(this); + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + param->GetParameterValue(pdataset); + return; + } + } + _error_("could not find parameter " << EnumToStringx(enum_type)); +} +/*}}}*/ + +/*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{*/ +void Parameters::SetParam(bool boolean,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(boolean); //already exists, just set it. + else this->AddObject(new BoolParam(enum_type,boolean)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{*/ +void Parameters::SetParam(int integer,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(integer); //already exists, just set it. + else this->AddObject(new IntParam(enum_type,integer)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(IssmDouble scalar,int enum_type);{{{*/ +void Parameters::SetParam(IssmDouble scalar,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(scalar); //already exists, just set it. + else this->AddObject(new DoubleParam(enum_type,scalar)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{*/ +void Parameters::SetParam(char* string,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(string); //already exists, just set it. + else this->AddObject(new StringParam(enum_type,string)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{*/ +void Parameters::SetParam(char** stringarray,int M, int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(stringarray,M); //already exists, just set it. + else this->AddObject(new StringArrayParam(enum_type,stringarray,M)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int enum_type);{{{*/ +void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it. + else this->AddObject(new DoubleVecParam(enum_type,IssmDoublearray,M)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int N, int enum_type);{{{*/ +void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int N, int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(IssmDoublearray,M,N); //already exists, just set it. + else this->AddObject(new DoubleMatParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(int* intarray,int M,int enum_type);{{{*/ +void Parameters::SetParam(int* intarray,int M, int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(intarray,M); //already exists, just set it. + else this->AddObject(new IntVecParam(enum_type,intarray,M)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(int* intarray,int M,int N, int enum_type);{{{*/ +void Parameters::SetParam(int* intarray,int M, int N, int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(intarray,M,N); //already exists, just set it. + else this->AddObject(new IntMatParam(enum_type,intarray,M,N)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{*/ +void Parameters::SetParam(Vector* vector,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(vector); //already exists, just set it. + else this->AddObject(new VectorParam(enum_type,vector)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{*/ +void Parameters::SetParam(Matrix* matrix,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(matrix); //already exists, just set it. + else this->AddObject(new MatrixParam(enum_type,matrix)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::SetParam(FILE* fid,int enum_type);{{{*/ +void Parameters::SetParam(FILE* fid,int enum_type){ + + Param* param=NULL; + + /*first, figure out if the param has already been created: */ + param=dynamic_cast(this->FindParamObject(enum_type)); + + if(param) param->SetValue(fid); //already exists, just set it. + else this->AddObject(new FileParam(enum_type,fid)); //just add the new parameter. +} +/*}}}*/ +/*FUNCTION Parameters::UnitConversion(int direction_enum);{{{*/ +void Parameters::UnitConversion(int direction_enum){ + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + param=dynamic_cast(*object); + param->UnitConversion(direction_enum); + } + +} +/*}}}*/ + +/*FUNCTION Parameters::FindParamObject{{{*/ +Object* Parameters::FindParamObject(int enum_type){ + + vector::iterator object; + Param* param=NULL; + + for ( object=objects.begin() ; object < objects.end(); object++ ){ + + param=dynamic_cast(*object); + if(param->InstanceEnum()==enum_type){ + return (*object); + } + } + return NULL; +} +/*}}}*/ + +/*Methods relating to parameters: */ +char* OptionsFromAnalysis(Parameters* parameters,int analysis_type){ /*{{{*/ + + /* figure out ISSM options for current analysis, return a string. */ + + /*output: */ + char* outstring=NULL; + + /*intermediary: */ + int dummy; + IssmDouble *analyses = NULL; + char **strings = NULL; + char *string = NULL; + int numanalyses; + int found = -1; + int i; + + numanalyses=0; + parameters->FindParam(&strings,&numanalyses,ToolkitsOptionsStringsEnum); + + parameters->FindParam(&analyses,&dummy,ToolkitsOptionsAnalysesEnum); + + if(numanalyses==0)return NULL; //we did not find petsc options, don't bother. + + /*ok, go through analyses and figure out if it corresponds to our analysis_type: */ + for(i=0;i(strlen(strings[found])+1); + strcpy(outstring,strings[found]); + + /*Free ressources*/ + xDelete(analyses); + for(i=0;i(string); + } + xDelete(strings); + return outstring; +} +/*}}}*/ +void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type){ /*{{{*/ + + /*!\file: ToolkitsOptionsFromAnalysis.cpp + * \brief: for each analysis, setup the issmoptions string. + * This is mainly for the case where we run our toolkits using petsc. In this case, we need to + * plug our toolkits options directly into the petsc options database. This is the case for each analysis type + * and parameters + */ + + + char* options=NULL; + + /*Recover first the options string for this analysis: */ + options=OptionsFromAnalysis(parameters,analysis_type); + + /*Initialize our Toolkit Options: */ + ToolkitOptions::Init(options); + + #ifdef _HAVE_PETSC_ + /*In case we are using PETSC, we do not rely on issmoptions. Instead, we dump issmoptions into the Petsc + * options database: */ + + #if _PETSC_MAJOR_ == 2 + PetscOptionsDestroy(); + PetscOptionsCreate(); + //PetscOptionsCheckInitial_Private(); + //PetscOptionsCheckInitial_Components(); + PetscOptionsSetFromOptions(); + PetscOptionsInsertMultipleString(options); //our patch + #else + PetscOptionsSetFromOptions(); + PetscOptionsClear(); + //PetscOptionsSetFromOptions(); + PetscOptionsInsertMultipleString(options); //our patch + #endif + + #endif + + xDelete(options); +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/DataSetParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/DataSetParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/DataSetParam.cpp (revision 15012) @@ -0,0 +1,84 @@ +/*!\file DataSetParam.c + * \brief: implementation of the DataSetParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "shared/shared.h" +/*}}}*/ + +/*DataSetParam constructors and destructor*/ +/*FUNCTION DataSetParam::DataSetParam(){{{*/ +DataSetParam::DataSetParam(){ + value=NULL; + return; +} +/*}}}*/ +/*FUNCTION DataSetParam::DataSetParam(int enum_type,DataSet *value){{{*/ +DataSetParam::DataSetParam(int in_enum_type,DataSet* in_value){ + + enum_type=in_enum_type; + value=in_value->Copy();; +} +/*}}}*/ +/*FUNCTION DataSetParam::~DataSetParam(){{{*/ +DataSetParam::~DataSetParam(){ + delete value; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION DataSetParam::Echo {{{*/ +void DataSetParam::Echo(void){ + this->DeepEcho(); +} +/*}}}*/ +/*FUNCTION DataSetParam::DeepEcho{{{*/ +void DataSetParam::DeepEcho(void){ + + _printLine_("DataSetParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + this->value->Echo(); +} +/*}}}*/ +/*FUNCTION DataSetParam::Id{{{*/ +int DataSetParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION DataSetParam::ObjectEnum{{{*/ +int DataSetParam::ObjectEnum(void){ + + return DataSetParamEnum; + +} +/*}}}*/ +/*FUNCTION DataSetParam::copy{{{*/ +Object* DataSetParam::copy() { + + return new DataSetParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*DataSetParam virtual functions definitions: */ +/*FUNCTION DataSetParam::GetParameterName{{{*/ +void DataSetParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION DataSetParam::UnitConversion{{{*/ +void DataSetParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ +/*FUNCTION DataSetParam::GetParameterValue{{{*/ +void DataSetParam::GetParameterValue(DataSet** pdataset){ + *pdataset=value->Copy(); +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/IntParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/IntParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/IntParam.cpp (revision 15012) @@ -0,0 +1,78 @@ +/*!\file IntParam.c + * \brief: implementation of the IntParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*IntParam constructors and destructor*/ +/*FUNCTION IntParam::IntParam(){{{*/ +IntParam::IntParam(){ + return; +} +/*}}}*/ +/*FUNCTION IntParam::IntParam(int enum_type,IssmInt value){{{*/ +IntParam::IntParam(int in_enum_type,IssmInt in_value){ + + enum_type=in_enum_type; + value=in_value; +} +/*}}}*/ +/*FUNCTION IntParam::~IntParam(){{{*/ +IntParam::~IntParam(){ + return; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION IntParam::Echo {{{*/ +void IntParam::Echo(void){ + this->DeepEcho(); +} +/*}}}*/ +/*FUNCTION IntParam::DeepEcho{{{*/ +void IntParam::DeepEcho(void){ + + _printLine_("IntParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" value: " << this->value); +} +/*}}}*/ +/*FUNCTION IntParam::Id{{{*/ +int IntParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION IntParam::ObjectEnum{{{*/ +int IntParam::ObjectEnum(void){ + + return IntParamEnum; + +} +/*}}}*/ +/*FUNCTION IntParam::copy{{{*/ +Object* IntParam::copy() { + + return new IntParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*IntParam virtual functions definitions: */ +/*FUNCTION IntParam::GetParameterName{{{*/ +void IntParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION IntParam::UnitConversion{{{*/ +void IntParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/IntVecParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/IntVecParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/IntVecParam.h (revision 15012) @@ -0,0 +1,77 @@ +/*! \file IntVecParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _INTVECPARAM_H_ +#define _INTVECPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class IntVecParam: public Param{ + + private: + int enum_type; + int* values; + int M; + + public: + /*IntVecParam constructors, destructors: {{{*/ + IntVecParam(); + IntVecParam(int enum_type,int* values,int M); + IntVecParam(int enum_type,IssmDouble* values,int M); + ~IntVecParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param virtual functions definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM); + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array (maybe in serial?)");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} + void SetValue(int* intarray,int M); + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + /*}}}*/ +}; +#endif Index: ../trunk-jpl/src/c/classes/Params/BoolParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/BoolParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/BoolParam.h (revision 15012) @@ -0,0 +1,75 @@ +/*! \file BoolParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _BOOLPARAM_H_ +#define _BOOLPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class BoolParam: public Param{ + + public: + /*just hold 3 values for 3 vertices: */ + int enum_type; + bool value; + + /*BoolParam constructors, destructors: {{{*/ + BoolParam(); + BoolParam(int enum_type,bool value); + ~BoolParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){*pbool=value;} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){this->value=boolean;} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an int");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmPDouble");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + /*}}}*/ +}; +#endif /* _BOOLPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/IntMatParam.h =================================================================== --- ../trunk-jpl/src/c/classes/Params/IntMatParam.h (revision 0) +++ ../trunk-jpl/src/c/classes/Params/IntMatParam.h (revision 15012) @@ -0,0 +1,78 @@ +/*! \file IntMatParam.h + * \brief: header file for triavertexinput object + */ + +#ifndef _INTMATPARAM_H_ +#define _INTMATPARAM_H_ + +/*Headers:*/ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "./Param.h" +#include "../../shared/shared.h" +/*}}}*/ + +class IntMatParam: public Param{ + + private: + int enum_type; + int* value; + int M; + int N; + + public: + /*IntMatParam constructors, destructors: {{{*/ + IntMatParam(); + IntMatParam(int enum_type,int* value,int M,int N); + ~IntMatParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN); + void GetParameterValue(IssmDouble* pIssmDouble){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}; + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + void GetParameterValue(DataSet** pdataset){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");} + + void SetValue(bool boolean){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} + void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");}; + void SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");}; + void SetValue(int* intarray,int M,int N); + void SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _INTMATPARAM_H */ Index: ../trunk-jpl/src/c/classes/Params/VectorParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/VectorParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/VectorParam.cpp (revision 15012) @@ -0,0 +1,109 @@ +/*!\file VectorParam.c + * \brief: implementation of the VectorParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*VectorParam constructors and destructor*/ +/*FUNCTION VectorParam::VectorParam(){{{*/ +VectorParam::VectorParam(){ + return; +} +/*}}}*/ +/*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{*/ +VectorParam::VectorParam(int in_enum_type,Vector* in_value){ + + enum_type=in_enum_type; + + value=NULL; + + if(in_value){ + value=in_value->Duplicate(); + in_value->Copy(value); + } +} +/*}}}*/ +/*FUNCTION VectorParam::~VectorParam(){{{*/ +VectorParam::~VectorParam(){ + delete value; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION VectorParam::Echo {{{*/ +void VectorParam::Echo(void){ + + _printLine_("VectorParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + +} +/*}}}*/ +/*FUNCTION VectorParam::DeepEcho{{{*/ +void VectorParam::DeepEcho(void){ + + _printLine_("VectorParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + value->Echo(); +} +/*}}}*/ +/*FUNCTION VectorParam::Id{{{*/ +int VectorParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION VectorParam::ObjectEnum{{{*/ +int VectorParam::ObjectEnum(void){ + + return VectorParamEnum; + +} +/*}}}*/ +/*FUNCTION VectorParam::copy{{{*/ +Object* VectorParam::copy() { + + return new VectorParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*VectorParam virtual functions definitions: */ +/*FUNCTION VectorParam::GetParameterValue{{{*/ +void VectorParam::GetParameterValue(Vector** poutput){ + Vector* output=NULL; + + if(value){ + output=value->Duplicate(); + value->Copy(output); + } + *poutput=output; +} +/*}}}*/ +/*FUNCTION VectorParam::GetParameterName{{{*/ +void VectorParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION VectorParam::SetValue{{{*/ +void VectorParam::SetValue(Vector* vector){ + + /*avoid leak: */ + delete value; + + /*copy: */ + value=vector->Duplicate(); + vector->Copy(value); +} +/*}}}*/ +/*FUNCTION VectorParam::UnitConversion{{{*/ +void VectorParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/MatrixParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/MatrixParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/MatrixParam.cpp (revision 15012) @@ -0,0 +1,105 @@ +/*!\file MatrixParam.c + * \brief: implementation of the MatrixParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*MatrixParam constructors and destructor*/ +/*FUNCTION MatrixParam::MatrixParam(){{{*/ +MatrixParam::MatrixParam(){ + return; +} +/*}}}*/ +/*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix* value){{{*/ +MatrixParam::MatrixParam(int in_enum_type,Matrix* in_value){ + + enum_type=in_enum_type; + value=NULL; + + if(in_value){ + value=in_value->Duplicate(); + } +} +/*}}}*/ +/*FUNCTION MatrixParam::~MatrixParam(){{{*/ +MatrixParam::~MatrixParam(){ + delete value; +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION MatrixParam::Echo {{{*/ +void MatrixParam::Echo(void){ + + _printLine_("MatrixParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + +} +/*}}}*/ +/*FUNCTION MatrixParam::DeepEcho{{{*/ +void MatrixParam::DeepEcho(void){ + + _printLine_("MatrixParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + this->value->Echo(); +} +/*}}}*/ +/*FUNCTION MatrixParam::Id{{{*/ +int MatrixParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION MatrixParam::ObjectEnum{{{*/ +int MatrixParam::ObjectEnum(void){ + + return MatrixParamEnum; + +} +/*}}}*/ +/*FUNCTION MatrixParam::copy{{{*/ +Object* MatrixParam::copy() { + + return new MatrixParam(this->enum_type,this->value); + +} +/*}}}*/ + +/*MatrixParam virtual functions definitions: */ +/*FUNCTION MatrixParam::GetParameterValue{{{*/ +void MatrixParam::GetParameterValue(Matrix** poutput){ + Matrix* output=NULL; + + if(value){ + output=value->Duplicate(); + } + *poutput=output; +} +/*}}}*/ +/*FUNCTION MatrixParam::GetParameterName{{{*/ +void MatrixParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION MatrixParam::SetValue{{{*/ +void MatrixParam::SetValue(Matrix* matrix){ + + /*avoid leak: */ + delete value; + + /*copy: */ + value=matrix->Duplicate(); +} +/*}}}*/ +/*FUNCTION MatrixParam::UnitConversion{{{*/ +void MatrixParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/StringArrayParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/StringArrayParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/StringArrayParam.cpp (revision 15012) @@ -0,0 +1,168 @@ +/*!\file StringArrayParam.c + * \brief: implementation of the StringArrayParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*StringArrayParam constructors and destructor*/ +/*FUNCTION StringArrayParam::StringArrayParam(){{{*/ +StringArrayParam::StringArrayParam(){ + return; +} +/*}}}*/ +/*FUNCTION StringArrayParam::StringArrayParam(int enum_type,char** in_values,int in_numstrings){{{*/ +StringArrayParam::StringArrayParam(int in_enum_type,char** in_values, int in_numstrings){ + + int i; + int size; + + enum_type=in_enum_type; + numstrings=in_numstrings; + + if(numstrings){ + value=xNew(numstrings); + for(i=0;i(size); + xMemCpy(string,in_values[i],size); + value[i]=string; + } + } + else value=NULL; + +} +/*}}}*/ +/*FUNCTION StringArrayParam::~StringArrayParam(){{{*/ +StringArrayParam::~StringArrayParam(){ + + int i; + + char* string=NULL; + for(i=0;inumstrings;i++){ + string=value[i]; + xDelete(string); + } + xDelete(value); +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION StringArrayParam::Echo {{{*/ +void StringArrayParam::Echo(void){ + this->DeepEcho(); +} +/*}}}*/ +/*FUNCTION StringArrayParam::DeepEcho{{{*/ +void StringArrayParam::DeepEcho(void){ + + int i; + char* string=NULL; + + _printLine_("StringArrayParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + for(i=0;inumstrings;i++){ + string=this->value[i]; + _printLine_(" " << i << ": " << string); + } +} +/*}}}*/ +/*FUNCTION StringArrayParam::Id{{{*/ +int StringArrayParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION StringArrayParam::ObjectEnum{{{*/ +int StringArrayParam::ObjectEnum(void){ + + return StringArrayParamEnum; + +} +/*}}}*/ +/*FUNCTION StringArrayParam::copy{{{*/ +Object* StringArrayParam::copy() { + + return new StringArrayParam(this->enum_type,this->value,this->numstrings); + +} +/*}}}*/ + +/*StringArrayParam virtual functions definitions: */ +/*FUNCTION StringArrayParam::GetParameterValue{{{*/ +void StringArrayParam::GetParameterValue(char*** pstringarray,int* pM){ + + int i; + char** outstrings=NULL; + int M; + char* string=NULL; + char* string2=NULL; + int stringsize; + + M=this->numstrings; + if(this->numstrings){ + outstrings=xNew(this->numstrings); + + for(i=0;inumstrings;i++){ + string=this->value[i]; + stringsize=strlen(string)+1; + + string2=xNew(stringsize); + xMemCpy(string2,string,stringsize); + + outstrings[i]=string2; + } + } + else outstrings=NULL; + + /*Assign output pointers:*/ + *pM=M; + *pstringarray=outstrings; +} +/*}}}*/ +/*FUNCTION StringArrayParam::GetParameterName{{{*/ +void StringArrayParam::GetParameterName(char**pname){ + EnumToStringx(pname,this->enum_type); +} +/*}}}*/ +/*FUNCTION StringArrayParam::SetValue{{{*/ +void StringArrayParam::SetValue(char** stringarray,int M){ + + int i; + char *string = NULL; + char *string2 = NULL; + int stringsize; + + /*first, avoid leak: */ + for(i=0;inumstrings;i++){ + string=this->value[i]; + xDelete(string); + } + xDelete(this->value); + + /*copy: */ + this->numstrings=M; + this->value=xNew(this->numstrings); + for(i=0;inumstrings;i++){ + string=stringarray[i]; + stringsize=strlen(string)+1; + + string2=xNew(stringsize); + xMemCpy(string2,string,stringsize); + + this->value[i]=string2; + } +} +/*}}}*/ +/*FUNCTION StringArrayParam::UnitConversion{{{*/ +void StringArrayParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: ../trunk-jpl/src/c/classes/Params/TransientParam.cpp =================================================================== --- ../trunk-jpl/src/c/classes/Params/TransientParam.cpp (revision 0) +++ ../trunk-jpl/src/c/classes/Params/TransientParam.cpp (revision 15012) @@ -0,0 +1,138 @@ +/*!\file TransientParam.c + * \brief: implementation of the TransientParam object + */ + +/*header files: */ +/*{{{*/ +#ifdef HAVE_CONFIG_H + #include +#else +#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" +#endif + +#include "../classes.h" +#include "../../shared/shared.h" +/*}}}*/ + +/*TransientParam constructors and destructor*/ +/*FUNCTION TransientParam::TransientParam(){{{*/ +TransientParam::TransientParam(){ + return; +} +/*}}}*/ +/*FUNCTION TransientParam::TransientParam(int enum_type,IssmDoubleMat value){{{*/ +TransientParam::TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,int in_N){ + + _assert_(in_values && in_time); + + enum_type=in_enum_type; + N=in_N; + + values=xNew(N); + xMemCpy(values,in_values,N); + + timesteps=xNew(N); + xMemCpy(timesteps,in_time,N); +} +/*}}}*/ +/*FUNCTION TransientParam::~TransientParam(){{{*/ +TransientParam::~TransientParam(){ + xDelete(values); + xDelete(timesteps); +} +/*}}}*/ + +/*Object virtual functions definitions:*/ +/*FUNCTION TransientParam::Echo {{{*/ +void TransientParam::Echo(void){ + + _printLine_("TransientParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" size: " << this->N); + +} +/*}}}*/ +/*FUNCTION TransientParam::DeepEcho{{{*/ +void TransientParam::DeepEcho(void){ + + _printLine_("TransientParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" size: " << this->N); + for(int i=0;iN;i++){ + _printLine_( "time: " << this->timesteps[i] << " value: " << this->values[i]); + } +} +/*}}}*/ +/*FUNCTION TransientParam::Id{{{*/ +int TransientParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION TransientParam::ObjectEnum{{{*/ +int TransientParam::ObjectEnum(void){ + + return TransientParamEnum; + +} +/*}}}*/ +/*FUNCTION TransientParam::copy{{{*/ +Object* TransientParam::copy() { + + return new TransientParam(this->enum_type,this->values,this->timesteps,this->N); + +} +/*}}}*/ + +/*TransientParam virtual functions definitions: */ +/*FUNCTION TransientParam::GetParameterValue(IssmDouble* pdouble,IssmDouble time){{{*/ +void TransientParam::GetParameterValue(IssmDouble* pdouble,IssmDouble time){ + + IssmDouble output; + bool found; + + /*Ok, we have the time, go through the timesteps, and figure out which interval we + *fall within. Then interpolate the values on this interval: */ + if(timetimesteps[0]){ + /*get values for the first time: */ + output=this->values[0]; + found=true; + } + else if(time>this->timesteps[this->N-1]){ + /*get values for the last time: */ + output=this->values[this->N-1]; + found=true; + } + else{ + /*Find which interval we fall within: */ + for(int i=0;iN;i++){ + if(time==this->timesteps[i]){ + /*We are right on one step time: */ + output=this->values[i]; + found=true; + break; //we are done with the time interpolation. + } + else{ + if(this->timesteps[i]