Thank you Roy & John! That's great help. Appreciate it :)
Best,
Shawn
On Mon, Nov 12, 2018 at 4:21 PM John Peterson <jwp...@gm...> wrote:
>
>
> On Mon, Nov 12, 2018 at 4:31 PM Stogner, Roy H <roy...@ic...>
> wrote:
>
>>
>> On Mon, 12 Nov 2018, Yuxiang Wang wrote:
>>
>> > Quick question: how do I get the n_nodes for a certain boundary set
>> (given
>> > bid)? I know I can do:
>> >
>> > MeshBase::const_node_iterator nodeit =
>> > mesh.bid_nodes_begin(NODE_BOUNDARY_ID);
>> > const MeshBase::const_node_iterator node_end =
>> > mesh.bid_nodes_end(NODE_BOUNDARY_ID);
>> >
>> > to loop through all the nodes, but would there be a way to find out how
>> > many nodes are there in the same set?
>>
>> Just std::distance, I believe.
>>
>
> This might be a bit slow, depending on what else you are doing. Another
> possibility would be to call:
>
> std::vector<std::tuple<dof_id_type, boundary_id_type>> vec
> = mesh.get_boundary_info().build_node_list();
>
> which returns a vector of _all_ the (node_id, boundary_id) pairs in the
> mesh (they will be sorted by node_id). You could then count up the number
> of entries with a specific boundary_id as needed...
>
> --
> John
>
--
Yuxiang "Shawn" Wang, PhD
yw...@vi...
+1 (434) 284-0836
|