Hi Pham!
>From your description I do not really get why you are specifically doing 
this, so maybe consider the following:
I assume, you are flagging cells material ids on one locally owned part due 
to some custom condition - lets say some stress or function, 
you cannot formulate in the global coordinate system, so that you cannot 
decide on the material id simply using cell->center() or similar strategies.

The workaround i came up with is as follows:
Every cell is only flagged from the owning processor and needs to be 
communicated to other parts of the 
p::d:tria afterwards, where those elements are ghosts.
->As a consequence, ghost cells have different material ids depending on 
the side, from which they are viewed from, 
which is what we want to get rid of.

So firstly, create - in my case I already had such a space in use - the 
simplest possible discontinuous (!) function space,
e.g. with FE_DGQ(degree=0). 

Then, you loop over the locally owned cells and assemble simply the 
material id. - similar to 
assembling e.g. the right hand side. (Here the discontinuity of the 
function space in use comes into play, since you do not 
want to mix contributions from different elements (or you consider the 
internal nodes for C0, but at least 2nd order functions).
 
After that, you of course compress and convert to a ghosted vector - 
meaning, that you now have access to the entries of the vectors
in the ghost cells as well - which now contain your material ids.

So finally, you loop over locally owned AND ghosted cells - and set the 
material id in both from the vector you got, 
which is now accessible from the cells you need.

The above approach might not be the fastest one, but if you can reuse some 
space it might not be too bad.
If someone reading this sees any flaw I am currently not aware of, please 
let me know! - I am new to both C++ and dealii ; )

Kind regards & good luck coding that up!
Richard


Am Dienstag, 3. September 2019 04:49:03 UTC+2 schrieb Phạm Ngọc Kiên:
>
> Dear Prof. Wolfgang Bangerth,
> As the file is too large, I send it again in a compressed file in the 
> attachment.
> I am sorry for my mistake.
> Best regards,
> Kien
>
> Vào Th 3, 3 thg 9, 2019 vào lúc 10:50 Phạm Ngọc Kiên <
> ngockie...@gmail.com <javascript:>> đã viết:
>
>> Dear Prof. Wolfgang Bangerth,
>> The attachment is my codes and the mesh for loading grid.
>> I think that when I run the codes on a single computer, it might take 
>> longer time than run the codes on cluster.
>>
>> I would like to thank you very much for your great guidance.
>> Best regards,
>> Kien
>>
>> Vào Th 6, 30 thg 8, 2019 vào lúc 12:35 Wolfgang Bangerth <
>> bang...@colostate.edu <javascript:>> đã viết:
>>
>>> On 8/29/19 6:31 PM, Phạm Ngọc Kiên wrote:
>>> > 
>>> > When I run the codes in my computer, it takes  a lot of time for p4est 
>>> to load 
>>> > the grid.
>>> > The loading grid  step is more time consuming than solving the system 
>>> of 
>>> > equations with a mesh containing about 100,000 cells.
>>>
>>> It *shouldn't* take that long, but who knows what exactly is happening 
>>> with 
>>> such big meshes. Do you think you can create a small testcase that 
>>> demonstrates this? It should really only contain of the code to read the 
>>> mesh, 
>>> and the file with the mesh itself.
>>>
>>> Best
>>>   W.
>>>
>>> -- 
>>> ------------------------------------------------------------------------
>>> Wolfgang Bangerth          email:                 bang...@colostate.edu 
>>> <javascript:>
>>>                             www: 
>>> http://www.math.colostate.edu/~bangerth/
>>>
>>> -- 
>>> 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 dea...@googlegroups.com <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/dealii/246cfed4-41cb-d051-022e-6b9c7f1d8e91%40colostate.edu
>>> .
>>>
>>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/9a839162-2c7f-4b32-befa-4a0f2a703a52%40googlegroups.com.

Reply via email to