Changeset 26888
- Timestamp:
- 02/16/22 07:32:49 (3 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.cpp
r26090 r26888 30 30 this->name = NULL; 31 31 this->weights_enum = UNDEF; 32 this->misfit=0;33 32 this->timepassedflag = false; 34 33 } … … 43 42 this->weights_enum=in_weights_enum; 44 43 this->timepassedflag=in_timepassedflag; 45 46 this->misfit=0;47 44 } 48 45 /*}}}*/ 49 46 Cfdragcoeffabsgrad::~Cfdragcoeffabsgrad(){/*{{{*/ 50 47 if(this->name)xDelete(this->name); 51 this->misfit=0;52 48 } 53 49 /*}}}*/ … … 55 51 Object* Cfdragcoeffabsgrad::copy() {/*{{{*/ 56 52 Cfdragcoeffabsgrad* mf = new Cfdragcoeffabsgrad(this->name,this->definitionenum, this->weights_enum,this->timepassedflag); 57 mf->misfit=this->misfit;58 53 return (Object*) mf; 59 54 } … … 115 110 int domaintype,numcomponents; 116 111 IssmDouble Jelem=0.; 117 IssmDouble misfit,Jdet;112 IssmDouble Jdet; 118 113 IssmDouble dp[2],weight; 119 114 IssmDouble* xyz_list = NULL; -
issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.h
r26469 r26888 22 22 bool timepassedflag; 23 23 24 IssmDouble misfit; //value carried over in time.25 26 24 /*Cfdragcoeffabsgrad constructors, destructors :*/ 27 25 Cfdragcoeffabsgrad(); -
issm/trunk-jpl/src/c/classes/Cflevelsetmisfit.cpp
r26255 r26888 32 32 this->observation_enum = UNDEF; 33 33 this->weights_enum = UNDEF; 34 this->misfit=0;35 34 this->datatime=0.; 36 35 this->timepassedflag = false; … … 49 48 this->datatime=in_datatime; 50 49 this->timepassedflag=in_timepassedflag; 51 52 this->misfit=0;53 50 } 54 51 /*}}}*/ 55 52 Cflevelsetmisfit::~Cflevelsetmisfit(){/*{{{*/ 56 53 if(this->name)xDelete(this->name); 57 this->misfit=0;58 54 } 59 55 /*}}}*/ … … 61 57 Object* Cflevelsetmisfit::copy() {/*{{{*/ 62 58 Cflevelsetmisfit* mf = new Cflevelsetmisfit(this->name,this->definitionenum, this->model_enum,this->observation_enum,this->weights_enum,this->datatime,this->timepassedflag); 63 mf->misfit=this->misfit;64 59 return (Object*) mf; 65 60 } … … 95 90 marshallhandle->call(this->datatime); 96 91 marshallhandle->call(this->timepassedflag); 97 marshallhandle->call(this->misfit);98 92 } 99 93 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Cflevelsetmisfit.h
r26469 r26888 25 25 bool timepassedflag; 26 26 27 IssmDouble misfit; //value carried over in time.28 29 27 /*Cflevelsetmisfit constructors, destructors :*/ 30 28 Cflevelsetmisfit(); -
issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.cpp
r26868 r26888 29 29 this->definitionenum = -1; 30 30 this->name = NULL; 31 this->misfit=0;32 31 this->datatime=0.; 33 32 this->timepassedflag = false; … … 45 44 this->timepassedflag=in_timepassedflag; 46 45 47 this->misfit=0;48 46 } 49 47 /*}}}*/ 50 48 Cfsurfacelogvel::~Cfsurfacelogvel(){/*{{{*/ 51 49 if(this->name)xDelete(this->name); 52 this->misfit=0;53 50 } 54 51 /*}}}*/ … … 56 53 Object* Cfsurfacelogvel::copy() {/*{{{*/ 57 54 Cfsurfacelogvel* mf = new Cfsurfacelogvel(this->name,this->definitionenum,this->datatime,this->timepassedflag); 58 mf->misfit=this->misfit;59 55 return (Object*) mf; 60 56 } … … 82 78 marshallhandle->call(this->datatime); 83 79 marshallhandle->call(this->timepassedflag); 84 marshallhandle->call(this->misfit);85 80 } 86 81 /*}}}*/ … … 107 102 femmodel->parameters->FindParam(&time,TimeEnum); 108 103 109 IssmDouble J=0.; 110 IssmDouble J_sum=0.; 111 if(this->datatime<=time && !timepassedflag){ 104 if(this->datatime<=time && !this->timepassedflag){ 105 106 IssmDouble J=0.; 107 IssmDouble J_sum=0.; 108 112 109 for(Object* & object : femmodel->elements->objects){ 113 110 Element* element=xDynamicCast<Element*>(object); … … 120 117 121 118 this->timepassedflag = true; 122 } 123 return J; 119 return J_sum; 120 } 121 else{ 122 return 0.; 123 } 124 124 }/*}}}*/ 125 125 IssmDouble Cfsurfacelogvel::Cfsurfacelogvel_Calculation(Element* element, int definitionenum){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.h
r26469 r26888 22 22 bool timepassedflag; 23 23 24 IssmDouble misfit; //value carried over in time.25 26 24 /*Cfsurfacelogvel constructors, destructors :*/ 27 25 Cfsurfacelogvel(); -
issm/trunk-jpl/src/c/classes/Cfsurfacesquare.cpp
r26525 r26888 6 6 /*{{{*/ 7 7 #ifdef HAVE_CONFIG_H 8 8 #include <config.h> 9 9 #else 10 10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" … … 27 27 Cfsurfacesquare::Cfsurfacesquare(){/*{{{*/ 28 28 29 this->definitionenum = -1;30 this->name = NULL;31 this->model_enum = UNDEF;29 this->definitionenum = -1; 30 this->name = NULL; 31 this->model_enum = UNDEF; 32 32 this->observation_enum = UNDEF; 33 this->weights_enum = UNDEF; 34 this->misfit=0; 35 this->datatime=0.; 36 this->timepassedflag = false; 33 this->weights_enum = UNDEF; 34 this->datatime = 0.; 35 this->timepassedflag = false; 37 36 } 38 37 /*}}}*/ … … 49 48 this->datatime=in_datatime; 50 49 this->timepassedflag=in_timepassedflag; 51 52 this->misfit=0;53 50 } 54 51 /*}}}*/ 55 52 Cfsurfacesquare::~Cfsurfacesquare(){/*{{{*/ 56 53 if(this->name)xDelete(this->name); 57 this->misfit=0; 58 } 59 /*}}}*/ 54 } 55 /*}}}*/ 56 60 57 /*Object virtual function resolutoin: */ 61 58 Object* Cfsurfacesquare::copy() {/*{{{*/ 62 59 Cfsurfacesquare* mf = new Cfsurfacesquare(this->name,this->definitionenum, this->model_enum,this->observation_enum,this->weights_enum,this->datatime,this->timepassedflag); 63 mf->misfit=this->misfit;64 60 return (Object*) mf; 65 61 } … … 95 91 marshallhandle->call(this->datatime); 96 92 marshallhandle->call(this->timepassedflag); 97 marshallhandle->call(this->misfit);98 93 } 99 94 /*}}}*/ … … 102 97 } 103 98 /*}}}*/ 99 104 100 /*Definition virtual function resolutoin: */ 105 101 int Cfsurfacesquare::DefinitionEnum(){/*{{{*/ … … 115 111 /*}}}*/ 116 112 IssmDouble Cfsurfacesquare::Response(FemModel* femmodel){/*{{{*/ 117 /*diverse: */ 118 IssmDouble time; 119 120 /*recover time parameters: */ 121 femmodel->parameters->FindParam(&time,TimeEnum); 122 123 IssmDouble J=0.; 124 IssmDouble J_sum=0.; 125 126 if(datatime<=time && !timepassedflag){ 127 for(Object* & object : femmodel->elements->objects){ 128 Element* element=xDynamicCast<Element*>(object); 129 J+=this->Cfsurfacesquare_Calculation(element,model_enum,observation_enum,weights_enum); 130 } 131 132 ISSM_MPI_Allreduce ( (void*)&J,(void*)&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm()); 133 ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 134 J=J_sum; 135 136 timepassedflag = true; 137 return J; 138 } 139 else return J; 140 } 141 /*}}}*/ 113 114 /*recover time parameters: */ 115 IssmDouble time; 116 femmodel->parameters->FindParam(&time,TimeEnum); 117 118 /*Do the calculation only if this is the first time we are passed datatime*/ 119 if(this->datatime<=time && !this->timepassedflag){ 120 121 IssmDouble J=0.; 122 IssmDouble J_sum=0.; 123 124 for(Object* & object : femmodel->elements->objects){ 125 Element* element=xDynamicCast<Element*>(object); 126 J+=this->Cfsurfacesquare_Calculation(element,model_enum,observation_enum,weights_enum); 127 } 128 129 ISSM_MPI_Allreduce ( (void*)&J,(void*)&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm()); 130 ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 131 132 this->timepassedflag = true; 133 return J_sum; 134 } 135 else{ 136 return 0.; 137 } 138 } 139 /*}}}*/ 142 140 IssmDouble Cfsurfacesquare::Cfsurfacesquare_Calculation(Element* element, int model_enum, int observation_enum, int weights_enum){/*{{{*/ 143 141 -
issm/trunk-jpl/src/c/classes/Cfsurfacesquare.h
r26525 r26888 26 26 bool timepassedflag; 27 27 28 IssmDouble misfit; //value carried over in time.29 30 28 /*Cfsurfacesquare constructors, destructors :*/ 31 29 Cfsurfacesquare();
Note:
See TracChangeset
for help on using the changeset viewer.