crown  1.0.0
src/CrownComposite.cpp
Go to the documentation of this file.
00001 /*
00002  Copyright 2015 Nicolas Melot
00003 
00004  This file is part of Pelib.
00005 
00006  Pelib is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  Pelib is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with Pelib. If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 #include <pelib/Algebra.hpp>
00021 #include <pelib/Scalar.hpp>
00022 #include <pelib/AmplSolver.hpp>
00023 #include <pelib/Vector.hpp>
00024 #include <pelib/Matrix.hpp>
00025 #include <pelib/AmplInput.hpp>
00026 
00027 #include <crown/CrownModular.hpp>
00028 #include <crown/CrownComposite.hpp>
00029 #include <crown/CrownAllocationFastest.hpp>
00030 #include <crown/CrownMappingLTLG.hpp>
00031 #include <crown/CrownScalingHeight.hpp>
00032 #include <crown/CrownConfigBinary.hpp>
00033 #include <crown/CrownException.hpp>
00034 
00035 #include <crown/mapping.h>
00036 #include <crown/scaling.h>
00037 
00038 #ifdef debug
00039 #undef debug
00040 #endif
00041 
00042 #define debug(var) cout << "[" << __FILE__ << ":" << __FUNCTION__ << ":" << __LINE__ << "] " << #var << " = \"" << (var) << "\"" << endl;
00043 
00044 using namespace std;
00045 using namespace pelib;
00046 using namespace crown;
00047 
00048 void
00049 CrownComposite::initialize(const CrownScheduler *scheduler)
00050 {
00051         if(scheduler == NULL)
00052         {
00053                 this->scheduler = new CrownModular(NULL, NULL, NULL, NULL, showOutput, showError);
00054         }
00055         else
00056         {
00057                 this->scheduler = scheduler->clone();
00058         }
00059 }
00060 
00061 CrownComposite::CrownComposite(const CrownScheduler *scheduler, bool showOutput, bool showError) : CrownScheduler(NULL, showOutput, showError)
00062 {
00063         initialize(scheduler);
00064 
00065         // TODO: restore arbitrary configuration
00066         //delete this->config;
00067         //this->config = new CrownConfigBinary();
00068 }
00069 
00070 CrownComposite::CrownComposite(const Algebra &param, const CrownScheduler *scheduler, bool showOutput, bool showError) : CrownScheduler(param, NULL, showOutput, showError)
00071 {
00072         initialize(scheduler);
00073 
00074         // TODO: restore arbitrary configuration
00075         //delete this->config;
00076         //this->config = new CrownConfigBinary();
00077 }
00078 
00079 CrownComposite::CrownComposite(const Taskgraph &tg, const Platform &pt, const Algebra &param, const CrownScheduler *scheduler, bool showOutput, bool showError) : CrownScheduler(tg, pt, param, NULL, showOutput, showError)
00080 {
00081         initialize(scheduler);
00082 
00083         // TODO: restore arbitrary configuration
00084         //delete this->config;
00085         //this->config = new CrownConfigBinary();
00086 }
00087 
00088 CrownComposite::CrownComposite(const CrownComposite &src) : CrownScheduler(src)
00089 {
00090         initialize(src.scheduler);
00091         //delete this->config;
00092         //this->config = new CrownConfigBinary();
00093 }
00094 
00095 CrownComposite::~CrownComposite()
00096 {
00097         delete this->scheduler;
00098 }
00099 
00100 string
00101 CrownComposite::getShortDescription() const
00102 {
00103         return string("Comp.") + this->scheduler->getShortDescription();
00104 }
00105