Hi Simon,
you don't need to modify the point class. You can simply pas to the
constructor of the set a comparator. See the first answer
in https://stackoverflow.com/questions/2620862/using-custom-stdset-comparator.
Hope this helps,
PM
On Sunday, 27 June 2021 at 12:15:40 UTC+2 Simon wrote:
> Dear all,
>
> I am trying to create a set of Points<dim>, i.e std::set<Point<dim>>.
> I get a quite extensive error message when trying to insert a point in the
> set but for my understanding of the message, the only problem is the
> missing operator< for two points.
> (Well I could make use of a std::vector instead but a std::set fits much
> better for my issue since (i) I need to insert points at arbitrary
> positions quite often and second (ii) wanna make sure that a given Point is
> only once in the container.)
>
> But irrespective of what container I use, I would like to supplement the
> Point Class by adding the 'operator<' like in the following:
>
> template<int dim, typename Number=double>
> bool Point<dim>::operator< (const Point<dim,Number>& p)
> {
> //...some Asserts
> return this.norm()<p.norm();
> }
>
> Of course I can not write this piece of code since there is no declaration
> for a member function 'operator<' in the Point Class.
> For that reasons my next idea was to modify the file <deal.II/base/point.h
> <https://www.dealii.org/current/doxygen/deal.II/base_2point_8h_source.html>>
> by simply adding the missing operator< declaration and the corresponding
> definition. So I did this but without effect, probably because all the
> files of the dealii-library are already compiled and executing my program
> via 'make run' did not see my changes in the Point Class at all. (I also
> added a dummy command, std::cout<<"...Test..."<<std::endl, which did not
> appear on my screen either.)
>
> I am only familiar with basic cmake- and make-commands.
> My question is if it is possible to recompile one specific file of the
> library again?
> So if this were possible I would appreciate getting some guidance for
> implementing this.
> I would also be interested in writing a patch for that issue.
>
> Best
> Simon
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/34faa5ae-9bed-4a66-ad9f-cb2bb59d7ba1n%40googlegroups.com.