@@ -53,7 +53,7 @@ FieldList LoadAllCasesInputField()
5353 if (!(i==31 || i==47 || i==55 || i==59 || i==61 || i==62 ))
5454 {
5555 auto file = (TestResources::rootDir () / " Fields/refinetetmeshlocally/all57outof64case_input/" ).string () + std::to_string (i) + " .mat" ;
56- FieldHandle field = MatlabField_reader (0 , file.c_str ());
56+ FieldHandle field = MatlabField_reader (0 , file.c_str ());
5757 result.push_back (field);
5858 }
5959 }
@@ -79,8 +79,8 @@ FieldList LoadAllCasesResultField()
7979
8080SparseRowMatrixHandle GetTheoreticalTetCases (int cases, int nr_nodes)
8181 {
82- SparseRowMatrixFromMap::Values result;
83-
82+ SparseRowMatrixFromMap::Values result;
83+
8484 if (cases==31 )
8585 {
8686 result[1 ][2 ]=1 ;
@@ -141,8 +141,8 @@ TEST(RefineTetMeshLocallyAlgoTests, Test59basicCutCases)
141141 FieldList result_files = LoadAllCasesResultField ();
142142
143143 double epsilon=1e-8 ;
144-
145- RefineTetMeshLocallyAlgorithm algo;
144+
145+ RefineTetMeshLocallyAlgorithm algo;
146146 algo.set (Parameters::RefineTetMeshLocallyIsoValue, 1.0 );
147147 algo.set (Parameters::RefineTetMeshLocallyEdgeLength, 0.0 );
148148 algo.set (Parameters::RefineTetMeshLocallyVolume, 0.0 );
@@ -155,31 +155,31 @@ TEST(RefineTetMeshLocallyAlgoTests, Test59basicCutCases)
155155 algo.set (Parameters::RefineTetMeshLocallyMaxNumberRefinementIterations, 1 );
156156 GetMeshNodesAlgo getfieldnodes_algo;
157157 DenseMatrixHandle output_nodes,exp_result_nodes;
158- VMesh::Node::array_type onodes1 (4 ),onodes2 (4 );
158+ VMesh::Node::array_type onodes1 (4 ),onodes2 (4 );
159159 VMesh *output_vmesh, *exp_result_vmesh;
160160 FieldHandle input,output, exp_result;
161161
162162 int count=0 ;
163163 for (int i=0 ; i<63 ; i++)
164- {
164+ {
165165 if (!(i==31 -1 || i==47 -1 || i==55 -1 || i==59 -1 || i==61 -1 || i==62 -1 ))
166- {
166+ {
167167 if (!input_files[count] || !result_files[i])
168168 {
169169 FAIL () << " ERROR: could not load data files. Please check path set in SCIRUN_TEST_RESOURCE_DIR variable (cmake). " << std::endl;
170170 }
171171 input=input_files[count++];
172172 exp_result=result_files[i];
173-
173+
174174 try
175175 {
176176 algo.runImpl (input, output);
177- } catch (...)
177+ } catch (...)
178178 {
179179 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 1 does not work. " << std::endl;
180180 }
181181 exp_result_vmesh=exp_result->vmesh ();
182- output_vmesh=output->vmesh ();
182+ output_vmesh=output->vmesh ();
183183 try
184184 {
185185 getfieldnodes_algo.run (output,output_nodes);
@@ -188,60 +188,59 @@ TEST(RefineTetMeshLocallyAlgoTests, Test59basicCutCases)
188188 {
189189 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 1 does not work (could not get field nodes from input files). " << std::endl;
190190 }
191-
191+
192192 if ( output_nodes->ncols ()!=exp_result_nodes->ncols () || output_nodes->nrows ()!=exp_result_nodes->nrows () )
193193 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 1 does not work (number of nodes is different than expected). " << std::endl;
194-
194+
195195 for (long idx=0 ;idx<exp_result_nodes->nrows ();idx++)
196196 {
197197 EXPECT_NEAR ( (*exp_result_nodes)(idx,0 ),(*output_nodes)(idx,0 ), epsilon);
198198 EXPECT_NEAR ( (*exp_result_nodes)(idx,1 ),(*output_nodes)(idx,1 ), epsilon);
199199 EXPECT_NEAR ( (*exp_result_nodes)(idx,2 ),(*output_nodes)(idx,2 ), epsilon);
200200 }
201-
201+
202202 output_vmesh->synchronize (Mesh::NODES_E);
203203 exp_result_vmesh->synchronize (Mesh::NODES_E);
204-
204+
205205 if ( output_vmesh->num_elems ()!=exp_result_vmesh->num_elems () || output_vmesh->num_elems ()!=exp_result_vmesh->num_elems () )
206206 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 1 does not work (number of elements is different than expected). " << std::endl;
207-
207+
208208 for (VMesh::Elem::index_type idx=0 ; idx<output_vmesh->num_elems (); idx++)
209209 {
210210 output_vmesh->get_nodes (onodes1, idx);
211211 exp_result_vmesh->get_nodes (onodes2, idx);
212212 for (int j=0 ;j<4 ;j++)
213213 if (onodes1[j]!=onodes2[j])
214- FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 1 does not work (definition of resulting and expected tet definition differs). " << std::endl;
214+ FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 1 does not work (definition of resulting and expected tet definition differs). " << std::endl;
215215 }
216-
216+
217217 }
218-
218+
219219 }
220-
220+
221221}
222222
223223TEST (RefineTetMeshLocallyAlgoTests, Test5MoreTheoreticalCutCases)
224224{
225225 double epsilon=1e-8 ;
226- RefineTetMeshLocallyAlgorithm algo;
226+ RefineTetMeshLocallyAlgorithm algo;
227227 VMesh::Node::array_type onodes1 (4 ),onodes2 (4 );
228228 DenseMatrixHandle output_nodes,exp_result_nodes;
229229 FieldList input_list=LoadAllCasesInputField ();
230230 FieldList result_list=LoadAllCasesResultField ();
231231 FieldHandle input=input_list[56 ];
232- int nr_nodes = input->vmesh ()->num_nodes ();
232+ int nr_nodes = input->vmesh ()->num_nodes ();
233233 SparseRowMatrixHandle case_;
234234 GetMeshNodesAlgo getfieldnodes_algo;
235- VMesh *case_vmesh, *case_exp_vmesh;
236235 int cases[] = {31 , 47 , 55 , 59 , 61 , 62 };
237236 for (int i=0 ; i<sizeof (cases)/4 ; i++)
238237 {
239238 SparseRowMatrixHandle case_=GetTheoreticalTetCases (cases[i], nr_nodes);
240- FieldHandle Casefld=algo.RefineMesh (input, case_);
239+ FieldHandle Casefld=algo.RefineMesh (input, case_);
241240 FieldHandle case_exp_result=result_list[cases[i]-1 ];
242- VMesh *case_vmesh=Casefld->vmesh ();
241+ VMesh *case_vmesh=Casefld->vmesh ();
243242 VMesh *case_exp_vmesh=case_exp_result->vmesh ();
244-
243+
245244 try
246245 {
247246 getfieldnodes_algo.run (Casefld,output_nodes);
@@ -250,32 +249,32 @@ TEST(RefineTetMeshLocallyAlgoTests, Test5MoreTheoreticalCutCases)
250249 {
251250 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 31 does not work (could not get field nodes from input files). " << std::endl;
252251 }
253-
252+
254253 if (output_nodes->ncols ()!=exp_result_nodes->ncols () || output_nodes->nrows ()!=exp_result_nodes->nrows () )
255254 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 63 does not work (number of nodes is different than expected). " << std::endl;
256-
255+
257256 for (long idx=0 ;idx<exp_result_nodes->nrows ();idx++)
258257 {
259258 EXPECT_NEAR ( (*exp_result_nodes)(idx,0 ),(*output_nodes)(idx,0 ), epsilon);
260259 EXPECT_NEAR ( (*exp_result_nodes)(idx,1 ),(*output_nodes)(idx,1 ), epsilon);
261260 EXPECT_NEAR ( (*exp_result_nodes)(idx,2 ),(*output_nodes)(idx,2 ), epsilon);
262261 }
263-
262+
264263 case_vmesh->synchronize (Mesh::NODES_E);
265264 case_exp_vmesh->synchronize (Mesh::NODES_E);
266-
265+
267266 if ( case_vmesh->num_elems ()!=case_exp_vmesh->num_elems () || case_vmesh->num_elems ()!=case_exp_vmesh->num_elems () )
268267 FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 63 does not work (number of elements is different than expected). " << std::endl;
269-
268+
270269 for (VMesh::Elem::index_type idx=0 ; idx<case_vmesh->num_elems (); idx++)
271270 {
272271 case_vmesh->get_nodes (onodes1, idx);
273272 case_exp_vmesh->get_nodes (onodes2, idx);
274273 for (int j=0 ;j<4 ;j++)
275274 if (onodes1[j]!=onodes2[j])
276- FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 63 does not work (definition of resulting and expected tet definition differs). " << std::endl;
277- }
278-
275+ FAIL () << " ERROR: RefineTetMeshLocallyAlgorithm: Case 63 does not work (definition of resulting and expected tet definition differs). " << std::endl;
276+ }
277+
279278 }
280279
281280}
0 commit comments