/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2016 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM 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.

    OpenFOAM 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 OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
    Foam::LinearInterpolator1D

Description

SourceFiles
    LinearInterpolator1DI.H
    LinearInterpolator1D.C
    LinearInterpolator1DIO.C

\*---------------------------------------------------------------------------*/

#ifndef LinearInterpolator1D_H
#define LinearInterpolator1D_H

#include "scalarField.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

// Forward declaration of classes
class Istream;
class Ostream;

// Forward declaration of friend functions and operators
class LinearInterpolator1D;
Istream& operator>>(Istream&, LinearInterpolator1D&);
Ostream& operator<<(Ostream&, const LinearInterpolator1D&);


/*---------------------------------------------------------------------------*\
                         Class LinearInterpolator1D Declaration
\*---------------------------------------------------------------------------*/

class LinearInterpolator1D
{
    // Private data

        //- Source grids
        scalarField srcGrid_;

        //- Destination grids
        scalarField dstGrid_;

        //- Source grid to refer for each dst grid
        labelList idxHigh_;

        //- Coefficients for dst grid points
        scalarField coef_;


    // Private Member Functions

        //- Check grid sorted
        bool _checkSorted(const scalarField& grid);

        //- Disallow default bitwise copy construct
        LinearInterpolator1D(const LinearInterpolator1D&);

        //- Disallow default bitwise assignment
        void operator=(const LinearInterpolator1D&);


public:


    // Constructors

        //- Construct null
        LinearInterpolator1D();

        //- Construct from components
        LinearInterpolator1D(const scalarField& srcGrid, const scalarField& dstGrid);

        //- Construct from Istream
        LinearInterpolator1D(Istream&);



    //- Destructor
    ~LinearInterpolator1D();


    // Member Functions

        // Access

        // Check

        // Edit

        // Write

        //- Evaluate interpolation
        void interpolate(const scalarField& src, scalarField& dst);


    // Member Operators



    // Friend Functions

    // Friend Operators

    // IOstream Operators

        friend Istream& operator>>(Istream&, LinearInterpolator1D&);
        friend Ostream& operator<<(Ostream&, const LinearInterpolator1D&);
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "LinearInterpolator1DI.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
