qancestor.cpp

来自「算断裂的」· C++ 代码 · 共 74 行

CPP
74
字号
// ------------------------------------------------------------------// qancestor.cpp//// This file contains member functions for qancestor.  This is// a class for looking up ancestors of a brep topological face.// ------------------------------------------------------------------// Author: Stephen A. Vavasis// Copyright (c) 1999 by Cornell University.  All rights reserved.// // See the accompanying file 'Copyright' for authorship information,// the terms of the license governing this software, and disclaimers// concerning this software.// ------------------------------------------------------------------// This file is part of the QMG software.  // Version 2.0 of QMG, release date September 3, 1999.// ------------------------------------------------------------------#include "qancestor.h"// ------------------------------------------------------------------// Constructor for class for looping over ancestors.QMG::Brep::Ancestor_Lookup::Loop_over_ancestors::Loop_over_ancestors(const Ancestor_Lookup& anc,                    const Brep::Face_Spec& fspec) : anc_(anc) {  TableType::const_iterator it1 = anc.lookup_tab_.find(fspec);  if (it1 == anc.lookup_tab_.end()) {    throw_error("Inconsistent ancestor lookup");  }  current_ = (it1 -> second).begin();  end_ = (it1 -> second).end();}QMG::Brep::Ancestor_Lookup::Ancestor_Lookup(const Brep& g) {  // Insert each face as its own ancestor.  {    for (Brep::Face_Spec_Loop_Over_Faces fspec(g);    fspec.notdone();    ++fspec) {      lookup_tab_[fspec][fspec] = 1;    }  }  // In reverse order of dimension, insert each for each subface the   // ancestors of its parent.  for (int d = g.gdim(); d >= 0; --d) {    for (Brep::Face_Spec_Loop_Over_Faces_Of_Dim fspec(g, d);    fspec.notdone();    ++fspec) {      // Loop over subfaces of fspec.      for (Brep::Face_Spec_Loop_Over_Face_Subfaces subfspec(g, fspec);      subfspec.notdone();      ++subfspec) {        int increment = (subfspec.is_internal_boundary())? 2 : 1;        for (OneTableType::iterator it = lookup_tab_[fspec].begin();        it != lookup_tab_[fspec].end();        ++it) {          lookup_tab_[subfspec][it -> first] += increment;        }      }    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?