Skip to content

Commit b16cde7

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents aedb44e + bdfa5ea commit b16cde7

29 files changed

+339
-233
lines changed

src/Core/Algorithms/Legacy/Fields/MeshData/FlipSurfaceNormals.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ AlgorithmOutput FlipSurfaceNormalsAlgo::run(const AlgorithmInput& input) const
4848
{
4949
auto input_field = input.get<Field>(Variables::InputField);
5050

51-
FieldHandle output_field = input_field;
51+
FieldHandle output_field(input_field->deep_clone());
5252
run(input_field,output_field);
5353

5454
AlgorithmOutput output;

src/Core/Algorithms/Legacy/Forward/BuildBEMatrixAlgo.cc

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,31 @@ void BuildBEMatrixBase::getOmega(
9090
Vector Ny( y1.length() , y2.length() , y3.length() );
9191

9292
Vector Nyij( y21.length() , y32.length() , y13.length() );
93-
94-
93+
9594
Vector gamma( 0 , 0 , 0 );
9695
double NomGamma , DenomGamma;
9796

9897
NomGamma = Ny[0]*Nyij[0] + Dot(y1,y21);
9998
DenomGamma = Ny[1]*Nyij[0] + Dot(y2,y21);
100-
if (fabs(DenomGamma-NomGamma) > epsilon && (DenomGamma != 0) && NomGamma != 0 )
99+
if (fabs(DenomGamma-NomGamma) > epsilon && (DenomGamma != 0) && NomGamma != 0 ){
101100
gamma[0] = -1/Nyij[0] * log(NomGamma/DenomGamma);
102-
101+
}
103102
NomGamma = Ny[1]*Nyij[1] + Dot(y2,y32);
104103
DenomGamma = Ny[2]*Nyij[1] + Dot(y3,y32);
105-
if (fabs(DenomGamma-NomGamma) > epsilon && (DenomGamma != 0) && NomGamma != 0 )
104+
if (fabs(DenomGamma-NomGamma) > epsilon && (DenomGamma != 0) && NomGamma != 0 ){
106105
gamma[1] = -1/Nyij[1] * log(NomGamma/DenomGamma);
107-
106+
}
108107
NomGamma = Ny[2]*Nyij[2] + Dot(y3,y13);
109108
DenomGamma = Ny[0]*Nyij[2] + Dot(y1,y13);
110-
if (fabs(DenomGamma-NomGamma) > epsilon && (DenomGamma != 0) && NomGamma != 0 )
109+
if (fabs(DenomGamma-NomGamma) > epsilon && (DenomGamma != 0) && NomGamma != 0 ){
111110
gamma[2] = -1/Nyij[2] * log(NomGamma/DenomGamma);
111+
}
112112

113113
double d = Dot( y1, Cross(y2, y3) );
114114

115115
Vector OmegaVec = (gamma[2]-gamma[0])*y1 + (gamma[0]-gamma[1])*y2 + (gamma[1]-gamma[2])*y3;
116+
117+
116118

117119
/*
118120
In order to avoid problems with the arctan used in de Muncks paper
@@ -127,6 +129,7 @@ void BuildBEMatrixBase::getOmega(
127129

128130
double Nn=0 , Omega=0 ;
129131
Nn = Ny[0]*Ny[1]*Ny[2] + Ny[0]*Dot(y2,y3) + Ny[2]*Dot(y1,y2) + Ny[1]*Dot(y3,y1);
132+
130133
if (Nn > 0) Omega = 2 * atan( d / Nn );
131134
if (Nn < 0) Omega = 2 * atan( d / Nn ) + 2*M_PI ;
132135
if (Nn == 0)
@@ -146,6 +149,7 @@ void BuildBEMatrixBase::getOmega(
146149
coef(0,0) = (1/A2) * ( Zn1*Omega + d * Dot(y32, OmegaVec) );
147150
coef(0,1) = (1/A2) * ( Zn2*Omega + d * Dot(y13, OmegaVec) );
148151
coef(0,2) = (1/A2) * ( Zn3*Omega + d * Dot(y21, OmegaVec) );
152+
149153
}
150154

151155
void BuildBEMatrixBase::get_cruse_weights(
@@ -737,6 +741,8 @@ template <class MatrixType>
737741
void BuildBEMatrixBaseCompute::make_auto_P_compute(VMesh* hsurf, MatrixType& auto_P, double in_cond, double out_cond, double op_cond)
738742
{
739743
auto nnodes = auto_P.rows();
744+
745+
740746

741747
//const double mult = 1/(2*M_PI)*((out_cond - in_cond)/op_cond); // op_cond=out_cond for all the surfaces but the outermost surface which in op_cond=in_cond
742748
const double mult = 1/(4*M_PI)*(out_cond - in_cond);
@@ -756,14 +762,15 @@ void BuildBEMatrixBaseCompute::make_auto_P_compute(VMesh* hsurf, MatrixType& aut
756762
Point pp = hsurf->get_point(ppi);
757763

758764
hsurf->begin(fi); hsurf->end(fie);
765+
759766
for (; fi != fie; ++fi) { //! find contributions from every triangle
760767

761768
hsurf->get_nodes(nodes, *fi);
762769
if (ppi!=nodes[0] && ppi!=nodes[1] && ppi!=nodes[2]){
763770
Vector v1 = hsurf->get_point(nodes[0]) - pp;
764771
Vector v2 = hsurf->get_point(nodes[1]) - pp;
765772
Vector v3 = hsurf->get_point(nodes[2]) - pp;
766-
773+
767774
getOmega(v1, v2, v3, coef);
768775

769776
for (i=0; i<3; ++i)
@@ -1099,7 +1106,7 @@ MatrixHandle SurfaceToSurface::compute(const bemfield_vector& fields) const
10991106
else
11001107
{
11011108
auto block = EE.blockRef(i, j);
1102-
make_cross_P_compute(fields[i].field_->vmesh(), fields[j].field_->vmesh(), block, fields[i].insideconductivity, fields[i].outsideconductivity, op_cond);
1109+
make_cross_P_compute(fields[i].field_->vmesh(), fields[j].field_->vmesh(), block, fields[j].insideconductivity, fields[j].outsideconductivity, op_cond);
11031110
}
11041111
}
11051112
}
@@ -1130,27 +1137,24 @@ MatrixHandle SurfaceToSurface::compute(const bemfield_vector& fields) const
11301137
if (i == sourcefieldindices[j])
11311138
{
11321139
auto block = EJ.blockRef(i,j);
1133-
//std::cout << "EJ block auto " << i << "," << j << " is size " << block.rows() << " x " << block.cols() /*<< " starting at " << blockStartsEE[i] << "," << blockStartsEJ[j]*/ << std::endl;
1134-
11351140
make_auto_G_compute(fields[i].field_->vmesh(), block, fields[i].insideconductivity, fields[i].outsideconductivity, op_cond, triangleareas);
11361141
}
11371142
else
11381143
{
11391144
auto block = EJ.blockRef(i,j);
1140-
//std::cout << "EJ block cross " << i << "," << j << " is size " << block.rows() << " x " << block.cols()/* << " starting at " << blockStartsEE[i] << "," << blockStartsEJ[j]*/ << std::endl;
1141-
1142-
make_cross_G_compute(fields[i].field_->vmesh(), fields[sourcefieldindices[j]].field_->vmesh(), block, fields[i].insideconductivity, fields[i].outsideconductivity, op_cond, triangleareas);
1145+
make_cross_G_compute(fields[i].field_->vmesh(), fields[sourcefieldindices[j]].field_->vmesh(), block, fields[j].insideconductivity, fields[j].outsideconductivity, op_cond, triangleareas);
11431146
}
11441147
}
11451148
}
11461149

11471150
printInfo(EJ.matrix(), "EJ");
11481151

1152+
// This needs to be checked. It was taken out because the deflation was producing errors
1153+
// Jeroen's matlab code, which was the basis of this code, only does a defation in test cases.
1154+
11491155
// Perform deflation on EE matrix
1150-
const double deflationconstant = 1.0/EE.matrix().ncols();
1151-
EE.matrix() = EE.matrix().array() + deflationconstant;
1152-
1153-
printInfo(EE.matrix(), "EE after deflation");
1156+
//const double deflationconstant = 1.0/EE.matrix().ncols();
1157+
//EE.matrix() = EE.matrix().array() + deflationconstant;
11541158

11551159
std::vector<int> measurementNodeSize(measurementfieldindices.size());
11561160
auto measFields = fields | boost::adaptors::filtered([](const bemfield& f) { return f.measurement; });

src/Core/Datatypes/Color.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ namespace Datatypes {
8181
struct SCISHARE ViewSceneFeedback : ModuleFeedback
8282
{
8383
Geometry::Transform transform;
84+
std::string selectionName;
8485
};
8586

8687
}}}

src/Dataflow/Network/Module.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,3 +964,10 @@ void Module::sendFeedbackUpstreamAlongIncomingConnections(const ModuleFeedback&
964964
}
965965
}
966966
}
967+
968+
std::string Module::helpPageUrl() const
969+
{
970+
auto url = "http://scirundocwiki.sci.utah.edu/SCIRunDocs/index.php/CIBC:Documentation:SCIRun:Reference:"
971+
+ legacyPackageName() + ":" + get_module_name();
972+
return url;
973+
}

src/Dataflow/Network/Module.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ namespace Networks {
6868
std::string get_packagename() const { return info_.package_name_; }
6969
ModuleId get_id() const override { return id_; }
7070

71+
virtual std::string helpPageUrl() const override;
72+
7173
//for serialization
7274
virtual const ModuleLookupInfo& get_info() const override final { return info_; }
7375
virtual void set_id(const std::string& id) override final;
@@ -110,6 +112,10 @@ namespace Networks {
110112
virtual std::vector<Core::Datatypes::DatatypeHandleOption> get_dynamic_input_handles(const PortId& id) override final;
111113
protected:
112114
virtual void send_output_handle(const PortId& id, Core::Datatypes::DatatypeHandle data) override final;
115+
116+
// override this for modules that changed packages, to point to correct wiki page
117+
virtual std::string legacyPackageName() const { return get_packagename(); }
118+
113119
public:
114120
virtual void setLogger(Core::Logging::LoggerHandle log) override final;
115121
virtual Core::Logging::LoggerHandle getLogger() const override final;
@@ -1010,6 +1016,8 @@ namespace Modules
10101016
return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name(), ModuleType::outputPort4Name(), ModuleType::outputPort5Name(), ModuleType::outputPort6Name(), ModuleType::outputPort7Name(), ModuleType::outputPort8Name());
10111017
}
10121018
};
1019+
1020+
#define LEGACY_BIOPSE_MODULE protected: virtual std::string legacyPackageName() const override { return "BioPSE"; }
10131021
}
10141022
}
10151023

src/Dataflow/Network/ModuleInterface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ namespace Networks {
7878
virtual bool has_ui() const = 0;
7979
virtual const ModuleLookupInfo& get_info() const = 0;
8080
virtual bool hasDynamicPorts() const = 0;
81+
82+
virtual std::string helpPageUrl() const = 0;
8183
};
8284

8385
class SCISHARE ModuleDisplayInterface

src/Dataflow/Network/PortManager.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,16 @@ PortManager<T>::add(const T& item)
122122
portPair.second->incrementIndex();
123123
}
124124

125-
for (const auto& portPair : ports_)
126-
{
127-
DYNAMIC_PORT_LOG(std::cout << "\t id " << portPair.second->id().toString() << " index after setting " << portPair.second->getIndex() << std::endl);
128-
}
125+
126+
DYNAMIC_PORT_LOG(for (const auto& portPair : ports_) std::cout << "\t id " << portPair.second->id().toString() << " index after setting " << portPair.second->getIndex() << std::endl;);
129127

130128
return newPortIndex;
131129
}
132130
}
133-
if (item->isDynamic())
134-
{
135-
DYNAMIC_PORT_LOG(std::cout << "original port: " << item->id().toString() << " newIndex: " << size() - 1 << std::endl);
136-
}
131+
132+
133+
DYNAMIC_PORT_LOG(if (item->isDynamic()) std::cout << "original port: " << item->id().toString() << " newIndex: " << size() - 1 << std::endl;);
134+
137135
return size() - 1;
138136
}
139137

@@ -147,10 +145,7 @@ PortManager<T>::lastIndexByName(const std::string& name) const
147145
return -1;
148146

149147
DYNAMIC_PORT_LOG(std::cout << name << " Input port object indexes:\n");
150-
for (const auto& input : matches)
151-
{
152-
DYNAMIC_PORT_LOG(std::cout << input->id() << " " << input->id().name << " " << input->getIndex() << std::endl);
153-
}
148+
DYNAMIC_PORT_LOG(for (const auto& input : matches) std::cout << input->id() << " " << input->id().name << " " << input->getIndex() << std::endl;);
154149

155150
return static_cast<int>((*std::max_element(matches.begin(), matches.end(), [](const T& port1, const T& port2) { return port1->getIndex() < port2->getIndex(); }))->getIndex());
156151
}

src/Dataflow/Network/Tests/MockModule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ namespace SCIRun {
6767
MOCK_CONST_METHOD0(has_ui, bool());
6868
MOCK_CONST_METHOD0(hasDynamicPorts, bool());
6969
MOCK_CONST_METHOD0(metadata, const MetadataMap&());
70+
MOCK_CONST_METHOD0(helpPageUrl, std::string());
7071
MOCK_METHOD1(setUiVisible, void(bool));
7172
MOCK_METHOD1(set_id, void(const std::string&));
7273
MOCK_CONST_METHOD0(get_info, const ModuleLookupInfo&());
59.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)