/**
 *  \brief     MeshParameters class
 *  \details   Used for mesh generation. To create mesh, faces and solids have to be added, as well as mesh parameters have to be set.
 *  \author    vadims
 *  \date      May 10, 2017
 *  \bug       Not all memory is freed when deleting an object of this class.
 *  \warning   Improper use can crash your application
 *  \copyright CENOS LLC
 */


#pragma once
#include <TopoDS.hxx>
#include <vector>
#include "topology/ShapeTypes.hpp"


struct SalomeVLParams
{
	double expansion_factor;
	double total_thickness;
	int nr_of_layers;
	std::vector<std::string> no_layers_on;
};

class MeshParameters
{
public:
	MeshParameters(ShapeType st = ShapeType::SOLID);
	~MeshParameters();
	/// <summary>
	/// Constructor takes shape as argument and calculates sizing accordingly. 
	/// This is recommended constructor, as using default constructor will initialize sizing to default values which may be completely off for current shape
	/// </summary>
	/// <param name="shape"> Shape that will be used to calculate sizing </param>
	MeshParameters(TopoDS_Shape);
	MeshParameters(const MeshParameters& that);
	void operator = (const MeshParameters& that);

	//set functions
	// status (calculated) is reset to false after each setting
	void setMaxH(double);
	void setMinH(double);
	void setGrading(double);
	void setDensityFactor(double);


	double getMaxH();
	double getGrading();
	double getMinH();
	double getDensityFactor();


	void calculateLayers(double skin_min, double skin_max, double geom_limit = 0);

	static SalomeVLParams getSalomeVL(double skin_min, double skin_max);

	ShapeType getType();

	std::vector<double> getLayers();

private:

	ShapeType param_type;

	double maxh;
	double minh;
	double grading;
	double density_factor;

	/// <summary>
	/// Thicknesses of boundary layers
	/// </summary>
	std::vector<double> thicknesses;

};

typedef  std::shared_ptr<MeshParameters> MeshParameters_;