From: Renato P. <re...@gm...> - 2018-06-28 17:31:33
|
Ok, I see Roy's point. Let's start over. I have a DG system (duplicated DOFs). I calculate the aperture at the DOFs sharing coordinates (position_at_the_element _minus_ position_at_the_neighbor). I do that for all integration points. I need an ordered vector with the bigger apertures first, and I need to identify who they are (element, neighbor and integration point). I think (not sure) it *is* indeed a maxloc() problem, as long as I can have my own objects to be compared with a specialized "operator<". (I tried to get closer to "X" here ... helped?) Thanks Renato On Thu, Jun 28, 2018 at 1:08 PM, Roy Stogner <roy...@ic...> wrote: > > On Thu, 28 Jun 2018, Renato Poli wrote: > > Should I copy-paste code from NumericVector to build mine? >> Any suggestion? >> > > We're pretty far into XY Problem territory at this point. > > http://xyproblem.info/ > > What you've said about your vector is that you'll need to be able to > do a maxloc() on it, that it's describable as a "solution vector", > that you seem to interested both in sorting it and in using it with > an arbitrary value type T. That's not enough information to give > advice. > > The "arbitrary value type T" criterion rules out pretty much all of > the libMesh NumericVector subclasses (except perhaps > DistributedVector, with some work), but the "solution vector" > description in the libMesh context *implies* a NumericVector subclass > (and not the DistributedVector subclass, if you're solving an implicit > system). > > Another alternative is to sync the solution vector to all processors so >> that everybody can do the same calculation. >> > > Are you referring to the maxloc() calculation here? That wouldn't be > hard to add to NumericVector (with specializations for speed in > subclasses), and the implementation would be a lot more efficient than > serialization. But maxloc has nothing to do with the "you can't use > NumericVector with generic type T" problem, so maybe back up and > figure that out (starting with *why*, not *how*)first? > --- > Roy > |