[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] r4897 - in /trunk/getfem/src: getfem/getfem_continuatio
From: |
logari81 |
Subject: |
[Getfem-commits] r4897 - in /trunk/getfem/src: getfem/getfem_continuation.h getfem/getfem_models.h gmm/gmm_blas.h gmm/gmm_iter.h |
Date: |
Mon, 23 Mar 2015 15:03:24 -0000 |
Author: logari81
Date: Mon Mar 23 16:03:24 2015
New Revision: 4897
URL: http://svn.gna.org/viewcvs/getfem?rev=4897&view=rev
Log:
minor whitespace and output improvements
Modified:
trunk/getfem/src/getfem/getfem_continuation.h
trunk/getfem/src/getfem/getfem_models.h
trunk/getfem/src/gmm/gmm_blas.h
trunk/getfem/src/gmm/gmm_iter.h
Modified: trunk/getfem/src/getfem/getfem_continuation.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_continuation.h?rev=4897&r1=4896&r2=4897&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_continuation.h (original)
+++ trunk/getfem/src/getfem/getfem_continuation.h Mon Mar 23 16:03:24 2015
@@ -67,7 +67,6 @@
size_type nbdir_, nbspan_;
int noisy_;
double tau_lp, tau_bp_1, tau_bp_2;
- gmm::sub_interval I; // for continuation based on a subset of model
variables
// stored singularities info
std::map<double, double> tau_bp_graph;
@@ -88,7 +87,7 @@
void compute_tangent(const VECT &x, double gamma,
VECT &tx, double &tgamma) {
VECT g(x), y(x);
- F_gamma(x, gamma, g); // g = F_gamma(x, gamma);
+ F_gamma(x, gamma, g); // g = F_gamma(x, gamma)
solve_grad(x, gamma, y, g); // y = F_x(x, gamma)^-1 * g
tgamma = 1. / (tgamma - w_sp(tx, y));
gmm::copy(gmm::scaled(y, -tgamma), tx); // tx = -tgamma * y
@@ -99,7 +98,7 @@
gmm::add(gmm::scaled(g, tgamma), y); // y += tgamma * g
double r = norm(y);
if (r > 1.e-10)
- GMM_WARNING1("Tangent computed with the residual " << r)
+ GMM_WARNING1("Tangent computed with the residual " << r);
}
private:
@@ -423,7 +422,6 @@
cout << "Starting locating the bifurcation point" << endl;
// predictor-corrector steps with a secant-type step-length adaptation
-// double hsum(0);
h *= tau1 / (tau0 - tau1);
for (size_type i=0; i < 10 && (gmm::abs(h) >= h_min()); ++i) {
scaled_add(x0, gamma0, tx0, tgamma0, h, X, Gamma); // [X,Gamma] =
[x0,gamma0] + h * [tx0,tgamma0]
@@ -436,7 +434,6 @@
copy(tX, tGamma, tx0, tgamma0);
tau0 = tau1;
tau1 = test_function_bp(X, Gamma, tx0, tgamma0, v_x, v_gamma);
-// hsum += h;
h *= tau1 / (tau0 - tau1);
} else {
scaled_add(x0, gamma0, tx0, tgamma0, h, x0, gamma0); // [x0,gamma0]
+= h*[tx0,tgamma0]
@@ -487,7 +484,6 @@
copy(tx0, tgamma0, tX, tGamma);
h /= 2.;
-// double hsum(0);
for (size_type i = 0; i < 15; i++) {
scaled_add(x0, gamma0, tx0, tgamma0, h, X, Gamma); // [X,Gamma] =
[x0,gamma0] + h*[tx0,tgamma0]
if (noisy() > 0)
@@ -497,7 +493,6 @@
&& (cosang(tX, tx0, tGamma, tgamma0) >= mcos)) {
copy(X, Gamma, x0, gamma0);
copy(tX, tGamma, tx0, tgamma0);
-// hsum += h;
} else {
copy(tx0, tgamma0, tX, tGamma);
}
@@ -943,10 +938,8 @@
virtual void mult_grad(const VECT &x, double gamma,
const VECT &w, VECT &y) const = 0;
- virtual void listresiduals(void) const = 0;
-
public:
-
+
virtual_cont_struct
(int sing = 0, bool nonsm = false, double sfac=0.,
double hin = 1.e-2, double hmax = 1.e-1, double hmin = 1.e-5,
@@ -985,7 +978,7 @@
mutable model *md;
std::string parameter_name;
std::string initdata_name, finaldata_name, currentdata_name;
- gmm::sub_interval I;
+ gmm::sub_interval I; // for continuation based on a subset of model
variables
rmodel_plsolver_type lsolver;
double maxres_solve;
@@ -997,7 +990,7 @@
double intrv_sp(const base_vector &v1, const base_vector &v2) const {
return (I.size() > 0) ? gmm::vect_sp(gmm::sub_vector(v1,I),
gmm::sub_vector(v2,I))
- : gmm::vect_sp(v1, v2);
+ : gmm::vect_sp(v1, v2);
}
// solve A * g = L
@@ -1025,8 +1018,6 @@
// F_x(x, gamma) * w --> y
void mult_grad(const base_vector &x, double gamma,
const base_vector &w, base_vector &y) const;
-
- void listresiduals(void) const;
public:
size_type estimated_memsize(void);
Modified: trunk/getfem/src/getfem/getfem_models.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_models.h?rev=4897&r1=4896&r2=4897&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_models.h (original)
+++ trunk/getfem/src/getfem/getfem_models.h Mon Mar 23 16:03:24 2015
@@ -549,7 +549,8 @@
bool variable_is_disabled(const std::string &name) const {
VAR_SET::iterator it = variables.find(name);
GMM_ASSERT1(it != variables.end(), "Undefined variable " << name);
- GMM_ASSERT1(it->second.is_variable, "Only for variables");
+ GMM_ASSERT1(it->second.is_variable, "Only for variables, "
+ << name << " is not a variable");
if (it->second.is_affine_dependent)
it = variables.find(it->second.org_name);
return it->second.is_disabled;
Modified: trunk/getfem/src/gmm/gmm_blas.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/gmm/gmm_blas.h?rev=4897&r1=4896&r2=4897&view=diff
==============================================================================
--- trunk/getfem/src/gmm/gmm_blas.h (original)
+++ trunk/getfem/src/gmm/gmm_blas.h Mon Mar 23 16:03:24 2015
@@ -262,7 +262,8 @@
template <typename V1, typename V2> inline
typename strongest_value_type<V1,V2>::value_type
vect_sp(const V1 &v1, const V2 &v2) {
- GMM_ASSERT2(vect_size(v1) == vect_size(v2), "dimensions mismatch");
+ GMM_ASSERT2(vect_size(v1) == vect_size(v2), "dimensions mismatch, "
+ << vect_size(v1) << " !=" << vect_size(v2));
return vect_sp(v1, v2,
typename linalg_traits<V1>::storage_type(),
typename linalg_traits<V2>::storage_type());
@@ -293,7 +294,7 @@
vect_sp_with_matr(const MATSP &ps, const V1 &v1, const V2 &v2,
abstract_sparse) {
GMM_ASSERT2(vect_size(v1) == mat_ncols(ps) &&
- vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
+ vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
size_type nr = mat_nrows(ps);
typename linalg_traits<V2>::const_iterator
it = vect_const_begin(v2), ite = vect_const_end(v2);
@@ -314,7 +315,7 @@
vect_sp_with_matr(const MATSP &ps, const V1 &v1, const V2 &v2,
abstract_dense) {
GMM_ASSERT2(vect_size(v1) == mat_ncols(ps) &&
- vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
+ vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
typename linalg_traits<V2>::const_iterator
it = vect_const_begin(v2), ite = vect_const_end(v2);
typename strongest_value_type3<V1,V2,MATSP>::value_type res(0);
@@ -340,7 +341,7 @@
vect_sp_with_matc(const MATSP &ps, const V1 &v1, const V2 &v2,
abstract_sparse) {
GMM_ASSERT2(vect_size(v1) == mat_ncols(ps) &&
- vect_size(v2) == mat_nrows(ps),"dimensions mismatch");
+ vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
typename linalg_traits<V1>::const_iterator
it = vect_const_begin(v1), ite = vect_const_end(v1);
typename strongest_value_type3<V1,V2,MATSP>::value_type res(0);
@@ -360,7 +361,7 @@
vect_sp_with_matc(const MATSP &ps, const V1 &v1, const V2 &v2,
abstract_dense) {
GMM_ASSERT2(vect_size(v1) == mat_ncols(ps) &&
- vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
+ vect_size(v2) == mat_nrows(ps), "dimensions mismatch");
typename linalg_traits<V1>::const_iterator
it = vect_const_begin(v1), ite = vect_const_end(v1);
typename strongest_value_type3<V1,V2,MATSP>::value_type res(0);
@@ -937,7 +938,8 @@
template <typename L1, typename L2> inline
void copy(const L1& l1, L2& l2, abstract_vector, abstract_vector) {
- GMM_ASSERT2(vect_size(l1) == vect_size(l2), "dimensions mismatch");
+ GMM_ASSERT2(vect_size(l1) == vect_size(l2), "dimensions mismatch, "
+ << vect_size(l1) << " !=" << vect_size(l2));
copy_vect(l1, l2, typename linalg_traits<L1>::storage_type(),
typename linalg_traits<L2>::storage_type());
}
@@ -1237,7 +1239,8 @@
template <typename L1, typename L2> inline
void add_spec(const L1& l1, L2& l2, abstract_vector) {
- GMM_ASSERT2(vect_size(l1) == vect_size(l2), "dimensions mismatch");
+ GMM_ASSERT2(vect_size(l1) == vect_size(l2), "dimensions mismatch, "
+ << vect_size(l1) << " !=" << vect_size(l2));
add(l1, l2, typename linalg_traits<L1>::storage_type(),
typename linalg_traits<L2>::storage_type());
}
@@ -1245,7 +1248,7 @@
template <typename L1, typename L2> inline
void add_spec(const L1& l1, L2& l2, abstract_matrix) {
GMM_ASSERT2(mat_nrows(l1)==mat_nrows(l2) && mat_ncols(l1)==mat_ncols(l2),
- "dimensions mismatch");
+ "dimensions mismatch");
add(l1, l2, typename linalg_traits<L1>::sub_orientation(),
typename linalg_traits<L2>::sub_orientation());
}
@@ -1406,7 +1409,7 @@
template <typename L1, typename L2, typename L3> inline
void add_spec(const L1& l1, const L2& l2, L3& l3, abstract_vector) {
GMM_ASSERT2(vect_size(l1) == vect_size(l2) &&
- vect_size(l1) == vect_size(l3), "dimensions mismatch");
+ vect_size(l1) == vect_size(l3), "dimensions mismatch");
if ((const void *)(&l1) == (const void *)(&l3))
add(l2, l3);
else if ((const void *)(&l2) == (const void *)(&l3))
@@ -1938,7 +1941,7 @@
size_type n = mat_ncols(l1);
if (n == 0) { gmm::clear(l3); return; }
GMM_ASSERT2(n == mat_nrows(l2) && mat_nrows(l1) == mat_nrows(l3) &&
- mat_ncols(l2) == mat_ncols(l3), "dimensions mismatch");
+ mat_ncols(l2) == mat_ncols(l3), "dimensions mismatch");
if (same_origin(l2, l3) || same_origin(l1, l3)) {
GMM_WARNING2("A temporary is used for mult");
Modified: trunk/getfem/src/gmm/gmm_iter.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/gmm/gmm_iter.h?rev=4897&r1=4896&r2=4897&view=diff
==============================================================================
--- trunk/getfem/src/gmm/gmm_iter.h (original)
+++ trunk/getfem/src/gmm/gmm_iter.h Mon Mar 23 16:03:24 2015
@@ -73,7 +73,7 @@
}
iteration(double r = 1.0E-8, int noi = 0, size_type mit = size_type(-1),
- double div_res = 1E200)
+ double div_res = 1E200)
: rhsn(1.0), maxiter(mit), noise(noi), resmax(r), diverged_res(div_res)
{ init(); }
@@ -128,17 +128,17 @@
bool finished(double nr) {
if (callback) callback(*this);
if (noise > 0 && !written) {
- double a = (rhsn == 0) ? 1.0 : rhsn;
- converged(nr);
- cout << name << " iter " << std::setw(3) << nit << " residual "
- << std::setw(12) << gmm::abs(nr) / a;
-// if (nit % 100 == 0 && nit > 0) {
-// cout << " (residual min " << resminreach / a << " mean val "
-// << resadd / (100.0 * a) << " )";
-// resadd = 0.0;
-// }
- cout << endl;
- written = true;
+ double a = (rhsn == 0) ? 1.0 : rhsn;
+ converged(nr);
+ cout << name << " iter " << std::setw(3) << nit << " residual "
+ << std::setw(12) << gmm::abs(nr) / a;
+// if (nit % 100 == 0 && nit > 0) {
+// cout << " (residual min " << resminreach / a << " mean val "
+// << resadd / (100.0 * a) << " )";
+// resadd = 0.0;
+// }
+ cout << endl;
+ written = true;
}
return (converged(nr) || diverged(nr));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] r4897 - in /trunk/getfem/src: getfem/getfem_continuation.h getfem/getfem_models.h gmm/gmm_blas.h gmm/gmm_iter.h,
logari81 <=