Skip to content
Snippets Groups Projects
Select Git revision
  • a1d239451e6e36403915cf421057ad66fbbf30d4
  • 2023 default protected
2 results

julia.py

Blame
  • ALL_fortran.cpp 5.00 KiB
    /*
    Copyright 2018 Rene Halver, Forschungszentrum Juelich GmbH, Germany
    Copyright 2018 Godehard Sutmann, Forschungszentrum Juelich GmbH, Germany
    
    Redistribution and use in source and binary forms, with or without modification, 
    are permitted provided that the following conditions are met:
    
    1. Redistributions of source code must retain the above copyright notice, this 
       list of conditions and the following disclaimer.
    
    2. Redistributions in binary form must reproduce the above copyright notice, this 
       list of conditions and the following disclaimer in the documentation and/or 
       other materials provided with the distribution.
    
    3. Neither the name of the copyright holder nor the names of its contributors may 
       be used to endorse or promote products derived from this software without 
       specific prior written permission.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
    IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
    OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
    POSSIBILITY OF SUCH DAMAGE.
    */
    
    #include "../include/ALL.hpp"
    
    extern "C"
    {
        // wrapper to create a ALL<double,double> object (should be the
        // most commonly used one)
        ALL<double,double>* ALL_init_f(const int dim, double gamma)
        {
            return new ALL<double,double>(dim,gamma);
        }
    
        // set grid parameters
        void ALL_set_proc_grid_params_f(ALL<double,double>* all_obj, int nloc, int* loc, int nsize, int* size)
        {
    	if(all_obj->get_dimension() != nloc) throw ALL_Invalid_Argument_Exception(__FILE__,__func__,__LINE__,"Length of index array does not match dimension");
    	if(all_obj->get_dimension() != nsize) throw ALL_Invalid_Argument_Exception(__FILE__,__func__,__LINE__,"Length of size array does not match dimension");
            all_obj->set_proc_grid_params(loc,size);
        }
    
        // wrapper to set the minimum domain size
        void ALL_set_min_domain_size_f(ALL<double,double>* all_obj, ALL_LB_t method, int dim, double* domain_size)
        {
    	if(all_obj->get_dimension() != dim) throw ALL_Invalid_Argument_Exception(__FILE__,__func__,__LINE__,"Length of array does not match dimension");
    	all_obj->set_min_domain_size(method, domain_size);
        }
    
        // wrapper to set the work (scalar only for the moment)
        void ALL_set_work_f(ALL<double,double>* all_obj, double work)
        {
            all_obj->set_work(work);
        }
    
        // wrapper to set the vertices (using an array of double values and dimension)
        void ALL_set_vertices_f(ALL<double,double>* all_obj, const int n, const int dim, const double* vertices)
        {
            all_obj->set_vertices(n,dim,vertices);
        }
    
        // wrapper to set the communicator
        void ALL_set_communicator_f(ALL<double,double>* all_obj, MPI_Fint fcomm)