|
|
@ -3,13 +3,17 @@ |
|
|
|
// polynomials. Additional examples are provided on the GitHub documentation page,
|
|
|
|
// https://algoim.github.io/
|
|
|
|
|
|
|
|
#include <cstddef> |
|
|
|
#include <iostream> |
|
|
|
#include <iomanip> |
|
|
|
#include <fstream> |
|
|
|
#include <vector> |
|
|
|
#include "bernstein.hpp" |
|
|
|
#include "quadrature_multipoly.hpp" |
|
|
|
|
|
|
|
#include "uvector.hpp" |
|
|
|
#include "vector" |
|
|
|
#include "xarray.hpp" |
|
|
|
|
|
|
|
using namespace algoim; |
|
|
|
|
|
|
@ -217,6 +221,30 @@ void outputQuadScheme(const F1& fphi1, const F2& fphi2, real xmin, real xmax, co |
|
|
|
outputQuadratureRuleAsVtpXML<N>(surf, qfile + "-surf.vtp"); |
|
|
|
} |
|
|
|
|
|
|
|
void module_test() { |
|
|
|
if (false){ |
|
|
|
const uvector<int, 1> P(5); |
|
|
|
xarray<real, 1> beta(nullptr, P); |
|
|
|
algoim_spark_alloc(real, beta); |
|
|
|
for(int i = 0; i < 5; i++) beta[i]=i+1; |
|
|
|
const uvector<real, 1> x(0.5); |
|
|
|
auto res = bernstein::evalBernsteinPoly(beta, x); |
|
|
|
std::cout << "res: " << res << std::endl; |
|
|
|
} |
|
|
|
if (true) { |
|
|
|
const uvector<int, 2> P(4, 4); |
|
|
|
xarray<real, 2> beta(nullptr, P); |
|
|
|
algoim_spark_alloc(real, beta); |
|
|
|
for(int i = 0; i < 4; i++) |
|
|
|
for (int j = 0; j < 4; j++) { |
|
|
|
beta(i,j)= i + j; |
|
|
|
} |
|
|
|
const uvector<real, 2> x(0.5, 0.3); |
|
|
|
auto res = bernstein::evalBernsteinPoly(beta, x); |
|
|
|
std::cout << "res: " << res << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if ALGOIM_EXAMPLES_DRIVER == 0 || ALGOIM_EXAMPLES_DRIVER == 4 |
|
|
|
int main(int argc, char* argv[]) |
|
|
|
{ |
|
|
@ -301,7 +329,7 @@ int main(int argc, char* argv[]) |
|
|
|
|
|
|
|
// Visusalisation of a 2D implicitly-defined domain involving the intersection of two polynomials; this example
|
|
|
|
// corresponds to the top-left example of Figure 15, https://doi.org/10.1016/j.jcp.2021.110720
|
|
|
|
{ |
|
|
|
if (false){ |
|
|
|
auto phi0 = [](const uvector<real,2>& xx) |
|
|
|
{ |
|
|
|
real x = xx(0)*2 - 1; |
|
|
@ -325,6 +353,8 @@ int main(int argc, char* argv[]) |
|
|
|
std::cout << "(XML VTP file format).\n"; |
|
|
|
} |
|
|
|
|
|
|
|
module_test(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
#endif |
|
|
|