- Timestamp:
- Jul 5, 2012, 11:54:39 AM (13 years ago)
- Children:
- 185795
- Parents:
- ef94e7
- Location:
- test/unit_test
- Files:
-
- 2 edited
-
library/force_sinus.cpp (modified) (1 diff)
-
unit_test/interpolate_test.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
test/unit_test/library/force_sinus.cpp
ref94e7 r0260d3 131 131 132 132 } 133 134 pos.X() = 0.25;135 pos.Y() = 0.25;136 for (pos.Z() = 0.25; pos.Z()<=0.75; pos.Z() += 0.001) {137 p.Pos() = pos;138 139 const Index index = (p.Pos()-sol.Extent().Begin())/sol.Extent().MeshWidth()-sol.Global().LocalBegin()+sol.Local().Begin();140 141 ip.ComputeCoefficients(sol, index);142 ip.Evaluate(p);143 144 Vector ref = Vector(std::cos(sine_factor*p.Pos().X())*std::sin(sine_factor*p.Pos().Y())*std::sin(sine_factor*p.Pos().Z()),145 std::sin(sine_factor*p.Pos().X())*std::cos(sine_factor*p.Pos().Y())*std::sin(sine_factor*p.Pos().Z()),146 std::sin(sine_factor*p.Pos().X())*std::sin(sine_factor*p.Pos().Y())*std::cos(sine_factor*p.Pos().Z()));147 ref *= -1.0 * sine_factor;148 std::cout << pos.Z() << " " << std::abs((ref.Z() - p.Field().Z()) / ref.Z()) << std::endl;149 }150 133 } 151 134 -
test/unit_test/unit_test/interpolate_test.cpp
ref94e7 r0260d3 54 54 InterpolateFixture() 55 55 { 56 grid = new TempGrid(64, 9, 0.0, 1.0);56 grid = new TempGrid(64, 5, 0.0, 1.0); 57 57 58 58 Index i; … … 80 80 { 81 81 Index i; 82 Particle::Interpolation ip( 8);82 Particle::Interpolation ip(5); 83 83 Particle::Particle p; 84 85 vmg_float min = 1.0, max = 0.0, diff;86 84 87 85 for (i.X() = grid->Local().Begin().X(); i.X()<grid->Local().End().X(); ++i.X()) … … 98 96 99 97 ip.Evaluate(p); 100 101 98 BOOST_CHECK_SMALL(p.Pot() - grid->GetVal(i), 1.0e-12); 102 99 103 for (p.Pos().X()=pos_begin.X(); p.Pos().X()<pos_end.X(); p.Pos().X()+=grid->Extent().MeshWidth().X()*0.25) 104 for (p.Pos().Y()=pos_begin.Y(); p.Pos().Y()<pos_end.Y(); p.Pos().Y()+=grid->Extent().MeshWidth().Y()*0.25) 105 for (p.Pos().Z()=pos_begin.Z(); p.Pos().Z()<pos_end.Z(); p.Pos().Z()+=grid->Extent().MeshWidth().Z()*0.25) { 106 ip.Evaluate(p); 107 diff = std::abs(p.Pot() - f(p.Pos())); 108 min = std::min(min, diff); 109 max = std::max(max, diff); 110 } 100 p.Pos() += 0.5 * grid->Extent().MeshWidth(); 101 ip.Evaluate(p); 102 BOOST_CHECK_SMALL(p.Pot() - f(p.Pos()), 1.0e-7); 111 103 112 104 } 113 105 114 BOOST_CHECK_SMALL(max, 1.0e-7);115 106 } 116 107 108 /* 117 109 BOOST_AUTO_TEST_CASE(InterpolateFieldTest) 118 110 { … … 123 115 124 116 vmg_float max_error = 0.0; 125 /* 117 126 118 for(p.Pos().X()=grid->Extent().Begin().X(); p.Pos().X()<grid->Extent().End().X(); p.Pos().X() += 0.01 * (grid->Extent().End().X() - grid->Extent().Begin().X())) 127 119 for(p.Pos().Y()=grid->Extent().Begin().Y(); p.Pos().Y()<grid->Extent().End().Y(); p.Pos().Y() += 0.01 * (grid->Extent().End().Y() - grid->Extent().Begin().Y())) … … 143 135 144 136 std::printf("Max error: %e\n", max_error); 145 */146 137 147 138 p.Pos().X() = 0.25; … … 157 148 158 149 ip.Evaluate(p); 159 160 std::printf("%e %e\n", p.Pos().Z(), std::abs((p.Field().Z() - grad_f(p.Pos()).Z())/grad_f(p.Pos()).Z()));161 //std::printf("%e %e\n", p.Pos().Z(), std::abs(p.Field().Z() - grad_f(p.Pos()).Z()));162 //std::printf("%e %e\n", p.Pos().Z(), p.Field().Z());163 164 150 } 165 151 } 152 */ 166 153 167 154 BOOST_AUTO_TEST_SUITE_END()
Note:
See TracChangeset
for help on using the changeset viewer.
