#pragma once

#include "base.h"
#include "core.h"

template < typename TYPE >
void execute(int pde_type)
{
	CORE<TYPE> core;
	core.lbm.pde_type = pde_type;

//	sprintf(core.target_dir,"output_%s_%s_%s_%s_%d_%d%s",(pde_type==NSE)?"nse":"ade",core.lbm.id, core.lbm.id_col,TYPE::T_MM::id,core.ORDER,core.MFCO,(core.use_symbolic_coefs)?"_symbolic":"");
	sprintf(core.target_dir,"output_%s_%s_%s_%s",core.lbm.id,(pde_type==NSE)?"nse":"ade", core.lbm.id_col,(core.use_symbolic_coefs)?"symbolic":"");

	// check whether the output dir already exists
	if (core.file_exists(core.target_dir))
	{
		printf("warning: directory %s already exists, skipping ...", core.target_dir);
		printf("(remove %s if you want to recompute the results and run the code again)\n", core.target_dir);
		return;
	}

	mkdir(core.target_dir,0777);

	core.log("LBMAT: d=%d q=%d order=%d mfco=%d model=%s_%s M=%s pde_type=%s do_subs=%s pid=%d", core.D, core.Q, core.ORDER, core.MFCO, core.lbm.id, core.lbm.id_col, TYPE::T_MM::id, pde_type==NSE ? "NSE" : "ADE", (core.use_symbolic_coefs)?"yes":"no",getpid());
	core.verbosity = 1;


	core.compute_all();

	core.log("Finished");
}
