Commit a342adfc authored by Chris Cantwell's avatar Chris Cantwell
Browse files

Merge branch 'fix/icc-dynamic' into 'master'

Add fix for ICC after last merge

icc compilation is currently broken in master after the previous merge due to the `boost_dynamic_cast` bug from base to derived classes. This MR fixes the issue in the same manner as implemented inside `StdExpansion` by adding a templated `as<>()` function to `EquationSystem`.

See merge request !414
parents 68c8793c 2d327457
......@@ -115,8 +115,7 @@ void DriverSteadyState::v_Execute(ostream &out)
timer.Start();
// Definition of shared pointer (used only for the Adaptive SFD method)
AdvectionSystemSharedPtr A
= boost::dynamic_pointer_cast<AdvectionSystem>(m_equ[0]);
AdvectionSystemSharedPtr A = m_equ[0]->as<AdvectionSystem>();
// Condition necessary to run SFD for the compressible case
NumVar_SFD = m_equ[m_nequ - 1]->UpdateFields()[0]->GetCoordim(0);
......
......@@ -63,7 +63,7 @@ namespace Nektar
SOLVER_UTILS_EXPORT EquationSystemFactory& GetEquationSystemFactory();
/// A base class for describing how to solve specific equations.
class EquationSystem
class EquationSystem : public boost::enable_shared_from_this<EquationSystem>
{
public:
/// Destructor
......@@ -99,6 +99,18 @@ namespace Nektar
return m_sessionName;
}
template<class T>
boost::shared_ptr<T> as()
{
#if defined __INTEL_COMPILER && BOOST_VERSION > 105200
typedef typename boost::shared_ptr<T>::element_type E;
E * p = dynamic_cast< E* >( shared_from_this().get() );
ASSERTL1(p, "Cannot perform cast");
return boost::shared_ptr<T>( shared_from_this(), p );
#else
return boost::dynamic_pointer_cast<T>( shared_from_this() );
#endif
}
/// Reset Session name
SOLVER_UTILS_EXPORT void ResetSessionName(std::string newname)
......
......@@ -33,9 +33,7 @@ int main(int argc, char *argv[])
EquationSystemSharedPtr EqSys = drv->GetEqu()[0];
IncNavierStokesSharedPtr IncNav = boost::dynamic_pointer_cast
<IncNavierStokes>(EqSys);
IncNavierStokesSharedPtr IncNav = EqSys->as<IncNavierStokes>();
IncNav->SetInitialConditions(0.0,false);
Array<OneD, MultiRegions::ExpListSharedPtr> fields = IncNav->UpdateFields();
......
......@@ -32,9 +32,7 @@ int main(int argc, char *argv[])
EquationSystemSharedPtr EqSys = drv->GetEqu()[0];
IncNavierStokesSharedPtr IncNav = boost::dynamic_pointer_cast
<IncNavierStokes>(EqSys);
IncNavierStokesSharedPtr IncNav = EqSys->as<IncNavierStokes>();
IncNav->SetInitialConditions(0.0,false);
Array<OneD, NekDouble> cfl = IncNav->GetElmtCFLVals();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment