Right now PointSource::apply searches the first entity collision, every time it is called.

This is unnecessary in many cases, and possibly wrong in others
(e.g. the nonlinear deformation of a structure, with applied non-follower, but time-varying concentrated forces)

The overhead is so high that it almost doubles the runtime of a simple time-marching code a student is developing right now (to be fair: small deformations, constant mass a stiffness matrix pre-assembled and factored).

I'd like to cache as much as possible,
and add some additional methods to

1) search again for the collision entity
2) change the source magnitude

However 1) could _silently_ break old codes.
Would this breaking be a show-stopper?

To avoid breaking old codes I could change
the definition of

void PointSource::apply(GenericVector& b)

into something like

void PointSource::apply(GenericVector& b, bool rebuild = true)

but I'd like to avoid hacks like this.

To achieve 2) I could

a) change the magnitude into a Constant
b) add a new method
c) change PointSource::apply(GenericVector& b) into
PointSource::apply(GenericVector& b, double magnitude)

The solution c) would have the "advantage" of explicitly breaking old codes, thus implicitly warning the user for 1)

Besides, the mesh bounding_box_tree used to find the colliding mesh entity is cached. I fear this could
be a source of "strange" results, because its use
is here completely transparent to the user,
who may be unaware of the need to update it.


Comments?

Thanks,

Marco
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to