On Mon, 22 Jun 2015 14:47:57 +0100 "Garth N. Wells" <[email protected]> wrote:
> On 22 June 2015 at 14:37, Marco Morandini <[email protected]> > wrote: > > 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) > > > > I think this is fine. > > > 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. > > > > I really don't like magical caching. How about having > > PointSource::apply(GenericVector& b, Cell& c, double magnitude); > > The user is responsible for finding the cell, and thereby also > responsible for handling meshes that move, etc. > > PointSource::apply(...) presently uses Mesh::bounding_box_tree(), > which I would like to get rid of from Mesh since mesh geometry is > mutable. If the search tools are not cached, the user takes > responsibility for managing the bounding boxes. For the record, this issue is filed as https://bitbucket.org/fenics-project/dolfin/issue/89 Jan > > Garth > > > > > > Comments? > > > > Thanks, > > > > Marco > > _______________________________________________ > > fenics mailing list > > [email protected] > > http://fenicsproject.org/mailman/listinfo/fenics > _______________________________________________ > fenics mailing list > [email protected] > http://fenicsproject.org/mailman/listinfo/fenics _______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
