Hi Zhidong,
On Monday, October 21, 2019 at 1:42:30 AM UTC+2, Zhidong Brian Zhang wrote:
>
> Thank you very much for your prompt reply, Konrad!
>
> My confusion is the output of cell->id(), for example,
> 0_3:000
> 0_3:200
> 0_3:003
> 0_3:006
> 0_3:406
> 0_3:606
> 0_3:206
> 0_3:007
> 0_3:407
> 0_3:607
> 0_3:207.
>
> What type I need to use as the key in std::map? And is the map
> parallel-distributed? Because my model requires that.
>
> You can use the CellId object as a key itself:
std::map<CellId, ClassWithCellInfo> cell_info_map;
If you need the map distributed across nodes according to the distribution
of cells then you can initialize the map (on each node separately) through
for (; cell!=endc; ++cell)
{
if (cell->is_locally_owned())
{
CellId current_cell_id(cell->id());
std::pair<typename std::map<CellId, ClassWithCellInfo>::iterator, bool >
result;
result = cell_basis_map.insert(std::make_pair(cell->id(),
cell_info_map));
// ClassWithCellInfo must have a copy constructor
Assert(result.second,
ExcMessage ("Insertion of cell_info_map into std::map failed. "
"Problem with copy constructor?"));
} // end if
} // end ++cell
Best,
Konrad
--
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/51256993-cd1b-487d-82a4-ee08ce56c501%40googlegroups.com.