Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Matice.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Matice.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Matice.cpp (revision 12822) @@ -1,769 +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 "../objects.h" -#include "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../include/include.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 i; - 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::MyRank {{{*/ -int Matice::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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(elementsin); -} -/*}}}*/ -/*FUNCTION Matice::SetCurrentConfiguration {{{*/ -void Matice::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){ - -} -/*}}}*/ -/*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]->GetVertexDof(); - - /*Get input (either in element or material)*/ - Input* input=inputs->GetInput(input_enum); - if(!input) _error2_("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: _error2_("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((IssmDouble)10,(IssmDouble)17); - } - else{ - e=(n-1)/(2*n); - viscosity=B/(2*pow(A,e)); - } - } - } - - /*Checks in debugging mode*/ - if(viscosity<=0) _error2_("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) _error2_("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) _error2_("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,exz; - - /*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]->GetVertexDof()]; - this->inputs->AddInput(new TriaP1Input(name,values)); - return; - } - default: _error2_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } - default: _error2_("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]->GetSidList()]; //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: _error2_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet"); - } - default: _error2_("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;iData(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)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[int(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)[int(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;iData(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)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; - for(j=0;jData(InversionMinParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; - for(j=0;jData(InversionMaxParametersEnum)[int(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{ - _error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Material.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Material.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Material.h (revision 12822) @@ -1,27 +0,0 @@ -/*!\file: Material.h - * \brief abstract class for Material object - */ - - -#ifndef _MATERIAL_H_ -#define _MATERIAL_H_ - -/*Headers:*/ -/*{{{*/ -class Object; -#include "../Object.h" -#include "../../toolkits/toolkits.h" -/*}}}*/ - -class Material: public Object,public Update{ - - public: - virtual ~Material(){}; - - /*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; - -}; -#endif Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Matpar.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Matpar.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Materials/Matpar.cpp (revision 12822) @@ -1,361 +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 "../objects.h" -#include "../../shared/shared.h" -#include "../../include/include.h" -#include "../../EnumDefinitions/EnumDefinitions.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){ - - 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); - - iomodel->Constant(&this->hydro_CR,HydrologyCREnum); - iomodel->Constant(&this->kn,HydrologyKnEnum); - iomodel->Constant(&this->hydro_n,HydrologyNEnum); - iomodel->Constant(&this->hydro_p,HydrologyPEnum); - iomodel->Constant(&this->hydro_q,HydrologyQEnum); -} -/*}}}*/ -/*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); - return; -} -/*}}}*/ -/*FUNCTION Matpar::DeepEcho {{{*/ -void Matpar::DeepEcho(void){ - - this->Echo(); -} -/*}}}*/ -/*FUNCTION Matpar::Id {{{*/ -int Matpar::Id(void){ return mid; } -/*}}}*/ -/*FUNCTION Matpar::MyRank {{{*/ -int Matpar::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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; - 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::GetThermalConductivity {{{*/ -IssmDouble Matpar::GetThermalConductivity(){ - return thermalconductivity; -} -/*}}}*/ -/*FUNCTION Matpar::GetThermalExchangeVelocity {{{*/ -IssmDouble Matpar::GetThermalExchangeVelocity(){ - return thermal_exchange_velocity; -} -/*}}}*/ -/*FUNCTION Matpar::GetKn {{{*/ -IssmDouble Matpar::GetKn(){ - return 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::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(enthalpy -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../objects.h" -#include "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" - -/*ControlInput constructors and destructor*/ -/*FUNCTION ControlInput::ControlInput(){{{*/ -ControlInput::ControlInput(){ - control_id = 0; - values = NULL; - savedvalues = NULL; - minvalues = NULL; - maxvalues = NULL; - gradient = NULL; -} -/*}}}*/ -/*FUNCTION ControlInput::ControlInput(int enum_type,int enum_input,IssmDouble* pvalues,IssmDouble* pmin,IssmDouble* pmax,int id){{{*/ -ControlInput::ControlInput(int in_enum_type,int enum_input,IssmDouble* pvalues,IssmDouble* pmin,IssmDouble* pmax,int id){ - - control_id=id; - enum_type=in_enum_type; - - switch(enum_input){ - case TriaP1InputEnum: - values =new TriaP1Input(enum_type,pvalues); - savedvalues=new TriaP1Input(enum_type,pvalues); - minvalues =new TriaP1Input(enum_type,pmin); - maxvalues =new TriaP1Input(enum_type,pmax); - break; - case PentaP1InputEnum: - values =new PentaP1Input(enum_type,pvalues); - savedvalues=new PentaP1Input(enum_type,pvalues); - minvalues =new PentaP1Input(enum_type,pmin); - maxvalues =new PentaP1Input(enum_type,pmax); - break; - default: - _error2_("Input of Enum " << EnumToStringx(enum_input) << " not supported yet by ControlInput"); - } - gradient =NULL; -} -/*}}}*/ -/*FUNCTION ControlInput::~ControlInput(){{{*/ -ControlInput::~ControlInput(){ - delete values; - delete savedvalues; - delete minvalues; - delete maxvalues; - delete gradient; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ - /*FUNCTION ControlInput::Echo {{{*/ -void ControlInput::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION ControlInput::DeepEcho{{{*/ -void ControlInput::DeepEcho(void){ - - _printLine_("ControlInput:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_("---values: "); if (values) values->Echo(); - _printLine_("---savedvalues: ");if (savedvalues) savedvalues->Echo(); - _printLine_("---minvalues: "); if (minvalues) minvalues->Echo(); - _printLine_("---maxvalues: "); if (maxvalues) maxvalues->Echo(); - _printLine_("---gradient: "); if (gradient) gradient->Echo(); -} -/*}}}*/ -/*FUNCTION ControlInput::Id{{{*/ -int ControlInput::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION ControlInput::MyRank{{{*/ -int ControlInput::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION ControlInput::ObjectEnum{{{*/ -int ControlInput::ObjectEnum(void){ - - return ControlInputEnum; - -} -/*}}}*/ -/*FUNCTION ControlInput::copy{{{*/ -Object* ControlInput::copy() { - - ControlInput* output=NULL; - - output = new ControlInput(); - output->enum_type=this->enum_type; - output->control_id=this->control_id; - - if(values) output->values=(Input*)this->values->copy(); - if(savedvalues) output->savedvalues=(Input*)this->savedvalues->copy(); - if(minvalues) output->minvalues=(Input*)this->minvalues->copy(); - if(maxvalues) output->maxvalues=(Input*)this->maxvalues->copy(); - if(gradient) output->gradient=(Input*)this->gradient->copy(); - - return output; -} -/*}}}*/ - -/*ControlInput management*/ -/*FUNCTION ControlInput::InstanceEnum{{{*/ -int ControlInput::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION ControlInput::Constrain(){{{*/ -void ControlInput::Constrain(void){ - - Input* newvalues=NULL; - - newvalues=this->values->PointwiseMin(maxvalues); - delete values; this->values=newvalues; - newvalues=this->values->PointwiseMax(minvalues); - delete values; this->values=newvalues; -}/*}}}*/ -/*FUNCTION ControlInput::Constrain(IssmDouble min, IssmDouble max){{{*/ -void ControlInput::Constrain(IssmDouble min, IssmDouble max){ - values->Constrain(min,max); -}/*}}}*/ -/*FUNCTION ControlInput::Extrude{{{*/ -void ControlInput::Extrude(void){ - values->Extrude(); - savedvalues->Extrude(); - //gradient->Extrude(); -}/*}}}*/ -/*FUNCTION ControlInput::GetGradient{{{*/ -void ControlInput::GetGradient(Vector* gradient_vec,int* doflist){ - if(gradient) gradient->GetVectorFromInputs(gradient_vec,doflist); -}/*}}}*/ -/*FUNCTION ControlInput::ScaleGradient{{{*/ -void ControlInput::ScaleGradient(IssmDouble scaling_factor){ - if(!gradient) _error2_("Gradient of ControlInput " << EnumToStringx(enum_type) << " not found"); - gradient->Scale(scaling_factor); -}/*}}}*/ -/*FUNCTION ControlInput::SetGradient{{{*/ -void ControlInput::SetGradient(Input* gradient_in){ - - /*Get enum for current gradient*/ - switch(this->control_id){ - case 1: - gradient_in->ChangeEnum(Gradient1Enum); - break; - case 2: - gradient_in->ChangeEnum(Gradient2Enum); - break; - case 3: - gradient_in->ChangeEnum(Gradient3Enum); - break; - default: - _error2_("more than 3 controls not implemented yet (Gradient " << this->control_id << " was requested). EnumDefinitions.h needs to be updated."); - } - - /*Delete old gradient and assign new gradient*/ - if(gradient) delete gradient; - gradient=gradient_in; - -}/*}}}*/ -/*FUNCTION ControlInput::SetInput{{{*/ -void ControlInput::SetInput(Input* in_input){ - - delete values; this->values=in_input; - this->SaveValue(); //because this is what SpawnResult saves FIXME - -}/*}}}*/ -/*FUNCTION ControlInput::SpawnResult{{{*/ -ElementResult* ControlInput::SpawnResult(int step, IssmDouble time){ - return savedvalues->SpawnResult(step,time); -}/*}}}*/ -/*FUNCTION ControlInput::SpawnTriaInput{{{*/ -Input* ControlInput::SpawnTriaInput(int* indices){ - return values->SpawnTriaInput(indices); -}/*}}}*/ -/*FUNCTION ControlInput::SpawnGradient{{{*/ -ElementResult* ControlInput::SpawnGradient(int step, IssmDouble time){ - _assert_(gradient); - return gradient->SpawnResult(step,time); -}/*}}}*/ -/*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){{{*/ -void ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){ - values->GetVectorFromInputs(vector,doflist); -}/*}}}*/ -/*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){{{*/ -void ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){ - if(strcmp(data,"value")==0){ - _assert_(values); - values->GetVectorFromInputs(vector,doflist); - } - else if (strcmp(data,"lowerbound")==0){ - _assert_(minvalues); - minvalues->GetVectorFromInputs(vector,doflist); - } - else if (strcmp(data,"upperbound")==0){ - _assert_(maxvalues); - maxvalues->GetVectorFromInputs(vector,doflist); - } - else if (strcmp(data,"gradient")==0){ - _assert_(gradient); - gradient->GetVectorFromInputs(vector,doflist); - } - else{ - _error2_("Data " << data << " not supported yet"); - } -}/*}}}*/ -/*FUNCTION ControlInput::GetInputAverage(IssmDouble* pvalue){{{*/ -void ControlInput::GetInputAverage(IssmDouble* pvalue){ - values->GetInputAverage(pvalue); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputValue(bool* pvalue){{{*/ -void ControlInput::GetInputValue(bool* pvalue){ - values->GetInputValue(pvalue); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputValue(int* pvalue){{{*/ -void ControlInput::GetInputValue(int* pvalue){ - values->GetInputValue(pvalue); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/ -void ControlInput::GetInputValue(IssmDouble* pvalue){ - values->GetInputValue(pvalue); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/ -void ControlInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){ - values->GetInputValue(pvalue,gauss); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputValue(IssmDouble* pvalue){{{*/ -void ControlInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){ - values->GetInputValue(pvalue,gauss); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){ - values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss); -}/*}}}*/ -/*FUNCTION ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void ControlInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){ - values->GetInputDerivativeValue(derivativevalues,xyz_list,gauss); -}/*}}}*/ -/*FUNCTION ControlInput::SaveValue{{{*/ -void ControlInput::SaveValue(void){ - if(!values) _error2_("Values of " << EnumToStringx(this->enum_type) << " not found"); - - if(savedvalues) delete this->savedvalues; - this->savedvalues=(Input*)this->values->copy(); -}/*}}}*/ -/*FUNCTION ControlInput::UpdateValue{{{*/ -void ControlInput::UpdateValue(IssmDouble scalar){ - if(!gradient) _error2_("Gradient of " << EnumToStringx(this->enum_type) << " not found"); - if(!savedvalues) _error2_("Values of " << EnumToStringx(this->enum_type) << " not found"); - - if(values) delete this->values; - this->values=(Input*)this->savedvalues->copy(); - this->values->AXPY(gradient,scalar); -}/*}}}*/ -/*FUNCTION ControlInput::VerticallyIntegrate{{{*/ -void ControlInput::VerticallyIntegrate(Input* thickness_input){ - values->VerticallyIntegrate(thickness_input); -}/*}}}*/ -/*FUNCTION ControlInput::Configure{{{*/ -void ControlInput::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/Input.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/Input.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/Input.h (revision 12822) @@ -1,69 +0,0 @@ -/*!\file: Input.h - * \brief abstract class for Input object - */ - - -#ifndef _INPUT_H_ -#define _INPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "../Object.h" -class Node; -class ElementResult; -class GaussTria; -class Parameters; -/*}}}*/ - -class Input: public Object{ - - public: - - virtual ~Input(){}; - - virtual int InstanceEnum()=0; - virtual void GetInputValue(bool* pvalue)=0; - virtual void GetInputValue(int* pvalue)=0; - virtual void GetInputValue(IssmDouble* pvalue)=0; - virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss)=0; - virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss)=0; - virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time)=0; - virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time)=0; - virtual void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index)=0; - virtual void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index)=0; - virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss)=0; - virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss)=0; - virtual void GetInputAverage(IssmDouble* pvalue)=0; - virtual void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss)=0; - virtual void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss)=0; - virtual void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss)=0; - virtual void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss)=0; - virtual void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss)=0; - virtual void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss)=0; - virtual void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss)=0; - virtual void ChangeEnum(int newenumtype)=0; - virtual void Configure(Parameters* parameters)=0; - - virtual void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters)=0; - virtual void ConstrainMin(IssmDouble minimum)=0; - virtual IssmDouble InfinityNorm(void)=0; - virtual IssmDouble MaxAbs(void)=0; - virtual IssmDouble MinAbs(void)=0; - virtual IssmDouble Max(void)=0; - virtual IssmDouble Min(void)=0; - virtual void Scale(IssmDouble scale_factor)=0; - virtual void ArtificialNoise(IssmDouble min,IssmDouble max)=0; - virtual void AXPY(Input* xinput,IssmDouble scalar)=0; - virtual void Constrain(IssmDouble cm_min, IssmDouble cm_max)=0; - virtual void VerticallyIntegrate(Input* thickness_input)=0; - virtual void Extrude()=0; - virtual void GetVectorFromInputs(Vector* vector,int* doflist)=0; - virtual void GetValuesPtr(IssmDouble** pvalues,int* pnum_values)=0; - - virtual Input* SpawnTriaInput(int* indices)=0; - virtual Input* PointwiseDivide(Input* inputB)=0; - virtual Input* PointwiseMax(Input* inputmax)=0; - virtual Input* PointwiseMin(Input* inputmin)=0; - virtual ElementResult* SpawnResult(int step, IssmDouble time)=0; -}; -#endif Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/ControlInput.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/ControlInput.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/ControlInput.h (revision 12822) @@ -1,98 +0,0 @@ -/*! \file ControlInput.h - * \brief: header file for triavertexinput object - */ - - -#ifndef _CONTROLINPUT_H_ -#define _CONTROLINPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -#include "../../include/include.h" -class GaussTria; -/*}}}*/ - -class ControlInput: public Input{ - - public: - int enum_type; - int control_id; - Input* values; - Input* savedvalues; - Input* minvalues; - Input* maxvalues; - Input* gradient; - - /*ControlInput constructors, destructors: {{{*/ - ControlInput(); - ControlInput(int enum_type,int enum_input,IssmDouble* pvalues,IssmDouble* pmin,IssmDouble* pmax,int id); - ~ControlInput(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*ControlInput management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; - ElementResult* SpawnResult(int step, IssmDouble time); - void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; - void Configure(Parameters* parameters); - /*}}}*/ - /*numerics: {{{*/ - void SetInput(Input* in_input); - void GetInputValue(bool* pvalue); - void GetInputValue(int* pvalue); - void GetInputValue(IssmDouble* pvalue); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); - void GetInputAverage(IssmDouble* pvalue); - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void ChangeEnum(int newenumtype){_error2_("not implemented yet");}; - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){_error2_("not implemented yet");}; - void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; - void Scale(IssmDouble scale_factor){_error2_("not implemented yet");}; - void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - void AXPY(Input* xinput,IssmDouble scalar){_error2_("not implemented yet");}; - void Constrain(void); - void Constrain(IssmDouble min,IssmDouble max); - IssmDouble InfinityNorm(void){_error2_("not implemented yet");}; - IssmDouble Max(void){_error2_("not implemented yet");}; - IssmDouble MaxAbs(void){_error2_("not implemented yet");}; - IssmDouble Min(void){_error2_("not implemented yet");}; - IssmDouble MinAbs(void){_error2_("not implemented yet");}; - void Extrude(void); - void VerticallyIntegrate(Input* thickness_input); - void GetVectorFromInputs(Vector* vector,int* doflist,const char* data); - void GetVectorFromInputs(Vector* vector,int* doflist); - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error2_("not implemented yet");}; - ElementResult* SpawnGradient(int step, IssmDouble time); - void GetGradient(Vector* gradient_vec,int* doflist); - void ScaleGradient(IssmDouble scale); - void SetGradient(Input* gradient_in); - void UpdateValue(IssmDouble scalar); - void SaveValue(void); - /*}}}*/ - -}; -#endif /* _CONTROLINPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DatasetInput.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DatasetInput.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DatasetInput.cpp (revision 12822) @@ -1,122 +0,0 @@ -/*!\file DatasetInput.c - * \brief: implementation of the datasetinput 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" -/*}}}*/ - -/*DatasetInput constructors and destructor*/ -/*FUNCTION DatasetInput::DatasetInput(){{{*/ -DatasetInput::DatasetInput(){ - enum_type=UNDEF; - inputs=NULL; -} -/*}}}*/ -/*FUNCTION DatasetInput::DatasetInput(int in_enum_type) {{{*/ -DatasetInput::DatasetInput(int in_enum_type){ - - enum_type = in_enum_type; - inputs = new Inputs(); -} -/*}}}*/ -/*FUNCTION DatasetInput::~DatasetInput(){{{*/ -DatasetInput::~DatasetInput(){ - delete inputs; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ - /*FUNCTION DatasetInput::Echo {{{*/ -void DatasetInput::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION DatasetInput::DeepEcho{{{*/ -void DatasetInput::DeepEcho(void){ - - _printLine_("DatasetInput:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_("---inputs: "); inputs->Echo(); -} -/*}}}*/ -/*FUNCTION DatasetInput::Id{{{*/ -int DatasetInput::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION DatasetInput::MyRank{{{*/ -int DatasetInput::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION DatasetInput::ObjectEnum{{{*/ -int DatasetInput::ObjectEnum(void){ - - return DatasetInputEnum; - -} -/*}}}*/ -/*FUNCTION DatasetInput::copy{{{*/ -Object* DatasetInput::copy() { - - DatasetInput* output=NULL; - - output = new DatasetInput(); - output->enum_type=this->enum_type; - output->inputs=(Inputs*)this->inputs->Copy(); - - return output; -} -/*}}}*/ -/*FUNCTION DatasetInput::SpawnTriaInput{{{*/ -Input* DatasetInput::SpawnTriaInput(int* indices){ - - /*output*/ - DatasetInput* outinput=NULL; - - /*Create new Datasetinput (copy of current input)*/ - outinput=new DatasetInput(); - outinput->enum_type=this->enum_type; - outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices); - - /*Assign output*/ - return outinput; -} -/*}}}*/ - -/*DatasetInput management*/ -/*FUNCTION DatasetInput::InstanceEnum{{{*/ -int DatasetInput::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION DatasetInput::Configure{{{*/ -void DatasetInput::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ -/*FUNCTION DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){{{*/ -void DatasetInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,int index){ - - /*Get requested input within dataset*/ - if(index<0 || index > inputs->Size()-1) _error2_("index requested (" << index << ") exceeds dataset size (" << inputs->Size() << ")"); - Input* input=(Input*)this->inputs->GetObjectByOffset(index); - - input->GetInputValue(pvalue,gauss); -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DatasetInput.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DatasetInput.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DatasetInput.h (revision 12822) @@ -1,92 +0,0 @@ -/*! \file DatasetInput.h - * \brief: header file for datasetinput object - */ - - -#ifndef _DATASETINPUT_H_ -#define _DATASETINPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -#include "../../include/include.h" -class GaussTria; -/*}}}*/ - -class DatasetInput: public Input{ - - public: - int enum_type; - - Inputs* inputs; - - /*DatasetInput constructors, destructors: {{{*/ - DatasetInput(); - DatasetInput(int enum_type); - ~DatasetInput(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*DatasetInput management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; - ElementResult* SpawnResult(int step, IssmDouble time){_error2_("not implemented yet");}; - void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; - void Configure(Parameters* parameters); - /*}}}*/ - /*numerics: {{{*/ - void GetInputValue(bool* pvalue){_error2_("not implemented yet");}; - void GetInputValue(int* pvalue){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetInputAverage(IssmDouble* pvalue){_error2_("not implemented yet");}; - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void ChangeEnum(int newenumtype){_error2_("not implemented yet");}; - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){_error2_("not implemented yet");}; - void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; - void Scale(IssmDouble scale_factor){_error2_("not implemented yet");}; - void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - void AXPY(Input* xinput,IssmDouble scalar){_error2_("not implemented yet");}; - void Constrain(void){_error2_("not implemented yet");}; - void Constrain(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - IssmDouble InfinityNorm(void){_error2_("not implemented yet");}; - IssmDouble Max(void){_error2_("not implemented yet");}; - IssmDouble MaxAbs(void){_error2_("not implemented yet");}; - IssmDouble Min(void){_error2_("not implemented yet");}; - IssmDouble MinAbs(void){_error2_("not implemented yet");}; - void Extrude(void){_error2_("not implemented yet");}; - void VerticallyIntegrate(Input* thickness_input){_error2_("not implemented yet");}; - void GetVectorFromInputs(Vector* vector,int* doflist){_error2_("not implemented yet");}; - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error2_("not implemented yet");}; - ElementResult* SpawnGradient(int step, IssmDouble time){_error2_("not implemented yet");}; - void GetGradient(Vector* gradient_vec,int* doflist){_error2_("not implemented yet");}; - void ScaleGradient(IssmDouble scale){_error2_("not implemented yet");}; - void SetGradient(Input* gradient_in){_error2_("not implemented yet");}; - void UpdateValue(IssmDouble scalar){_error2_("not implemented yet");}; - void SaveValue(void){_error2_("not implemented yet");}; - /*}}}*/ - -}; -#endif /* _DATASETINPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/IntInput.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/IntInput.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/IntInput.cpp (revision 12822) @@ -1,199 +0,0 @@ -/*!\file IntInput.c - * \brief: implementation of the IntInput 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" - -/*IntInput constructors and destructor*/ -/*FUNCTION IntInput::IntInput(){{{*/ -IntInput::IntInput(){ - return; -} -/*}}}*/ -/*FUNCTION IntInput::IntInput(IssmDouble* values){{{*/ -IntInput::IntInput(int in_enum_type,IssmInt in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION IntInput::~IntInput(){{{*/ -IntInput::~IntInput(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION IntInput::DeepEcho{{{*/ -void IntInput::DeepEcho(void){ - - _printLine_("IntInput:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " << (int)this->value); -} -/*}}}*/ -/*FUNCTION IntInput::Id{{{*/ -int IntInput::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION IntInput::MyRank{{{*/ -int IntInput::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION IntInput::ObjectEnum{{{*/ -int IntInput::ObjectEnum(void){ - - return IntInputEnum; - -} -/*}}}*/ -/*FUNCTION IntInput::copy{{{*/ -Object* IntInput::copy() { - - return new IntInput(this->enum_type,this->value); - -} -/*}}}*/ - -/*IntInput management*/ -/*FUNCTION IntInput::Echo {{{*/ -void IntInput::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION IntInput::InstanceEnum{{{*/ -int IntInput::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ -/*FUNCTION IntInput::SpawnTriaInput{{{*/ -Input* IntInput::SpawnTriaInput(int* indices){ - - /*output*/ - IntInput* outinput=new IntInput(); - - /*only copy current value*/ - outinput->enum_type=this->enum_type; - outinput->value=this->value; - - /*Assign output*/ - return outinput; -} -/*}}}*/ -/*FUNCTION IntInput::SpawnResult{{{*/ -ElementResult* IntInput::SpawnResult(int step, IssmDouble time){ - - _error2_("not supported yet!"); - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION IntInput::GetInputValue(bool* pvalue) {{{*/ -void IntInput::GetInputValue(bool* pvalue){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION IntInput::GetInputValue(int* pvalue){{{*/ -void IntInput::GetInputValue(int* pvalue){ - *pvalue=value; -} -/*}}}*/ -/*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue){{{*/ -void IntInput::GetInputValue(IssmDouble* pvalue){ - _error2_("IntInput cannot return a IssmDouble in parallel"); -} -/*}}}*/ -/*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ -void IntInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION IntInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ -void IntInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void IntInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION IntInput::ChangeEnum{{{*/ -void IntInput::ChangeEnum(int newenumtype){ - this->enum_type=newenumtype; -} -/*}}}*/ -/*FUNCTION IntInput::SquareMin{{{*/ -void IntInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ - - /*square min of an integer is the square of the integer itself: */ - *psquaremin=pow((IssmDouble)value,2); -} -/*}}}*/ -/*FUNCTION IntInput::Scale{{{*/ -void IntInput::Scale(IssmDouble scale_factor){ - IssmDouble dvalue=(IssmDouble)value*scale_factor; - value=reCast(dvalue); -} -/*}}}*/ -/*FUNCTION IntInput::AXPY{{{*/ -void IntInput::AXPY(Input* xinput,IssmDouble scalar){ - - IssmDouble dvalue; - IntInput* xintinput=NULL; - - /*xinput is of the same type, so cast it: */ - xintinput=(IntInput*)xinput; - - /*Carry out the AXPY operation depending on type:*/ - switch(xinput->ObjectEnum()){ - - case IntInputEnum: - dvalue=(IssmDouble)this->value+scalar*(IssmDouble)xintinput->value; - this->value=reCast(dvalue); - return; - - default: - _error2_("not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION IntInput::Constrain{{{*/ -void IntInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){ - - if(!xIsNan(cm_min)) if (this->valuevalue=reCast(cm_min); - if(!xIsNan(cm_max)) if (this->value>cm_max)this->value=reCast(cm_max); - -} -/*}}}*/ -/*FUNCTION IntInput::GetVectorFromInputs{{{*/ -void IntInput::GetVectorFromInputs(Vector* vector,int* doflist){ - - _error2_("not supporte yet!"); - -} -/*}}}*/ -/*FUNCTION IntInput::GetValuesPtr{{{*/ -void IntInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ - - _error2_("not supported yet!"); - -} -/*}}}*/ -/*FUNCTION IntInput::Configure{{{*/ -void IntInput::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/BoolInput.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/BoolInput.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/BoolInput.cpp (revision 12822) @@ -1,193 +0,0 @@ -/*!\file BoolInput.c - * \brief: implementation of the BoolInput 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" - -/*BoolInput constructors and destructor*/ -/*FUNCTION BoolInput::BoolInput(){{{*/ -BoolInput::BoolInput(){ - return; -} -/*}}}*/ -/*FUNCTION BoolInput::BoolInput(IssmDouble* values){{{*/ -BoolInput::BoolInput(int in_enum_type,IssmBool in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION BoolInput::~BoolInput(){{{*/ -BoolInput::~BoolInput(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION BoolInput::Echo {{{*/ -void BoolInput::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION BoolInput::DeepEcho{{{*/ -void BoolInput::DeepEcho(void){ - - _printLine_("BoolInput:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " <<(value?"true":"false")); -} -/*}}}*/ -/*FUNCTION BoolInput::Id{{{*/ -int BoolInput::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION BoolInput::MyRank{{{*/ -int BoolInput::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION BoolInput::ObjectEnum{{{*/ -int BoolInput::ObjectEnum(void){ - - return BoolInputEnum; - -} -/*}}}*/ -/*FUNCTION BoolInput::copy{{{*/ -Object* BoolInput::copy() { - - return new BoolInput(this->enum_type,this->value); - -} -/*}}}*/ - -/*BoolInput management*/ -/*FUNCTION BoolInput::InstanceEnum{{{*/ -int BoolInput::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ -/*FUNCTION BoolInput::SpawnTriaInput{{{*/ -Input* BoolInput::SpawnTriaInput(int* indices){ - - /*output*/ - BoolInput* outinput=new BoolInput(); - - /*only copy current value*/ - outinput->enum_type=this->enum_type; - outinput->value=this->value; - - /*Assign output*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION BoolInput::SpawnResult{{{*/ -ElementResult* BoolInput::SpawnResult(int step, IssmDouble time){ - - return new BoolElementResult(this->enum_type,this->value,step,time); - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION BoolInput::GetInputValue(bool* pvalue) {{{*/ -void BoolInput::GetInputValue(bool* pvalue){ - *pvalue=value; -} -/*}}}*/ -/*FUNCTION BoolInput::GetInputValue(int* pvalue){{{*/ -void BoolInput::GetInputValue(int* pvalue){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue){{{*/ -void BoolInput::GetInputValue(IssmDouble* pvalue){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ -void BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ -void BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION BoolInput::ChangeEnum{{{*/ -void BoolInput::ChangeEnum(int newenumtype){ - this->enum_type=newenumtype; -} -/*}}}*/ -/*FUNCTION BoolInput::SquareMin{{{*/ -void BoolInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ - /*square of a bool is the bool itself: */ - *psquaremin=value; -} -/*}}}*/ -/*FUNCTION BoolInput::Scale{{{*/ -void BoolInput::Scale(IssmDouble scale_factor){ - /*a bool cannot be scaled: */ -} -/*}}}*/ -/*FUNCTION BoolInput::AXPY{{{*/ -void BoolInput::AXPY(Input* xinput,IssmDouble scalar){ - - BoolInput* xboolinput=NULL; - - /*xinput is of the same type, so cast it: */ - xboolinput=(BoolInput*)xinput; - - /*Carry out the AXPY operation depending on type:*/ - switch(xinput->ObjectEnum()){ - - case BoolInputEnum: - this->value=reCast(this->value+scalar*xboolinput->value); - return; - - default: - _error2_("not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION BoolInput::Extrude{{{*/ -void BoolInput::Extrude(void){ - - /*do nothing*/ - return; -} -/*}}}*/ -/*FUNCTION BoolInput::GetVectorFromInputs{{{*/ -void BoolInput::GetVectorFromInputs(Vector* vector,int* doflist){ - - _error2_("not supporte yet!"); - -} -/*}}}*/ -/*FUNCTION BoolInput::GetValuesPtr{{{*/ -void BoolInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ - - _error2_("not supported yet!"); - -} -/*}}}*/ -/*FUNCTION BoolInput::Configure{{{*/ -void BoolInput::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/IntInput.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/IntInput.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/IntInput.h (revision 12822) @@ -1,85 +0,0 @@ -/*! \file IntInput.h - * \brief: header file for triavertexinput object - */ - - -#ifndef _INTINPUT_H_ -#define _INTINPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -#include "../../include/include.h" -class GaussTria; -/*}}}*/ - -class IntInput: public Input{ - - public: - /*just hold 3 values for 3 vertices: */ - int enum_type; - IssmInt value; - - /*IntInput constructors, destructors: {{{*/ - IntInput(); - IntInput(int enum_type,IssmInt value); - ~IntInput(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*IntInput management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; - ElementResult* SpawnResult(int step, IssmDouble time); - void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; - void Configure(Parameters* parameters); - /*}}}*/ - /*numerics: {{{*/ - void GetInputValue(bool* pvalue); - void GetInputValue(int* pvalue); - void GetInputValue(IssmDouble* pvalue); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); - void GetInputAverage(IssmDouble* pvalue){_error2_("not implemented yet");}; - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void ChangeEnum(int newenumtype); - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); - void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; - void Scale(IssmDouble scale_factor); - void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - void AXPY(Input* xinput,IssmDouble scalar); - void Constrain(IssmDouble cm_min, IssmDouble cm_max); - IssmDouble InfinityNorm(void){_error2_("InfinityNorm not implemented for integers");}; - IssmDouble Max(void){_error2_("Max not implemented for integers");}; - IssmDouble MaxAbs(void){_error2_("Max not implemented for integers");}; - IssmDouble Min(void){_error2_("Min not implemented for integers");}; - IssmDouble MinAbs(void){_error2_("Min not implemented for integers");}; - void Extrude(void){_error2_("not supported yet");}; - void VerticallyIntegrate(Input* thickness_input){_error2_("not supported yet");}; - void GetVectorFromInputs(Vector* vector,int* doflist); - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); - /*}}}*/ - -}; -#endif /* _INTINPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/BoolInput.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/BoolInput.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/BoolInput.h (revision 12822) @@ -1,85 +0,0 @@ -/*! \file BoolInput.h - * \brief: header file for triavertexinput object - */ - - -#ifndef _BOOLINPUT_H_ -#define _BOOLINPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -#include "../../include/include.h" -class GaussTria; -/*}}}*/ - -class BoolInput: public Input{ - - public: - /*just hold 3 values for 3 vertices: */ - int enum_type; - IssmBool value; - - /*BoolInput constructors, destructors: {{{*/ - BoolInput(); - BoolInput(int enum_type,IssmBool value); - ~BoolInput(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*BoolInput management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMin(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMax(Input* inputB){_error2_("not implemented yet");}; - ElementResult* SpawnResult(int step, IssmDouble time); - void Configure(Parameters* parameters); - void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; - /*}}}*/ - /*numerics: {{{*/ - void GetInputValue(bool* pvalue); - void GetInputValue(int* pvalue); - void GetInputValue(IssmDouble* pvalue); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); - void GetInputAverage(IssmDouble* pvalue){_error2_("not implemented yet");}; - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void ChangeEnum(int newenumtype); - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); - void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; - IssmDouble InfinityNorm(void){_error2_("InfinityNorm not implemented for booleans");}; - IssmDouble Max(void){_error2_("Max not implemented for booleans");}; - IssmDouble MaxAbs(void){_error2_("Max not implemented for booleans");}; - IssmDouble Min(void){_error2_("Min not implemented for booleans");}; - IssmDouble MinAbs(void){_error2_("Min not implemented for booleans");}; - void Scale(IssmDouble scale_factor); - void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - void AXPY(Input* xinput,IssmDouble scalar); - void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error2_("Constrain not implemented for booleans");}; - void Extrude(void); - void VerticallyIntegrate(Input* thickness_input){_error2_("not supported yet");}; - void GetVectorFromInputs(Vector* vector,int* doflist); - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); - /*}}}*/ - -}; -#endif /* _BOOLINPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TriaP1Input.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TriaP1Input.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TriaP1Input.cpp (revision 12822) @@ -1,422 +0,0 @@ -/*!\file TriaP1Input.c - * \brief: implementation of the TriaP1Input 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" - -/*TriaP1Input constructors and destructor*/ -/*FUNCTION TriaP1Input::TriaP1Input(){{{*/ -TriaP1Input::TriaP1Input(){ - return; -} -/*}}}*/ -/*FUNCTION TriaP1Input::TriaP1Input(int in_enum_type,IssmDouble* values){{{*/ -TriaP1Input::TriaP1Input(int in_enum_type,IssmDouble* in_values) - :TriaRef(1) -{ - - /*Set TriaRef*/ - this->SetElementType(P1Enum,0); - this->element_type=P1Enum; - - /*Set Enum*/ - enum_type=in_enum_type; - - /*Set values*/ - values[0]=in_values[0]; - values[1]=in_values[1]; - values[2]=in_values[2]; -} -/*}}}*/ -/*FUNCTION TriaP1Input::~TriaP1Input(){{{*/ -TriaP1Input::~TriaP1Input(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION TriaP1Input::Echo {{{*/ -void TriaP1Input::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION TriaP1Input::DeepEcho{{{*/ -void TriaP1Input::DeepEcho(void){ - - _printLine_("TriaP1Input:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << "]"); -} -/*}}}*/ -/*FUNCTION TriaP1Input::Id{{{*/ -int TriaP1Input::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION TriaP1Input::MyRank{{{*/ -int TriaP1Input::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION TriaP1Input::ObjectEnum{{{*/ -int TriaP1Input::ObjectEnum(void){ - - return TriaP1InputEnum; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::copy{{{*/ -Object* TriaP1Input::copy() { - - return new TriaP1Input(this->enum_type,this->values); - -} -/*}}}*/ - -/*TriaP1Input management*/ -/*FUNCTION TriaP1Input::InstanceEnum{{{*/ -int TriaP1Input::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::SpawnTriaInput{{{*/ -Input* TriaP1Input::SpawnTriaInput(int* indices){ - - /*output*/ - TriaP1Input* outinput=NULL; - - /*Create new Tria input (copy of current input)*/ - outinput=new TriaP1Input(this->enum_type,&this->values[0]); - - /*Assign output*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::SpawnResult{{{*/ -ElementResult* TriaP1Input::SpawnResult(int step, IssmDouble time){ - - return new TriaP1ElementResult(this->enum_type,this->values,step,time); - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION TriaP1Input::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ -void TriaP1Input::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){ - - /*Call TriaRef function*/ - TriaRef::GetInputValue(pvalue,&values[0],gauss); - -} -/*}}}*/ -/*FUNCTION TriaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void TriaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){ - - /*Call TriaRef function*/ - TriaRef::GetInputDerivativeValue(p,&values[0],xyz_list,gauss); -} -/*}}}*/ -/*FUNCTION TriaP1Input::GetVxStrainRate2d{{{*/ -void TriaP1Input::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){ - - /*Intermediary*/ - int i; - const int numnodes=3; - IssmDouble B[3][NDOF2*numnodes]; - IssmDouble velocity[3][NDOF2]; - - /*Get B matrix: */ - GetBMacAyeal(&B[0][0], xyz_list, gauss); - - /*Here, we are computing the strain rate of (vx,0)*/ - for(i=0;i<3;i++){ - velocity[i][0]=this->values[i]; - velocity[i][1]=0.0; - } - /*Get epsilon(vx) = B*velocity*/ - MatrixMultiply( &B[0][0],3,NDOF2*numnodes,0, - &velocity[0][0],NDOF2*numnodes,1,0, - epsilonvx,0); -} -/*}}}*/ -/*FUNCTION TriaP1Input::GetVyStrainRate2d{{{*/ -void TriaP1Input::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){ - - /*Intermediary*/ - int i; - const int numnodes=3; - IssmDouble B[3][NDOF2*numnodes]; - IssmDouble velocity[3][NDOF2]; - - /*Get B matrix: */ - GetBMacAyeal(&B[0][0], xyz_list, gauss); - - /*Here, we are computing the strain rate of (0,vy)*/ - for(i=0;i<3;i++){ - velocity[i][0]=0.0; - velocity[i][1]=this->values[i]; - } - /*Get epsilon(vy) = B*velocity*/ - MatrixMultiply( &B[0][0],3,NDOF2*numnodes,0, - &velocity[0][0],NDOF2*numnodes,1,0, - epsilonvy,0); -} -/*}}}*/ -/*FUNCTION TriaP1Input::ChangeEnum{{{*/ -void TriaP1Input::ChangeEnum(int newenumtype){ - this->enum_type=newenumtype; -} -/*}}}*/ -/*FUNCTION TriaP1Input::GetInputAverage{{{*/ -void TriaP1Input::GetInputAverage(IssmDouble* pvalue){ - *pvalue=1./3.*(values[0]+values[1]+values[2]); -} -/*}}}*/ - -/*Intermediary*/ -/*FUNCTION TriaP1Input::SquareMin{{{*/ -void TriaP1Input::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ - - int i; - const int numnodes=3; - IssmDouble valuescopy[numnodes]; - IssmDouble squaremin; - - /*First, copy values, to process units if requested: */ - for(i=0;ivalues[i]; - - /*Process units if requested: */ - if(process_units)UnitConversion(&valuescopy[0],numnodes,IuToExtEnum,enum_type); - - /*Now, figure out minimum of valuescopy: */ - squaremin=pow(valuescopy[0],2); - for(i=1;inorm) norm=fabs(values[i]); - return norm; -} -/*}}}*/ -/*FUNCTION TriaP1Input::Max{{{*/ -IssmDouble TriaP1Input::Max(void){ - - const int numnodes=3; - IssmDouble max=values[0]; - - for(int i=1;imax) max=values[i]; - } - return max; -} -/*}}}*/ -/*FUNCTION TriaP1Input::MaxAbs{{{*/ -IssmDouble TriaP1Input::MaxAbs(void){ - - const int numnodes=3; - IssmDouble max=fabs(values[0]); - - for(int i=1;imax) max=fabs(values[i]); - } - return max; -} -/*}}}*/ -/*FUNCTION TriaP1Input::Min{{{*/ -IssmDouble TriaP1Input::Min(void){ - - const int numnodes=3; - IssmDouble min=values[0]; - - for(int i=1;iObjectEnum()){ - - case TriaP1InputEnum : - for(i=0;ivalues[i]=this->values[i]+scalar*xtriavertexinput->values[i]; - return; - - default : - _error2_("not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION TriaP1Input::Constrain{{{*/ -void TriaP1Input::Constrain(IssmDouble cm_min, IssmDouble cm_max){ - - int i; - const int numnodes=3; - - if(!xIsNan(cm_min)) for(i=0;ivalues[i]values[i]=cm_min; - if(!xIsNan(cm_max)) for(i=0;ivalues[i]>cm_max)this->values[i]=cm_max; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::GetVectorFromInputs{{{*/ -void TriaP1Input::GetVectorFromInputs(Vector* vector,int* doflist){ - - const int numvertices=3; - vector->SetValues(numvertices,doflist,this->values,INS_VAL); - -} /*}}}*/ -/*FUNCTION TriaP1Input::GetValuesPtr{{{*/ -void TriaP1Input::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ - - *pvalues=this->values; - if(pnum_values)*pnum_values=3; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::PointwiseMin{{{*/ -Input* TriaP1Input::PointwiseMin(Input* inputB){ - - /*Ouput*/ - TriaP1Input* outinput=NULL; - - /*Intermediaries*/ - int i; - TriaP1Input *xinputB = NULL; - int B_numvalues; - const int numnodes = 3; - IssmDouble minvalues[numnodes]; - - /*Check that inputB is of the same type*/ - if (inputB->ObjectEnum()!=TriaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); - xinputB=(TriaP1Input*)inputB; - - /*Create point wise min*/ - for(i=0;ivalues[i] > xinputB->values[i]) minvalues[i]=xinputB->values[i]; - else minvalues[i]=this->values[i]; - } - - /*Create new Tria vertex input (copy of current input)*/ - outinput=new TriaP1Input(this->enum_type,&minvalues[0]); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::PointwiseMax{{{*/ -Input* TriaP1Input::PointwiseMax(Input* inputB){ - - /*Ouput*/ - TriaP1Input* outinput=NULL; - - /*Intermediaries*/ - int i; - TriaP1Input *xinputB = NULL; - int B_numvalues; - const int numnodes = 3; - IssmDouble maxvalues[numnodes]; - - /*Check that inputB is of the same type*/ - if (inputB->ObjectEnum()!=TriaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); - xinputB=(TriaP1Input*)inputB; - - /*Create point wise max*/ - for(i=0;ivalues[i] < xinputB->values[i]) maxvalues[i]=xinputB->values[i]; - else maxvalues[i]=this->values[i]; - } - - /*Create new Tria vertex input (copy of current input)*/ - outinput=new TriaP1Input(this->enum_type,&maxvalues[0]); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION TriaP1Input::Configure{{{*/ -void TriaP1Input::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TriaP1Input.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TriaP1Input.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TriaP1Input.h (revision 12822) @@ -1,86 +0,0 @@ -/*! \file TriaP1Input.h - * \brief: header file for TriaP1Input object - */ - - -#ifndef _TRIAP1INPUT_H_ -#define _TRIAP1INPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -#include "../Elements/TriaRef.h" -class GaussTria; -/*}}}*/ - -class TriaP1Input: public Input,public TriaRef{ - - public: - /*just hold 3 values for 3 vertices: */ - int enum_type; - IssmDouble values[3]; - - /*TriaP1Input constructors, destructors: {{{*/ - TriaP1Input(); - TriaP1Input(int enum_type,IssmDouble* values); - ~TriaP1Input(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*TriaP1Input management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* inputB){_error2_("not implemented yet");}; - Input* PointwiseMin(Input* inputB); - Input* PointwiseMax(Input* inputB); - ElementResult* SpawnResult(int step, IssmDouble time); - void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; - void Configure(Parameters* parameters); - /*}}}*/ - /*numerics: {{{*/ - void GetInputValue(bool* pvalue){_error2_("not implemented yet");} - void GetInputValue(int* pvalue){_error2_("not implemented yet");} - void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");} - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetInputAverage(IssmDouble* pvalue); - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss); - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss); - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void ChangeEnum(int newenumtype); - - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); - void ConstrainMin(IssmDouble minimum); - void Scale(IssmDouble scale_factor); - void ArtificialNoise(IssmDouble min,IssmDouble max); - void AXPY(Input* xinput,IssmDouble scalar); - void Constrain(IssmDouble cm_min, IssmDouble cm_max); - IssmDouble InfinityNorm(void); - IssmDouble Max(void); - IssmDouble MaxAbs(void); - IssmDouble Min(void); - IssmDouble MinAbs(void); - void Extrude(void){_error2_("not supported yet");}; - void VerticallyIntegrate(Input* thickness_input){_error2_("not supported yet");}; - void GetVectorFromInputs(Vector* vector,int* doflist); - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); - /*}}}*/ - -}; -#endif /* _TRIAP1INPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TransientInput.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TransientInput.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TransientInput.cpp (revision 12822) @@ -1,486 +0,0 @@ -/*!\file TransientInput.c - * \brief: implementation of the TransientInput 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" -/*}}}*/ - -/*TransientInput constructors and destructor*/ -/*FUNCTION TransientInput::TransientInput(){{{*/ -TransientInput::TransientInput(){ - - enum_type=UNDEF; - inputs=NULL; - this->numtimesteps=0; - this->parameters=NULL; - this->timesteps=NULL; - -} -/*}}}*/ -/*FUNCTION TransientInput::TransientInput(int in_enum_type){{{*/ -TransientInput::TransientInput(int in_enum_type) -{ - /*Set Enum*/ - enum_type=in_enum_type; - - /*Allocate values and timesteps, and copy: */ - this->numtimesteps=0; - this->timesteps=NULL; - inputs = new Inputs(); - this->parameters=NULL; - -} -/*}}}*/ -/*FUNCTION TransientInput::~TransientInput{{{*/ -TransientInput::~TransientInput(){ - xDelete(this->timesteps); - this->timesteps=NULL; - this->numtimesteps=0; - parameters=NULL; - delete this->inputs; - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION TransientInput::Echo {{{*/ -void TransientInput::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION TransientInput::DeepEcho{{{*/ -void TransientInput::DeepEcho(void){ - - int i; - - _printLine_("TransientInput:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" numtimesteps: " << this->numtimesteps); - _printLine_("---inputs: "); - for(i=0;inumtimesteps;i++){ - _printLine_(" time: " << this->timesteps[i] << " "); - ((Input*)this->inputs->GetObjectByOffset(i))->Echo(); - } -} -/*}}}*/ -/*FUNCTION TransientInput::Id{{{*/ -int TransientInput::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION TransientInput::MyRank{{{*/ -int TransientInput::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION TransientInput::ObjectEnum{{{*/ -int TransientInput::ObjectEnum(void){ - - return TransientInputEnum; - -} -/*}}}*/ -/*FUNCTION TransientInput::copy{{{*/ -Object* TransientInput::copy() { - - TransientInput* output=NULL; - - output = new TransientInput(); - output->enum_type=this->enum_type; - output->numtimesteps=this->numtimesteps; - output->timesteps=xNew(this->numtimesteps); - memcpy(output->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmDouble)); - output->inputs=(Inputs*)this->inputs->Copy(); - output->parameters=this->parameters; - - return output; - -} -/*}}}*/ - -/*TransientInput management*/ -/*FUNCTION TransientInput::InstanceEnum{{{*/ -int TransientInput::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ -/*FUNCTION TransientInput::SpawnTriaInput{{{*/ -Input* TransientInput::SpawnTriaInput(int* indices){ - - /*output*/ - TransientInput* outinput=NULL; - - /*Create new Transientinput (copy of current input)*/ - outinput=new TransientInput(); - outinput->enum_type=this->enum_type; - outinput->numtimesteps=this->numtimesteps; - outinput->timesteps=xNew(this->numtimesteps); - memcpy(outinput->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmDouble)); - outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices); - outinput->parameters=this->parameters; - - /*Assign output*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION TransientInput::SpawnResult{{{*/ -ElementResult* TransientInput::SpawnResult(int step, IssmDouble time){ - - ElementResult* elementresult=NULL; - - /*Ok, we want to spawn an ElementResult. We have the time, just get - *the correct values: */ - Input* input=GetTimeInput(time); - - elementresult=input->SpawnResult(step,time); - - delete input; - - return elementresult; -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ -void TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){ - IssmDouble time; - - /*First, recover current time from parameters: */ - this->parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetInputValue(pvalue,gauss); - - delete input; -} -/*}}}*/ -/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ -void TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){ - IssmDouble time; - - /*First, recover current time from parameters: */ - this->parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetInputValue(pvalue,gauss); - - delete input; -} -/*}}}*/ -/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){{{*/ -void TransientInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){ - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetInputValue(pvalue,gauss); - - delete input; -} -/*}}}*/ -/*FUNCTION TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){{{*/ -void TransientInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){ - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetInputValue(pvalue,gauss); - - delete input; -} -/*}}}*/ -/*FUNCTION TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void TransientInput::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussTria* gauss){ - - IssmDouble time; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetInputDerivativeValue(p,xyz_list,gauss); - - delete input; - -} -/*}}}*/ -/*FUNCTION TransientInput::ChangeEnum{{{*/ -void TransientInput::ChangeEnum(int newenumtype){ - this->enum_type=newenumtype; -} -/*}}}*/ -/*FUNCTION TransientInput::GetInputAverage{{{*/ -void TransientInput::GetInputAverage(IssmDouble* pvalue){ - - IssmDouble time; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetInputAverage(pvalue); - - delete input; - -} -/*}}}*/ - -/*Intermediary*/ -/*FUNCTION TransientInput::AddTimeInput{{{*/ -void TransientInput::AddTimeInput(Input* input,IssmDouble time){ - - /*insert values at time step: */ - if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _assert_("timestep values must increase sequentially"); - - //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input); - IssmDouble* old_timesteps=NULL; - - if (this->numtimesteps > 0){ - old_timesteps=xNew(this->numtimesteps); - memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(IssmDouble)); - xDelete(this->timesteps); - } - - this->numtimesteps=this->numtimesteps+1; - this->timesteps=xNew(this->numtimesteps); - - if (this->numtimesteps > 1){ - memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(IssmDouble)); - xDelete(old_timesteps); - } - - /*go ahead and plug: */ - this->timesteps[this->numtimesteps-1]=time; - inputs->AddObject(input); - -} -/*}}}*/ -/*FUNCTION TransientInput::SquareMin{{{*/ -void TransientInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ - - IssmDouble time; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->SquareMin(psquaremin,process_units,parameters); - - delete input; - -} -/*}}}*/ -/*FUNCTION TransientInput::InfinityNorm{{{*/ -IssmDouble TransientInput::InfinityNorm(void){ - - IssmDouble time; - IssmDouble infnorm; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - infnorm=input->InfinityNorm(); - - /*Clean-up and return*/ - delete input; - return infnorm; -} -/*}}}*/ -/*FUNCTION TransientInput::Max{{{*/ -IssmDouble TransientInput::Max(void){ - - IssmDouble time; - IssmDouble max; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - max=input->Max(); - - delete input; - - return max; -} -/*}}}*/ -/*FUNCTION TransientInput::MaxAbs{{{*/ -IssmDouble TransientInput::MaxAbs(void){ - - IssmDouble time; - IssmDouble maxabs; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - maxabs=input->MaxAbs(); - - /*Clean-up and return*/ - delete input; - return maxabs; - -} -/*}}}*/ -/*FUNCTION TransientInput::Min{{{*/ -IssmDouble TransientInput::Min(void){ - - IssmDouble time; - IssmDouble min; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - min=input->Min(); - - /*Clean-up and return*/ - delete input; - return min; - -} -/*}}}*/ -/*FUNCTION TransientInput::MinAbs{{{*/ -IssmDouble TransientInput::MinAbs(void){ - - IssmDouble time; - IssmDouble minabs; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - minabs=input->MinAbs(); - - /*Clean-up and return*/ - delete input; - return minabs; -} -/*}}}*/ -/*FUNCTION TransientInput::GetVectorFromInputs{{{*/ -void TransientInput::GetVectorFromInputs(Vector* vector,int* doflist){ - - IssmDouble time; - - /*First, recover current time from parameters: */ - parameters->FindParam(&time,TimeEnum); - - /*Retrieve interpolated values for this time step: */ - Input* input=GetTimeInput(time); - - /*Call input function*/ - input->GetVectorFromInputs(vector,doflist); - - delete input; - -} /*}}}*/ -/*FUNCTION TransientInput::GetTimeInput{{{*/ -Input* TransientInput::GetTimeInput(IssmDouble intime){ - - int i,j; - IssmDouble deltat; - IssmDouble alpha1,alpha2; - bool found=false; - Input* input=NULL; - Input* input1=NULL; - Input* input2=NULL; - - /*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(intimetimesteps[0]){ - /*get values for the first time: */ - input=(Input*)((Input*)this->inputs->GetObjectByOffset(0))->copy(); - found=true; - } - else if(intime>this->timesteps[this->numtimesteps-1]){ - /*get values for the last time: */ - input=(Input*)((Input*)this->inputs->GetObjectByOffset(numtimesteps-1))->copy(); - found=true; - } - else{ - /*Find which interval we fall within: */ - for(i=0;inumtimesteps;i++){ - if(intime==this->timesteps[i]){ - /*We are right on one step time: */ - input=(Input*)((Input*)this->inputs->GetObjectByOffset(i))->copy(); - found=true; - break; //we are done with the time interpolation. - } - else{ - if(this->timesteps[i]timesteps[i+1]){ - /*ok, we have the interval ]i:i+1[. Interpolate linearly for now: */ - deltat=this->timesteps[i+1]-this->timesteps[i]; - alpha2=(intime-this->timesteps[i])/deltat; - alpha1=(1.0-alpha2); - - input1=(Input*)this->inputs->GetObjectByOffset(i); - input2=(Input*)this->inputs->GetObjectByOffset(i+1); - - input=(Input*)input1->copy(); - input->Scale(alpha1); - input->AXPY(input2,alpha2); - - found=true; - break; - } - else continue; //keep looking on the next interval - } - } - } - if(!found)_error2_("did not find time interval on which to interpolate forcing values!"); - - /*Assign output pointer*/ - return input; -} -/*}}}*/ -/*FUNCTION TransientInput::Configure{{{*/ -void TransientInput::Configure(Parameters* parameters){ - this->parameters=parameters; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/PentaP1Input.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/PentaP1Input.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/PentaP1Input.cpp (revision 12822) @@ -1,629 +0,0 @@ -/*!\file PentaP1Input.c - * \brief: implementation of the PentaP1Input 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" - -/*PentaP1Input constructors and destructor*/ -/*FUNCTION PentaP1Input::PentaP1Input(){{{*/ -PentaP1Input::PentaP1Input(){ - return; -} -/*}}}*/ -/*FUNCTION PentaP1Input::PentaP1Input(int in_enum_type,IssmDouble* values){{{*/ -PentaP1Input::PentaP1Input(int in_enum_type,IssmDouble* in_values) - :PentaRef(1) -{ - - /*Set PentaRef*/ - this->SetElementType(P1Enum,0); - this->element_type=P1Enum; - - enum_type=in_enum_type; - values[0]=in_values[0]; - values[1]=in_values[1]; - values[2]=in_values[2]; - values[3]=in_values[3]; - values[4]=in_values[4]; - values[5]=in_values[5]; -} -/*}}}*/ -/*FUNCTION PentaP1Input::~PentaP1Input(){{{*/ -PentaP1Input::~PentaP1Input(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ -/*FUNCTION PentaP1Input::Echo {{{*/ -void PentaP1Input::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION PentaP1Input::DeepEcho{{{*/ -void PentaP1Input::DeepEcho(void){ - - _printLine_("PentaP1Input:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" values: [" << this->values[0] << " " << this->values[1] << " " << this->values[2] << " " << this->values[3] << " " << this->values[4] << " " << this->values[5] << "]"); -} -/*}}}*/ -/*FUNCTION PentaP1Input::Id{{{*/ -int PentaP1Input::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION PentaP1Input::MyRank{{{*/ -int PentaP1Input::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION PentaP1Input::ObjectEnum{{{*/ -int PentaP1Input::ObjectEnum(void){ - - return PentaP1InputEnum; - -} -/*}}}*/ - -/*PentaP1Input management*/ -/*FUNCTION PentaP1Input::copy{{{*/ -Object* PentaP1Input::copy() { - - return new PentaP1Input(this->enum_type,this->values); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::InstanceEnum{{{*/ -int PentaP1Input::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::SpawnTriaInput{{{*/ -Input* PentaP1Input::SpawnTriaInput(int* indices){ - - /*output*/ - TriaP1Input* outinput=NULL; - IssmDouble newvalues[3]; - - /*Loop over the new indices*/ - for(int i=0;i<3;i++){ - - /*Check index value*/ - _assert_(indices[i]>=0 && indices[i]<6); - - /*Assign value to new input*/ - newvalues[i]=this->values[indices[i]]; - } - - /*Create new Tria input*/ - outinput=new TriaP1Input(this->enum_type,&newvalues[0]); - - /*Assign output*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::SpawnResult{{{*/ -ElementResult* PentaP1Input::SpawnResult(int step, IssmDouble time){ - - return new PentaP1ElementResult(this->enum_type,this->values,step,time); - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION PentaP1Input::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ -void PentaP1Input::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){ - - /*Call PentaRef function*/ - PentaRef::GetInputValue(pvalue,&values[0],gauss); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void PentaP1Input::GetInputDerivativeValue(IssmDouble* p, IssmDouble* xyz_list, GaussPenta* gauss){ - - /*Call PentaRef function*/ - PentaRef::GetInputDerivativeValue(p,&values[0],xyz_list,gauss); -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetVxStrainRate3d{{{*/ -void PentaP1Input::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ - int i,j; - - const int numnodes=6; - const int DOFVELOCITY=3; - IssmDouble B[8][27]; - IssmDouble B_reduced[6][DOFVELOCITY*numnodes]; - IssmDouble velocity[numnodes][DOFVELOCITY]; - - /*Get B matrix: */ - GetBStokes(&B[0][0], xyz_list, gauss); - /*Create a reduced matrix of B to get rid of pressure */ - for (i=0;i<6;i++){ - for (j=0;j<3;j++){ - B_reduced[i][j]=B[i][j]; - } - for (j=4;j<7;j++){ - B_reduced[i][j-1]=B[i][j]; - } - for (j=8;j<11;j++){ - B_reduced[i][j-2]=B[i][j]; - } - for (j=12;j<15;j++){ - B_reduced[i][j-3]=B[i][j]; - } - for (j=16;j<19;j++){ - B_reduced[i][j-4]=B[i][j]; - } - for (j=20;j<23;j++){ - B_reduced[i][j-5]=B[i][j]; - } - } - - /*Here, we are computing the strain rate of (vx,0,0)*/ - for(i=0;ivalues[i]; - velocity[i][1]=0.0; - velocity[i][2]=0.0; - } - /*Multiply B by velocity, to get strain rate: */ - MatrixMultiply(&B_reduced[0][0],6,DOFVELOCITY*numnodes,0,&velocity[0][0],DOFVELOCITY*numnodes,1,0,epsilonvx,0); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetVyStrainRate3d{{{*/ -void PentaP1Input::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ - int i,j; - - const int numnodes=6; - const int DOFVELOCITY=3; - IssmDouble B[8][27]; - IssmDouble B_reduced[6][DOFVELOCITY*numnodes]; - IssmDouble velocity[numnodes][DOFVELOCITY]; - - /*Get B matrix: */ - GetBStokes(&B[0][0], xyz_list, gauss); - /*Create a reduced matrix of B to get rid of pressure */ - for (i=0;i<6;i++){ - for (j=0;j<3;j++){ - B_reduced[i][j]=B[i][j]; - } - for (j=4;j<7;j++){ - B_reduced[i][j-1]=B[i][j]; - } - for (j=8;j<11;j++){ - B_reduced[i][j-2]=B[i][j]; - } - for (j=12;j<15;j++){ - B_reduced[i][j-3]=B[i][j]; - } - for (j=16;j<19;j++){ - B_reduced[i][j-4]=B[i][j]; - } - for (j=20;j<23;j++){ - B_reduced[i][j-5]=B[i][j]; - } - } - - /*Here, we are computing the strain rate of (0,vy,0)*/ - for(i=0;ivalues[i]; - velocity[i][2]=0.0; - } - /*Multiply B by velocity, to get strain rate: */ - MatrixMultiply(&B_reduced[0][0],6,DOFVELOCITY*numnodes,0,&velocity[0][0],DOFVELOCITY*numnodes,1,0,epsilonvy,0); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetVzStrainRate3d{{{*/ -void PentaP1Input::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){ - int i,j; - - const int numnodes=6; - const int DOFVELOCITY=3; - IssmDouble B[8][27]; - IssmDouble B_reduced[6][DOFVELOCITY*numnodes]; - IssmDouble velocity[numnodes][DOFVELOCITY]; - - /*Get B matrix: */ - GetBStokes(&B[0][0], xyz_list, gauss); - /*Create a reduced matrix of B to get rid of pressure */ - for (i=0;i<6;i++){ - for (j=0;j<3;j++){ - B_reduced[i][j]=B[i][j]; - } - for (j=4;j<7;j++){ - B_reduced[i][j-1]=B[i][j]; - } - for (j=8;j<11;j++){ - B_reduced[i][j-2]=B[i][j]; - } - for (j=12;j<15;j++){ - B_reduced[i][j-3]=B[i][j]; - } - for (j=16;j<19;j++){ - B_reduced[i][j-4]=B[i][j]; - } - for (j=20;j<23;j++){ - B_reduced[i][j-5]=B[i][j]; - } - } - - /*Here, we are computing the strain rate of (0,0,vz)*/ - for(i=0;ivalues[i]; - } - - /*Multiply B by velocity, to get strain rate: */ - MatrixMultiply(&B_reduced[0][0],6,DOFVELOCITY*numnodes,0,&velocity[0][0],DOFVELOCITY*numnodes,1,0,epsilonvz,0); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetVxStrainRate3dPattyn{{{*/ -void PentaP1Input::GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ - - int i; - const int numnodes=6; - IssmDouble B[5][NDOF2*numnodes]; - IssmDouble velocity[numnodes][NDOF2]; - - /*Get B matrix: */ - GetBPattyn(&B[0][0], xyz_list, gauss); - - /*Here, we are computing the strain rate of (vx,0)*/ - for(i=0;ivalues[i]; - velocity[i][1]=0.0; - } - - /*Multiply B by velocity, to get strain rate: */ - MatrixMultiply( &B[0][0],5,NDOF2*numnodes,0, - &velocity[0][0],NDOF2*numnodes,1,0, - epsilonvx,0); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetVyStrainRate3dPattyn{{{*/ -void PentaP1Input::GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ - - int i; - const int numnodes=6; - IssmDouble B[5][NDOF2*numnodes]; - IssmDouble velocity[numnodes][NDOF2]; - - /*Get B matrix: */ - GetBPattyn(&B[0][0], xyz_list, gauss); - - /*Here, we are computing the strain rate of (0,vy)*/ - for(i=0;ivalues[i]; - } - - /*Multiply B by velocity, to get strain rate: */ - MatrixMultiply( &B[0][0],5,NDOF2*numnodes,0, - &velocity[0][0],NDOF2*numnodes,1,0, - epsilonvy,0); - -} -/*}}}*/ -/*FUNCTION PentaP1Input::ChangeEnum{{{*/ -void PentaP1Input::ChangeEnum(int newenumtype){ - this->enum_type=newenumtype; -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetInputAverage{{{*/ -void PentaP1Input::GetInputAverage(IssmDouble* pvalue){ - *pvalue=1./6.*(values[0]+values[1]+values[2]+values[3]+values[4]+values[5]); -} -/*}}}*/ - -/*Intermediary*/ -/*FUNCTION PentaP1Input::SquareMin{{{*/ -void PentaP1Input::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ - - int i; - const int numnodes=6; - IssmDouble valuescopy[numnodes]; - IssmDouble squaremin; - - /*First, copy values, to process units if requested: */ - for(i=0;ivalues[i]; - - /*Process units if requested: */ - if(process_units)UnitConversion(&valuescopy[0],numnodes,IuToExtEnum,enum_type); - - /*Now, figure out minimum of valuescopy: */ - squaremin=pow(valuescopy[0],2); - for(i=1;inorm) norm=fabs(values[i]); - return norm; -} -/*}}}*/ -/*FUNCTION PentaP1Input::Max{{{*/ -IssmDouble PentaP1Input::Max(void){ - - const int numnodes=6; - IssmDouble max=values[0]; - - for(int i=1;imax) max=values[i]; - } - return max; -} -/*}}}*/ -/*FUNCTION PentaP1Input::MaxAbs{{{*/ -IssmDouble PentaP1Input::MaxAbs(void){ - - const int numnodes=6; - IssmDouble max=fabs(values[0]); - - for(int i=1;imax) max=fabs(values[i]); - } - return max; -} -/*}}}*/ -/*FUNCTION PentaP1Input::Min{{{*/ -IssmDouble PentaP1Input::Min(void){ - - const int numnodes=6; - IssmDouble min=values[0]; - - for(int i=1;iObjectEnum()){ - - case PentaP1InputEnum:{ - PentaP1Input* cast_input=(PentaP1Input*)xinput; - for(i=0;ivalues[i]=this->values[i]+scalar*(cast_input->values[i]);} - return; - case ControlInputEnum:{ - ControlInput* cont_input=(ControlInput*)xinput; - if(cont_input->values->ObjectEnum()!=PentaP1InputEnum) _error2_("not supported yet"); - PentaP1Input* cast_input=(PentaP1Input*)cont_input->values; - for(i=0;ivalues[i]=this->values[i]+scalar*(cast_input->values[i]);} - return; - default: - _error2_("not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION PentaP1Input::Constrain{{{*/ -void PentaP1Input::Constrain(IssmDouble cm_min, IssmDouble cm_max){ - - int i; - const int numnodes=6; - - if(!xIsNan(cm_min)) for(i=0;ivalues[i]values[i]=cm_min; - if(!xIsNan(cm_max)) for(i=0;ivalues[i]>cm_max)this->values[i]=cm_max; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::Extrude{{{*/ -void PentaP1Input::Extrude(void){ - - int i; - - /*First 3 values copied on 3 last values*/ - for(i=0;i<3;i++) this->values[3+i]=this->values[i]; -} -/*}}}*/ -/*FUNCTION PentaP1Input::VerticallyIntegrate{{{*/ -void PentaP1Input::VerticallyIntegrate(Input* thickness_input){ - - /*Intermediaries*/ - int i; - const int numnodes = 6; - int num_thickness_values; - IssmDouble *thickness_values = NULL; - - /*Check that input provided is a thickness*/ - if (thickness_input->InstanceEnum()!=ThicknessEnum) _error2_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")"); - - /*Get Thickness value pointer*/ - thickness_input->GetValuesPtr(&thickness_values,&num_thickness_values); - - /*vertically integrate depending on type:*/ - switch(thickness_input->ObjectEnum()){ - - case PentaP1InputEnum: - for(i=0;i<3;i++){ - this->values[i]=0.5*(this->values[i]+this->values[i+3]) * thickness_values[i]; - this->values[i+3]=this->values[i]; - } - return; - - default: - _error2_("not implemented yet"); - } -} -/*}}}*/ -/*FUNCTION PentaP1Input::PointwiseDivide{{{*/ -Input* PentaP1Input::PointwiseDivide(Input* inputB){ - - /*Ouput*/ - PentaP1Input* outinput=NULL; - - /*Intermediaries*/ - int i; - PentaP1Input *xinputB = NULL; - int B_numvalues; - const int numnodes = 6; - IssmDouble AdotBvalues[numnodes]; - - /*Check that inputB is of the same type*/ - if (inputB->ObjectEnum()!=PentaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); - xinputB=(PentaP1Input*)inputB; - - /*Create point wise sum*/ - for(i=0;ivalues[i]!=0); - AdotBvalues[i]=this->values[i]/xinputB->values[i]; - } - - /*Create new Penta vertex input (copy of current input)*/ - outinput=new PentaP1Input(this->enum_type,&AdotBvalues[0]); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::PointwiseMin{{{*/ -Input* PentaP1Input::PointwiseMin(Input* inputB){ - - /*Ouput*/ - PentaP1Input* outinput=NULL; - - /*Intermediaries*/ - int i; - PentaP1Input *xinputB = NULL; - int B_numvalues; - const int numnodes = 6; - IssmDouble minvalues[numnodes]; - - /*Check that inputB is of the same type*/ - if (inputB->ObjectEnum()!=PentaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); - xinputB=(PentaP1Input*)inputB; - - /*Create point wise min*/ - for(i=0;ivalues[i] > xinputB->values[i]) minvalues[i]=xinputB->values[i]; - else minvalues[i]=this->values[i]; - } - - /*Create new Penta vertex input (copy of current input)*/ - outinput=new PentaP1Input(this->enum_type,&minvalues[0]); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::PointwiseMax{{{*/ -Input* PentaP1Input::PointwiseMax(Input* inputB){ - - /*Ouput*/ - PentaP1Input* outinput=NULL; - - /*Intermediaries*/ - int i; - PentaP1Input *xinputB = NULL; - int B_numvalues; - const int numnodes = 6; - IssmDouble maxvalues[numnodes]; - - /*Check that inputB is of the same type*/ - if (inputB->ObjectEnum()!=PentaP1InputEnum) _error2_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum())); - xinputB=(PentaP1Input*)inputB; - - /*Create point wise max*/ - for(i=0;ivalues[i] < xinputB->values[i]) maxvalues[i]=xinputB->values[i]; - else maxvalues[i]=this->values[i]; - } - - /*Create new Penta vertex input (copy of current input)*/ - outinput=new PentaP1Input(this->enum_type,&maxvalues[0]); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::GetVectorFromInputs{{{*/ -void PentaP1Input::GetVectorFromInputs(Vector* vector,int* doflist){ - - const int numvertices=6; - vector->SetValues(numvertices,doflist,this->values,INS_VAL); - -} /*}}}*/ -/*FUNCTION PentaP1Input::GetValuesPtr{{{*/ -void PentaP1Input::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ - - *pvalues=this->values; - *pnum_values=6; - -} -/*}}}*/ -/*FUNCTION PentaP1Input::Configure{{{*/ -void PentaP1Input::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DoubleInput.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DoubleInput.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/DoubleInput.cpp (revision 12822) @@ -1,359 +0,0 @@ -/*!\file DoubleInput.c - * \brief: implementation of the DoubleInput 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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" - -/*DoubleInput constructors and destructor*/ -/*FUNCTION DoubleInput::DoubleInput(){{{*/ -DoubleInput::DoubleInput(){ - return; -} -/*}}}*/ -/*FUNCTION DoubleInput::DoubleInput(IssmDouble value){{{*/ -DoubleInput::DoubleInput(int in_enum_type,IssmDouble in_value){ - - enum_type=in_enum_type; - value=in_value; -} -/*}}}*/ -/*FUNCTION DoubleInput::~DoubleInput(){{{*/ -DoubleInput::~DoubleInput(){ - return; -} -/*}}}*/ - -/*Object virtual functions definitions:*/ - /*FUNCTION DoubleInput::Echo {{{*/ -void DoubleInput::Echo(void){ - this->DeepEcho(); -} -/*}}}*/ -/*FUNCTION DoubleInput::DeepEcho{{{*/ -void DoubleInput::DeepEcho(void){ - - _printLine_("DoubleInput:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" value: " << this->value); -} -/*}}}*/ -/*FUNCTION DoubleInput::Id{{{*/ -int DoubleInput::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION DoubleInput::MyRank{{{*/ -int DoubleInput::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*FUNCTION DoubleInput::ObjectEnum{{{*/ -int DoubleInput::ObjectEnum(void){ - - return DoubleInputEnum; - -} -/*}}}*/ -/*FUNCTION DoubleInput::copy{{{*/ -Object* DoubleInput::copy() { - - return new DoubleInput(this->enum_type,this->value); - -} -/*}}}*/ - -/*DoubleInput management*/ -/*FUNCTION DoubleInput::InstanceEnum{{{*/ -int DoubleInput::InstanceEnum(void){ - - return this->enum_type; - -} -/*}}}*/ -/*FUNCTION DoubleInput::SpawnTriaInput{{{*/ -Input* DoubleInput::SpawnTriaInput(int* indices){ - - /*output*/ - DoubleInput* outinput=new DoubleInput(); - - /*only copy current value*/ - outinput->enum_type=this->enum_type; - outinput->value=this->value; - - /*Assign output*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION DoubleInput::SpawnResult{{{*/ -ElementResult* DoubleInput::SpawnResult(int step, IssmDouble time){ - - return new DoubleElementResult(this->enum_type,this->value,step,time); - -} -/*}}}*/ - -/*Object functions*/ -/*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{*/ -void DoubleInput::GetInputValue(bool* pvalue){ - _error2_("Double input of enum " << EnumToStringx(enum_type) << " cannot return a boolean"); - -} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{*/ -void DoubleInput::GetInputValue(int* pvalue){ - _error2_("Double input of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer"); - -} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue){{{*/ -void DoubleInput::GetInputValue(IssmDouble* pvalue){ - - /*return value*/ - *pvalue=value; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/ -void DoubleInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){*pvalue=this->value;} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/ -void DoubleInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){*pvalue=this->value;} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void DoubleInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");} -/*}}}*/ -/*FUNCTION DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void DoubleInput::GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){ - /*Epsilon is zero as vx is constant over the element*/ - for(int i=0;i<3;i++) epsilonvx[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){{{*/ -void DoubleInput::GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){ - /*Epsilon is zero as vy is constant over the element*/ - for(int i=0;i<3;i++) epsilonvy[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void DoubleInput::GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ - /*Epsilon is zero as vx is constant over the element*/ - for(int i=0;i<6;i++) epsilonvx[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void DoubleInput::GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ - /*Epsilon is zero as vy is constant over the element*/ - for(int i=0;i<6;i++) epsilonvy[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void DoubleInput::GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){ - /*Epsilon is zero as vz is constant over the element*/ - for(int i=0;i<6;i++) epsilonvz[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void DoubleInput::GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){ - /*Epsilon is zero as vx is constant over the element*/ - for(int i=0;i<5;i++) epsilonvx[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){{{*/ -void DoubleInput::GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){ - /*Epsilon is zero as vy is constant over the element*/ - for(int i=0;i<5;i++) epsilonvy[i]=0; -} -/*}}}*/ -/*FUNCTION DoubleInput::ChangeEnum{{{*/ -void DoubleInput::ChangeEnum(int newenumtype){ - this->enum_type=newenumtype; -} -/*}}}*/ -/*FUNCTION DoubleInput::SquareMin{{{*/ -void DoubleInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){ - - /*square min of a IssmDouble is the square of the IssmDouble itself: */ - *psquaremin=pow(value,2); -} -/*}}}*/ -/*FUNCTION DoubleInput::Scale{{{*/ -void DoubleInput::Scale(IssmDouble scale_factor){ - value=value*scale_factor; -} -/*}}}*/ -/*FUNCTION DoubleInput::ConstrainMin{{{*/ -void DoubleInput::ConstrainMin(IssmDouble minimum){ - if (valueObjectEnum()){ - - case DoubleInputEnum: - this->value=this->value+scalar*xIssmDoubleinput->value; - return; - - default: - _error2_("not implemented yet"); - } - -} -/*}}}*/ -/*FUNCTION DoubleInput::Constrain{{{*/ -void DoubleInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){ - - if(!xIsNan(cm_min)) if (this->valuevalue=cm_min; - if(!xIsNan(cm_max)) if (this->value>cm_max)this->value=cm_max; - -} -/*}}}*/ -/*FUNCTION DoubleInput::Max{{{*/ -IssmDouble DoubleInput::Max(void){ - return this->value; -} -/*}}}*/ -/*FUNCTION DoubleInput::MaxAbs{{{*/ -IssmDouble DoubleInput::MaxAbs(void){ - return fabs(this->value); -} -/*}}}*/ -/*FUNCTION DoubleInput::Min{{{*/ -IssmDouble DoubleInput::Min(void){ - return this->value; -} -/*}}}*/ -/*FUNCTION DoubleInput::MinAbs{{{*/ -IssmDouble DoubleInput::MinAbs(void){ - return fabs(this->value); -} -/*}}}*/ -/*FUNCTION DoubleInput::GetVectorFromInputs{{{*/ -void DoubleInput::GetVectorFromInputs(Vector* vector,int* doflist){ - - _error2_("not supporte yet!"); - -} -/*}}}*/ -/*FUNCTION DoubleInput::GetValuesPtr{{{*/ -void DoubleInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){ - - _error2_("not supported yet!"); - -} -/*}}}*/ -/*FUNCTION DoubleInput::GetInputAverage{{{*/ -void DoubleInput::GetInputAverage(IssmDouble* pvalue){ - *pvalue=value; -} -/*}}}*/ -/*FUNCTION DoubleInput::VerticallyIntegrate{{{*/ -void DoubleInput::VerticallyIntegrate(Input* thickness_input){ - - /*Intermediaries*/ - IssmDouble thickness_value; - - /*Check that input provided is a thickness*/ - if (thickness_input->InstanceEnum()!=ThicknessEnum) _error2_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")"); - - /*vertically integrate depending on type:*/ - switch(thickness_input->ObjectEnum()){ - - case PentaP1InputEnum: - thickness_input->GetInputAverage(&thickness_value); - this->value=this->value*thickness_value; - return; - - default: - _error2_("not implemented yet"); - } -} -/*}}}*/ -/*FUNCTION DoubleInput::PointwiseDivide{{{*/ -Input* DoubleInput::PointwiseDivide(Input* inputB){ - - /*Ouput*/ - DoubleInput* outinput=NULL; - - /*Intermediaries*/ - IssmDouble Bvalue; - - /*Check that inputB is of the same type*/ - inputB->GetInputAverage(&Bvalue); - - /*Create new DoubleInput*/ - outinput=new DoubleInput(this->enum_type,this->value/Bvalue); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION DoubleInput::PointwiseMin{{{*/ -Input* DoubleInput::PointwiseMin(Input* input){ - - /*Ouput*/ - DoubleInput* outinput=NULL; - - /*Intermediaries*/ - IssmDouble min; - - /*Check that inputB is of the same type*/ - if (input->Min() < this->Min()) min=input->Min(); - else min=this->Min(); - - /*Create new DoubleInput*/ - outinput=new DoubleInput(this->enum_type,min); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION DoubleInput::PointwiseMax{{{*/ -Input* DoubleInput::PointwiseMax(Input* input){ - - /*Ouput*/ - DoubleInput* outinput=NULL; - - /*Intermediaries*/ - IssmDouble max; - - /*Check that inputB is of the same type*/ - if (input->Max() > this->Max()) max=input->Max(); - else max=this->Max(); - - /*Create new DoubleInput*/ - outinput=new DoubleInput(this->enum_type,max); - - /*Return output pointer*/ - return outinput; - -} -/*}}}*/ -/*FUNCTION DoubleInput::Configure{{{*/ -void DoubleInput::Configure(Parameters* parameters){ - /*do nothing: */ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TransientInput.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TransientInput.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/TransientInput.h (revision 12822) @@ -1,90 +0,0 @@ -/*! \file TransientInput.h - * \brief: header file for transientinput object - */ - - -#ifndef _TRANSIENTINPUT_H_ -#define _TRANSIENTINPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -class GaussTria; -class Parameters; -/*}}}*/ - -class TransientInput: public Input{ - - public: - int enum_type; - int numtimesteps; - Inputs* inputs; - IssmDouble* timesteps; - Parameters* parameters; //to find current time. - - /*TransientInput constructors, destructors: {{{*/ - TransientInput(); - TransientInput(int enum_type); - ~TransientInput(); - void AddTimeInput(Input* input,IssmDouble time); - /*}}}*/ - /*Object virtual functions definitions:{{{*/ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*TransientInput management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* forcingB){_error2_("not implemented yet");}; - Input* PointwiseMin(Input* forcingB){_error2_("not implemented yet");}; - Input* PointwiseMax(Input* forcingB){_error2_("not implemented yet");}; - ElementResult* SpawnResult(int step, IssmDouble time); - void Configure(Parameters* parameters); - /*}}}*/ - /*numerics: {{{*/ - void GetInputValue(bool* pvalue){_error2_("not implemented yet");}; - void GetInputValue(int* pvalue){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time); - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss); - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetInputAverage(IssmDouble* pvalue); - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not implemented yet");}; - void ChangeEnum(int newenumtype); - - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); - void ConstrainMin(IssmDouble minimum){_error2_("not implemented yet");}; - void Scale(IssmDouble scale_factor){_error2_("not implemented yet");}; - void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - void AXPY(Input* xforcing,IssmDouble scalar){_error2_("not implemented yet");}; - void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error2_("not implemented yet");}; - IssmDouble InfinityNorm(void); - IssmDouble Max(void); - IssmDouble MaxAbs(void); - IssmDouble Min(void); - IssmDouble MinAbs(void); - void Extrude(void){_error2_("not supported yet");} - void VerticallyIntegrate(Input* thickness_forcing){_error2_("not supported yet");}; - void GetVectorFromInputs(Vector* vector,int* doflist); - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error2_("not supported yet");}; - void GetTimeValues(IssmDouble* values,IssmDouble time){_error2_("not implemented yet");}; - Input* GetTimeInput(IssmDouble time); - /*}}}*/ - -}; -#endif /* _TRANSIENTINPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/PentaP1Input.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/PentaP1Input.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Inputs/PentaP1Input.h (revision 12822) @@ -1,86 +0,0 @@ -/*! \file PentaP1Input.h - * \brief: header file for PentaP1Input object - */ - - -#ifndef _PENTAP1INPUT_H_ -#define _PENTAP1INPUT_H_ - -/*Headers:*/ -/*{{{*/ -#include "./Input.h" -#include "../Elements/PentaRef.h" -class GaussTria; -/*}}}*/ - -class PentaP1Input: public Input, public PentaRef{ - - public: - /*just hold 6 values for 6 vertices: */ - int enum_type; - IssmDouble values[6]; - - /*PentaP1Input constructors, destructors: {{{*/ - PentaP1Input(); - PentaP1Input(int enum_type,IssmDouble* values); - ~PentaP1Input(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*PentaP1Input management: {{{*/ - int InstanceEnum(); - Input* SpawnTriaInput(int* indices); - Input* PointwiseDivide(Input* inputB); - Input* PointwiseMin(Input* inputB); - Input* PointwiseMax(Input* inputB); - ElementResult* SpawnResult(int step, IssmDouble time); - void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error2_("not supported yet");}; - void Configure(Parameters* parameters); - /*}}}*/ - /*numerics: {{{*/ - void GetInputValue(bool* pvalue){_error2_("not implemented yet");}; - void GetInputValue(int* pvalue){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss); - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss,IssmDouble time){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussTria* gauss ,int index){_error2_("not implemented yet");}; - void GetInputValue(IssmDouble* pvalue,GaussPenta* gauss ,int index){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss); - void GetInputAverage(IssmDouble* pvalue); - void GetVxStrainRate2d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVyStrainRate2d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussTria* gauss){_error2_("not implemented yet");}; - void GetVxStrainRate3d(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss); - void GetVyStrainRate3d(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss); - void GetVzStrainRate3d(IssmDouble* epsilonvz,IssmDouble* xyz_list, GaussPenta* gauss); - void GetVxStrainRate3dPattyn(IssmDouble* epsilonvx,IssmDouble* xyz_list, GaussPenta* gauss); - void GetVyStrainRate3dPattyn(IssmDouble* epsilonvy,IssmDouble* xyz_list, GaussPenta* gauss); - void ChangeEnum(int newenumtype); - - void SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters); - void ConstrainMin(IssmDouble minimum); - void Scale(IssmDouble scale_factor); - void ArtificialNoise(IssmDouble min,IssmDouble max){_error2_("not implemented yet");}; - void AXPY(Input* xinput,IssmDouble scalar); - void Constrain(IssmDouble cm_min, IssmDouble cm_max); - IssmDouble InfinityNorm(void); - IssmDouble Max(void); - IssmDouble MaxAbs(void); - IssmDouble Min(void); - IssmDouble MinAbs(void); - void Extrude(void); - void VerticallyIntegrate(Input* thickness_input); - void GetVectorFromInputs(Vector* vector,int* doflist); - void GetValuesPtr(IssmDouble** pvalues,int* pnum_values); - /*}}}*/ - -}; -#endif /* _PENTAP1INPUT_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Geometry.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Geometry.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Geometry.cpp (revision 12822) @@ -1,94 +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 "../../Container/Container.h" -#include "../../include/include.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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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 ) xfree((void**)&name); - if (value ) xfree((void**)&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=(char *) xmalloc((strlen(value)+1)*sizeof(char)); - 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_("\""); - - xfree((void**)&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=(char *) xmalloc((strlen(value)+1)*sizeof(char)); - 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); - - xfree((void**)&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; - 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],"AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Placemark.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Placemark.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Placemark.cpp (revision 12822) @@ -1,210 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_ColorStyle.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_ColorStyle.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_ColorStyle.cpp (revision 12822) @@ -1,109 +0,0 @@ -/*!\file KML_ColorStyle.cpp - * \brief: implementation of the kml_colorstyle 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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LinearRing.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LinearRing.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LinearRing.h (revision 12822) @@ -1,51 +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 "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LINEARRING_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Feature.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Feature.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Feature.h (revision 12822) @@ -1,57 +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 "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_FEATURE_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_GroundOverlay.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_GroundOverlay.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_GroundOverlay.cpp (revision 12822) @@ -1,164 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Style.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Style.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Style.cpp (revision 12822) @@ -1,243 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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; - if (list ) xfree((void**)&list); - list =NULL; - } - if (balloon) { -// delete balloon; - if (balloon ) xfree((void**)&balloon); - balloon =NULL; - } - if (poly) { - delete poly; - poly =NULL; - } - if (line) { - delete line; - line =NULL; - } - if (label) { -// delete label; - if (label ) xfree((void**)&label); - label =NULL; - } - if (icon) { -// delete icon; - if (icon ) xfree((void**)&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,"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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KMLFileReadUtils.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KMLFileReadUtils.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KMLFileReadUtils.h (revision 12822) @@ -1,57 +0,0 @@ -/*!\file: KMLFileReadUtils.h - * \brief: header file for kml file reading utilities. - */ - -#ifndef _KMLFILEREADUTILS_H -#define _KMLFILEREADUTILS_H - -/*Headers:{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.h" - -#include "../Object.h" -/*}}}*/ - -/* local prototypes: */ -char* KMLFileToken(FILE* fid, - int* pncom,char*** ppcom); -char* KMLFileTokenComment(FILE* fid); -void KMLFileTokenBuffer(char** pbuffer,int* pibuf,int* pbuflen, - int c, - int bufblk); -char* KMLFileTagName(char* pname, - char* ktag); -char* KMLFileTagName(char* pname,int *m,int maxlen, - char* ktag); -int KMLFileTagAttrib(KML_Object* kobj, - char* ktag); -int KMLFileTokenParse(int* pival, - char* ktag, - FILE* fid); -int KMLFileTokenParse(bool* pbval, - char* ktag, - FILE* fid); -char* KMLFileTokenParse(char* pstr, - char* ktag, - FILE* fid); -char* KMLFileTokenParse(char* pstr,int *m,int maxlen, - char* ktag, - FILE* fid); -int KMLFileTokenParse(float* pfval, - char* ktag, - FILE* fid); -int KMLFileTokenParse(double* pdval, - char* ktag, - FILE* fid); -int KMLFileTokenParse(double **pdval,int* m,int maxlen, - char* ktag, - FILE* fid); -int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen, - char* ktag, - FILE* fid); -int KMLFileTagSkip(char* ktag, - FILE* fid); - -#endif /* _KMLFILEREADUTILS_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Comment.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Comment.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Comment.cpp (revision 12822) @@ -1,118 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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 ) xfree((void**)&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=(char *) xmalloc((strlen(valuei)+1)*sizeof(char)); - 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=(char *) xmalloc((strlen(value)+1)*sizeof(char)); - memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_MultiGeometry.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_MultiGeometry.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_MultiGeometry.cpp (revision 12822) @@ -1,203 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_StyleSelector.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_StyleSelector.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_StyleSelector.h (revision 12822) @@ -1,42 +0,0 @@ -/*! \file KML_StyleSelector.h - * \brief: header file for kml_styleselector abstract object - */ - -#ifndef _KML_STYLESELECTOR_H_ -#define _KML_STYLESELECTOR_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_STYLESELECTOR_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LatLonBox.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LatLonBox.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LatLonBox.h (revision 12822) @@ -1,48 +0,0 @@ -/*! \file KML_LatLonBox.h - * \brief: header file for kml_latlonbox object - */ - -#ifndef _KML_LATLONBOX_H_ -#define _KML_LATLONBOX_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LATLONBOX_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LineStyle.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LineStyle.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LineStyle.cpp (revision 12822) @@ -1,138 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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){ - - int i; - 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,"")) - KMLFileTokenParse(&width , - kstri, - fid); - - else if (!strncmp(kstri,"<",1)) - KML_ColorStyle::Read(fid,kstri); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Attribute.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Attribute.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Attribute.h (revision 12822) @@ -1,50 +0,0 @@ -/*! \file KML_Attribute.h - * \brief: header file for kml_attribute object - */ - -#ifndef _KML_ATTRIBUTE_H_ -#define _KML_ATTRIBUTE_H_ - -/*Headers:{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_PolyStyle.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_PolyStyle.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_PolyStyle.h (revision 12822) @@ -1,45 +0,0 @@ -/*! \file KML_PolyStyle.h - * \brief: header file for kml_polystyle object - */ - -#ifndef _KML_POLYSTYLE_H_ -#define _KML_POLYSTYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_POLYSTYLE_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Folder.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Folder.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Folder.cpp (revision 12822) @@ -1,131 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Object.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Object.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Object.h (revision 12822) @@ -1,56 +0,0 @@ -/*! \file KML_Object.h - * \brief: header file for kml_object abstract object - */ - -#ifndef _KML_OBJECT_H_ -#define _KML_OBJECT_H_ - -/*Headers:{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Document.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Document.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Document.cpp (revision 12822) @@ -1,131 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_File.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_File.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_File.cpp (revision 12822) @@ -1,140 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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; - 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,"AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_SubStyle.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_SubStyle.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_SubStyle.h (revision 12822) @@ -1,42 +0,0 @@ -/*! \file KML_SubStyle.h - * \brief: header file for kml_substyle abstract object - */ - -#ifndef _KML_SUBSTYLE_H_ -#define _KML_SUBSTYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_SUBSTYLE_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LineString.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LineString.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_LineString.h (revision 12822) @@ -1,51 +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 "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_LINESTRING_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Overlay.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Overlay.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Overlay.h (revision 12822) @@ -1,49 +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 "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_OVERLAY_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Container.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Container.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Container.h (revision 12822) @@ -1,46 +0,0 @@ -/*! \file KML_Container.h - * \brief: header file for kml_container abstract object - */ - -#ifndef _KML_CONTAINER_H_ -#define _KML_CONTAINER_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_CONTAINER_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Icon.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Icon.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Icon.cpp (revision 12822) @@ -1,182 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Point.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Point.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Point.cpp (revision 12822) @@ -1,193 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&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 */ - - Ll2xyx(&x,&y,&lat,&lon,1,sgn,cm,sp); - -/* 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 "../../Container/Container.h" -#include "../../include/include.h" -#include "../../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,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); - Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); - -/* write header */ - - memcpy(nstr2,nstr,(strlen(nstr)+1)*sizeof(char)); - - for (i=0; i(y); - xDelete(x); - xDelete(lon); - xDelete(lat); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Feature.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Feature.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Feature.cpp (revision 12822) @@ -1,179 +0,0 @@ -/*!\file KML_Feature.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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Polygon.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Polygon.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Polygon.h (revision 12822) @@ -1,53 +0,0 @@ -/*! \file KML_Polygon.h - * \brief: header file for kml_polygon object - */ - -#ifndef _KML_POLYGON_H_ -#define _KML_POLYGON_H_ - -#define KML_POLYGON_ALTMODE_LENGTH 18 - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.h" - -#include "./KML_Geometry.h" -class KML_LinearRing; -class DataSet; -/*}}}*/ - -class KML_Polygon: public KML_Geometry { - - public: - - bool extrude; - bool tessellate; - char altmode[KML_POLYGON_ALTMODE_LENGTH+1]; - DataSet* outer; - DataSet* inner; - - /*KML_Polygon constructors, destructors {{{*/ - KML_Polygon(); - ~KML_Polygon(); - /*}}}*/ - /*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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_POLYGON_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KMLFileReadUtils.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KMLFileReadUtils.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KMLFileReadUtils.cpp (revision 12822) @@ -1,700 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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; - - buffer=(char *) xmalloc(buflen*sizeof(char)); - 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)++; - *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*)); - (*ppcom)[*pncom-1]=bufferc; - } - else - xfree((void**)&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)++; - *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*)); - (*ppcom)[*pncom-1]=bufferc; - } - else - xfree((void**)&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) - xfree((void**)&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=(char *) xmalloc(buflen*sizeof(char)); - 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); - xfree((void**)&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) - xfree((void**)&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* buffer=NULL; - -/* check buffer length and realloc if necessary */ - - if (*pibuf+2 > *pbuflen) { - *pbuflen+=bufblk; - *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)) - _error2_("KMLFileTagName -- Missing tag delimiters in " << ktag << ".\n"); - -/* strtok modifies ktag, so work on copy */ - - ktagi=(char *) xmalloc((strlen(ktag)+1)*sizeof(char)); - 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=(char *) xmalloc((maxlen +1)*sizeof(char)); - else - pname=(char *) xmalloc((strlen(ktokn)+1)*sizeof(char)); - } - - 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)); - - xfree((void**)&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=(char *) xmalloc((strlen(ktag)+1)*sizeof(char)); - 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); - } - - xfree((void**)&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] == '<')) - _error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); - - sscanf(kstr,"%d",pival); - xfree((void**)&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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&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] == '<')) - {_error2_("KMLFileTokenParse -- Missing bool field for " << ktag << ".\n");} - - sscanf(kstr,"%d",&ival); - *pbval=(bool)ival; - xfree((void**)&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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&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] == '<')) - _error2_("KMLFileTokenParse -- Missing string field for " << ktag << ".\n"); - - if (!pstr) { - if (maxlen) - pstr=(char *) xmalloc((maxlen +1)*sizeof(char)); - else - pstr=(char *) xmalloc((strlen(kstr)+1)*sizeof(char)); - } - - 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)); - - xfree((void**)&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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&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] == '<')) - {_error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n");} - - sscanf(kstr,"%g",pfval); - xfree((void**)&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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&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] == '<')) - _error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); - - sscanf(kstr,"%lg",pdval); - xfree((void**)&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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pdval << "."); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(double **pdval,int* m,int maxlen, - char* ktag, - FILE* fid){ - - int i=-1,j; - char* kstr; - char* ktok; - char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; - -/* get next token and allocate if necessary */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error2_("KMLFileTokenParse -- Missing double [m] field for " << ktag << ".\n"); - - if (!*pdval) - if (maxlen) - *pdval=(double *) xmalloc(maxlen *sizeof(double)); - else - *pdval=(double *) xmalloc(((strlen(kstr)+1)/2)*sizeof(double)); - -/* loop through string to get all values */ - - ktok=strtok(kstr,delim); - while (ktok) { - i++; - if (maxlen && (maxlen < i+1)) - _error2_("KMLFileTokenParse -- Double [m] field too short for " << ktag << ".\n"); - sscanf(ktok,"%lg",&((*pdval)[i])); - ktok=strtok(NULL,delim); - } - xfree((void**)&kstr); - - if (!maxlen) - *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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); -// for (j=0; j<=i; j++) -// _pprintLine_(" [" << j << "]: " << (*pdval)[j] << "g"); - - return(0); -} -/*}}}*/ -/*FUNCTION KMLFileTokenParse {{{*/ -int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen, - char* ktag, - FILE* fid){ - - int i=0,j=-1; - char* kstr; - char* ktok; - char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; - -/* get next token and allocate if necessary */ - - if (!(kstr=KMLFileToken(fid, - NULL,NULL)) || - (kstr[0] == '<')) - _error2_("KMLFileTokenParse -- Missing double [m x 3] field for " << ktag << ".\n"); - - if (!*pdval3) - if (maxlen) - *pdval3=(double (*)[3]) xmalloc((maxlen*3) *sizeof(double)); - else - *pdval3=(double (*)[3]) xmalloc(((strlen(kstr)+1)/2)*sizeof(double)); - -/* loop through string to get all values */ - - ktok=strtok(kstr,delim); - while (ktok) { - j++; - if (j == 3) { - i++; - j=0; - if (maxlen && (maxlen < i+1)) - _error2_("KMLFileTokenParse -- Double [m x 3] field too short for " << ktag << ".\n"); - } - sscanf(ktok,"%lg",&((*pdval3)[i][j])); - ktok=strtok(NULL,delim); - } - xfree((void**)&kstr); - - if (!maxlen) - *pdval3=(double (*)[3]) xrealloc(*pdval3,((i+1)*3)*sizeof(double)); - - if (m) - *m=i+1; - - if (j != 2) - _pprintLine_("KMLFileTokenParse -- Double [m x 3] field for " << ktag << " does not have multiple of 3 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))) - {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} - else - xfree((void**)&kstr); - -// _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); -// for (j=0; j<=i; j++) -// _pprintLine_(" [" << j << "][0-2]: " << (*pdval3)[j][0] << "g," << (*pdval3)[j][1] << "g," << (*pdval3)[j][2] << "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 << "."); - xfree((void**)&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] == '/')) { - _error2_("KMLFileTagSkip -- Unexpected closing tag " << kstr << ".\n"); - } - - xfree((void**)&kstr); - } - - _error2_("KMLFileTokenParse -- Corresponding closing tag for " << ktag << " not found.\n"); - - return(0); -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Geometry.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Geometry.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Geometry.h (revision 12822) @@ -1,42 +0,0 @@ -/*! \file KML_Geometry.h - * \brief: header file for kml_geometry abstract object - */ - -#ifndef _KML_GEOMETRY_H_ -#define _KML_GEOMETRY_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_GEOMETRY_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_StyleSelector.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_StyleSelector.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_StyleSelector.cpp (revision 12822) @@ -1,94 +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 "../../Container/Container.h" -#include "../../include/include.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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Attribute.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Attribute.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Attribute.cpp (revision 12822) @@ -1,133 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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 ) xfree((void**)&name); - if (value ) xfree((void**)&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 =(char *) xmalloc((strlen(namei )+1)*sizeof(char)); - memcpy(name,namei,(strlen(namei)+1)*sizeof(char)); - - value=(char *) xmalloc((strlen(valuei)+1)*sizeof(char)); - 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=(char *) xmalloc((strlen(deflt)+1)*sizeof(char)); - memcpy(*pvalueo,deflt,(strlen(deflt)+1)*sizeof(char)); - } - else { - *pvalueo=(char *) xmalloc((strlen(value)+1)*sizeof(char)); - memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); - } - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_ColorStyle.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_ColorStyle.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_ColorStyle.h (revision 12822) @@ -1,48 +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 "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_COLORSTYLE_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Placemark.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Placemark.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Placemark.h (revision 12822) @@ -1,47 +0,0 @@ -/*! \file KML_Placemark.h - * \brief: header file for kml_placemark object - */ - -#ifndef _KML_PLACEMARK_H_ -#define _KML_PLACEMARK_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_PLACEMARK_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_PolyStyle.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_PolyStyle.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_PolyStyle.cpp (revision 12822) @@ -1,146 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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){ - - int i; - 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,"")) - KMLFileTokenParse(&fill , - kstri, - fid); - else if (!strcmp(kstri,"")) - KMLFileTokenParse(&outline , - kstri, - fid); - - else if (!strncmp(kstri,"<",1)) - KML_ColorStyle::Read(fid,kstri); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&pcom); - - return; -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Unknown.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Unknown.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Unknown.h (revision 12822) @@ -1,45 +0,0 @@ -/*! \file KML_Unknown.h - * \brief: header file for kml_unknown object - */ - -#ifndef _KML_UNKNOWN_H_ -#define _KML_UNKNOWN_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_UNKNOWN_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_GroundOverlay.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_GroundOverlay.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_GroundOverlay.h (revision 12822) @@ -1,49 +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 "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_GROUNDOVERLAY_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Style.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Style.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Style.h (revision 12822) @@ -1,51 +0,0 @@ -/*! \file KML_Style.h - * \brief: header file for kml_style object - */ - -#ifndef _KML_STYLE_H_ -#define _KML_STYLE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_STYLE_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Object.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Object.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Object.cpp (revision 12822) @@ -1,387 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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=(char *) xmalloc((strlen(deflt)+1)*sizeof(char)); - 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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Comment.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Comment.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Comment.h (revision 12822) @@ -1,50 +0,0 @@ -/*! \file KML_Comment.h - * \brief: header file for kml_comment object - */ - -#ifndef _KML_COMMENT_H_ -#define _KML_COMMENT_H_ - -/*Headers:{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_SubStyle.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_SubStyle.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_SubStyle.cpp (revision 12822) @@ -1,94 +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 "../../Container/Container.h" -#include "../../include/include.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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&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=(double *) xmalloc(ncoord*sizeof(double)); - lon=(double *) xmalloc(ncoord*sizeof(double)); - 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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Container.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Container.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Container.cpp (revision 12822) @@ -1,168 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Document.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Document.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Document.h (revision 12822) @@ -1,43 +0,0 @@ -/*! \file KML_Document.h - * \brief: header file for kml_document object - */ - -#ifndef _KML_DOCUMENT_H_ -#define _KML_DOCUMENT_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_DOCUMENT_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_File.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_File.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_File.h (revision 12822) @@ -1,44 +0,0 @@ -/*! \file KML_File.h - * \brief: header file for kml_file object - */ - -#ifndef _KML_FILE_H_ -#define _KML_FILE_H_ - -/*Headers:*/ -/*{{{*/ -#include "../../include/include.h" -#include "../../shared/Exceptions/exceptions.h" -#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; - int MyRank(){_error2_("Not implemented yet.");}; - void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int MarshallSize(){_error2_("Not implemented yet.");}; - void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; - int ObjectEnum(){_error2_("Not implemented yet.");}; - Object* copy(){_error2_("Not implemented yet.");}; - /*}}}*/ - -}; -#endif /* _KML_FILE_H */ - Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Polygon.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Polygon.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/KML/KML_Polygon.cpp (revision 12822) @@ -1,298 +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 "../../io/io.h" -#include "../../Container/Container.h" -#include "../../include/include.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,"")) - 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,"Read(fid,kstrj); - outer ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstrj,"<",1)) - KML_Geometry::Read(fid,kstrj); - - xfree((void**)&kstrj); - } - - else if (!strcmp(kstri,"")) - -/* loop over and process fields within inner boundaries */ - - while (kstrj=KMLFileToken(fid, - &ncom,&pcom)) { - if (!strncmp(kstrj,"Read(fid,kstrj); - inner ->AddObject((Object*)kobj); - } - - else if (!strncmp(kstrj,"<",1)) - KML_Geometry::Read(fid,kstrj); - - xfree((void**)&kstrj); - } - - - else if (!strncmp(kstri,"<",1)) - KML_Geometry::Read(fid,kstri); - - xfree((void**)&kstri); - } - - this->AddCommnt(ncom,pcom); - - for (ncom; ncom>0; ncom--) - xfree((void**)&(pcom[ncom-1])); - xfree((void**)&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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleVecParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleVecParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleVecParam.h (revision 12822) @@ -1,78 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param virtual functions definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM); - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");}; - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M); - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; - void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif /* _DOUBLEVECPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleParam.h (revision 12822) @@ -1,79 +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 "../../include/include.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 MyRank(); - 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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - - 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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _DOUBLEPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/FileParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/FileParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/FileParam.cpp (revision 12822) @@ -1,89 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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::MyRank{{{*/ -int FileParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleMatArrayParam.h (revision 12822) @@ -1,81 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims); - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a boolean");} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold an integer");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a scalar");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble vec array");} - void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble mat array");} - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a int vec array");} - void SetValue(int* intarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a int mat array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleMatParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleMatParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleMatParam.h (revision 12822) @@ -1,80 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN); - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} - void SetValue(IssmDouble* IssmDoublearray,int M,int N); - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");} - void SetValue(int* intarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _DOUBLEMATPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/FileParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/FileParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/FileParam.h (revision 12822) @@ -1,78 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){ _error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){*pfid=value;}; - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("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){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/Param.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/Param.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/Param.h (revision 12822) @@ -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 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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntVecParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntVecParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntVecParam.cpp (revision 12822) @@ -1,147 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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::MyRank{{{*/ -int IntVecParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntParam.cpp (revision 12822) @@ -1,89 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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::MyRank{{{*/ -int IntParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/BoolParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/BoolParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/BoolParam.cpp (revision 12822) @@ -1,89 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.h" -/*}}}*/ - -/*BoolParam constructors and destructor*/ -/*FUNCTION BoolParam::BoolParam(){{{*/ -BoolParam::BoolParam(){ - return; -} -/*}}}*/ -/*FUNCTION BoolParam::BoolParam(int enum_type,IssmBool value){{{*/ -BoolParam::BoolParam(int in_enum_type,IssmBool 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::MyRank{{{*/ -int BoolParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntMatParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntMatParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntMatParam.cpp (revision 12822) @@ -1,131 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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::MyRank{{{*/ -int IntMatParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntVecParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntVecParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntVecParam.h (revision 12822) @@ -1,79 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param virtual functions definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM); - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix");} - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array (maybe in serial?)");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} - void SetValue(int* intarray,int M); - void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntParam.h (revision 12822) @@ -1,79 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){*pinteger=value;} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a bool");} - void SetValue(int integer){this->value=integer;} - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} - void SetValue(int* intarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _INTPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/BoolParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/BoolParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/BoolParam.h (revision 12822) @@ -1,77 +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 "../../include/include.h" -#include "../../shared/shared.h" -/*}}}*/ - -class BoolParam: public Param{ - - public: - /*just hold 3 values for 3 vertices: */ - int enum_type; - IssmBool value; - - /*BoolParam constructors, destructors: {{{*/ - BoolParam(); - BoolParam(int enum_type,IssmBool value); - ~BoolParam(); - /*}}}*/ - /*Object virtual functions definitions:{{{ */ - void Echo(); - void DeepEcho(); - int Id(); - int MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){*pbool=value;} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a FILE");} - - void SetValue(bool boolean){this->value=boolean;} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold an int");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold an IssmPDouble");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a int array");} - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - /*}}}*/ -}; -#endif /* _BOOLPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntMatParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntMatParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/IntMatParam.h (revision 12822) @@ -1,80 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN); - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}; - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} - void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} - void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} - void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} - void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");}; - void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");}; - void SetValue(int* intarray,int M,int N); - void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} - void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _INTMATPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/VectorParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/VectorParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/VectorParam.cpp (revision 12822) @@ -1,121 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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(){ - xdelete(&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){ - - int i; - _printLine_("VectorParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - value->Echo(); -} -/*}}}*/ -/*FUNCTION VectorParam::Id{{{*/ -int VectorParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION VectorParam::MyRank{{{*/ -int VectorParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: */ - xdelete(&value); - - /*copy: */ - value=vector->Duplicate(); - vector->Copy(value); -} -/*}}}*/ -/*FUNCTION VectorParam::UnitConversion{{{*/ -void VectorParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleTransientMatParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleTransientMatParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/DoubleTransientMatParam.cpp (revision 12822) @@ -1,30 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/MatrixParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/MatrixParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/MatrixParam.cpp (revision 12822) @@ -1,117 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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(){ - xdelete(&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){ - - int i; - _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::MyRank{{{*/ -int MatrixParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: */ - xdelete(&value); - - /*copy: */ - value=matrix->Duplicate(); -} -/*}}}*/ -/*FUNCTION MatrixParam::UnitConversion{{{*/ -void MatrixParam::UnitConversion(int direction_enum){ - /*do nothing, no unit conversion*/ -} -/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/StringArrayParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/StringArrayParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/StringArrayParam.cpp (revision 12822) @@ -1,179 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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::MyRank{{{*/ -int StringArrayParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/StringParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/StringParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/StringParam.cpp (revision 12822) @@ -1,121 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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::MyRank{{{*/ -int StringParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/VectorParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/VectorParam.h (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/VectorParam.h (revision 12822) @@ -1,79 +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 "../../include/include.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 MyRank(); - int ObjectEnum(); - Object* copy(); - /*}}}*/ - /*Param vritual function definitions: {{{*/ - int InstanceEnum(){return enum_type;} - void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} - void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} - void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} - void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} - void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} - void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} - void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} - void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} - void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} - void GetParameterValue(Vector** poutput); - void GetParameterValue(FILE** pfid){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");} - - void SetValue(bool boolean){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a boolean");} - void SetValue(int integer){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an integer");} - void SetValue(IssmDouble scalar){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a scalar");} - void SetValue(char* string){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} - void SetValue(char** stringarray,int M){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} - void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} - void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} - void SetValue(int* intarray,int M){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} - void SetValue(int* pintarray,int M,int N){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");} - void SetValue(Vector* vec); - void SetValue(Matrix* mat){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");} - void SetValue(FILE* fid){_error2_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} - void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} - void UnitConversion(int direction_enum); - - void GetParameterName(char**pname); - - /*}}}*/ -}; -#endif /* _VECTORPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/TransientParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/TransientParam.cpp (revision 12821) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/objects/Params/TransientParam.cpp (revision 12822) @@ -1,151 +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 "../../EnumDefinitions/EnumDefinitions.h" -#include "../../shared/shared.h" -#include "../../Container/Container.h" -#include "../../include/include.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){ - - int i,j; - - _printLine_("TransientParam:"); - _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); - _printLine_(" size: " << this->N); - for(i=0;iN;i++){ - _printLine_( "time: " << this->timesteps[i] << " value: " << this->values[i]); - } -} -/*}}}*/ -/*FUNCTION TransientParam::Id{{{*/ -int TransientParam::Id(void){ return -1; } -/*}}}*/ -/*FUNCTION TransientParam::MyRank{{{*/ -int TransientParam::MyRank(void){ - extern int my_rank; - return my_rank; -} -/*}}}*/ -/*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){ - - double 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]AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&pcom); + + return; +} +/*}}}*/ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Document.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Document.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Document.cpp (revision 12822) @@ -0,0 +1,131 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&pcom); + + return; +} +/*}}}*/ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.h (revision 12822) @@ -0,0 +1,42 @@ +/*! \file KML_SubStyle.h + * \brief: header file for kml_substyle abstract object + */ + +#ifndef _KML_SUBSTYLE_H_ +#define _KML_SUBSTYLE_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_SUBSTYLE_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_File.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_File.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_File.cpp (revision 12822) @@ -0,0 +1,140 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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; + 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,"AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_LineString.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_LineString.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_LineString.h (revision 12822) @@ -0,0 +1,51 @@ +/*! \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 "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_LINESTRING_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Overlay.h (revision 12822) @@ -0,0 +1,49 @@ +/*! \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 "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_OVERLAY_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Container.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Container.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Container.h (revision 12822) @@ -0,0 +1,46 @@ +/*! \file KML_Container.h + * \brief: header file for kml_container abstract object + */ + +#ifndef _KML_CONTAINER_H_ +#define _KML_CONTAINER_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_CONTAINER_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp (revision 12822) @@ -0,0 +1,182 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"")) + 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); + + xfree((void**)&kstri); + } + + this->AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&pcom); + + return; +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Point.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Point.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Point.cpp (revision 12822) @@ -0,0 +1,193 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"")) + 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); + + xfree((void**)&kstri); + } + + this->AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&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 */ + + Ll2xyx(&x,&y,&lat,&lon,1,sgn,cm,sp); + +/* 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 "../../Container/Container.h" +#include "../../include/include.h" +#include "../../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,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); + Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); + +/* write header */ + + memcpy(nstr2,nstr,(strlen(nstr)+1)*sizeof(char)); + + for (i=0; i(y); + xDelete(x); + xDelete(lon); + xDelete(lat); + + return; +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Feature.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Feature.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Feature.cpp (revision 12822) @@ -0,0 +1,179 @@ +/*!\file KML_Feature.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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.h (revision 12822) @@ -0,0 +1,53 @@ +/*! \file KML_Polygon.h + * \brief: header file for kml_polygon object + */ + +#ifndef _KML_POLYGON_H_ +#define _KML_POLYGON_H_ + +#define KML_POLYGON_ALTMODE_LENGTH 18 + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.h" + +#include "./KML_Geometry.h" +class KML_LinearRing; +class DataSet; +/*}}}*/ + +class KML_Polygon: public KML_Geometry { + + public: + + bool extrude; + bool tessellate; + char altmode[KML_POLYGON_ALTMODE_LENGTH+1]; + DataSet* outer; + DataSet* inner; + + /*KML_Polygon constructors, destructors {{{*/ + KML_Polygon(); + ~KML_Polygon(); + /*}}}*/ + /*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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_POLYGON_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KMLFileReadUtils.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KMLFileReadUtils.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KMLFileReadUtils.cpp (revision 12822) @@ -0,0 +1,700 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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; + + buffer=(char *) xmalloc(buflen*sizeof(char)); + 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)++; + *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*)); + (*ppcom)[*pncom-1]=bufferc; + } + else + xfree((void**)&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)++; + *ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*)); + (*ppcom)[*pncom-1]=bufferc; + } + else + xfree((void**)&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) + xfree((void**)&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=(char *) xmalloc(buflen*sizeof(char)); + 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); + xfree((void**)&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) + xfree((void**)&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* buffer=NULL; + +/* check buffer length and realloc if necessary */ + + if (*pibuf+2 > *pbuflen) { + *pbuflen+=bufblk; + *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)) + _error2_("KMLFileTagName -- Missing tag delimiters in " << ktag << ".\n"); + +/* strtok modifies ktag, so work on copy */ + + ktagi=(char *) xmalloc((strlen(ktag)+1)*sizeof(char)); + 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=(char *) xmalloc((maxlen +1)*sizeof(char)); + else + pname=(char *) xmalloc((strlen(ktokn)+1)*sizeof(char)); + } + + 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)); + + xfree((void**)&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=(char *) xmalloc((strlen(ktag)+1)*sizeof(char)); + 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); + } + + xfree((void**)&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] == '<')) + _error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); + + sscanf(kstr,"%d",pival); + xfree((void**)&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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&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] == '<')) + {_error2_("KMLFileTokenParse -- Missing bool field for " << ktag << ".\n");} + + sscanf(kstr,"%d",&ival); + *pbval=(bool)ival; + xfree((void**)&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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&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] == '<')) + _error2_("KMLFileTokenParse -- Missing string field for " << ktag << ".\n"); + + if (!pstr) { + if (maxlen) + pstr=(char *) xmalloc((maxlen +1)*sizeof(char)); + else + pstr=(char *) xmalloc((strlen(kstr)+1)*sizeof(char)); + } + + 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)); + + xfree((void**)&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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&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] == '<')) + {_error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n");} + + sscanf(kstr,"%g",pfval); + xfree((void**)&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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&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] == '<')) + _error2_("KMLFileTokenParse -- Missing integer field for " << ktag << ".\n"); + + sscanf(kstr,"%lg",pdval); + xfree((void**)&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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&kstr); + +// _pprintLine_("KMLFileTokenParse -- " << ktag << "=" << *pdval << "."); + + return(0); +} +/*}}}*/ +/*FUNCTION KMLFileTokenParse {{{*/ +int KMLFileTokenParse(double **pdval,int* m,int maxlen, + char* ktag, + FILE* fid){ + + int i=-1,j; + char* kstr; + char* ktok; + char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; + +/* get next token and allocate if necessary */ + + if (!(kstr=KMLFileToken(fid, + NULL,NULL)) || + (kstr[0] == '<')) + _error2_("KMLFileTokenParse -- Missing double [m] field for " << ktag << ".\n"); + + if (!*pdval) + if (maxlen) + *pdval=(double *) xmalloc(maxlen *sizeof(double)); + else + *pdval=(double *) xmalloc(((strlen(kstr)+1)/2)*sizeof(double)); + +/* loop through string to get all values */ + + ktok=strtok(kstr,delim); + while (ktok) { + i++; + if (maxlen && (maxlen < i+1)) + _error2_("KMLFileTokenParse -- Double [m] field too short for " << ktag << ".\n"); + sscanf(ktok,"%lg",&((*pdval)[i])); + ktok=strtok(NULL,delim); + } + xfree((void**)&kstr); + + if (!maxlen) + *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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&kstr); + +// _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); +// for (j=0; j<=i; j++) +// _pprintLine_(" [" << j << "]: " << (*pdval)[j] << "g"); + + return(0); +} +/*}}}*/ +/*FUNCTION KMLFileTokenParse {{{*/ +int KMLFileTokenParse(double (**pdval3)[3],int* m,int maxlen, + char* ktag, + FILE* fid){ + + int i=0,j=-1; + char* kstr; + char* ktok; + char delim[]={' ',',','\f','\n','\r','\t','\v','\0'}; + +/* get next token and allocate if necessary */ + + if (!(kstr=KMLFileToken(fid, + NULL,NULL)) || + (kstr[0] == '<')) + _error2_("KMLFileTokenParse -- Missing double [m x 3] field for " << ktag << ".\n"); + + if (!*pdval3) + if (maxlen) + *pdval3=(double (*)[3]) xmalloc((maxlen*3) *sizeof(double)); + else + *pdval3=(double (*)[3]) xmalloc(((strlen(kstr)+1)/2)*sizeof(double)); + +/* loop through string to get all values */ + + ktok=strtok(kstr,delim); + while (ktok) { + j++; + if (j == 3) { + i++; + j=0; + if (maxlen && (maxlen < i+1)) + _error2_("KMLFileTokenParse -- Double [m x 3] field too short for " << ktag << ".\n"); + } + sscanf(ktok,"%lg",&((*pdval3)[i][j])); + ktok=strtok(NULL,delim); + } + xfree((void**)&kstr); + + if (!maxlen) + *pdval3=(double (*)[3]) xrealloc(*pdval3,((i+1)*3)*sizeof(double)); + + if (m) + *m=i+1; + + if (j != 2) + _pprintLine_("KMLFileTokenParse -- Double [m x 3] field for " << ktag << " does not have multiple of 3 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))) + {_error2_("KMLFileTokenParse -- Missing closing tag for " << ktag << ".\n");} + else + xfree((void**)&kstr); + +// _pprintLine_("KMLFileTokenParse -- " << ktag << "=..."); +// for (j=0; j<=i; j++) +// _pprintLine_(" [" << j << "][0-2]: " << (*pdval3)[j][0] << "g," << (*pdval3)[j][1] << "g," << (*pdval3)[j][2] << "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 << "."); + xfree((void**)&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] == '/')) { + _error2_("KMLFileTagSkip -- Unexpected closing tag " << kstr << ".\n"); + } + + xfree((void**)&kstr); + } + + _error2_("KMLFileTokenParse -- Corresponding closing tag for " << ktag << " not found.\n"); + + return(0); +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Geometry.h (revision 12822) @@ -0,0 +1,42 @@ +/*! \file KML_Geometry.h + * \brief: header file for kml_geometry abstract object + */ + +#ifndef _KML_GEOMETRY_H_ +#define _KML_GEOMETRY_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_GEOMETRY_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_StyleSelector.cpp (revision 12822) @@ -0,0 +1,94 @@ +/*!\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 "../../Container/Container.h" +#include "../../include/include.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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"")) + 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); + + xfree((void**)&kstri); + } + + this->AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&pcom); + + return; +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Attribute.cpp (revision 12822) @@ -0,0 +1,133 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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 ) xfree((void**)&name); + if (value ) xfree((void**)&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 =(char *) xmalloc((strlen(namei )+1)*sizeof(char)); + memcpy(name,namei,(strlen(namei)+1)*sizeof(char)); + + value=(char *) xmalloc((strlen(valuei)+1)*sizeof(char)); + 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=(char *) xmalloc((strlen(deflt)+1)*sizeof(char)); + memcpy(*pvalueo,deflt,(strlen(deflt)+1)*sizeof(char)); + } + else { + *pvalueo=(char *) xmalloc((strlen(value)+1)*sizeof(char)); + memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char)); + } + + return; +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_ColorStyle.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_ColorStyle.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_ColorStyle.h (revision 12822) @@ -0,0 +1,48 @@ +/*! \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 "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_COLORSTYLE_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Placemark.h (revision 12822) @@ -0,0 +1,47 @@ +/*! \file KML_Placemark.h + * \brief: header file for kml_placemark object + */ + +#ifndef _KML_PLACEMARK_H_ +#define _KML_PLACEMARK_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_PLACEMARK_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_PolyStyle.cpp (revision 12822) @@ -0,0 +1,146 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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){ + + int i; + 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,"")) + KMLFileTokenParse(&fill , + kstri, + fid); + else if (!strcmp(kstri,"")) + KMLFileTokenParse(&outline , + kstri, + fid); + + else if (!strncmp(kstri,"<",1)) + KML_ColorStyle::Read(fid,kstri); + + xfree((void**)&kstri); + } + + this->AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&pcom); + + return; +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Unknown.h (revision 12822) @@ -0,0 +1,45 @@ +/*! \file KML_Unknown.h + * \brief: header file for kml_unknown object + */ + +#ifndef _KML_UNKNOWN_H_ +#define _KML_UNKNOWN_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_UNKNOWN_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_GroundOverlay.h (revision 12822) @@ -0,0 +1,49 @@ +/*! \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 "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_GROUNDOVERLAY_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Style.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Style.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Style.h (revision 12822) @@ -0,0 +1,51 @@ +/*! \file KML_Style.h + * \brief: header file for kml_style object + */ + +#ifndef _KML_STYLE_H_ +#define _KML_STYLE_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_STYLE_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Object.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Object.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Object.cpp (revision 12822) @@ -0,0 +1,387 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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=(char *) xmalloc((strlen(deflt)+1)*sizeof(char)); + 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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Comment.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Comment.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Comment.h (revision 12822) @@ -0,0 +1,50 @@ +/*! \file KML_Comment.h + * \brief: header file for kml_comment object + */ + +#ifndef _KML_COMMENT_H_ +#define _KML_COMMENT_H_ + +/*Headers:{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_SubStyle.cpp (revision 12822) @@ -0,0 +1,94 @@ +/*!\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 "../../Container/Container.h" +#include "../../include/include.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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"")) + 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); + + xfree((void**)&kstri); + } + + this->AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&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=(double *) xmalloc(ncoord*sizeof(double)); + lon=(double *) xmalloc(ncoord*sizeof(double)); + 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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"")) + 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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Container.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Container.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Container.cpp (revision 12822) @@ -0,0 +1,168 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Document.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Document.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Document.h (revision 12822) @@ -0,0 +1,43 @@ +/*! \file KML_Document.h + * \brief: header file for kml_document object + */ + +#ifndef _KML_DOCUMENT_H_ +#define _KML_DOCUMENT_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_DOCUMENT_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_File.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_File.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_File.h (revision 12822) @@ -0,0 +1,44 @@ +/*! \file KML_File.h + * \brief: header file for kml_file object + */ + +#ifndef _KML_FILE_H_ +#define _KML_FILE_H_ + +/*Headers:*/ +/*{{{*/ +#include "../../include/include.h" +#include "../../shared/Exceptions/exceptions.h" +#include "../../EnumDefinitions/EnumDefinitions.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(){_error2_("Not implemented yet.");}; + int MyRank(){_error2_("Not implemented yet.");}; + void Marshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int MarshallSize(){_error2_("Not implemented yet.");}; + void Demarshall(char** pmarshalled_dataset){_error2_("Not implemented yet.");}; + int ObjectEnum(){_error2_("Not implemented yet.");}; + Object* copy(){_error2_("Not implemented yet.");}; + /*}}}*/ + +}; +#endif /* _KML_FILE_H */ + Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/KML/KML_Polygon.cpp (revision 12822) @@ -0,0 +1,298 @@ +/*!\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 "../../io/io.h" +#include "../../Container/Container.h" +#include "../../include/include.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,"")) + 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,"Read(fid,kstrj); + outer ->AddObject((Object*)kobj); + } + + else if (!strncmp(kstrj,"<",1)) + KML_Geometry::Read(fid,kstrj); + + xfree((void**)&kstrj); + } + + else if (!strcmp(kstri,"")) + +/* loop over and process fields within inner boundaries */ + + while (kstrj=KMLFileToken(fid, + &ncom,&pcom)) { + if (!strncmp(kstrj,"Read(fid,kstrj); + inner ->AddObject((Object*)kobj); + } + + else if (!strncmp(kstrj,"<",1)) + KML_Geometry::Read(fid,kstrj); + + xfree((void**)&kstrj); + } + + + else if (!strncmp(kstri,"<",1)) + KML_Geometry::Read(fid,kstri); + + xfree((void**)&kstri); + } + + this->AddCommnt(ncom,pcom); + + for (ncom; ncom>0; ncom--) + xfree((void**)&(pcom[ncom-1])); + xfree((void**)&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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h (revision 12822) @@ -0,0 +1,78 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param virtual functions definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM); + void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");}; + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M); + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; + void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + /*}}}*/ +}; +#endif /* _DOUBLEVECPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleParam.h (revision 12822) @@ -0,0 +1,79 @@ +/*! \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 "../../include/include.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 MyRank(); + 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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + + 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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _DOUBLEPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/FileParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/FileParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/FileParam.cpp (revision 12822) @@ -0,0 +1,89 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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::MyRank{{{*/ +int FileParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h (revision 12822) @@ -0,0 +1,81 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a bool");} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims); + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << "cannot return a FILE");} + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a boolean");} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold an integer");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a scalar");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble vec array");} + void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble mat array");} + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a int vec array");} + void SetValue(int* intarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a int mat array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << "cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h (revision 12822) @@ -0,0 +1,80 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN); + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("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){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} + void SetValue(IssmDouble* IssmDoublearray,int M,int N); + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");} + void SetValue(int* intarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}; + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _DOUBLEMATPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/Param.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/Param.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/Param.h (revision 12822) @@ -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 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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/FileParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/FileParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/FileParam.h (revision 12822) @@ -0,0 +1,78 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){ _error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){*pfid=value;}; + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("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){_error2_("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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntVecParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntVecParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntVecParam.cpp (revision 12822) @@ -0,0 +1,147 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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::MyRank{{{*/ +int IntVecParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntParam.cpp (revision 12822) @@ -0,0 +1,89 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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::MyRank{{{*/ +int IntParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/BoolParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/BoolParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/BoolParam.cpp (revision 12822) @@ -0,0 +1,89 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.h" +/*}}}*/ + +/*BoolParam constructors and destructor*/ +/*FUNCTION BoolParam::BoolParam(){{{*/ +BoolParam::BoolParam(){ + return; +} +/*}}}*/ +/*FUNCTION BoolParam::BoolParam(int enum_type,IssmBool value){{{*/ +BoolParam::BoolParam(int in_enum_type,IssmBool 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::MyRank{{{*/ +int BoolParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntMatParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntMatParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntMatParam.cpp (revision 12822) @@ -0,0 +1,131 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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::MyRank{{{*/ +int IntMatParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntVecParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntVecParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntVecParam.h (revision 12822) @@ -0,0 +1,79 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param virtual functions definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM); + void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix");} + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array (maybe in serial?)");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} + void SetValue(int* intarray,int M); + void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + /*}}}*/ +}; +#endif Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntParam.h (revision 12822) @@ -0,0 +1,79 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){*pinteger=value;} + void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a bool");} + void SetValue(int integer){this->value=integer;} + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} + void SetValue(int* intarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an int array");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _INTPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/BoolParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/BoolParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/BoolParam.h (revision 12822) @@ -0,0 +1,77 @@ +/*! \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 "../../include/include.h" +#include "../../shared/shared.h" +/*}}}*/ + +class BoolParam: public Param{ + + public: + /*just hold 3 values for 3 vertices: */ + int enum_type; + IssmBool value; + + /*BoolParam constructors, destructors: {{{*/ + BoolParam(); + BoolParam(int enum_type,IssmBool value); + ~BoolParam(); + /*}}}*/ + /*Object virtual functions definitions:{{{ */ + void Echo(); + void DeepEcho(); + int Id(); + int MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){*pbool=value;} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return an array of integers");} + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot return a FILE");} + + void SetValue(bool boolean){this->value=boolean;} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold an int");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold an IssmPDouble");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} + void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a int array");} + void SetValue(int* pintarray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a int array");} + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << ") cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + /*}}}*/ +}; +#endif /* _BOOLPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntMatParam.h =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntMatParam.h (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/IntMatParam.h (revision 12822) @@ -0,0 +1,80 @@ +/*! \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 "../../include/include.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 MyRank(); + int ObjectEnum(); + Object* copy(); + /*}}}*/ + /*Param vritual function definitions: {{{*/ + int InstanceEnum(){return enum_type;} + void GetParameterValue(bool* pbool){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");} + void GetParameterValue(int* pinteger){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");} + void GetParameterValue(int** pintarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");} + void GetParameterValue(int** pintarray,int* pM,int* pN); + void GetParameterValue(IssmDouble* pIssmDouble){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");} + void GetParameterValue(IssmDouble* pdouble,IssmDouble time){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");} + void GetParameterValue(char** pstring){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string");} + void GetParameterValue(char*** pstringarray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} + void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}; + void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} + void GetParameterValue(Vector** pvec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} + void GetParameterValue(Matrix** pmat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} + void GetParameterValue(FILE** pfid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");} + + void SetValue(bool boolean){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");} + void SetValue(int integer){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");} + void SetValue(IssmDouble scalar){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");} + void SetValue(char* string){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} + void SetValue(char** stringarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} + void SetValue(IssmDouble* IssmDoublearray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} + void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");}; + void SetValue(int* intarray,int M){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");}; + void SetValue(int* intarray,int M,int N); + void SetValue(Vector* vec){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");} + void SetValue(Matrix* mat){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");} + void SetValue(FILE* fid){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} + void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error2_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} + void UnitConversion(int direction_enum); + + void GetParameterName(char**pname); + + /*}}}*/ +}; +#endif /* _INTMATPARAM_H */ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp (revision 12822) @@ -0,0 +1,121 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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(){ + xdelete(&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){ + + int i; + _printLine_("VectorParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + value->Echo(); +} +/*}}}*/ +/*FUNCTION VectorParam::Id{{{*/ +int VectorParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION VectorParam::MyRank{{{*/ +int VectorParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: */ + xdelete(&value); + + /*copy: */ + value=vector->Duplicate(); + vector->Copy(value); +} +/*}}}*/ +/*FUNCTION VectorParam::UnitConversion{{{*/ +void VectorParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/DoubleTransientMatParam.cpp (revision 12822) @@ -0,0 +1,30 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp (revision 12822) @@ -0,0 +1,117 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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(){ + xdelete(&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){ + + int i; + _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::MyRank{{{*/ +int MatrixParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: */ + xdelete(&value); + + /*copy: */ + value=matrix->Duplicate(); +} +/*}}}*/ +/*FUNCTION MatrixParam::UnitConversion{{{*/ +void MatrixParam::UnitConversion(int direction_enum){ + /*do nothing, no unit conversion*/ +} +/*}}}*/ Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/StringArrayParam.cpp (revision 12822) @@ -0,0 +1,179 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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::MyRank{{{*/ +int StringArrayParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/StringParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/StringParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/StringParam.cpp (revision 12822) @@ -0,0 +1,121 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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::MyRank{{{*/ +int StringParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp (revision 0) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Params/TransientParam.cpp (revision 12822) @@ -0,0 +1,151 @@ +/*!\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 "../../EnumDefinitions/EnumDefinitions.h" +#include "../../shared/shared.h" +#include "../../Container/Container.h" +#include "../../include/include.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){ + + int i,j; + + _printLine_("TransientParam:"); + _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")"); + _printLine_(" size: " << this->N); + for(i=0;iN;i++){ + _printLine_( "time: " << this->timesteps[i] << " value: " << this->values[i]); + } +} +/*}}}*/ +/*FUNCTION TransientParam::Id{{{*/ +int TransientParam::Id(void){ return -1; } +/*}}}*/ +/*FUNCTION TransientParam::MyRank{{{*/ +int TransientParam::MyRank(void){ + extern int my_rank; + return my_rank; +} +/*}}}*/ +/*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){ + + double 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]