Hi,

somehow I do not get the following code at all:

int faceCell(int face, int local_index) const
        {
            cpgrid::OrientedEntityTable<1,0>::row_type r
                = face_to_cell_[cpgrid::EntityRep<1>(face, true)];
            bool a = (local_index == 0);
            bool b = r[0].orientation();
            bool use_first = a ? b : !b;
            if (r.size() == 2) {
                assert(r[0].orientation() != r[1].orientation());
                return use_first ? r[0].index() : r[1].index();
            } else {
                return use_first ? r[0].index() : -1;
            }
        }

What are the implicit assumption here?

For clarity I rephrase the algorithm in my own words:
If we request a cell by a local_index, then the orientation of the
first cell always tells which of the cell we will return:
- if there is only one cell, cell 0 is return for local_index 0 and
  otherwise -1 to indicate "no such cell" (->clear to me)
- if local_index==0 then it is cell 0 if the orientation of cell 0 is true
otherwise cell 1
- if local_index!=0 then it is cell 1 if the orientation of cell 0 is true
otherwise cell 0

The last two items just puzzle me.

If somewhat could comment on how this relates to
UnstructuredGrid::face_cells[2*f+local_index] I would be most
grateful.

Markus
-- 
Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany,  USt-Id: DE279960836
Tel.: +49 (0) 160 97590858

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Opm mailing list
Opm@opm-project.org
http://www.opm-project.org/mailman/listinfo/opm

Reply via email to