On Tue, 7 Aug 2012, Ataollah Mesgarnejad wrote:
> I'm trying to impose some irreversibility bounds on my system that requires
> updating bounds based on the previous time step solution. Is there a trick to
> do this ?
>
> I tried to pass:
>
> void FormBounds(NumericVector<Number>& XL,NumericVector<Number>&
> XU,TransientNonlinearImplicitSystem& sys);
>
> as "system.nonlinear_solver->bounds" so I can use system.old_local_solution;
> but I get a type mismatch error:
>
> vfmfe-init.C:174:43: Assigning to 'void (*)(NumericVector<Number> &,
> NumericVector<Number> &, sys_type &)' from incompatible type 'void
> (NumericVector<Number> &, NumericVector<Number> &,
> TransientNonlinearImplicitSystem &)': type mismatch at 3rd parameter
> ('sys_type &' (aka 'libMesh::NonlinearImplicitSystem &') vs
> 'TransientNonlinearImplicitSystem &' (aka
> 'TransientSystem<libMesh::NonlinearImplicitSystem> &'))
Change the declaration type to NonlinearImplicitSystem&, but then do a
TransientNonlinearImplicitSystem& realsys =
libmesh_cast_ptr<TransientNonlinearImplicitSystem&>(sys);
in FormBounds to get a reference from which you can grab
old_local_solution.
AFAIK there's no less hackish way to pass derived types through C/C++
callbacks; for type safety we'd need to use a functor-based interface
instead.
---
Roy
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users