Skip to content

Commit

Permalink
Fixed #1656: 1d_stencil codes all have wrong factor
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jul 12, 2015
1 parent de5f98e commit deac1c9
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_1.cpp
Expand Up @@ -35,7 +35,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// do all the work on 'nx' data points for 'nt' time steps
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_1_omp.cpp
Expand Up @@ -52,7 +52,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// do all the work on 'nx' data points for 'nt' time steps
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_2.cpp
Expand Up @@ -54,7 +54,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// do all the work on 'nx' data points for 'nt' time steps
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_3.cpp
Expand Up @@ -84,7 +84,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_3_omp.cpp
Expand Up @@ -95,7 +95,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_4.cpp
Expand Up @@ -99,7 +99,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_4_parallel.cpp
Expand Up @@ -81,7 +81,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_5.cpp
Expand Up @@ -192,7 +192,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all elements
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_6.cpp
Expand Up @@ -243,7 +243,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all elements
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_7.cpp
Expand Up @@ -243,7 +243,7 @@ struct stepper
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

//[stepper_7
Expand Down
2 changes: 1 addition & 1 deletion examples/1d_stencil/1d_stencil_8.cpp
Expand Up @@ -352,7 +352,7 @@ struct stepper_server : hpx::components::simple_component_base<stepper_server>
// Our operator
static double heat(double left, double middle, double right)
{
return middle + (k*dt/dx*dx) * (left - 2*middle + right);
return middle + (k*dt/(dx*dx)) * (left - 2*middle + right);
}

// The partitioned operator, it invokes the heat operator above on all
Expand Down

0 comments on commit deac1c9

Please sign in to comment.