# Omp private object inside a derived type

**URL:** <https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174>\
**Category:** Help\
**Created:** [July 2, 2020, 8:42pm UTC](https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174 "2020-07-02T20:42:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Seba](https://fortran-lang.discourse.group/u/Seba)\
**Post date:** [July 2, 2020, 8:42pm UTC](https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174/1 "2020-07-02T20:42:22Z")

</div>

Is there a way of making PRIVATE only a given element of a derived type while keeping the others SHARED inside an openMP region? Thanks.

---

<div class="post-metadata">

**Author:** ![sblionel](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/sblionel/32/853_2.png) [@sblionel](https://fortran-lang.discourse.group/u/sblionel)\
**Post date:** [July 2, 2020, 10:38pm UTC](https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174/2 "2020-07-02T22:38:10Z")

</div>

No, there isn’t that I am aware of. You would need to separate these out into distinct variables.

---

<div class="post-metadata">

**Author:** ![Seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Seba](https://fortran-lang.discourse.group/u/Seba)\
**Post date:** [July 3, 2020, 7:46am UTC](https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174/3 "2020-07-03T07:46:15Z")

</div>

Thanks Steve. I don’t see that as an option since that would mean re-factoring huge amounts of code… Would this be something to add into Fortran 202X?.

---

<div class="post-metadata">

**Author:** ![sblionel](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/sblionel/32/853_2.png) [@sblionel](https://fortran-lang.discourse.group/u/sblionel)\
**Post date:** [July 8, 2020, 11:09pm UTC](https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174/4 "2020-07-08T23:09:34Z")

</div>

Not in 202X, and I don’t see how Fortran could do anything for you here. Locality applies to named variables, not subobjects of variables.

---

<div class="post-metadata">

**Author:** ![Seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Seba](https://fortran-lang.discourse.group/u/Seba)\
**Post date:** [July 9, 2020, 12:17pm UTC](https://fortran-lang.discourse.group/t/omp-private-object-inside-a-derived-type/174/5 "2020-07-09T12:17:50Z")

</div>

I understand. I guess then that this is something for OMP. There should be something like ompthreadprivate declarations for these type of things. It is really important for oop code to have it. Think in a mesh object where the position is fixed, hence can be SHARED, but properties can be calculated independently for different parameters.
