From f742eeb365d369ec23fc31b95a1d793f592627b9 Mon Sep 17 00:00:00 2001 From: "charles.prouveur@cea.fr" Date: Sun, 5 Nov 2023 23:46:07 +0100 Subject: [PATCH] clean up of ElectroMagnBC2D_SM.cpp and fix for Francesco email adress --- doc/Sphinx/Overview/partners.rst | 2 +- src/ElectroMagnBC/ElectroMagnBC2D_SM.cpp | 136 +++-------------------- 2 files changed, 18 insertions(+), 120 deletions(-) diff --git a/doc/Sphinx/Overview/partners.rst b/doc/Sphinx/Overview/partners.rst index 3b47d215d..2170321ba 100755 --- a/doc/Sphinx/Overview/partners.rst +++ b/doc/Sphinx/Overview/partners.rst @@ -56,7 +56,7 @@ Partners | | * `Julien Dérouillat `_ | | | * `Haithem Kallala `_ | | | * `Mathieu Lobet `_ | -| | * `Francesco Massimo `_ | +| | * `Francesco Massimo `_ | | | * `Charles Prouveur `_ | | | | +------------+---------------------------------------------------------------------------------------------------------+ diff --git a/src/ElectroMagnBC/ElectroMagnBC2D_SM.cpp b/src/ElectroMagnBC/ElectroMagnBC2D_SM.cpp index 109b83fd5..689a143ac 100755 --- a/src/ElectroMagnBC/ElectroMagnBC2D_SM.cpp +++ b/src/ElectroMagnBC/ElectroMagnBC2D_SM.cpp @@ -22,7 +22,6 @@ ElectroMagnBC2D_SM::ElectroMagnBC2D_SM( Params ¶ms, Patch *patch, unsigned i // Calculate axes indices axis0_ = i_boundary_ / 2; // axis normal to border axis1_ = axis0_ == 0 ? 1 : 0; // other axis (tangent to border) - //axis2_ = axis0_ == 2 ? 1 : 2; // other axis (tangent to border) sign_ = (double) (i_boundary_ % 2) *2 - 1.; // -1 or 1 for min or max // Index where to set the field along axis 0 @@ -44,7 +43,6 @@ ElectroMagnBC2D_SM::ElectroMagnBC2D_SM( Params ¶ms, Patch *patch, unsigned i B_val[axis1_].resize( n_p[axis1_], 0. ); // primal in the other direction B_val[2 ].resize( n_d[axis1_], 0. ); // dual in the other direction - // allocation on te device smilei::tools::gpu::HostDeviceMemoryManagement::DeviceAllocate( B_val[0].data(), B_val[0].size() ); smilei::tools::gpu::HostDeviceMemoryManagement::DeviceAllocate( B_val[1].data(), B_val[1].size() ); smilei::tools::gpu::HostDeviceMemoryManagement::DeviceAllocate( B_val[2].data(), B_val[2].size() ); @@ -72,21 +70,10 @@ ElectroMagnBC2D_SM::~ElectroMagnBC2D_SM() { for (int i=0 ; i > ()); - /*if( B_val[1] ) { - smilei::tools::gpu::HostDeviceMemoryManagement::DeviceFree( B_val[1].data(), B_val[1].size() ); - delete B_val[1]; - } - if( B_val[2] ) { - smilei::tools::gpu::HostDeviceMemoryManagement::DeviceFree( B_val[2].data(), B_val[2].size() ); - delete B_val[2]; - }*/ } - - void ElectroMagnBC2D_SM::save_fields( Field *my_field, Patch *patch ) { Field2D *field2D=static_cast( my_field ); @@ -126,8 +113,6 @@ void ElectroMagnBC2D_SM::disableExternalFields() B_val[2].resize( 0 ); } - - // --------------------------------------------------------------------------------------------------------------------- // Apply Boundary Conditions // --------------------------------------------------------------------------------------------------------------------- @@ -135,46 +120,33 @@ void ElectroMagnBC2D_SM::apply( ElectroMagn *EMfields, double time_dual, Patch * { if( patch->isBoundary( i_boundary_ ) ) { - // Static cast of the fields - /*std::vector E( 3 ); - E[0] = static_cast( EMfields->Ex_ ); - E[1] = static_cast( EMfields->Ey_ ); - E[2] = static_cast( EMfields->Ez_ ); - std::vector B( 3 ); - B[0] = static_cast( EMfields->Bx_ ); - B[1] = static_cast( EMfields->By_ ); - B[2] = static_cast( EMfields->Bz_ );//*/ - - const Field *E[3]{ EMfields->Ex_, EMfields->Ey_, EMfields->Ez_ }; const Field *B[3]{ EMfields->Bx_, EMfields->By_, EMfields->Bz_ }; - - const double *const __restrict__ E0 = E[0]->data_;//E[axis0_]->data_; - const double *const __restrict__ E1 = E[1]->data_;//E[axis1_]->data_; + const double *const __restrict__ E0 = E[0]->data_; + const double *const __restrict__ E1 = E[1]->data_; const double *const __restrict__ E2 = E[2]->data_; - double *const __restrict__ B0 = B[0]->data_;//B[axis0_]->data_; - double *const __restrict__ B1 = B[1]->data_;//B[axis1_]->data_; + double *const __restrict__ B0 = B[0]->data_; + double *const __restrict__ B1 = B[1]->data_; double *const __restrict__ B2 = B[2]->data_; - const double *const __restrict__ B_ext0 = B_val[0].data();//B_val[axis0_].data(); - const double *const __restrict__ B_ext1 = B_val[1].data();//B_val[axis1_].data(); + const double *const __restrict__ B_ext0 = B_val[0].data(); + const double *const __restrict__ B_ext1 = B_val[1].data(); const double *const __restrict__ B_ext2 = B_val[2].data(); #ifdef SMILEI_OPENACC_MODE - const int sizeofE0 = E[0]->number_of_points_;//E[axis0_]->number_of_points_; - const int sizeofE1 = E[1]->number_of_points_;//E[axis1_]->number_of_points_; + const int sizeofE0 = E[0]->number_of_points_; + const int sizeofE1 = E[1]->number_of_points_; const int sizeofE2 = E[2]->number_of_points_; - const int sizeofB0 = B[0]->number_of_points_;//B[axis0_]->number_of_points_; - const int sizeofB1 = B[1]->number_of_points_;//[axis1_]->number_of_points_; + const int sizeofB0 = B[0]->number_of_points_; + const int sizeofB1 = B[1]->number_of_points_; const int sizeofB2 = B[2]->number_of_points_; - const int B_ext_size0 = B_val[0].size();//B_val[axis0_].size(); - const int B_ext_size1 = B_val[1].size();//B_val[axis1_].size(); - const int B_ext_size2 = B_val[2].size();//*/ + const int B_ext_size0 = B_val[0].size(); + const int B_ext_size1 = B_val[1].size(); + const int B_ext_size2 = B_val[2].size(); #endif - const int isBoundary1min = patch->isBoundary( axis1_, 0 ); const int isBoundary1max = patch->isBoundary( axis1_, 1 ); @@ -216,41 +188,13 @@ void ElectroMagnBC2D_SM::apply( ElectroMagn *EMfields, double time_dual, Patch * #pragma omp teams distribute parallel for #endif for( unsigned int j=isBoundary1min; j