getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] vector iterator + offset out of range error in mat_tr


From: Yves Renard
Subject: Re: [Getfem-users] vector iterator + offset out of range error in mat_transp_reduction
Date: Mon, 22 Jun 2015 19:40:51 +0200 (CEST)


Dear Egor,

This problem has in fact already been addressed in the svn version of Getfem.
This is due to a quite drastic control of the validity of iterators of the new 
compiler version.
The loop can be replaced by

iterator pff = pf;
for (size_type k = 0; k < dim; ++k) {
  if (k) pff += co;
  *pff = T(0); pt = tmp->begin(); pl = m.begin() + k;
  *pff += (*pl) * (*pt); ++pt;
  for (size_type l = 1; l < dimt; ++l, ++pt) {
    pl += dim;
    *pff += (*pl) * (*pt);
   }
}

Best regards,

Yves.



----- Original Message -----
From: "Egor Vtorushin" <address@hidden>
To: address@hidden
Sent: Monday, June 22, 2015 4:41:06 PM
Subject: [Getfem-users] vector iterator + offset out of range error in  
mat_transp_reduction

Dear Yves 

After months of stable working in Visual Studio 2010 the getfem++ lib is failed 
on my desktop 
I'm rebuilding the getfem and trying to pass a simple tests via 
test_assembly.cc 

It fails on the first calculation of gradient while performing ctx.pf 
()->real_grad_base_value(ctx, t); 

It goes to mat_transp_reduction method and dies then inside the last loop 

iterator pff = pf; 
for (size_type k = 0; k < dim; ++k, pff += co) { 
*pff = T(0); pt = tmp->begin(); pl = m.begin() + k; 
for (size_type l = 0; l < dimt; ++l, ++pt, pl += dim ) 
*pff += (*pl) * (*pt); 
} 

once the error 

_Myiter& operator+=(difference_type _Off) 
{ // increment by integer 
#if _ITERATOR_DEBUG_LEVEL == 2 
if (this->_Getcont() == 0 
|| this->_Ptr + _Off < ((_Myvec *)this->_Getcont())->_Myfirst 
|| ((_Myvec *)this->_Getcont())->_Mylast < this->_Ptr + _Off) 
{ // report error 
_DEBUG_ERROR("vector iterator + offset out of range"); 
_SCL_SECURE_OUT_OF_RANGE; 
} 
occurs in std include\vector file 

I believe it can not perform pl += dim anymore. 

I'm really frustrated since it out of my control. I rebuilt it with many 
compiler/linker options but cannot get a working library anymore 

Unfortunately, I don't understand this part of the code well so it's hard to me 
rewriting mat_transp_reduction in more correct manner. 

Yves, if you have any idea why it could die here please advise how to rewrite 
mat_transp_reduction method? 
What the difference between mat_transp_reduction and mat_reduction methods? In 
mat_reduction you just apply++pl but not pl += dim 

I will try to rebuild the getfem on different Visual Studio(2008,2013) but even 
it fixes the problem it's probably better to fix the reason(unstable code 
pieces) . 

Regards, Egor 


_______________________________________________
Getfem-users mailing list
address@hidden
https://mail.gna.org/listinfo/getfem-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]