/*
  This file is part of CDO. CDO is a collection of Operators to
  manipulate and analyse Climate model Data.

  Copyright (C) 2003-2020 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
  See COPYING file for copying and redistribution conditions.

  This program 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; version 2 of the License.

  This program 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.
*/
#ifndef INTERPOL_H
#define INTERPOL_H

#include <stdio.h>

class Field;

void intgridbil(Field &field1, Field &field2);
void intgridcon(Field &field1, Field &field2);
void interpolate(Field &field1, Field &field2);
void intgriddis(Field &field1, Field &field2, size_t nnn);

constexpr double
intlin(const double x, const double y1, const double x1, const double y2, const double x2)
{
  // intlin - lineare interpolation

  // Uwe Schulzweida  04/05/1995

  return (y2 * (x - x1) + y1 * (x2 - x)) / (x2 - x1);
}

#endif
