Commit fdc72017 authored by tilman.metz's avatar tilman.metz

Fixed unecessary allocation

By using an operator of FDORDER length an addiotional frame around the subgrids with FDORDER/2 length instead of FDORDER/2+1 length is needed.
For example by using second order you will need one additional gridpoint to calculate the differences.
parent 5279c595
......@@ -25,7 +25,7 @@
#include "fd.h"
void exchange_s(float ** sxx, float ** syy,
void exchange_s(int nd, float ** sxx, float ** syy,
float ** sxy, float ** bufferlef_to_rig, float ** bufferrig_to_lef,
float ** buffertop_to_bot, float ** bufferbot_to_top,
MPI_Request *req_send, MPI_Request *req_rec){
......@@ -38,7 +38,7 @@ void exchange_s(float ** sxx, float ** syy,
int i, j, fdo, fdo2, n, l;
fdo = FDORDER/2 + 1;
fdo = nd;
// fdo2 = FDORDER + 1;
fdo2 = 2*fdo;
......
......@@ -25,7 +25,7 @@
#include "fd.h"
void exchange_v(float ** vx, float ** vy,
void exchange_v(int nd, float ** vx, float ** vy,
float ** bufferlef_to_rig, float ** bufferrig_to_lef,
float ** buffertop_to_bot, float ** bufferbot_to_top,
MPI_Request * req_send, MPI_Request * req_rec){
......@@ -39,7 +39,7 @@ void exchange_v(float ** vx, float ** vy,
fdo = FDORDER/2 + 1;
fdo = nd;
// fdo2= FDORDER + 1;
fdo2 = 2*fdo;
......
......@@ -86,12 +86,12 @@ void exchange_s_rsg ( float ** vx, float ** vy, float ** vz,
float ** bufferlef_to_rig, float ** bufferrig_to_lef,
float ** buffertop_to_bot, float ** bufferbot_to_top );
void exchange_v ( float ** vx, float ** vy,
void exchange_v (int nd, float ** vx, float ** vy,
float ** bufferlef_to_rig, float ** bufferrig_to_lef,
float ** buffertop_to_bot, float ** bufferbot_to_top,
MPI_Request * req_send, MPI_Request * req_rec );
void exchange_s ( float ** sxx, float ** syy,
void exchange_s ( int nd, float ** sxx, float ** syy,
float ** sxy, float ** bufferlef_to_rig, float ** bufferrig_to_lef,
float ** buffertop_to_bot, float ** bufferbot_to_top,
MPI_Request * req_send, MPI_Request * req_rec );
......
......@@ -262,7 +262,7 @@ int main ( int argc, char **argv )
}
/*allocate memory for dynamic, static and buffer arrays */
nd = FDORDER / 2 + 1;
nd = FDORDER / 2;
fdo3 = 2 * nd;
fac1 = ( NX + fdo3 ) * ( NY + fdo3 );
......@@ -739,7 +739,7 @@ int main ( int argc, char **argv )
/* ------- exchange of particle velocities between PEs --------------*/
/*---------------------------------------------------------------*/
exchange_v ( pvx, pvy, bufferlef_to_rig, bufferrig_to_lef, buffertop_to_bot, bufferbot_to_top, req_send, req_rec );
exchange_v ( nd, pvx, pvy, bufferlef_to_rig, bufferrig_to_lef, buffertop_to_bot, bufferbot_to_top, req_send, req_rec );
if ( ( MYID == 0 )
&& ( ( nt + ( OUTNTIMESTEPINFO - 1 ) ) % OUTNTIMESTEPINFO ) == 0 ) {
......@@ -843,7 +843,7 @@ int main ( int argc, char **argv )
/*if ( RSG ) {
exchange_s_rsg ( psxx, psyy, psxy, bufferlef_to_rig, bufferrig_to_lef, buffertop_to_bot, bufferbot_to_top );
} else {*/
exchange_s ( psxx, psyy, psxy, bufferlef_to_rig, bufferrig_to_lef, buffertop_to_bot, bufferbot_to_top, req_send, req_rec );
exchange_s (nd, psxx, psyy, psxy, bufferlef_to_rig, bufferrig_to_lef, buffertop_to_bot, bufferbot_to_top, req_send, req_rec );
if ( ( MYID == 0 ) && ( ( nt + ( OUTNTIMESTEPINFO - 1 ) ) % OUTNTIMESTEPINFO ) == 0 ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment