-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoSweep.cc
56 lines (46 loc) · 1.5 KB
/
AutoSweep.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "AutoSweep.h"
#include "SharedObject.h"
#include "log.h"
void AutoSweep::updateModel(const MineField* mf)
{
if (_model.empty())
{
_model.allocCells(mf->getRows(), mf->getCols());
_model.resetCells();
Log::print(Log::VERBOSE, "ConstraintSweep::updateModel() initializing model size = %d,%d\n",
_model.getRows(), _model.getCols());
}
for (int i = 0; i < mf->getRows(); i++)
{
for (int j = 0; j < mf->getCols(); j++)
{
Cell& m = _model.getCell(i, j);
const Cell& r = mf->getCell(i, j);
m.setValue(r.getValue());
m.setState(r.getState());
}
}
}
AutoSweep* AutoSweep::loadSolver(const std::string& name)
{
SharedObject solver_so;
std::string full_name = "lib";
full_name += name;
full_name += ".";
full_name += SharedObject::sharedObjectExtension();
if (!solver_so.open(full_name.c_str()))
{
Log::print(Log::ERROR, "Error opening solver shared object '%s' : %s\n",
full_name.c_str(), solver_so.lastError().c_str());
return 0;
}
AutoSweep *solver = solver_so.createObject<AutoSweep>("initialize", "");
if (solver == NULL)
{
Log::print(Log::ERROR, "Error initializing solver '%s' : %s\n",
full_name.c_str(), solver_so.lastError().c_str());
return 0;
}
// lcc::Log::verbose("bootstrap: loaded scanner dso '%s'", scanner_dso_path.c_str());
return solver;
}