Skip to content
Snippets Groups Projects
Select Git revision
  • 40eb9085e44794f83e7626dc6946111a67dc525a
  • master default protected
  • NewDistributionGmshFWI
  • parametrizationSimpleWave
  • tuto_obstacle
  • everything
  • cleanup_configuuration_mesh
  • fix
  • source_estimation
  • unique_ptr
  • SobolevDirectionalFilter
  • OT
  • newPhysics
  • SimultaneousFrequency
  • SobolevDistance
  • BonesImaging
  • MultiParameter
  • UpdateAntho
  • v2.0
  • v1.0
20 results

updater.cpp

Blame
  • updater.cpp 1.54 KiB
    #include "updater.h"
    #include "../wave/updater.h"
    
    template<Physic T_Physic>
    void DataUpdater<T_Physic>::update(Type type, const ModelStateEvaluator& m)
    {
        if(_ds._isUpToDate[type]){return;}
    
        std::array<bool,4> waveNeedToBeUpToDate = {false,false,false,false};
        switch (type)
        {
            case Type::F:
                waveNeedToBeUpToDate[Type::F] = true;
                _ds._state[type].value( (_wu->get(waveNeedToBeUpToDate,m)).state(type) );
                break;
            case Type::A: case Type::D:
                update(Type::F,m);
                _ds._state[type] = _objective->update(type,_ds);
                break;
            case Type::PF:
                waveNeedToBeUpToDate[Type::PF] = true;
                _ds._state[type].value( (_wu->get(waveNeedToBeUpToDate,m)).state(type) );
                break;
            case Type::PA:
                update(Type::F,m);
                update(Type::PF,m);
                _ds._state[type] = _objective->update(type,_ds);
                break;
        }
    
        _ds._isUpToDate[type] = true;
    }
    
    template<Physic T_Physic>
    const DataStateEvaluator<T_Physic>& DataUpdater<T_Physic>::get(std::array<bool,5> needToBeUpToDate, const ModelStateEvaluator& m)
    {
        for (unsigned int t = 0; t < 5; t++)
        {
            Type type = ((Type) t);
            if(needToBeUpToDate[type]){update(type,m);}
        }
        return _ds;
    }
    
    template<Physic T_Physic>
    void DataUpdater<T_Physic>::isObsolete(std::array<bool,5> NoMoreUpToDate)
    {
        for (unsigned int t = 0; t < 5; t++)
        {
            if(NoMoreUpToDate[t]){_ds._isUpToDate[t] = false;}
        }
    }
    
    template class DataUpdater<Physic::acoustic>;