MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_components_mapping

Function test_components_mapping

tests/model/test-model-mapping.cpp:119–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void test_components_mapping()
120{
121 geode::ComponentMeshVertexMapping vertices_mapping;
122 geode::ComponentMeshVertexMapping elements_mapping;
123
124 std::vector< geode::uuid > uuids_in( 3 );
125 std::vector< geode::uuid > uuids_out( 3 );
126
127 for( const auto mesh_id : geode::LRange{ 2 } )
128 {
129 for( const auto vertex_id : geode::Range{ 10 } )
130 {
131 vertices_mapping.map( { uuids_in[mesh_id], vertex_id },
132 { { geode::Line3D::component_type_static(),
133 uuids_out[mesh_id] },
134 2 * vertex_id } );
135 }
136 for( const auto element_id : geode::Range{ 8 } )
137 {
138 elements_mapping.map( { uuids_in[mesh_id], element_id },
139 { { geode::Line3D::component_type_static(),
140 uuids_out[mesh_id] },
141 8 - element_id } );
142 }
143 }
144 for( const auto vertex_id : geode::Range{ 9 } )
145 {
146 vertices_mapping.map( { uuids_in[2], vertex_id },
147 { { geode::Surface3D::component_type_static(), uuids_out[2] },
148 3 * vertex_id } );
149 }
150 for( const auto element_id : geode::Range{ 5 } )
151 {
152 elements_mapping.map( { uuids_in[2], element_id },
153 { { geode::Surface3D::component_type_static(), uuids_out[2] },
154 element_id + 2 } );
155 }
156
157 geode::OpenGeodeModelException::test(
158 vertices_mapping.size_in() == 29, "Wrong size for vertices mappings" );
159 geode::OpenGeodeModelException::test(
160 elements_mapping.size_out() == 21, "Wrong size for elements mappings" );
161 for( const auto mesh_id : geode::LRange{ 2 } )
162 {
163 for( const auto vertex_id : geode::Range{ 10 } )
164 {
165 geode::ComponentMeshVertex value{
166 { geode::Line3D::component_type_static(), uuids_out[mesh_id] },
167 2 * vertex_id
168 };
169 geode::OpenGeodeModelException::test(
170 vertices_mapping.in2out( { uuids_in[mesh_id], vertex_id } )
171 .at( 0 )
172 == value,
173 "Wrong mapping for vertices (in2out)" );
174 }
175 for( const auto element_id : geode::Range{ 8 } )
176 {

Callers 1

testFunction · 0.85

Calls 5

size_inMethod · 0.80
size_outMethod · 0.80
atMethod · 0.80
testFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected