1 #include "../../include/SimplifiedGrainRepresentation.h" 3 template <
int dim,
typename T>
8 std::cout <<
"\nTesting 'SimplifiedGrainManipulator::transferGrainIds'... " << std::endl;
20 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
21 {dealii::Point<dim> p(0.0,0.0); vertex_set[0] = p;}
22 {dealii::Point<dim> p(1.0,0.0); vertex_set[1] = p;}
23 {dealii::Point<dim> p(0.0,1.0); vertex_set[2] = p;}
24 {dealii::Point<dim> p(1.0,1.0); vertex_set[3] = p;}
37 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
38 {dealii::Point<dim> p(4.0,0.0); vertex_set[0] = p;}
39 {dealii::Point<dim> p(5.0,0.0); vertex_set[1] = p;}
40 {dealii::Point<dim> p(4.0,1.0); vertex_set[2] = p;}
41 {dealii::Point<dim> p(5.0,1.0); vertex_set[3] = p;}
54 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
55 {dealii::Point<dim> p(0.0,0.0); vertex_set[0] = p;}
56 {dealii::Point<dim> p(1.2,0.0); vertex_set[1] = p;}
57 {dealii::Point<dim> p(0.0,1.2); vertex_set[2] = p;}
58 {dealii::Point<dim> p(1.2,1.2); vertex_set[3] = p;}
71 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
72 {dealii::Point<dim> p(4.0,0.0); vertex_set[0] = p;}
73 {dealii::Point<dim> p(5.2,0.0); vertex_set[1] = p;}
74 {dealii::Point<dim> p(4.0,1.2); vertex_set[2] = p;}
75 {dealii::Point<dim> p(5.2,1.2); vertex_set[3] = p;}
83 std::vector<SimplifiedGrainRepresentation<dim>> old_grain_representations, new_grain_representations;
84 old_grain_representations.push_back(simplified_grain_representation_0);
85 old_grain_representations.push_back(simplified_grain_representation_1);
86 new_grain_representations.push_back(simplified_grain_representation_0_new);
87 new_grain_representations.push_back(simplified_grain_representation_1_new);
90 std::cout <<
"Grain ids before transfer: " << new_grain_representations.at(0).getGrainId() <<
" " << new_grain_representations.at(1).getGrainId() << std::endl;
93 simplified_grain_manipulator.
transferGrainIds(old_grain_representations, new_grain_representations);
95 std::cout <<
"Grain ids after transfer: " << new_grain_representations.at(0).getGrainId() <<
" " << new_grain_representations.at(1).getGrainId() << std::endl;
98 if ( new_grain_representations.at(0).getGrainId() == 0 and new_grain_representations.at(1).getGrainId() == 1){
101 pass = pass & result;
104 sprintf (buffer,
"Test result for 'SimplifiedGrainManipulator::transferGrainIds': %u\n", pass);
110 template <
int dim,
typename T>
115 std::cout <<
"\nTesting 'SimplifiedGrainManipulator::reassignGrains'... " << std::endl;
127 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
128 {dealii::Point<dim> p(0.0,0.0); vertex_set[0] = p;}
129 {dealii::Point<dim> p(1.0,0.0); vertex_set[1] = p;}
130 {dealii::Point<dim> p(0.0,1.0); vertex_set[2] = p;}
131 {dealii::Point<dim> p(1.0,1.0); vertex_set[3] = p;}
144 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
145 {dealii::Point<dim> p(4.0,0.0); vertex_set[0] = p;}
146 {dealii::Point<dim> p(5.0,0.0); vertex_set[1] = p;}
147 {dealii::Point<dim> p(4.0,1.0); vertex_set[2] = p;}
148 {dealii::Point<dim> p(5.0,1.0); vertex_set[3] = p;}
161 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
162 {dealii::Point<dim> p(0.0,0.0); vertex_set[0] = p;}
163 {dealii::Point<dim> p(1.2,0.0); vertex_set[1] = p;}
164 {dealii::Point<dim> p(0.0,1.2); vertex_set[2] = p;}
165 {dealii::Point<dim> p(1.2,1.2); vertex_set[3] = p;}
174 std::vector<SimplifiedGrainRepresentation<dim>> grain_representations;
175 grain_representations.push_back(simplified_grain_representation_0);
176 grain_representations.push_back(simplified_grain_representation_1);
177 grain_representations.push_back(simplified_grain_representation_2);
179 std::vector<unsigned int> order_parameter_id_list;
180 order_parameter_id_list.push_back(0);
181 order_parameter_id_list.push_back(1);
190 simplified_grain_manipulator.
reassignGrains(grain_representations, 0.5, order_parameter_id_list);
197 if ( grain_representations.at(0).getOrderParameterId() == 1 and grain_representations.at(1).getOrderParameterId() == 1 and grain_representations.at(2).getOrderParameterId() == 0){
201 sprintf (buffer,
"Subtest 1 result for 'SimplifiedGrainManipulator::reassignGrains': %u\n", result);
204 pass = pass & result;
215 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
216 {dealii::Point<dim> p(0.0,0.0); vertex_set[0] = p;}
217 {dealii::Point<dim> p(1.0,0.0); vertex_set[1] = p;}
218 {dealii::Point<dim> p(0.0,1.0); vertex_set[2] = p;}
219 {dealii::Point<dim> p(1.0,1.0); vertex_set[3] = p;}
232 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
233 {dealii::Point<dim> p(4.0,0.0); vertex_set[0] = p;}
234 {dealii::Point<dim> p(5.0,0.0); vertex_set[1] = p;}
235 {dealii::Point<dim> p(4.0,1.0); vertex_set[2] = p;}
236 {dealii::Point<dim> p(5.0,1.0); vertex_set[3] = p;}
249 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
250 {dealii::Point<dim> p(2.0,2.0); vertex_set[0] = p;}
251 {dealii::Point<dim> p(3.0,2.0); vertex_set[1] = p;}
252 {dealii::Point<dim> p(2.0,3.0); vertex_set[2] = p;}
253 {dealii::Point<dim> p(3.0,3.0); vertex_set[3] = p;}
262 std::vector<SimplifiedGrainRepresentation<dim>> grain_representations;
263 grain_representations.push_back(simplified_grain_representation_0);
264 grain_representations.push_back(simplified_grain_representation_1);
265 grain_representations.push_back(simplified_grain_representation_2);
267 std::vector<unsigned int> order_parameter_id_list;
268 order_parameter_id_list.push_back(0);
269 order_parameter_id_list.push_back(1);
279 simplified_grain_manipulator.
reassignGrains(grain_representations, 0.5, order_parameter_id_list);
288 if ( grain_representations.at(0).getOrderParameterId() == 0 and grain_representations.at(1).getOrderParameterId() == 1 and grain_representations.at(2).getOrderParameterId() == 0){
292 sprintf (buffer,
"Subtest 2 result for 'SimplifiedGrainManipulator::reassignGrains': %u\n", result);
295 pass = pass & result;
298 sprintf (buffer,
"Test result for 'SimplifiedGrainManipulator::reassignGrains': %u\n", pass);
void reassignGrains(std::vector< SimplifiedGrainRepresentation< dim >> &grain_representations, double buffer_distance, std::vector< unsigned int > order_parameter_id_list)
void setOrderParameterIndex(unsigned int _order_parameter_index)
void transferGrainIds(const std::vector< SimplifiedGrainRepresentation< dim >> &old_grain_representations, std::vector< SimplifiedGrainRepresentation< dim >> &new_grain_representations) const
void addVertexList(std::vector< dealii::Point< dim >> _vertices)
bool test_SimplifiedGrainManipulator_transferGrainIds()
bool test_SimplifiedGrainManipulator_reassignGrains()
void setGrainIndex(unsigned int _grain_index)