Exemple #1
0
void CSkelMeshViewer::Export()
{
	CMeshViewer::Export();

	CSkelMeshInstance *MeshInst = static_cast<CSkelMeshInstance*>(Inst);
	const CAnimSet *Anim = MeshInst->GetAnim();
	if (Anim) ExportObject(Anim->OriginalAnim);

	for (int i = 0; i < TaggedMeshes.Num(); i++)
		ExportObject(TaggedMeshes[i]->pMesh->OriginalMesh);
}
Exemple #2
0
void CVertMeshViewer::Export()
{
	CMeshViewer::Export();
	const UVertMesh *Mesh = static_cast<UVertMesh*>(Object);
	assert(Mesh);
	for (int i = 0; i < Mesh->Textures.Num(); i++)
	{
		const UUnrealMaterial *Tex = MATERIAL_CAST(Mesh->Textures[i]);
		ExportObject(Tex);
	}
}
Exemple #3
0
void CSkelMeshViewer::Export()
{
	// Export base mesh and animation
	Mesh->Anim = Anim;
	CMeshViewer::Export();
	Mesh->Anim = NULL;

	// Export all tagged meshes
	for (int i = 0; i < TaggedMeshes.Num(); i++)
		ExportObject(TaggedMeshes[i]->pMesh->OriginalMesh);
}
Exemple #4
0
void ExportMd5Mesh(const CSkeletalMesh *Mesh)
{
	guard(ExportMd5Mesh);

	int i;

	UObject *OriginalMesh = Mesh->OriginalMesh;
	if (!Mesh->Lods.Num())
	{
		appNotify("Mesh %s has 0 lods", OriginalMesh->Name);
		return;
	}

	FArchive *Ar = CreateExportArchive(OriginalMesh, "%s.md5mesh", OriginalMesh->Name);
	if (!Ar) return;

	const CSkelMeshLod &Lod = Mesh->Lods[0];

	Ar->Printf(
		"MD5Version 10\n"
		"commandline \"Created with UE Viewer\"\n"
		"\n"
		"numJoints %d\n"
		"numMeshes %d\n"
		"\n",
		Mesh->RefSkeleton.Num(),
		Lod.Sections.Num()
	);

	// compute skeleton
	TArray<CCoords> BoneCoords;
	BuildSkeleton(BoneCoords, Mesh->RefSkeleton);

	// write joints
	Ar->Printf("joints {\n");
	for (i = 0; i < Mesh->RefSkeleton.Num(); i++)
	{
		const CSkelMeshBone &B = Mesh->RefSkeleton[i];

		const CCoords &BC = BoneCoords[i];
		CVec3 BP;
		CQuat BO;
		BP = BC.origin;
		BO.FromAxis(BC.axis);
		if (BO.w < 0) BO.Negate();				// W-component of quaternion will be removed ...

		Ar->Printf(
			"\t\"%s\"\t%d ( %f %f %f ) ( %.10f %.10f %.10f )\n",
			*B.Name, (i == 0) ? -1 : B.ParentIndex,
			VECTOR_ARG(BP),
			BO.x, BO.y, BO.z
		);
#if 0
	//!!
if (i == 32 || i == 34)
{
	CCoords BC;
	BC.origin = BP;
	BO.ToAxis(BC.axis);
	appNotify("Bone %d (%8.3f %8.3f %8.3f) - (%8.3f %8.3f %8.3f %8.3f)", i, VECTOR_ARG(BP), QUAT_ARG(BO));
#define C BC
	appNotify("INV   : o=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.origin ));
	appNotify("        0=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.axis[0]));
	appNotify("        1=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.axis[1]));
	appNotify("        2=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.axis[2]));
#undef C
//	BO.Negate();
	BO.w *= -1;
	BO.ToAxis(BC.axis);
#define C BC
	appNotify("INV2  : o=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.origin ));
	appNotify("        0=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.axis[0]));
	appNotify("        1=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.axis[1]));
	appNotify("        2=%8.3f %8.3f %8.3f",    VECTOR_ARG(C.axis[2]));
#undef C
}
#endif
	}
	Ar->Printf("}\n\n");

	// collect weights information
	TArray<VertInfluences> Weights;				// Point -> Influences
	Weights.AddZeroed(Lod.NumVerts);
	for (i = 0; i < Lod.NumVerts; i++)
	{
		const CSkelMeshVertex &V = Lod.Verts[i];
		CVec4 UnpackedWeights;
		V.UnpackWeights(UnpackedWeights);
		for (int j = 0; j < NUM_INFLUENCES; j++)
		{
			if (V.Bone[j] < 0) break;
			VertInfluence *I = new (Weights[i].Inf) VertInfluence;
			I->Bone   = V.Bone[j];
			I->Weight = UnpackedWeights[j];
		}
	}

	CIndexBuffer::IndexAccessor_t Index = Lod.Indices.GetAccessor();

	// write meshes
	// we are using some terms here:
	// - "mesh vertex" is a vertex in Lod.Verts[] array, global for whole mesh
	// - "surcace vertex" is a vertex from the mesh stripped to only one (current) section
	for (int m = 0; m < Lod.Sections.Num(); m++)
	{
		const CMeshSection &Sec = Lod.Sections[m];

		TArray<int>  MeshVerts;					// surface vertex -> mesh vertex
		TArray<int>  BackWedge;					// mesh vertex -> surface vertex
		TArray<bool> UsedVerts;					// mesh vertex -> surface: used of not
		TArray<int>  MeshWeights;				// mesh vertex -> weight index
		MeshVerts.Empty(Lod.NumVerts);
		UsedVerts.AddZeroed(Lod.NumVerts);
		BackWedge.AddZeroed(Lod.NumVerts);
		MeshWeights.AddZeroed(Lod.NumVerts);

		// find verts and triangles for current material
		for (i = 0; i < Sec.NumFaces * 3; i++)
		{
			int idx = Index(i + Sec.FirstIndex);

			if (UsedVerts[idx]) continue;		// vertex is already used in previous triangle
			UsedVerts[idx] = true;
			int locWedge = MeshVerts.Add(idx);
			BackWedge[idx] = locWedge;
		}

		// find influences
		int WeightIndex = 0;
		for (i = 0; i < Lod.NumVerts; i++)
		{
			if (!UsedVerts[i]) continue;
			MeshWeights[i] = WeightIndex;
			WeightIndex += Weights[i].Inf.Num();
		}

		// mesh header
		const UUnrealMaterial *Tex = Sec.Material;
		if (Tex)
		{
			Ar->Printf(
				"mesh {\n"
				"\tshader \"%s\"\n\n",
				Tex->Name
			);
			ExportObject(Tex);
		}
		else
		{
			Ar->Printf(
				"mesh {\n"
				"\tshader \"material_%d\"\n\n",
				m
			);
		}
		// verts
		Ar->Printf("\tnumverts %d\n", MeshVerts.Num());
		for (i = 0; i < MeshVerts.Num(); i++)
		{
			int iPoint = MeshVerts[i];
			const CSkelMeshVertex &V = Lod.Verts[iPoint];
			Ar->Printf("\tvert %d ( %f %f ) %d %d\n",
				i, V.UV.U, V.UV.V, MeshWeights[iPoint], Weights[iPoint].Inf.Num());
		}
		// triangles
		Ar->Printf("\n\tnumtris %d\n", Sec.NumFaces);
		for (i = 0; i < Sec.NumFaces; i++)
		{
			Ar->Printf("\ttri %d", i);
#if MIRROR_MESH
			for (int j = 2; j >= 0; j--)
#else
			for (int j = 0; j < 3; j++)
#endif
				Ar->Printf(" %d", BackWedge[Index(Sec.FirstIndex + i * 3 + j)]);
			Ar->Printf("\n");
		}
		// weights
		Ar->Printf("\n\tnumweights %d\n", WeightIndex);
		int saveWeightIndex = WeightIndex;
		WeightIndex = 0;
		for (i = 0; i < Lod.NumVerts; i++)
		{
			if (!UsedVerts[i]) continue;
			for (int j = 0; j < Weights[i].Inf.Num(); j++)
			{
				const VertInfluence &I = Weights[i].Inf[j];
				CVec3 v;
				v = Lod.Verts[i].Position;
#if MIRROR_MESH
				v[1] *= -1;						// y
#endif
				BoneCoords[I.Bone].TransformPoint(v, v);
				Ar->Printf(
					"\tweight %d %d %f ( %f %f %f )\n",
					WeightIndex, I.Bone, I.Weight, VECTOR_ARG(v)
				);
				WeightIndex++;
			}
		}
		assert(saveWeightIndex == WeightIndex);

		// mesh footer
		Ar->Printf("}\n");
	}

	delete Ar;

	unguard;
}
Exemple #5
0
LONG ALMCALLBACK	admnProc(
	OBJECTID				theObject,
  pAObjMessage		system
	)
  {
	LONG				lRet						= A_OK;
  KBRECORD    kbRec;

  switch (system->message1)
    {
		case AOBJ_CREATED:
			kbRec.active = 1L;
      kbRec.version = DATAVersion;
			AObjAddData(theObject, &kbRec, sizeof(kbRec));
      break;
          
		case AOBJ_ASSIGNOBJECT:
			{
			KBRECORD*			kbRecSrc;
			OBJECTID			sourceObject;

		 	sourceObject = (OBJECTID)(system->message3);

			kbRecSrc = (KBRECORD*) AObjLockData(sourceObject, DATA0);
      kbRecSrc->version = DATAVersion;  // set if previously not set

      AObjSetData(
					theObject,
					DATA0,
					kbRecSrc,
          sizeof(KBRECORD));

      AEvtPostStandard(
					theObject,
					AEVENT_OBJECTCHANGED, 
					0,
          AEVT_ATTAIL|AEVT_KILLDUPLICATES);

			AObjUnlockData(sourceObject, DATA0);

			break;
			}

		case AOBJ_READ:
			{
			KBRECORD*		kbRec			= (KBRECORD*) AObjLockData(theObject, DATA0);

			// for all keyboard objects of version 1
			// translate the signals to match the MAC version, MAY 27, 1993
			if (kbRec->version < CORRECTSIGNALVERSION)
				{
				TranslateSignals(theObject);
        }

			kbRec->version = DATAVersion;  // set if previously not set

			if (kbRec->active != 0)
        kbRec->active = 1L;

			AObjUnlockData(theObject, DATA0);
			}
      break;
			
		case AOBJ_IMPORTOBJECT:
			ImportObject(theObject);
      break;

		case AOBJ_EXPORTOBJECT:
			ExportObject(theObject);
      break;

    case AOBJ_EDITOBJECT:
      if (EditKey(theObject))   // To manage description dlg
				lRet = A_MODIFIED;
      break;

    case AOBJ_CHECKOBJECT:
      break;

    case AOBJ_BUILDSIGNALS:
      doBuildSignals(system);
      break;

    default:
			lRet = A_NOTHANDLED;
      break;
    }

	return lRet;
  }
Exemple #6
0
// --- Main code ---
// -----------------
int main(int argc, char **argv)
{
	// ---> Set parameters
	// >>>> Input
	input_params input;
	int pid;
	string filename;		// Input file

	// Get file and folder
	if(argc == 1)
	{
		filename = "params_Part.in";
	}

	if(argc == 2)
	{
		filename = argv[1];
	}

	if(argc > 2)
	{
		cout << "--------------------------------------------------------------------------------" << endl << endl;

		cout << "ERROR: more than one argument given, simulation WON'T be set up!" << endl << endl;
		UsageHelp();
		cout << "--------------------------------------------------------------------------------" << endl;
		return 0;
	}

	// Read input
	ifstream inputF(filename.c_str());

	if(inputF.good())
	{
		pid = getpid();
		input.SetParamPart(inputF);
		inputF.close();
	}
	else
	{
		cout << " ERROR: input file \"" << filename << "\" not found!" << endl;
		inputF.close();
		return 0;
	}

	// >>>> Geometry parameters
	string SimType = "Part";
	SysConf conf(input,SimType);
	conf.SetNeighboursPart();
	if(conf.initCondType == 0)
	{
		conf.SetInitialPartAntiFerro();
	}
	else if(conf.initCondType == 1)
	{
		conf.SetInitialPartEmpty();
	}
	else if(conf.initCondType == 2)
	{
		conf.SetInitialPartStar3();
	}
	else
	{
		conf.SetInitialPart();
	}

	// >>>> Set up order parameters
	OrderParam dummyOrder(input);
	TwoDOrderParam dummy2DOrder;

	// ---> Prepare the output file/folder names
	// >>>> Output folder
	string outFolder	= input.outFolderName + "_" + ToString(input.nx) + "_" + ToString(input.ny) + "_" + ToString(input.p) + "_" + ToString(pid);
	mkdir(outFolder.c_str(),0777);

	// >>>> V/t folders
	vector<string> 		  vtFolder(input.VtN,outFolder + "/Vt_");
	for(int iii = 0; iii < input.VtN; ++iii)
	{
		vtFolder[iii] = vtFolder[iii] + ToString(input.VtValues[iii]);
		mkdir(vtFolder[iii].c_str(),0777);
	}

	string statusFolder = outFolder + "/status";
	mkdir(statusFolder.c_str(),0777);

	// >>>> Filenames
	string dummyString;
	string dummyStringBis;
	string outBase 		= "./" + outFolder + "/";
	string sysConfFilename	= outBase + "Obj_conf.odat";
	string 	param_out 	= outBase + filename;
	CpFile(filename.c_str(),param_out.c_str());

	// ---> MC parameters
	MCParameters params(input,conf.L,outFolder.c_str());

	// ---> Set up files
	// >>>> For the geometry
	ExportObject(conf,sysConfFilename.c_str());

	dummyString = "./" + outFolder + "/Obj_InputParams.odat";
	ExportObject(input,dummyString.c_str());

	for(int iii = 0; iii < input.VtN; ++iii)
	{
		// >>>> For the MC parameters
		dummyString 	= "./" + vtFolder[iii] + "/Obj_MCparams.odat";
		params.SetVt(input.VtValues[iii]);
		ExportObject(params,dummyString.c_str());

		// >>>> For the order parameters
		dummyString 	= "./" + vtFolder[iii];
		dummyOrder.SetVt(input.VtValues[iii]);
		dummyOrder.SetFolder(dummyString.c_str());

		dummy2DOrder.SetVt(input.VtValues[iii]);
		dummy2DOrder.SetFolder(dummyString.c_str());


		// Mean mag
		dummyOrder.SetType("Mag");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanMag.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		// Mean energy
		dummyOrder.SetType("Energy");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanEnergy.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("QEnergy");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanQEnergy.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("PotEnergy");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanPotEnergy.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("KinEnergy");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanKinEnergy.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummy2DOrder.Initialize(conf.L,1);
		dummy2DOrder.SetType("MeanKinEnergyDensity");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanKinEnergyDensity.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

                dummyOrder.SetType("QNewEnergy");
                dummyOrder.CreateFiles();
                dummyStringBis  = "./" + vtFolder[iii] + "/Obj_MeanQNewEnergy.odat";
                ExportObject(dummyOrder,dummyStringBis.c_str());
                
                dummyOrder.SetType("NewKinEnergy");
                dummyOrder.CreateFiles();
                dummyStringBis  = "./" + vtFolder[iii] + "/Obj_MeanNewKinEnergy.odat";
                ExportObject(dummyOrder,dummyStringBis.c_str());

		// Mean N_j
		dummyOrder.SetType("N0");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanN0.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("N1");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanN1.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("N2");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanN2.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("N3");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanN3.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("PlaquetteIndex");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanPlaquetteIndex.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("Star3Index");
		dummyOrder.CreateFiles();
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanStar3Index.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		// Mean mag stag
		if(conf.initCondType == 0)
		{
			if(input.ny==1)
			{
				dummyOrder.SetType("MeanStagMag");
				dummyOrder.CreateFiles();
				dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanStagMag.odat";
				ExportObject(dummyOrder,dummyStringBis.c_str());

				dummyOrder.SetType("MeanChainEnergy");
				dummyOrder.CreateFiles();
				dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanChainEnergy.odat";
				ExportObject(dummyOrder,dummyStringBis.c_str());

				dummyOrder.SetCorrLength(input.nx + input.p);
				dummyOrder.SetType("CorrMag");
				dummyOrder.CreateFiles();
				dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrMag.odat";
				ExportObject(dummyOrder,dummyStringBis.c_str());

				dummyOrder.SetType("CorrStagMag");
				dummyOrder.CreateFiles();
				dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrStagMag.odat";
				ExportObject(dummyOrder,dummyStringBis.c_str());
			}
			else
			{
				dummyOrder.SetType("MeanCoreMag");
				dummyOrder.CreateFiles();
				dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanCoreMag.odat";
				ExportObject(dummyOrder,dummyStringBis.c_str());
			}
		}

		// For the 2D order parameters
		dummy2DOrder.Initialize(conf.nx*conf.nx,1);
		dummy2DOrder.SetType("MeanPart");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanPart.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

		dummy2DOrder.Initialize(conf.L,1);
		dummy2DOrder.SetType("MeanLocalNf");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanLocalNf.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

		dummy2DOrder.Initialize(conf.L,conf.NbOfNeights);
		dummy2DOrder.SetType("MeanLocalDimer");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_MeanLocalDimer.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

		dummy2DOrder.Initialize(conf.L,1);
		dummy2DOrder.SetType("Star3Lattice");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_Star3.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

		dummyOrder.SetCorrLength(conf.N);
		dummyOrder.SetType("CorrSzSz");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrSzSz.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummyOrder.SetType("CorrSxSx");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrSxSx.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummy2DOrder.SetType("CorrMeanSz");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrMeanSzSz.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

		dummyOrder.SetType("CorrDimer");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrDimer.odat";
		ExportObject(dummyOrder,dummyStringBis.c_str());

		dummy2DOrder.Initialize(conf.L,conf.NbOfNeights);
		dummy2DOrder.SetType("CorrMeanDimer");
		dummyStringBis	= "./" + vtFolder[iii] + "/Obj_CorrMeanDimer.odat";
		ExportObject(dummy2DOrder,dummyStringBis.c_str());

		// >>>> For the RNG engine
		dummyString = "./" + vtFolder[iii] + "/Obj_Engine.odat";
		conf.ExportRNG(dummyString.c_str());
	}

	string scriptFilename	= "./run_Part_" + ToString(pid) + ".sh";
	string commandsFilename	= "comm_Part_" + ToString(pid) + ".sh";

	if(input.compType==0)
	{
		ofstream commandsFile(commandsFilename.c_str(),ios::trunc);
		int procCounter = 0;
		for(int iii = 0; iii < input.VtN; ++iii)
		{
			commandsFile 	<< "nice -19 ./" << input.execName << " " << outFolder
							<< "/Obj_conf.odat" << " " << vtFolder[iii]
							<< " > ${PWD}/" << vtFolder[iii] << "/out_log.txt &" <<  endl;
			++procCounter;
			if(procCounter==input.numProc)
			{
				commandsFile << "wait" << endl;
				procCounter = 0;
			}
		}
		commandsFile.close();
	}
	else if(input.compType==1||input.compType==2)
	{
		ofstream commandsFile(commandsFilename.c_str(),ios::trunc);
		for(int iii = 0; iii < input.VtN; ++iii)
		{
			commandsFile 	<< "nice -19 ./" << input.execName << " " << outFolder
							<< "/Obj_conf.odat" << " " << vtFolder[iii] << endl;
		}
		commandsFile.close();
	}
	else if(input.compType==3)
	{
		ofstream commandsFile(commandsFilename.c_str(),ios::trunc);
		for(int iii = 0; iii < input.VtN; ++iii)
		{
			commandsFile 	<< "srun --exclusive -N1 -n1 nice -19 ./" << input.execName << " " << outFolder
							<< "/Obj_conf.odat" << " " << vtFolder[iii] <<  endl;
		}
		commandsFile.close();
	}
	if(input.compType==0)
	{
		// Direct
		cout << "---> Output type        : direct - Lab (local)" << endl;
		cout << "     Execution script   : " << scriptFilename << endl;
		cout << "     Commands list      : " << commandsFilename << endl;

		ofstream scriptFile(scriptFilename.c_str(),ios::trunc);
		scriptFile << ". " << commandsFilename << endl;
		scriptFile << "./Merge " << outFolder << "/Obj_InputParams.odat" << " " << outFolder <<  endl;
		scriptFile.close();
	}
	if(input.compType==1)
	{
		// Parallel - simple
		cout << "---> Output type        : parallel - Lab (local)" << endl;
		cout << "     Execution script   : " << scriptFilename << endl;
		cout << "     Commands list      : " << commandsFilename << endl;

		ofstream scriptFile(scriptFilename.c_str(),ios::trunc);
		scriptFile << "parallel -j " << input.numProc << " < " << commandsFilename << endl;
		scriptFile << "./Merge " << outFolder << "/Obj_InputParams.odat" << " " << outFolder <<  endl;
		scriptFile.close();
	}
	if(input.compType==2)
	{
		// Torque - parallel
		string mergeScript 	= "merge_script_"  + ToString(pid) + ".sh";

		cout << "---> Output type        : TORQUE - Totoro, MESU" << endl;
		cout << "     Execution script   : none" << endl;
		cout << "     Commands list      : " << commandsFilename << endl;
		cout << "     Merge script       : " << mergeScript << endl;

		ofstream mergeFile(mergeScript.c_str(),ios::trunc);
		mergeFile << "./Merge " << outFolder << "/Obj_InputParams.odat" << " " << outFolder <<  endl;
		mergeFile.close();
	}
	if(input.compType==3)
	{
		// SLURM - parallel
		string SLURMbase 	= "parallel_base.sh";
		string mergeScript 	= "merge_script_"  + ToString(pid) + ".sh";

		cout << "---> Output type        : SLURM - Lab (cluster)" << endl;
		cout << "     Execution script   : " << scriptFilename << endl;
		cout << "     Commands list      : " << commandsFilename << endl;
		cout << "     Base file          : " << SLURMbase << endl;
		cout << "     Merge script       : " << mergeScript << endl << endl;
		cout << "--------------------------------------------------------------------------------" << endl << endl;
		cout << "---> Open '" << scriptFilename << "' to edit :" << endl;
		cout << "        Job name        : #SBATCH --job-name=[name]" << endl;
		cout << "        Number of CPU's : #SBATCH --ntask=[number]" <<  endl << endl;
		cout << "--------------------------------------------------------------------------------" << endl << endl;
		cout << "---> Submit job with       : 'sbatch " << scriptFilename << "'" << endl ;
		cout << "                             (from any computer, no need to use 'screen')" << endl << endl;
		cout << "     View job queue        : 'squeue'" << endl << endl;
		cout << "     View your jobs        : 'squeue -u [your username]'" << endl << endl;
		cout << "     To kill a job         : > get JOB ID no. from 'squeue -u [your username]'" << endl;
		cout << "                             > then 'scancel [job ID]'" << endl << endl;
		cout << "     View cluster status   : 'sinfo'" << endl;
		cout << "                             > 'idle'       computers are 100% free" << endl;
		cout << "                             > 'mix'        computers are partially free" << endl;
		cout << "                             > 'alloc'      computers are 100% full" << endl;
		cout << "                             > 'drain/down' computers are offline" << endl << endl;
		cout << "     The 'status' sub-folder contains files with the progress of the simulation" << endl << endl;
		cout << "--------------------------------------------------------------------------------" << endl << endl;

		CpFile(SLURMbase.c_str(),scriptFilename.c_str());
		ofstream scriptFile(scriptFilename.c_str(),ios::app);
		ofstream mergeFile(mergeScript.c_str(),ios::trunc);

		scriptFile << "$parallel < " << commandsFilename << endl;
		mergeFile << "./Merge " << outFolder << "/Obj_InputParams.odat" << " " << outFolder <<  endl;

		scriptFile.close();
		mergeFile.close();
	}

	return 0;
}