1 #include "../../include/SimplifiedGrainRepresentation.h" 3 template <
int dim,
typename T>
8 std::cout <<
"\nTesting 'SimplifiedGrainRepresentation'... " << std::endl;
18 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
19 {dealii::Point<dim> p(0.0,0.75); vertex_set[0] = p;}
20 {dealii::Point<dim> p(0.25,0.75); vertex_set[1] = p;}
21 {dealii::Point<dim> p(0.0,1.0); vertex_set[2] = p;}
22 {dealii::Point<dim> p(0.25,1.0); vertex_set[3] = p;}
28 std::cout <<
"Centroid: " << simplified_grain_representation.
getCenter() << std::endl;
29 std::cout <<
"Radius: " << simplified_grain_representation.
getRadius() << std::endl;
32 if ( (std::abs(simplified_grain_representation.
getCenter()(0) - 0.125) < 1.0e-10) and (std::abs(simplified_grain_representation.
getCenter()(1) - 0.875) < 1.0e-10) and (std::abs(simplified_grain_representation.
getRadius() - 0.125*std::sqrt(2.0)) < 1.0e-10)){
36 sprintf (buffer,
"Subtest 1 result for 'SimplifiedGrainRepresentation': %u\n", result);
38 pass = pass and result;
48 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
49 {dealii::Point<dim> p(0.0,0.75); vertex_set[0] = p;}
50 {dealii::Point<dim> p(0.25,0.75); vertex_set[1] = p;}
51 {dealii::Point<dim> p(0.0,1.0); vertex_set[2] = p;}
52 {dealii::Point<dim> p(0.25,1.0); vertex_set[3] = p;}
57 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
58 {dealii::Point<dim> p(0.0,0.5); vertex_set[0] = p;}
59 {dealii::Point<dim> p(0.25,0.5); vertex_set[1] = p;}
60 {dealii::Point<dim> p(0.0,0.75); vertex_set[2] = p;}
61 {dealii::Point<dim> p(0.25,0.75); vertex_set[3] = p;}
66 std::vector<dealii::Point<dim>> vertex_set(dealii::Utilities::fixed_power<dim>(2.0));
67 {dealii::Point<dim> p(0.25,0.75); vertex_set[0] = p;}
68 {dealii::Point<dim> p(0.5,0.75); vertex_set[1] = p;}
69 {dealii::Point<dim> p(0.25,1.0); vertex_set[2] = p;}
70 {dealii::Point<dim> p(0.5,1.0); vertex_set[3] = p;}
77 std::cout <<
"Centroid: " << simplified_grain_representation.
getCenter() << std::endl;
78 std::cout <<
"Radius: " << simplified_grain_representation.
getRadius() << std::endl;
82 double centroid_x = (0.125*3.0+0.25)/3.0;
83 double centroid_y = (0.875*3.0-0.25)/3.0;
84 double radius = std::sqrt(dealii::Utilities::fixed_power<2>( centroid_x - 0.5) + dealii::Utilities::fixed_power<2>( centroid_y - 1.0));
86 if ( (std::abs(simplified_grain_representation.
getCenter()(0) - centroid_x) < 1.0e-10) and (std::abs(simplified_grain_representation.
getCenter()(1) - centroid_y) < 1.0e-10) and (std::abs(simplified_grain_representation.
getRadius() - radius) < 1.0e-10)){
90 sprintf (buffer,
"Subtest 2 result for 'SimplifiedGrainRepresentation': %u\n", result);
92 pass = pass and result;
95 sprintf (buffer,
"Test result for 'SimplifiedGrainRepresentation': %u\n", pass);
dealii::Point< dim > getCenter() const
bool test_SimplifiedGrainRepresentation()
void addVertexList(std::vector< dealii::Point< dim >> _vertices)
void setGrainIndex(unsigned int _grain_index)