Page MenuHomec4science

interpolator.hh
No OneTemporary

File Metadata

Created
Mon, Nov 11, 23:35

interpolator.hh

/**
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2016 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef INTERPOLATOR_H
#define INTERPOLATOR_H
/* -------------------------------------------------------------------------- */
#include "surface.hh"
#include <sstream>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include "function.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
using namespace std;
/* -------------------------------------------------------------------------- */
enum INTERPOLATION_TYPE { BY_PROFILE, BY_PROFILE_II, VOLUMETRIC };
class Interpolator {
public:
Interpolator() { std::cout << "ERROR: Should not be here" << std::endl; exit(0); }
Interpolator(INTERPOLATION_TYPE it, int n, Real tol) {itype = it; num_inter_points = n; tolerance = tol;}
~Interpolator() {}
//! Interpolate by patch
void make_by_patch(Surface& original, int ix, int iy, int patch_size, int margin, bool parabola, Real max_value, vector<vector<Real> >& pdfs,
Real& area, Real& perimeter, Real& pressure, vector<vector<Real> >& interpolated_surface, string fname="");
//! Interpolate by patch, version 2
void make_by_patch2(Surface& original, int ix, int iy, int patch_size, int margin, bool parabola, Real max_value, vector<vector<Real> >& pdfs,
Real& area, Real& perimeter, Real& pressure, vector<vector<Real> >& interpolated_surface, string fname="");
//! Interpolate profile by profile
void make_by_profile(Surface original, int iline, bool parabola, bool vertical, Real max_value, vector<vector<Real> >& pdfs,
Real& area, Real& perimeter, Real& pressure, string fname="");
//! Interpolate all profiles
vector<vector<Real> > make_by_profile( Surface original, bool parabola, bool vertical=false );
//! Get shifted element for line
Real getRelativeElement(const vector<Real>& line, int act_pos, int shift );
//! Get shifted element for surface
Real getRelativeElement(Surface& surface, int act_pos_x, int act_pos_y, int shift_x, int shift_y);
//! Check convexity/concavity
bool if_concave( vector<Real>& points );
bool if_concave( vector<Real>& points, int start );
//! Find the distance to the closest local maximum
Real find_dist_to_max(bool forward, vector<Real>& points, int start);
//! assigning of elements
void assign_value(vector<vector<Real> >& surf, int i, int j, Real value);
void assign_value(vector<Real>& vec, int i, Real value);
void assign_value(vector<int>& vec, int i, Real value);
//! Interpolates locally along a profile, return increment to go to the next interpolation point
int interpolate(bool forward, bool horizontal, vector<vector<Real> >& interpolated_surface, int ix, int iy,
vector<Real>& original_points, INTER_FUNCTION_TYPE type, vector<int>& deja_interpolated, vector<Real>& slope, Real radius=0.,
//o tmp
Real val=0., int steps=1);
//x tmp
protected:
INTERPOLATION_TYPE itype;
int num_inter_points;
Real tolerance;
};
__END_TAMAAS__
#endif

Event Timeline