Skip to content

Commit 113235f

Browse files
committed
Some build fixes
1 parent d2d6aa7 commit 113235f

File tree

5 files changed

+34
-46
lines changed

5 files changed

+34
-46
lines changed

src/Core/Algorithms/BrainStimulator/ElectrodeCoilSetupAlgorithm.cc

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <Core/Algorithms/Legacy/Fields/DistanceField/CalculateSignedDistanceField.h>
3636
#include <Core/Algorithms/Legacy/Fields/FieldData/ConvertFieldBasisType.h>
3737
#include <Core/Algorithms/Legacy/Fields/FieldData/GetFieldData.h>
38-
#include <Core/Algorithms/Legacy/Fields/TransformMesh/AlignMeshBoundingBoxes.h>
3938
#include <Core/Algorithms/Legacy/Fields/MeshDerivatives/SplitByConnectedRegion.h>
4039
#include <Core/Algorithms/Legacy/Fields/DomainFields/SplitFieldByDomainAlgo.h>
4140
#include <Core/Algorithms/Legacy/Fields/ConvertMeshType/ConvertMeshToTriSurfMeshAlgo.h>
@@ -49,17 +48,13 @@
4948
#include <Core/Datatypes/Matrix.h>
5049
#include <Core/Datatypes/MatrixTypeConversions.h>
5150
#include <Core/Datatypes/MatrixComparison.h>
52-
#include <string>
53-
#include <boost/range/algorithm/count.hpp>
5451
#include <boost/lexical_cast.hpp>
5552
#include <boost/algorithm/string/trim.hpp>
5653
#include <boost/algorithm/string/split.hpp>
57-
#include <boost/algorithm/string/classification.hpp>
5854
#include <boost/format.hpp>
5955
#include <boost/assign.hpp>
6056
#include <math.h>
6157
#include <Core/Math/MiscMath.h>
62-
#include <iostream>
6358

6459
using namespace SCIRun::Core::Algorithms;
6560
using namespace SCIRun::Core::Algorithms::BrainStimulator;
@@ -129,7 +124,7 @@ ElectrodeCoilSetupAlgorithm::ElectrodeCoilSetupAlgorithm()
129124
}
130125

131126

132-
VariableHandle ElectrodeCoilSetupAlgorithm::fill_table(FieldHandle scalp, DenseMatrixHandle locations, const std::vector<FieldHandle>& input) const
127+
VariableHandle ElectrodeCoilSetupAlgorithm::fill_table(FieldHandle, DenseMatrixHandle locations, const std::vector<FieldHandle>&) const
133128
{
134129
Variable::List table;
135130
if (locations->ncols() != 3)
@@ -628,17 +623,17 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
628623
std::vector<double> field_values, field_values_elc_on_scalp;
629624
std::vector<int> valid_electrode_definition;
630625
FieldInformation fieldinfo("TriSurfMesh", CONSTANTDATA_E, "int");
631-
FieldHandle electrode_field = CreateField(fieldinfo);
632-
VMesh* tdcs_vmesh = electrode_field->vmesh();
633-
VField* tdcs_vfld = electrode_field->vfield();
626+
auto electrode_field = CreateField(fieldinfo);
627+
auto tdcs_vmesh = electrode_field->vmesh();
628+
auto tdcs_vfld = electrode_field->vfield();
634629
FieldInformation fieldinfo3("TriSurfMesh", CONSTANTDATA_E, "int");
635-
FieldHandle output = CreateField(fieldinfo3);
636-
VMesh* output_vmesh = output->vmesh();
637-
VField* output_vfld = output->vfield();
630+
auto output = CreateField(fieldinfo3);
631+
auto output_vmesh = output->vmesh();
632+
auto output_vfld = output->vfield();
638633
Variable::List new_table;
639634
DenseMatrixHandle elc_sponge_locations;
640635
auto tab_values = get(Parameters::TableValues).toVector();
641-
bool flip_normal = false;
636+
auto flip_normal = false;
642637
FlipSurfaceNormalsAlgo flipnormal_algo;
643638
ConvertMeshToTriSurfMeshAlgo conv_algo;
644639
FieldInformation scalp_info(scalp_mesh);
@@ -653,8 +648,8 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
653648

654649
if (tab_values.size() == elc_prototyp_map.size() && elc_thickness.size() == elc_prototyp_map.size() && elc_x.size() == elc_prototyp_map.size() && elc_y.size() == elc_prototyp_map.size() && elc_z.size() == elc_prototyp_map.size() && elc_angle_rotation.size() == elc_prototyp_map.size())
655650
{
656-
VMesh* scalp_vmesh = scalp->vmesh();
657-
VField* scalp_vfld = scalp->vfield();
651+
auto scalp_vmesh = scalp->vmesh();
652+
auto scalp_vfld = scalp->vfield();
658653
valid_electrode_definition.resize(elc_prototyp_map.size());
659654
for (int i = 0; i < elc_prototyp_map.size(); i++)
660655
{
@@ -667,7 +662,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
667662
}
668663

669664
double distance = 0;
670-
bool skip_current_iteration = false;
671665
VMesh::Node::index_type didx;
672666
Point elc(elc_x[i], elc_y[i], elc_z[i]), r;
673667
scalp_vmesh->synchronize(Mesh::NODE_LOCATE_E);
@@ -759,7 +753,7 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
759753

760754
for (int j = 0; j < fieldnodes->nrows(); j++)
761755
{
762-
DenseMatrixHandle pos_vec(boost::make_shared<DenseMatrix>(3, 1));
756+
auto pos_vec(boost::make_shared<DenseMatrix>(3, 1));
763757

764758
(*pos_vec)(0, 0) = (*fieldnodes)(j, 0);
765759
(*pos_vec)(1, 0) = (*fieldnodes)(j, 1);
@@ -872,7 +866,7 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
872866
SplitFieldByConnectedRegionAlgo algo_splitbyconnectedregion;
873867
algo_splitbyconnectedregion.set(SplitFieldByConnectedRegionAlgo::SortDomainBySize(), true);
874868
algo_splitbyconnectedregion.set(SplitFieldByConnectedRegionAlgo::SortAscending(), false);
875-
FieldList scalp_result = algo_splitbyconnectedregion.run(tmp_fld);
869+
auto scalp_result = algo_splitbyconnectedregion.run(tmp_fld);
876870

877871
FieldHandle small_scalp_surf;
878872

@@ -979,7 +973,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
979973
std::ostringstream ostr3;
980974
ostr3 << " Electrode sponge/scalp surface could not be found for " << i + 1 << ". electrode. Make sure that prototype encapsulated scalp!" << std::endl;
981975
remark(ostr3.str());
982-
skip_current_iteration = true;
983976
continue;
984977
}
985978

@@ -993,10 +986,10 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
993986
}
994987

995988
final_electrode_sponge_surf->vfield()->set_all_values(0.0); /// Precaution: set data values (defined at elements) to zero
996-
SplitFieldByConnectedRegionAlgo algo_splitbyconnectedregion;
997-
algo_splitbyconnectedregion.set(SplitFieldByConnectedRegionAlgo::SortDomainBySize(), true);
998-
algo_splitbyconnectedregion.set(SplitFieldByConnectedRegionAlgo::SortAscending(), false);
999-
result = algo_splitbyconnectedregion.run(final_electrode_sponge_surf);
989+
SplitFieldByConnectedRegionAlgo algo_splitbyconnectedregion_1;
990+
algo_splitbyconnectedregion_1.set(SplitFieldByConnectedRegionAlgo::SortDomainBySize(), true);
991+
algo_splitbyconnectedregion_1.set(SplitFieldByConnectedRegionAlgo::SortAscending(), false);
992+
result = algo_splitbyconnectedregion_1.run(final_electrode_sponge_surf);
1000993
}
1001994

1002995
}
@@ -1033,7 +1026,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
10331026
std::ostringstream ostr3;
10341027
ostr3 << " Electrode sponge/scalp surface could not be found for " << i + 1 << ". electrode. Make sure that prototype encapsulated scalp." << std::endl;
10351028
remark(ostr3.str());
1036-
skip_current_iteration = true;
10371029
continue;/// in that case go to the next electrode -> leave the for loop thats iterating over i
10381030
}
10391031

@@ -1056,7 +1048,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
10561048
std::ostringstream ostr3;
10571049
ostr3 << " Electrode sponge/scalp surface could not be found for " << i + 1 << ". electrode (after sdf binarization). Make sure that prototype encapsulates scalp." << std::endl;
10581050
remark(ostr3.str());
1059-
skip_current_iteration = true;
10601051
continue;/// in that case go to the next electrode -> leave the for loop thats iterating over
10611052
}
10621053

@@ -1075,7 +1066,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
10751066
std::ostringstream ostr3;
10761067
ostr3 << " Electrode sponge/scalp surface could not be found for " << i + 1 << ". electrode (conversion to constant data storage). Make sure that prototype encapsulates scalp." << std::endl;
10771068
remark(ostr3.str());
1078-
skip_current_iteration = true;
10791069
continue;/// in that case go to the next electrode -> leave the for loop thats iterating over i
10801070
}
10811071

@@ -1099,7 +1089,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
10991089
std::ostringstream ostr3;
11001090
ostr3 << " Electrode sponge/scalp surface could not be found for " << i + 1 << ". electrode (conversion to constant data storage). Make sure that prototype encapsulates scalp." << std::endl;
11011091
remark(ostr3.str());
1102-
skip_current_iteration = true;
11031092
continue;/// in that case go to the next electrode -> leave the for loop thats iterating over i
11041093
}
11051094

@@ -1148,8 +1137,8 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
11481137

11491138
for (int l = 0; l < result.size(); l++)
11501139
{
1151-
FieldHandle tmp_fld = result[l];
1152-
VMesh* tmp_fld_msh = tmp_fld->vmesh();
1140+
auto tmp_fld_1 = result[l];
1141+
auto tmp_fld_msh = tmp_fld_1->vmesh();
11531142

11541143
tmp_fld_msh->synchronize(Mesh::NODE_LOCATE_E);
11551144
tmp_fld_msh->find_closest_node(distance, p, didx, r);
@@ -1159,7 +1148,7 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
11591148
found_elc_surf = true;
11601149
scalp_vmesh->synchronize(Mesh::NORMALS_E);
11611150
Point q;
1162-
Vector norm;
1151+
Vector norm1;
11631152

11641153
/// create scalp/electrode sponge triangle nodes
11651154
for (VMesh::Node::index_type k = 0; k < tmp_fld_msh->num_nodes(); k++)
@@ -1174,8 +1163,8 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
11741163
{
11751164
tmp_fld_msh->get_center(p, k);
11761165
scalp_vmesh->find_closest_node(distance, q, didx, p);
1177-
scalp_vmesh->get_normal(norm, didx);
1178-
double x = norm.x(), y = norm.y(), z = norm.z();
1166+
scalp_vmesh->get_normal(norm1, didx);
1167+
double x = norm1.x(), y = norm1.y(), z = norm1.z();
11791168
double normal_mag = sqrt(x*x + y*y + z*z);
11801169
x /= normal_mag;
11811170
y /= normal_mag;
@@ -1198,8 +1187,8 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
11981187
bool scalp_elec_surf_needs_flipping = false;
11991188
if (scalp_vmesh->find_closest_node(distance, tmp, scalp_node_idx, r))
12001189
{
1201-
scalp_vmesh->get_normal(norm, scalp_node_idx);
1202-
double dot_product = Dot(norm, Vector(nx, ny, nz));
1190+
scalp_vmesh->get_normal(norm1, scalp_node_idx);
1191+
double dot_product = Dot(norm1, Vector(nx, ny, nz));
12031192
if (dot_product > 0)
12041193
{
12051194
scalp_elec_surf_needs_flipping = true;
@@ -1272,7 +1261,7 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
12721261
MatrixHandle mapping;
12731262
GetFieldBoundaryAlgo algo_getfldbnd;
12741263
FieldHandle boundary;
1275-
algo_getfldbnd.run(tmp_fld, boundary, mapping);
1264+
algo_getfldbnd.run(tmp_fld_1, boundary, mapping);
12761265
VMesh* boundary_msh = boundary->vmesh();
12771266
/// connect electrode sponge surfaces
12781267
if (boundary->vmesh()->is_curvemesh())
@@ -1341,7 +1330,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
13411330
std::ostringstream ostr3;
13421331
ostr3 << " tDCS electrode definition for " << i + 1 << ". row needs be a QuadSurf / TriSurf (with defined scalar or vectors data)." << std::endl;
13431332
remark(ostr3.str());
1344-
skip_current_iteration = true;
13451333
continue;
13461334
}
13471335

@@ -1352,7 +1340,7 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
13521340
{
13531341
output_vfld->resize_values();
13541342
output_vfld->set_values(field_values_elc_on_scalp);
1355-
elc_sponge_locations = boost::make_shared<DenseMatrix>(DenseMatrix::Zero(num_valid_electrode_definition, 4));
1343+
elc_sponge_locations.reset(new DenseMatrix(static_cast<size_t>(num_valid_electrode_definition), 4ul, 0.0));
13561344
int count = 0;
13571345
for (int j = 0; j < valid_electrode_definition.size(); j++)
13581346
{
@@ -1394,7 +1382,6 @@ boost::tuple<DenseMatrixHandle, FieldHandle, FieldHandle, VariableHandle> Electr
13941382

13951383
VariableHandle table2(new Variable(Name("Table"), new_table));
13961384
return boost::make_tuple(elc_sponge_locations, electrode_field, output, table2);
1397-
13981385
}
13991386

14001387
boost::tuple<VariableHandle, DenseMatrixHandle, FieldHandle, FieldHandle, FieldHandle> ElectrodeCoilSetupAlgorithm::run(const FieldHandle scalp, const DenseMatrixHandle locations, const std::vector<FieldHandle>& elc_coil_proto) const

src/Core/Algorithms/Math/SelectSubMatrix.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ MatrixHandle SelectSubMatrixAlgorithm::run(MatrixHandle input_matrix, const std:
283283
m=rows.size();
284284
for (size_t i=0; i<rows.size(); i++)
285285
{
286-
auto matrix_row = sparse_matrix->row(rows[i]);
287-
for (Eigen::SparseVector<double,Eigen::RowMajor, index_type>::InnerIterator it(matrix_row); it; ++it)
286+
Eigen::SparseVector<double> matrix_row = sparse_matrix->row(rows[i]);
287+
for (Eigen::SparseVector<double>::InnerIterator it(matrix_row); it; ++it)
288288
{
289289
additionalData[rows[i]][it.index()]=it.value();
290290
}
@@ -296,8 +296,8 @@ MatrixHandle SelectSubMatrixAlgorithm::run(MatrixHandle input_matrix, const std:
296296
n=cols.size();
297297
for (size_t j=0; j<cols.size(); j++)
298298
{
299-
auto matrix_col=sparse_matrix->col(cols[j]);
300-
for (Eigen::SparseVector<double,Eigen::RowMajor, index_type>::InnerIterator it(matrix_col); it; ++it)
299+
Eigen::SparseVector<double> matrix_col = sparse_matrix->col(cols[j]);
300+
for (Eigen::SparseVector<double>::InnerIterator it(matrix_col); it; ++it)
301301
{
302302
additionalData[it.index()][cols[j]]=it.value();
303303
}

src/Core/Algorithms/Math/SolveLinearSystemWithEigen.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828

29+
2930
#include <Core/Algorithms/Base/AlgorithmPreconditions.h>
3031
#include <Core/Algorithms/Math/SolveLinearSystemWithEigen.h>
3132
#include <Core/Datatypes/DenseMatrix.h>
@@ -42,6 +43,8 @@ using namespace SCIRun::Core;
4243

4344
namespace
4445
{
46+
using EigenComputationInfo = boost::error_info<struct tag_eigen_computation, Eigen::ComputationInfo>;
47+
4548
template <class ColumnMatrixType, template <typename> class SolverType>
4649
class SolveLinearSystemAlgorithmEigenCGImpl
4750
{

src/Core/Algorithms/Math/SolveLinearSystemWithEigen.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#define ALGORITHMS_MATH_SOLVELINEARSYSTEMWITHEIGEN_H
3131

3232
#include <Core/Algorithms/Base/AlgorithmBase.h>
33-
/// @todo: move
34-
#include <Eigen/src/Core/util/Constants.h>
3533
#include <Core/Algorithms/Math/share.h>
3634

3735
namespace SCIRun {
@@ -60,7 +58,7 @@ namespace Math {
6058
Out solve(const In& input, const Parameters& params) const;
6159
};
6260

63-
typedef boost::error_info<struct tag_eigen_computation, Eigen::ComputationInfo> EigenComputationInfo;
61+
6462

6563
}}}}
6664

src/Core/Datatypes/MatrixTypeConversions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ namespace Datatypes {
118118
{
119119
DenseColumnMatrixGeneric<T> dense_col(DenseColumnMatrixGeneric<T>::Zero(sparse->nrows()));
120120
for (auto i = 0; i < sparse->nrows(); i++)
121-
dense_col(i, 0) = sparse->coeff(i, 0);
121+
dense_col(i) = sparse->coeff(i, 0);
122122

123123
return boost::make_shared<DenseColumnMatrixGeneric<T>>(dense_col);
124124
}

0 commit comments

Comments
 (0)