Changeset 3041


Ignore:
Timestamp:
02/16/10 14:21:06 (15 years ago)
Author:
Eric.Larour
Message:

Added real factor, to compute real misfit or not. real=0 for control methods.

Location:
issm/trunk/src/c/objects
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Beam.cpp

    r2907 r3041  
    666666#undef __FUNCT__
    667667#define __FUNCT__ "Beam::Misfit"
    668 double Beam::Misfit(void*,int,int ){
     668double Beam::Misfit(void*,int,int,int){
    669669        throw ErrorException(__FUNCT__," not supported yet!");
    670670}
  • issm/trunk/src/c/objects/Beam.h

    r2333 r3041  
    8787                void  GradjDrag(_p_Vec*, void*, int,int );
    8888                void  GradjB(_p_Vec*, void*, int,int );
    89                 double Misfit(void*,int,int );
     89                double Misfit(void*,int,int,int);
    9090                void  GetNodalFunctions(double* l1l2, double gauss_coord);
    9191                void  GetParameterValue(double* pvalue, double* value_list,double gauss_coord);
  • issm/trunk/src/c/objects/Element.h

    r2333 r3041  
    3838                virtual void  GradjDrag(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type)=0;
    3939                virtual void  GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type)=0;
    40                 virtual double Misfit(void* inputs,int analysis_type,int sub_analysis_type)=0;
     40                virtual double Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real)=0;
    4141                virtual void  ComputePressure(Vec p_g)=0;
    4242                virtual double MassFlux(double* segment,double* ug)=0;
  • issm/trunk/src/c/objects/Penta.cpp

    r2956 r3041  
    39263926#undef __FUNCT__
    39273927#define __FUNCT__ "Penta::Misfit"
    3928 double Penta::Misfit(void* inputs,int analysis_type,int sub_analysis_type){
     3928double Penta::Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real){
    39293929
    39303930        double J;
     
    39453945                 * and compute Misfit*/
    39463946                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
    3947                 J=tria->Misfit(inputs,analysis_type,sub_analysis_type);
     3947                J=tria->Misfit(inputs,analysis_type,sub_analysis_type,real);
    39483948                delete tria;
    39493949                return J;
     
    39523952
    39533953                tria=(Tria*)SpawnTria(3,4,5); //grids 3, 4 and 5 make the new tria (upper face).
    3954                 J=tria->Misfit(inputs,analysis_type,sub_analysis_type);
     3954                J=tria->Misfit(inputs,analysis_type,sub_analysis_type,real);
    39553955                delete tria;
    39563956                return J;
  • issm/trunk/src/c/objects/Penta.h

    r2956 r3041  
    8888                void  GradjDrag(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type);
    8989                void  GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type);
    90                 double Misfit(void* inputs,int analysis_type,int sub_analysis_type);
     90                double Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real);
    9191               
    9292                void          GetThicknessList(double* thickness_list);
  • issm/trunk/src/c/objects/Sing.cpp

    r2908 r3041  
    515515#undef __FUNCT__
    516516#define __FUNCT__ "Sing::Misfit"
    517 double Sing::Misfit(void*, int,int){
     517double Sing::Misfit(void*, int,int,int){
    518518        throw ErrorException(__FUNCT__," not supported yet!");
    519519}
  • issm/trunk/src/c/objects/Sing.h

    r2333 r3041  
    8282                void  GradjDrag(_p_Vec*, void*, int,int);
    8383                void  GradjB(_p_Vec*, void*, int,int);
    84                 double Misfit(void*,int,int);
     84                double Misfit(void*,int,int,int);
    8585                double MassFlux(double* segment,double* ug);
    8686
  • issm/trunk/src/c/objects/Tria.cpp

    r2956 r3041  
    43224322#undef __FUNCT__
    43234323#define __FUNCT__ "Tria::Misfit"
    4324 double Tria::Misfit(void* vinputs,int analysis_type,int sub_analysis_type){
     4324double Tria::Misfit(void* vinputs,int analysis_type,int sub_analysis_type,int real){
    43254325
    43264326        int i;
     
    44564456
    44574457                /*Add dampening terms to misfit*/
    4458                 if (strcmp(numpar->control_type,"drag")==0){
    4459                         if (!shelf){
    4460 
     4458                if(!real){
     4459                        if (strcmp(numpar->control_type,"drag")==0){
     4460                                if (!shelf){
     4461
     4462                                        //noise dampening
     4463                                        GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
     4464                                        Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight;
     4465
     4466                                }
     4467                        }
     4468                        else if (strcmp(numpar->control_type,"B")==0){
     4469                                if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){
     4470                                        throw ErrorException(__FUNCT__,"parameter B not found in input");
     4471                                }
    44614472                                //noise dampening
    4462                                 GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
    4463                                 Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight;
    4464 
     4473                                GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3);
     4474                                Jelem+=numpar->cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight;
     4475
     4476                                //min dampening
     4477                                GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3);
     4478                                if(B_gauss<numpar->cm_mindmp_value){
     4479                                        Jelem+=numpar->cm_mindmp_slope*B_gauss*Jdet*gauss_weight;
     4480                                }
     4481
     4482                                //max dampening
     4483                                if(B_gauss>numpar->cm_maxdmp_value){
     4484                                        Jelem+=numpar->cm_maxdmp_slope*B_gauss*Jdet*gauss_weight;
     4485                                }
    44654486                        }
    4466                 }
    4467                 else if (strcmp(numpar->control_type,"B")==0){
    4468                         if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){
    4469                                 throw ErrorException(__FUNCT__,"parameter B not found in input");
     4487                        else{
     4488                                throw ErrorException(__FUNCT__,exprintf("%s%s","unsupported control type: ",numpar->control_type));
    44704489                        }
    4471                         //noise dampening
    4472                         GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3);
    4473                         Jelem+=numpar->cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight;
    4474 
    4475                         //min dampening
    4476                         GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3);
    4477                         if(B_gauss<numpar->cm_mindmp_value){
    4478                                 Jelem+=numpar->cm_mindmp_slope*B_gauss*Jdet*gauss_weight;
    4479                         }
    4480 
    4481                         //max dampening
    4482                         if(B_gauss>numpar->cm_maxdmp_value){
    4483                                 Jelem+=numpar->cm_maxdmp_slope*B_gauss*Jdet*gauss_weight;
    4484                         }
    4485                 }
    4486                 else{
    4487                         throw ErrorException(__FUNCT__,exprintf("%s%s","unsupported control type: ",numpar->control_type));
    44884490                }
    44894491
     
    45114513                }
    45124514                else throw ErrorException(__FUNCT__,exprintf("%s%i%s","fit type",fit," not supported yet!"));
     4515                       
    45134516
    45144517        }
     
    45184521        xfree((void**)&third_gauss_area_coord);
    45194522        xfree((void**)&gauss_weights);
    4520 
     4523               
    45214524        /*Return: */
    45224525        return Jelem;
  • issm/trunk/src/c/objects/Tria.h

    r2956 r3041  
    9999                void  SurfaceNormal(double* surface_normal, double xyz_list[3][3]);
    100100                void  GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type);
    101                 double Misfit(void* inputs,int analysis_type,int sub_analysis_type);
     101                double Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real);
    102102
    103103                void  CreatePVectorDiagnosticHoriz(Vec pg,void* inputs,int analysis_type,int sub_analysis_type);
Note: See TracChangeset for help on using the changeset viewer.