1 /** \file
2 * \brief implements class VariableEmbeddingInserter
3 *
4 * \author Carsten Gutwenger
5 *
6 * \par License:
7 * This file is part of the Open Graph Drawing Framework (OGDF).
8 *
9 * \par
10 * Copyright (C)<br>
11 * See README.md in the OGDF root directory for details.
12 *
13 * \par
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * Version 2 or 3 as published by the Free Software Foundation;
17 * see the file LICENSE.txt included in the packaging of this file
18 * for details.
19 *
20 * \par
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * \par
27 * You should have received a copy of the GNU General Public
28 * License along with this program; if not, see
29 * http://www.gnu.org/copyleft/gpl.html
30 */
31
32 #include <ogdf/planarity/VariableEmbeddingInserter.h>
33 #include <ogdf/planarity/embedding_inserter/VarEdgeInserterCore.h>
34
35 namespace ogdf {
36
37 // clone method
clone() const38 EdgeInsertionModule *VariableEmbeddingInserter::clone() const
39 {
40 return new VariableEmbeddingInserter(*this);
41 }
42
43 // actual call method
doCall(PlanRepLight & pr,const Array<edge> & origEdges,const EdgeArray<int> * pCostOrig,const EdgeArray<bool> * pForbiddenOrig,const EdgeArray<uint32_t> * pEdgeSubgraph)44 Module::ReturnType VariableEmbeddingInserter::doCall(
45 PlanRepLight &pr,
46 const Array<edge> &origEdges,
47 const EdgeArray<int> *pCostOrig,
48 const EdgeArray<bool> *pForbiddenOrig,
49 const EdgeArray<uint32_t> *pEdgeSubgraph)
50 {
51 VarEdgeInserterCore core(pr, pCostOrig, pForbiddenOrig, pEdgeSubgraph);
52 core.timeLimit(timeLimit());
53
54 ReturnType retVal = core.call(origEdges, removeReinsert(), percentMostCrossed());
55 runsPostprocessing(core.runsPostprocessing());
56 return retVal;
57 }
58
59 // actual call method for postprocessing only
doCallPostprocessing(PlanRepLight & pr,const Array<edge> & origEdges,const EdgeArray<int> * pCostOrig,const EdgeArray<bool> * pForbiddenOrig,const EdgeArray<uint32_t> * pEdgeSubgraphs)60 Module::ReturnType VariableEmbeddingInserter::doCallPostprocessing(
61 PlanRepLight &pr,
62 const Array<edge> &origEdges,
63 const EdgeArray<int> *pCostOrig,
64 const EdgeArray<bool> *pForbiddenOrig,
65 const EdgeArray<uint32_t> *pEdgeSubgraphs)
66 {
67 VarEdgeInserterCore core(pr, pCostOrig, pForbiddenOrig, pEdgeSubgraphs);
68 core.timeLimit(timeLimit());
69
70 ReturnType retVal = core.callPostprocessing(origEdges, removeReinsert(), percentMostCrossed());
71 runsPostprocessing(core.runsPostprocessing());
72 return retVal;
73 }
74
75 }
76