Changeset 17509


Ignore:
Timestamp:
03/20/14 16:48:44 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added Max function to PetscVec

Location:
issm/trunk-jpl/src/c/toolkits
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/toolkits/objects/Vector.h

    r16675 r17509  
    305305                }
    306306                /*}}}*/
     307                /*FUNCTION Max{{{*/
     308                doubletype Max(void){_assert_(this);
     309
     310                        doubletype max=0;
     311
     312                        if(type==PetscVecType){
     313                                #ifdef _HAVE_PETSC_
     314                                max=this->pvector->Max();
     315                                #endif
     316                        }
     317                        else _error_("operation not supported yet");
     318                        return max;
     319                }
     320                /*}}}*/
    307321                /*FUNCTION Norm{{{*/
    308322                doubletype Norm(NormMode norm_type){_assert_(this);
  • TabularUnified issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp

    r13880 r17509  
    188188}
    189189/*}}}*/
     190/*FUNCTION PetscVec::Max{{{*/
     191IssmDouble PetscVec::Max(void){
     192
     193        _assert_(this->vector);
     194
     195        IssmDouble max;
     196        VecMax(this->vector,NULL,&max);
     197        return max;
     198
     199}
     200/*}}}*/
    190201/*FUNCTION PetscVec::Norm{{{*/
    191202IssmDouble PetscVec::Norm(NormMode mode){
  • TabularUnified issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h

    r14917 r17509  
    3838
    3939                /*PetscVec specific routines*/
    40                 void Echo(void);
    41                 void Assemble(void);
    42                 void SetValues(int ssize, int* list, IssmDouble* values, InsMode mode);
    43                 void SetValue(int dof, IssmDouble value, InsMode  mode);
    44                 void GetValue(IssmDouble* pvalue, int dof);
    45                 void GetSize(int* pM);
    46                 void GetLocalSize(int* pM);
    47                 PetscVec* Duplicate(void);
    48                 void Set(IssmDouble value);
    49                 void AXPY(PetscVec* X, IssmDouble a);
    50                 void AYPX(PetscVec* X, IssmDouble a);
     40                void        Echo(void);
     41                void        Assemble(void);
     42                void        SetValues(int ssize, int* list, IssmDouble* values, InsMode mode);
     43                void        SetValue(int dof, IssmDouble value, InsMode  mode);
     44                void        GetValue(IssmDouble* pvalue, int dof);
     45                void        GetSize(int* pM);
     46                void        GetLocalSize(int* pM);
     47                PetscVec*   Duplicate(void);
     48                void        Set(IssmDouble value);
     49                void        AXPY(PetscVec* X, IssmDouble a);
     50                void        AYPX(PetscVec* X, IssmDouble a);
    5151                IssmDouble* ToMPISerial(void);
    52                 void Copy(PetscVec* to);
    53                 IssmDouble Norm(NormMode norm_type);
    54                 void Scale(IssmDouble scale_factor);
    55                 void PointwiseDivide(PetscVec* x,PetscVec* y);
    56                 IssmDouble Dot(PetscVec* vector);
     52                void        Copy(PetscVec* to);
     53                IssmDouble  Norm(NormMode norm_type);
     54                IssmDouble  Max(void);
     55                void        Scale(IssmDouble scale_factor);
     56                void        PointwiseDivide(PetscVec* x,PetscVec* y);
     57                IssmDouble  Dot(PetscVec* vector);
    5758};
    5859
Note: See TracChangeset for help on using the changeset viewer.