### Author Topic: Possible infinite loop in structural_application  (Read 631 times)

#### Carlos Roig

• Newbie
• Posts: 16
##### Possible infinite loop in structural_application
« on: May 02, 2016, 11:57:14 AM »
Dear all,

I just detected that in the tensor_utility of the structural_application there is (at least) inconsistent loop:

the file:
https://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/custom_utilities/tensor_utils.h

the loop:

static inline void Contraction_Double(Fourth_Order_Tensor& Fourth_Tensor, Second_Order_Tensor Second_Tensor, Second_Order_Tensor Result_Tensor)
{
unsigned int size = Second_Tensor[0].size();
for (unsigned int i=0; i<size; i++)
{
for(unsigned int j=0; j<size; j++)
{
for (unsigned int k=0; k<size; k++)
{
for (unsigned int l =0; j<size; l++)
{
Result_Tensor(j)= Result_Tensor(j) + Fourth_Tensor[j](k,l)*Second_Tensor[k](l);
}
}
}
}
}

The underline code should be "l<size" in my opinion.

It looks like this was introduced in rev 1141, so it has been a long while there without nobody complaining about it.
Please, if you use the structural_application take this into account.

Br.

#### riccardo

• Global Moderator
• Newbie
• Posts: 47
##### Re: Possible infinite loop in structural_application
« Reply #1 on: May 02, 2016, 01:10:06 PM »
Dear Carlos,

I agree that the code looks wrong. I believe that this function is not being used, otherwise someone would have an error. My proposal would be to comment it out entirely, putting a comment of where the problem is.

if someone is actually using it an error would pop up...

what do you think?

cheers
Riccardo