Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • feature/add-fft-interface
  • feature/expose-rnumber-from-simulations
  • feature/particle_state_generation_with_variable_box_size
  • feature/forcing-unit-test
  • feature/dealias-check2
  • bugfix/check_field_exists
  • feature/dealias-check
  • v3.x
  • feature/particles-vectorization
  • 6.2.4
  • 6.2.3
  • 6.2.2
  • 6.2.1
  • 6.2.0
  • 6.1.0
  • 6.0.0
  • 5.8.1
  • 5.8.0
  • 5.7.2
  • 5.7.1
  • 5.7.0
  • 5.6.0
  • 5.5.1
  • 5.5.0
  • 5.4.7
  • 5.4.6
  • 5.4.5
  • 5.4.4
  • 5.4.3
30 results

field.cpp

Blame
  • Cristian C Lalescu's avatar
    Cristian Lalescu authored
    code compiles, but doesn't do anything yet...
    341a305c
    History
    field.cpp 3.53 KiB
    /**********************************************************************
    *                                                                     *
    *  Copyright 2015 Max Planck Institute                                *
    *                 for Dynamics and Self-Organization                  *
    *                                                                     *
    *  This file is part of bfps.                                         *
    *                                                                     *
    *  bfps is free software: you can redistribute it and/or modify       *
    *  it under the terms of the GNU General Public License as published  *
    *  by the Free Software Foundation, either version 3 of the License,  *
    *  or (at your option) any later version.                             *
    *                                                                     *
    *  bfps is distributed in the hope that it will be useful,            *
    *  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
    *  GNU General Public License for more details.                       *
    *                                                                     *
    *  You should have received a copy of the GNU General Public License  *
    *  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
    *                                                                     *
    * Contact: Cristian.Lalescu@ds.mpg.de                                 *
    *                                                                     *
    **********************************************************************/
    
    
    #include "field.hpp"
    
    template <class number,
              field_backend be,
              field_components fc>
    field_container<number, be, fc>::field_container(
            int nx, int ny, int nz,
            MPI_Comm COMM_TO_USE)
    {
        this->comm = COMM_TO_USE;
        MPI_Comm_rank(this->comm, &this->myrank);
        MPI_Comm_size(this->comm, &this->nprocs);
    
        if (be == FFTW)
        {
            ptrdiff_t nfftw[3];
            nfftw[0] = nz;
            nfftw[1] = ny;
            nfftw[2] = nx;
            this->local_size = fftw_mpi_local_size_many(
                    3,
                    nfftw,
                    ncomp(fc),
                    FFTW_MPI_DEFAULT_BLOCK,
                    this->comm,
                    this->subsizes,
                    this->starts);
        }
        this->sizes[0] = nz;
        this->sizes[1] = ny;
        this->sizes[2] = nx;
        if (fc == THREE || fc == THREExTHREE)
            this->sizes[3] = 3;
        if (fc == THREExTHREE)
            this->sizes[4] = 3;
        if (be == FFTW)
        {
            for (int i=1; i<ndim(fc); i++)
            {
                this->subsizes[i] = this->sizes[i];
                this->starts[i] = 0;
            }
        }
    }
    
    template <class number,
              field_backend be,
              field_components fc>
    field_container<number, be, fc>::~field_container()
    {}
    
    template <class number,
              field_backend be,
              field_components fc>
    int field_container<number, be, fc>::read(
            const char *fname,
            const char *dset_name,
            int iteration)
    {
        return EXIT_SUCCESS;
    }
    
    template <class number,
              field_backend be,
              field_components fc>
    int field_container<number, be, fc>::write(
            const char *fname,
            const char *dset_name,
            int iteration)
    {
        return EXIT_SUCCESS;
    }
    
    //template <class rnum,
    //          field_representation repr,
    //          field_backend be,
    //          field_components fc>
    //field::field(
    //                int *n,
    //                MPI_Comm COMM_TO_USE)
    //{}
    //
    //field::~field()
    //{}