Mercurial > hg > kwantix
changeset 34:7f31f9e2d196
Rename kwantxi to kwantix
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Thu, 04 Feb 2010 21:55:30 -0600 |
parents | 8725d274af42 |
children | 22f78a6faa3e |
files | src/bvp.cpp src/ddm.cpp src/diff_op.cpp src/error.cpp src/func.cpp src/interp_values.cpp src/interpolator.cpp src/linalg.cpp src/main-Laplace.cpp src/main-ddm-diff-adv.cpp src/main-diff-adv.cpp src/main-linear-wave-eq.cpp src/main-poisson.cpp src/main-profiling.cpp src/main-sw-euler.cpp src/main-sw-rk4.cpp src/main.cpp src/rbf.cpp src/utils.cpp |
diffstat | 19 files changed, 141 insertions(+), 141 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bvp.cpp +++ b/src/bvp.cpp @@ -9,7 +9,7 @@ #include "include/func.hpp" -namespace kwantxi{ +namespace kwantix{ using std::pair; using std::make_pair; @@ -161,7 +161,7 @@ void domain::add_to_normals(const map<point, vector> &ns){ for(map<point, vector>::const_iterator I = ns.begin(); I != ns.end(); I++){ - if (!kwantxi::contains(boundary, I->first)){ + if (!kwantix::contains(boundary, I->first)){ badArgument exc; exc.reason = "Bad normal given: must match a point on the boundary."; exc.line = __LINE__; @@ -180,7 +180,7 @@ } void domain::add_to_normals(const point &bdry, const vector &n){ - if (!kwantxi::contains(boundary, bdry)){ + if (!kwantix::contains(boundary, bdry)){ badArgument exc; exc.reason = "Bad normal given: must match a point on the boundary."; exc.line = __LINE__; @@ -214,9 +214,9 @@ //Is point in this domain, whether interior or boundary? bool domain::contains(const point& p) const{ - if(kwantxi::contains(interior, p)) + if(kwantix::contains(interior, p)) return true; - if(kwantxi::contains(boundary, p)) + if(kwantix::contains(boundary, p)) return true; return false; }
--- a/src/ddm.cpp +++ b/src/ddm.cpp @@ -12,9 +12,9 @@ //debug #include <iostream> -namespace kwantxi{ +namespace kwantix{ using namespace std; - using kwantxi::vector; + using kwantix::vector; using boost::shared_ptr; using boost::dynamic_pointer_cast; @@ -32,7 +32,7 @@ double ddm_bdry_diff_op::at(const realfunc &f, const point &p) const { - if( kwantxi::contains(intr_bdry_pts, p)) + if( kwantix::contains(intr_bdry_pts, p)) return Bprime -> at(f,p); return B -> at(f,p); @@ -41,7 +41,7 @@ double ddm_bdry_diff_op::at(const realfunc &f, const point &p, const vector &n) const { - if( kwantxi::contains(intr_bdry_pts, p)) + if( kwantix::contains(intr_bdry_pts, p)) return Bprime -> at(f,p,n); return B -> at(f,p,n); @@ -80,7 +80,7 @@ throw exc; } - if(!kwantxi::includes(boundary,union_boundary) ){ + if(!kwantix::includes(boundary,union_boundary) ){ badArgument exc; exc.reason = "Bad argument in domain decomposition method constructor: \n" @@ -352,8 +352,8 @@ for(map<point, shared_ptr<const overlapping_domain> >::const_iterator i = bdry_asst.begin(); i != bdry_asst.end(); i++) { - if(!kwantxi::contains(ols, i->second) or - !kwantxi::contains(bdry_copy, i->first)){ + if(!kwantix::contains(ols, i->second) or + !kwantix::contains(bdry_copy, i->first)){ badArgument exc; exc.reason = "Bad argument in overlapping_domain constructor: \n" @@ -385,7 +385,7 @@ shared_ptr<const overlapping_domain> overlapping_domain::which_domain(const point& p) const { - if(!kwantxi::contains(boundary_assignments, p)){ + if(!kwantix::contains(boundary_assignments, p)){ shared_ptr<const overlapping_domain> zero; return zero; } @@ -396,7 +396,7 @@ overlapping_domain:: set_overlapper_info(const point& p, const shared_ptr<overlapping_domain> o) { - if(kwantxi::contains(this -> get_boundary(), p)) + if(kwantix::contains(this -> get_boundary(), p)) boundary_assignments[p] = o; } @@ -412,7 +412,7 @@ for(set<shared_ptr<overlapping_domain> >::iterator d_other = domains.begin(); d_other != domains.end(); d_other++) if( - kwantxi::contains((*d_other ) -> get_interior(), *p) + kwantix::contains((*d_other ) -> get_interior(), *p) ){ (*d) -> boundary_assignments[*p] = *d_other; (*d) -> overlappers.insert(*d_other);
--- a/src/diff_op.cpp +++ b/src/diff_op.cpp @@ -3,7 +3,7 @@ #include "include/func.hpp" -namespace kwantxi{ +namespace kwantix{ using namespace std; //************** Differential operator functions *********************
--- a/src/error.cpp +++ b/src/error.cpp @@ -1,7 +1,7 @@ // File with a few function definitions. #include "include/error.hpp" -namespace kwantxi{ +namespace kwantix{ void errorHandler(const char * reason, const char * file, int line, int gsl_errno){ //This exception is so common that we will want more information
--- a/src/func.cpp +++ b/src/func.cpp @@ -4,7 +4,7 @@ #include <cmath> #include <limits> -namespace kwantxi{ +namespace kwantix{ //The static variables... double realfunc::eps = 0; @@ -101,9 +101,9 @@ return 0; } - kwantxi::badArgument + kwantix::badArgument realfunc::no_init(int line, string file) const{ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.line = line; exc.file = file; exc.reason = "Did not assign a function pointer to a realfunc object.";
--- a/src/interp_values.cpp +++ b/src/interp_values.cpp @@ -2,7 +2,7 @@ //debug #include <iostream> -namespace kwantxi{ +namespace kwantix{ // ************************ interp_values stuff ***************** badArgument interp_values::different_rbfs(int line, string file) const @@ -83,7 +83,7 @@ { if(v.size() == m+n){ //Lower part of the vector contains the boundary - kwantxi::slice s(n+1,v.size()); + kwantix::slice s(n+1,v.size()); v = v(s); } else if(v.size() != m){ @@ -102,7 +102,7 @@ { if(v.size() == m+n){ //Upper part of the vector contains the boundary - kwantxi::slice s(1,n); + kwantix::slice s(1,n); v = v(s); } else if(v.size() != n){ @@ -117,10 +117,10 @@ //*************** normals stuff ************************************* normals::normals(size_t rbfs_hash_in, - const map<point, kwantxi::vector>& normals_in, + const map<point, kwantix::vector>& normals_in, size_t n_in) : rbfs_hash(rbfs_hash_in), n(n_in) { - map<point, kwantxi::vector>::const_iterator I; + map<point, kwantix::vector>::const_iterator I; size_t rows = normals_in.size(); size_t cols = normals_in.begin() -> second.size(); slice s(1,cols); @@ -158,7 +158,7 @@ interp_values operator-(double a, const interp_values& v) { - kwantxi::vector w(v.v.size(),a); + kwantix::vector w(v.v.size(),a); return interp_values(w-v.v, v.rbfs_hash,v.n,v.m); } @@ -169,7 +169,7 @@ interp_values operator/(double a, const interp_values& v) { - kwantxi::vector w(v.v.size(),a); + kwantix::vector w(v.v.size(),a); return interp_values(w/v.v, v.rbfs_hash,v.n,v.m); } }
--- a/src/interpolator.cpp +++ b/src/interpolator.cpp @@ -15,7 +15,7 @@ #include <boost/functional/hash.hpp> #include <boost/shared_ptr.hpp> -namespace kwantxi{ +namespace kwantix{ using boost::shared_ptr; template<typename RBF> @@ -61,9 +61,9 @@ for(map<point, double>::const_iterator I = Xi.begin(); I != Xi.end(); I++) { - if(kwantxi::contains(Omega -> get_interior(), I -> first)) + if(kwantix::contains(Omega -> get_interior(), I -> first)) f[I -> first] = I -> second; - else if(kwantxi::contains(Omega -> get_boundary(), I -> first)) + else if(kwantix::contains(Omega -> get_boundary(), I -> first)) g[I -> first] = I -> second; else { @@ -222,7 +222,7 @@ rbfs_hash = hash_value(rbfs); - kwantxi::normals nrmls_tmp(rbfs_hash, normals, n); + kwantix::normals nrmls_tmp(rbfs_hash, normals, n); nrmls = nrmls_tmp; initted = true; @@ -414,7 +414,7 @@ // ------------------- Whole domain evaluations ---------------- template<typename RBF> - kwantxi::badArgument + kwantix::badArgument interpolator<RBF>::not_precomputed(int line, string file) const { badArgument exc; @@ -607,7 +607,7 @@ std::vector<size_t> alpha; //empty, corresponds to evaluation if(precomp_values_vec.find(alpha) == precomp_values_vec.end()) at(); - kwantxi::vector rhs = precomp_values_vec[alpha]; + kwantix::vector rhs = precomp_values_vec[alpha]; slice s1(1,n), s2(n+1,n+m); rhs(s2) = b_new.v; coeffs = precomp_rbfs[alpha].inv(rhs); @@ -627,7 +627,7 @@ } template<typename RBF> - kwantxi::badArgument + kwantix::badArgument interpolator<RBF>::not_initted(int line, string file) const { badArgument exc; @@ -641,7 +641,7 @@ template<typename RBF> void interpolator<RBF>::computecoeffs(bool rhs_defined) { - kwantxi::vector rhs(n+m); + kwantix::vector rhs(n+m); //Compute the RBF coefficients if(rhs_defined){ @@ -671,7 +671,7 @@ typename map<std::vector<size_t>, matrix>::const_iterator I; for(I = precomp_rbfs.begin(); I != precomp_rbfs.end(); I++){ - kwantxi::vector vals = (I->second)*coeffs; + kwantix::vector vals = (I->second)*coeffs; precomp_values_vec[I -> first] = vals; precomp_values[I -> first] = valsvec2map(vals); } @@ -680,7 +680,7 @@ template<typename RBF> map<point, double> interpolator<RBF>:: - valsvec2map(const kwantxi::vector& values) const + valsvec2map(const kwantix::vector& values) const { map<point, double> out; { @@ -702,7 +702,7 @@ template<typename RBF> void interpolator<RBF>::into_os(std::ostream& os) const { - kwantxi::vector values; + kwantix::vector values; size_t i; set<point>::const_iterator I; @@ -712,7 +712,7 @@ values = precomp_values_vec[alpha]; } else{ - kwantxi::vector tmp(n+m); + kwantix::vector tmp(n+m); for(i = 1, I=thebvp->get_domain()->get_interior().begin() ; i<=n; i++, I++) {
--- a/src/linalg.cpp +++ b/src/linalg.cpp @@ -11,7 +11,7 @@ #include <gsl/gsl_math.h> //For floating-point comparison. //Matrix stuff -namespace kwantxi{ +namespace kwantix{ const double matrix::eps = std::numeric_limits<double>::epsilon(); const double vector::eps = std::numeric_limits<double>::epsilon(); @@ -354,7 +354,7 @@ //***************** LUmatrix stuff ********************************** -namespace kwantxi{ +namespace kwantix{ matrix::LUmatrix::LUmatrix(gsl_matrix* M){ A = gsl_matrix_alloc(M -> size1, M -> size2); gsl_matrix_memcpy(A,M); @@ -417,7 +417,7 @@ //Vector stuff -namespace kwantxi{ +namespace kwantix{ // **************** Vector allocation stuff ********************* @@ -623,7 +623,7 @@ } //************************* Vector view stuff ******************************* -namespace kwantxi{ +namespace kwantix{ vector_view::vector_view(){ x = 0; } @@ -716,7 +716,7 @@ //Slice stuff -namespace kwantxi{ +namespace kwantix{ slice::slice(size_t a, size_t b, size_t k) { set(a,b,k); @@ -759,7 +759,7 @@ } //Non-member functions -namespace kwantxi{ +namespace kwantix{ // ************* I/O ************************ @@ -779,7 +779,7 @@ bool colvector = true; bool shouldbedone = false; while(getline(is, s)){ - s = kwantxi::trim(s); + s = kwantix::trim(s); if(s[0] == '#' or s.size() == 0) //Blank line or comment character continue; @@ -845,7 +845,7 @@ size_t rows = 0; size_t cols = 0; while(getline(is, line)){ - line = kwantxi::trim(line); + line = kwantix::trim(line); //Blank row or comment character. if(line[0] == '#' or line.length() == 0) continue;
--- a/src/main-Laplace.cpp +++ b/src/main-Laplace.cpp @@ -28,7 +28,7 @@ #define RBF_TYPE inverse_multiquadric //Replace by template later. using namespace std; -using namespace kwantxi; +using namespace kwantix; //Some arbitrary interior function for Poisson equation (change to //"return 0*p(1);", for example, for Laplace equation). @@ -48,10 +48,10 @@ void output_result(const interpolator<RBF_TYPE>& u); int main(){ - using kwantxi::vector; + using kwantix::vector; try{ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); //Define the domain from given data shared_ptr<domain> Omega(new domain("data/interior.matrix", @@ -77,7 +77,7 @@ } catch(error& exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); } return 0;
--- a/src/main-ddm-diff-adv.cpp +++ b/src/main-ddm-diff-adv.cpp @@ -11,7 +11,7 @@ #include "include/ddm.hpp" #include "include/func.hpp" -using namespace kwantxi; +using namespace kwantix; class conv_diff : public linear_diff_op2{ public: @@ -45,12 +45,12 @@ dirichlet_op D; }; -double f(const kwantxi::point& p){ +double f(const kwantix::point& p){ p.size(); return 0; } -double g(const kwantxi::point& p){ +double g(const kwantix::point& p){ if(p(1) == 0) return 1; if(p(1) == 1) @@ -62,11 +62,11 @@ int main(){ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try{ using namespace std; - using kwantxi::vector; + using kwantix::vector; shared_ptr<domain> Omega(new domain("data/intr.v", "data/bdry.v", "data/nrml.v")); @@ -98,7 +98,7 @@ piecewise_polynomial::set_n(7); thin_plate_spline::set_n(8); - c_infty_kwantxi::set_epsilon(7.234); + c_infty_kwantix::set_epsilon(7.234); additive_schwarz_ddm<thin_plate_spline> solver(dd_in, thebvp); @@ -130,7 +130,7 @@ } catch(error exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); } return 0; }
--- a/src/main-diff-adv.cpp +++ b/src/main-diff-adv.cpp @@ -11,7 +11,7 @@ #include "include/diff_op.hpp" #include "include/ddm.hpp" -using namespace kwantxi; +using namespace kwantix; class conv_diff : public linear_diff_op2{ public: @@ -142,12 +142,12 @@ dirichlet_op D; }; -double f(const kwantxi::point& p){ +double f(const kwantix::point& p){ p.size(); return 0; } -double g(const kwantxi::point& p){ +double g(const kwantix::point& p){ if(p(1) == 0) return 1; if(p(1) == 1) @@ -159,11 +159,11 @@ int main(){ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try{ using namespace std; - using kwantxi::vector; + using kwantix::vector; shared_ptr<domain> Omega(new domain("data/intr.v", "data/bdry.v", "data/nrml.v")); @@ -199,7 +199,7 @@ piecewise_polynomial::set_n(7); thin_plate_spline::set_n(6); - c_infty_kwantxi::set_epsilon(20.534); + c_infty_kwantix::set_epsilon(20.534); interpolator<piecewise_polynomial> solver(thebvp); @@ -243,7 +243,7 @@ } catch(error exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); } return 0; }
--- a/src/main-linear-wave-eq.cpp +++ b/src/main-linear-wave-eq.cpp @@ -12,7 +12,7 @@ #include "include/interpolator.hpp" #include "include/func.hpp" -using namespace kwantxi; +using namespace kwantix; class wave_op : public linear_diff_op2{ public: @@ -55,18 +55,18 @@ }; int main(){ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try{ using namespace std; - using kwantxi::vector; + using kwantix::vector; shared_ptr<domain> Omega(new domain("data/circ_intr.matrix", "data/circ_bdry.matrix", "data/circ_nrml.matrix") ); //Interior conditions, init them - map<point,double> u_init = kwantxi::read_pd_map("data/wave_init.map"); + map<point,double> u_init = kwantix::read_pd_map("data/wave_init.map"); //Boundary conditions, Dirichlet, set to zero (clamped membrane) zero_func g; @@ -97,7 +97,7 @@ return 0; } catch(error exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); return 1; }
--- a/src/main-poisson.cpp +++ b/src/main-poisson.cpp @@ -28,7 +28,7 @@ #define RBF_TYPE inverse_multiquadric //Replace by template later. using namespace std; -using namespace kwantxi; +using namespace kwantix; //Some arbitrary interior function for Poisson equation (change to //"return 0*p(1);", for example, for Laplace equation). @@ -48,10 +48,10 @@ void output_result(const interpolator<RBF_TYPE>& u); int main(){ - using kwantxi::vector; + using kwantix::vector; try{ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); //Define the domain from given data shared_ptr<domain> Omega(new domain("data/interior.matrix", @@ -77,7 +77,7 @@ } catch(error& exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); } return 0;
--- a/src/main-profiling.cpp +++ b/src/main-profiling.cpp @@ -12,20 +12,20 @@ //********************** Main ****************************************** int main(){ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try { using namespace std; - using namespace kwantxi + using namespace kwantix point p(2),q(2); p(1) = P1; p(2) = P2; q(1) = Q1; q(2) = Q2; - kwantxi::radial_basis_function::set_dimension(2); - kwantxi::multiquadric phi(p); + kwantix::radial_basis_function::set_dimension(2); + kwantix::multiquadric phi(p); double out; for(size_t i = 0; i < 10000000; i++){ // out = phi(q); @@ -45,9 +45,9 @@ cout << out << endl; return 0; } - catch(kwantxi::error exc) + catch(kwantix::error exc) { - kwantxi::show_exception(exc); + kwantix::show_exception(exc); return 1; }
--- a/src/main-sw-euler.cpp +++ b/src/main-sw-euler.cpp @@ -15,9 +15,9 @@ #include "include/interpolator.hpp" #include "include/func.hpp" -using namespace kwantxi; +using namespace kwantix; -#define RBF_TYPE kwantxi::conical +#define RBF_TYPE kwantix::conical //Will solve the system // @@ -132,13 +132,13 @@ //********************** Main ****************************************** int main(){ - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try{ using namespace std; using boost::shared_ptr; - map<point, double> h_init = kwantxi::read_pd_map("data/h_init.map"); + map<point, double> h_init = kwantix::read_pd_map("data/h_init.map"); shared_ptr<domain> Omega(new domain("data/circ_intr.matrix", "data/circ_bdry.matrix", @@ -203,7 +203,7 @@ return 0; } catch(error exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); return 1; } @@ -273,7 +273,7 @@ iter_neumann::iter_neumann(size_t u_or_v_in) { if(u_or_v_in < 1 or u_or_v_in > 2){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Argument to iter_neumann constructor must be 1 or 2"; exc.line = __LINE__; exc.file = __FILE__; @@ -338,7 +338,7 @@ } template<typename RBF> -kwantxi::vector at_bdry(const interpolator<RBF>& u, +kwantix::vector at_bdry(const interpolator<RBF>& u, const boost::shared_ptr<domain> Omega) { vector out(Omega -> get_boundary().size()); @@ -359,7 +359,7 @@ Gu_or_v<RBF_TYPE> gu(2, Omega), gv(1, Omega); double err = 1; do{ - kwantxi::vector u_old, u_new, v_old, v_new; + kwantix::vector u_old, u_new, v_old, v_new; u_old = at_bdry(u,Omega); gu.set_other(v); u.set_g(gu);
--- a/src/main-sw-rk4.cpp +++ b/src/main-sw-rk4.cpp @@ -16,9 +16,9 @@ #include "include/interpolator.hpp" #include "include/func.hpp" -using namespace kwantxi; +using namespace kwantix; -#define RBF_TYPE kwantxi::conical +#define RBF_TYPE kwantix::conical //Will solve the system // @@ -61,7 +61,7 @@ using Fgen<RBF>::h; using Fgen<RBF>::dt; public: - kwantxi::interp_values at() const; + kwantix::interp_values at() const; }; template<typename RBF> @@ -71,7 +71,7 @@ using Fgen<RBF>::h; using Fgen<RBF>::dt; public: - kwantxi::interp_values at() const; + kwantix::interp_values at() const; }; template<typename RBF> @@ -81,7 +81,7 @@ using Fgen<RBF>::h; using Fgen<RBF>::dt; public: - kwantxi::interp_values at() const; + kwantix::interp_values at() const; }; class zero_func : public realfunc{ @@ -103,13 +103,13 @@ //********************** Main ****************************************** int main() { - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try{ using namespace std; using boost::shared_ptr; - map<point, double> h_init = kwantxi::read_pd_map("data/h_init.map"); + map<point, double> h_init = kwantix::read_pd_map("data/h_init.map"); shared_ptr<domain> Omega(new domain("data/circ_intr.matrix", "data/circ_bdry.matrix", @@ -233,7 +233,7 @@ return 0; } catch(error exc){ - kwantxi::show_exception(exc); + kwantix::show_exception(exc); return 1; } @@ -332,11 +332,11 @@ if(false){ //debug double r, th, N, M; N = 30; M = 70; - kwantxi::matrix out(static_cast<size_t>(N),static_cast<size_t>(M)); + kwantix::matrix out(static_cast<size_t>(N),static_cast<size_t>(M)); size_t i,j; for(r = 0, j=1; j <= N; r += 1/(N-1),j++){ for(th = 0,i=1; i <= M; th += 2*pi/(M-1),i++){ - kwantxi::vector p(2); + kwantix::vector p(2); p(1) = r*cos(th); p(2) = r*sin(th); out(j,i) = u(p); @@ -351,8 +351,8 @@ template<typename RBF> void set_bdry_conds(interpolator<RBF> & u, interpolator<RBF> & v) { - kwantxi::bdry_values u_bdry(u.at()), v_bdry(v.at()); - kwantxi::normals N=u.get_normals(), M=v.get_normals(); + kwantix::bdry_values u_bdry(u.at()), v_bdry(v.at()); + kwantix::normals N=u.get_normals(), M=v.get_normals(); if(N != M){ failure exc; exc.reason="u and v have incompatible domains. This should never" @@ -361,8 +361,8 @@ } //Project the vector (u,v) onto the perp of (N(1),N(2)) = (-N(2),N(1)). - kwantxi::bdry_values u_bdry_new = u_bdry*N(2)*N(2) - v_bdry*N(1)*N(2); - kwantxi::bdry_values v_bdry_new = v_bdry*N(1)*N(1) - u_bdry*N(1)*N(2); + kwantix::bdry_values u_bdry_new = u_bdry*N(2)*N(2) - v_bdry*N(1)*N(2); + kwantix::bdry_values v_bdry_new = v_bdry*N(1)*N(1) - u_bdry*N(1)*N(2); u.set_bdry_values(u_bdry_new); v.set_bdry_values(v_bdry_new);
--- a/src/main.cpp +++ b/src/main.cpp @@ -16,10 +16,10 @@ #include "include/interpolator.hpp" #include "include/func.hpp" -using namespace kwantxi; +using namespace kwantix; //Define the RBF type here. -typedef kwantxi::conical RBF_TYPE; +typedef kwantix::conical RBF_TYPE; const double pi = 3.141592653589793238462643383279502; @@ -45,14 +45,14 @@ int main() { - gsl_set_error_handler(&kwantxi::errorHandler); + gsl_set_error_handler(&kwantix::errorHandler); try { using namespace std; using boost::shared_ptr; - map<point, double> u_init = kwantxi::read_pd_map("data/wave_init.map"); + map<point, double> u_init = kwantix::read_pd_map("data/wave_init.map"); shared_ptr<domain> Omega(new domain("data/circ_intr.matrix", "data/circ_bdry.matrix", @@ -67,7 +67,7 @@ shared_ptr<linear_BVP2> the_bvp(new linear_BVP2(Omega, W, D, u_init, g)); - kwantxi::conical::set_n(5); + kwantix::conical::set_n(5); interpolator<RBF_TYPE> u(the_bvp); u.precompute_ev(); interpolator<RBF_TYPE> u0 = u, u1 = u; @@ -86,7 +86,7 @@ } catch(error exc) { - kwantxi::show_exception(exc); + kwantix::show_exception(exc); return 1; }
--- a/src/rbf.cpp +++ b/src/rbf.cpp @@ -10,7 +10,7 @@ #include <typeinfo> //Radial basis function stuff -namespace kwantxi{ +namespace kwantix{ size_t radial_basis_function::dimension = 0; double c_infty_rbf::eps = 1; @@ -48,7 +48,7 @@ void radial_basis_function::bad_dimension(string file, int line, size_t dim) const{ - kwantxi::badDimension exc; + kwantix::badDimension exc; if(dimension == 0) exc.reason = "Vector of wrong dimensionality passed to " @@ -80,7 +80,7 @@ if(x.size() != dimension) bad_dimension(__FILE__, __LINE__, x.size()); else if(k < 1 or k > dimension){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Cannot differentiate wrt given index: out of bounds."; exc.line = __LINE__; exc.file = __FILE__; @@ -100,7 +100,7 @@ if(x.size() != dimension) bad_dimension(__FILE__, __LINE__, x.size()); else if(k1 < 1 or k1 > dimension or k2 < 1 or k2 > dimension){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Cannot differentiate wrt given indices: out of bounds."; exc.line = __LINE__; exc.file = __FILE__; @@ -145,7 +145,7 @@ // ***************** Two important subclasses ******************** -namespace kwantxi{ +namespace kwantix{ piecewise_smooth_rbf::piecewise_smooth_rbf(){ //Nothing to create! @@ -200,7 +200,7 @@ // ***************** Specific RBFs ******************************* //Piecewise polynomial -namespace kwantxi{ +namespace kwantix{ double piecewise_polynomial::operator()(double r) const{ if(n == 0){ badArgument exc; @@ -278,7 +278,7 @@ } //Thin-plate spline -namespace kwantxi{ +namespace kwantix{ double thin_plate_spline::operator()(double r) const { if(n == 0){ badArgument exc; @@ -365,7 +365,7 @@ } //Multiquadric -namespace kwantxi{ +namespace kwantix{ double multiquadric::operator()(double r) const { return sqrt(1 + gsl_pow_2(eps*r)); } @@ -382,7 +382,7 @@ } //Inverse multiquadric -namespace kwantxi{ +namespace kwantix{ double inverse_multiquadric::operator()(double r) const { return 1/sqrt(1 + gsl_pow_2(eps*r)); } @@ -399,7 +399,7 @@ } //Inverse quadratic -namespace kwantxi{ +namespace kwantix{ double inverse_quadratic::operator()(double r) const { return 1/(1 + gsl_pow_2(eps*r)); } @@ -418,7 +418,7 @@ } //Gaussian -namespace kwantxi{ +namespace kwantix{ double gaussian::operator()(double r) const { return exp(-gsl_pow_2(eps*r)); }
--- a/src/utils.cpp +++ b/src/utils.cpp @@ -7,7 +7,7 @@ #include "include/linalg.hpp" #include "include/error.hpp" -namespace kwantxi{ +namespace kwantix{ std::string trim(const std::string& s){ if(s.length() == 0) return s; @@ -33,13 +33,13 @@ return std::includes(s2.begin(), s2.end(), s1.begin(), s1.end()); } - using kwantxi::vector; - using kwantxi::matrix; + using kwantix::vector; + using kwantix::matrix; matrix read_matrix(std::string filename){ std::ifstream ifs(filename.c_str()); if(!ifs){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Cannot open file "; exc.reason += filename; exc.line = __LINE__; @@ -54,7 +54,7 @@ vector read_vector(std::string filename){ std::ifstream ifs(filename.c_str()); if(!ifs){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Cannot open file "; exc.reason += filename; exc.line = __LINE__; @@ -66,10 +66,10 @@ return v; } - std::map<kwantxi::point, double> read_pd_map(std::string filename){ + std::map<kwantix::point, double> read_pd_map(std::string filename){ std::ifstream ifs(filename.c_str()); if(!ifs){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Cannot open file "; exc.reason += filename; exc.line = __LINE__; @@ -80,7 +80,7 @@ ifs >> M; if(M.cols() < 2){ - kwantxi::badArgument exc; + kwantix::badArgument exc; exc.reason = "Input matrix to read_pd_map is too narrow. \n" "Need at least two columns in the input matrix"; @@ -89,15 +89,15 @@ throw exc; } - std::map <kwantxi::point, double> result; + std::map <kwantix::point, double> result; size_t m = M.cols(); - kwantxi::slice s(1,m-1); + kwantix::slice s(1,m-1); for(size_t i = 1; i <= M.rows(); i++) result[M(i,s)] = M(i,m); return result; } - void show_exception(kwantxi::error exc){ + void show_exception(kwantix::error exc){ using namespace std; cerr << exc.file << ": ""Caught an exception!" << endl; @@ -110,19 +110,19 @@ #include <boost/shared_ptr.hpp> #include "include/ddm.hpp" //Instantiations -namespace kwantxi{ +namespace kwantix{ using boost::shared_ptr; - template bool contains(const std::set<kwantxi::point>&, kwantxi::point E); - template bool contains(const std::map<kwantxi::point, kwantxi::vector>& m, - kwantxi::point thing); - template bool includes(const std::set<kwantxi::point>& s1, - const std::set<kwantxi::point>& s2); - template bool contains(const std::map<kwantxi::point, - shared_ptr<const kwantxi::overlapping_domain> >&, - kwantxi::point ); + template bool contains(const std::set<kwantix::point>&, kwantix::point E); + template bool contains(const std::map<kwantix::point, kwantix::vector>& m, + kwantix::point thing); + template bool includes(const std::set<kwantix::point>& s1, + const std::set<kwantix::point>& s2); + template bool contains(const std::map<kwantix::point, + shared_ptr<const kwantix::overlapping_domain> >&, + kwantix::point ); template bool contains(const std::set<shared_ptr - <const kwantxi::overlapping_domain> >&, - shared_ptr<const kwantxi::overlapping_domain> E); + <const kwantix::overlapping_domain> >&, + shared_ptr<const kwantix::overlapping_domain> E); }