/* * Advanced Simulation Library * * Copyright 2015 Avtech Scientific * * * This file is part of Advanced Simulation Library (ASL). * * ASL is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, version 3 of the License. * * ASL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with ASL. If not, see . * */ #include "aslMATFormat.h" #include #include #include #include #include "math/aslVectors.h" #include "acl/acl.h" using namespace std; namespace asl { void writeMAT(const string &fileName, const AbstractData & data, const string & name) { mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL ")); unsigned int nComp(data.getDContainer().size()); std::vector names(nComp,name); for (unsigned int i(0); i < nComp; ++i) names[i]+="-"+numToStr(i); SPMatVar var(castMATLABCellArray(data,names)); Mat_VarWrite(matFile,var->var, 0); Mat_Close(matFile); } void writeMAT(const string &fileName, vector> data) { mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL ")); for(unsigned int k(0); kgetDContainer().size()); std::vector names(nComp,data[k].second); for (unsigned int i(0); i < nComp; ++i) names[i]+="-"+numToStr(i); SPMatVar var(castMATLABCellArray(*data[k].first,names)); Mat_VarWrite(matFile,var->var, 0); } Mat_Close(matFile); } void writeMAT(const string &fileName, vector> data) { mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL ")); for(unsigned int k(0); kvar, 0); } Mat_Close(matFile); } void writeMAT(const string &fileName,Probe & probe, unsigned int component, const string & name) { mat_t* matFile(Mat_Create(fileName.c_str(),"This file was created by ASL ")); SPMatVar var(castMATLABCellArray(probe,component,name)); Mat_VarWrite(matFile,var->var, 0); Mat_Close(matFile); } } //asl