[Dune] Usage of insertBoundary to set ID boundaries

Andreas Dedner a.s.dedner at warwick.ac.uk
Thu Feb 13 15:45:25 CET 2014


Hi Andrea.
After grid creation the insert methods don't make sense (probably they 
should throw
an exception if called in this way....)
You need to call the insertBoundary method before you call create grid. 
Why don't/can't you
do that?
Best
Andreas

On 13/02/14 12:39, Sacconi, Andrea wrote:
> Hi Andreas,
>
> I'm fine, thanks for your answer!
> I implemented everything, but it still doesn't work as I would like.
>
> The problem is here: I did as you do, but when I call (_after_ the creation of the grid)
>
> gridFactory.insertBoundary ( numElement , faceLocalIndex , myMapper [insertionIndex] );
>
> and then I check intersection_iterator -> boundaryId(), this ID remains always 1 (the default value, I guess), and doesn't take the new value I passed the line before.
> Where am I wrong? Am I overlooking something?
>
> Cheers,
> Andrea
> __________________________________________________________
>
> Andrea Sacconi
> PhD student, Applied Mathematics
> AMMP Section, Department of Mathematics, Imperial College London,
> London SW7 2AZ, UK
> a.sacconi11 at imperial.ac.uk
>
> ________________________________________
> From: dune-bounces+a.sacconi11=imperial.ac.uk at dune-project.org [dune-bounces+a.sacconi11=imperial.ac.uk at dune-project.org] on behalf of Andreas Buhr [andreas at andreasbuhr.de]
> Sent: 12 February 2014 06:17
> To: dune at dune-project.org
> Subject: Re: [Dune] Usage of insertBoundary to set ID boundaries
>
> Hi Andrea,
>
> How are you doing? I hope
> On 02/10/2014 01:11 PM, Sacconi, Andrea wrote:
>> I would like to ask you a quick question about the method
>> insertBoundary of Alberta factory grid. I need to set the boundary
>> conditions, i.e. I would like to assign a specific ID to each segment
>> on the grid. The grid has been generated from an external mesh
>> generator, which stores boundary info in a different way.
> Yes, what you describe is possible. I am doing exactly this. You can
> give boundary segments to the grid factory. You cannot directly assign
> any properties to those boundary segments. Instead, you have to keep
> track in which order you gave it to the grid factory. After mesh
> creation, you can ask the grid factory for the insertion number of a
> given intersection. So you have to keep a data structure which tells you
> something like "the n-th boundary segment I gave to the grid factory
> belongs to neumann boundary".
>
> The way I do it (for 2D) (pseudocode):
>
> 1. Create a grid factory:
> Dune::GridFactory<GridType> gf;
>
> 2. Insert Vertices:
> for(point : points)
>    gf.insertVertex(point);
>
> 3. Insert boundary segments:
> for(segment : interesting_boundary_segments)
>    gf.insertBoundarySegment(sid);
>
> 4. Insert Triangles:
> for(triangle : triangles)
>    gf.insertElement(type, vid);
>
> Then you create the grid. On this grid, you can ask the grid factory
> whether a given intersection was inserted using "insertBoundarySegment".
> Some lines from my code:
>
> if (gf.wasInserted(*intersection_iterator)) {
>    auto index = gf.insertionIndex(*intersection_iterator);
>    std::pair<int, int> my_index =
>    dune_segment_marker_to_my_numbering[index];
>
> I hope this helps?
>
> best,
> Andreas
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune





More information about the Dune mailing list