/*!\file Icefront.h
 * \brief: header file for icefront object
 */

#ifndef _ICEFRONT_H_
#define _ICEFRONT_H_

#include "./Load.h"
#include "./Matpar.h"
#include "./Element.h"
#include "./Node.h"

#define MAX_ICEFRONT_GRIDS 4 //max number of grids for a certain load
#define ICEFRONTSTRING 20 //max string length

class Icefront: public Load {

	private: 
		char	type[ICEFRONTSTRING];
		int		sid;
	
		/*material: */
		int mparid; //material id
		Matpar* matpar; 
		int   matpar_offset;
	
		/*element of icefront: */
		int 	element_type;
		int     eid;  //id of element on ice front
		Element* element;
		int     element_offset;

		/*nodes: */
		int   node_ids[MAX_ICEFRONT_GRIDS]; //node ids
		Node* nodes[MAX_ICEFRONT_GRIDS]; //node pointers
		int   node_offsets[MAX_ICEFRONT_GRIDS]; //node offsets in nodes dataset

		/*properties: */
		double		h[MAX_ICEFRONT_GRIDS]; //thickness
		double		b[MAX_ICEFRONT_GRIDS]; //bed

	public:

		Icefront();
		Icefront(char type[ICEFRONTSTRING],int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double	b[MAX_ICEFRONT_GRIDS]);
		~Icefront();

		void  Echo();
		void  Marshall(char** pmarshalled_dataset);
		int   MarshallSize();
		char* GetName();
		void  Demarshall(char** pmarshalled_dataset);
		int   Enum();
		int   GetId(); 
		int   MyRank();
		void  DistributeNumDofs(int* numdofspernode,int analysis_type);
		void  Configure(void* elements,void* nodes,void* materials);
		void  CreateKMatrix(Mat Kgg,ParameterInputs* inputs,int analysis_type);
		void  UpdateFromInputs(ParameterInputs* inputs);
		
		void  CreatePVector(Vec pg, ParameterInputs* inputs, int analysis_type);
		void  CreatePVectorDiagnosticHoriz( Vec pg, ParameterInputs* inputs, int analysis_type);
		void  CreatePVectorDiagnosticHorizSegment( Vec pg,ParameterInputs* inputs, int analysis_type);
		void  CreatePVectorDiagnosticHorizQuad( Vec pg,ParameterInputs* inputs, int analysis_type);
		void  GetDofList(int* doflist,int* pnumberofdofs);
		void  SegmentPressureLoad(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, double* normal,double length,int fill);
		void  PenaltyCreateKMatrix(Mat Kgg,ParameterInputs* inputs,double kmax,int analysis_type);
		void  PenaltyCreatePVector(Vec pg,ParameterInputs* inputs,double kmax,int analysis_type);
		Object* copy();
};

#endif  /* _ICEFRONT_H_ */
