#include "cell.h"
#include <stdio.h>

// output possibilities
int
sprintf_Cell1D (char* str, Cell1D cell)
{
  char var_str[1000];
  sprintf_PrimitiveVars(var_str, conserv2primitive(cell.vars));
  return sprintf(str, "%8.6E\t%s\t%8.6E", cell.x, var_str, cell.convergence);
}

// Cell1D operator overloading
const ConservVars
operator+ (Cell1D c1, Cell1D c2)
{
return c1.vars + c2.vars;
}

const ConservVars
operator- (Cell1D c1, Cell1D c2)
{
return c1.vars - c2.vars;
}

const ConservVars
operator* (Cell1D c1, Cell1D c2)
{
return c1.vars * c2.vars;
}

const ConservVars
operator/ (Cell1D c1, Cell1D c2)
{
return c1.vars / c2.vars;
}

// Cell1D-ConservVars operator overloading

const ConservVars
operator+ (Cell1D cell, ConservVars vars)
{
return cell.vars + vars;
}

const ConservVars
operator+ (ConservVars vars, Cell1D cell)
{
return vars + cell.vars;
}

const ConservVars
operator- (Cell1D cell, ConservVars vars)
{
return cell.vars - vars;
}

const ConservVars
operator- (ConservVars vars, Cell1D cell)
{
return vars - cell.vars;
}

const ConservVars
operator* (Cell1D cell, ConservVars vars)
{
return cell.vars * vars;
}

const ConservVars
operator* (ConservVars vars, Cell1D cell)
{
return vars * cell.vars;
}

const ConservVars
operator/ (Cell1D cell, ConservVars vars)
{
return cell.vars / vars;
}

const ConservVars
operator/ (ConservVars vars, Cell1D cell)
{
return vars / cell.vars;
}

// Cell1D-double operator overloading

const ConservVars
operator+ (Cell1D cell, double num)
{
return cell.vars + num;
}

const ConservVars
operator+ (double num, Cell1D cell)
{
return num + cell.vars;
}

const ConservVars
operator- (Cell1D cell, double num)
{
return cell.vars - num;
}

const ConservVars
operator- (double num, Cell1D cell)
{
return num - cell.vars;
}

const ConservVars
operator* (Cell1D cell, double num)
{
return cell.vars * num;
}

const ConservVars
operator* (double num, Cell1D cell)
{
return num * cell.vars;
}

const ConservVars
operator/ (Cell1D cell, double num)
{
return cell.vars / num;
}

const ConservVars
operator/ (double num, Cell1D cell)
{
return num / cell.vars;
}