19 template<
typename T >
24 for(
int i = 0; i < pm->
size(); i++)
26 std::cout <<
" " <<
get(*pm, i);
27 if(i != pm->
size() - 1)
61 AIFPropHelpers::set_point(m, v0, 0.1, 0.2, 0.3);
62 AIFPropHelpers::set_point(m, v1, 1.1, 1.2, 1.3);
63 AIFPropHelpers::set_point(m, v2, 2.1, 2.2, 2.3);
64 AIFPropHelpers::set_point(m, v3, 3.1, 3.2, 3.3);
67 std::cout <<
"Input mesh:\n";
73 auto v_iter = v_range.begin();
74 auto v_end = v_range.end();
75 for(; v_iter != v_end; ++v_iter)
77 Point &p = AIFPropHelpers::get_point(m, *v_iter);
78 assert(((*v_iter) == v0 && p ==
Point(0.1, 0.2, 0.3)) ||
79 ((*v_iter) == v1 && p ==
Point(1.1, 1.2, 1.3)) ||
80 ((*v_iter) == v2 && p ==
Point(2.1, 2.2, 2.3)) ||
81 ((*v_iter) == v3 && p ==
Point(3.1, 3.2, 3.3)));
89 throw std::runtime_error(
"Failed to create property map.");
91 (*test_pm)[v0] =
Point(10.1, 10.2, 10.3);
92 (*test_pm)[v1] =
Point(11.1, 11.2, 11.3);
93 (*test_pm)[v2] =
Point(12.1, 12.2, 12.3);
97 assert(test_pm->
size() == 3);
100 auto v_iter = v_range.begin();
101 auto v_end = v_range.end();
102 for(; v_iter != v_end; ++v_iter)
104 Point &p = (*test_pm)[*v_iter];
105 assert(((*v_iter) == v0 && p ==
Point(10.1, 10.2, 10.3)) ||
106 ((*v_iter) == v1 && p ==
Point(11.1, 11.2, 11.3)) ||
107 ((*v_iter) == v2 && p ==
Point(12.1, 12.2, 12.3)) ||
114 auto v_iter = v_range.begin();
115 auto v_end = v_range.end();
116 for(; v_iter != v_end; ++v_iter)
118 Point &p = (*test_pm)[*v_iter];
119 std::cout <<
"[" << (*v_iter)->GetIndex() <<
"]: " << p[0] <<
", " << p[1]
120 <<
", " << p[2] <<
'\n';
144 (*vpm_str)[v0] =
"v0";
145 (*vpm_str)[v2] =
"v2";
146 (*vpm_str)[v1] =
"v1";
150 (*vpm_int)[vtmp0] = 9999;
154 assert(vpm_str->
size() == 4);
155 assert(vpm_int->size() == 4);
161 assert(vpm_str->
size() == 4);
162 assert(vpm_int->size() == 4);
164 (*vpm_str)[v3] =
"v3";
168 assert(vpm_str->
size() == 5);
169 assert(vpm_int->size() == 4);
180 assert(vpm_int->size() == 4);
181 assert(vpm_str->
size() == 5);
182 assert(
get(*vpm_str, 1) ==
"v3");
183 assert(
get(*vpm_int, 1) == 9999);
186 (*vpm_str)[v4] =
"v4";
191 assert(vpm_int->size() == 5);
192 assert(vpm_str->
size() == 5);
193 assert(
get(*vpm_str, 0) ==
"v0");
194 assert(
get(*vpm_str, 1) ==
"v3");
195 assert(
get(*vpm_str, 2) ==
"v1");
196 assert(
get(*vpm_str, 3) ==
"v2");
197 assert(
get(*vpm_str, 4) ==
"v4");
198 assert(
get(*vpm_int, 0) == 0);
199 assert(
get(*vpm_int, 1) == 9999);
200 assert(
get(*vpm_int, 2) == 1);
201 assert(
get(*vpm_int, 3) == 2);
202 assert(
get(*vpm_int, 4) == 4);
203 assert((*vpm_str)[v0] ==
"v0");
204 assert((*vpm_str)[v1] ==
"v1");
205 assert((*vpm_str)[v2] ==
"v2");
206 assert((*vpm_str)[v3] ==
"v3");
207 assert((*vpm_str)[v4] ==
"v4");
208 assert((*vpm_int)[v0] == 0);
209 assert((*vpm_int)[v1] == 1);
210 assert((*vpm_int)[v2] == 2);
211 assert((*vpm_int)[v3] == 9999);
212 assert((*vpm_int)[v4] == 4);
217 m->AddPropertyMap< AIFEdge::ptr, std::string >(
"e:test_str");
230 (*epm_str)[e4] =
"e4";
231 (*epm_str)[e1] =
"e1";
232 (*epm_str)[e2] =
"e2";
233 (*epm_str)[e5] =
"e5";
234 (*epm_str)[e3] =
"e3";
241 assert(epm_str->
size() == 5);
242 assert(
get(*epm_str, 0) ==
"e2");
243 assert(
get(*epm_str, 1) ==
"e1");
244 assert(
get(*epm_str, 2) ==
"e3");
245 assert(
get(*epm_str, 3) ==
"e4");
246 assert(
get(*epm_str, 4) ==
"e5");
247 assert((*epm_str)[e1] ==
"e1");
248 assert((*epm_str)[e2] ==
"e2");
249 assert((*epm_str)[e3] ==
"e3");
250 assert((*epm_str)[e4] ==
"e4");
255 m->AddPropertyMap< AIFFace::ptr,
int >(
"f:test");
270 assert(fpm->
size() == 5);
275 assert(fpm->
size() == 5);
281 assert(fpm->
size() == 5);
286 assert(fpm->
size() == 5);
305 assert(fpm->
size() == 6);
306 assert(
get(*fpm, 0) == 8);
307 assert(
get(*fpm, 1) == 4);
308 assert(
get(*fpm, 2) == 2);
309 assert(
get(*fpm, 3) == 5);
310 assert(
get(*fpm, 4) == 8);
311 assert(
get(*fpm, 5) == 7);
312 assert((*fpm)[f2] == 2);
313 assert((*fpm)[f4] == 4);
314 assert((*fpm)[f5] == 5);
315 assert((*fpm)[f8] == 8);
327 m->AddAssocPropertyMap< char,
float >(
"assoc:test");
331 assert((*pm)[
'a'] == 42.3f);
332 assert((*pm)[
'b'] == 42.5f);
334 m->RemoveAssocPropertyMap(
"assoc:test");
338 pm = m->GetAssocPropertyMap< char,
float >(
"assoc:test");
343 catch(std::runtime_error &)
349 std::cout <<
"Test passed.\n";