📄 qbrep.h
字号:
const double* control_point_indices; int degree1; int degree2; int patchdim; PatchType ptype; }; Patchinfo_ get_patch_(const Face_Spec& fspec, int patchind) const;public: PatchMath_for_Brep patchmath(const Face_Spec& fspec, PatchIndex patchind) const { Patchinfo_ pi = get_patch_(fspec, patchind); return PatchMath_for_Brep(pi.ptype, *this, pi.control_point_indices, pi.patchdim, pi.degree1, pi.degree2); } int patch_degree1(const Face_Spec& fspec, PatchIndex patchind) const { Patchinfo_ pi = get_patch_(fspec, patchind); return pi.degree1; } int patch_degree2(const Face_Spec& fspec, PatchIndex patchind) const { Patchinfo_ pi = get_patch_(fspec, patchind); return pi.degree2; } PatchType patch_type(const Face_Spec& fspec, PatchIndex patchind) const { Patchinfo_ pi = get_patch_(fspec, patchind); return pi.ptype; } ControlPointIndex patch_control_point(const Face_Spec& fspec, PatchIndex patchind, int cpindex) const { Patchinfo_ pi = get_patch_(fspec, patchind); return static_cast<int>(pi.control_point_indices[cpindex]); } int face_number_of_patches(const Face_Spec& fspec) const; // ------------------------------------------------------------------ // class QMG::Brep::Loop_over_patches_of_face // This class is for iterating over all patches of a topological face. // The usage is: // for (Brep::Loop_over_patches_of_face patch(g,fspec); patch.notdone(); // ++patch()) { Use patch.X here } class Loop_over_patches_of_face; friend class Loop_over_patches_of_face; class Loop_over_patches_of_face { const Brep& brep_; const Face_Spec& fspec_; PatchIndex count_; int num_patches_; Patchinfo_ pi_; // no copying, no assignment Loop_over_patches_of_face(const Loop_over_patches_of_face& o): brep_(o.brep_), fspec_(o.fspec_) { } void operator=(const Loop_over_patches_of_face&) { } public: Loop_over_patches_of_face(const Brep& g, const Face_Spec& f) : brep_(g), fspec_(f) { num_patches_ = g.face_number_of_patches(f); count_ = 0; if (num_patches_ > 0) pi_ = g.get_patch_(f,0); } void operator++() { ++count_; if (count_ < num_patches_) pi_ = brep_.get_patch_(fspec_,count_); } bool notdone() const {return count_ < num_patches_;} int degree1() const {return pi_.degree1;} int degree2() const {return pi_.degree2;} PatchType ptype() const {return pi_.ptype;} PatchIndex index() const {return count_;} ControlPointIndex control_point(int j) const { return static_cast<int>(pi_.control_point_indices[j]); } PatchMath_for_Brep patchmath() const { return brep_.patchmath(fspec_, count_); } }; // ------------------------------------------------------------------ // class QMG::Brep::Loop_over_propvals_of_face // This class is for iterating over all property-value pairs of a topological face. // The usage is: // for (Brep::Loop_over_propvals_of_face pvloop(g, fspec); pvloop.notdone(); // ++pvloop) { Use pvloop.prop() and pvloop.val() } class Loop_over_propvals_of_face; friend class Loop_over_propvals_of_face; class Loop_over_propvals_of_face { const mxArray* pvlist_; int count_; int num_propvals_; // no copying, no assignment Loop_over_propvals_of_face(const Loop_over_propvals_of_face&) { } void operator=(const Loop_over_propvals_of_face&) { } public: Loop_over_propvals_of_face(const Brep& g, const Face_Spec& f); void operator++() {++count_;} bool notdone() const {return count_ < num_propvals_;} string prop() const; string val() const; }; // ------------------------------------------------------------------ // class QMG::Brep::Loop_over_propvals_of_brep // This class is for iterating over all property-value pairs of the rep // The usage is: // for (Brep::Loop_over_propvals_of_face brep(g); pvloop.notdone(); // ++pvloop) { Use pvloop.prop() and pvloop.val() } class Loop_over_propvals_of_brep; friend class Loop_over_propvals_of_brep; class Loop_over_propvals_of_brep { const mxArray* pvlist_; int count_; int num_propvals_; // no copying, no assignment Loop_over_propvals_of_brep(const Loop_over_propvals_of_brep&) { } void operator=(const Loop_over_propvals_of_brep&) { } public: explicit Loop_over_propvals_of_brep(const Brep& g); void operator++() {++count_;} bool notdone() const {return count_ < num_propvals_;} string prop() const; string val() const; }; // ------------------------------------------------------------------ // class Brep::Face_Labeling<T> // A data structure to that allows brep faces to be labeled with // elements of data type T. // To construct one, use Brep::Face_Labeling<T> lbl1(g, {,t}) // where g is a brep and t is the default value for faces // not explicitly assigned a label. // To set a label use // lbl1(fspec) = value; // To read it // t = lbl1(fspec); template<class T> class Face_Labeling { map<Face_Spec, T> labels_; typedef map <Face_Spec, T> MapType;#ifdef NEED_TYPENAME_KEYWD typedef typename map<Face_Spec,T>::iterator FaceLabelIt; typedef typename MapType::const_iterator FaceLabelCIt;#else typedef MapType::iterator FaceLabelIt; typedef MapType::const_iterator FaceLabelCIt;#endif T default_label_; // no copying, no assignment Face_Labeling(const Face_Labeling<T>& ) { } void operator=(const Face_Labeling<T>&) { } public: explicit Face_Labeling(const Brep&, const T& default1 = T()) : default_label_(default1) { } T& operator()(const Face_Spec& fspec) { FaceLabelIt it = labels_.find(fspec); if (it == labels_.end()) { labels_[fspec] = default_label_; return labels_[fspec]; } else { return it -> second; } } const T& operator()(const Face_Spec& fspec) const { FaceLabelCIt it = labels_.find(fspec); if (it == labels_.end()) { return default_label_; } else { return it -> second; } } ~Face_Labeling() { } }; class Ancestor_Lookup; // g.gdim() returns the intrinsic dimension of the brep int gdim() const { return c_gdim_; } // g.embedded_dim() returns the embedded dimension of the brep int embedded_dim() const { return c_embedded_dim_; } // g.num_control_points() returns the total number of control points of the brep. int num_control_points() const { return c_num_control_points_; } // g.control_point(i,j) returns coordinate entry j of control point i. Real control_point(ControlPointIndex i, int d) const {#ifdef RANGECHECK if (i < 0 || i >= c_num_control_points_ || d < 0 || d >= c_embedded_dim_) throw_error("Range error in Brep::control_point");#endif return c_control_points_[i * c_embedded_dim_ + d]; } // g.face_lookup_propval(fspec, prop) looks up the value associated with // property prop for topological face fspec. If no such property exists, // the null string is returned. string face_lookup_prop_val(const Face_Spec& fspec, const string& property) const; string lookup_brep_propval(const string& property) const; double scale_factor() const; // g.face_name(fspec) gives the name of a face. string face_name(const Face_Spec& fspec) const; virtual ~Brep() { }};// ------------------------------------------------------------------// A derived class that takes a pointer to the C-data structure// for a brep and constructs the auxiliary data item. // class QMG::Brep_From_FrontEnd : public QMG::Brep { public: explicit Brep_From_FrontEnd(const mxArray* mesh); ~Brep_From_FrontEnd(); // Destructive copy & destructive copy using standard // helper class.private: class Brep_From_FrontEnd_Returnval { private: friend class Brep_From_FrontEnd; Brep_From_FrontEnd& sref_; Brep_From_FrontEnd_Returnval(Brep_From_FrontEnd& s, int) : sref_(s) { } };public: // destructive copy semantics (like auto_ptr) Brep_From_FrontEnd(Brep_From_FrontEnd& other); Brep_From_FrontEnd(const Brep_From_FrontEnd_Returnval& sucr); operator Brep_From_FrontEnd_Returnval() { return Brep_From_FrontEnd_Returnval(*this, 0); }};extern QMG::ostream& operator<<(QMG::ostream& s, const QMG::Brep& brep);extern QMG::ostream& operator<<(QMG::ostream& s, const QMG::Brep::Face_Spec& fspec);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -