Lifting a Triangulation<2> to Triangulation<2,3>

69 views
Skip to first unread message

jaosch

unread,
Aug 19, 2024, 8:48:54 AM8/19/24
to deal.II User Group
Hello,

I am new to deal.ii and try to create a simple 2D mesh that lives in 3D space.

My starting point is the following code:

Triangulation<2> my_triangulation;
GridGenerator::hyper_ball(my_triangulation);

Is there a built-in function to convert my_triangulation to type Triangulation<2,3> so I end up with a 2D surface in 3D space?

Best regards
Jasper

Bruno Turcksin

unread,
Aug 19, 2024, 2:12:19 PM8/19/24
to deal.II User Group
Jasper,

You don't want to use GridGenerator::hyper_ball. Instead try:

Triangulation<2,3> my_triangulation;
GridGenerator::hyper_shell(my_triangulation);

Note that you need to use a triangulation where dim is different than spacedim.

Best,

Bruno

Wolfgang Bangerth

unread,
Aug 19, 2024, 5:32:00 PM8/19/24
to dea...@googlegroups.com


On 8/19/24 03:46, jaosch wrote:
>
> My starting point is the following code:
>
> Triangulation<2> my_triangulation;
> GridGenerator::hyper_ball(my_triangulation);
>
> Is there a built-in function to convert my_triangulation to type
> Triangulation<2,3> so I end up with a 2D surface in 3D space?

For some of the other functions in namespace GridGenerator, if you
declare the triangulation as
Triangulation<2,3> my_triangulation;
then everything just magically works. I recognize that
GridGenerator::hyper_ball() is one of those functions that do not take a
second template argument for spacedim!=dim.

Rather than think about how to work around this limitation, would you
perhaps be interested in simply adding the spacedim argument to the
implementation of this function and create a pull request that adds this
functionality? In the end, all that needs to happen is that the last
component of all vertex locations needs to be set to zero. We would, of
course, be quite happy to walk you through the process of creating a
pull request!

Best
Wolfgang

jaosch

unread,
Sep 10, 2024, 3:00:56 AM9/10/24
to deal.II User Group
Hi Bruno, hi Wolfgang,

thank you for the replies.

Unfortunately, using GridGenerator::hyper_shell() is not an option, as it does not allow
the inner radius to be zero. Adding spacedim != dim to GridGenerator::hyper_ball() is
a good I idea and something I might consider doing in a couple of months, once I have
gained a better understanding of the more fundamental parts of deal.ii.

Best regards
Jasper

Wolfgang Bangerth

unread,
Sep 10, 2024, 10:06:31 AM9/10/24
to dea...@googlegroups.com
On 9/10/24 01:00, jaosch wrote:
>
> Unfortunately, using GridGenerator::hyper_shell() is not an option, as it
> does not allow the inner radius to be zero. Adding spacedim != dim to
> GridGenerator::hyper_ball() is a good I idea and something I might consider
> doing in a couple of months, once I have gained a better understanding of
> the more fundamental parts of deal.ii.

Sounds good. Let us know if you have questions!

Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages