diff --git a/examples/plot_sorted.py b/examples/plot_sorted.py index 8c47e73ff2a2d718625220ff00635cec979e10a6..a2482fd05cff524dc6d570f29a8399e7e9f9d16a 100644 --- a/examples/plot_sorted.py +++ b/examples/plot_sorted.py @@ -49,13 +49,26 @@ axis = [ 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, -1.0, - 0.0, 0.0, 1.0 + 0.0, 0.0, 1.0, + -1.0, -1.0, -1.0, + -1.0, -1.0, 0.0, + -1.0, -1.0, 1.0, + -1.0, 0.0, -1.0, + -1.0, 0.0, 0.0, + -1.0, 0.0, 1.0, + -1.0, 1.0, -1.0, + -1.0, 1.0, 0.0, + -1.0, 1.0, 1.0, + 0.0, -1.0, -1.0, + 0.0, -1.0, 0.0, + 0.0, -1.0, 1.0, + 0.0, 0.0, -1.0 ] #names = ["side", "edge", "corner"] -for orientation in range( 13 ): +for orientation in range( 26 ): # Read Quickshed accelerations data=loadtxt( "interaction_dump_%d.dat"%orientation ) @@ -121,7 +134,42 @@ for orientation in range( 13 ): #xlim(0, size(id)-1) grid() - savefig("accelerations_%d.png"%orientation) + savefig("accelerations_relative_%d.png"%orientation) + close() + + + # Plot ------------------------------------------------------- + figure(frameon=True) + + subplot(311, title="Acceleration along X") + #plot(id[abs(errx_s) > 0.001], e_errx_s , 'ro') + plot(pos, accx_u , 'bx') + plot(pos, accx_s , 'ro') + text( 0., 0.1, "axis=( %d %d %d )"%(axis[orientation*3 + 0], axis[orientation*3 + 1], axis[orientation*3 + 2]) , ha='center', backgroundcolor='w', fontsize=14) + ylim(-700, 700) + grid() + + subplot(312, title="Acceleration along Y") + #plot(id[abs(erry_s) > 0.001], e_erry_s , 'ro') + plot(pos, accy_u , 'bx') + plot(pos, accy_s , 'ro') + text( 0., 0.1, "axis=( %d %d %d )"%(axis[orientation*3 + 0], axis[orientation*3 + 1], axis[orientation*3 + 2]) , ha='center', backgroundcolor='w', fontsize=14) + ylim(-700, 700) + grid() + + subplot(313, title="Acceleration along Z") + #plot(id[abs(errz_s) > 0.001], e_errz_s , 'ro', label="Sorted") + plot(pos, accz_u , 'bx', label="Unsorted") + plot(pos, accz_s , 'ro', label="Sorted") + + text( 0., 0.1, "axis=( %d %d %d )"%(axis[orientation*3 + 0], axis[orientation*3 + 1], axis[orientation*3 + 2]) , ha='center', backgroundcolor='w', fontsize=14) + + legend(loc="upper right") + + ylim(-700, 700) + grid() + + savefig("accelerations_absolute_%d.png"%orientation) close() diff --git a/examples/test_bh_sorted.c b/examples/test_bh_sorted.c index a9609ba8ea53165d8918abc684e2d092ed17c1be..7f74823e13807f2b7503846a029dbf192ceeff74 100644 --- a/examples/test_bh_sorted.c +++ b/examples/test_bh_sorted.c @@ -2064,7 +2064,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) { * sorted and unsortde interactions. Outputs then the tow sets of accelerations * for accuracy tests. * @param N_parts Number of particles in each cell - * @param orientation Orientation of the cells ( 0 <= orientation < 13 ) + * @param orientation Orientation of the cells ( 0 <= orientation < 26 ) */ void test_direct_neighbour(int N_parts, int orientation) { @@ -2073,23 +2073,36 @@ void test_direct_neighbour(int N_parts, int orientation) { struct cell left, right; /* All 13 configurations */ - const float cell_shift[13 * 3] = { - 1.0, 1.0, 1.0, /* 0 */ - 1.0, 1.0, 0.0, /* 1 */ - 1.0, 1.0, -1.0, /* 2 */ - 1.0, 0.0, 1.0, /* 3 */ - 1.0, 0.0, 0.0, /* 4 */ - 1.0, 0.0, -1.0, /* 5 */ - 1.0, -1.0, 1.0, /* 6 */ - 1.0, -1.0, 0.0, /* 7 */ - 1.0, -1.0, -1.0, /* 8 */ - 0.0, 1.0, 1.0, /* 9 */ - 0.0, 1.0, 0.0, /* 10 */ - 0.0, 1.0, -1.0, /* 11 */ - 0.0, 0.0, 1.0 /* 12 */ + const float cell_shift[26 * 3] = { + 1.0, 1.0, 1.0, /* 0 */ + 1.0, 1.0, 0.0, /* 1 */ + 1.0, 1.0, -1.0, /* 2 */ + 1.0, 0.0, 1.0, /* 3 */ + 1.0, 0.0, 0.0, /* 4 */ + 1.0, 0.0, -1.0, /* 5 */ + 1.0, -1.0, 1.0, /* 6 */ + 1.0, -1.0, 0.0, /* 7 */ + 1.0, -1.0, -1.0, /* 8 */ + 0.0, 1.0, 1.0, /* 9 */ + 0.0, 1.0, 0.0, /* 10 */ + 0.0, 1.0, -1.0, /* 11 */ + 0.0, 0.0, 1.0, /* 12 */ + -1.0, -1.0, -1.0, /* 13 */ + -1.0, -1.0, 0.0, /* 14 */ + -1.0, -1.0, 1.0, /* 15 */ + -1.0, 0.0, -1.0, /* 16 */ + -1.0, 0.0, 0.0, /* 17 */ + -1.0, 0.0, 1.0, /* 18 */ + -1.0, 1.0, -1.0, /* 19 */ + -1.0, 1.0, 0.0, /* 20 */ + -1.0, 1.0, 1.0, /* 21 */ + 0.0, -1.0, -1.0, /* 22 */ + 0.0, -1.0, 0.0, /* 23 */ + 0.0, -1.0, 1.0, /* 24 */ + 0.0, 0.0, -1.0 /* 25 */ }; - if ( orientation >= 13 ) + if ( orientation >= 26 ) error( "Wrong orientation !" ); /* Select configuration */ @@ -2312,7 +2325,7 @@ int main(int argc, char *argv[]) { N_parts); /* Run the test */ - for ( k = 0 ; k < 13 ; ++k ) + for ( k = 0 ; k < 26 ; ++k ) test_direct_neighbour(N_parts, k); } else {