Ignore:
Timestamp:
11/30/21 18:48:37 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: done with ys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/jl/solve/elementmatrix.jl

    r26681 r26682  
    3131        display(this.values)
    3232end# }}}
     33function AddToGlobal!(Ke::ElementMatrix,Kff::IssmMatrix,Kfs::IssmMatrix)#{{{
     34
     35        #First check that the element matrix looks alright
     36        CheckConsistency(Ke)
     37
     38        #See if we need to do anything
     39        is_fset = false
     40        is_sset = false
     41        for i in 1:Ke.nrows
     42                if(Ke.fglobaldoflist[i]>0) is_fset = true end
     43                if(Ke.sglobaldoflist[i]>0) is_sset = true end
     44        end
     45
     46        if is_fset
     47                AddValues!(Kff,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.fglobaldoflist,Ke.values)
     48        end
     49        if is_sset
     50                AddValues!(Kfs,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.sglobaldoflist,Ke.values)
     51        end
     52
     53end#}}}
     54function CheckConsistency(Ke::ElementMatrix)#{{{
     55
     56        for i in 1:Ke.nrows
     57                for j in 1:Ke.nrows
     58                        if(isnan(Ke.values[i,j])) error("NaN found in Element Matrix") end
     59                        if(isinf(Ke.values[i,j])) error("Inf found in Element Matrix") end
     60                        if(abs(Ke.values[i,j])>1.e+50) error("Element Matrix values exceeds 1.e+50") end
     61                end
     62        end
     63end#}}}
    3364
    3465mutable struct ElementVector#{{{
     
    5889        display(this.values)
    5990end# }}}
     91function AddToGlobal!(pe::ElementVector,pf::IssmVector)#{{{
     92
     93        #First check that the element matrix looks alright
     94        CheckConsistency(pe)
     95
     96        #See if we need to do anything
     97        is_fset = false
     98        for i in 1:pe.nrows
     99                if(pe.fglobaldoflist[i]>0)
     100                        is_fset = true
     101                        break
     102                end
     103        end
     104
     105        if is_fset
     106                AddValues!(pf,pe.nrows,pe.fglobaldoflist,pe.values)
     107        end
     108
     109end#}}}
     110function CheckConsistency(pe::ElementVector)#{{{
     111
     112        for i in 1:pe.nrows
     113                if(isnan(pe.values[i])) error("NaN found in Element Vector") end
     114                if(isinf(pe.values[i])) error("Inf found in Element Vector") end
     115                if(abs(pe.values[i])>1.e+50) error("Element Vector values exceeds 1.e+50") end
     116        end
     117end#}}}
Note: See TracChangeset for help on using the changeset viewer.