Class documentation of Concepts

Loading...
Searching...
No Matches
facetteTraceTypes.hh
Go to the documentation of this file.
1
11#ifndef facetteTracetypes_hh
12#define facetteTracetypes_hh
13
14#define FacetteTraceDeconstr_D 0
15
16
17#include <map>
18#include "geometry/semantics.hh"
21#include "toolbox/hashMap.hh"
22
23namespace concepts {
24
33 template<class NormalVectorRule>
35 public:
36 enum traceTypes { FIRST, MEAN, JUMP, PLUS, MINUS, BDD };
37
38 //by default look outward first and use first trace only
39 FacetteTraceType(): type_(FIRST), normalVectorRule_(NormalVectorRule().clone()) {}
40
42 type_(fttype.type_), normalVectorRule_(fttype.normalVectorRule_->clone()){}
43
44
45 FacetteTraceType(const enum traceTypes type,const NormalVectorRule& normalVectorRule= NormalVectorRule()):
46 type_(type), normalVectorRule_(normalVectorRule.clone()){}
47
48 virtual ~FacetteTraceType(){
49 DEBUGL(FacetteTraceDeconstr_D, "Delete done.")
50 }
51
53 if (&fttype != this) {
54 type_ = fttype.type_;
55 normalVectorRule_.reset(fttype.normalVectorRule_->clone());
56 }
57 return *this;
58 }
59
61 std::string typeStr() const{
62 switch(type_) {
63 case FIRST : return "FIRST"; break;
64 case MEAN : return "MEAN"; break;
65 case JUMP : return "JUMP"; break;
66 case PLUS : return "PLUS"; break;
67 case MINUS : return "MINUS"; break;
68 default: return "UNDEFINED";
69 }
70 }
71
72 enum traceTypes type() const { return type_; }
73
74 const NormalVectorRule& rule() const{return *normalVectorRule_;}
75
76 protected:
77 virtual std::ostream& info(std::ostream& os) const{
78 return os << concepts::typeOf(*this)<<" ("<< typeStr() <<", "<< *normalVectorRule_<<")";
79 }
80 private :
81 //trace Type
82 enum traceTypes type_;
83 //normalvectorrule
84 std::unique_ptr< NormalVectorRule> normalVectorRule_;
85 };
86
87
101 template<class NormalVectorRule>
102 class FacetteTraceTypes : public Semantics<FacetteTraceType<NormalVectorRule> > {
103 public:
104
108
113 DEBUGL(FacetteTraceDeconstr_D, "Delete done.")
114 }
115
124 typename std::map<uint,FacetteTraceType<NormalVectorRule> >::const_iterator i = facetteTraceTypes_.find(attrib.attrib());
125 DEBUGL(FacetteTraceDeconstr_D, "i = " << i->second)
126 assert( i != facetteTraceTypes_.end());
127 return i->second;
128 }
129
130
141 facetteTraceTypes_[attrib.attrib()]= fttObject;
142 }
143
145 Set<Attribute>::const_iterator iter = attrib.begin();
146 for( ; iter != attrib.end(); iter++){
147 facetteTraceTypes_[iter->attrib()]= fttObject;
148 }
149 }
150
156 typename std::map<uint, FacetteTraceType<NormalVectorRule> >::const_iterator iter = facetteTraceTypes_.begin();
157 for( ; iter!= facetteTraceTypes_.end();iter++){
158 domain.insert(iter->first);
159 }
160 return domain;
161 }
162
163 protected:
164 virtual std::ostream& info(std::ostream& os) const{
165 os<< concepts::typeOf(*this)<<"["<<std::endl;
166 typename std::map<uint,FacetteTraceType<NormalVectorRule> >::const_iterator iter = facetteTraceTypes_.begin();
167 for( ; iter!= facetteTraceTypes_.end();iter++){
168 os << "Attribute("<<iter->first<<") --> "<<(facetteTraceTypes_[iter->first])<<std::endl;
169 }
170 return os<<"]";
171 }
172 private:
176 mutable std::map<uint, FacetteTraceType<NormalVectorRule> > facetteTraceTypes_;
177 };
178
179
180
181} // namespace concepts
182
183#endif // facetteTracetypes_hh
uint attrib() const
Returns the attribute.
Definition connector.hh:38
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
std::string typeStr() const
Return the type of the edgeTraceType as output string.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void add(const Attribute &attrib, const FacetteTraceType< NormalVectorRule > &fttObject)
virtual FacetteTraceType< NormalVectorRule > operator()(Attribute attrib) const
#define DEBUGL(doit, msg)
Definition debug.hh:40
std::string typeOf(const T &t)
Definition output.hh:43
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320